@ray-js/api 1.4.0-alpha.1 → 1.4.0-alpha.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/@types/P2PKit.d.ts +402 -0
  2. package/@types/all-kits.d.ts +1 -0
  3. package/lib/BaseKit-3.3.10.js +85 -83
  4. package/lib/BizKit-3.2.7.js +48 -47
  5. package/lib/DeviceKit-3.3.1.js +194 -193
  6. package/lib/HomeKit-3.1.4.js +2 -1
  7. package/lib/MapKit-3.0.7.js +4 -2
  8. package/lib/MiniKit-3.1.0.js +65 -64
  9. package/lib/P2PKit-2.0.3.d.ts +27 -0
  10. package/lib/P2PKit-2.0.3.js +79 -0
  11. package/lib/PlayNetKit-1.1.3.js +2 -1
  12. package/lib/all-kits.d.ts +1 -0
  13. package/lib/all-kits.js +1 -0
  14. package/lib/cloud/alarm.js +4 -7
  15. package/lib/cloud/core.js +2 -3
  16. package/lib/cloud/device.js +20 -31
  17. package/lib/cloud/interface.d.ts +7 -7
  18. package/lib/cloud/linkage.js +43 -41
  19. package/lib/cloud/statistic.js +21 -33
  20. package/lib/cloud/timer.js +31 -48
  21. package/lib/constants.js +1 -1
  22. package/lib/core/promisify/index.js +5 -9
  23. package/lib/getBoundingClientRect/index.js +16 -17
  24. package/lib/getBoundingClientRect/index.thing.js +16 -17
  25. package/lib/getBoundingClientRect/index.wechat.js +16 -17
  26. package/lib/getCdnUrl/index.d.ts +1 -0
  27. package/lib/getCdnUrl/index.js +4 -0
  28. package/lib/getCdnUrl/index.thing.d.ts +3 -1
  29. package/lib/getCdnUrl/index.thing.js +54 -19
  30. package/lib/getCdnUrl/index.wechat.d.ts +1 -0
  31. package/lib/getCdnUrl/index.wechat.js +4 -0
  32. package/lib/getElementById/index.js +1 -3
  33. package/lib/getElementById/index.thing.js +2 -4
  34. package/lib/getElementById/index.wechat.js +2 -4
  35. package/lib/hideTabBar/index.d.ts +7 -1
  36. package/lib/index.d.ts +1 -1
  37. package/lib/index.js +4 -3
  38. package/lib/lifecycles/offAppEvent/index.js +2 -2
  39. package/lib/lifecycles/offAppHide/index.js +2 -2
  40. package/lib/lifecycles/offAppShow/index.js +2 -2
  41. package/lib/lifecycles/offError/index.js +2 -2
  42. package/lib/lifecycles/offThemeChange/index.js +2 -2
  43. package/lib/lifecycles/offWindowResize/index.js +2 -2
  44. package/lib/lifecycles/onAppEvent/index.js +2 -2
  45. package/lib/lifecycles/onAppHide/index.js +2 -2
  46. package/lib/lifecycles/onAppShow/index.js +2 -2
  47. package/lib/lifecycles/onError/index.js +2 -2
  48. package/lib/lifecycles/onPageNotFound/index.js +2 -2
  49. package/lib/lifecycles/onThemeChange/index.js +2 -2
  50. package/lib/lifecycles/onWindowResize/index.js +2 -2
  51. package/lib/navigateBack/index.js +3 -6
  52. package/lib/navigateTo/index.js +2 -5
  53. package/lib/onNavigationBarBack/index.js +1 -2
  54. package/lib/onNavigationBarBack/index.wechat.js +1 -2
  55. package/lib/panel/devInfo/index.js +84 -121
  56. package/lib/panel/i18n/index.d.ts +1 -1
  57. package/lib/panel/i18n/index.js +180 -262
  58. package/lib/panel/i18n/index.wechat.d.ts +1 -1
  59. package/lib/panel/i18n/index.wechat.js +184 -267
  60. package/lib/panel/normalizeNetwork.d.ts +2 -2
  61. package/lib/panel/normalizeNetwork.js +2 -7
  62. package/lib/panel/publishDps.d.ts +1 -1
  63. package/lib/panel/publishDps.js +13 -18
  64. package/lib/panel/types/devInfo.d.ts +3 -3
  65. package/lib/panel/types/utilities.d.ts +8 -8
  66. package/lib/panel/utils.js +1 -3
  67. package/lib/reLaunch/index.js +2 -5
  68. package/lib/redirectTo/index.js +2 -6
  69. package/lib/requestCloud/index.js +2 -2
  70. package/lib/requestCloud/index.wechat.js +0 -1
  71. package/lib/setNavigationBarBack/index.js +1 -2
  72. package/lib/setNavigationBarBack/index.wechat.js +1 -2
  73. package/lib/setNavigationBarColor/index.js +3 -6
  74. package/lib/setNavigationBarTitle/index.js +5 -6
  75. package/lib/showTabBar/index.d.ts +7 -1
  76. package/lib/switchTab/index.js +2 -5
  77. package/lib/utils.d.ts +1 -1
  78. package/lib/utils.js +5 -14
  79. package/lib/utils.wechat.d.ts +1 -1
  80. package/lib/utils.wechat.js +9 -21
  81. package/lib/viewAPI.js +13 -12
  82. package/package.json +25 -25
