@ray-js/api 0.6.11 → 0.6.12-beta-2

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.
Files changed (84) hide show
  1. package/@types/api-extend.d.ts +55 -0
  2. package/lib/index.d.ts +1 -0
  3. package/lib/index.js +1 -0
  4. package/lib/lifecycles/index.d.ts +13 -0
  5. package/lib/lifecycles/index.js +13 -0
  6. package/lib/lifecycles/offAppEvent/index.d.ts +2 -0
  7. package/lib/lifecycles/offAppEvent/index.js +6 -0
  8. package/lib/lifecycles/offAppEvent/index.thing.d.ts +2 -0
  9. package/lib/lifecycles/offAppEvent/index.thing.js +1 -0
  10. package/lib/lifecycles/offAppEvent/index.wechat.d.ts +1 -0
  11. package/lib/lifecycles/offAppEvent/index.wechat.js +4 -0
  12. package/lib/lifecycles/offAppHide/index.d.ts +2 -0
  13. package/lib/lifecycles/offAppHide/index.js +6 -0
  14. package/lib/lifecycles/offAppHide/index.thing.d.ts +2 -0
  15. package/lib/lifecycles/offAppHide/index.thing.js +1 -0
  16. package/lib/lifecycles/offAppHide/index.wechat.d.ts +2 -0
  17. package/lib/lifecycles/offAppHide/index.wechat.js +1 -0
  18. package/lib/lifecycles/offAppShow/index.d.ts +2 -0
  19. package/lib/lifecycles/offAppShow/index.js +6 -0
  20. package/lib/lifecycles/offAppShow/index.thing.d.ts +2 -0
  21. package/lib/lifecycles/offAppShow/index.thing.js +1 -0
  22. package/lib/lifecycles/offAppShow/index.wechat.d.ts +2 -0
  23. package/lib/lifecycles/offAppShow/index.wechat.js +1 -0
  24. package/lib/lifecycles/offError/index.d.ts +2 -0
  25. package/lib/lifecycles/offError/index.js +6 -0
  26. package/lib/lifecycles/offError/index.thing.d.ts +2 -0
  27. package/lib/lifecycles/offError/index.thing.js +1 -0
  28. package/lib/lifecycles/offError/index.wechat.d.ts +2 -0
  29. package/lib/lifecycles/offError/index.wechat.js +1 -0
  30. package/lib/lifecycles/offThemeChange/index.d.ts +2 -0
  31. package/lib/lifecycles/offThemeChange/index.js +6 -0
  32. package/lib/lifecycles/offThemeChange/index.thing.d.ts +2 -0
  33. package/lib/lifecycles/offThemeChange/index.thing.js +1 -0
  34. package/lib/lifecycles/offThemeChange/index.wechat.d.ts +2 -0
  35. package/lib/lifecycles/offThemeChange/index.wechat.js +1 -0
  36. package/lib/lifecycles/offWindowResize/index.d.ts +2 -0
  37. package/lib/lifecycles/offWindowResize/index.js +6 -0
  38. package/lib/lifecycles/offWindowResize/index.thing.d.ts +2 -0
  39. package/lib/lifecycles/offWindowResize/index.thing.js +1 -0
  40. package/lib/lifecycles/offWindowResize/index.wechat.d.ts +2 -0
  41. package/lib/lifecycles/offWindowResize/index.wechat.js +1 -0
  42. package/lib/lifecycles/onAppEvent/index.d.ts +2 -0
  43. package/lib/lifecycles/onAppEvent/index.js +6 -0
  44. package/lib/lifecycles/onAppEvent/index.thing.d.ts +2 -0
  45. package/lib/lifecycles/onAppEvent/index.thing.js +1 -0
  46. package/lib/lifecycles/onAppEvent/index.wechat.d.ts +1 -0
  47. package/lib/lifecycles/onAppEvent/index.wechat.js +4 -0
  48. package/lib/lifecycles/onAppHide/index.d.ts +2 -0
  49. package/lib/lifecycles/onAppHide/index.js +6 -0
  50. package/lib/lifecycles/onAppHide/index.thing.d.ts +2 -0
  51. package/lib/lifecycles/onAppHide/index.thing.js +1 -0
  52. package/lib/lifecycles/onAppHide/index.wechat.d.ts +2 -0
  53. package/lib/lifecycles/onAppHide/index.wechat.js +1 -0
  54. package/lib/lifecycles/onAppShow/index.d.ts +2 -0
  55. package/lib/lifecycles/onAppShow/index.js +6 -0
  56. package/lib/lifecycles/onAppShow/index.thing.d.ts +2 -0
  57. package/lib/lifecycles/onAppShow/index.thing.js +1 -0
  58. package/lib/lifecycles/onAppShow/index.wechat.d.ts +2 -0
  59. package/lib/lifecycles/onAppShow/index.wechat.js +1 -0
  60. package/lib/lifecycles/onError/index.d.ts +2 -0
  61. package/lib/lifecycles/onError/index.js +6 -0
  62. package/lib/lifecycles/onError/index.thing.d.ts +2 -0
  63. package/lib/lifecycles/onError/index.thing.js +1 -0
  64. package/lib/lifecycles/onError/index.wechat.d.ts +2 -0
  65. package/lib/lifecycles/onError/index.wechat.js +1 -0
  66. package/lib/lifecycles/onPageNotFound/index.d.ts +2 -0
  67. package/lib/lifecycles/onPageNotFound/index.js +6 -0
  68. package/lib/lifecycles/onPageNotFound/index.thing.d.ts +2 -0
  69. package/lib/lifecycles/onPageNotFound/index.thing.js +1 -0
  70. package/lib/lifecycles/onPageNotFound/index.wechat.d.ts +2 -0
  71. package/lib/lifecycles/onPageNotFound/index.wechat.js +1 -0
  72. package/lib/lifecycles/onThemeChange/index.d.ts +2 -0
  73. package/lib/lifecycles/onThemeChange/index.js +6 -0
  74. package/lib/lifecycles/onThemeChange/index.thing.d.ts +2 -0
  75. package/lib/lifecycles/onThemeChange/index.thing.js +1 -0
  76. package/lib/lifecycles/onThemeChange/index.wechat.d.ts +2 -0
  77. package/lib/lifecycles/onThemeChange/index.wechat.js +1 -0
  78. package/lib/lifecycles/onWindowResize/index.d.ts +2 -0
  79. package/lib/lifecycles/onWindowResize/index.js +6 -0
  80. package/lib/lifecycles/onWindowResize/index.thing.d.ts +2 -0
  81. package/lib/lifecycles/onWindowResize/index.thing.js +1 -0
  82. package/lib/lifecycles/onWindowResize/index.wechat.d.ts +2 -0
  83. package/lib/lifecycles/onWindowResize/index.wechat.js +1 -0
  84. package/package.json +5 -5
