@mpxjs/api-proxy 2.10.4-beta.6 → 2.10.5-beta.1
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 +2 -2
- package/src/common/js/utils.js +6 -5
- package/src/platform/api/animation/{animation.react.js → animation.ios.js} +9 -8
- package/src/platform/api/animation/index.ios.js +1 -1
- package/src/platform/api/create-intersection-observer/IntersectionObserver.js +2 -2
- package/src/platform/api/video/index.web.js +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/api-proxy",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.5-beta.1",
|
|
4
4
|
"description": "convert miniprogram API at each end",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"types": "@types/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/didi/mpx#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@mpxjs/utils": "^2.10.4",
|
|
40
|
+
"@mpxjs/utils": "^2.10.4 | ^2.10.5-beta.1",
|
|
41
41
|
"axios": "^1.7.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
package/src/common/js/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasOwn, noop, getEnvObj, getFocusedNavigation } from '@mpxjs/utils'
|
|
1
|
+
import { hasOwn, noop, getEnvObj, getFocusedNavigation, error as errorHandler, warn as warnHandler } from '@mpxjs/utils'
|
|
2
2
|
import { getCurrentInstance } from '@mpxjs/core'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -47,15 +47,16 @@ const handleSuccess = (opts, getOptions = noop, thisObj) => {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function warn (msg) {
|
|
50
|
-
|
|
50
|
+
warnHandler(msg, '@mpxjs/api-proxy')
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function error (msg) {
|
|
54
|
-
|
|
54
|
+
errorHandler(msg, '@mpxjs/api-proxy')
|
|
55
55
|
}
|
|
56
|
+
|
|
56
57
|
function envError (method) {
|
|
57
58
|
return () => {
|
|
58
|
-
|
|
59
|
+
errorHandler(`\n ${__mpx_mode__}环境不支持${method}方法`, '@mpxjs/api-proxy')
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -90,7 +91,7 @@ function failHandle (result, fail, complete) {
|
|
|
90
91
|
|
|
91
92
|
function getCurrentPageId () {
|
|
92
93
|
const currentInstance = getCurrentInstance()
|
|
93
|
-
const id = currentInstance?.getPageId() || getFocusedNavigation()?.pageId || null
|
|
94
|
+
const id = currentInstance?.proxy?.getPageId() || getFocusedNavigation()?.pageId || null
|
|
94
95
|
return id
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { error } from '../../../common/js'
|
|
1
2
|
class Animation {
|
|
2
3
|
constructor (
|
|
3
4
|
{
|
|
@@ -47,7 +48,7 @@ class Animation {
|
|
|
47
48
|
steps = []
|
|
48
49
|
|
|
49
50
|
matrix (a, b, c, d, tx, ty) { // Todo
|
|
50
|
-
|
|
51
|
+
error('React Native 不支持 matrix 动画')
|
|
51
52
|
// this.transform.set('matrix', [a, b, c, d, tx, ty])
|
|
52
53
|
return this
|
|
53
54
|
}
|
|
@@ -57,7 +58,7 @@ class Animation {
|
|
|
57
58
|
a3, b3, c3, d3,
|
|
58
59
|
a4, b4, c4, d4
|
|
59
60
|
) {
|
|
60
|
-
|
|
61
|
+
error('React Native 不支持 matrix3d 动画')
|
|
61
62
|
// this.transform.set('matrix3d', [ // Todo
|
|
62
63
|
// a1, b1, c1, d1,
|
|
63
64
|
// a2, b2, c2, d2,
|
|
@@ -78,7 +79,7 @@ class Animation {
|
|
|
78
79
|
// this.rotateY(y)
|
|
79
80
|
// this.rotateZ(z)
|
|
80
81
|
// this.rotate(angle)
|
|
81
|
-
|
|
82
|
+
error('React Native 不支持 transform rotate3d')
|
|
82
83
|
return this
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -116,13 +117,13 @@ class Animation {
|
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
scaleZ (scale) { // Todo Invariant Violation: Invalid transform scaleZ: {"scaleZ":0}
|
|
119
|
-
|
|
120
|
+
error('React Native 不支持 transform scaleZ')
|
|
120
121
|
// this.transform.set('scaleZ', scale)
|
|
121
122
|
return this
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
scale3d (x, y, z) { // Todo Invariant Violation: Invalid transform scaleZ: {"scaleZ":0}
|
|
125
|
-
|
|
126
|
+
error('React Native 不支持 transform scaleZ,故不支持 scale3d')
|
|
126
127
|
// this.scaleX(x)
|
|
127
128
|
// this.scaleY(y)
|
|
128
129
|
// this.scaleZ(z)
|
|
@@ -167,14 +168,14 @@ class Animation {
|
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
translateZ (translate) { // Todo Invariant Violation: Invalid transform translateZ: {"translateZ":0}
|
|
170
|
-
|
|
171
|
+
error('React Native 不支持 transform translateZ')
|
|
171
172
|
// [translate] = this._transformUnit(translate)
|
|
172
173
|
// this.transform.set('translateZ', translate)
|
|
173
174
|
return this
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
translate3d (x, y, z) { // Todo Invariant Violation: Invalid transform translateZ: {"translateZ":0}
|
|
177
|
-
|
|
178
|
+
error('React Native 不支持 transform translateZ,故无法支持 translate3d')
|
|
178
179
|
// [x, y, z] = this._transformUnit(x, y, z)
|
|
179
180
|
// // this.transform.set('translate3d', [x, y, z])
|
|
180
181
|
// this.translateX(x)
|
|
@@ -239,7 +240,7 @@ class Animation {
|
|
|
239
240
|
transformOrigin = DEFAULT.transformOrigin
|
|
240
241
|
} = arg
|
|
241
242
|
if (typeof transformOrigin !== 'string') {
|
|
242
|
-
|
|
243
|
+
error('Value of transformOrigin only support string type, please check again')
|
|
243
244
|
transformOrigin = DEFAULT.transformOrigin
|
|
244
245
|
}
|
|
245
246
|
this.steps.push({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nextTick } from '../next-tick'
|
|
2
|
-
import { parseDataset } from '@mpxjs/utils'
|
|
2
|
+
import { parseDataset, warn } from '@mpxjs/utils'
|
|
3
3
|
|
|
4
4
|
let isInit = true
|
|
5
5
|
|
|
@@ -68,7 +68,7 @@ class WebIntersectionObserver {
|
|
|
68
68
|
observe (targetSelector, callback) {
|
|
69
69
|
nextTick(() => {
|
|
70
70
|
if (!document.querySelector(targetSelector)) {
|
|
71
|
-
|
|
71
|
+
warn(`Node ${JSON.stringify(targetSelector)} is not found. Intersection observer will not trigger.`)
|
|
72
72
|
return
|
|
73
73
|
}
|
|
74
74
|
this._observer = this.initObserver()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isBrowser, throwSSRWarning } from '../../../common/js'
|
|
1
|
+
import { isBrowser, throwSSRWarning, warn } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
const allowPlaybackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0]
|
|
4
4
|
export const createVideoContext = (id, context) => {
|
|
@@ -22,22 +22,22 @@ export const createVideoContext = (id, context) => {
|
|
|
22
22
|
|
|
23
23
|
// todo 进入后台音频播放模式
|
|
24
24
|
__videoContext.requestBackgroundPlayback = () => {
|
|
25
|
-
|
|
25
|
+
warn('暂不支持requestBackgroundPlayback API')
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// todo 退出后台音频播放
|
|
29
29
|
__videoContext.exitBackgroundPlayback = () => {
|
|
30
|
-
|
|
30
|
+
warn('暂不支持exitBackgroundPlayback API')
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// todo 退出小窗,该方法可在任意页面调用
|
|
34
34
|
__videoContext.exitPictureInPicture = ({ success, fail, complete }) => {
|
|
35
|
-
|
|
35
|
+
warn('暂不支持exitPictureInPicture API')
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// todo 发送弹幕
|
|
39
39
|
__videoContext.sendDanmu = ({ text, color }) => {
|
|
40
|
-
|
|
40
|
+
warn('暂不支持发送弹幕')
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// 进入全屏
|
|
@@ -90,7 +90,7 @@ export const createVideoContext = (id, context) => {
|
|
|
90
90
|
// 设置倍速播放
|
|
91
91
|
__videoContext.playbackRate = (number) => {
|
|
92
92
|
if (allowPlaybackRate.indexOf(number) === -1) {
|
|
93
|
-
|
|
93
|
+
warn(`不支持${number}倍速播放`)
|
|
94
94
|
return
|
|
95
95
|
}
|
|
96
96
|
__videoNode.playbackRate = number
|