@@ -1,13 +1,9 @@
1
- import "core-js/modules/es.regexp.exec.js";
2
1
  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
2
  /// <reference path="../../@types/api.d.ts" />
6
- import router from '@ray-js/router';
7
3
 
8
- var redirectTo = function (options) {
4
+ import router from '@ray-js/router';
5
+ const redirectTo = function (options) {
9
6
  router.replace(options.url);
10
7
  return Promise.resolve();
11
8
  };
12
-
13
9
  export default redirectTo;
@@ -1,7 +1,7 @@
1
1
  /// <reference path="../../@types/api.d.ts" />
2
- var requestCloud = function () {
2
+
3
+ const requestCloud = function () {
3
4
  console.warn('// TODO 暂未实现方法 requestCloud');
4
5
  return undefined;
5
6
  };
6
-
7
7
  export default requestCloud;
@@ -3,6 +3,5 @@ export default function () {
3
3
  console.warn('// TODO 暂未实现方法 wx.requestCloud');
4
4
  return;
5
5
  }
6
-
7
6
  return wx.requestCloud.apply(this, arguments);
8
7
  }
@@ -1,5 +1,4 @@
1
- var setNavigationBarBack = function () {
1
+ const setNavigationBarBack = function () {
2
2
  console.warn('尚未支持');
3
3
  };
4
-
5
4
  export default setNavigationBarBack;
@@ -1,5 +1,4 @@
1
- var setNavigationBarBack = function () {
1
+ const setNavigationBarBack = function () {
2
2
  console.warn('尚未支持');
3
3
  };
4
-
5
4
  export default setNavigationBarBack;
@@ -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
- var setNavigationBarColor = function (options) {
6
- var meta = document.querySelector('meta[name=theme-color]');
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
- var setNavigationBarTitle = function (options) {
6
- var title = options.title;
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?: any) => Promise<any>;
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;
@@ -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
- var switchTab = function (options) {
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
@@ -1,4 +1,4 @@
1
- declare type Opts = {
1
+ type Opts = {
2
2
  deprecated?: boolean;
3
3
  namespace?: string;
4
4
  };
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
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
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
6
  console.warn("\u8BE5\u65B9\u6CD5 ".concat(name, " \u5DF2\u5F03\u7528"));
9
7
  }
10
-
11
- var inst = typeof ty === 'undefined' ? {} : ty;
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
11
  console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u65B9\u6CD5 ".concat(opts.namespace ? opts.namespace + '.' : '').concat(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
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24
-
18
+ let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25
19
  if (opts.deprecated) {
26
20
  console.warn("\u8BE5\u53D8\u91CF ".concat(name, " \u5DF2\u5F03\u7528"));
27
21
  }
28
-
29
- var inst = typeof ty === 'undefined' ? {} : ty;
30
-
22
+ const inst = typeof ty === 'undefined' ? {} : ty;
31
23
  if (!inst[name]) {
32
24
  console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u53D8\u91CF ".concat(name));
33
25
  return;
34
26
  }
35
-
36
27
  return inst[name];
37
28
  }
@@ -1,4 +1,4 @@
1
- declare type Opts = {
1
+ type Opts = {
2
2
  deprecated?: boolean;
3
3
  namespace?: string;
4
4
  };
@@ -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
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
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
8
  console.warn("\u8BE5\u65B9\u6CD5 ".concat(name, " \u5DF2\u5F03\u7528"));
12
- } // eslint-disable-next-line prefer-rest-params
13
-
14
-
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
16
  console.warn("\u8BE5\u65B9\u6CD5 ".concat(name, " \u5DF2\u5F03\u7528"));
22
17
  }
23
-
24
18
  if (!tyWx[name] && !wx[name]) {
25
19
  console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u65B9\u6CD5 wx.".concat(name));
26
20
  return;
27
- } // 优先取得 TTT 能力的方法
28
-
29
-
21
+ }
22
+ // 优先取得 TTT 能力的方法
30
23
  if (tyWx[name]) {
31
24
  return tyWx[name].apply(this, arguments);
32
- } // eslint-disable-next-line prefer-rest-params
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
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
40
-
31
+ let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
41
32
  if (opts.deprecated) {
42
33
  console.warn("\u8BE5\u53D8\u91CF ".concat(name, " \u5DF2\u5F03\u7528"));
43
34
  }
44
-
45
- var inst = typeof wx === 'undefined' ? {} : wx;
46
-
35
+ const inst = typeof wx === 'undefined' ? {} : wx;
47
36
  if (!inst[name]) {
48
37
  console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u53D8\u91CF ".concat(name));
49
38
  return;
50
39
  }
51
-
52
40
  return inst[name];
53
41
  }
package/lib/viewAPI.js CHANGED
@@ -1,14 +1,15 @@
1
1
  /// <reference path="../@types/api.d.ts" />
2
+
2
3
  import { factory, factoryContants } from './utils';
3
- export var env = factoryContants('env');
4
- export var createAnimation = factory('createAnimation');
5
- export var pageScrollTo = factory('pageScrollTo');
6
- export var createSelectorQuery = factory('createSelectorQuery');
7
- export var createIntersectionObserver = factory('createIntersectionObserver');
8
- export var createCanvasContext = factory('createCanvasContext');
9
- export var canvasGetImageData = factory('canvasGetImageData');
10
- export var canvasPutImageData = factory('canvasPutImageData');
11
- export var createVideoContext = factory('createVideoContext');
12
- export var createMapContext = factory('createMapContext');
13
- export var createIpcPlayerContext = factory('createIpcPlayerContext');
14
- export var createCameraContext = factory('createCameraContext');
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 createMapContext = factory('createMapContext');
14
+ export const createIpcPlayerContext = factory('createIpcPlayerContext');
15
+ export const createCameraContext = factory('createCameraContext');
package/package.json CHANGED
@@ -1,49 +1,49 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.4.0-alpha.1",
3
+ "version": "1.4.0-alpha.11",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
7
7
  ],
