@ray-js/api 1.3.22 → 1.3.23
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/LICENSE.md +9 -0
- package/lib/BaseKit-3.3.10.js +85 -83
- package/lib/BizKit-3.2.7.js +48 -47
- package/lib/DeviceKit-3.3.1.js +194 -193
- package/lib/HomeKit-3.1.4.js +2 -1
- package/lib/MapKit-3.0.7.js +4 -2
- package/lib/MiniKit-3.1.0.js +65 -64
- package/lib/P2PKit-2.0.3.js +4 -2
- package/lib/PlayNetKit-1.1.3.js +2 -1
- package/lib/cloud/alarm.js +6 -9
- package/lib/cloud/core.js +3 -4
- package/lib/cloud/device.js +25 -36
- package/lib/cloud/interface.d.ts +7 -7
- package/lib/cloud/linkage.js +51 -49
- package/lib/cloud/statistic.js +30 -42
- package/lib/cloud/timer.js +45 -62
- package/lib/constants.js +1 -1
- package/lib/core/promisify/index.js +5 -9
- package/lib/getBoundingClientRect/index.js +16 -17
- package/lib/getBoundingClientRect/index.thing.js +16 -17
- package/lib/getBoundingClientRect/index.wechat.js +16 -17
- package/lib/getCdnUrl/index.js +0 -2
- package/lib/getCdnUrl/index.thing.js +30 -85
- package/lib/getCdnUrl/index.wechat.js +0 -2
- package/lib/getElementById/index.js +1 -3
- package/lib/getElementById/index.thing.js +2 -4
- package/lib/getElementById/index.wechat.js +2 -4
- package/lib/hideTabBar/index.d.ts +7 -1
- package/lib/index.js +3 -2
- package/lib/lifecycles/offAppEvent/index.js +2 -2
- package/lib/lifecycles/offAppHide/index.js +2 -2
- package/lib/lifecycles/offAppShow/index.js +2 -2
- package/lib/lifecycles/offError/index.js +2 -2
- package/lib/lifecycles/offThemeChange/index.js +2 -2
- package/lib/lifecycles/offWindowResize/index.js +2 -2
- package/lib/lifecycles/onAppEvent/index.js +2 -2
- package/lib/lifecycles/onAppHide/index.js +2 -2
- package/lib/lifecycles/onAppShow/index.js +2 -2
- package/lib/lifecycles/onError/index.js +2 -2
- package/lib/lifecycles/onPageNotFound/index.js +2 -2
- package/lib/lifecycles/onThemeChange/index.js +2 -2
- package/lib/lifecycles/onWindowResize/index.js +2 -2
- package/lib/navigateBack/index.js +3 -6
- package/lib/navigateTo/index.js +2 -5
- package/lib/onNavigationBarBack/index.js +1 -2
- package/lib/onNavigationBarBack/index.wechat.js +1 -2
- package/lib/panel/devInfo/index.js +84 -121
- package/lib/panel/i18n/index.d.ts +1 -1
- package/lib/panel/i18n/index.js +180 -263
- package/lib/panel/i18n/index.wechat.d.ts +1 -1
- package/lib/panel/i18n/index.wechat.js +184 -268
- package/lib/panel/normalizeNetwork.d.ts +2 -2
- package/lib/panel/normalizeNetwork.js +2 -7
- package/lib/panel/publishDps.d.ts +1 -1
- package/lib/panel/publishDps.js +14 -19
- package/lib/panel/types/devInfo.d.ts +3 -3
- package/lib/panel/types/utilities.d.ts +8 -8
- package/lib/panel/utils.js +1 -3
- package/lib/reLaunch/index.js +2 -5
- package/lib/redirectTo/index.js +2 -7
- package/lib/requestCloud/index.js +2 -2
- package/lib/requestCloud/index.wechat.js +0 -1
- package/lib/setNavigationBarBack/index.js +1 -2
- package/lib/setNavigationBarBack/index.wechat.js +1 -2
- package/lib/setNavigationBarColor/index.js +3 -6
- package/lib/setNavigationBarTitle/index.js +5 -6
- package/lib/showTabBar/index.d.ts +7 -1
- package/lib/switchTab/index.js +2 -5
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +9 -18
- package/lib/utils.wechat.d.ts +1 -1
- package/lib/utils.wechat.js +14 -26
- package/lib/viewAPI.js +14 -13
- package/package.json +5 -5
package/lib/redirectTo/index.js
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
import "core-js/modules/es.regexp.exec.js";
|
2
|
-
import "core-js/modules/es.string.replace.js";
|
3
|
-
import "core-js/modules/es.object.to-string.js";
|
4
|
-
import "core-js/modules/es.promise.js";
|
5
1
|
/// <reference path="../../@types/api.d.ts" />
|
6
|
-
import router from '@ray-js/router';
|
7
2
|
|
8
|
-
|
3
|
+
import router from '@ray-js/router';
|
4
|
+
const redirectTo = function (options) {
|
9
5
|
router.replace(options.url);
|
10
6
|
return Promise.resolve();
|
11
7
|
};
|
12
|
-
|
13
8
|
export default redirectTo;
|
@@ -1,11 +1,8 @@
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
2
|
-
import "core-js/modules/es.promise.js";
|
3
|
-
|
4
1
|
/// <reference path="../../@types/api.d.ts" />
|
5
|
-
|
6
|
-
|
2
|
+
|
3
|
+
const setNavigationBarColor = function (options) {
|
4
|
+
const meta = document.querySelector('meta[name=theme-color]');
|
7
5
|
meta && meta.setAttribute('content', options.backgroundColor);
|
8
6
|
return Promise.resolve();
|
9
7
|
};
|
10
|
-
|
11
8
|
export default setNavigationBarColor;
|
@@ -1,11 +1,10 @@
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
2
|
-
import "core-js/modules/es.promise.js";
|
3
|
-
|
4
1
|
/// <reference path="../../@types/api.d.ts" />
|
5
|
-
|
6
|
-
|
2
|
+
|
3
|
+
const setNavigationBarTitle = function (options) {
|
4
|
+
const {
|
5
|
+
title
|
6
|
+
} = options;
|
7
7
|
document.title = title;
|
8
8
|
return Promise.resolve();
|
9
9
|
};
|
10
|
-
|
11
10
|
export default setNavigationBarTitle;
|
@@ -1,3 +1,9 @@
|
|
1
1
|
/// <reference path="../../@types/api.d.ts" />
|
2
|
-
declare const _default: (arg?:
|
2
|
+
declare const _default: (arg?: {
|
3
|
+
animation?: boolean | undefined;
|
4
|
+
} & {
|
5
|
+
success?: ((S?: any) => void) | undefined;
|
6
|
+
fail?: ((F?: any) => void) | undefined;
|
7
|
+
complete?: ((C?: any) => void) | undefined;
|
8
|
+
} & import("../core").PromisifyArgs<any, any>) => Promise<any>;
|
3
9
|
export default _default;
|
package/lib/switchTab/index.js
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
2
|
-
import "core-js/modules/es.promise.js";
|
3
1
|
/// <reference path="../../@types/api.d.ts" />
|
4
|
-
import router from '@ray-js/router';
|
5
2
|
|
6
|
-
|
3
|
+
import router from '@ray-js/router';
|
4
|
+
const switchTab = function (options) {
|
7
5
|
router.push(options.url);
|
8
6
|
return Promise.resolve();
|
9
7
|
};
|
10
|
-
|
11
8
|
export default switchTab;
|
package/lib/utils.d.ts
CHANGED
package/lib/utils.js
CHANGED
@@ -1,37 +1,28 @@
|
|
1
|
-
import "core-js/modules/es.array.concat.js";
|
2
1
|
export function factory(name) {
|
3
|
-
|
2
|
+
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
4
3
|
return function () {
|
5
4
|
var _inst$opts$namespace;
|
6
|
-
|
7
5
|
if (opts.deprecated) {
|
8
|
-
console.warn(
|
6
|
+
console.warn(`该方法 ${name} 已弃用`);
|
9
7
|
}
|
10
|
-
|
11
|
-
|
12
|
-
var method = opts.namespace ? ((_inst$opts$namespace = inst[opts.namespace]) !== null && _inst$opts$namespace !== void 0 ? _inst$opts$namespace : {})[name] : inst[name];
|
13
|
-
|
8
|
+
const inst = typeof ty === 'undefined' ? {} : ty;
|
9
|
+
const method = opts.namespace ? ((_inst$opts$namespace = inst[opts.namespace]) !== null && _inst$opts$namespace !== void 0 ? _inst$opts$namespace : {})[name] : inst[name];
|
14
10
|
if (!method) {
|
15
|
-
console.warn(
|
11
|
+
console.warn(`// TODO 暂未实现方法 ${opts.namespace ? opts.namespace + '.' : ''}${name}`);
|
16
12
|
return;
|
17
13
|
}
|
18
|
-
|
19
14
|
return method.apply(this, arguments);
|
20
15
|
};
|
21
16
|
}
|
22
17
|
export function factoryContants(name) {
|
23
|
-
|
24
|
-
|
18
|
+
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
25
19
|
if (opts.deprecated) {
|
26
|
-
console.warn(
|
20
|
+
console.warn(`该变量 ${name} 已弃用`);
|
27
21
|
}
|
28
|
-
|
29
|
-
var inst = typeof ty === 'undefined' ? {} : ty;
|
30
|
-
|
22
|
+
const inst = typeof ty === 'undefined' ? {} : ty;
|
31
23
|
if (!inst[name]) {
|
32
|
-
console.warn(
|
24
|
+
console.warn(`// TODO 暂未实现变量 ${name}`);
|
33
25
|
return;
|
34
26
|
}
|
35
|
-
|
36
27
|
return inst[name];
|
37
28
|
}
|
package/lib/utils.wechat.d.ts
CHANGED
package/lib/utils.wechat.js
CHANGED
@@ -1,53 +1,41 @@
|
|
1
|
-
import "core-js/modules/es.regexp.exec.js";
|
2
|
-
import "core-js/modules/es.regexp.test.js";
|
3
1
|
// @ts-ignore
|
4
2
|
import * as tyWx from '@ray-js/wechat';
|
5
3
|
export function factory(name) {
|
6
|
-
|
7
|
-
|
4
|
+
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
8
5
|
if (/(set|get|remove|clear)+Storage(Sync)?$/.test(name)) {
|
9
6
|
return function (option) {
|
10
7
|
if (opts.deprecated) {
|
11
|
-
console.warn(
|
12
|
-
}
|
13
|
-
|
14
|
-
|
8
|
+
console.warn(`该方法 ${name} 已弃用`);
|
9
|
+
}
|
10
|
+
// eslint-disable-next-line prefer-rest-params
|
15
11
|
return wx[name].call(this, option.key, option.data);
|
16
12
|
};
|
17
13
|
}
|
18
|
-
|
19
14
|
return function () {
|
20
15
|
if (opts.deprecated) {
|
21
|
-
console.warn(
|
16
|
+
console.warn(`该方法 ${name} 已弃用`);
|
22
17
|
}
|
23
|
-
|
24
18
|
if (!tyWx[name] && !wx[name]) {
|
25
|
-
console.warn(
|
19
|
+
console.warn(`// TODO 暂未实现方法 wx.${name}`);
|
26
20
|
return;
|
27
|
-
}
|
28
|
-
|
29
|
-
|
21
|
+
}
|
22
|
+
// 优先取得 TTT 能力的方法
|
30
23
|
if (tyWx[name]) {
|
31
24
|
return tyWx[name].apply(this, arguments);
|
32
|
-
}
|
33
|
-
|
34
|
-
|
25
|
+
}
|
26
|
+
// eslint-disable-next-line prefer-rest-params
|
35
27
|
return wx[name].apply(this, arguments);
|
36
28
|
};
|
37
29
|
}
|
38
30
|
export function factoryContants(name) {
|
39
|
-
|
40
|
-
|
31
|
+
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
41
32
|
if (opts.deprecated) {
|
42
|
-
console.warn(
|
33
|
+
console.warn(`该变量 ${name} 已弃用`);
|
43
34
|
}
|
44
|
-
|
45
|
-
var inst = typeof wx === 'undefined' ? {} : wx;
|
46
|
-
|
35
|
+
const inst = typeof wx === 'undefined' ? {} : wx;
|
47
36
|
if (!inst[name]) {
|
48
|
-
console.warn(
|
37
|
+
console.warn(`// TODO 暂未实现变量 ${name}`);
|
49
38
|
return;
|
50
39
|
}
|
51
|
-
|
52
40
|
return inst[name];
|
53
41
|
}
|
package/lib/viewAPI.js
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
/// <reference path="../@types/api.d.ts" />
|
2
|
+
|
2
3
|
import { factory, factoryContants } from './utils';
|
3
|
-
export
|
4
|
-
export
|
5
|
-
export
|
6
|
-
export
|
7
|
-
export
|
8
|
-
export
|
9
|
-
export
|
10
|
-
export
|
11
|
-
export
|
12
|
-
export
|
13
|
-
export
|
14
|
-
export
|
15
|
-
export
|
4
|
+
export const env = factoryContants('env');
|
5
|
+
export const createAnimation = factory('createAnimation');
|
6
|
+
export const pageScrollTo = factory('pageScrollTo');
|
7
|
+
export const createSelectorQuery = factory('createSelectorQuery');
|
8
|
+
export const createIntersectionObserver = factory('createIntersectionObserver');
|
9
|
+
export const createCanvasContext = factory('createCanvasContext');
|
10
|
+
export const canvasGetImageData = factory('canvasGetImageData');
|
11
|
+
export const canvasPutImageData = factory('canvasPutImageData');
|
12
|
+
export const createVideoContext = factory('createVideoContext');
|
13
|
+
export const createNativeVideoContext = factory('createNativeVideoContext');
|
14
|
+
export const createMapContext = factory('createMapContext');
|
15
|
+
export const createIpcPlayerContext = factory('createIpcPlayerContext');
|
16
|
+
export const createCameraContext = factory('createCameraContext');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.23",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -26,13 +26,13 @@
|
|
26
26
|
"build:kit:api": "node scripts/api-creator.mjs"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@ray-js/framework": "1.3.
|
30
|
-
"@ray-js/router": "1.3.
|
29
|
+
"@ray-js/framework": "1.3.23",
|
30
|
+
"@ray-js/router": "1.3.23",
|
31
31
|
"@ray-js/wechat": "^0.0.16",
|
32
32
|
"base64-browser": "^1.0.1"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
|
-
"@ray-js/cli": "1.3.
|
35
|
+
"@ray-js/cli": "1.3.23",
|
36
36
|
"art-template": "^4.13.2",
|
37
37
|
"fs-extra": "^10.1.0",
|
38
38
|
"miniprogram-api-typings": "^3.4.3",
|
@@ -44,6 +44,6 @@
|
|
44
44
|
"email": "tuyafe@tuya.com"
|
45
45
|
}
|
46
46
|
],
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "04708bb394d817a7a522fcde178f19f170d5d364",
|
48
48
|
"repository": {}
|
49
49
|
}
|