@lingxia/types 0.9.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.
Files changed (130) hide show
  1. package/dist/automation/index.d.ts +942 -0
  2. package/dist/automation/index.d.ts.map +1 -0
  3. package/dist/automation/index.js +13 -0
  4. package/dist/automation/index.js.map +1 -0
  5. package/dist/generated/i18n.d.ts +1 -1
  6. package/dist/generated/i18n.d.ts.map +1 -1
  7. package/dist/generated/i18n.js +44 -22
  8. package/dist/generated/i18n.js.map +1 -1
  9. package/dist/generated/logic-web.d.ts +305 -0
  10. package/dist/generated/logic.d.ts +1909 -0
  11. package/dist/generated/logic.d.ts.map +1 -0
  12. package/dist/generated/logic.js +5 -0
  13. package/dist/generated/logic.js.map +1 -0
  14. package/dist/index.d.ts +16 -139
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +3 -16
  17. package/dist/index.js.map +1 -1
  18. package/dist/logic-globals.d.ts +1 -0
  19. package/dist/process.d.ts +117 -0
  20. package/dist/process.d.ts.map +1 -0
  21. package/dist/process.js +10 -0
  22. package/dist/process.js.map +1 -0
  23. package/package.json +73 -47
  24. package/src/automation/index.ts +1074 -0
  25. package/src/generated/i18n.ts +44 -22
  26. package/src/generated/logic-web.d.ts +305 -0
  27. package/src/generated/logic.ts +2123 -0
  28. package/src/index.ts +18 -258
  29. package/src/logic-globals.d.ts +1 -0
  30. package/src/process.ts +135 -0
  31. package/dist/app/index.d.ts +0 -278
  32. package/dist/app/index.d.ts.map +0 -1
  33. package/dist/app/index.js +0 -6
  34. package/dist/app/index.js.map +0 -1
  35. package/dist/device/actions.d.ts +0 -7
  36. package/dist/device/actions.d.ts.map +0 -1
  37. package/dist/device/actions.js +0 -6
  38. package/dist/device/actions.js.map +0 -1
  39. package/dist/device/index.d.ts +0 -5
  40. package/dist/device/index.d.ts.map +0 -1
  41. package/dist/device/index.js +0 -21
  42. package/dist/device/index.js.map +0 -1
  43. package/dist/device/info.d.ts +0 -16
  44. package/dist/device/info.d.ts.map +0 -1
  45. package/dist/device/info.js +0 -6
  46. package/dist/device/info.js.map +0 -1
  47. package/dist/device/network.d.ts +0 -12
  48. package/dist/device/network.d.ts.map +0 -1
  49. package/dist/device/network.js +0 -6
  50. package/dist/device/network.js.map +0 -1
  51. package/dist/device/wifi.d.ts +0 -20
  52. package/dist/device/wifi.d.ts.map +0 -1
  53. package/dist/device/wifi.js +0 -6
  54. package/dist/device/wifi.js.map +0 -1
  55. package/dist/display/index.d.ts +0 -8
  56. package/dist/display/index.d.ts.map +0 -1
  57. package/dist/display/index.js +0 -6
  58. package/dist/display/index.js.map +0 -1
  59. package/dist/env/index.d.ts +0 -8
  60. package/dist/env/index.d.ts.map +0 -1
  61. package/dist/env/index.js +0 -6
  62. package/dist/env/index.js.map +0 -1
  63. package/dist/file/index.d.ts +0 -146
  64. package/dist/file/index.d.ts.map +0 -1
  65. package/dist/file/index.js +0 -6
  66. package/dist/file/index.js.map +0 -1
  67. package/dist/input/index.d.ts +0 -18
  68. package/dist/input/index.d.ts.map +0 -1
  69. package/dist/input/index.js +0 -8
  70. package/dist/input/index.js.map +0 -1
  71. package/dist/location/index.d.ts +0 -19
  72. package/dist/location/index.d.ts.map +0 -1
  73. package/dist/location/index.js +0 -6
  74. package/dist/location/index.js.map +0 -1
  75. package/dist/lxapp/index.d.ts +0 -11
  76. package/dist/lxapp/index.d.ts.map +0 -1
  77. package/dist/lxapp/index.js +0 -6
  78. package/dist/lxapp/index.js.map +0 -1
  79. package/dist/media/index.d.ts +0 -313
  80. package/dist/media/index.d.ts.map +0 -1
  81. package/dist/media/index.js +0 -6
  82. package/dist/media/index.js.map +0 -1
  83. package/dist/navigator/index.d.ts +0 -14
  84. package/dist/navigator/index.d.ts.map +0 -1
  85. package/dist/navigator/index.js +0 -6
  86. package/dist/navigator/index.js.map +0 -1
  87. package/dist/share/index.d.ts +0 -90
  88. package/dist/share/index.d.ts.map +0 -1
  89. package/dist/share/index.js +0 -6
  90. package/dist/share/index.js.map +0 -1
  91. package/dist/storage/index.d.ts +0 -13
  92. package/dist/storage/index.d.ts.map +0 -1
  93. package/dist/storage/index.js +0 -6
  94. package/dist/storage/index.js.map +0 -1
  95. package/dist/system/index.d.ts +0 -13
  96. package/dist/system/index.d.ts.map +0 -1
  97. package/dist/system/index.js +0 -6
  98. package/dist/system/index.js.map +0 -1
  99. package/dist/transfer/index.d.ts +0 -121
  100. package/dist/transfer/index.d.ts.map +0 -1
  101. package/dist/transfer/index.js +0 -6
  102. package/dist/transfer/index.js.map +0 -1
  103. package/dist/ui/index.d.ts +0 -147
  104. package/dist/ui/index.d.ts.map +0 -1
  105. package/dist/ui/index.js +0 -6
  106. package/dist/ui/index.js.map +0 -1
  107. package/dist/update/index.d.ts +0 -17
  108. package/dist/update/index.d.ts.map +0 -1
  109. package/dist/update/index.js +0 -6
  110. package/dist/update/index.js.map +0 -1
  111. package/src/app/index.ts +0 -323
  112. package/src/device/actions.ts +0 -7
  113. package/src/device/index.ts +0 -4
  114. package/src/device/info.ts +0 -17
  115. package/src/device/network.ts +0 -23
  116. package/src/device/wifi.ts +0 -23
  117. package/src/display/index.ts +0 -9
  118. package/src/env/index.ts +0 -8
  119. package/src/file/index.ts +0 -171
  120. package/src/input/index.ts +0 -19
  121. package/src/location/index.ts +0 -20
  122. package/src/lxapp/index.ts +0 -12
  123. package/src/media/index.ts +0 -343
  124. package/src/navigator/index.ts +0 -16
  125. package/src/share/index.ts +0 -97
  126. package/src/storage/index.ts +0 -13
  127. package/src/system/index.ts +0 -14
  128. package/src/transfer/index.ts +0 -136
  129. package/src/ui/index.ts +0 -180
  130. package/src/update/index.ts +0 -19