8
+ "repository": {},
8
9
  "license": "MIT",
9
- "main": "lib/index.js",
10
- "files": [
11
- "lib",
12
- "@types"
10
+ "maintainers": [
11
+ {
12
+ "name": "tuyafe",
13
+ "email": "tuyafe@tuya.com"
14
+ }
13
15
  ],
14
16
  "sideEffects": [
15
17
  "*.less",
16
18
  "*.css"
17
19
  ],
18
- "publishConfig": {
19
- "access": "public",
20
- "registry": "https://registry.npmjs.org"
21
- },
20
+ "main": "lib/index.js",
21
+ "files": [
22
+ "lib",
23
+ "@types"
24
+ ],
22
25
  "scripts": {
23
- "clean": "rm -rf lib",
24
26
  "build": "ray build --type=component",
25
- "watch": "ray start --type=component",
26
- "build:kit:api": "node scripts/api-creator.mjs"
27
+ "build:kit:api": "node scripts/api-creator.mjs",
28
+ "clean": "rm -rf lib",
29
+ "watch": "ray start --type=component"
27
30
  },
28
31
  "dependencies": {
29
- "@ray-js/framework": "^1.4.0-alpha.1",
30
- "@ray-js/router": "^1.4.0-alpha.1",
31
- "@ray-js/wechat": "^0.0.16",
32
+ "@ray-js/framework": "^1.4.0-alpha.11",
33
+ "@ray-js/router": "^1.4.0-alpha.11",
34
+ "@ray-js/wechat": "^0.0.33",
32
35
  "base64-browser": "^1.0.1"
33
36
  },
34
37
  "devDependencies": {
35
- "@ray-js/cli": "^1.4.0-alpha.1",
38
+ "@ray-js/cli": "^1.4.0-alpha.11",
36
39
  "art-template": "^4.13.2",
37
40
  "fs-extra": "^10.1.0",
38
- "miniprogram-api-typings": "^3.4.3",
41
+ "miniprogram-api-typings": "^3.12.0",
39
42
  "react": "^17.0.2"
40
43
  },
41
- "maintainers": [
42
- {
43
- "name": "tuyafe",
44
- "email": "tuyafe@tuya.com"
45
- }
46
- ],
47
- "gitHead": "4340240aafe16c03853241e2356134610e65443e",
48
- "repository": {}
44
+ "publishConfig": {
45
+ "access": "public",
46
+ "registry": "https://registry.npmjs.org"
47
+ },
48
+ "gitHead": "5e9c8e1d288eeaf707d34515399784d98ec13a1e"
49
49
  }