@lingxia/types 0.5.1 → 0.6.3
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/dist/app/index.d.ts +121 -16
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +1 -2
- package/dist/app/index.js.map +1 -1
- package/dist/device/actions.d.ts +1 -2
- package/dist/device/actions.d.ts.map +1 -1
- package/dist/device/actions.js +1 -2
- package/dist/device/actions.js.map +1 -1
- package/dist/device/info.d.ts +1 -2
- package/dist/device/info.d.ts.map +1 -1
- package/dist/device/info.js +1 -2
- package/dist/device/info.js.map +1 -1
- package/dist/device/network.d.ts +1 -2
- package/dist/device/network.d.ts.map +1 -1
- package/dist/device/network.js +1 -2
- package/dist/device/network.js.map +1 -1
- package/dist/device/wifi.d.ts +1 -2
- package/dist/device/wifi.d.ts.map +1 -1
- package/dist/device/wifi.js +1 -2
- package/dist/device/wifi.js.map +1 -1
- package/dist/display/index.d.ts +1 -2
- package/dist/display/index.d.ts.map +1 -1
- package/dist/display/index.js +1 -2
- package/dist/display/index.js.map +1 -1
- package/dist/env/index.d.ts +8 -0
- package/dist/env/index.d.ts.map +1 -0
- package/dist/env/index.js +6 -0
- package/dist/env/index.js.map +1 -0
- package/dist/file/index.d.ts +88 -52
- package/dist/file/index.d.ts.map +1 -1
- package/dist/file/index.js +0 -1
- package/dist/file/index.js.map +1 -1
- package/dist/index.d.ts +25 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/input/index.d.ts +1 -2
- package/dist/input/index.d.ts.map +1 -1
- package/dist/input/index.js +1 -2
- package/dist/input/index.js.map +1 -1
- package/dist/location/index.d.ts +1 -2
- package/dist/location/index.d.ts.map +1 -1
- package/dist/location/index.js +1 -2
- package/dist/location/index.js.map +1 -1
- package/dist/lxapp/index.d.ts +11 -0
- package/dist/lxapp/index.d.ts.map +1 -0
- package/dist/lxapp/index.js +6 -0
- package/dist/lxapp/index.js.map +1 -0
- package/dist/media/index.d.ts +4 -10
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +1 -2
- package/dist/media/index.js.map +1 -1
- package/dist/navigator/index.d.ts +7 -3
- package/dist/navigator/index.d.ts.map +1 -1
- package/dist/navigator/index.js +1 -2
- package/dist/navigator/index.js.map +1 -1
- package/dist/storage/index.d.ts +1 -6
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +1 -2
- package/dist/storage/index.js.map +1 -1
- package/dist/system/index.d.ts +1 -8
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +1 -2
- package/dist/system/index.js.map +1 -1
- package/dist/transfer/index.d.ts +121 -0
- package/dist/transfer/index.d.ts.map +1 -0
- package/dist/transfer/index.js +6 -0
- package/dist/transfer/index.js.map +1 -0
- package/dist/ui/index.d.ts +63 -25
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -2
- package/dist/ui/index.js.map +1 -1
- package/dist/update/index.d.ts +2 -3
- package/dist/update/index.d.ts.map +1 -1
- package/dist/update/index.js +1 -2
- package/dist/update/index.js.map +1 -1
- package/package.json +11 -1
- package/src/app/index.ts +151 -19
- package/src/device/actions.ts +1 -2
- package/src/device/info.ts +1 -2
- package/src/device/network.ts +1 -2
- package/src/device/wifi.ts +1 -2
- package/src/display/index.ts +1 -2
- package/src/env/index.ts +8 -0
- package/src/file/index.ts +100 -51
- package/src/index.ts +36 -17
- package/src/input/index.ts +1 -2
- package/src/location/index.ts +1 -2
- package/src/lxapp/index.ts +12 -0
- package/src/media/index.ts +4 -10
- package/src/navigator/index.ts +9 -3
- package/src/storage/index.ts +1 -7
- package/src/system/index.ts +1 -9
- package/src/transfer/index.ts +136 -0
- package/src/ui/index.ts +75 -25
- package/src/update/index.ts +2 -3
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* UI APIs
|
|
3
|
-
* Corresponds to: lingxia-logic/src/ui/
|
|
2
|
+
* UI feedback, navigation, and surface control APIs.
|
|
4
3
|
*/
|
|
5
|
-
import type { EventEmitter } from '../app';
|
|
6
4
|
export interface ShowToastOptions {
|
|
7
5
|
title: string;
|
|
8
6
|
icon?: 'success' | 'error' | 'loading' | 'none';
|
|
@@ -31,24 +29,24 @@ export interface ShowActionSheetOptions {
|
|
|
31
29
|
export interface ActionSheetResult {
|
|
32
30
|
tapIndex: number;
|
|
33
31
|
}
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
export type PageQueryValue = string | number | boolean | null | undefined;
|
|
33
|
+
export type PageQuery = Record<string, PageQueryValue>;
|
|
34
|
+
export type PageTargetOptions = {
|
|
35
|
+
page: string;
|
|
36
|
+
path?: never;
|
|
37
|
+
query?: PageQuery;
|
|
38
|
+
} | {
|
|
39
|
+
path: string;
|
|
40
|
+
page?: never;
|
|
41
|
+
query?: PageQuery;
|
|
42
|
+
};
|
|
43
|
+
export type NavigateToOptions = PageTargetOptions;
|
|
40
44
|
export interface NavigateBackOptions {
|
|
41
45
|
delta: number;
|
|
42
46
|
}
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export interface SwitchTabOptions {
|
|
47
|
-
url: string;
|
|
48
|
-
}
|
|
49
|
-
export interface ReLaunchOptions {
|
|
50
|
-
url: string;
|
|
51
|
-
}
|
|
47
|
+
export type RedirectToOptions = PageTargetOptions;
|
|
48
|
+
export type SwitchTabOptions = PageTargetOptions;
|
|
49
|
+
export type ReLaunchOptions = PageTargetOptions;
|
|
52
50
|
export interface SetNavigationBarTitleOptions {
|
|
53
51
|
title: string;
|
|
54
52
|
}
|
|
@@ -78,15 +76,55 @@ export interface SetTabBarItemOptions {
|
|
|
78
76
|
iconPath?: string;
|
|
79
77
|
selectedIconPath?: string;
|
|
80
78
|
}
|
|
81
|
-
export
|
|
79
|
+
export type SurfaceQueryValue = PageQueryValue;
|
|
80
|
+
export type SurfaceQuery = PageQuery;
|
|
81
|
+
export type SurfacePageTargetOptions = {
|
|
82
|
+
page: string;
|
|
83
|
+
path?: never;
|
|
84
|
+
url?: never;
|
|
85
|
+
query?: SurfaceQuery;
|
|
86
|
+
} | {
|
|
87
|
+
path: string;
|
|
88
|
+
page?: never;
|
|
89
|
+
url?: never;
|
|
90
|
+
query?: SurfaceQuery;
|
|
91
|
+
};
|
|
92
|
+
export type SurfaceUrlTargetOptions = {
|
|
82
93
|
url: string;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
export
|
|
88
|
-
|
|
94
|
+
page?: never;
|
|
95
|
+
path?: never;
|
|
96
|
+
query?: never;
|
|
97
|
+
};
|
|
98
|
+
export type SurfaceTargetOptions = SurfacePageTargetOptions | SurfaceUrlTargetOptions;
|
|
99
|
+
/**
|
|
100
|
+
* Popup size value.
|
|
101
|
+
*
|
|
102
|
+
* - number: absolute size, must be > 0
|
|
103
|
+
* - `${number}%`: percentage size, must be > 0% and <= 100%
|
|
104
|
+
*/
|
|
105
|
+
export type PopupSurfaceSizeValue = number | `${number}%`;
|
|
106
|
+
export interface PopupSurfaceSize {
|
|
107
|
+
/** Width for popup surface. */
|
|
108
|
+
width?: PopupSurfaceSizeValue;
|
|
109
|
+
/** Height for popup surface. */
|
|
110
|
+
height?: PopupSurfaceSizeValue;
|
|
111
|
+
}
|
|
112
|
+
export type PopupSurfaceOptions = SurfaceTargetOptions & {
|
|
113
|
+
kind: 'popup';
|
|
114
|
+
position?: 'center' | 'bottom' | 'left' | 'right' | 'top';
|
|
115
|
+
size?: PopupSurfaceSize;
|
|
116
|
+
};
|
|
117
|
+
export interface WindowSurfaceSize {
|
|
118
|
+
/** Window width, must be a positive number. */
|
|
119
|
+
width?: number;
|
|
120
|
+
/** Window height, must be a positive number. */
|
|
121
|
+
height?: number;
|
|
89
122
|
}
|
|
123
|
+
export type WindowSurfaceOptions = SurfaceTargetOptions & {
|
|
124
|
+
kind: 'window';
|
|
125
|
+
size?: WindowSurfaceSize;
|
|
126
|
+
};
|
|
127
|
+
export type SurfaceOpenOptions = PopupSurfaceOptions | WindowSurfaceOptions;
|
|
90
128
|
export interface CapsuleRect {
|
|
91
129
|
width?: number;
|
|
92
130
|
height?: number;
|
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACxC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;I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AI,CAAC,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IACxD,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AAE5E,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
package/dist/ui/index.js
CHANGED
package/dist/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/dist/update/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Corresponds to: lingxia-logic/src/update.rs
|
|
2
|
+
* Runtime update APIs.
|
|
4
3
|
*/
|
|
5
4
|
export interface UpdateManager {
|
|
6
5
|
applyUpdate(): void;
|
|
@@ -10,7 +9,7 @@ export interface UpdateManager {
|
|
|
10
9
|
export interface UpdateReadyInfo {
|
|
11
10
|
version?: string;
|
|
12
11
|
isForceUpdate?: boolean;
|
|
13
|
-
|
|
12
|
+
channel?: "release" | "preview" | "developer" | string;
|
|
14
13
|
}
|
|
15
14
|
export interface UpdateFailedInfo extends UpdateReadyInfo {
|
|
16
15
|
error?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,WAAW,IAAI,IAAI,CAAC;IACpB,aAAa,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,GAAG,IAAI,CAAC;IAC/D,cAAc,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;CACxD;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/update/index.js
CHANGED
package/dist/update/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxia/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "TypeScript type definitions for the LingXia JS API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
"import": "./dist/app/index.js",
|
|
22
22
|
"require": "./dist/app/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./lxapp": {
|
|
25
|
+
"types": "./dist/lxapp/index.d.ts",
|
|
26
|
+
"import": "./dist/lxapp/index.js",
|
|
27
|
+
"require": "./dist/lxapp/index.js"
|
|
28
|
+
},
|
|
24
29
|
"./device": {
|
|
25
30
|
"types": "./dist/device/index.d.ts",
|
|
26
31
|
"import": "./dist/device/index.js",
|
|
@@ -46,6 +51,11 @@
|
|
|
46
51
|
"import": "./dist/file/index.js",
|
|
47
52
|
"require": "./dist/file/index.js"
|
|
48
53
|
},
|
|
54
|
+
"./transfer": {
|
|
55
|
+
"types": "./dist/transfer/index.d.ts",
|
|
56
|
+
"import": "./dist/transfer/index.js",
|
|
57
|
+
"require": "./dist/transfer/index.js"
|
|
58
|
+
},
|
|
49
59
|
"./location": {
|
|
50
60
|
"types": "./dist/location/index.d.ts",
|
|
51
61
|
"import": "./dist/location/index.js",
|
package/src/app/index.ts
CHANGED
|
@@ -1,8 +1,115 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Corresponds to: lingxia-lxapp/src/appservice/
|
|
2
|
+
* Host app, app lifecycle, and page instance APIs.
|
|
4
3
|
*/
|
|
5
4
|
|
|
5
|
+
export interface AppBaseInfo {
|
|
6
|
+
language: string;
|
|
7
|
+
productName: string;
|
|
8
|
+
version: string;
|
|
9
|
+
SDKVersion: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface HostAppUpdateInfo {
|
|
13
|
+
version: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
releaseNotes?: string[];
|
|
16
|
+
isForceUpdate: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Download and apply this checked update.
|
|
19
|
+
*
|
|
20
|
+
* `apply()` is single-use for this update object.
|
|
21
|
+
*
|
|
22
|
+
* The returned task can be awaited directly when progress is not needed, or
|
|
23
|
+
* consumed with `for await...of` to render progress.
|
|
24
|
+
*
|
|
25
|
+
* Direct package handoff is currently supported on Android and macOS. Other
|
|
26
|
+
* platforms reject with an unsupported-operation error; use `version` and
|
|
27
|
+
* `releaseNotes` to guide users to the appropriate app marketplace.
|
|
28
|
+
*/
|
|
29
|
+
apply(): HostAppUpdateTask;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type HostAppUpdateApplyStage = 'download' | 'install';
|
|
33
|
+
|
|
34
|
+
export type HostAppUpdateCheckResult =
|
|
35
|
+
| {
|
|
36
|
+
hasUpdate: false;
|
|
37
|
+
update?: never;
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
hasUpdate: true;
|
|
41
|
+
update: HostAppUpdateInfo;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type HostAppUpdateEvent =
|
|
45
|
+
| {
|
|
46
|
+
state: 'downloading';
|
|
47
|
+
downloadedBytes?: number;
|
|
48
|
+
progress?: number;
|
|
49
|
+
}
|
|
50
|
+
| {
|
|
51
|
+
state: 'downloaded' | 'installRequested';
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
state: 'failed';
|
|
55
|
+
stage: HostAppUpdateApplyStage;
|
|
56
|
+
error: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export interface HostAppUpdateResult {
|
|
60
|
+
state: 'installRequested';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface HostAppUpdateIteratorResult {
|
|
64
|
+
done: boolean;
|
|
65
|
+
value?: HostAppUpdateEvent;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface HostAppUpdateTask
|
|
69
|
+
extends PromiseLike<HostAppUpdateResult>,
|
|
70
|
+
AsyncIterable<HostAppUpdateEvent> {
|
|
71
|
+
next(): Promise<HostAppUpdateIteratorResult>;
|
|
72
|
+
/** Stops iteration only. It does not cancel an app update already handed to the platform. */
|
|
73
|
+
return(): Promise<HostAppUpdateIteratorResult>;
|
|
74
|
+
catch<TResult = never>(
|
|
75
|
+
onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,
|
|
76
|
+
): Promise<HostAppUpdateResult | TResult>;
|
|
77
|
+
finally(onfinally?: (() => void) | null): Promise<HostAppUpdateResult>;
|
|
78
|
+
wait(): Promise<HostAppUpdateResult>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface HostAppApi {
|
|
82
|
+
getBaseInfo(): AppBaseInfo;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Check whether the host app has an update.
|
|
86
|
+
*
|
|
87
|
+
* This is a host app level capability and is only available to the home
|
|
88
|
+
* lxapp. Non-home lxapps receive a permission error.
|
|
89
|
+
*
|
|
90
|
+
* Calling this API opts the host app into custom update handling for this
|
|
91
|
+
* process. LingXia will not show its built-in host app update UI or
|
|
92
|
+
* auto-install host app updates after that point.
|
|
93
|
+
*
|
|
94
|
+
* If no update is available, or if an update requires a newer LingXia
|
|
95
|
+
* runtime than the current host app provides, `hasUpdate` is `false`.
|
|
96
|
+
*
|
|
97
|
+
* `checkUpdate()` may return version metadata on platforms that cannot apply
|
|
98
|
+
* host app packages directly. In that case, `update.apply()` rejects with an
|
|
99
|
+
* unsupported-operation error.
|
|
100
|
+
*/
|
|
101
|
+
checkUpdate(): Promise<HostAppUpdateCheckResult>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Exit the host app immediately.
|
|
105
|
+
*
|
|
106
|
+
* This API does not show a confirmation dialog. If the user should confirm
|
|
107
|
+
* first, call `lx.showModal(...)` in page logic and invoke `lx.app.exit()`
|
|
108
|
+
* only after the user confirms.
|
|
109
|
+
*/
|
|
110
|
+
exit(): void;
|
|
111
|
+
}
|
|
112
|
+
|
|
6
113
|
export interface AppLifecycleEventArgs {
|
|
7
114
|
source: 'host' | 'lxapp';
|
|
8
115
|
reason:
|
|
@@ -15,15 +122,6 @@ export interface AppLifecycleEventArgs {
|
|
|
15
122
|
| 'switch_away';
|
|
16
123
|
}
|
|
17
124
|
|
|
18
|
-
export type LxAppReleaseType = 'release' | 'preview' | 'developer';
|
|
19
|
-
|
|
20
|
-
export interface LxAppInfo {
|
|
21
|
-
appId: string;
|
|
22
|
-
appName: string;
|
|
23
|
-
version: string;
|
|
24
|
-
releaseType: LxAppReleaseType;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
125
|
export interface AppLaunchOptions {
|
|
28
126
|
path?: string;
|
|
29
127
|
query?: Record<string, string>;
|
|
@@ -62,18 +160,52 @@ export interface PageConfig<TData extends Record<string, unknown> = Record<strin
|
|
|
62
160
|
[key: string]: unknown;
|
|
63
161
|
}
|
|
64
162
|
|
|
163
|
+
export type SurfaceCloseReason =
|
|
164
|
+
| 'user'
|
|
165
|
+
| 'programmatic'
|
|
166
|
+
| 'owner_closed'
|
|
167
|
+
| 'app_closed'
|
|
168
|
+
| 'failed'
|
|
169
|
+
| 'unknown';
|
|
170
|
+
|
|
171
|
+
export interface SurfaceClosedEvent {
|
|
172
|
+
id: string;
|
|
173
|
+
kind: 'popup' | 'window';
|
|
174
|
+
reason: SurfaceCloseReason;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface Surface {
|
|
178
|
+
readonly id: string;
|
|
179
|
+
readonly kind: 'popup' | 'window';
|
|
180
|
+
/**
|
|
181
|
+
* Sends a message to the other side of a page surface.
|
|
182
|
+
*
|
|
183
|
+
* For the opener this targets the opened page. For the opened page this
|
|
184
|
+
* targets the opener. URL surfaces have no page-side receiver.
|
|
185
|
+
*/
|
|
186
|
+
postMessage(message: unknown): void;
|
|
187
|
+
onMessage(handler: (message: unknown) => void): () => void;
|
|
188
|
+
onClose(handler: (event: SurfaceClosedEvent) => void): () => void;
|
|
189
|
+
close(): Promise<void>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface PageMessagePort {
|
|
193
|
+
postMessage(message: unknown): void;
|
|
194
|
+
onMessage(handler: (message: unknown) => void): () => void;
|
|
195
|
+
}
|
|
196
|
+
|
|
65
197
|
export interface PageInstance<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
66
198
|
data: TData;
|
|
67
199
|
route: string;
|
|
200
|
+
/**
|
|
201
|
+
* Available when this page was opened by `lx.surface.open(...)`.
|
|
202
|
+
*/
|
|
203
|
+
surface?: Surface;
|
|
204
|
+
/**
|
|
205
|
+
* Available when this page was opened by `lx.navigateTo(...)`.
|
|
206
|
+
*/
|
|
207
|
+
opener?: PageMessagePort;
|
|
68
208
|
setData(data: Partial<TData> | Record<string, unknown>, callback?: () => void): void;
|
|
69
|
-
getEventEmitter(): EventEmitter;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface EventEmitter {
|
|
73
|
-
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
74
|
-
off(event: string, handler: (...args: unknown[]) => void): void;
|
|
75
|
-
emit(event: string, ...args: unknown[]): void;
|
|
76
|
-
once(event: string, handler: (...args: unknown[]) => void): void;
|
|
77
209
|
}
|
|
78
210
|
|
|
79
211
|
/**
|
package/src/device/actions.ts
CHANGED
package/src/device/info.ts
CHANGED
package/src/device/network.ts
CHANGED
package/src/device/wifi.ts
CHANGED
package/src/display/index.ts
CHANGED
package/src/env/index.ts
ADDED
package/src/file/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File system APIs.
|
|
3
|
-
* Corresponds to: lingxia-logic/src/fs.rs
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
5
|
export interface OpenFileOptions {
|
|
@@ -18,7 +17,6 @@ export interface OpenFileOptions {
|
|
|
18
17
|
showMenu?: boolean;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
22
20
|
export interface FileDialogFilter {
|
|
23
21
|
/** Optional label shown in the native dialog. */
|
|
24
22
|
name?: string;
|
|
@@ -26,88 +24,139 @@ export interface FileDialogFilter {
|
|
|
26
24
|
extensions: string[];
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
30
27
|
export interface ChooseFileOptions {
|
|
31
28
|
/** Allow selecting multiple files. Default: false */
|
|
32
29
|
multiple?: boolean;
|
|
33
30
|
/** Optional file filters. Empty or omitted means all file types. */
|
|
34
31
|
filters?: FileDialogFilter[];
|
|
35
|
-
/** Dialog window title. Platform provides a default if omitted. */
|
|
36
|
-
title?: string;
|
|
37
32
|
/** Initial directory the dialog opens in. Platform default if omitted. */
|
|
38
33
|
defaultPath?: string;
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
42
36
|
export interface ChooseFileResult {
|
|
43
37
|
/** True if the user dismissed the dialog without selecting. */
|
|
44
38
|
canceled: boolean;
|
|
45
|
-
/**
|
|
39
|
+
/** Native-consumable file references (paths or URIs). Empty when canceled. */
|
|
46
40
|
paths: string[];
|
|
47
41
|
}
|
|
48
42
|
|
|
49
|
-
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
50
43
|
export interface ChooseDirectoryOptions {
|
|
51
|
-
/** Dialog window title. Platform provides a default if omitted. */
|
|
52
|
-
title?: string;
|
|
53
44
|
/** Initial directory the dialog opens in. Platform default if omitted. */
|
|
54
45
|
defaultPath?: string;
|
|
55
46
|
}
|
|
56
47
|
|
|
57
|
-
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
58
48
|
export interface ChooseDirectoryResult {
|
|
59
49
|
/** True if the user dismissed the dialog without selecting. */
|
|
60
50
|
canceled: boolean;
|
|
61
|
-
/**
|
|
51
|
+
/** Native-consumable directory reference (path or URI). Undefined when canceled. */
|
|
62
52
|
path?: string;
|
|
63
53
|
}
|
|
64
54
|
|
|
65
|
-
export interface
|
|
66
|
-
|
|
67
|
-
url: string;
|
|
68
|
-
/** Optional request headers. */
|
|
69
|
-
headers?: Record<string, string>;
|
|
70
|
-
/** Request timeout in milliseconds. */
|
|
71
|
-
timeout?: number;
|
|
72
|
-
/** Optional destination path. Relative paths resolve under user data. */
|
|
73
|
-
filePath?: string;
|
|
74
|
-
/** Optional abort signal. */
|
|
75
|
-
signal?: AbortSignal;
|
|
55
|
+
export interface ExistsOptions {
|
|
56
|
+
path: string;
|
|
76
57
|
}
|
|
77
58
|
|
|
78
|
-
export interface
|
|
79
|
-
|
|
80
|
-
downloadedBytes?: number;
|
|
81
|
-
totalBytes?: number;
|
|
82
|
-
/** Present only when the total size is known. */
|
|
83
|
-
progress?: number;
|
|
84
|
-
result?: DownloadResult;
|
|
59
|
+
export interface StatOptions {
|
|
60
|
+
path: string;
|
|
85
61
|
}
|
|
86
62
|
|
|
87
|
-
export interface
|
|
88
|
-
|
|
89
|
-
|
|
63
|
+
export interface FileStats {
|
|
64
|
+
isFile: boolean;
|
|
65
|
+
isDirectory: boolean;
|
|
66
|
+
isSymlink: boolean;
|
|
67
|
+
size: number;
|
|
68
|
+
lastModifiedTime?: number;
|
|
69
|
+
lastAccessedTime?: number;
|
|
70
|
+
createTime?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface ReadDirOptions {
|
|
74
|
+
path: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface DirEntry {
|
|
78
|
+
name: string;
|
|
79
|
+
isFile: boolean;
|
|
80
|
+
isDirectory: boolean;
|
|
81
|
+
isSymlink: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface MkdirOptions {
|
|
85
|
+
path: string;
|
|
86
|
+
recursive?: boolean;
|
|
90
87
|
}
|
|
91
88
|
|
|
92
|
-
export interface
|
|
93
|
-
/** Final accessible file path or URI. */
|
|
89
|
+
export interface ReadTextFileOptions {
|
|
94
90
|
filePath: string;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
encoding: 'utf8' | 'base64';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface ReadBinaryFileOptions {
|
|
95
|
+
filePath: string;
|
|
96
|
+
encoding?: undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type ReadFileOptions = ReadTextFileOptions | ReadBinaryFileOptions;
|
|
100
|
+
|
|
101
|
+
export interface ReadTextFileResult {
|
|
102
|
+
data: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface ReadBinaryFileResult {
|
|
106
|
+
data: ArrayBuffer;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type ReadFileResult = ReadTextFileResult | ReadBinaryFileResult;
|
|
110
|
+
|
|
111
|
+
export type BinaryFileData = ArrayBuffer | ArrayBufferView;
|
|
112
|
+
|
|
113
|
+
export interface WriteTextFileOptions {
|
|
114
|
+
filePath: string;
|
|
115
|
+
data: string;
|
|
116
|
+
encoding?: 'utf8' | 'base64';
|
|
117
|
+
/** Defaults to false. */
|
|
118
|
+
overwrite?: boolean;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface WriteBinaryFileOptions {
|
|
122
|
+
filePath: string;
|
|
123
|
+
data: BinaryFileData;
|
|
124
|
+
encoding?: never;
|
|
125
|
+
/** Defaults to false. */
|
|
126
|
+
overwrite?: boolean;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type WriteFileOptions = WriteTextFileOptions | WriteBinaryFileOptions;
|
|
130
|
+
|
|
131
|
+
export interface CopyFileOptions {
|
|
132
|
+
srcPath: string;
|
|
133
|
+
destPath: string;
|
|
134
|
+
/** Defaults to false. */
|
|
135
|
+
overwrite?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface RenameOptions {
|
|
139
|
+
oldPath: string;
|
|
140
|
+
newPath: string;
|
|
141
|
+
/** Defaults to false. */
|
|
142
|
+
overwrite?: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface RemoveOptions {
|
|
146
|
+
path: string;
|
|
147
|
+
recursive?: boolean;
|
|
99
148
|
}
|
|
100
149
|
|
|
101
|
-
export interface
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
): Promise<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
150
|
+
export interface FileManager {
|
|
151
|
+
exists(options: ExistsOptions): Promise<boolean>;
|
|
152
|
+
stat(options: StatOptions): Promise<FileStats>;
|
|
153
|
+
readDir(options: ReadDirOptions): Promise<AsyncIterableIterator<DirEntry>>;
|
|
154
|
+
mkdir(options: MkdirOptions): Promise<void>;
|
|
155
|
+
readFile(options: ReadTextFileOptions): Promise<ReadTextFileResult>;
|
|
156
|
+
readFile(options: ReadBinaryFileOptions): Promise<ReadBinaryFileResult>;
|
|
157
|
+
readFile(options: ReadFileOptions): Promise<ReadFileResult>;
|
|
158
|
+
writeFile(options: WriteFileOptions): Promise<void>;
|
|
159
|
+
copyFile(options: CopyFileOptions): Promise<void>;
|
|
160
|
+
rename(options: RenameOptions): Promise<void>;
|
|
161
|
+
remove(options: RemoveOptions): Promise<void>;
|
|
113
162
|
}
|