@lingxia/types 0.10.0 → 0.11.1
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/automation/index.d.ts +942 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +13 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/generated/i18n.d.ts +1 -1
- package/dist/generated/i18n.d.ts.map +1 -1
- package/dist/generated/i18n.js +29 -0
- package/dist/generated/i18n.js.map +1 -1
- package/dist/generated/logic-web.d.ts +305 -0
- package/dist/generated/logic.d.ts +1909 -0
- package/dist/generated/logic.d.ts.map +1 -0
- package/dist/generated/logic.js +5 -0
- package/dist/generated/logic.js.map +1 -0
- package/dist/index.d.ts +16 -313
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -16
- package/dist/index.js.map +1 -1
- package/dist/logic-globals.d.ts +1 -0
- package/dist/process.d.ts +117 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +10 -0
- package/dist/process.js.map +1 -0
- package/package.json +73 -47
- package/src/automation/index.ts +1074 -0
- package/src/generated/i18n.ts +29 -0
- package/src/generated/logic-web.d.ts +305 -0
- package/src/generated/logic.ts +2123 -0
- package/src/index.ts +18 -459
- package/src/logic-globals.d.ts +1 -0
- package/src/process.ts +135 -0
- package/dist/app/index.d.ts +0 -328
- package/dist/app/index.d.ts.map +0 -1
- package/dist/app/index.js +0 -6
- package/dist/app/index.js.map +0 -1
- package/dist/device/actions.d.ts +0 -7
- package/dist/device/actions.d.ts.map +0 -1
- package/dist/device/actions.js +0 -6
- package/dist/device/actions.js.map +0 -1
- package/dist/device/index.d.ts +0 -5
- package/dist/device/index.d.ts.map +0 -1
- package/dist/device/index.js +0 -21
- package/dist/device/index.js.map +0 -1
- package/dist/device/info.d.ts +0 -16
- package/dist/device/info.d.ts.map +0 -1
- package/dist/device/info.js +0 -6
- package/dist/device/info.js.map +0 -1
- package/dist/device/network.d.ts +0 -12
- package/dist/device/network.d.ts.map +0 -1
- package/dist/device/network.js +0 -6
- package/dist/device/network.js.map +0 -1
- package/dist/device/wifi.d.ts +0 -20
- package/dist/device/wifi.d.ts.map +0 -1
- package/dist/device/wifi.js +0 -6
- package/dist/device/wifi.js.map +0 -1
- package/dist/display/index.d.ts +0 -8
- package/dist/display/index.d.ts.map +0 -1
- package/dist/display/index.js +0 -6
- package/dist/display/index.js.map +0 -1
- package/dist/env/index.d.ts +0 -8
- package/dist/env/index.d.ts.map +0 -1
- package/dist/env/index.js +0 -6
- package/dist/env/index.js.map +0 -1
- package/dist/file/index.d.ts +0 -146
- package/dist/file/index.d.ts.map +0 -1
- package/dist/file/index.js +0 -6
- package/dist/file/index.js.map +0 -1
- package/dist/input/index.d.ts +0 -18
- package/dist/input/index.d.ts.map +0 -1
- package/dist/input/index.js +0 -8
- package/dist/input/index.js.map +0 -1
- package/dist/location/index.d.ts +0 -19
- package/dist/location/index.d.ts.map +0 -1
- package/dist/location/index.js +0 -6
- package/dist/location/index.js.map +0 -1
- package/dist/lxapp/index.d.ts +0 -11
- package/dist/lxapp/index.d.ts.map +0 -1
- package/dist/lxapp/index.js +0 -6
- package/dist/lxapp/index.js.map +0 -1
- package/dist/media/index.d.ts +0 -372
- package/dist/media/index.d.ts.map +0 -1
- package/dist/media/index.js +0 -6
- package/dist/media/index.js.map +0 -1
- package/dist/navigator/index.d.ts +0 -14
- package/dist/navigator/index.d.ts.map +0 -1
- package/dist/navigator/index.js +0 -6
- package/dist/navigator/index.js.map +0 -1
- package/dist/share/index.d.ts +0 -90
- package/dist/share/index.d.ts.map +0 -1
- package/dist/share/index.js +0 -6
- package/dist/share/index.js.map +0 -1
- package/dist/storage/index.d.ts +0 -13
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js +0 -6
- package/dist/storage/index.js.map +0 -1
- package/dist/system/index.d.ts +0 -9
- package/dist/system/index.d.ts.map +0 -1
- package/dist/system/index.js +0 -6
- package/dist/system/index.js.map +0 -1
- package/dist/transfer/index.d.ts +0 -166
- package/dist/transfer/index.d.ts.map +0 -1
- package/dist/transfer/index.js +0 -6
- package/dist/transfer/index.js.map +0 -1
- package/dist/ui/index.d.ts +0 -134
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -6
- package/dist/ui/index.js.map +0 -1
- package/dist/update/index.d.ts +0 -17
- package/dist/update/index.d.ts.map +0 -1
- package/dist/update/index.js +0 -6
- package/dist/update/index.js.map +0 -1
- package/src/app/index.ts +0 -378
- package/src/device/actions.ts +0 -7
- package/src/device/index.ts +0 -4
- package/src/device/info.ts +0 -17
- package/src/device/network.ts +0 -23
- package/src/device/wifi.ts +0 -23
- package/src/display/index.ts +0 -9
- package/src/env/index.ts +0 -8
- package/src/file/index.ts +0 -171
- package/src/input/index.ts +0 -19
- package/src/location/index.ts +0 -20
- package/src/lxapp/index.ts +0 -12
- package/src/media/index.ts +0 -411
- package/src/navigator/index.ts +0 -16
- package/src/share/index.ts +0 -97
- package/src/storage/index.ts +0 -13
- package/src/system/index.ts +0 -9
- package/src/transfer/index.ts +0 -194
- package/src/ui/index.ts +0 -165
- package/src/update/index.ts +0 -19
package/src/app/index.ts
DELETED
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host app, app lifecycle, and page instance APIs.
|
|
3
|
-
*/
|
|
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
|
-
/**
|
|
82
|
-
* Build-time environment version of the host app.
|
|
83
|
-
*
|
|
84
|
-
* Surfaced via {@link HostAppApi.envVersion}. Mirrors the
|
|
85
|
-
* `crates/lingxia-update::ReleaseType` enum and the `envVersion` field in the
|
|
86
|
-
* generated `app.json`. Pre-envVersion app artifacts are treated as `'release'`.
|
|
87
|
-
*
|
|
88
|
-
* Note: this is *separate* from `LxAppEnvVersion` in the navigator module,
|
|
89
|
-
* which encodes lxapp release channels (`'develop' | 'preview' | 'release'`)
|
|
90
|
-
* for cross-app navigation URLs and uses the truncated `develop` form.
|
|
91
|
-
*/
|
|
92
|
-
export type HostAppEnvVersion = 'developer' | 'preview' | 'release';
|
|
93
|
-
|
|
94
|
-
export interface AppScreenshotOptions {
|
|
95
|
-
/**
|
|
96
|
-
* Platform-specific window id to capture (desktop only). Omit to let the
|
|
97
|
-
* platform pick: the key/main window on desktop, the sole window on mobile.
|
|
98
|
-
*/
|
|
99
|
-
windowId?: string;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface AppScreenshotResult {
|
|
103
|
-
/** `lx://` URI of the captured PNG in the lxapp temp directory. */
|
|
104
|
-
tempFilePath: string;
|
|
105
|
-
/** Image width in pixels, when the runtime could read it from the PNG. */
|
|
106
|
-
width?: number;
|
|
107
|
-
/** Image height in pixels, when the runtime could read it from the PNG. */
|
|
108
|
-
height?: number;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface HostAppApi {
|
|
112
|
-
/**
|
|
113
|
-
* The environment this build was produced for, mirroring `app.json::envVersion`.
|
|
114
|
-
* Always present; defaults to `'release'` for builds produced before the field
|
|
115
|
-
* existed in the artifact.
|
|
116
|
-
*
|
|
117
|
-
* Use this to branch on environment-specific behavior (e.g. verbose logging in
|
|
118
|
-
* developer builds, distinct theme tinting, distinct error-reporter tags).
|
|
119
|
-
* Synchronous; the value is fixed at app boot.
|
|
120
|
-
*/
|
|
121
|
-
readonly envVersion: HostAppEnvVersion;
|
|
122
|
-
|
|
123
|
-
getBaseInfo(): AppBaseInfo;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Check whether the host app has an update.
|
|
127
|
-
*
|
|
128
|
-
* This is a host app level capability and is only available to the home
|
|
129
|
-
* lxapp. Non-home lxapps receive a permission error.
|
|
130
|
-
*
|
|
131
|
-
* Calling this API opts the host app into custom update handling for this
|
|
132
|
-
* process. LingXia will not show its built-in host app update UI or
|
|
133
|
-
* auto-install host app updates after that point.
|
|
134
|
-
*
|
|
135
|
-
* If no update is available, or if an update requires a newer LingXia
|
|
136
|
-
* runtime than the current host app provides, `hasUpdate` is `false`.
|
|
137
|
-
*
|
|
138
|
-
* `checkUpdate()` may return version metadata on platforms that cannot apply
|
|
139
|
-
* host app packages directly. In that case, `update.apply()` rejects with an
|
|
140
|
-
* unsupported-operation error.
|
|
141
|
-
*/
|
|
142
|
-
checkUpdate(): Promise<HostAppUpdateCheckResult>;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Exit the host app immediately.
|
|
146
|
-
*
|
|
147
|
-
* This API does not show a confirmation dialog. If the user should confirm
|
|
148
|
-
* first, call `lx.showModal(...)` in page logic and invoke `lx.app.exit()`
|
|
149
|
-
* only after the user confirms.
|
|
150
|
-
*/
|
|
151
|
-
exit(): void;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Capture the host app's window as a PNG and save it to the lxapp temp
|
|
155
|
-
* directory.
|
|
156
|
-
*
|
|
157
|
-
* App-level semantics — one level above any page/WebView capture: the image
|
|
158
|
-
* is what the user currently sees of the whole app, including host-drawn
|
|
159
|
-
* navigation chrome, native overlays, and every composited WebView. Because
|
|
160
|
-
* that view can include other lxapps' UI, this API is only available to the
|
|
161
|
-
* home lxapp; other lxapps receive a permission error.
|
|
162
|
-
*/
|
|
163
|
-
screenshot(options?: AppScreenshotOptions): Promise<AppScreenshotResult>;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Set the app-icon badge — e.g. an unread count.
|
|
167
|
-
*
|
|
168
|
-
* Cross-platform: the dock (macOS), the taskbar (Windows), and the home /
|
|
169
|
-
* launcher icon (iOS, Android). Pass `null` or an empty string to clear it.
|
|
170
|
-
* On platforms where it is not wired this is a no-op (it never throws), so it
|
|
171
|
-
* is safe to call from portable code.
|
|
172
|
-
*/
|
|
173
|
-
setBadge(value: string | number | null): void;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export interface AppLifecycleEventArgs {
|
|
177
|
-
source: 'host' | 'lxapp';
|
|
178
|
-
reason:
|
|
179
|
-
| 'foreground'
|
|
180
|
-
| 'background'
|
|
181
|
-
| 'screenshot'
|
|
182
|
-
| 'open'
|
|
183
|
-
| 'close'
|
|
184
|
-
| 'switch_back'
|
|
185
|
-
| 'switch_away';
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export interface AppLaunchOptions {
|
|
189
|
-
path?: string;
|
|
190
|
-
query?: Record<string, string>;
|
|
191
|
-
scene?: number;
|
|
192
|
-
referrerInfo?: {
|
|
193
|
-
appId?: string;
|
|
194
|
-
extraData?: Record<string, unknown>;
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export interface AppConfig {
|
|
199
|
-
globalData?: Record<string, unknown>;
|
|
200
|
-
onLaunch?: (options?: AppLaunchOptions) => void | Promise<void>;
|
|
201
|
-
onShow?: (args?: AppLifecycleEventArgs) => void | Promise<void>;
|
|
202
|
-
onHide?: (args?: AppLifecycleEventArgs) => void | Promise<void>;
|
|
203
|
-
onUserCaptureScreen?: () => void | Promise<void>;
|
|
204
|
-
[key: string]: unknown;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export interface AppInstance extends AppConfig {
|
|
208
|
-
globalData: Record<string, unknown>;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export interface PageLoadOptions {
|
|
212
|
-
[key: string]: string | undefined;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export interface PageConfig<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
216
|
-
data?: TData;
|
|
217
|
-
onLoad?: (options?: PageLoadOptions) => void | Promise<void>;
|
|
218
|
-
onShow?: () => void | Promise<void>;
|
|
219
|
-
onReady?: () => void | Promise<void>;
|
|
220
|
-
onHide?: () => void | Promise<void>;
|
|
221
|
-
onUnload?: () => void | Promise<void>;
|
|
222
|
-
onPullDownRefresh?: () => void | Promise<void>;
|
|
223
|
-
[key: string]: unknown;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export type SurfaceCloseReason =
|
|
227
|
-
| 'user'
|
|
228
|
-
| 'programmatic'
|
|
229
|
-
| 'owner_closed'
|
|
230
|
-
| 'app_closed'
|
|
231
|
-
| 'failed'
|
|
232
|
-
/**
|
|
233
|
-
* The SDK reclaimed a long-hidden overlay surface for resource reasons.
|
|
234
|
-
* Treat as a normal close: the page instance is gone; further postMessage /
|
|
235
|
-
* show / hide calls will fail. The opener may immediately reopen if needed.
|
|
236
|
-
*/
|
|
237
|
-
| 'reclaimed'
|
|
238
|
-
| 'unknown';
|
|
239
|
-
|
|
240
|
-
export interface SurfaceClosedEvent {
|
|
241
|
-
id: string;
|
|
242
|
-
kind: 'overlay' | 'window';
|
|
243
|
-
reason: SurfaceCloseReason;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Detail payload for `onShow` / `onHide` events. `source` identifies which
|
|
248
|
-
* Surface object initiated the visibility change so observers can
|
|
249
|
-
* distinguish self-driven transitions from peer-driven ones (e.g. an opener
|
|
250
|
-
* UI that wants to update its own button state only when the page side
|
|
251
|
-
* toggled visibility).
|
|
252
|
-
*/
|
|
253
|
-
export interface SurfaceVisibilityEvent {
|
|
254
|
-
id: string;
|
|
255
|
-
kind: 'overlay' | 'window';
|
|
256
|
-
source: 'opener' | 'page';
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
export interface SurfaceHandle {
|
|
260
|
-
readonly id: string;
|
|
261
|
-
/**
|
|
262
|
-
* Show a host-managed surface. Dynamic page/url surfaces return a Promise;
|
|
263
|
-
* host-declared surfaces may complete synchronously.
|
|
264
|
-
*/
|
|
265
|
-
show(): void | Promise<void>;
|
|
266
|
-
/**
|
|
267
|
-
* Hide without destroying user-visible state when the platform supports it.
|
|
268
|
-
*/
|
|
269
|
-
hide(): void | Promise<void>;
|
|
270
|
-
/**
|
|
271
|
-
* Close or hide the surface depending on how it is managed by the host.
|
|
272
|
-
*/
|
|
273
|
-
close(): void | Promise<void>;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
export interface Surface extends SurfaceHandle {
|
|
277
|
-
readonly kind: 'overlay' | 'window';
|
|
278
|
-
/**
|
|
279
|
-
* Last-known visibility, kept in sync with the native side via show/hide
|
|
280
|
-
* events. False once the surface has been closed. Safe to bind into
|
|
281
|
-
* declarative UI; for event-driven updates subscribe via `onShow`/`onHide`.
|
|
282
|
-
*/
|
|
283
|
-
readonly visible: boolean;
|
|
284
|
-
/**
|
|
285
|
-
* True until `close()` fires. After close the surface is detached and the
|
|
286
|
-
* page instance is being torn down; further `show()` / `hide()` calls will
|
|
287
|
-
* reject.
|
|
288
|
-
*/
|
|
289
|
-
readonly alive: boolean;
|
|
290
|
-
/**
|
|
291
|
-
* Sends a message to the other side of a page surface.
|
|
292
|
-
*
|
|
293
|
-
* For the opener this targets the opened page. For the opened page this
|
|
294
|
-
* targets the opener. URL surfaces have no page-side receiver.
|
|
295
|
-
*/
|
|
296
|
-
postMessage(message: unknown): void;
|
|
297
|
-
onMessage(handler: (message: unknown) => void): () => void;
|
|
298
|
-
onClose(handler: (event: SurfaceClosedEvent) => void): () => void;
|
|
299
|
-
/**
|
|
300
|
-
* Fires when the surface transitions to visible, regardless of whether
|
|
301
|
-
* `show()` was called on this side or on the peer. Returns an unsubscribe
|
|
302
|
-
* function. Only fires on real state changes — calling `show()` on an
|
|
303
|
-
* already-visible surface is a no-op for listeners.
|
|
304
|
-
*/
|
|
305
|
-
onShow(handler: (event: SurfaceVisibilityEvent) => void): () => void;
|
|
306
|
-
/**
|
|
307
|
-
* Fires when the surface transitions to hidden, regardless of which side
|
|
308
|
-
* triggered it. Returns an unsubscribe function. Only fires on real state
|
|
309
|
-
* changes.
|
|
310
|
-
*/
|
|
311
|
-
onHide(handler: (event: SurfaceVisibilityEvent) => void): () => void;
|
|
312
|
-
close(): Promise<void>;
|
|
313
|
-
/**
|
|
314
|
-
* Toggle the surface to visible without tearing it down. The page instance
|
|
315
|
-
* and its state survive a hide / show round-trip — only close() actually
|
|
316
|
-
* destroys the surface and fires the onClose listener. Idempotent: calling
|
|
317
|
-
* on an already-visible surface resolves without firing `onShow`.
|
|
318
|
-
*/
|
|
319
|
-
show(): Promise<void>;
|
|
320
|
-
/**
|
|
321
|
-
* Hide the surface without destroying it. The page instance stays mounted,
|
|
322
|
-
* so a subsequent show() restores the same scroll position, form input,
|
|
323
|
-
* and JS state. Hidden surfaces still receive postMessage but are not
|
|
324
|
-
* visible to the user. Idempotent.
|
|
325
|
-
*/
|
|
326
|
-
hide(): Promise<void>;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export interface PageMessagePort {
|
|
330
|
-
postMessage(message: unknown): void;
|
|
331
|
-
onMessage(handler: (message: unknown) => void): () => void;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
export interface PageInstance<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
335
|
-
data: TData;
|
|
336
|
-
route: string;
|
|
337
|
-
/**
|
|
338
|
-
* Available when this page was opened as a surface via `lx.openSurface(...)`.
|
|
339
|
-
*/
|
|
340
|
-
surface?: Surface;
|
|
341
|
-
/**
|
|
342
|
-
* Available when this page was opened by `lx.navigateTo(...)`.
|
|
343
|
-
*/
|
|
344
|
-
opener?: PageMessagePort;
|
|
345
|
-
setData(data: Partial<TData> | Record<string, unknown>, callback?: () => void): void;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Injected by the runtime into methods listed in `stream_handlers` page metadata.
|
|
350
|
-
*
|
|
351
|
-
* Use this when your async source uses callbacks rather than an async iterator.
|
|
352
|
-
* For the generator form (`async *method()`), no handle is needed — the runtime
|
|
353
|
-
* pumps the generator automatically.
|
|
354
|
-
*/
|
|
355
|
-
export interface StreamHandle<T = unknown> {
|
|
356
|
-
/** Send a chunk to View. */
|
|
357
|
-
send(payload: T): void;
|
|
358
|
-
/** End the stream with an optional final value. */
|
|
359
|
-
end(result?: unknown): void;
|
|
360
|
-
/** End the stream with an error. */
|
|
361
|
-
error(code: string, message?: string): void;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Injected by the runtime as the second parameter when View opens a channel.
|
|
366
|
-
*
|
|
367
|
-
* Use `ch.send()` to push data to View, `ch.on()` to receive data/close
|
|
368
|
-
* events from View, and `ch.close()` to shut down the channel.
|
|
369
|
-
*/
|
|
370
|
-
export interface ChannelHandle<TSend = unknown, TReceive = unknown> {
|
|
371
|
-
/** Push a message to View. */
|
|
372
|
-
send(payload: TSend): void;
|
|
373
|
-
/** Close the channel from Logic side. */
|
|
374
|
-
close(code?: string, reason?: string): void;
|
|
375
|
-
/** Register a listener for incoming events. */
|
|
376
|
-
on(event: 'data', handler: (payload: TReceive) => void): void;
|
|
377
|
-
on(event: 'close', handler: (info: { code: string; reason: string }) => void): void;
|
|
378
|
-
}
|
package/src/device/actions.ts
DELETED
package/src/device/index.ts
DELETED
package/src/device/info.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Device info APIs.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface DeviceInfo {
|
|
6
|
-
brand: string;
|
|
7
|
-
model: string;
|
|
8
|
-
marketName: string;
|
|
9
|
-
osName: string;
|
|
10
|
-
osVersion: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ScreenInfo {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
scale: number;
|
|
17
|
-
}
|
package/src/device/network.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Network status APIs.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Matches mini-program style where possible: wifi/2g/3g/4g/5g/none/unknown.
|
|
6
|
-
export type NetworkType =
|
|
7
|
-
| 'none'
|
|
8
|
-
| 'unknown'
|
|
9
|
-
| 'wifi'
|
|
10
|
-
| '2g'
|
|
11
|
-
| '3g'
|
|
12
|
-
| '4g'
|
|
13
|
-
| '5g'
|
|
14
|
-
| 'ethernet';
|
|
15
|
-
|
|
16
|
-
export interface NetworkInfo {
|
|
17
|
-
isConnected: boolean;
|
|
18
|
-
networkType: NetworkType;
|
|
19
|
-
ipv4: string[];
|
|
20
|
-
ipv6: string[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type NetworkChangeCallback = (info: NetworkInfo) => void;
|
package/src/device/wifi.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wi-Fi APIs.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface WifiInfo {
|
|
6
|
-
SSID: string;
|
|
7
|
-
BSSID?: string;
|
|
8
|
-
secure: boolean;
|
|
9
|
-
signalStrength: number;
|
|
10
|
-
frequency?: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface WifiConnectedInfo extends WifiInfo {
|
|
14
|
-
connected: boolean;
|
|
15
|
-
state: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ConnectWifiOptions {
|
|
19
|
-
SSID: string;
|
|
20
|
-
password?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type WifiConnectedCallback = (info: WifiConnectedInfo) => void;
|
package/src/display/index.ts
DELETED
package/src/env/index.ts
DELETED
package/src/file/index.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File system APIs.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface OpenFileOptions {
|
|
6
|
-
/** Local file path or runtime-managed temp path. */
|
|
7
|
-
filePath: string;
|
|
8
|
-
/** Optional coarse file type hint such as `pdf`, `docx`, or `xlsx`. */
|
|
9
|
-
fileType?: string;
|
|
10
|
-
/**
|
|
11
|
-
* `auto`: prefer native review, then fall back to external open.
|
|
12
|
-
* `review`: require native review UI and reject when unsupported.
|
|
13
|
-
* `external`: hand off directly to the system / external app.
|
|
14
|
-
*/
|
|
15
|
-
mode?: 'auto' | 'review' | 'external';
|
|
16
|
-
/** Hint for whether the native review UI should expose its action menu when supported. */
|
|
17
|
-
showMenu?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface FileDialogFilter {
|
|
21
|
-
/** Optional label shown in the native dialog. */
|
|
22
|
-
name?: string;
|
|
23
|
-
/** Allowed extensions without dots, e.g. ['pdf', 'txt']. */
|
|
24
|
-
extensions: string[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ChooseFileOptions {
|
|
28
|
-
/** Allow selecting multiple files. Default: false */
|
|
29
|
-
multiple?: boolean;
|
|
30
|
-
/** Optional file filters. Empty or omitted means all file types. */
|
|
31
|
-
filters?: FileDialogFilter[];
|
|
32
|
-
/**
|
|
33
|
-
* Initial directory the dialog opens in.
|
|
34
|
-
*
|
|
35
|
-
* When this resolves to an app-local directory, LingXia may use its internal
|
|
36
|
-
* file picker. When omitted, the platform system file picker is used.
|
|
37
|
-
*/
|
|
38
|
-
defaultPath?: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface ChooseFileResult {
|
|
42
|
-
/** True if the user dismissed the dialog without selecting. */
|
|
43
|
-
canceled: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* File paths returned by LingXia. Values may be app-local paths, `lx://...`
|
|
46
|
-
* paths, or platform system-picker references. Treat them as opaque strings
|
|
47
|
-
* and pass them back to LingXia APIs such as `lx.share`.
|
|
48
|
-
*/
|
|
49
|
-
paths: string[];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface ChooseDirectoryOptions {
|
|
53
|
-
/** Initial directory the dialog opens in. Platform default if omitted. */
|
|
54
|
-
defaultPath?: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface ChooseDirectoryResult {
|
|
58
|
-
/** True if the user dismissed the dialog without selecting. */
|
|
59
|
-
canceled: boolean;
|
|
60
|
-
/** Native-consumable directory reference (path or URI). Undefined when canceled. */
|
|
61
|
-
path?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface ExistsOptions {
|
|
65
|
-
path: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface StatOptions {
|
|
69
|
-
path: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface FileStats {
|
|
73
|
-
isFile: boolean;
|
|
74
|
-
isDirectory: boolean;
|
|
75
|
-
isSymlink: boolean;
|
|
76
|
-
size: number;
|
|
77
|
-
lastModifiedTime?: number;
|
|
78
|
-
lastAccessedTime?: number;
|
|
79
|
-
createTime?: number;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface ReadDirOptions {
|
|
83
|
-
path: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface DirEntry {
|
|
87
|
-
name: string;
|
|
88
|
-
isFile: boolean;
|
|
89
|
-
isDirectory: boolean;
|
|
90
|
-
isSymlink: boolean;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface MkdirOptions {
|
|
94
|
-
path: string;
|
|
95
|
-
recursive?: boolean;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface ReadTextFileOptions {
|
|
99
|
-
filePath: string;
|
|
100
|
-
encoding: 'utf8' | 'base64';
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface ReadBinaryFileOptions {
|
|
104
|
-
filePath: string;
|
|
105
|
-
encoding?: undefined;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export type ReadFileOptions = ReadTextFileOptions | ReadBinaryFileOptions;
|
|
109
|
-
|
|
110
|
-
export interface ReadTextFileResult {
|
|
111
|
-
data: string;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface ReadBinaryFileResult {
|
|
115
|
-
data: ArrayBuffer;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export type ReadFileResult = ReadTextFileResult | ReadBinaryFileResult;
|
|
119
|
-
|
|
120
|
-
export type BinaryFileData = ArrayBuffer | ArrayBufferView;
|
|
121
|
-
|
|
122
|
-
export interface WriteTextFileOptions {
|
|
123
|
-
filePath: string;
|
|
124
|
-
data: string;
|
|
125
|
-
encoding?: 'utf8' | 'base64';
|
|
126
|
-
/** Defaults to false. */
|
|
127
|
-
overwrite?: boolean;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface WriteBinaryFileOptions {
|
|
131
|
-
filePath: string;
|
|
132
|
-
data: BinaryFileData;
|
|
133
|
-
encoding?: never;
|
|
134
|
-
/** Defaults to false. */
|
|
135
|
-
overwrite?: boolean;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export type WriteFileOptions = WriteTextFileOptions | WriteBinaryFileOptions;
|
|
139
|
-
|
|
140
|
-
export interface CopyFileOptions {
|
|
141
|
-
srcPath: string;
|
|
142
|
-
destPath: string;
|
|
143
|
-
/** Defaults to false. */
|
|
144
|
-
overwrite?: boolean;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface RenameOptions {
|
|
148
|
-
oldPath: string;
|
|
149
|
-
newPath: string;
|
|
150
|
-
/** Defaults to false. */
|
|
151
|
-
overwrite?: boolean;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface RemoveOptions {
|
|
155
|
-
path: string;
|
|
156
|
-
recursive?: boolean;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export interface FileManager {
|
|
160
|
-
exists(options: ExistsOptions): Promise<boolean>;
|
|
161
|
-
stat(options: StatOptions): Promise<FileStats>;
|
|
162
|
-
readDir(options: ReadDirOptions): Promise<AsyncIterableIterator<DirEntry>>;
|
|
163
|
-
mkdir(options: MkdirOptions): Promise<void>;
|
|
164
|
-
readFile(options: ReadTextFileOptions): Promise<ReadTextFileResult>;
|
|
165
|
-
readFile(options: ReadBinaryFileOptions): Promise<ReadBinaryFileResult>;
|
|
166
|
-
readFile(options: ReadFileOptions): Promise<ReadFileResult>;
|
|
167
|
-
writeFile(options: WriteFileOptions): Promise<void>;
|
|
168
|
-
copyFile(options: CopyFileOptions): Promise<void>;
|
|
169
|
-
rename(options: RenameOptions): Promise<void>;
|
|
170
|
-
remove(options: RemoveOptions): Promise<void>;
|
|
171
|
-
}
|
package/src/input/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Input event APIs.
|
|
3
|
-
*
|
|
4
|
-
* Platform support: Android only
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface KeyEvent {
|
|
8
|
-
/** Key value following W3C naming (e.g. "Enter", "ArrowLeft", "a") */
|
|
9
|
-
key: string;
|
|
10
|
-
/** Physical key code (e.g. "ENTER", "DPAD_LEFT") */
|
|
11
|
-
code: string;
|
|
12
|
-
altKey?: boolean;
|
|
13
|
-
ctrlKey?: boolean;
|
|
14
|
-
shiftKey?: boolean;
|
|
15
|
-
metaKey?: boolean;
|
|
16
|
-
repeat?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type KeyEventCallback = (event: KeyEvent) => void;
|
package/src/location/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Location APIs.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface GetLocationOptions {
|
|
6
|
-
type?: 'wgs84' | 'gcj02';
|
|
7
|
-
altitude?: boolean;
|
|
8
|
-
isHighAccuracy?: boolean;
|
|
9
|
-
highAccuracyExpireTime?: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface LocationInfo {
|
|
13
|
-
latitude: number;
|
|
14
|
-
longitude: number;
|
|
15
|
-
speed?: number;
|
|
16
|
-
accuracy?: number;
|
|
17
|
-
altitude?: number;
|
|
18
|
-
verticalAccuracy?: number;
|
|
19
|
-
horizontalAccuracy?: number;
|
|
20
|
-
}
|
package/src/lxapp/index.ts
DELETED