@lingxia/types 0.3.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/index.d.ts +7 -0
- package/dist/app/index.d.ts.map +1 -1
- package/dist/display/index.d.ts +3 -5
- package/dist/display/index.d.ts.map +1 -1
- package/dist/error.d.ts +15 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +85 -0
- package/dist/error.js.map +1 -0
- package/dist/file/index.d.ts +102 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/{document → file}/index.js +1 -1
- package/dist/{document → file}/index.js.map +1 -1
- package/dist/generated/error.d.ts +165 -0
- package/dist/generated/error.d.ts.map +1 -0
- package/dist/generated/error.js +46 -0
- package/dist/generated/error.js.map +1 -0
- package/dist/generated/i18n.d.ts +3 -0
- package/dist/generated/i18n.d.ts.map +1 -0
- package/dist/generated/i18n.js +124 -0
- package/dist/generated/i18n.js.map +1 -0
- package/dist/index.d.ts +30 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/media/index.d.ts +100 -3
- package/dist/media/index.d.ts.map +1 -1
- package/dist/system/index.d.ts +2 -1
- package/dist/system/index.d.ts.map +1 -1
- package/dist/update/index.d.ts +10 -2
- package/dist/update/index.d.ts.map +1 -1
- package/package.json +13 -7
- package/src/app/index.ts +9 -0
- package/src/display/index.ts +3 -5
- package/src/error.ts +82 -0
- package/src/file/index.ts +121 -0
- package/src/generated/error.ts +52 -0
- package/src/generated/i18n.ts +123 -0
- package/src/index.ts +40 -7
- package/src/media/index.ts +110 -3
- package/src/system/index.ts +2 -1
- package/src/update/index.ts +12 -2
- package/dist/document/index.d.ts +0 -10
- package/dist/document/index.d.ts.map +0 -1
- package/src/document/index.ts +0 -10
package/dist/index.d.ts
CHANGED
|
@@ -8,24 +8,27 @@ export * from './device';
|
|
|
8
8
|
export * from './display';
|
|
9
9
|
export * from './input';
|
|
10
10
|
export * from './storage';
|
|
11
|
-
export * from './
|
|
11
|
+
export * from './file';
|
|
12
12
|
export * from './location';
|
|
13
13
|
export * from './navigator';
|
|
14
14
|
export * from './system';
|
|
15
15
|
export * from './update';
|
|
16
16
|
export * from './media';
|
|
17
17
|
export * from './ui';
|
|
18
|
-
|
|
18
|
+
export * from './error';
|
|
19
|
+
export * from './generated/error';
|
|
20
|
+
export * from './generated/i18n';
|
|
21
|
+
import type { AppConfig, AppInstance, LxAppInfo, PageConfig, PageInstance } from './app';
|
|
19
22
|
import type { DeviceInfo, ScreenInfo, MakePhoneCallOptions, WifiInfo, ConnectWifiOptions, WifiConnectedCallback, NetworkInfo, NetworkChangeCallback } from './device';
|
|
20
23
|
import type { KeyEventCallback } from './input';
|
|
21
24
|
import type { LxEnv, Storage } from './storage';
|
|
22
|
-
import type { OpenDocumentOptions } from './
|
|
23
|
-
import type {
|
|
25
|
+
import type { OpenDocumentOptions, ChooseDirectoryOptions, ChooseDirectoryResult, ChooseFileOptions, ChooseFileResult, DownloadTask, DownloadOptions } from './file';
|
|
26
|
+
import type { DeviceOrientation, DeviceOrientationChangeEvent } from './display';
|
|
24
27
|
import type { GetLocationOptions, LocationInfo } from './location';
|
|
25
28
|
import type { AppBaseInfo, SystemSettingInfo, OpenURLOptions } from './system';
|
|
26
29
|
import type { NavigateToLxAppOptions } from './navigator';
|
|
27
30
|
import type { UpdateManager } from './update';
|
|
28
|
-
import type { GetImageInfoOptions, ImageInfo, CompressImageOptions, CompressImageResult, CompressVideoOptions, CompressVideoResult, GetVideoInfoOptions, VideoInfo, ExtractVideoThumbnailOptions, ExtractVideoThumbnailResult, ChooseMediaOptions, ChosenMediaEntry, PreviewMediaOptions, SaveMediaOptions, ScanCodeOptions, ScanCodeResult, VideoContext } from './media';
|
|
31
|
+
import type { GetImageInfoOptions, ImageInfo, CompressImageOptions, CompressImageResult, CompressVideoOptions, CompressVideoResult, GetVideoInfoOptions, VideoInfo, ExtractVideoThumbnailOptions, ExtractVideoThumbnailResult, ChooseMediaOptions, ChosenMediaEntry, PreviewMediaOptions, PreviewMediaResult, SaveMediaOptions, ScanCodeOptions, ScanCodeResult, VideoContext } from './media';
|
|
29
32
|
import type { ShowToastOptions, ShowModalOptions, ModalResult, ShowActionSheetOptions, ActionSheetResult, NavigateToOptions, NavigateToResult, NavigateBackOptions, RedirectToOptions, SwitchTabOptions, ReLaunchOptions, SetNavigationBarTitleOptions, SetNavigationBarColorOptions, TabBarRedDotOptions, SetTabBarBadgeOptions, RemoveTabBarBadgeOptions, SetTabBarStyleOptions, SetTabBarItemOptions, ShowPopupOptions, ShowPopupResult, CapsuleRect } from './ui';
|
|
30
33
|
export interface Lx {
|
|
31
34
|
env: LxEnv;
|
|
@@ -44,14 +47,17 @@ export interface Lx {
|
|
|
44
47
|
getNetworkInfo(): Promise<NetworkInfo>;
|
|
45
48
|
onNetworkChange(callback: NetworkChangeCallback): void;
|
|
46
49
|
offNetworkChange(callback?: NetworkChangeCallback): void;
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
setDeviceOrientation(orientation: DeviceOrientation): boolean;
|
|
51
|
+
onDeviceOrientationChange(callback: (event: DeviceOrientationChangeEvent) => void): void;
|
|
52
|
+
offDeviceOrientationChange(callback?: (event: DeviceOrientationChangeEvent) => void): void;
|
|
49
53
|
openDocument(options: OpenDocumentOptions): void;
|
|
54
|
+
downloadFile(options: DownloadOptions): DownloadTask;
|
|
50
55
|
getStorage(): Storage;
|
|
51
56
|
getLocation(options?: GetLocationOptions): Promise<LocationInfo>;
|
|
52
57
|
navigateToLxApp(options: NavigateToLxAppOptions): Promise<void>;
|
|
53
58
|
navigateBackLxApp(): Promise<void>;
|
|
54
59
|
getAppBaseInfo(): AppBaseInfo;
|
|
60
|
+
getLxAppInfo(): LxAppInfo;
|
|
55
61
|
getSystemSetting(): SystemSettingInfo;
|
|
56
62
|
openURL(options: OpenURLOptions): void;
|
|
57
63
|
getUpdateManager(): UpdateManager;
|
|
@@ -61,7 +67,19 @@ export interface Lx {
|
|
|
61
67
|
getVideoInfo(options: GetVideoInfoOptions): Promise<VideoInfo>;
|
|
62
68
|
extractVideoThumbnail(options: ExtractVideoThumbnailOptions): Promise<ExtractVideoThumbnailResult>;
|
|
63
69
|
chooseMedia(options?: ChooseMediaOptions): Promise<ChosenMediaEntry[]>;
|
|
64
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Opens native media preview.
|
|
72
|
+
*
|
|
73
|
+
* Supports:
|
|
74
|
+
* - a single source path string for the simplest case
|
|
75
|
+
* - a single-item object for per-item options like `rotate`, `objectFit`, or `durationMs`
|
|
76
|
+
* - a sequence object for multi-item preview with `sources`, `startIndex`, and `advance`
|
|
77
|
+
*
|
|
78
|
+
* Resolves when preview session is closed (manual/auto/interrupted/error).
|
|
79
|
+
* Rejects with a cancellation error if `signal` is aborted, and abort also requests
|
|
80
|
+
* the active native preview session to close immediately.
|
|
81
|
+
*/
|
|
82
|
+
previewMedia(options: PreviewMediaOptions): Promise<PreviewMediaResult>;
|
|
65
83
|
saveImageToPhotosAlbum(options: SaveMediaOptions): Promise<void>;
|
|
66
84
|
saveVideoToPhotosAlbum(options: SaveMediaOptions): Promise<void>;
|
|
67
85
|
scanCode(options?: ScanCodeOptions): Promise<ScanCodeResult>;
|
|
@@ -91,6 +109,10 @@ export interface Lx {
|
|
|
91
109
|
startPullDownRefresh(): void;
|
|
92
110
|
stopPullDownRefresh(): void;
|
|
93
111
|
getCapsuleRect(): Promise<CapsuleRect>;
|
|
112
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
113
|
+
chooseFile(options?: ChooseFileOptions): Promise<ChooseFileResult>;
|
|
114
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
115
|
+
chooseDirectory(options?: ChooseDirectoryOptions): Promise<ChooseDirectoryResult>;
|
|
94
116
|
onKeyDown(callback: KeyEventCallback): void;
|
|
95
117
|
offKeyDown(callback?: KeyEventCallback): void;
|
|
96
118
|
onKeyUp(callback: KeyEventCallback): void;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,YAAY,EACb,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EACV,KAAK,EACL,OAAO,EACR,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAChB,MAAM,QAAQ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,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElF,SAAS,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC5C,UAAU,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC9C,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC7C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,EAAE,EAAE,EAAE,CAAC;IAEb,SAAS,GAAG,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC;IAC7C,SAAS,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,KAAK,CAAC,GAAG,IAAI,CAAC;IACjE,SAAS,IAAI,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3E,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,GAC5E,IAAI,CAAC;IACR,SAAS,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,KAAK,CAAC,EAAE,CAAC;CACxE;AAED,OAAO,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -24,11 +24,14 @@ __exportStar(require("./device"), exports);
|
|
|
24
24
|
__exportStar(require("./display"), exports);
|
|
25
25
|
__exportStar(require("./input"), exports);
|
|
26
26
|
__exportStar(require("./storage"), exports);
|
|
27
|
-
__exportStar(require("./
|
|
27
|
+
__exportStar(require("./file"), exports);
|
|
28
28
|
__exportStar(require("./location"), exports);
|
|
29
29
|
__exportStar(require("./navigator"), exports);
|
|
30
30
|
__exportStar(require("./system"), exports);
|
|
31
31
|
__exportStar(require("./update"), exports);
|
|
32
32
|
__exportStar(require("./media"), exports);
|
|
33
33
|
__exportStar(require("./ui"), exports);
|
|
34
|
+
__exportStar(require("./error"), exports);
|
|
35
|
+
__exportStar(require("./generated/error"), exports);
|
|
36
|
+
__exportStar(require("./generated/i18n"), exports);
|
|
34
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;AAEH,wCAAsB;AACtB,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,4CAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;AAEH,wCAAsB;AACtB,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,4CAA0B;AAC1B,yCAAuB;AACvB,6CAA2B;AAC3B,8CAA4B;AAC5B,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,uCAAqB;AACrB,0CAAwB;AACxB,oDAAkC;AAClC,mDAAiC"}
|
package/dist/media/index.d.ts
CHANGED
|
@@ -165,13 +165,110 @@ export interface ChosenMediaEntry {
|
|
|
165
165
|
fileType: 'image' | 'video';
|
|
166
166
|
isOriginal: boolean;
|
|
167
167
|
}
|
|
168
|
-
export
|
|
168
|
+
export type MediaRotation = 0 | 90 | 180 | 270;
|
|
169
|
+
export type MediaObjectFit = 'cover' | 'contain' | 'fill' | 'fit';
|
|
170
|
+
export interface PreviewMediaSource {
|
|
171
|
+
/**
|
|
172
|
+
* Media source path.
|
|
173
|
+
* Recommended: `lx://` path (for example `lx://usercache/...`) or a sandbox-local path
|
|
174
|
+
* that can be resolved by runtime access rules.
|
|
175
|
+
*/
|
|
169
176
|
path: string;
|
|
170
177
|
type?: 'image' | 'video';
|
|
178
|
+
/**
|
|
179
|
+
* Optional poster image path for video preview.
|
|
180
|
+
* Uses the same path contract as `path`.
|
|
181
|
+
*/
|
|
171
182
|
coverPath?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Optional clockwise rotation in degrees (`0 | 90 | 180 | 270`).
|
|
185
|
+
* Default: when omitted, runtime resolves orientation from media metadata.
|
|
186
|
+
*/
|
|
187
|
+
rotate?: MediaRotation;
|
|
188
|
+
/**
|
|
189
|
+
* Optional display fit mode for video preview.
|
|
190
|
+
* Default: `contain`.
|
|
191
|
+
*/
|
|
192
|
+
objectFit?: MediaObjectFit;
|
|
193
|
+
/**
|
|
194
|
+
* Image display duration in milliseconds.
|
|
195
|
+
* Effective only for image items and only when preview `advance` is not `manual`.
|
|
196
|
+
*/
|
|
197
|
+
durationMs?: number;
|
|
198
|
+
}
|
|
199
|
+
export type PreviewMediaAdvance = 'manual' | 'next' | 'loop';
|
|
200
|
+
export interface PreviewMediaSingleOptions extends PreviewMediaSource {
|
|
201
|
+
/**
|
|
202
|
+
* Auto behavior for the preview session.
|
|
203
|
+
*
|
|
204
|
+
* - `manual`: never auto-advance
|
|
205
|
+
* - `next`: advance to the next item; if already on the last item, close the session
|
|
206
|
+
* - `loop`: advance to the next item; if already on the last item, wrap to the first item
|
|
207
|
+
*
|
|
208
|
+
* Default: `manual`
|
|
209
|
+
*/
|
|
210
|
+
advance?: PreviewMediaAdvance;
|
|
211
|
+
/**
|
|
212
|
+
* Optional cancellation signal for the preview request.
|
|
213
|
+
*
|
|
214
|
+
* Aborting rejects the returned promise with a cancellation error and requests the active
|
|
215
|
+
* native preview session to close immediately.
|
|
216
|
+
*/
|
|
217
|
+
signal?: AbortSignal;
|
|
218
|
+
/**
|
|
219
|
+
* Whether to show the top `current/total` indicator.
|
|
220
|
+
*
|
|
221
|
+
* Default: `true` when previewing multiple items, otherwise `false`.
|
|
222
|
+
*/
|
|
223
|
+
showIndexIndicator?: boolean;
|
|
224
|
+
}
|
|
225
|
+
export interface PreviewMediaSequenceOptions {
|
|
226
|
+
/**
|
|
227
|
+
* Preview list. Supports images, videos, or a mixed queue.
|
|
228
|
+
*/
|
|
229
|
+
sources: PreviewMediaSource[];
|
|
230
|
+
/**
|
|
231
|
+
* Initial item index in `sources`.
|
|
232
|
+
* Must be an integer.
|
|
233
|
+
* Out-of-range values are clamped by runtime.
|
|
234
|
+
* Default: `0`.
|
|
235
|
+
*/
|
|
236
|
+
startIndex?: number;
|
|
237
|
+
/**
|
|
238
|
+
* Auto behavior for the preview session.
|
|
239
|
+
*
|
|
240
|
+
* - `manual`: never auto-advance
|
|
241
|
+
* - `next`: advance to the next item; if already on the last item, close the session
|
|
242
|
+
* - `loop`: advance to the next item; if already on the last item, wrap to the first item
|
|
243
|
+
*
|
|
244
|
+
* Default: `manual`
|
|
245
|
+
*/
|
|
246
|
+
advance?: PreviewMediaAdvance;
|
|
247
|
+
/**
|
|
248
|
+
* Optional cancellation signal for the preview request.
|
|
249
|
+
*
|
|
250
|
+
* Aborting rejects the returned promise with a cancellation error and requests the active
|
|
251
|
+
* native preview session to close immediately.
|
|
252
|
+
*/
|
|
253
|
+
signal?: AbortSignal;
|
|
254
|
+
/**
|
|
255
|
+
* Whether to show the top `current/total` indicator.
|
|
256
|
+
*
|
|
257
|
+
* Default: `true` when previewing multiple items, otherwise `false`.
|
|
258
|
+
*/
|
|
259
|
+
showIndexIndicator?: boolean;
|
|
172
260
|
}
|
|
173
|
-
export
|
|
174
|
-
|
|
261
|
+
export type PreviewMediaOptions = string | PreviewMediaSingleOptions | PreviewMediaSequenceOptions;
|
|
262
|
+
export type PreviewMediaCloseReason = 'manual' | 'completed' | 'interrupted' | 'error';
|
|
263
|
+
export interface PreviewMediaResult {
|
|
264
|
+
/**
|
|
265
|
+
* Why the preview session finished.
|
|
266
|
+
*/
|
|
267
|
+
reason: PreviewMediaCloseReason;
|
|
268
|
+
/**
|
|
269
|
+
* Last active item index before close.
|
|
270
|
+
*/
|
|
271
|
+
lastIndex: number;
|
|
175
272
|
}
|
|
176
273
|
export interface SaveMediaOptions {
|
|
177
274
|
filePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/media/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MA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6
|
language: string;
|
|
7
7
|
productName: string;
|
|
8
8
|
version: string;
|
|
9
|
+
SDKVersion: string;
|
|
9
10
|
}
|
|
10
11
|
export interface SystemSettingInfo {
|
|
11
12
|
bluetoothEnabled: boolean;
|
|
@@ -14,6 +15,6 @@ export interface SystemSettingInfo {
|
|
|
14
15
|
}
|
|
15
16
|
export interface OpenURLOptions {
|
|
16
17
|
url: string;
|
|
17
|
-
|
|
18
|
+
target?: 'self' | 'external';
|
|
18
19
|
}
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAC9B"}
|
package/dist/update/index.d.ts
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export interface UpdateManager {
|
|
6
6
|
applyUpdate(): void;
|
|
7
|
-
onUpdateReady(callback: () => void): void;
|
|
8
|
-
onUpdateFailed(callback: () => void): void;
|
|
7
|
+
onUpdateReady(callback: (info: UpdateReadyInfo) => void): void;
|
|
8
|
+
onUpdateFailed(callback: (info: UpdateFailedInfo) => void): void;
|
|
9
|
+
}
|
|
10
|
+
export interface UpdateReadyInfo {
|
|
11
|
+
version?: string;
|
|
12
|
+
isForceUpdate?: boolean;
|
|
13
|
+
releaseType?: "release" | "preview" | "developer" | string;
|
|
14
|
+
}
|
|
15
|
+
export interface UpdateFailedInfo extends UpdateReadyInfo {
|
|
16
|
+
error?: string;
|
|
9
17
|
}
|
|
10
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,WAAW,IAAI,IAAI,CAAC;IACpB,aAAa,CAAC,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;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,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;CAC5D;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxia/types",
|
|
3
|
-
"version": "0.3
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "TypeScript type definitions for the LingXia JS API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/LingXia-Dev/LingXia.git",
|
|
8
|
-
"directory": "lingxia-types"
|
|
8
|
+
"directory": "packages/lingxia-types"
|
|
9
9
|
},
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"module": "dist/index.js",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"import": "./dist/storage/index.js",
|
|
42
42
|
"require": "./dist/storage/index.js"
|
|
43
43
|
},
|
|
44
|
-
"./
|
|
45
|
-
"types": "./dist/
|
|
46
|
-
"import": "./dist/
|
|
47
|
-
"require": "./dist/
|
|
44
|
+
"./file": {
|
|
45
|
+
"types": "./dist/file/index.d.ts",
|
|
46
|
+
"import": "./dist/file/index.js",
|
|
47
|
+
"require": "./dist/file/index.js"
|
|
48
48
|
},
|
|
49
49
|
"./location": {
|
|
50
50
|
"types": "./dist/location/index.d.ts",
|
|
@@ -75,6 +75,11 @@
|
|
|
75
75
|
"types": "./dist/ui/index.d.ts",
|
|
76
76
|
"import": "./dist/ui/index.js",
|
|
77
77
|
"require": "./dist/ui/index.js"
|
|
78
|
+
},
|
|
79
|
+
"./error": {
|
|
80
|
+
"types": "./dist/error.d.ts",
|
|
81
|
+
"import": "./dist/error.js",
|
|
82
|
+
"require": "./dist/error.js"
|
|
78
83
|
}
|
|
79
84
|
},
|
|
80
85
|
"files": [
|
|
@@ -82,7 +87,8 @@
|
|
|
82
87
|
"src"
|
|
83
88
|
],
|
|
84
89
|
"scripts": {
|
|
85
|
-
"
|
|
90
|
+
"gen:i18n": "node scripts/gen-i18n.mjs",
|
|
91
|
+
"build": "npm run gen:i18n && tsc",
|
|
86
92
|
"clean": "rm -rf dist",
|
|
87
93
|
"prepublishOnly": "npm run clean && npm run build"
|
|
88
94
|
},
|
package/src/app/index.ts
CHANGED
|
@@ -15,6 +15,15 @@ export interface AppLifecycleEventArgs {
|
|
|
15
15
|
| 'switch_away';
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export type LxAppReleaseType = 'release' | 'preview' | 'developer';
|
|
19
|
+
|
|
20
|
+
export interface LxAppInfo {
|
|
21
|
+
appId: string;
|
|
22
|
+
appName: string;
|
|
23
|
+
version: string;
|
|
24
|
+
releaseType: LxAppReleaseType;
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
export interface AppLaunchOptions {
|
|
19
28
|
path?: string;
|
|
20
29
|
query?: Record<string, string>;
|
package/src/display/index.ts
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* Corresponds to: lingxia-logic/src/display.rs
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
orientation: string;
|
|
8
|
-
}
|
|
6
|
+
export type DeviceOrientation = "portrait" | "landscape";
|
|
9
7
|
|
|
10
|
-
export interface
|
|
11
|
-
|
|
8
|
+
export interface DeviceOrientationChangeEvent {
|
|
9
|
+
value: DeviceOrientation;
|
|
12
10
|
}
|
package/src/error.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ERR_CODE_INFO_BY_CODE, type LxErrorCodeInfo } from "./generated/error";
|
|
2
|
+
|
|
3
|
+
const ERR_CODE_INDEX = ERR_CODE_INFO_BY_CODE as Record<number, LxErrorCodeInfo>;
|
|
4
|
+
|
|
5
|
+
export interface LxApiError {
|
|
6
|
+
readonly code: number;
|
|
7
|
+
readonly key: LxErrorCodeInfo["key"];
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly raw: unknown;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function isLxApiError(error: unknown): error is LxApiError {
|
|
13
|
+
return parseLxApiError(error) !== null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function readMessage(error: unknown): string {
|
|
17
|
+
if (typeof error === "string") return error;
|
|
18
|
+
if (error instanceof Error && typeof error.message === "string") return error.message;
|
|
19
|
+
if (typeof error === "object" && error !== null) {
|
|
20
|
+
const value = (error as { message?: unknown }).message;
|
|
21
|
+
if (typeof value === "string") return value;
|
|
22
|
+
}
|
|
23
|
+
return "Unknown LingXia error";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function toRecord(value: unknown): Record<string, unknown> | null {
|
|
27
|
+
if (typeof value !== "object" || value === null) return null;
|
|
28
|
+
return value as Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function parseIntegerCode(value: unknown): number | null {
|
|
32
|
+
if (typeof value === "number" && Number.isInteger(value)) return value;
|
|
33
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
34
|
+
const parsed = Number(value);
|
|
35
|
+
if (Number.isInteger(parsed)) return parsed;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function extractLxErrorCode(error: unknown): number | null {
|
|
41
|
+
const root = toRecord(error);
|
|
42
|
+
if (!root) return null;
|
|
43
|
+
|
|
44
|
+
const rootCode = parseIntegerCode(root.code);
|
|
45
|
+
if (rootCode !== null) return rootCode;
|
|
46
|
+
|
|
47
|
+
const data = toRecord(root.data);
|
|
48
|
+
if (!data) return null;
|
|
49
|
+
|
|
50
|
+
return parseIntegerCode(data.bizCode) ?? parseIntegerCode(data.code);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function isKnownLxErrorCode(code: number): boolean {
|
|
54
|
+
return Number.isInteger(code) && Object.prototype.hasOwnProperty.call(ERR_CODE_INDEX, code);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function infoForLxErrorCode(code: number): LxErrorCodeInfo | null {
|
|
58
|
+
if (!isKnownLxErrorCode(code)) return null;
|
|
59
|
+
return ERR_CODE_INDEX[code];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function parseLxApiError(error: unknown): LxApiError | null {
|
|
63
|
+
const code = extractLxErrorCode(error);
|
|
64
|
+
if (code === null) return null;
|
|
65
|
+
const info = infoForLxErrorCode(code);
|
|
66
|
+
if (!info) return null;
|
|
67
|
+
return {
|
|
68
|
+
...info,
|
|
69
|
+
message: readMessage(error),
|
|
70
|
+
raw: error,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function requireLxApiError(error: unknown): LxApiError {
|
|
75
|
+
const parsed = parseLxApiError(error);
|
|
76
|
+
if (parsed) return parsed;
|
|
77
|
+
throw new Error(`Unknown LingXia API error: ${readMessage(error)}`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function formatLxApiError(error: LxApiError): string {
|
|
81
|
+
return `[${error.code}] ${error.message}`;
|
|
82
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File system APIs.
|
|
3
|
+
* Corresponds to: lingxia-logic/src/fs.rs
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface OpenDocumentOptions {
|
|
7
|
+
filePath: string;
|
|
8
|
+
fileType?: string;
|
|
9
|
+
showMenu?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
13
|
+
export interface FileDialogFilter {
|
|
14
|
+
/** Optional label shown in the native dialog. */
|
|
15
|
+
name?: string;
|
|
16
|
+
/** Allowed extensions without dots, e.g. ['pdf', 'txt']. */
|
|
17
|
+
extensions: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
21
|
+
export interface ChooseFileOptions {
|
|
22
|
+
/** Allow selecting multiple files. Default: false */
|
|
23
|
+
multiple?: boolean;
|
|
24
|
+
/** Optional file filters. Empty or omitted means all file types. */
|
|
25
|
+
filters?: FileDialogFilter[];
|
|
26
|
+
/** Dialog window title. Platform provides a default if omitted. */
|
|
27
|
+
title?: string;
|
|
28
|
+
/** Initial directory the dialog opens in. Platform default if omitted. */
|
|
29
|
+
defaultPath?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
33
|
+
export interface ChooseFileResult {
|
|
34
|
+
/** True if the user dismissed the dialog without selecting. */
|
|
35
|
+
canceled: boolean;
|
|
36
|
+
/** Absolute system paths of selected files. Empty when canceled. */
|
|
37
|
+
paths: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
41
|
+
export interface ChooseDirectoryOptions {
|
|
42
|
+
/** Dialog window title. Platform provides a default if omitted. */
|
|
43
|
+
title?: string;
|
|
44
|
+
/** Initial directory the dialog opens in. Platform default if omitted. */
|
|
45
|
+
defaultPath?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
49
|
+
export interface ChooseDirectoryResult {
|
|
50
|
+
/** True if the user dismissed the dialog without selecting. */
|
|
51
|
+
canceled: boolean;
|
|
52
|
+
/** Absolute system path of the selected directory. Undefined when canceled. */
|
|
53
|
+
path?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface DownloadOptions {
|
|
57
|
+
/** HTTP(S) source URL. */
|
|
58
|
+
url: string;
|
|
59
|
+
/**
|
|
60
|
+
* Optional external cancellation channel.
|
|
61
|
+
* When aborted, it has the same effect as calling `task.cancel()`.
|
|
62
|
+
* Useful for timeout/router/lifecycle composition.
|
|
63
|
+
*/
|
|
64
|
+
signal?: AbortSignal;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface DownloadResult {
|
|
68
|
+
/** Downloaded file URI under user cache, e.g. lx://usercache/... */
|
|
69
|
+
tempFilePath: string;
|
|
70
|
+
/** Suggested filename resolved by runtime from headers/url. */
|
|
71
|
+
fileName: string;
|
|
72
|
+
/** MIME type when available. */
|
|
73
|
+
mimeType?: string;
|
|
74
|
+
/** File size in bytes. */
|
|
75
|
+
size: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface DownloadProgressEvent {
|
|
79
|
+
kind: 'progress';
|
|
80
|
+
downloadedBytes: number;
|
|
81
|
+
totalBytes?: number;
|
|
82
|
+
/**
|
|
83
|
+
* 0~1 progress value.
|
|
84
|
+
* - precise ratio when totalBytes is known
|
|
85
|
+
* - monotonic estimated progress when totalBytes is unknown
|
|
86
|
+
*/
|
|
87
|
+
progress: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface DownloadSuccessEvent {
|
|
91
|
+
kind: 'success';
|
|
92
|
+
result: DownloadResult;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface DownloadPausedEvent {
|
|
96
|
+
kind: 'paused';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface DownloadResumedEvent {
|
|
100
|
+
kind: 'resumed';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface DownloadCanceledEvent {
|
|
104
|
+
kind: 'canceled';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type DownloadEvent =
|
|
108
|
+
| DownloadProgressEvent
|
|
109
|
+
| DownloadSuccessEvent
|
|
110
|
+
| DownloadPausedEvent
|
|
111
|
+
| DownloadResumedEvent
|
|
112
|
+
| DownloadCanceledEvent;
|
|
113
|
+
|
|
114
|
+
export interface DownloadTask extends AsyncIterable<DownloadEvent> {
|
|
115
|
+
/** Pause current download and keep resume metadata. */
|
|
116
|
+
pause(): Promise<void>;
|
|
117
|
+
/** Resume a paused download from persisted resume metadata. */
|
|
118
|
+
resume(): Promise<void>;
|
|
119
|
+
/** Cancel and remove downloaded temp artifacts. */
|
|
120
|
+
cancel(): Promise<void>;
|
|
121
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Auto-generated by lingxia-gen. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import type { I18nKey } from "./i18n";
|
|
4
|
+
|
|
5
|
+
export const ERR_CODE_INFO_BY_CODE = {
|
|
6
|
+
1000: { code: 1000, key: "err_code_1000" },
|
|
7
|
+
1001: { code: 1001, key: "err_code_1001" },
|
|
8
|
+
1002: { code: 1002, key: "err_code_1002" },
|
|
9
|
+
1003: { code: 1003, key: "err_code_1003" },
|
|
10
|
+
1004: { code: 1004, key: "err_code_1004" },
|
|
11
|
+
1005: { code: 1005, key: "err_code_1005" },
|
|
12
|
+
2000: { code: 2000, key: "err_code_2000" },
|
|
13
|
+
2001: { code: 2001, key: "err_code_2001" },
|
|
14
|
+
3000: { code: 3000, key: "err_code_3000" },
|
|
15
|
+
3001: { code: 3001, key: "err_code_3001" },
|
|
16
|
+
3002: { code: 3002, key: "err_code_3002" },
|
|
17
|
+
3003: { code: 3003, key: "err_code_3003" },
|
|
18
|
+
3004: { code: 3004, key: "err_code_3004" },
|
|
19
|
+
3005: { code: 3005, key: "err_code_3005" },
|
|
20
|
+
3006: { code: 3006, key: "err_code_3006" },
|
|
21
|
+
3007: { code: 3007, key: "err_code_3007" },
|
|
22
|
+
4000: { code: 4000, key: "err_code_4000" },
|
|
23
|
+
4001: { code: 4001, key: "err_code_4001" },
|
|
24
|
+
4002: { code: 4002, key: "err_code_4002" },
|
|
25
|
+
4003: { code: 4003, key: "err_code_4003" },
|
|
26
|
+
5000: { code: 5000, key: "err_code_5000" },
|
|
27
|
+
5001: { code: 5001, key: "err_code_5001" },
|
|
28
|
+
5002: { code: 5002, key: "err_code_5002" },
|
|
29
|
+
5003: { code: 5003, key: "err_code_5003" },
|
|
30
|
+
5004: { code: 5004, key: "err_code_5004" },
|
|
31
|
+
6000: { code: 6000, key: "err_code_6000" },
|
|
32
|
+
6001: { code: 6001, key: "err_code_6001" },
|
|
33
|
+
6002: { code: 6002, key: "err_code_6002" },
|
|
34
|
+
12000: { code: 12000, key: "err_code_12000" },
|
|
35
|
+
12001: { code: 12001, key: "err_code_12001" },
|
|
36
|
+
12002: { code: 12002, key: "err_code_12002" },
|
|
37
|
+
12003: { code: 12003, key: "err_code_12003" },
|
|
38
|
+
12004: { code: 12004, key: "err_code_12004" },
|
|
39
|
+
12005: { code: 12005, key: "err_code_12005" },
|
|
40
|
+
12006: { code: 12006, key: "err_code_12006" },
|
|
41
|
+
12007: { code: 12007, key: "err_code_12007" },
|
|
42
|
+
12008: { code: 12008, key: "err_code_12008" },
|
|
43
|
+
12009: { code: 12009, key: "err_code_12009" },
|
|
44
|
+
12010: { code: 12010, key: "err_code_12010" },
|
|
45
|
+
} as const;
|
|
46
|
+
|
|
47
|
+
export type LxErrorCode = (typeof ERR_CODE_INFO_BY_CODE)[keyof typeof ERR_CODE_INFO_BY_CODE]["code"];
|
|
48
|
+
export interface LxErrorCodeInfo {
|
|
49
|
+
readonly code: LxErrorCode;
|
|
50
|
+
readonly key: I18nKey;
|
|
51
|
+
}
|
|
52
|
+
|