uview-plus 3.7.36 → 3.8.18
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/README.md +0 -1
- package/changelog.md +1993 -1820
- package/components/u-action-sheet/u-action-sheet.vue +54 -16
- package/components/u-agreement/u-agreement.vue +2 -1
- package/components/u-alert/u-alert.vue +8 -10
- package/components/u-button/u-button.vue +35 -5
- package/components/u-calendar/calendar.js +1 -0
- package/components/u-calendar/header.vue +98 -9
- package/components/u-calendar/month.vue +10 -7
- package/components/u-calendar/props.js +5 -0
- package/components/u-calendar/u-calendar.vue +109 -2
- package/components/u-car-keyboard/u-car-keyboard.vue +7 -7
- package/components/u-card/u-card.vue +6 -6
- package/components/u-cascader/u-cascader.vue +32 -12
- package/components/u-cate-tab/u-cate-tab.vue +49 -48
- package/components/u-cell/u-cell.vue +24 -4
- package/components/u-cell-group/u-cell-group.vue +10 -3
- package/components/u-checkbox/u-checkbox.vue +6 -6
- package/components/u-choose/u-choose.vue +9 -4
- package/components/u-city-locate/u-city-locate.vue +28 -22
- package/components/u-color-picker/u-color-picker.vue +15 -15
- package/components/u-datetime-picker/u-datetime-picker.vue +79 -10
- package/components/u-dragsort/u-dragsort.vue +3 -0
- package/components/u-dropdown/u-dropdown.vue +15 -2
- package/components/u-dropdown-item/u-dropdown-item.vue +3 -3
- package/components/u-form-item/u-form-item.vue +6 -1
- package/components/u-gap/u-gap.vue +5 -1
- package/components/u-goods-sku/u-goods-sku.vue +16 -15
- package/components/u-index-anchor/u-index-anchor.vue +13 -2
- package/components/u-index-list/u-index-list.vue +18 -5
- package/components/u-input/input.js +3 -3
- package/components/u-input/u-input.vue +27 -5
- package/components/u-keyboard/u-keyboard.vue +11 -6
- package/components/u-loading-page/loadingPage.js +1 -1
- package/components/u-loading-page/u-loading-page.vue +18 -12
- package/components/u-navbar/navbar.js +2 -3
- package/components/u-navbar/theme-vars.scss +21 -0
- package/components/u-navbar/u-navbar.vue +30 -6
- package/components/u-notice-bar/theme-vars.scss +25 -0
- package/components/u-notice-bar/u-notice-bar.vue +24 -5
- package/components/u-number-box/numberBox.js +4 -4
- package/components/u-number-box/u-number-box.vue +27 -13
- package/components/u-number-keyboard/u-number-keyboard.vue +6 -6
- package/components/u-picker/picker.js +43 -43
- package/components/u-picker/u-picker.vue +14 -2
- package/components/u-popup/popup.js +1 -1
- package/components/u-popup/u-popup.vue +14 -6
- package/components/u-pull-refresh/u-pull-refresh.vue +6 -6
- package/components/u-radio/u-radio.vue +6 -6
- package/components/u-rate/rate.js +2 -2
- package/components/u-rate/u-rate.vue +98 -21
- package/components/u-search/search.js +3 -3
- package/components/u-search/u-search.vue +29 -6
- package/components/u-select/u-select.vue +141 -73
- package/components/u-signature/u-signature.vue +35 -16
- package/components/u-skeleton/u-skeleton.vue +7 -2
- package/components/u-slider/u-slider.vue +30 -31
- package/components/u-steps-item/u-steps-item.vue +20 -17
- package/components/u-subsection/theme-vars.scss +41 -0
- package/components/u-subsection/u-subsection.vue +69 -16
- package/components/u-swipe-action-item/u-swipe-action-item.vue +11 -5
- package/components/u-switch/theme-vars.scss +41 -0
- package/components/u-switch/u-switch.vue +44 -15
- package/components/u-tabbar/u-tabbar.vue +5 -5
- package/components/u-tabbar-item/u-tabbar-item.vue +16 -5
- package/components/u-table/u-table.vue +18 -3
- package/components/u-table2/tableRow.vue +43 -41
- package/components/u-table2/u-table2.vue +56 -50
- package/components/u-tabs/u-tabs.vue +14 -1
- package/components/u-tag/theme-vars.scss +21 -0
- package/components/u-tag/u-tag.vue +17 -7
- package/components/u-td/u-td.vue +5 -3
- package/components/u-text/text.js +1 -1
- package/components/u-text/u-text.vue +15 -13
- package/components/u-textarea/props.js +2 -2
- package/components/u-textarea/textarea.js +1 -1
- package/components/u-textarea/u-textarea.vue +115 -61
- package/components/u-th/u-th.vue +5 -4
- package/components/u-title/u-title.vue +1 -0
- package/components/u-toast/u-toast.vue +8 -8
- package/components/u-tree/u-tree.vue +491 -51
- package/components/u-upload/u-upload.vue +34 -6
- package/index.js +178 -27
- package/index.scss +5 -1
- package/libs/config/color.js +1 -2
- package/libs/config/props.js +1 -1
- package/libs/css/theme-vars-core.scss +197 -0
- package/libs/css/theme-vars.scss +1 -0
- package/libs/function/index.js +7 -7
- package/libs/mixin/mixin.js +111 -4
- package/libs/root/index.js +175 -0
- package/libs/root/nvue-root.vue +72 -0
- package/libs/root/page.js +269 -0
- package/libs/root/root-toast-host.vue +31 -0
- package/libs/root/root.js +40 -0
- package/libs/root/runtime.js +11 -0
- package/libs/root/utils.js +115 -0
- package/libs/theme/runtime.js +391 -0
- package/libs/theme/theme.js +684 -0
- package/libs/util/gcanvas/bridge/bridge-weex.js +0 -0
- package/libs/util/gcanvas/context-2d/FillStyleLinearGradient.js +0 -0
- package/libs/util/gcanvas/context-2d/FillStylePattern.js +0 -0
- package/libs/util/gcanvas/context-2d/FillStyleRadialGradient.js +0 -0
- package/libs/util/gcanvas/context-2d/RenderingContext.js +0 -0
- package/libs/util/gcanvas/context-webgl/ActiveInfo.js +0 -0
- package/libs/util/gcanvas/context-webgl/Buffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/Framebuffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLenum.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLmethod.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLtype.js +0 -0
- package/libs/util/gcanvas/context-webgl/Program.js +0 -0
- package/libs/util/gcanvas/context-webgl/Renderbuffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/RenderingContext.js +0 -0
- package/libs/util/gcanvas/context-webgl/Shader.js +0 -0
- package/libs/util/gcanvas/context-webgl/ShaderPrecisionFormat.js +0 -0
- package/libs/util/gcanvas/context-webgl/Texture.js +0 -0
- package/libs/util/gcanvas/context-webgl/UniformLocation.js +0 -0
- package/libs/util/gcanvas/context-webgl/classUtils.js +0 -0
- package/libs/util/gcanvas/env/canvas.js +0 -0
- package/libs/util/gcanvas/env/image.js +0 -0
- package/libs/util/gcanvas/env/tool.js +0 -0
- package/libs/util/gcanvas/index.js +0 -0
- package/package.json +3 -2
- package/theme.scss +113 -32
- package/types/index.d.ts +41 -2
package/index.js
CHANGED
|
@@ -43,6 +43,95 @@ import fontUtil from './components/u-icon/util.js';
|
|
|
43
43
|
|
|
44
44
|
// i18n
|
|
45
45
|
import i18n, { t } from './libs/i18n/index.js'
|
|
46
|
+
import {
|
|
47
|
+
themeState,
|
|
48
|
+
setTheme,
|
|
49
|
+
setThemePreference,
|
|
50
|
+
getThemePreference,
|
|
51
|
+
getSystemTheme,
|
|
52
|
+
getThemeVars,
|
|
53
|
+
initThemeSystem,
|
|
54
|
+
refreshThemeFromConfig,
|
|
55
|
+
syncThemeColorOverrideState
|
|
56
|
+
} from './libs/theme/theme.js'
|
|
57
|
+
import {
|
|
58
|
+
applyNativeThemeUI,
|
|
59
|
+
getThemeCardStyle,
|
|
60
|
+
getThemeIsDark,
|
|
61
|
+
getThemePageStyle,
|
|
62
|
+
getThemeTabBarStyle,
|
|
63
|
+
getThemeVar,
|
|
64
|
+
getThemeVarsForStyle
|
|
65
|
+
} from './libs/theme/runtime.js'
|
|
66
|
+
|
|
67
|
+
const rootToastState = {
|
|
68
|
+
ref: null
|
|
69
|
+
}
|
|
70
|
+
const rootNotifyState = {
|
|
71
|
+
ref: null
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function normalizeRootToastOptions(options = {}) {
|
|
75
|
+
const toastOptions = typeof options === 'string'
|
|
76
|
+
? { message: options }
|
|
77
|
+
: (options && typeof options === 'object' ? { ...options } : {})
|
|
78
|
+
if (!toastOptions.message && toastOptions.title) {
|
|
79
|
+
toastOptions.message = toastOptions.title
|
|
80
|
+
}
|
|
81
|
+
return toastOptions
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function setRootToastRef(ref = null) {
|
|
85
|
+
rootToastState.ref = ref || null
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function rootToast(options = {}) {
|
|
89
|
+
const toastOptions = normalizeRootToastOptions(options)
|
|
90
|
+
const toastRef = rootToastState.ref
|
|
91
|
+
if (toastRef && typeof toastRef.show === 'function') {
|
|
92
|
+
toastRef.show(toastOptions)
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
if (!toastOptions.message) return
|
|
96
|
+
if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
|
|
97
|
+
uni.showToast({
|
|
98
|
+
title: toastOptions.message,
|
|
99
|
+
icon: 'none',
|
|
100
|
+
duration: Number(toastOptions.duration) || 2000,
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function normalizeRootNotifyOptions(options = {}) {
|
|
106
|
+
const notifyOptions = typeof options === 'string'
|
|
107
|
+
? { message: options }
|
|
108
|
+
: (options && typeof options === 'object' ? { ...options } : {})
|
|
109
|
+
if (!notifyOptions.message && notifyOptions.title) {
|
|
110
|
+
notifyOptions.message = notifyOptions.title
|
|
111
|
+
}
|
|
112
|
+
return notifyOptions
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function setRootNotifyRef(ref = null) {
|
|
116
|
+
rootNotifyState.ref = ref || null
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function rootNotify(options = {}) {
|
|
120
|
+
const notifyOptions = normalizeRootNotifyOptions(options)
|
|
121
|
+
const notifyRef = rootNotifyState.ref
|
|
122
|
+
if (notifyRef && typeof notifyRef.show === 'function') {
|
|
123
|
+
notifyRef.show(notifyOptions)
|
|
124
|
+
return
|
|
125
|
+
}
|
|
126
|
+
if (!notifyOptions.message) return
|
|
127
|
+
if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
|
|
128
|
+
uni.showToast({
|
|
129
|
+
title: notifyOptions.message,
|
|
130
|
+
icon: 'none',
|
|
131
|
+
duration: Number(notifyOptions.duration) || 3000,
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
}
|
|
46
135
|
|
|
47
136
|
// 导出
|
|
48
137
|
let themeType = ['primary', 'success', 'error', 'warning', 'info'];
|
|
@@ -58,10 +147,21 @@ export * from './libs/function/colorGradient.js'
|
|
|
58
147
|
* @param {object} zIndex 修改内置zIndex属性
|
|
59
148
|
*/
|
|
60
149
|
export function setConfig(configs) {
|
|
61
|
-
|
|
62
|
-
index.shallowMerge(
|
|
63
|
-
index.shallowMerge(
|
|
64
|
-
index.shallowMerge(
|
|
150
|
+
const settings = configs || {}
|
|
151
|
+
index.shallowMerge(config, settings.config || {})
|
|
152
|
+
index.shallowMerge(props, settings.props || {})
|
|
153
|
+
index.shallowMerge(color, settings.color || {})
|
|
154
|
+
index.shallowMerge(zIndex, settings.zIndex || {})
|
|
155
|
+
syncThemeColorOverrideState({
|
|
156
|
+
color: settings.color,
|
|
157
|
+
configColor: settings?.config?.color
|
|
158
|
+
})
|
|
159
|
+
const shouldRefreshTheme = !!settings.color
|
|
160
|
+
|| !!settings?.config?.color
|
|
161
|
+
|| themeState.version > 0
|
|
162
|
+
if (shouldRefreshTheme) {
|
|
163
|
+
refreshThemeFromConfig()
|
|
164
|
+
}
|
|
65
165
|
}
|
|
66
166
|
index.setConfig = setConfig
|
|
67
167
|
|
|
@@ -85,11 +185,59 @@ const $u = {
|
|
|
85
185
|
// props,
|
|
86
186
|
...index,
|
|
87
187
|
color,
|
|
88
|
-
platform
|
|
188
|
+
platform,
|
|
189
|
+
theme: themeState,
|
|
190
|
+
setTheme,
|
|
191
|
+
setThemePreference,
|
|
192
|
+
getThemePreference,
|
|
193
|
+
getSystemTheme,
|
|
194
|
+
getThemeVars,
|
|
195
|
+
getThemeTabBarStyle,
|
|
196
|
+
applyNativeThemeUI,
|
|
197
|
+
rootToast,
|
|
198
|
+
setRootToastRef,
|
|
199
|
+
rootNotify,
|
|
200
|
+
setRootNotifyRef
|
|
89
201
|
}
|
|
90
202
|
|
|
91
203
|
export const mount$u = function() {
|
|
92
204
|
uni.$u = $u
|
|
205
|
+
initThemeSystem()
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function defineGlobalThemeHelpers(Vue) {
|
|
209
|
+
const globalProperties = Vue?.config?.globalProperties
|
|
210
|
+
if (!globalProperties) return
|
|
211
|
+
Object.defineProperty(globalProperties, 'upThemeIsDark', {
|
|
212
|
+
configurable: true,
|
|
213
|
+
get() {
|
|
214
|
+
return getThemeIsDark()
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
Object.defineProperty(globalProperties, 'upThemeVars', {
|
|
218
|
+
configurable: true,
|
|
219
|
+
get() {
|
|
220
|
+
return getThemeVarsForStyle()
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
Object.defineProperty(globalProperties, 'upThemePageStyle', {
|
|
224
|
+
configurable: true,
|
|
225
|
+
get() {
|
|
226
|
+
return getThemePageStyle()
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
Object.defineProperty(globalProperties, 'upThemeCardStyle', {
|
|
230
|
+
configurable: true,
|
|
231
|
+
get() {
|
|
232
|
+
return getThemeCardStyle()
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
globalProperties.upThemeVar = function(varName, fallbackColor) {
|
|
236
|
+
return getThemeVar(varName, fallbackColor)
|
|
237
|
+
}
|
|
238
|
+
globalProperties.upApplyNativeThemeUI = function() {
|
|
239
|
+
return applyNativeThemeUI()
|
|
240
|
+
}
|
|
93
241
|
}
|
|
94
242
|
|
|
95
243
|
function toCamelCase(str) {
|
|
@@ -100,27 +248,27 @@ function toCamelCase(str) {
|
|
|
100
248
|
});
|
|
101
249
|
}
|
|
102
250
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
components.push(component);
|
|
251
|
+
let components = []
|
|
252
|
+
|
|
253
|
+
function resolveComponents() {
|
|
254
|
+
if (components.length) return components
|
|
255
|
+
// #ifdef H5
|
|
256
|
+
const canUseGlob = typeof import.meta !== 'undefined' && typeof import.meta.glob === 'function'
|
|
257
|
+
if (!canUseGlob) return components
|
|
258
|
+
const importFn = import.meta.glob('./components/u-*/u-*.vue', { eager: true })
|
|
259
|
+
for (const key in importFn) {
|
|
260
|
+
const component = importFn[key]?.default
|
|
261
|
+
if (component?.name && component.name.indexOf('u--') !== 0) {
|
|
262
|
+
components.push(component)
|
|
263
|
+
}
|
|
117
264
|
}
|
|
265
|
+
// #endif
|
|
266
|
+
return components
|
|
118
267
|
}
|
|
119
|
-
// #endif
|
|
120
268
|
|
|
121
269
|
const install = (Vue, upuiParams = '') => {
|
|
122
|
-
// #ifdef
|
|
123
|
-
|
|
270
|
+
// #ifdef H5
|
|
271
|
+
resolveComponents().forEach(function(component) {
|
|
124
272
|
const name = component.name.replace(/u-([a-zA-Z0-9-_]+)/g, 'up-$1');
|
|
125
273
|
if (name != component.name) {
|
|
126
274
|
Vue.component(component.name, component);
|
|
@@ -144,12 +292,15 @@ const install = (Vue, upuiParams = '') => {
|
|
|
144
292
|
// 同时挂载到uni和Vue.prototype中
|
|
145
293
|
// $u挂载到uni对象上
|
|
146
294
|
uni.$u = $u
|
|
295
|
+
initThemeSystem()
|
|
147
296
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
297
|
+
if (Vue && Vue.config && Vue.config.globalProperties) {
|
|
298
|
+
Vue.config.globalProperties.$u = $u
|
|
299
|
+
defineGlobalThemeHelpers(Vue)
|
|
300
|
+
}
|
|
301
|
+
if (Vue && typeof Vue.mixin === 'function') {
|
|
302
|
+
Vue.mixin(mixin)
|
|
303
|
+
}
|
|
153
304
|
}
|
|
154
305
|
|
|
155
306
|
export default {
|
package/index.scss
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/* #ifndef APP-NVUE */
|
|
2
|
+
@import "./libs/css/theme-vars.scss";
|
|
3
|
+
/* #endif */
|
|
4
|
+
|
|
1
5
|
// 引入公共基础类
|
|
2
6
|
@import "./libs/css/common.scss";
|
|
3
7
|
@import "./libs/css/components.scss";
|
|
@@ -22,4 +26,4 @@
|
|
|
22
26
|
// H5特有的样式
|
|
23
27
|
/* #ifdef H5 */
|
|
24
28
|
@import "./libs/css/h5.scss";
|
|
25
|
-
/* #endif */
|
|
29
|
+
/* #endif */
|
package/libs/config/color.js
CHANGED
package/libs/config/props.js
CHANGED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
page,
|
|
3
|
+
body {
|
|
4
|
+
--up-main-color: var(--up-light-main-color, #303133);
|
|
5
|
+
--up-content-color: var(--up-light-content-color, #606266);
|
|
6
|
+
--up-tips-color: var(--up-light-tips-color, #909193);
|
|
7
|
+
--up-light-color: var(--up-light-light-color, #c0c4cc);
|
|
8
|
+
--up-border-color: var(--up-light-border-color, #dadbde);
|
|
9
|
+
--up-bg-color: var(--up-light-bg-color, #f3f4f6);
|
|
10
|
+
--up-hover-bg-color: #e7ebf0;
|
|
11
|
+
--up-page-bg-color: #f3f4f6;
|
|
12
|
+
--up-card-bg-color: #ffffff;
|
|
13
|
+
--up-disabled-color: var(--up-light-disabled-color, #c8c9cc);
|
|
14
|
+
|
|
15
|
+
--up-primary: var(--up-light-primary, #3c9cff);
|
|
16
|
+
--up-primary-dark: var(--up-light-primary-dark, #398ade);
|
|
17
|
+
--up-primary-disabled: var(--up-light-primary-disabled, #9acafc);
|
|
18
|
+
--up-primary-light: var(--up-light-primary-light, #ecf5ff);
|
|
19
|
+
|
|
20
|
+
--up-warning: var(--up-light-warning, #f9ae3d);
|
|
21
|
+
--up-warning-dark: var(--up-light-warning-dark, #f1a532);
|
|
22
|
+
--up-warning-disabled: var(--up-light-warning-disabled, #f9d39b);
|
|
23
|
+
--up-warning-light: var(--up-light-warning-light, #fdf6ec);
|
|
24
|
+
|
|
25
|
+
--up-success: var(--up-light-success, #5ac725);
|
|
26
|
+
--up-success-dark: var(--up-light-success-dark, #53c21d);
|
|
27
|
+
--up-success-disabled: var(--up-light-success-disabled, #a9e08f);
|
|
28
|
+
--up-success-light: var(--up-light-success-light, #f5fff0);
|
|
29
|
+
|
|
30
|
+
--up-error: var(--up-light-error, #f56c6c);
|
|
31
|
+
--up-error-dark: var(--up-light-error-dark, #e45656);
|
|
32
|
+
--up-error-disabled: var(--up-light-error-disabled, #f7b2b2);
|
|
33
|
+
--up-error-light: var(--up-light-error-light, #fef0f0);
|
|
34
|
+
|
|
35
|
+
--up-info: var(--up-light-info, #909399);
|
|
36
|
+
--up-info-dark: var(--up-light-info-dark, #767a82);
|
|
37
|
+
--up-info-disabled: var(--up-light-info-disabled, #c4c6c9);
|
|
38
|
+
--up-info-light: var(--up-light-info-light, #f4f4f5);
|
|
39
|
+
|
|
40
|
+
--up-table2-header-bg-color: #f5f7fa;
|
|
41
|
+
--up-table2-zebra-bg-color: #fafafa;
|
|
42
|
+
--up-table2-highlight-bg-color: #f5f7fa;
|
|
43
|
+
--up-gap-bg-color: #f3f4f6;
|
|
44
|
+
--up-skeleton-bg-color: #f1f2f4;
|
|
45
|
+
--up-skeleton-shimmer-color: #e6e6e6;
|
|
46
|
+
--up-swipe-action-button-bg-color: #c7c6cd;
|
|
47
|
+
--up-index-list-indicator-bg-color: #c9c9c9;
|
|
48
|
+
--up-calendar-month-mark-color: rgba(231, 232, 234, 0.83);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@media (prefers-color-scheme: dark) {
|
|
52
|
+
:root,
|
|
53
|
+
page,
|
|
54
|
+
body {
|
|
55
|
+
--up-main-color: #f5f5f5;
|
|
56
|
+
--up-content-color: #d1d5db;
|
|
57
|
+
--up-tips-color: #9ca3af;
|
|
58
|
+
--up-light-color: #6b7280;
|
|
59
|
+
--up-border-color: #3a3a3c;
|
|
60
|
+
--up-bg-color: #1f1f1f;
|
|
61
|
+
--up-hover-bg-color: #343741;
|
|
62
|
+
--up-page-bg-color: #1f1f1f;
|
|
63
|
+
--up-card-bg-color: #1c1c1e;
|
|
64
|
+
--up-disabled-color: #4b5563;
|
|
65
|
+
|
|
66
|
+
--up-primary: #3c9cff;
|
|
67
|
+
--up-primary-dark: #5aa8ff;
|
|
68
|
+
--up-primary-disabled: #4c6f92;
|
|
69
|
+
--up-primary-light: #10243a;
|
|
70
|
+
|
|
71
|
+
--up-warning: #f9ae3d;
|
|
72
|
+
--up-warning-dark: #ffbf66;
|
|
73
|
+
--up-warning-disabled: #8a6a3a;
|
|
74
|
+
--up-warning-light: #3d2f1b;
|
|
75
|
+
|
|
76
|
+
--up-success: #5ac725;
|
|
77
|
+
--up-success-dark: #7ad94b;
|
|
78
|
+
--up-success-disabled: #5f7f4f;
|
|
79
|
+
--up-success-light: #1f3316;
|
|
80
|
+
|
|
81
|
+
--up-error: #f56c6c;
|
|
82
|
+
--up-error-dark: #ff8a8a;
|
|
83
|
+
--up-error-disabled: #8d5858;
|
|
84
|
+
--up-error-light: #3a2222;
|
|
85
|
+
|
|
86
|
+
--up-info: #909399;
|
|
87
|
+
--up-info-dark: #b0b3b8;
|
|
88
|
+
--up-info-disabled: #5f6368;
|
|
89
|
+
--up-info-light: #2f3238;
|
|
90
|
+
|
|
91
|
+
--up-table2-header-bg-color: #2a2d33;
|
|
92
|
+
--up-table2-zebra-bg-color: #23262b;
|
|
93
|
+
--up-table2-highlight-bg-color: #2f3440;
|
|
94
|
+
--up-gap-bg-color: #111111;
|
|
95
|
+
--up-skeleton-bg-color: #2f3135;
|
|
96
|
+
--up-skeleton-shimmer-color: rgba(255, 255, 255, 0.12);
|
|
97
|
+
--up-swipe-action-button-bg-color: #4b5563;
|
|
98
|
+
--up-index-list-indicator-bg-color: #4b5563;
|
|
99
|
+
--up-calendar-month-mark-color: rgba(255, 255, 255, 0.04);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[data-up-theme='light'] {
|
|
104
|
+
--up-main-color: var(--up-light-main-color, #303133);
|
|
105
|
+
--up-content-color: var(--up-light-content-color, #606266);
|
|
106
|
+
--up-tips-color: var(--up-light-tips-color, #909193);
|
|
107
|
+
--up-light-color: var(--up-light-light-color, #c0c4cc);
|
|
108
|
+
--up-border-color: var(--up-light-border-color, #dadbde);
|
|
109
|
+
--up-bg-color: var(--up-light-bg-color, #f3f4f6);
|
|
110
|
+
--up-hover-bg-color: #e7ebf0;
|
|
111
|
+
--up-page-bg-color: #f3f4f6;
|
|
112
|
+
--up-card-bg-color: #ffffff;
|
|
113
|
+
--up-disabled-color: var(--up-light-disabled-color, #c8c9cc);
|
|
114
|
+
|
|
115
|
+
--up-primary: var(--up-light-primary, #3c9cff);
|
|
116
|
+
--up-primary-dark: var(--up-light-primary-dark, #398ade);
|
|
117
|
+
--up-primary-disabled: var(--up-light-primary-disabled, #9acafc);
|
|
118
|
+
--up-primary-light: var(--up-light-primary-light, #ecf5ff);
|
|
119
|
+
|
|
120
|
+
--up-warning: var(--up-light-warning, #f9ae3d);
|
|
121
|
+
--up-warning-dark: var(--up-light-warning-dark, #f1a532);
|
|
122
|
+
--up-warning-disabled: var(--up-light-warning-disabled, #f9d39b);
|
|
123
|
+
--up-warning-light: var(--up-light-warning-light, #fdf6ec);
|
|
124
|
+
|
|
125
|
+
--up-success: var(--up-light-success, #5ac725);
|
|
126
|
+
--up-success-dark: var(--up-light-success-dark, #53c21d);
|
|
127
|
+
--up-success-disabled: var(--up-light-success-disabled, #a9e08f);
|
|
128
|
+
--up-success-light: var(--up-light-success-light, #f5fff0);
|
|
129
|
+
|
|
130
|
+
--up-error: var(--up-light-error, #f56c6c);
|
|
131
|
+
--up-error-dark: var(--up-light-error-dark, #e45656);
|
|
132
|
+
--up-error-disabled: var(--up-light-error-disabled, #f7b2b2);
|
|
133
|
+
--up-error-light: var(--up-light-error-light, #fef0f0);
|
|
134
|
+
|
|
135
|
+
--up-info: var(--up-light-info, #909399);
|
|
136
|
+
--up-info-dark: var(--up-light-info-dark, #767a82);
|
|
137
|
+
--up-info-disabled: var(--up-light-info-disabled, #c4c6c9);
|
|
138
|
+
--up-info-light: var(--up-light-info-light, #f4f4f5);
|
|
139
|
+
|
|
140
|
+
--up-table2-header-bg-color: #f5f7fa;
|
|
141
|
+
--up-table2-zebra-bg-color: #fafafa;
|
|
142
|
+
--up-table2-highlight-bg-color: #f5f7fa;
|
|
143
|
+
--up-gap-bg-color: #f3f4f6;
|
|
144
|
+
--up-skeleton-bg-color: #f1f2f4;
|
|
145
|
+
--up-skeleton-shimmer-color: #e6e6e6;
|
|
146
|
+
--up-swipe-action-button-bg-color: #c7c6cd;
|
|
147
|
+
--up-index-list-indicator-bg-color: #c9c9c9;
|
|
148
|
+
--up-calendar-month-mark-color: rgba(231, 232, 234, 0.83);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
[data-up-theme='dark'] {
|
|
152
|
+
--up-main-color: #f5f5f5;
|
|
153
|
+
--up-content-color: #d1d5db;
|
|
154
|
+
--up-tips-color: #9ca3af;
|
|
155
|
+
--up-light-color: #6b7280;
|
|
156
|
+
--up-border-color: #3a3a3c;
|
|
157
|
+
--up-bg-color: #1f1f1f;
|
|
158
|
+
--up-hover-bg-color: #343741;
|
|
159
|
+
--up-page-bg-color: #1f1f1f;
|
|
160
|
+
--up-card-bg-color: #1c1c1e;
|
|
161
|
+
--up-disabled-color: #4b5563;
|
|
162
|
+
|
|
163
|
+
--up-primary: #3c9cff;
|
|
164
|
+
--up-primary-dark: #5aa8ff;
|
|
165
|
+
--up-primary-disabled: #4c6f92;
|
|
166
|
+
--up-primary-light: #10243a;
|
|
167
|
+
|
|
168
|
+
--up-warning: #f9ae3d;
|
|
169
|
+
--up-warning-dark: #ffbf66;
|
|
170
|
+
--up-warning-disabled: #8a6a3a;
|
|
171
|
+
--up-warning-light: #3d2f1b;
|
|
172
|
+
|
|
173
|
+
--up-success: #5ac725;
|
|
174
|
+
--up-success-dark: #7ad94b;
|
|
175
|
+
--up-success-disabled: #5f7f4f;
|
|
176
|
+
--up-success-light: #1f3316;
|
|
177
|
+
|
|
178
|
+
--up-error: #f56c6c;
|
|
179
|
+
--up-error-dark: #ff8a8a;
|
|
180
|
+
--up-error-disabled: #8d5858;
|
|
181
|
+
--up-error-light: #3a2222;
|
|
182
|
+
|
|
183
|
+
--up-info: #909399;
|
|
184
|
+
--up-info-dark: #b0b3b8;
|
|
185
|
+
--up-info-disabled: #5f6368;
|
|
186
|
+
--up-info-light: #2f3238;
|
|
187
|
+
|
|
188
|
+
--up-table2-header-bg-color: #2a2d33;
|
|
189
|
+
--up-table2-zebra-bg-color: #23262b;
|
|
190
|
+
--up-table2-highlight-bg-color: #2f3440;
|
|
191
|
+
--up-gap-bg-color: #111111;
|
|
192
|
+
--up-skeleton-bg-color: #2f3135;
|
|
193
|
+
--up-skeleton-shimmer-color: rgba(255, 255, 255, 0.12);
|
|
194
|
+
--up-swipe-action-button-bg-color: #4b5563;
|
|
195
|
+
--up-index-list-indicator-bg-color: #4b5563;
|
|
196
|
+
--up-calendar-month-mark-color: rgba(255, 255, 255, 0.04);
|
|
197
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./theme-vars-core.scss";
|
package/libs/function/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
number as testNumber,
|
|
3
|
-
array as testArray,
|
|
4
|
-
empty as testEmpty
|
|
5
|
-
} from './test'
|
|
6
|
-
import { round } from './digit.js'
|
|
7
|
-
import config from '../config/config'
|
|
1
|
+
import {
|
|
2
|
+
number as testNumber,
|
|
3
|
+
array as testArray,
|
|
4
|
+
empty as testEmpty
|
|
5
|
+
} from './test.js'
|
|
6
|
+
import { round } from './digit.js'
|
|
7
|
+
import config from '../config/config.js'
|
|
8
8
|
/**
|
|
9
9
|
* @description 如果value小于min,取min;如果value大于max,取max
|
|
10
10
|
* @param {number} min
|
package/libs/mixin/mixin.js
CHANGED
|
@@ -2,9 +2,21 @@ import { defineMixin } from '../vue'
|
|
|
2
2
|
import { deepMerge, $parent, sleep } from '../function/index'
|
|
3
3
|
import test from '../function/test'
|
|
4
4
|
import route from '../util/route'
|
|
5
|
+
import {
|
|
6
|
+
applyNativeThemeUI,
|
|
7
|
+
applyNativeThemeUIDeferred,
|
|
8
|
+
getThemeCardStyle,
|
|
9
|
+
getThemeIsDark,
|
|
10
|
+
getThemePageStyle,
|
|
11
|
+
getThemeVar,
|
|
12
|
+
getThemeVarsForStyle,
|
|
13
|
+
syncThemeRuntimeFromStorage
|
|
14
|
+
} from '../theme/runtime'
|
|
5
15
|
// #ifdef APP-NVUE
|
|
6
16
|
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
|
|
7
|
-
const dom = uni.requireNativePlugin
|
|
17
|
+
const dom = (typeof uni !== 'undefined' && uni && typeof uni.requireNativePlugin === 'function')
|
|
18
|
+
? uni.requireNativePlugin('dom')
|
|
19
|
+
: null
|
|
8
20
|
// #endif
|
|
9
21
|
|
|
10
22
|
export const mixin = defineMixin({
|
|
@@ -31,21 +43,51 @@ export const mixin = defineMixin({
|
|
|
31
43
|
}
|
|
32
44
|
},
|
|
33
45
|
data() {
|
|
34
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
__upPageThemeChangeHandler: null,
|
|
48
|
+
upThemeVersion: 0
|
|
49
|
+
}
|
|
35
50
|
},
|
|
36
51
|
onLoad() {
|
|
37
52
|
// getRect挂载到$u上,因为这方法需要使用in(this),所以无法把它独立成一个单独的文件导出
|
|
38
|
-
this
|
|
53
|
+
this.upBindGetRect()
|
|
54
|
+
this.upInitThemeVersion()
|
|
55
|
+
if (this.upIsPageScope()) {
|
|
56
|
+
this.upApplyNativeThemeUI()
|
|
57
|
+
if (typeof uni !== 'undefined' && typeof uni.$on === 'function' && !this.__upPageThemeChangeHandler) {
|
|
58
|
+
this.__upPageThemeChangeHandler = () => {
|
|
59
|
+
this.upApplyNativeThemeUI()
|
|
60
|
+
}
|
|
61
|
+
uni.$on('uThemeChange', this.__upPageThemeChangeHandler)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
onShow() {
|
|
66
|
+
if (this.upIsPageScope()) {
|
|
67
|
+
this.upApplyNativeThemeUI()
|
|
68
|
+
}
|
|
39
69
|
},
|
|
40
70
|
created() {
|
|
41
71
|
// 组件当中,只有created声明周期,为了能在组件使用,故也在created中将方法挂载到$u
|
|
42
|
-
this
|
|
72
|
+
this.upBindGetRect()
|
|
73
|
+
this.upInitThemeVersion()
|
|
74
|
+
if (typeof uni !== 'undefined' && typeof uni.$on === 'function') {
|
|
75
|
+
this.__uThemeChangeHandler = (payload = {}) => {
|
|
76
|
+
this.upSyncThemeVersion(payload)
|
|
77
|
+
this.chacheU = null
|
|
78
|
+
if (typeof this.$forceUpdate === 'function') {
|
|
79
|
+
this.$forceUpdate()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
uni.$on('uThemeChange', this.__uThemeChangeHandler)
|
|
83
|
+
}
|
|
43
84
|
},
|
|
44
85
|
computed: {
|
|
45
86
|
// 在2.x版本中,将会把$u挂载到uni对象下,导致在模板中无法使用uni.$u.xxx形式
|
|
46
87
|
// 所以这里通过computed计算属性将其附加到this.$u上,就可以在模板或者js中使用uni.$u.xxx
|
|
47
88
|
// 只在nvue环境通过此方式引入完整的$u,其他平台会出现性能问题,非nvue则按需引入(主要原因是props过大)
|
|
48
89
|
$u() {
|
|
90
|
+
this.upThemeVersion
|
|
49
91
|
// #ifndef APP-NVUE
|
|
50
92
|
// 在非nvue端,移除props,http,mixin等对象,避免在小程序setData时数据过大影响性能
|
|
51
93
|
let mergeU = deepMerge(uni.$u, {
|
|
@@ -63,6 +105,22 @@ export const mixin = defineMixin({
|
|
|
63
105
|
return uni.$u
|
|
64
106
|
// #endif
|
|
65
107
|
},
|
|
108
|
+
upThemeIsDark() {
|
|
109
|
+
this.upThemeVersion
|
|
110
|
+
return getThemeIsDark(this.$u)
|
|
111
|
+
},
|
|
112
|
+
upThemeVars() {
|
|
113
|
+
this.upThemeVersion
|
|
114
|
+
return getThemeVarsForStyle(this.$u)
|
|
115
|
+
},
|
|
116
|
+
upThemePageStyle() {
|
|
117
|
+
this.upThemeVersion
|
|
118
|
+
return getThemePageStyle(this.$u)
|
|
119
|
+
},
|
|
120
|
+
upThemeCardStyle() {
|
|
121
|
+
this.upThemeVersion
|
|
122
|
+
return getThemeCardStyle(this.$u)
|
|
123
|
+
},
|
|
66
124
|
/**
|
|
67
125
|
* 生成bem规则类名
|
|
68
126
|
* 由于微信小程序,H5,nvue之间绑定class的差异,无法通过:class="[bem()]"的形式进行同用
|
|
@@ -98,6 +156,47 @@ export const mixin = defineMixin({
|
|
|
98
156
|
}
|
|
99
157
|
},
|
|
100
158
|
methods: {
|
|
159
|
+
upBindGetRect() {
|
|
160
|
+
const upU = this.$u || (typeof uni !== 'undefined' ? uni.$u : null)
|
|
161
|
+
if (upU) {
|
|
162
|
+
upU.getRect = this.$uGetRect
|
|
163
|
+
} else if (typeof uni !== 'undefined') {
|
|
164
|
+
uni.$u = {
|
|
165
|
+
getRect: this.$uGetRect
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
upReadThemeVersion() {
|
|
170
|
+
return Number((typeof uni !== 'undefined' && uni.$u && uni.$u.theme && uni.$u.theme.version) || 0)
|
|
171
|
+
},
|
|
172
|
+
upInitThemeVersion() {
|
|
173
|
+
const version = this.upReadThemeVersion()
|
|
174
|
+
if (version) {
|
|
175
|
+
this.upThemeVersion = version
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
upSyncThemeVersion(payload = {}) {
|
|
179
|
+
const version = Number(payload.version || this.upReadThemeVersion() || 0)
|
|
180
|
+
this.upThemeVersion = version || Number(this.upThemeVersion || 0) + 1
|
|
181
|
+
},
|
|
182
|
+
upIsPageScope() {
|
|
183
|
+
return !!(this.$page || this.route || this.$options?.mpType === 'page')
|
|
184
|
+
},
|
|
185
|
+
upHasProp(propName) {
|
|
186
|
+
const vnodeProps = this.$?.vnode?.props || {}
|
|
187
|
+
const kebabName = propName.replace(/[A-Z]/g, (s) => `-${s.toLowerCase()}`)
|
|
188
|
+
return Object.prototype.hasOwnProperty.call(vnodeProps, propName)
|
|
189
|
+
|| Object.prototype.hasOwnProperty.call(vnodeProps, kebabName)
|
|
190
|
+
},
|
|
191
|
+
upThemeVar(varName, fallbackColor) {
|
|
192
|
+
this.upThemeVersion
|
|
193
|
+
return getThemeVar(varName, fallbackColor, this.$u)
|
|
194
|
+
},
|
|
195
|
+
upApplyNativeThemeUI() {
|
|
196
|
+
syncThemeRuntimeFromStorage(this.$u)
|
|
197
|
+
this.upSyncThemeVersion()
|
|
198
|
+
applyNativeThemeUIDeferred(this.$u)
|
|
199
|
+
},
|
|
101
200
|
// 跳转某一个页面
|
|
102
201
|
openPage(urlKey = 'url') {
|
|
103
202
|
const url = this[urlKey]
|
|
@@ -200,6 +299,14 @@ export const mixin = defineMixin({
|
|
|
200
299
|
}
|
|
201
300
|
})
|
|
202
301
|
}
|
|
302
|
+
if (typeof uni !== 'undefined' && typeof uni.$off === 'function' && this.__uThemeChangeHandler) {
|
|
303
|
+
uni.$off('uThemeChange', this.__uThemeChangeHandler)
|
|
304
|
+
this.__uThemeChangeHandler = null
|
|
305
|
+
}
|
|
306
|
+
if (typeof uni !== 'undefined' && typeof uni.$off === 'function' && this.__upPageThemeChangeHandler) {
|
|
307
|
+
uni.$off('uThemeChange', this.__upPageThemeChangeHandler)
|
|
308
|
+
this.__upPageThemeChangeHandler = null
|
|
309
|
+
}
|
|
203
310
|
}
|
|
204
311
|
})
|
|
205
312
|
|