@@ -1,9 +1,45 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  type OriginRequestCloudParams = Parameters<typeof ty.apiRequestByAtop>[0]
2
3
  type RequestCloudParams = Omit<OriginRequestCloudParams, 'postData'> & {
3
4
  data: OriginRequestCloudParams['postData']
4
5
  }
5
6
  type RequestCloudReturn = ReturnType<typeof ty.apiRequestByAtop>
6
7
 
8
+ type IAnyObject = Record<string, any>
9
+ /** 启动参数 */
10
+ interface LaunchOptionsApp {
11
+ /** 启动小程序的路径 (代码包路径) */
12
+ path: string
13
+ /** 启动小程序的 query 参数 */
14
+ query: IAnyObject
15
+ [key: string]: any
16
+ }
17
+ interface GeneralCallbackResult {
18
+ [key: string]: any
19
+ }
20
+ /** 小程序切前台事件的监听函数 */
21
+ type OnAppShowListeners = (
22
+ /** 启动参数 */
23
+ options?: LaunchOptionsApp
24
+ ) => void
25
+
26
+ type OnThemeChangelisteners = (result: OnThemeChangeListenerResult) => void
27
+ type OffThemeChangelisteners = (result: OnThemeChangeListenerResult) => void
28
+ type OnWindowResizeListeners = (result: OnWindowResizeListenerResult) => void
29
+ type OffWindowResizeListeners = (result: OnWindowResizeListenerResult) => void
30
+
31
+ interface OnWindowResizeListenerResult {
32
+ type: string
33
+ size: { windowWidth: number; windowHeight: number }
34
+ }
35
+ interface OnThemeChangeListenerResult {
36
+ /** 系统当前的主题,取值为`light`或`dark`
37
+ *
38
+ * 可选值:
39
+ * - 'dark': 深色主题;
40
+ * - 'light': 浅色主题; */
41
+ theme: 'dark' | 'light'
42
+ }
7
43
  declare namespace ty {
8
44
  /**
9
45
  * 小程序云能力
@@ -20,6 +56,25 @@ declare namespace ty {
20
56
  * @plugin xxx@1.1.2
21
57
  */
22
58
  export function requestCloud<T>(params: RequestCloudParams): Promise<T>
59
+
60
+ export function onAppShow(listeners: OnAppShowListeners)
61
+ export function offAppShow(listeners?: (res: GeneralCallbackResult) => void)
62
+ export function onAppHide(listener: (res: GeneralCallbackResult) => void)
63
+ export function offAppHide(listeners?: (res: GeneralCallbackResult) => void)
64
+ export function onWindowResize(listeners: OnWindowResizeListeners)
65
+ export function offWindowResize(listeners?: OffWindowResizeListeners)
66
+ export function onError(
67
+ listeners: (
68
+ /** 错误信息,包含堆栈 */
69
+ error?: string
70
+ ) => void
71
+ )
72
+ export function offError(listeners?: (res: GeneralCallbackResult) => void)
73
+ export function onAppEvent(listener: (res: GeneralCallbackResult) => void)
74
+ export function offAppEvent(listener?: (res: GeneralCallbackResult) => void)
75
+ export function onThemeChange(listener: OnThemeChangelisteners)
76
+ export function offThemeChange(listener?: OffThemeChangelisteners)
77
+ export function onPageNotFound(listeners: ({ url: string, query: CommonObject }) => void)
23
78
  }
