@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.
- package/@types/api-extend.d.ts +55 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/lifecycles/index.d.ts +13 -0
- package/lib/lifecycles/index.js +13 -0
- package/lib/lifecycles/offAppEvent/index.d.ts +2 -0
- package/lib/lifecycles/offAppEvent/index.js +6 -0
- package/lib/lifecycles/offAppEvent/index.thing.d.ts +2 -0
- package/lib/lifecycles/offAppEvent/index.thing.js +1 -0
- package/lib/lifecycles/offAppEvent/index.wechat.d.ts +1 -0
- package/lib/lifecycles/offAppEvent/index.wechat.js +4 -0
- package/lib/lifecycles/offAppHide/index.d.ts +2 -0
- package/lib/lifecycles/offAppHide/index.js +6 -0
- package/lib/lifecycles/offAppHide/index.thing.d.ts +2 -0
- package/lib/lifecycles/offAppHide/index.thing.js +1 -0
- package/lib/lifecycles/offAppHide/index.wechat.d.ts +2 -0
- package/lib/lifecycles/offAppHide/index.wechat.js +1 -0
- package/lib/lifecycles/offAppShow/index.d.ts +2 -0
- package/lib/lifecycles/offAppShow/index.js +6 -0
- package/lib/lifecycles/offAppShow/index.thing.d.ts +2 -0
- package/lib/lifecycles/offAppShow/index.thing.js +1 -0
- package/lib/lifecycles/offAppShow/index.wechat.d.ts +2 -0
- package/lib/lifecycles/offAppShow/index.wechat.js +1 -0
- package/lib/lifecycles/offError/index.d.ts +2 -0
- package/lib/lifecycles/offError/index.js +6 -0
- package/lib/lifecycles/offError/index.thing.d.ts +2 -0
- package/lib/lifecycles/offError/index.thing.js +1 -0
- package/lib/lifecycles/offError/index.wechat.d.ts +2 -0
- package/lib/lifecycles/offError/index.wechat.js +1 -0
- package/lib/lifecycles/offThemeChange/index.d.ts +2 -0
- package/lib/lifecycles/offThemeChange/index.js +6 -0
- package/lib/lifecycles/offThemeChange/index.thing.d.ts +2 -0
- package/lib/lifecycles/offThemeChange/index.thing.js +1 -0
- package/lib/lifecycles/offThemeChange/index.wechat.d.ts +2 -0
- package/lib/lifecycles/offThemeChange/index.wechat.js +1 -0
- package/lib/lifecycles/offWindowResize/index.d.ts +2 -0
- package/lib/lifecycles/offWindowResize/index.js +6 -0
- package/lib/lifecycles/offWindowResize/index.thing.d.ts +2 -0
- package/lib/lifecycles/offWindowResize/index.thing.js +1 -0
- package/lib/lifecycles/offWindowResize/index.wechat.d.ts +2 -0
- package/lib/lifecycles/offWindowResize/index.wechat.js +1 -0
- package/lib/lifecycles/onAppEvent/index.d.ts +2 -0
- package/lib/lifecycles/onAppEvent/index.js +6 -0
- package/lib/lifecycles/onAppEvent/index.thing.d.ts +2 -0
- package/lib/lifecycles/onAppEvent/index.thing.js +1 -0
- package/lib/lifecycles/onAppEvent/index.wechat.d.ts +1 -0
- package/lib/lifecycles/onAppEvent/index.wechat.js +4 -0
- package/lib/lifecycles/onAppHide/index.d.ts +2 -0
- package/lib/lifecycles/onAppHide/index.js +6 -0
- package/lib/lifecycles/onAppHide/index.thing.d.ts +2 -0
- package/lib/lifecycles/onAppHide/index.thing.js +1 -0
- package/lib/lifecycles/onAppHide/index.wechat.d.ts +2 -0
- package/lib/lifecycles/onAppHide/index.wechat.js +1 -0
- package/lib/lifecycles/onAppShow/index.d.ts +2 -0
- package/lib/lifecycles/onAppShow/index.js +6 -0
- package/lib/lifecycles/onAppShow/index.thing.d.ts +2 -0
- package/lib/lifecycles/onAppShow/index.thing.js +1 -0
- package/lib/lifecycles/onAppShow/index.wechat.d.ts +2 -0
- package/lib/lifecycles/onAppShow/index.wechat.js +1 -0
- package/lib/lifecycles/onError/index.d.ts +2 -0
- package/lib/lifecycles/onError/index.js +6 -0
- package/lib/lifecycles/onError/index.thing.d.ts +2 -0
- package/lib/lifecycles/onError/index.thing.js +1 -0
- package/lib/lifecycles/onError/index.wechat.d.ts +2 -0
- package/lib/lifecycles/onError/index.wechat.js +1 -0
- package/lib/lifecycles/onPageNotFound/index.d.ts +2 -0
- package/lib/lifecycles/onPageNotFound/index.js +6 -0
- package/lib/lifecycles/onPageNotFound/index.thing.d.ts +2 -0
- package/lib/lifecycles/onPageNotFound/index.thing.js +1 -0
- package/lib/lifecycles/onPageNotFound/index.wechat.d.ts +2 -0
- package/lib/lifecycles/onPageNotFound/index.wechat.js +1 -0
- package/lib/lifecycles/onThemeChange/index.d.ts +2 -0
- package/lib/lifecycles/onThemeChange/index.js +6 -0
- package/lib/lifecycles/onThemeChange/index.thing.d.ts +2 -0
- package/lib/lifecycles/onThemeChange/index.thing.js +1 -0
- package/lib/lifecycles/onThemeChange/index.wechat.d.ts +2 -0
- package/lib/lifecycles/onThemeChange/index.wechat.js +1 -0
- package/lib/lifecycles/onWindowResize/index.d.ts +2 -0
- package/lib/lifecycles/onWindowResize/index.js +6 -0
- package/lib/lifecycles/onWindowResize/index.thing.d.ts +2 -0
- package/lib/lifecycles/onWindowResize/index.thing.js +1 -0
- package/lib/lifecycles/onWindowResize/index.wechat.d.ts +2 -0
- package/lib/lifecycles/onWindowResize/index.wechat.js +1 -0
- package/package.json +5 -5
package/@types/api-extend.d.ts
CHANGED
@@ -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 @@
|
|
1
|
+
export default ty.offAppEvent;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function (): undefined;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.offAppHide;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.offAppHide;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.offAppShow;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.offAppShow;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.offError;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.offError;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.offThemeChange;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.offThemeChange;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.offWindowResize;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.offWindowResize;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.onAppEvent;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function (): undefined;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.onAppHide;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.onAppHide;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.onAppShow;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.onAppShow;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.onError;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.onError;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.onPageNotFound;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.onPageNotFound;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.onThemeChange;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default wx.onThemeChange;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default ty.onWindowResize;
|
@@ -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.
|
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.
|
30
|
-
"@ray-js/router": "^0.6.
|
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.
|
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": "
|
45
|
+
"gitHead": "f1cf3886811c99b1b1a9c509c21c43d9518d0c0c",
|
46
46
|
"repository": {}
|
47
47
|
}
|