@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
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Auto-generated by lingxia-gen. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
export const I18N_KEYS = [
|
|
4
|
+
"album_add_more_media",
|
|
5
|
+
"album_add_more_photos",
|
|
6
|
+
"album_add_more_videos",
|
|
7
|
+
"album_all_media",
|
|
8
|
+
"album_all_photos",
|
|
9
|
+
"album_all_videos",
|
|
10
|
+
"album_label",
|
|
11
|
+
"album_original_image",
|
|
12
|
+
"album_selected",
|
|
13
|
+
"camera_access_denied",
|
|
14
|
+
"camera_audio_init_failed",
|
|
15
|
+
"camera_cancelling",
|
|
16
|
+
"camera_init_failed",
|
|
17
|
+
"camera_label",
|
|
18
|
+
"camera_long_press_to_record",
|
|
19
|
+
"camera_max_duration_reached",
|
|
20
|
+
"camera_preparing",
|
|
21
|
+
"camera_record_video",
|
|
22
|
+
"camera_release_to_stop",
|
|
23
|
+
"camera_switch",
|
|
24
|
+
"camera_switch_failed",
|
|
25
|
+
"camera_switch_to_back",
|
|
26
|
+
"camera_switch_to_front",
|
|
27
|
+
"camera_switching",
|
|
28
|
+
"camera_tap_to_capture",
|
|
29
|
+
"camera_tap_to_record",
|
|
30
|
+
"camera_tap_to_stop",
|
|
31
|
+
"camera_video_input_failed",
|
|
32
|
+
"camera_video_output_failed",
|
|
33
|
+
"capsule_clean_cache",
|
|
34
|
+
"capsule_restart",
|
|
35
|
+
"capsule_uninstall",
|
|
36
|
+
"common_auto",
|
|
37
|
+
"common_back",
|
|
38
|
+
"common_cancel",
|
|
39
|
+
"common_close",
|
|
40
|
+
"common_confirm",
|
|
41
|
+
"common_delete",
|
|
42
|
+
"common_done",
|
|
43
|
+
"common_edit",
|
|
44
|
+
"common_home",
|
|
45
|
+
"common_loading",
|
|
46
|
+
"common_ok",
|
|
47
|
+
"common_retry",
|
|
48
|
+
"common_save",
|
|
49
|
+
"common_settings",
|
|
50
|
+
"common_share",
|
|
51
|
+
"common_success",
|
|
52
|
+
"common_warning",
|
|
53
|
+
"date_last_30_days",
|
|
54
|
+
"date_last_7_days",
|
|
55
|
+
"date_last_month",
|
|
56
|
+
"date_last_week",
|
|
57
|
+
"date_this_month",
|
|
58
|
+
"date_this_week",
|
|
59
|
+
"document_pdf_page_preview",
|
|
60
|
+
"err_code_1000",
|
|
61
|
+
"err_code_1001",
|
|
62
|
+
"err_code_1002",
|
|
63
|
+
"err_code_1003",
|
|
64
|
+
"err_code_1004",
|
|
65
|
+
"err_code_1005",
|
|
66
|
+
"err_code_12000",
|
|
67
|
+
"err_code_12001",
|
|
68
|
+
"err_code_12002",
|
|
69
|
+
"err_code_12003",
|
|
70
|
+
"err_code_12004",
|
|
71
|
+
"err_code_12005",
|
|
72
|
+
"err_code_12006",
|
|
73
|
+
"err_code_12007",
|
|
74
|
+
"err_code_12008",
|
|
75
|
+
"err_code_12009",
|
|
76
|
+
"err_code_12010",
|
|
77
|
+
"err_code_2000",
|
|
78
|
+
"err_code_2001",
|
|
79
|
+
"err_code_3000",
|
|
80
|
+
"err_code_3001",
|
|
81
|
+
"err_code_3002",
|
|
82
|
+
"err_code_3003",
|
|
83
|
+
"err_code_3004",
|
|
84
|
+
"err_code_3005",
|
|
85
|
+
"err_code_3006",
|
|
86
|
+
"err_code_3007",
|
|
87
|
+
"err_code_4000",
|
|
88
|
+
"err_code_4001",
|
|
89
|
+
"err_code_4002",
|
|
90
|
+
"err_code_4003",
|
|
91
|
+
"err_code_5000",
|
|
92
|
+
"err_code_5001",
|
|
93
|
+
"err_code_5002",
|
|
94
|
+
"err_code_5003",
|
|
95
|
+
"err_code_5004",
|
|
96
|
+
"err_code_6000",
|
|
97
|
+
"err_code_6001",
|
|
98
|
+
"err_code_6002",
|
|
99
|
+
"error_network_error",
|
|
100
|
+
"error_save_failed",
|
|
101
|
+
"error_server_error",
|
|
102
|
+
"error_timeout",
|
|
103
|
+
"error_unauthorized",
|
|
104
|
+
"error_unknown",
|
|
105
|
+
"error_video_too_short",
|
|
106
|
+
"permission_limited_access_add_more_media",
|
|
107
|
+
"permission_limited_access_add_more_photos",
|
|
108
|
+
"permission_limited_access_add_more_videos",
|
|
109
|
+
"permission_limited_access_warning",
|
|
110
|
+
"permission_location_reason",
|
|
111
|
+
"permission_media_reason",
|
|
112
|
+
"permission_network_reason",
|
|
113
|
+
"permission_wifi_reason",
|
|
114
|
+
"update_confirm",
|
|
115
|
+
"update_download_failed",
|
|
116
|
+
"update_downloading",
|
|
117
|
+
"update_message",
|
|
118
|
+
"update_title",
|
|
119
|
+
"video_quality",
|
|
120
|
+
"video_speed",
|
|
121
|
+
] as const;
|
|
122
|
+
|
|
123
|
+
export type I18nKey = (typeof I18N_KEYS)[number];
|
package/src/index.ts
CHANGED
|
@@ -9,17 +9,21 @@ export * from './device';
|
|
|
9
9
|
export * from './display';
|
|
10
10
|
export * from './input';
|
|
11
11
|
export * from './storage';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './file';
|
|
13
13
|
export * from './location';
|
|
14
14
|
export * from './navigator';
|
|
15
15
|
export * from './system';
|
|
16
16
|
export * from './update';
|
|
17
17
|
export * from './media';
|
|
18
18
|
export * from './ui';
|
|
19
|
+
export * from './error';
|
|
20
|
+
export * from './generated/error';
|
|
21
|
+
export * from './generated/i18n';
|
|
19
22
|
|
|
20
23
|
import type {
|
|
21
24
|
AppConfig,
|
|
22
25
|
AppInstance,
|
|
26
|
+
LxAppInfo,
|
|
23
27
|
PageConfig,
|
|
24
28
|
PageInstance,
|
|
25
29
|
} from './app';
|
|
@@ -42,11 +46,19 @@ import type {
|
|
|
42
46
|
Storage,
|
|
43
47
|
} from './storage';
|
|
44
48
|
|
|
45
|
-
import type {
|
|
49
|
+
import type {
|
|
50
|
+
OpenDocumentOptions,
|
|
51
|
+
ChooseDirectoryOptions,
|
|
52
|
+
ChooseDirectoryResult,
|
|
53
|
+
ChooseFileOptions,
|
|
54
|
+
ChooseFileResult,
|
|
55
|
+
DownloadTask,
|
|
56
|
+
DownloadOptions,
|
|
57
|
+
} from './file';
|
|
46
58
|
|
|
47
59
|
import type {
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
DeviceOrientation,
|
|
61
|
+
DeviceOrientationChangeEvent,
|
|
50
62
|
} from './display';
|
|
51
63
|
|
|
52
64
|
import type {
|
|
@@ -78,6 +90,7 @@ import type {
|
|
|
78
90
|
ChooseMediaOptions,
|
|
79
91
|
ChosenMediaEntry,
|
|
80
92
|
PreviewMediaOptions,
|
|
93
|
+
PreviewMediaResult,
|
|
81
94
|
SaveMediaOptions,
|
|
82
95
|
ScanCodeOptions,
|
|
83
96
|
ScanCodeResult,
|
|
@@ -128,10 +141,12 @@ export interface Lx {
|
|
|
128
141
|
onNetworkChange(callback: NetworkChangeCallback): void;
|
|
129
142
|
offNetworkChange(callback?: NetworkChangeCallback): void;
|
|
130
143
|
|
|
131
|
-
|
|
132
|
-
|
|
144
|
+
setDeviceOrientation(orientation: DeviceOrientation): boolean;
|
|
145
|
+
onDeviceOrientationChange(callback: (event: DeviceOrientationChangeEvent) => void): void;
|
|
146
|
+
offDeviceOrientationChange(callback?: (event: DeviceOrientationChangeEvent) => void): void;
|
|
133
147
|
|
|
134
148
|
openDocument(options: OpenDocumentOptions): void;
|
|
149
|
+
downloadFile(options: DownloadOptions): DownloadTask;
|
|
135
150
|
|
|
136
151
|
getStorage(): Storage;
|
|
137
152
|
|
|
@@ -141,6 +156,7 @@ export interface Lx {
|
|
|
141
156
|
navigateBackLxApp(): Promise<void>;
|
|
142
157
|
|
|
143
158
|
getAppBaseInfo(): AppBaseInfo;
|
|
159
|
+
getLxAppInfo(): LxAppInfo;
|
|
144
160
|
getSystemSetting(): SystemSettingInfo;
|
|
145
161
|
openURL(options: OpenURLOptions): void;
|
|
146
162
|
|
|
@@ -154,7 +170,19 @@ export interface Lx {
|
|
|
154
170
|
|
|
155
171
|
chooseMedia(options?: ChooseMediaOptions): Promise<ChosenMediaEntry[]>;
|
|
156
172
|
|
|
157
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Opens native media preview.
|
|
175
|
+
*
|
|
176
|
+
* Supports:
|
|
177
|
+
* - a single source path string for the simplest case
|
|
178
|
+
* - a single-item object for per-item options like `rotate`, `objectFit`, or `durationMs`
|
|
179
|
+
* - a sequence object for multi-item preview with `sources`, `startIndex`, and `advance`
|
|
180
|
+
*
|
|
181
|
+
* Resolves when preview session is closed (manual/auto/interrupted/error).
|
|
182
|
+
* Rejects with a cancellation error if `signal` is aborted, and abort also requests
|
|
183
|
+
* the active native preview session to close immediately.
|
|
184
|
+
*/
|
|
185
|
+
previewMedia(options: PreviewMediaOptions): Promise<PreviewMediaResult>;
|
|
158
186
|
|
|
159
187
|
saveImageToPhotosAlbum(options: SaveMediaOptions): Promise<void>;
|
|
160
188
|
saveVideoToPhotosAlbum(options: SaveMediaOptions): Promise<void>;
|
|
@@ -197,6 +225,11 @@ export interface Lx {
|
|
|
197
225
|
|
|
198
226
|
getCapsuleRect(): Promise<CapsuleRect>;
|
|
199
227
|
|
|
228
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
229
|
+
chooseFile(options?: ChooseFileOptions): Promise<ChooseFileResult>;
|
|
230
|
+
/** Desktop only. Currently supported on macOS. Windows is planned. */
|
|
231
|
+
chooseDirectory(options?: ChooseDirectoryOptions): Promise<ChooseDirectoryResult>;
|
|
232
|
+
|
|
200
233
|
onKeyDown(callback: KeyEventCallback): void;
|
|
201
234
|
offKeyDown(callback?: KeyEventCallback): void;
|
|
202
235
|
onKeyUp(callback: KeyEventCallback): void;
|
package/src/media/index.ts
CHANGED
|
@@ -179,14 +179,121 @@ export interface ChosenMediaEntry {
|
|
|
179
179
|
isOriginal: boolean;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
export
|
|
182
|
+
export type MediaRotation = 0 | 90 | 180 | 270;
|
|
183
|
+
|
|
184
|
+
export type MediaObjectFit = 'cover' | 'contain' | 'fill' | 'fit';
|
|
185
|
+
|
|
186
|
+
export interface PreviewMediaSource {
|
|
187
|
+
/**
|
|
188
|
+
* Media source path.
|
|
189
|
+
* Recommended: `lx://` path (for example `lx://usercache/...`) or a sandbox-local path
|
|
190
|
+
* that can be resolved by runtime access rules.
|
|
191
|
+
*/
|
|
183
192
|
path: string;
|
|
184
193
|
type?: 'image' | 'video';
|
|
194
|
+
/**
|
|
195
|
+
* Optional poster image path for video preview.
|
|
196
|
+
* Uses the same path contract as `path`.
|
|
197
|
+
*/
|
|
185
198
|
coverPath?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Optional clockwise rotation in degrees (`0 | 90 | 180 | 270`).
|
|
201
|
+
* Default: when omitted, runtime resolves orientation from media metadata.
|
|
202
|
+
*/
|
|
203
|
+
rotate?: MediaRotation;
|
|
204
|
+
/**
|
|
205
|
+
* Optional display fit mode for video preview.
|
|
206
|
+
* Default: `contain`.
|
|
207
|
+
*/
|
|
208
|
+
objectFit?: MediaObjectFit;
|
|
209
|
+
/**
|
|
210
|
+
* Image display duration in milliseconds.
|
|
211
|
+
* Effective only for image items and only when preview `advance` is not `manual`.
|
|
212
|
+
*/
|
|
213
|
+
durationMs?: number;
|
|
186
214
|
}
|
|
187
215
|
|
|
188
|
-
export
|
|
189
|
-
|
|
216
|
+
export type PreviewMediaAdvance = 'manual' | 'next' | 'loop';
|
|
217
|
+
|
|
218
|
+
export interface PreviewMediaSingleOptions extends PreviewMediaSource {
|
|
219
|
+
/**
|
|
220
|
+
* Auto behavior for the preview session.
|
|
221
|
+
*
|
|
222
|
+
* - `manual`: never auto-advance
|
|
223
|
+
* - `next`: advance to the next item; if already on the last item, close the session
|
|
224
|
+
* - `loop`: advance to the next item; if already on the last item, wrap to the first item
|
|
225
|
+
*
|
|
226
|
+
* Default: `manual`
|
|
227
|
+
*/
|
|
228
|
+
advance?: PreviewMediaAdvance;
|
|
229
|
+
/**
|
|
230
|
+
* Optional cancellation signal for the preview request.
|
|
231
|
+
*
|
|
232
|
+
* Aborting rejects the returned promise with a cancellation error and requests the active
|
|
233
|
+
* native preview session to close immediately.
|
|
234
|
+
*/
|
|
235
|
+
signal?: AbortSignal;
|
|
236
|
+
/**
|
|
237
|
+
* Whether to show the top `current/total` indicator.
|
|
238
|
+
*
|
|
239
|
+
* Default: `true` when previewing multiple items, otherwise `false`.
|
|
240
|
+
*/
|
|
241
|
+
showIndexIndicator?: boolean;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface PreviewMediaSequenceOptions {
|
|
245
|
+
/**
|
|
246
|
+
* Preview list. Supports images, videos, or a mixed queue.
|
|
247
|
+
*/
|
|
248
|
+
sources: PreviewMediaSource[];
|
|
249
|
+
/**
|
|
250
|
+
* Initial item index in `sources`.
|
|
251
|
+
* Must be an integer.
|
|
252
|
+
* Out-of-range values are clamped by runtime.
|
|
253
|
+
* Default: `0`.
|
|
254
|
+
*/
|
|
255
|
+
startIndex?: number;
|
|
256
|
+
/**
|
|
257
|
+
* Auto behavior for the preview session.
|
|
258
|
+
*
|
|
259
|
+
* - `manual`: never auto-advance
|
|
260
|
+
* - `next`: advance to the next item; if already on the last item, close the session
|
|
261
|
+
* - `loop`: advance to the next item; if already on the last item, wrap to the first item
|
|
262
|
+
*
|
|
263
|
+
* Default: `manual`
|
|
264
|
+
*/
|
|
265
|
+
advance?: PreviewMediaAdvance;
|
|
266
|
+
/**
|
|
267
|
+
* Optional cancellation signal for the preview request.
|
|
268
|
+
*
|
|
269
|
+
* Aborting rejects the returned promise with a cancellation error and requests the active
|
|
270
|
+
* native preview session to close immediately.
|
|
271
|
+
*/
|
|
272
|
+
signal?: AbortSignal;
|
|
273
|
+
/**
|
|
274
|
+
* Whether to show the top `current/total` indicator.
|
|
275
|
+
*
|
|
276
|
+
* Default: `true` when previewing multiple items, otherwise `false`.
|
|
277
|
+
*/
|
|
278
|
+
showIndexIndicator?: boolean;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export type PreviewMediaOptions =
|
|
282
|
+
| string
|
|
283
|
+
| PreviewMediaSingleOptions
|
|
284
|
+
| PreviewMediaSequenceOptions;
|
|
285
|
+
|
|
286
|
+
export type PreviewMediaCloseReason = 'manual' | 'completed' | 'interrupted' | 'error';
|
|
287
|
+
|
|
288
|
+
export interface PreviewMediaResult {
|
|
289
|
+
/**
|
|
290
|
+
* Why the preview session finished.
|
|
291
|
+
*/
|
|
292
|
+
reason: PreviewMediaCloseReason;
|
|
293
|
+
/**
|
|
294
|
+
* Last active item index before close.
|
|
295
|
+
*/
|
|
296
|
+
lastIndex: number;
|
|
190
297
|
}
|
|
191
298
|
|
|
192
299
|
export interface SaveMediaOptions {
|
package/src/system/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface AppBaseInfo {
|
|
|
7
7
|
language: string;
|
|
8
8
|
productName: string;
|
|
9
9
|
version: string;
|
|
10
|
+
SDKVersion: string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export interface SystemSettingInfo {
|
|
@@ -17,5 +18,5 @@ export interface SystemSettingInfo {
|
|
|
17
18
|
|
|
18
19
|
export interface OpenURLOptions {
|
|
19
20
|
url: string;
|
|
20
|
-
|
|
21
|
+
target?: 'self' | 'external';
|
|
21
22
|
}
|
package/src/update/index.ts
CHANGED
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
export interface UpdateManager {
|
|
7
7
|
applyUpdate(): void;
|
|
8
|
-
onUpdateReady(callback: () => void): void;
|
|
9
|
-
onUpdateFailed(callback: () => void): void;
|
|
8
|
+
onUpdateReady(callback: (info: UpdateReadyInfo) => void): void;
|
|
9
|
+
onUpdateFailed(callback: (info: UpdateFailedInfo) => void): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UpdateReadyInfo {
|
|
13
|
+
version?: string;
|
|
14
|
+
isForceUpdate?: boolean;
|
|
15
|
+
releaseType?: "release" | "preview" | "developer" | string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface UpdateFailedInfo extends UpdateReadyInfo {
|
|
19
|
+
error?: string;
|
|
10
20
|
}
|
package/dist/document/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|