24
79
 
25
80
  declare namespace WechatMiniprogram {
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference path="../@types/api.d.ts" />
2
2
  export * from './all-kits';
3
+ export * from './lifecycles';
3
4
  export { default as getApp } from './getApp';
4
5
  export { default as getBoundingClientRect } from './getBoundingClientRect';
5
6
  export { default as getCurrentPages } from './getCurrentPages';
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference path="../@types/api.d.ts" />
2
2
  export * from './all-kits';
3
+ export * from './lifecycles';
3
4
  export { default as getApp } from './getApp';
4
5
  export { default as getBoundingClientRect } from './getBoundingClientRect';
5
6
  export { default as getCurrentPages } from './getCurrentPages';
@@ -0,0 +1,13 @@
1
+ export { default as offAppEvent } from './offAppEvent';
2
+ export { default as offAppHide } from './offAppHide';
3
+ export { default as offAppShow } from './offAppShow';
4
+ export { default as offError } from './offError';
5
+ export { default as offThemeChange } from './offThemeChange';
6
+ export { default as offWindowResize } from './offWindowResize';
7
+ export { default as onAppEvent } from './onAppEvent';
8
+ export { default as onAppHide } from './onAppHide';
9
+ export { default as onAppShow } from './onAppShow';
10
+ export { default as onError } from './onError';
11
+ export { default as onPageNotFound } from './onPageNotFound';
12
+ export { default as onThemeChange } from './onThemeChange';
13
+ export { default as onWindowResize } from './onWindowResize';
@@ -0,0 +1,13 @@
1
+ export { default as offAppEvent } from './offAppEvent';
2
+ export { default as offAppHide } from './offAppHide';
3
+ export { default as offAppShow } from './offAppShow';
4
+ export { default as offError } from './offError';
5
+ export { default as offThemeChange } from './offThemeChange';
6
+ export { default as offWindowResize } from './offWindowResize';
7
+ export { default as onAppEvent } from './onAppEvent';
8
+ export { default as onAppHide } from './onAppHide';
9
+ export { default as onAppShow } from './onAppShow';
10
+ export { default as onError } from './onError';
11
+ export { default as onPageNotFound } from './onPageNotFound';
12
+ export { default as onThemeChange } from './onThemeChange';
13
+ export { default as onWindowResize } from './onWindowResize';
@@ -0,0 +1,2 @@
1
+ declare const offAppEvent: typeof ty.offAppEvent;
2
+ export default offAppEvent;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var offAppEvent = function () {
3
+ console.warn('// TODO 暂未实现方法 offAppEvent');
4
+ };
5
+
6
+ export default offAppEvent;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.offAppEvent;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.offAppEvent;
@@ -0,0 +1 @@
1
+ export default function (): undefined;
@@ -0,0 +1,4 @@
1
+ export default function () {
2
+ console.warn('// TODO 暂未实现方法');
3
+ return undefined;
4
+ }
@@ -0,0 +1,2 @@
1
+ declare const offAppHide: typeof ty.offAppHide;
2
+ export default offAppHide;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var offAppHide = function () {
3
+ console.warn('// TODO 暂未实现方法 offAppHide');
4
+ };
5
+
6
+ export default offAppHide;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.offAppHide;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.offAppHide;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.offAppHide;
@@ -0,0 +1,2 @@
1
+ declare const offAppShow: typeof ty.offAppShow;
2
+ export default offAppShow;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var offAppShow = function () {
3
+ console.warn('// TODO 暂未实现方法 offAppShow');
4
+ };
5
+
6
+ export default offAppShow;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.offAppShow;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.offAppShow;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.offAppShow;
@@ -0,0 +1,2 @@
1
+ declare const offError: typeof ty.offError;
2
+ export default offError;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var offError = function () {
3
+ console.warn('// TODO 暂未实现方法 offError');
4
+ };
5
+
6
+ export default offError;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.offError;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.offError;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.offError;
@@ -0,0 +1,2 @@
1
+ declare const offThemeChange: typeof ty.offThemeChange;
2
+ export default offThemeChange;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var offThemeChange = function () {
3
+ console.warn('// TODO 暂未实现方法 offThemeChange');
4
+ };
5
+
6
+ export default offThemeChange;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.offThemeChange;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.offThemeChange;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.offThemeChange;
@@ -0,0 +1,2 @@
1
+ declare const offWindowResize: typeof ty.offWindowResize;
2
+ export default offWindowResize;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var offWindowResize = function () {
3
+ console.warn('// TODO 暂未实现方法 offWindowResize');
4
+ };
5
+
6
+ export default offWindowResize;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.offWindowResize;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.offWindowResize;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.offWindowResize;
@@ -0,0 +1,2 @@
1
+ declare const onAppEvent: typeof ty.onAppEvent;
2
+ export default onAppEvent;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var onAppEvent = function () {
3
+ console.warn('// TODO 暂未实现方法 onAppEvent');
4
+ };
5
+
6
+ export default onAppEvent;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.onAppEvent;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.onAppEvent;
@@ -0,0 +1 @@
1
+ export default function (): undefined;
@@ -0,0 +1,4 @@
1
+ export default function () {
2
+ console.warn('// TODO 暂未实现方法');
3
+ return undefined;
4
+ }
@@ -0,0 +1,2 @@
1
+ declare const onAppHide: typeof ty.onAppHide;
2
+ export default onAppHide;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var onAppHide = function () {
3
+ console.warn('// TODO 暂未实现方法 onAppHide');
4
+ };
5
+
6
+ export default onAppHide;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.onAppHide;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.onAppHide;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.onAppHide;
@@ -0,0 +1,2 @@
1
+ declare const onAppShow: typeof ty.onAppShow;
2
+ export default onAppShow;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var onAppShow = function () {
3
+ console.warn('// TODO 暂未实现方法 onAppShow');
4
+ };
5
+
6
+ export default onAppShow;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.onAppShow;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.onAppShow;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.onAppShow;
@@ -0,0 +1,2 @@
1
+ declare const onError: typeof ty.onError;
2
+ export default onError;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var onError = function () {
3
+ console.warn('// TODO 暂未实现方法 onError');
4
+ };
5
+
6
+ export default onError;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.onError;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.onError;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.onError;
@@ -0,0 +1,2 @@
1
+ declare const onPageNotFound: typeof ty.onPageNotFound;
2
+ export default onPageNotFound;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var onPageNotFound = function () {
3
+ console.warn('// TODO 暂未实现方法 onPageNotFound');
4
+ };
5
+
6
+ export default onPageNotFound;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.onPageNotFound;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.onPageNotFound;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.onPageNotFound;
@@ -0,0 +1,2 @@
1
+ declare const onThemeChange: typeof ty.onThemeChange;
2
+ export default onThemeChange;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var onThemeChange = function () {
3
+ console.warn('// TODO 暂未实现方法 onThemeChange');
4
+ };
5
+
6
+ export default onThemeChange;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.onThemeChange;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.onThemeChange;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.onThemeChange;
@@ -0,0 +1,2 @@
1
+ declare const onWindowResize: typeof ty.onWindowResize;
2
+ export default onWindowResize;
@@ -0,0 +1,6 @@
1
+ /// <reference path="../../@types/api.d.ts" />
2
+ var onWindowResize = function () {
3
+ console.warn('// TODO 暂未实现方法 onWindowResize');
4
+ };
5
+
6
+ export default onWindowResize;
@@ -0,0 +1,2 @@
1
+ declare const _default: typeof ty.onWindowResize;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default ty.onWindowResize;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default wx.onWindowResize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "0.6.11",
3
+ "version": "0.6.12-beta-2",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -26,11 +26,11 @@
26
26
  "build:kit:api": "node scripts/api-creator.mjs"
27
27
  },
28
28
  "dependencies": {
29
- "@ray-js/framework": "^0.6.11",
30
- "@ray-js/router": "^0.6.11"
29
+ "@ray-js/framework": "^0.6.12-beta-2",
30
+ "@ray-js/router": "^0.6.12-beta-2"
31
31
  },
32
32
  "devDependencies": {
33
- "@ray-js/cli": "^0.6.11",
33
+ "@ray-js/cli": "^0.6.12-beta-2",
34
34
  "art-template": "^4.13.2",
35
35
  "fs-extra": "^10.1.0",
36
36
  "miniprogram-api-typings": "^3.4.3",
@@ -42,6 +42,6 @@
42
42
  "email": "tuyafe@tuya.com"
43
43
  }
44
44
  ],
45
- "gitHead": "a5a5e82cfc1e4e47e54dd0f976bd7ca44d837ddc",
45
+ "gitHead": "f1cf3886811c99b1b1a9c509c21c43d9518d0c0c",
46
46
  "repository": {}
47
47
  }