@mpxjs/core 2.9.69 → 2.9.70
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/package.json +7 -3
- package/src/convertor/convertor.js +11 -32
- package/src/convertor/wxToAli.js +3 -3
- package/src/convertor/wxToSwan.js +3 -3
- package/src/convertor/wxToWeb.js +3 -3
- package/src/core/proxy.js +18 -12
- package/src/dynamic/dynamicRenderMixin.js +2 -2
- package/src/index.js +3 -14
- package/src/observer/reactive.js +5 -4
- package/src/observer/ref.js +3 -2
- package/src/observer/scheduler.js +4 -0
- package/src/observer/watch.js +5 -4
- package/src/platform/builtInMixins/directiveHelperMixin.ios.js +4 -1
- package/src/platform/builtInMixins/styleHelperMixin.ios.js +7 -4
- package/src/platform/createApp.ios.js +45 -33
- package/src/platform/createApp.js +7 -9
- package/src/platform/env/event.js +108 -0
- package/src/platform/env/index.ios.js +51 -0
- package/src/platform/env/index.js +8 -0
- package/src/platform/env/index.web.js +48 -0
- package/src/{external → platform/env}/vuePlugin.js +1 -1
- package/src/platform/export/index.js +1 -1
- package/src/platform/patch/{ali/getDefaultOptions.js → getDefaultOptions.ali.js} +3 -3
- package/src/platform/patch/{react/getDefaultOptions.ios.js → getDefaultOptions.ios.js} +263 -192
- package/src/platform/patch/{wx/getDefaultOptions.js → getDefaultOptions.js} +11 -5
- package/src/platform/patch/{web/getDefaultOptions.js → getDefaultOptions.web.js} +5 -5
- package/src/platform/patch/index.js +4 -21
- package/src/platform/patch/{ali/lifecycle.js → lifecycle/index.ali.js} +2 -0
- package/src/platform/patch/lifecycle/index.js +1 -0
- package/src/platform/patch/{swan/lifecycle.js → lifecycle/index.swan.js} +2 -0
- package/src/platform/patch/{web/lifecycle.js → lifecycle/index.web.js} +4 -0
- package/src/platform/patch/{wx/lifecycle.js → lifecycle/index.wx.js} +2 -0
- package/src/external/vue.js +0 -1
- package/src/external/vue.web.js +0 -6
- package/src/platform/patch/react/getDefaultOptions.js +0 -1
- package/src/platform/patch/swan/getDefaultOptions.js +0 -34
- /package/src/platform/export/{apiInject.js → inject.js} +0 -0
- /package/src/platform/export/{apiInject.web.js → inject.web.js} +0 -0
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import transferOptions from '../../core/transferOptions'
|
|
2
2
|
import getBuiltInMixins from '../builtInMixins/index'
|
|
3
|
-
import { getDefaultOptions
|
|
4
|
-
import {
|
|
5
|
-
import { getDefaultOptions as getSwanDefaultOptions } from './swan/getDefaultOptions'
|
|
6
|
-
import { getDefaultOptions as getWebDefaultOptions } from './web/getDefaultOptions'
|
|
7
|
-
import { getDefaultOptions as getReactDefaultOptions } from './react/getDefaultOptions'
|
|
8
|
-
import { error } from '@mpxjs/utils'
|
|
3
|
+
import { getDefaultOptions } from './getDefaultOptions'
|
|
4
|
+
import { error, isReact, isWeb } from '@mpxjs/utils'
|
|
9
5
|
|
|
10
6
|
export default function createFactory (type) {
|
|
11
7
|
return (options = {}, { isNative, customCtor, customCtorType } = {}) => {
|
|
12
8
|
options.__nativeRender__ = !!isNative
|
|
13
9
|
options.__type__ = type
|
|
14
10
|
let ctor
|
|
15
|
-
if (
|
|
11
|
+
if (!isWeb && !isReact) {
|
|
16
12
|
if (customCtor) {
|
|
17
13
|
ctor = customCtor
|
|
18
14
|
customCtorType = customCtorType || type
|
|
@@ -39,19 +35,6 @@ export default function createFactory (type) {
|
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
37
|
|
|
42
|
-
let getDefaultOptions
|
|
43
|
-
if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android') {
|
|
44
|
-
getDefaultOptions = getReactDefaultOptions
|
|
45
|
-
} else if (__mpx_mode__ === 'web') {
|
|
46
|
-
getDefaultOptions = getWebDefaultOptions
|
|
47
|
-
} else if (__mpx_mode__ === 'ali') {
|
|
48
|
-
getDefaultOptions = getAliDefaultOptions
|
|
49
|
-
} else if (__mpx_mode__ === 'swan') {
|
|
50
|
-
getDefaultOptions = getSwanDefaultOptions
|
|
51
|
-
} else {
|
|
52
|
-
getDefaultOptions = getWxDefaultOptions
|
|
53
|
-
}
|
|
54
|
-
|
|
55
38
|
const { setup } = options
|
|
56
39
|
const { rawOptions, currentInject } = transferOptions(options, type)
|
|
57
40
|
rawOptions.setup = setup
|
|
@@ -60,7 +43,7 @@ export default function createFactory (type) {
|
|
|
60
43
|
// 将合并后的用户定义的rawOptions传入获取当前应该注入的内建mixins
|
|
61
44
|
rawOptions.mixins = getBuiltInMixins({ type, rawOptions, currentInject })
|
|
62
45
|
const defaultOptions = getDefaultOptions({ type, rawOptions, currentInject })
|
|
63
|
-
if (
|
|
46
|
+
if (isWeb || isReact) {
|
|
64
47
|
global.__mpxOptionsMap = global.__mpxOptionsMap || {}
|
|
65
48
|
global.__mpxOptionsMap[currentInject.moduleId] = defaultOptions
|
|
66
49
|
} else if (ctor) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.wx'
|
package/src/external/vue.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default {}
|
package/src/external/vue.web.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function getDefaultOptions () {}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import mergeOptions from '../../../core/mergeOptions'
|
|
2
|
-
import { initProxy, filterOptions } from '../wx/getDefaultOptions'
|
|
3
|
-
|
|
4
|
-
export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
5
|
-
let hookNames = ['attached', 'ready', 'detached']
|
|
6
|
-
// 当用户传入page作为构造器构造页面时,修改所有关键hooks
|
|
7
|
-
if (rawOptions.__pageCtor__) {
|
|
8
|
-
hookNames = ['onLoad', 'onReady', 'onUnload']
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const rootMixin = {
|
|
12
|
-
[hookNames[0]] () {
|
|
13
|
-
initProxy(this, rawOptions, currentInject)
|
|
14
|
-
},
|
|
15
|
-
[hookNames[1]] () {
|
|
16
|
-
if (this.__mpxProxy) this.__mpxProxy.mounted()
|
|
17
|
-
},
|
|
18
|
-
[hookNames[2]] () {
|
|
19
|
-
if (this.__mpxProxy) this.__mpxProxy.unmounted()
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// 如构造页面,优先使用onInit进行初始化
|
|
24
|
-
if (type === 'page') {
|
|
25
|
-
rootMixin.onInit = function (...params) {
|
|
26
|
-
initProxy(this, rawOptions, currentInject, params)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const rootMixins = [rootMixin]
|
|
31
|
-
rawOptions.mixins = rawOptions.mixins ? rootMixins.concat(rawOptions.mixins) : rootMixins
|
|
32
|
-
rawOptions = mergeOptions(rawOptions, type, false)
|
|
33
|
-
return filterOptions(rawOptions)
|
|
34
|
-
}
|
|
File without changes
|
|
File without changes
|