@@ -1,147 +0,0 @@
1
- /**
2
- * UI feedback, navigation, and surface control APIs.
3
- */
4
- export interface ShowToastOptions {
5
- title: string;
6
- icon?: 'success' | 'error' | 'loading' | 'none';
7
- image?: string;
8
- duration?: number;
9
- mask?: boolean;
10
- position?: 'top' | 'center' | 'bottom';
11
- }
12
- export interface ShowModalOptions {
13
- title?: string;
14
- content?: string;
15
- showCancel?: boolean;
16
- cancelText?: string;
17
- cancelColor?: string;
18
- confirmText?: string;
19
- confirmColor?: string;
20
- }
21
- export interface ModalResult {
22
- confirm: boolean;
23
- cancel: boolean;
24
- }
25
- export interface ShowActionSheetOptions {
26
- itemList: string[];
27
- itemColor?: string;
28
- }
29
- export interface ActionSheetResult {
30
- tapIndex: number;
31
- }
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;
44
- export interface NavigateBackOptions {
45
- delta: number;
46
- }
47
- export type RedirectToOptions = PageTargetOptions;
48
- export type SwitchTabOptions = PageTargetOptions;
49
- export type ReLaunchOptions = PageTargetOptions;
50
- export interface SetNavigationBarTitleOptions {
51
- title: string;
52
- }
53
- export interface SetNavigationBarColorOptions {
54
- frontColor: string;
55
- backgroundColor: string;
56
- }
57
- export interface TabBarRedDotOptions {
58
- index: number;
59
- }
60
- export interface SetTabBarBadgeOptions {
61
- index: number;
62
- text: string;
63
- }
64
- export interface RemoveTabBarBadgeOptions {
65
- index: number;
66
- }
67
- export interface SetTabBarStyleOptions {
68
- color?: string;
69
- selectedColor?: string;
70
- backgroundColor?: string;
71
- borderStyle?: string;
72
- }
73
- export interface SetTabBarItemOptions {
74
- index: number;
75
- text?: string;
76
- iconPath?: string;
77
- selectedIconPath?: string;
78
- }
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 = {
93
- url: string;
94
- page?: never;
95
- path?: never;
96
- query?: never;
97
- };
98
- export type SurfaceTargetOptions = SurfacePageTargetOptions | SurfaceUrlTargetOptions;
99
- /**
100
- * Overlay surface size value.
101
- *
102
- * - number: absolute size, must be > 0
103
- * - `${number}%`: percentage size, must be > 0% and <= 100%
104
- */
105
- export type OverlaySurfaceSizeValue = number | `${number}%`;
106
- export interface OverlaySurfaceSize {
107
- /** Width for overlay surface. */
108
- width?: OverlaySurfaceSizeValue;
109
- /** Height for overlay surface. */
110
- height?: OverlaySurfaceSizeValue;
111
- }
112
- /**
113
- * Overlay surface: a webview composited on top of the host activity's
114
- * content. Cross-platform. Covers the screen (or a fraction of it) until
115
- * closed; coexists with native media preview at the same z-tier — the
116
- * later-added overlay or preview wins compositing order.
117
- */
118
- export type OverlaySurfaceOptions = SurfaceTargetOptions & {
119
- kind: 'overlay';
120
- position?: 'center' | 'bottom' | 'left' | 'right' | 'top';
121
- size?: OverlaySurfaceSize;
122
- };
123
- export interface WindowSurfaceSize {
124
- /** Window width, must be a positive number. */
125
- width?: number;
126
- /** Window height, must be a positive number. */
127
- height?: number;
128
- }
129
- /**
130
- * Window-kind surfaces are macOS-only. Android, iOS, and Harmony reject
131
- * `kind: 'window'` at open() and surface a `surface_open_failed` error;
132
- * use `OverlaySurfaceOptions` for cross-platform code.
133
- */
134
- export type WindowSurfaceOptions = SurfaceTargetOptions & {
135
- kind: 'window';
136
- size?: WindowSurfaceSize;
137
- };
138
- export type SurfaceOpenOptions = OverlaySurfaceOptions | WindowSurfaceOptions;
139
- export interface CapsuleRect {
140
- width?: number;
141
- height?: number;
142
- top?: number;
143
- right?: number;
144
- bottom?: number;
145
- left?: number;
146
- }
147
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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;IAC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AM,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 DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /**
3
- * UI feedback, navigation, and surface control APIs.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Runtime update APIs.
3
- */
4
- export interface UpdateManager {
5
- applyUpdate(): void;
6
- onUpdateReady(callback: (info: UpdateReadyInfo) => void): void;
7
- onUpdateFailed(callback: (info: UpdateFailedInfo) => void): void;
8
- }
9
- export interface UpdateReadyInfo {
10
- version?: string;
11
- isForceUpdate?: boolean;
12
- channel?: "release" | "preview" | "developer" | string;
13
- }
14
- export interface UpdateFailedInfo extends UpdateReadyInfo {
15
- error?: string;
16
- }
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /**
3
- * Runtime update APIs.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":";AAAA;;GAEG"}
package/src/app/index.ts DELETED
@@ -1,323 +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 HostAppApi {
95
- /**
96
- * The environment this build was produced for, mirroring `app.json::envVersion`.
97
- * Always present; defaults to `'release'` for builds produced before the field
98
- * existed in the artifact.
99
- *
100
- * Use this to branch on environment-specific behavior (e.g. verbose logging in
101
- * developer builds, distinct theme tinting, distinct error-reporter tags).
102
- * Synchronous; the value is fixed at app boot.
103
- */
104
- readonly envVersion: HostAppEnvVersion;
105
-
106
- getBaseInfo(): AppBaseInfo;
107
-
108
- /**
109
- * Check whether the host app has an update.
110
- *
111
- * This is a host app level capability and is only available to the home
112
- * lxapp. Non-home lxapps receive a permission error.
113
- *
114
- * Calling this API opts the host app into custom update handling for this
115
- * process. LingXia will not show its built-in host app update UI or
116
- * auto-install host app updates after that point.
117
- *
118
- * If no update is available, or if an update requires a newer LingXia
119
- * runtime than the current host app provides, `hasUpdate` is `false`.
120
- *
121
- * `checkUpdate()` may return version metadata on platforms that cannot apply
122
- * host app packages directly. In that case, `update.apply()` rejects with an
123
- * unsupported-operation error.
124
- */
125
- checkUpdate(): Promise<HostAppUpdateCheckResult>;
126
-
127
- /**
128
- * Exit the host app immediately.
129
- *
130
- * This API does not show a confirmation dialog. If the user should confirm
131
- * first, call `lx.showModal(...)` in page logic and invoke `lx.app.exit()`
132
- * only after the user confirms.
133
- */
134
- exit(): void;
135
- }
136
-
137
- export interface AppLifecycleEventArgs {
138
- source: 'host' | 'lxapp';
139
- reason:
140
- | 'foreground'
141
- | 'background'
142
- | 'screenshot'
143
- | 'open'
144
- | 'close'
145
- | 'switch_back'
146
- | 'switch_away';
147
- }
148
-
149
- export interface AppLaunchOptions {
150
- path?: string;
151
- query?: Record<string, string>;
152
- scene?: number;
153
- referrerInfo?: {
154
- appId?: string;
155
- extraData?: Record<string, unknown>;
156
- };
157
- }
158
-
159
- export interface AppConfig {
160
- globalData?: Record<string, unknown>;
161
- onLaunch?: (options?: AppLaunchOptions) => void | Promise<void>;
162
- onShow?: (args?: AppLifecycleEventArgs) => void | Promise<void>;
163
- onHide?: (args?: AppLifecycleEventArgs) => void | Promise<void>;
164
- onUserCaptureScreen?: () => void | Promise<void>;
165
- [key: string]: unknown;
166
- }
167
-
168
- export interface AppInstance extends AppConfig {
169
- globalData: Record<string, unknown>;
170
- }
171
-
172
- export interface PageLoadOptions {
173
- [key: string]: string | undefined;
174
- }
175
-
176
- export interface PageConfig<TData extends Record<string, unknown> = Record<string, unknown>> {
177
- data?: TData;
178
- onLoad?: (options?: PageLoadOptions) => void | Promise<void>;
179
- onShow?: () => void | Promise<void>;
180
- onReady?: () => void | Promise<void>;
181
- onHide?: () => void | Promise<void>;
182
- onUnload?: () => void | Promise<void>;
183
- onPullDownRefresh?: () => void | Promise<void>;
184
- [key: string]: unknown;
185
- }
186
-
187
- export type SurfaceCloseReason =
188
- | 'user'
189
- | 'programmatic'
190
- | 'owner_closed'
191
- | 'app_closed'
192
- | 'failed'
193
- /**
194
- * The SDK reclaimed a long-hidden overlay surface for resource reasons.
195
- * Treat as a normal close: the page instance is gone; further postMessage /
196
- * show / hide calls will fail. The opener may immediately reopen if needed.
197
- */
198
- | 'reclaimed'
199
- | 'unknown';
200
-
201
- export interface SurfaceClosedEvent {
202
- id: string;
203
- kind: 'overlay' | 'window';
204
- reason: SurfaceCloseReason;
205
- }
206
-
207
- /**
208
- * Detail payload for `onShow` / `onHide` events. `source` identifies which
209
- * Surface object initiated the visibility change so observers can
210
- * distinguish self-driven transitions from peer-driven ones (e.g. an opener
211
- * UI that wants to update its own button state only when the page side
212
- * toggled visibility).
213
- */
214
- export interface SurfaceVisibilityEvent {
215
- id: string;
216
- kind: 'overlay' | 'window';
217
- source: 'opener' | 'page';
218
- }
219
-
220
- export interface Surface {
221
- readonly id: string;
222
- readonly kind: 'overlay' | 'window';
223
- /**
224
- * Last-known visibility, kept in sync with the native side via show/hide
225
- * events. False once the surface has been closed. Safe to bind into
226
- * declarative UI; for event-driven updates subscribe via `onShow`/`onHide`.
227
- */
228
- readonly visible: boolean;
229
- /**
230
- * True until `close()` fires. After close the surface is detached and the
231
- * page instance is being torn down; further `show()` / `hide()` calls will
232
- * reject.
233
- */
234
- readonly alive: boolean;
235
- /**
236
- * Sends a message to the other side of a page surface.
237
- *
238
- * For the opener this targets the opened page. For the opened page this
239
- * targets the opener. URL surfaces have no page-side receiver.
240
- */
241
- postMessage(message: unknown): void;
242
- onMessage(handler: (message: unknown) => void): () => void;
243
- onClose(handler: (event: SurfaceClosedEvent) => void): () => void;
244
- /**
245
- * Fires when the surface transitions to visible, regardless of whether
246
- * `show()` was called on this side or on the peer. Returns an unsubscribe
247
- * function. Only fires on real state changes — calling `show()` on an
248
- * already-visible surface is a no-op for listeners.
249
- */
250
- onShow(handler: (event: SurfaceVisibilityEvent) => void): () => void;
251
- /**
252
- * Fires when the surface transitions to hidden, regardless of which side
253
- * triggered it. Returns an unsubscribe function. Only fires on real state
254
- * changes.
255
- */
256
- onHide(handler: (event: SurfaceVisibilityEvent) => void): () => void;
257
- close(): Promise<void>;
258
- /**
259
- * Toggle the surface to visible without tearing it down. The page instance
260
- * and its state survive a hide / show round-trip — only close() actually
261
- * destroys the surface and fires the onClose listener. Idempotent: calling
262
- * on an already-visible surface resolves without firing `onShow`.
263
- */
264
- show(): Promise<void>;
265
- /**
266
- * Hide the surface without destroying it. The page instance stays mounted,
267
- * so a subsequent show() restores the same scroll position, form input,
268
- * and JS state. Hidden surfaces still receive postMessage but are not
269
- * visible to the user. Idempotent.
270
- */
271
- hide(): Promise<void>;
272
- }
273
-
274
- export interface PageMessagePort {
275
- postMessage(message: unknown): void;
276
- onMessage(handler: (message: unknown) => void): () => void;
277
- }
278
-
279
- export interface PageInstance<TData extends Record<string, unknown> = Record<string, unknown>> {
280
- data: TData;
281
- route: string;
282
- /**
283
- * Available when this page was opened by `lx.surface.open(...)`.
284
- */
285
- surface?: Surface;
286
- /**
287
- * Available when this page was opened by `lx.navigateTo(...)`.
288
- */
289
- opener?: PageMessagePort;
290
- setData(data: Partial<TData> | Record<string, unknown>, callback?: () => void): void;
291
- }
292
-
293
- /**
294
- * Injected by the runtime into methods listed in `stream_handlers` page metadata.
295
- *
296
- * Use this when your async source uses callbacks rather than an async iterator.
297
- * For the generator form (`async *method()`), no handle is needed — the runtime
298
- * pumps the generator automatically.
299
- */
300
- export interface StreamHandle<T = unknown> {
301
- /** Send a chunk to View. */
302
- send(payload: T): void;
303
- /** End the stream with an optional final value. */
304
- end(result?: unknown): void;
305
- /** End the stream with an error. */
306
- error(code: string, message?: string): void;
307
- }
308
-
309
- /**
310
- * Injected by the runtime as the second parameter when View opens a channel.
311
- *
312
- * Use `ch.send()` to push data to View, `ch.on()` to receive data/close
313
- * events from View, and `ch.close()` to shut down the channel.
314
- */
315
- export interface ChannelHandle<TSend = unknown, TReceive = unknown> {
316
- /** Push a message to View. */
317
- send(payload: TSend): void;
318
- /** Close the channel from Logic side. */
319
- close(code?: string, reason?: string): void;
320
- /** Register a listener for incoming events. */
321
- on(event: 'data', handler: (payload: TReceive) => void): void;
322
- on(event: 'close', handler: (info: { code: string; reason: string }) => void): void;
323
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Device action APIs.
3
- */
4
-
5
- export interface MakePhoneCallOptions {
6
- phoneNumber: string;
7
- }
@@ -1,4 +0,0 @@
1
- export * from './info';
2
- export * from './actions';
3
- export * from './wifi';
4
- export * from './network';
@@ -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
- }
@@ -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;
@@ -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;
@@ -1,9 +0,0 @@
1
- /**
2
- * Display and orientation APIs.
3
- */
4
-
5
- export type DeviceOrientation = "portrait" | "landscape";
6
-
7
- export interface DeviceOrientationChangeEvent {
8
- value: DeviceOrientation;
9
- }
package/src/env/index.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * Runtime environment constants.
3
- */
4
-
5
- export interface LxEnv {
6
- USER_DATA_PATH: string;
7
- USER_CACHE_PATH: string;
8
- }