@lingxia/types 0.5.1 → 0.6.0
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/src/index.ts
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export * from './app';
|
|
8
|
+
export * from './lxapp';
|
|
8
9
|
export * from './device';
|
|
9
10
|
export * from './display';
|
|
10
11
|
export * from './input';
|
|
12
|
+
export * from './env';
|
|
11
13
|
export * from './storage';
|
|
12
14
|
export * from './file';
|
|
15
|
+
export * from './transfer';
|
|
13
16
|
export * from './location';
|
|
14
17
|
export * from './navigator';
|
|
15
18
|
export * from './system';
|
|
@@ -23,11 +26,17 @@ export * from './generated/i18n';
|
|
|
23
26
|
import type {
|
|
24
27
|
AppConfig,
|
|
25
28
|
AppInstance,
|
|
26
|
-
|
|
29
|
+
HostAppApi,
|
|
30
|
+
PageMessagePort,
|
|
27
31
|
PageConfig,
|
|
28
32
|
PageInstance,
|
|
33
|
+
Surface,
|
|
29
34
|
} from './app';
|
|
30
35
|
|
|
36
|
+
import type {
|
|
37
|
+
LxAppInfo,
|
|
38
|
+
} from './lxapp';
|
|
39
|
+
|
|
31
40
|
import type {
|
|
32
41
|
DeviceInfo,
|
|
33
42
|
ScreenInfo,
|
|
@@ -41,10 +50,9 @@ import type {
|
|
|
41
50
|
|
|
42
51
|
import type { KeyEventCallback } from './input';
|
|
43
52
|
|
|
44
|
-
import type {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} from './storage';
|
|
53
|
+
import type { LxEnv } from './env';
|
|
54
|
+
|
|
55
|
+
import type { Storage } from './storage';
|
|
48
56
|
|
|
49
57
|
import type {
|
|
50
58
|
OpenFileOptions,
|
|
@@ -52,9 +60,15 @@ import type {
|
|
|
52
60
|
ChooseDirectoryResult,
|
|
53
61
|
ChooseFileOptions,
|
|
54
62
|
ChooseFileResult,
|
|
63
|
+
FileManager,
|
|
64
|
+
} from './file';
|
|
65
|
+
|
|
66
|
+
import type {
|
|
55
67
|
DownloadOptions,
|
|
56
68
|
DownloadTask,
|
|
57
|
-
|
|
69
|
+
UploadOptions,
|
|
70
|
+
UploadTask,
|
|
71
|
+
} from './transfer';
|
|
58
72
|
|
|
59
73
|
import type {
|
|
60
74
|
DeviceOrientation,
|
|
@@ -67,7 +81,6 @@ import type {
|
|
|
67
81
|
} from './location';
|
|
68
82
|
|
|
69
83
|
import type {
|
|
70
|
-
AppBaseInfo,
|
|
71
84
|
SystemSettingInfo,
|
|
72
85
|
OpenURLOptions,
|
|
73
86
|
} from './system';
|
|
@@ -104,7 +117,6 @@ import type {
|
|
|
104
117
|
ShowActionSheetOptions,
|
|
105
118
|
ActionSheetResult,
|
|
106
119
|
NavigateToOptions,
|
|
107
|
-
NavigateToResult,
|
|
108
120
|
NavigateBackOptions,
|
|
109
121
|
RedirectToOptions,
|
|
110
122
|
SwitchTabOptions,
|
|
@@ -116,13 +128,24 @@ import type {
|
|
|
116
128
|
RemoveTabBarBadgeOptions,
|
|
117
129
|
SetTabBarStyleOptions,
|
|
118
130
|
SetTabBarItemOptions,
|
|
119
|
-
|
|
120
|
-
ShowPopupResult,
|
|
131
|
+
SurfaceOpenOptions,
|
|
121
132
|
CapsuleRect,
|
|
122
133
|
} from './ui';
|
|
123
134
|
|
|
135
|
+
export interface SurfaceApi {
|
|
136
|
+
/**
|
|
137
|
+
* Dynamically opens a page or URL in a runtime-managed surface.
|
|
138
|
+
*
|
|
139
|
+
* `popup` is cross-platform. `window` is a desktop capability and rejects on
|
|
140
|
+
* mobile platforms.
|
|
141
|
+
*/
|
|
142
|
+
open(options: SurfaceOpenOptions): Promise<Surface>;
|
|
143
|
+
}
|
|
144
|
+
|
|
124
145
|
export interface Lx {
|
|
125
146
|
env: LxEnv;
|
|
147
|
+
app: HostAppApi;
|
|
148
|
+
surface: SurfaceApi;
|
|
126
149
|
|
|
127
150
|
getDeviceInfo(): DeviceInfo;
|
|
128
151
|
getScreenInfo(): ScreenInfo;
|
|
@@ -152,6 +175,8 @@ export interface Lx {
|
|
|
152
175
|
*/
|
|
153
176
|
openFile(options: OpenFileOptions): void;
|
|
154
177
|
downloadFile(options: DownloadOptions): DownloadTask;
|
|
178
|
+
uploadFile(options: UploadOptions): UploadTask;
|
|
179
|
+
getFileManager(): FileManager;
|
|
155
180
|
|
|
156
181
|
getStorage(): Storage;
|
|
157
182
|
|
|
@@ -160,7 +185,6 @@ export interface Lx {
|
|
|
160
185
|
navigateToLxApp(options: NavigateToLxAppOptions): Promise<void>;
|
|
161
186
|
navigateBackLxApp(): Promise<void>;
|
|
162
187
|
|
|
163
|
-
getAppBaseInfo(): AppBaseInfo;
|
|
164
188
|
getLxAppInfo(): LxAppInfo;
|
|
165
189
|
getSystemSetting(): SystemSettingInfo;
|
|
166
190
|
openURL(options: OpenURLOptions): void;
|
|
@@ -203,7 +227,7 @@ export interface Lx {
|
|
|
203
227
|
|
|
204
228
|
showActionSheet(options: ShowActionSheetOptions): Promise<ActionSheetResult>;
|
|
205
229
|
|
|
206
|
-
navigateTo(options: NavigateToOptions): Promise<
|
|
230
|
+
navigateTo(options: NavigateToOptions): Promise<PageMessagePort>;
|
|
207
231
|
navigateBack(options: NavigateBackOptions): void;
|
|
208
232
|
redirectTo(options: RedirectToOptions): Promise<void>;
|
|
209
233
|
switchTab(options: SwitchTabOptions): Promise<void>;
|
|
@@ -222,17 +246,12 @@ export interface Lx {
|
|
|
222
246
|
setTabBarStyle(options: SetTabBarStyleOptions): boolean;
|
|
223
247
|
setTabBarItem(options: SetTabBarItemOptions): boolean;
|
|
224
248
|
|
|
225
|
-
showPopup(options: ShowPopupOptions): Promise<ShowPopupResult>;
|
|
226
|
-
hidePopup(): void;
|
|
227
|
-
|
|
228
249
|
startPullDownRefresh(): void;
|
|
229
250
|
stopPullDownRefresh(): void;
|
|
230
251
|
|
|
231
252
|
getCapsuleRect(): Promise<CapsuleRect>;
|
|
232
253
|
|
|
233
|
-
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
234
254
|
chooseFile(options?: ChooseFileOptions): Promise<ChooseFileResult>;
|
|
235
|
-
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
236
255
|
chooseDirectory(options?: ChooseDirectoryOptions): Promise<ChooseDirectoryResult>;
|
|
237
256
|
|
|
238
257
|
onKeyDown(callback: KeyEventCallback): void;
|
package/src/input/index.ts
CHANGED
package/src/location/index.ts
CHANGED
package/src/media/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Media APIs
|
|
3
|
-
* Corresponds to: lingxia-logic/src/media/
|
|
2
|
+
* Media picker, preview, scan, and file processing APIs.
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
5
|
export interface GetImageInfoOptions {
|
|
@@ -188,14 +187,9 @@ export interface PreviewMediaSource {
|
|
|
188
187
|
* Media source path.
|
|
189
188
|
* Recommended: `lx://` path (for example `lx://usercache/...`) or a sandbox-local path
|
|
190
189
|
* that can be resolved by runtime access rules.
|
|
191
|
-
|
|
190
|
+
*/
|
|
192
191
|
path: string;
|
|
193
192
|
type?: 'image' | 'video';
|
|
194
|
-
/**
|
|
195
|
-
* Optional poster image path for video preview.
|
|
196
|
-
* Uses the same path contract as `path`.
|
|
197
|
-
*/
|
|
198
|
-
coverPath?: string;
|
|
199
193
|
/**
|
|
200
194
|
* Optional clockwise rotation in degrees (`0 | 90 | 180 | 270`).
|
|
201
195
|
* Default: when omitted, runtime resolves orientation from media metadata.
|
|
@@ -207,8 +201,8 @@ export interface PreviewMediaSource {
|
|
|
207
201
|
*/
|
|
208
202
|
objectFit?: MediaObjectFit;
|
|
209
203
|
/**
|
|
210
|
-
*
|
|
211
|
-
* Effective
|
|
204
|
+
* Display duration in milliseconds.
|
|
205
|
+
* Effective when preview `advance` is not `manual`.
|
|
212
206
|
*/
|
|
213
207
|
durationMs?: number;
|
|
214
208
|
}
|
package/src/navigator/index.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LxApp navigator APIs
|
|
3
|
-
* Corresponds to: lingxia-logic/src/navigator.rs
|
|
2
|
+
* LxApp navigator APIs.
|
|
4
3
|
*/
|
|
5
4
|
|
|
5
|
+
import type { PageQuery } from '../ui';
|
|
6
|
+
|
|
7
|
+
export type LxAppEnvVersion = 'release' | 'preview' | 'develop';
|
|
8
|
+
|
|
6
9
|
export interface NavigateToLxAppOptions {
|
|
7
10
|
appId: string;
|
|
11
|
+
page?: string;
|
|
8
12
|
path?: string;
|
|
9
|
-
|
|
13
|
+
query?: PageQuery;
|
|
14
|
+
envVersion?: LxAppEnvVersion;
|
|
15
|
+
targetVersion?: string;
|
|
10
16
|
}
|
package/src/storage/index.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Corresponds to: lingxia-logic/src/storage.rs, env.rs
|
|
2
|
+
* Key-value storage APIs.
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
|
-
export interface LxEnv {
|
|
7
|
-
USER_DATA_PATH: string;
|
|
8
|
-
USER_CACHE_PATH: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
export interface Storage {
|
|
12
6
|
get(key: string): unknown;
|
|
13
7
|
set(key: string, value: unknown): void;
|
package/src/system/index.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* System APIs
|
|
3
|
-
* Corresponds to: lingxia-logic/src/system.rs
|
|
2
|
+
* System settings and URL APIs.
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
|
-
export interface AppBaseInfo {
|
|
7
|
-
language: string;
|
|
8
|
-
productName: string;
|
|
9
|
-
version: string;
|
|
10
|
-
SDKVersion: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
5
|
export interface SystemSettingInfo {
|
|
14
6
|
bluetoothEnabled: boolean;
|
|
15
7
|
locationEnabled: boolean;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transfer task APIs.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface DownloadOptions {
|
|
6
|
+
/** HTTP(S) source URL. */
|
|
7
|
+
url: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional request headers.
|
|
10
|
+
* Restricted headers such as `Referer` are ignored by the runtime.
|
|
11
|
+
*/
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
/** Request timeout in milliseconds. */
|
|
14
|
+
timeout?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Optional durable destination.
|
|
17
|
+
*
|
|
18
|
+
* - Omit `filePath` to receive a temporary file in `tempFilePath`
|
|
19
|
+
* - Relative paths resolve under user data
|
|
20
|
+
* - `lx://` paths must target `lx://userdata`
|
|
21
|
+
*
|
|
22
|
+
* `lx://usercache` is not accepted here.
|
|
23
|
+
*/
|
|
24
|
+
filePath?: string;
|
|
25
|
+
/** Optional abort signal. */
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface DownloadProgressEvent {
|
|
30
|
+
kind: 'progress' | 'paused' | 'resumed' | 'canceled' | 'completed';
|
|
31
|
+
downloadedBytes?: number;
|
|
32
|
+
totalBytes?: number;
|
|
33
|
+
/** Present only when the total size is known. */
|
|
34
|
+
progress?: number;
|
|
35
|
+
result?: DownloadResult;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface DownloadIteratorResult {
|
|
39
|
+
done: boolean;
|
|
40
|
+
value?: DownloadProgressEvent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type DownloadResult =
|
|
44
|
+
| {
|
|
45
|
+
/**
|
|
46
|
+
* Temporary result.
|
|
47
|
+
*
|
|
48
|
+
* Not durable; move or copy it to `lx://userdata` if you need to keep it.
|
|
49
|
+
*
|
|
50
|
+
* When `filePath` is omitted, the runtime must be able to infer a file
|
|
51
|
+
* type from the URL or the server's `Content-Type` header.
|
|
52
|
+
*/
|
|
53
|
+
tempFilePath: string;
|
|
54
|
+
filePath?: never;
|
|
55
|
+
mimeType?: string;
|
|
56
|
+
size: number;
|
|
57
|
+
}
|
|
58
|
+
| {
|
|
59
|
+
/** Durable destination under `lx://userdata`. */
|
|
60
|
+
filePath: string;
|
|
61
|
+
tempFilePath?: never;
|
|
62
|
+
mimeType?: string;
|
|
63
|
+
size: number;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export interface DownloadTask extends PromiseLike<DownloadResult>, AsyncIterable<DownloadProgressEvent> {
|
|
67
|
+
next(): Promise<DownloadIteratorResult>;
|
|
68
|
+
/** Stops iteration only. Does not cancel the underlying download task. */
|
|
69
|
+
return(): Promise<DownloadIteratorResult>;
|
|
70
|
+
catch<TResult = never>(
|
|
71
|
+
onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,
|
|
72
|
+
): Promise<DownloadResult | TResult>;
|
|
73
|
+
finally(onfinally?: (() => void) | null): Promise<DownloadResult>;
|
|
74
|
+
pause(): Promise<void>;
|
|
75
|
+
resume(): Promise<void>;
|
|
76
|
+
cancel(): Promise<void>;
|
|
77
|
+
/** Alias for cancel(), matching browser/mini-program abort naming. */
|
|
78
|
+
abort(): Promise<void>;
|
|
79
|
+
wait(): Promise<DownloadResult>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface UploadOptions {
|
|
83
|
+
/** HTTP(S) destination URL. */
|
|
84
|
+
url: string;
|
|
85
|
+
/** Local file path or runtime-managed URI to upload. */
|
|
86
|
+
filePath: string;
|
|
87
|
+
/** Multipart field name. Default: `file`. */
|
|
88
|
+
name?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Optional request headers.
|
|
91
|
+
* Restricted headers such as `Referer` are ignored by the runtime.
|
|
92
|
+
*/
|
|
93
|
+
headers?: Record<string, string>;
|
|
94
|
+
/** Optional extra `multipart/form-data` text fields. */
|
|
95
|
+
formData?: Record<string, string>;
|
|
96
|
+
/** Request timeout in milliseconds. */
|
|
97
|
+
timeout?: number;
|
|
98
|
+
/** Override multipart filename. */
|
|
99
|
+
fileName?: string;
|
|
100
|
+
/** Override file MIME type. */
|
|
101
|
+
mimeType?: string;
|
|
102
|
+
/** Optional abort signal. */
|
|
103
|
+
signal?: AbortSignal;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface UploadProgressEvent {
|
|
107
|
+
kind: 'progress' | 'canceled' | 'completed';
|
|
108
|
+
uploadedBytes?: number;
|
|
109
|
+
totalBytes?: number;
|
|
110
|
+
progress?: number;
|
|
111
|
+
result?: UploadResult;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface UploadIteratorResult {
|
|
115
|
+
done: boolean;
|
|
116
|
+
value?: UploadProgressEvent;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface UploadResult {
|
|
120
|
+
/** HTTP status code returned by the server. */
|
|
121
|
+
statusCode: number;
|
|
122
|
+
/** Response body decoded as UTF-8 text. */
|
|
123
|
+
data: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface UploadTask extends PromiseLike<UploadResult>, AsyncIterable<UploadProgressEvent> {
|
|
127
|
+
next(): Promise<UploadIteratorResult>;
|
|
128
|
+
/** Stops iteration only. Does not cancel the underlying upload task. */
|
|
129
|
+
return(): Promise<UploadIteratorResult>;
|
|
130
|
+
catch<TResult = never>(
|
|
131
|
+
onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,
|
|
132
|
+
): Promise<UploadResult | TResult>;
|
|
133
|
+
finally(onfinally?: (() => void) | null): Promise<UploadResult>;
|
|
134
|
+
cancel(): Promise<void>;
|
|
135
|
+
wait(): Promise<UploadResult>;
|
|
136
|
+
}
|
package/src/ui/index.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* UI APIs
|
|
3
|
-
* Corresponds to: lingxia-logic/src/ui/
|
|
2
|
+
* UI feedback, navigation, and surface control APIs.
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
|
-
import type { EventEmitter } from '../app';
|
|
7
|
-
|
|
8
5
|
export interface ShowToastOptions {
|
|
9
6
|
title: string;
|
|
10
7
|
icon?: 'success' | 'error' | 'loading' | 'none';
|
|
@@ -38,29 +35,32 @@ export interface ActionSheetResult {
|
|
|
38
35
|
tapIndex: number;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
}
|
|
38
|
+
export type PageQueryValue = string | number | boolean | null | undefined;
|
|
39
|
+
export type PageQuery = Record<string, PageQueryValue>;
|
|
44
40
|
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
export type PageTargetOptions =
|
|
42
|
+
| {
|
|
43
|
+
page: string;
|
|
44
|
+
path?: never;
|
|
45
|
+
query?: PageQuery;
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
path: string;
|
|
49
|
+
page?: never;
|
|
50
|
+
query?: PageQuery;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type NavigateToOptions = PageTargetOptions;
|
|
48
54
|
|
|
49
55
|
export interface NavigateBackOptions {
|
|
50
56
|
delta: number;
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
export
|
|
54
|
-
url: string;
|
|
55
|
-
}
|
|
59
|
+
export type RedirectToOptions = PageTargetOptions;
|
|
56
60
|
|
|
57
|
-
export
|
|
58
|
-
url: string;
|
|
59
|
-
}
|
|
61
|
+
export type SwitchTabOptions = PageTargetOptions;
|
|
60
62
|
|
|
61
|
-
export
|
|
62
|
-
url: string;
|
|
63
|
-
}
|
|
63
|
+
export type ReLaunchOptions = PageTargetOptions;
|
|
64
64
|
|
|
65
65
|
export interface SetNavigationBarTitleOptions {
|
|
66
66
|
title: string;
|
|
@@ -98,17 +98,67 @@ export interface SetTabBarItemOptions {
|
|
|
98
98
|
selectedIconPath?: string;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export
|
|
101
|
+
export type SurfaceQueryValue = PageQueryValue;
|
|
102
|
+
export type SurfaceQuery = PageQuery;
|
|
103
|
+
|
|
104
|
+
export type SurfacePageTargetOptions =
|
|
105
|
+
| {
|
|
106
|
+
page: string;
|
|
107
|
+
path?: never;
|
|
108
|
+
url?: never;
|
|
109
|
+
query?: SurfaceQuery;
|
|
110
|
+
}
|
|
111
|
+
| {
|
|
112
|
+
path: string;
|
|
113
|
+
page?: never;
|
|
114
|
+
url?: never;
|
|
115
|
+
query?: SurfaceQuery;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type SurfaceUrlTargetOptions = {
|
|
102
119
|
url: string;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
120
|
+
page?: never;
|
|
121
|
+
path?: never;
|
|
122
|
+
query?: never;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type SurfaceTargetOptions = SurfacePageTargetOptions | SurfaceUrlTargetOptions;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Popup size value.
|
|
129
|
+
*
|
|
130
|
+
* - number: absolute size, must be > 0
|
|
131
|
+
* - `${number}%`: percentage size, must be > 0% and <= 100%
|
|
132
|
+
*/
|
|
133
|
+
export type PopupSurfaceSizeValue = number | `${number}%`;
|
|
134
|
+
|
|
135
|
+
export interface PopupSurfaceSize {
|
|
136
|
+
/** Width for popup surface. */
|
|
137
|
+
width?: PopupSurfaceSizeValue;
|
|
138
|
+
/** Height for popup surface. */
|
|
139
|
+
height?: PopupSurfaceSizeValue;
|
|
106
140
|
}
|
|
107
141
|
|
|
108
|
-
export
|
|
109
|
-
|
|
142
|
+
export type PopupSurfaceOptions = SurfaceTargetOptions & {
|
|
143
|
+
kind: 'popup';
|
|
144
|
+
position?: 'center' | 'bottom' | 'left' | 'right' | 'top';
|
|
145
|
+
size?: PopupSurfaceSize;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export interface WindowSurfaceSize {
|
|
149
|
+
/** Window width, must be a positive number. */
|
|
150
|
+
width?: number;
|
|
151
|
+
/** Window height, must be a positive number. */
|
|
152
|
+
height?: number;
|
|
110
153
|
}
|
|
111
154
|
|
|
155
|
+
export type WindowSurfaceOptions = SurfaceTargetOptions & {
|
|
156
|
+
kind: 'window';
|
|
157
|
+
size?: WindowSurfaceSize;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export type SurfaceOpenOptions = PopupSurfaceOptions | WindowSurfaceOptions;
|
|
161
|
+
|
|
112
162
|
export interface CapsuleRect {
|
|
113
163
|
width?: number;
|
|
114
164
|
height?: number;
|
package/src/update/index.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
|
|
|
6
5
|
export interface UpdateManager {
|
|
@@ -12,7 +11,7 @@ export interface UpdateManager {
|
|
|
12
11
|
export interface UpdateReadyInfo {
|
|
13
12
|
version?: string;
|
|
14
13
|
isForceUpdate?: boolean;
|
|
15
|
-
|
|
14
|
+
channel?: "release" | "preview" | "developer" | string;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export interface UpdateFailedInfo extends UpdateReadyInfo {
|