@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.
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 +29 -0
  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 -313
  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 +29 -0
  26. package/src/generated/logic-web.d.ts +305 -0
  27. package/src/generated/logic.ts +2123 -0
  28. package/src/index.ts +18 -459
  29. package/src/logic-globals.d.ts +1 -0
  30. package/src/process.ts +135 -0
  31. package/dist/app/index.d.ts +0 -328
  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 -372
  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 -9
  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 -166
  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 -134
  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 -378
  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 -411
  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 -9
  128. package/src/transfer/index.ts +0 -194
  129. package/src/ui/index.ts +0 -165
  130. package/src/update/index.ts +0 -19
@@ -1,194 +0,0 @@
1
- /**
2
- * Transfer task APIs.
3
- */
4
-
5
- declare const appDownloadPathBrand: unique symbol;
6
- declare const systemDownloadsPathBrand: unique symbol;
7
-
8
- export type DownloadDestination = 'app' | 'downloads';
9
-
10
- /** Runtime-managed app download path, usually under `lx://userdata`. */
11
- export type AppDownloadFilePath = string & {
12
- readonly [appDownloadPathBrand]: 'app-download-file-path';
13
- };
14
-
15
- /** Native system Downloads path. Do not pass this to `FileManager`. */
16
- export type SystemDownloadsPath = string & {
17
- readonly [systemDownloadsPathBrand]: 'system-downloads-path';
18
- };
19
-
20
- export interface DownloadOptionsBase {
21
- /** HTTP(S) source URL. */
22
- url: string;
23
- /**
24
- * Optional request headers.
25
- * Restricted headers such as `Referer` are ignored by the runtime.
26
- */
27
- headers?: Record<string, string>;
28
- /** Request timeout in milliseconds. */
29
- timeout?: number;
30
- /** Optional abort signal. */
31
- signal?: AbortSignal;
32
- }
33
-
34
- export interface AppDownloadOptions extends DownloadOptionsBase {
35
- /**
36
- * Optional app-owned durable output path.
37
- *
38
- * Omit `filePath` to receive a temporary result in `tempFilePath`. Relative
39
- * paths resolve under user data. `lx://` paths must target `lx://userdata`;
40
- * `lx://usercache` is not accepted here.
41
- */
42
- filePath?: string;
43
- /**
44
- * App-owned output. Omit to use a temporary output unless `filePath` is set.
45
- */
46
- destination?: 'app';
47
- }
48
-
49
- export interface DownloadsDownloadOptions extends DownloadOptionsBase {
50
- /**
51
- * Optional filename hint for the system Downloads destination.
52
- * This is not an app-owned FileManager path.
53
- */
54
- filePath?: string;
55
- /** Save into the user's system Downloads directory. */
56
- destination: 'downloads';
57
- }
58
-
59
- /**
60
- * Download options.
61
- *
62
- * - `app`: app-owned temporary output, or durable `lx://userdata` output when
63
- * `filePath` is set
64
- * - `downloads`: user-visible system Downloads output, requiring
65
- * `security.privileges: ["downloads"]` in `lxapp.json`
66
- *
67
- * Default: `app`.
68
- */
69
- export type DownloadOptions<TDestination extends DownloadDestination = DownloadDestination> =
70
- TDestination extends 'downloads' ? DownloadsDownloadOptions : AppDownloadOptions;
71
-
72
- export type DownloadResultForDestination<TDestination extends DownloadDestination> =
73
- TDestination extends 'downloads' ? DownloadsDownloadResult : AppDownloadResult;
74
-
75
- export interface DownloadProgressEvent<TResult extends DownloadResult = DownloadResult> {
76
- kind: 'progress' | 'paused' | 'resumed' | 'canceled' | 'completed';
77
- downloadedBytes?: number;
78
- totalBytes?: number;
79
- /** Present only when the total size is known. */
80
- progress?: number;
81
- result?: TResult;
82
- }
83
-
84
- export interface DownloadIteratorResult<TResult extends DownloadResult = DownloadResult> {
85
- done: boolean;
86
- value?: DownloadProgressEvent<TResult>;
87
- }
88
-
89
- export type AppDownloadResult =
90
- | {
91
- /**
92
- * Temporary result.
93
- *
94
- * Not durable; move or copy it to `lx://userdata` if you need to keep it.
95
- *
96
- * When `filePath` is omitted, the runtime must be able to infer a file
97
- * type from the URL or the server's `Content-Type` header.
98
- */
99
- tempFilePath: string;
100
- filePath?: never;
101
- mimeType?: string;
102
- size: number;
103
- }
104
- | {
105
- /** Durable destination under `lx://userdata`. */
106
- filePath: AppDownloadFilePath;
107
- tempFilePath?: never;
108
- mimeType?: string;
109
- size: number;
110
- };
111
-
112
- export interface DownloadsDownloadResult {
113
- /** Native system Downloads path. Do not pass this to `FileManager`. */
114
- filePath: SystemDownloadsPath;
115
- tempFilePath?: never;
116
- mimeType?: string;
117
- size: number;
118
- }
119
-
120
- export type DownloadResult = AppDownloadResult | DownloadsDownloadResult;
121
-
122
- export interface DownloadTask<TDownloadResult extends DownloadResult = DownloadResult>
123
- extends PromiseLike<TDownloadResult>,
124
- AsyncIterable<DownloadProgressEvent<TDownloadResult>> {
125
- next(): Promise<DownloadIteratorResult<TDownloadResult>>;
126
- /** Stops iteration only. Does not cancel the underlying download task. */
127
- return(): Promise<DownloadIteratorResult<TDownloadResult>>;
128
- catch<TRejected = never>(
129
- onrejected?: ((reason: unknown) => TRejected | PromiseLike<TRejected>) | null,
130
- ): Promise<TDownloadResult | TRejected>;
131
- finally(onfinally?: (() => void) | null): Promise<TDownloadResult>;
132
- pause(): Promise<void>;
133
- resume(): Promise<void>;
134
- cancel(): Promise<void>;
135
- /** Alias for cancel(), matching browser/mini-program abort naming. */
136
- abort(): Promise<void>;
137
- wait(): Promise<TDownloadResult>;
138
- }
139
-
140
- export interface UploadOptions {
141
- /** HTTP(S) destination URL. */
142
- url: string;
143
- /** Local file path or runtime-managed URI to upload. */
144
- filePath: string;
145
- /** Multipart field name. Default: `file`. */
146
- name?: string;
147
- /**
148
- * Optional request headers.
149
- * Restricted headers such as `Referer` are ignored by the runtime.
150
- */
151
- headers?: Record<string, string>;
152
- /** Optional extra `multipart/form-data` text fields. */
153
- formData?: Record<string, string>;
154
- /** Request timeout in milliseconds. */
155
- timeout?: number;
156
- /** Override multipart filename. */
157
- fileName?: string;
158
- /** Override file MIME type. */
159
- mimeType?: string;
160
- /** Optional abort signal. */
161
- signal?: AbortSignal;
162
- }
163
-
164
- export interface UploadProgressEvent {
165
- kind: 'progress' | 'canceled' | 'completed';
166
- uploadedBytes?: number;
167
- totalBytes?: number;
168
- progress?: number;
169
- result?: UploadResult;
170
- }
171
-
172
- export interface UploadIteratorResult {
173
- done: boolean;
174
- value?: UploadProgressEvent;
175
- }
176
-
177
- export interface UploadResult {
178
- /** HTTP status code returned by the server. */
179
- statusCode: number;
180
- /** Response body decoded as UTF-8 text. */
181
- data: string;
182
- }
183
-
184
- export interface UploadTask extends PromiseLike<UploadResult>, AsyncIterable<UploadProgressEvent> {
185
- next(): Promise<UploadIteratorResult>;
186
- /** Stops iteration only. Does not cancel the underlying upload task. */
187
- return(): Promise<UploadIteratorResult>;
188
- catch<TResult = never>(
189
- onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,
190
- ): Promise<UploadResult | TResult>;
191
- finally(onfinally?: (() => void) | null): Promise<UploadResult>;
192
- cancel(): Promise<void>;
193
- wait(): Promise<UploadResult>;
194
- }
package/src/ui/index.ts DELETED
@@ -1,165 +0,0 @@
1
- /**
2
- * UI feedback, navigation, and surface control APIs.
3
- */
4
-
5
- export interface ShowToastOptions {
6
- title: string;
7
- icon?: 'success' | 'error' | 'loading' | 'none';
8
- image?: string;
9
- duration?: number;
10
- mask?: boolean;
11
- position?: 'top' | 'center' | 'bottom';
12
- }
13
-
14
- export interface ShowModalOptions {
15
- title?: string;
16
- content?: string;
17
- showCancel?: boolean;
18
- cancelText?: string;
19
- cancelColor?: string;
20
- confirmText?: string;
21
- confirmColor?: string;
22
- }
23
-
24
- export interface ModalResult {
25
- confirm: boolean;
26
- cancel: boolean;
27
- }
28
-
29
- export interface ShowActionSheetOptions {
30
- itemList: string[];
31
- itemColor?: string;
32
- }
33
-
34
- export interface ActionSheetResult {
35
- tapIndex: number;
36
- }
37
-
38
- export type PageQueryValue = string | number | boolean | null | undefined;
39
- export type PageQuery = Record<string, PageQueryValue>;
40
-
41
- /**
42
- * Target page for `navigateTo` / `redirectTo` / `switchTab` / `reLaunch`.
43
- *
44
- * Pass **exactly one** of `page` or `path` — there is **no `url` field**:
45
- * - `page` — a configured page **name** from `lingxia.yaml` / `lxapp.json`
46
- * (e.g. `"pullToRefresh"`), resolved to its route by the page registry.
47
- * - `path` — the full page **route**, e.g. `"/pages/pulltorefresh/index"`.
48
- *
49
- * Both are discoverable with `lxdev lxapp pages`, which lists every page's
50
- * `name` and `path`; `lxdev lxapp nav to|relaunch|redirect|switch-tab <name>`
51
- * drives navigation by name when automating.
52
- */
53
- export type PageTargetOptions =
54
- | {
55
- /**
56
- * Configured page **name** from `lingxia.yaml` / `lxapp.json`
57
- * (e.g. `"pullToRefresh"`). Mutually exclusive with `path`.
58
- */
59
- page: string;
60
- path?: never;
61
- query?: PageQuery;
62
- }
63
- | {
64
- /**
65
- * Full page **route**, e.g. `"/pages/pulltorefresh/index"`.
66
- * Mutually exclusive with `page`.
67
- */
68
- path: string;
69
- page?: never;
70
- query?: PageQuery;
71
- };
72
-
73
- export type NavigateToOptions = PageTargetOptions;
74
-
75
- export interface NavigateBackOptions {
76
- delta: number;
77
- }
78
-
79
- export type RedirectToOptions = PageTargetOptions;
80
-
81
- export type SwitchTabOptions = PageTargetOptions;
82
-
83
- export type ReLaunchOptions = PageTargetOptions;
84
-
85
- export interface SetNavigationBarTitleOptions {
86
- title: string;
87
- }
88
-
89
- export interface SetNavigationBarColorOptions {
90
- frontColor: string;
91
- backgroundColor: string;
92
- }
93
-
94
- export interface TabBarRedDotOptions {
95
- index: number;
96
- }
97
-
98
- export interface SetTabBarBadgeOptions {
99
- index: number;
100
- text: string;
101
- }
102
-
103
- export interface RemoveTabBarBadgeOptions {
104
- index: number;
105
- }
106
-
107
- export interface SetTabBarStyleOptions {
108
- color?: string;
109
- selectedColor?: string;
110
- backgroundColor?: string;
111
- borderStyle?: string;
112
- }
113
-
114
- export interface SetTabBarItemOptions {
115
- index: number;
116
- text?: string;
117
- iconPath?: string;
118
- selectedIconPath?: string;
119
- }
120
-
121
- // ── Adaptive Surface Layout ─────────────────────────────────────────────────
122
- // The form is expressed by the `as` field on `lx.openSurface({ page, as })`; the
123
- // Host arbitrates the realized platform form (split pane on larger screens,
124
- // full-screen drill-in on compact screens).
125
-
126
- /**
127
- * Size hint for an overlay surface (aside / float).
128
- *
129
- * - number: absolute px, must be > 0
130
- * - `${number}%`: percentage of the container, 0 < N ≤ 100
131
- */
132
- export type OverlaySurfaceSizeValue = number | `${number}%`;
133
-
134
- export interface OverlaySurfaceSize {
135
- /** Width hint. */
136
- width?: OverlaySurfaceSizeValue;
137
- /** Height hint. */
138
- height?: OverlaySurfaceSizeValue;
139
- }
140
-
141
- /** Edge an aside docks to; the Host decides the realized form by screen size. */
142
- export type SurfaceEdge = 'left' | 'right' | 'top' | 'bottom';
143
-
144
- /** Where a float popup anchors (default `center`). */
145
- export type SurfaceFloatPosition = 'center' | 'top' | 'bottom' | 'left' | 'right';
146
-
147
- /**
148
- * The window's adaptive context, delivered to `lx.onSurfaceContext()` so an
149
- * lxapp can self-adapt (e.g. switch column count by `sizeClass`).
150
- */
151
- export interface SurfaceContext {
152
- /** compact (<600) / medium (600–840) / expanded (>840), with hysteresis. */
153
- sizeClass: 'compact' | 'medium' | 'expanded';
154
- /** In compact, the bottom region belongs to the app content. */
155
- bottomOwner: 'app';
156
- }
157
-
158
- export interface CapsuleRect {
159
- width?: number;
160
- height?: number;
161
- top?: number;
162
- right?: number;
163
- bottom?: number;
164
- left?: number;
165
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Runtime update APIs.
3
- */
4
-
5
- export interface UpdateManager {
6
- applyUpdate(): void;
7
- onUpdateReady(callback: (info: UpdateReadyInfo) => void): void;
8
- onUpdateFailed(callback: (info: UpdateFailedInfo) => void): void;
9
- }
10
-
11
- export interface UpdateReadyInfo {
12
- version?: string;
13
- isForceUpdate?: boolean;
14
- channel?: "release" | "preview" | "developer" | string;
15
- }
16
-
17
- export interface UpdateFailedInfo extends UpdateReadyInfo {
18
- error?: string;
19
- }