@lingxia/types 0.1.2 → 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/device/actions.d.ts +8 -0
- package/dist/device/actions.d.ts.map +1 -0
- package/dist/device/actions.js +7 -0
- package/dist/device/actions.js.map +1 -0
- package/dist/device/index.d.ts +4 -37
- package/dist/device/index.d.ts.map +1 -1
- package/dist/device/index.js +18 -4
- package/dist/device/index.js.map +1 -1
- package/dist/device/info.d.ts +17 -0
- package/dist/device/info.d.ts.map +1 -0
- package/dist/device/info.js +7 -0
- package/dist/device/info.js.map +1 -0
- package/dist/device/network.d.ts +13 -0
- package/dist/device/network.d.ts.map +1 -0
- package/dist/device/network.js +7 -0
- package/dist/device/network.js.map +1 -0
- package/dist/device/wifi.d.ts +21 -0
- package/dist/device/wifi.d.ts.map +1 -0
- package/dist/device/wifi.js +7 -0
- package/dist/device/wifi.js.map +1 -0
- package/dist/display/index.d.ts +9 -0
- package/dist/display/index.d.ts.map +1 -0
- package/dist/display/index.js +7 -0
- package/dist/display/index.js.map +1 -0
- 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/file/index.js +7 -0
- package/dist/file/index.js.map +1 -0
- 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 +44 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/media/index.d.ts +233 -3
- package/dist/media/index.d.ts.map +1 -1
- package/dist/navigator/index.d.ts +10 -0
- package/dist/navigator/index.d.ts.map +1 -0
- package/dist/navigator/index.js +7 -0
- package/dist/navigator/index.js.map +1 -0
- package/dist/storage/index.d.ts +2 -7
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -2
- package/dist/system/index.d.ts +3 -12
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +1 -1
- package/dist/update/index.d.ts +18 -0
- package/dist/update/index.d.ts.map +1 -0
- package/dist/update/index.js +7 -0
- package/dist/update/index.js.map +1 -0
- package/package.json +29 -3
- package/src/app/index.ts +9 -0
- package/src/device/actions.ts +8 -0
- package/src/device/index.ts +4 -46
- package/src/device/info.ts +18 -0
- package/src/device/network.ts +24 -0
- package/src/device/wifi.ts +24 -0
- package/src/display/index.ts +10 -0
- 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 +65 -8
- package/src/media/index.ts +250 -3
- package/src/navigator/index.ts +10 -0
- package/src/storage/index.ts +2 -8
- package/src/system/index.ts +3 -14
- package/src/update/index.ts +20 -0
package/src/media/index.ts
CHANGED
|
@@ -25,6 +25,146 @@ export interface CompressImageResult {
|
|
|
25
25
|
tempFilePath: string;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export type VideoCompressQuality = 'low' | 'medium' | 'high';
|
|
29
|
+
|
|
30
|
+
export interface CompressVideoOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Source video path or `lx://` URI.
|
|
33
|
+
*/
|
|
34
|
+
path: string;
|
|
35
|
+
/**
|
|
36
|
+
* Cross-platform note: video compression parameters are best-effort and may map to
|
|
37
|
+
* native presets instead of exact encoder settings.
|
|
38
|
+
*
|
|
39
|
+
* Compression quality preset.
|
|
40
|
+
* When provided, `bitrate`, `fps`, and `resolution` are ignored.
|
|
41
|
+
*/
|
|
42
|
+
quality?: VideoCompressQuality;
|
|
43
|
+
/**
|
|
44
|
+
* Preferred target video bitrate in kbps.
|
|
45
|
+
* May be adjusted or ignored by platform codec/runtime limitations.
|
|
46
|
+
*/
|
|
47
|
+
bitrate?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Preferred target frame rate in fps.
|
|
50
|
+
* Some platforms may ignore this option.
|
|
51
|
+
*/
|
|
52
|
+
fps?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Target resolution scale ratio relative to source size, in range `(0, 1]`.
|
|
55
|
+
* May be approximated or ignored by platform transcoder capabilities.
|
|
56
|
+
*/
|
|
57
|
+
resolution?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Optional output path for compressed file.
|
|
60
|
+
*/
|
|
61
|
+
outputPath?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface CompressVideoResult {
|
|
65
|
+
tempFilePath: string;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
durationMs: number;
|
|
69
|
+
/**
|
|
70
|
+
* Output file size in bytes.
|
|
71
|
+
* Could be close to source size when platform falls back to source content.
|
|
72
|
+
*/
|
|
73
|
+
size: number;
|
|
74
|
+
type: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface GetVideoInfoOptions {
|
|
78
|
+
/**
|
|
79
|
+
* Video file path or `lx://` URI.
|
|
80
|
+
*/
|
|
81
|
+
path: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface VideoInfo {
|
|
85
|
+
/**
|
|
86
|
+
* Encoded display width in pixels.
|
|
87
|
+
*/
|
|
88
|
+
width: number;
|
|
89
|
+
/**
|
|
90
|
+
* Encoded display height in pixels.
|
|
91
|
+
*/
|
|
92
|
+
height: number;
|
|
93
|
+
/**
|
|
94
|
+
* Video duration in milliseconds.
|
|
95
|
+
*/
|
|
96
|
+
durationMs: number;
|
|
97
|
+
/**
|
|
98
|
+
* Clockwise rotation in degrees (usually `0 | 90 | 180 | 270`).
|
|
99
|
+
*/
|
|
100
|
+
rotation?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Average bitrate in bits per second (bps).
|
|
103
|
+
*/
|
|
104
|
+
bitrate?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Frame rate in frames per second (fps).
|
|
107
|
+
*/
|
|
108
|
+
fps?: number;
|
|
109
|
+
/**
|
|
110
|
+
* MIME type, e.g. `video/mp4`.
|
|
111
|
+
*/
|
|
112
|
+
type?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Resolved path used by runtime (typically `lx://...`).
|
|
115
|
+
*/
|
|
116
|
+
path: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface ExtractVideoThumbnailOptions {
|
|
120
|
+
/**
|
|
121
|
+
* Source video path or `lx://` URI.
|
|
122
|
+
*/
|
|
123
|
+
path: string;
|
|
124
|
+
/**
|
|
125
|
+
* Optional output image path. If omitted, runtime chooses a temporary path.
|
|
126
|
+
*/
|
|
127
|
+
outputPath?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Max output width in pixels.
|
|
130
|
+
* Optional; when set with/without `maxHeight`, output keeps aspect ratio (no cropping).
|
|
131
|
+
*/
|
|
132
|
+
maxWidth?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Max output height in pixels.
|
|
135
|
+
* Optional; when set with/without `maxWidth`, output keeps aspect ratio (no cropping).
|
|
136
|
+
*/
|
|
137
|
+
maxHeight?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Target frame time in milliseconds from video start.
|
|
140
|
+
* `0` means first frame.
|
|
141
|
+
*/
|
|
142
|
+
timeMs?: number;
|
|
143
|
+
/**
|
|
144
|
+
* JPEG quality in range `0-100`.
|
|
145
|
+
*/
|
|
146
|
+
quality?: number;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ExtractVideoThumbnailResult {
|
|
150
|
+
/**
|
|
151
|
+
* Generated thumbnail file path.
|
|
152
|
+
*/
|
|
153
|
+
tempFilePath: string;
|
|
154
|
+
/**
|
|
155
|
+
* Output image width in pixels.
|
|
156
|
+
*/
|
|
157
|
+
width: number;
|
|
158
|
+
/**
|
|
159
|
+
* Output image height in pixels.
|
|
160
|
+
*/
|
|
161
|
+
height: number;
|
|
162
|
+
/**
|
|
163
|
+
* Output MIME type, usually `image/jpeg`.
|
|
164
|
+
*/
|
|
165
|
+
type: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
28
168
|
export interface ChooseMediaOptions {
|
|
29
169
|
count?: number;
|
|
30
170
|
mediaType?: ('image' | 'video')[];
|
|
@@ -39,14 +179,121 @@ export interface ChosenMediaEntry {
|
|
|
39
179
|
isOriginal: boolean;
|
|
40
180
|
}
|
|
41
181
|
|
|
42
|
-
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
|
+
*/
|
|
43
192
|
path: string;
|
|
44
193
|
type?: 'image' | 'video';
|
|
194
|
+
/**
|
|
195
|
+
* Optional poster image path for video preview.
|
|
196
|
+
* Uses the same path contract as `path`.
|
|
197
|
+
*/
|
|
45
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;
|
|
214
|
+
}
|
|
215
|
+
|
|
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;
|
|
46
242
|
}
|
|
47
243
|
|
|
48
|
-
export interface
|
|
49
|
-
|
|
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;
|
|
50
297
|
}
|
|
51
298
|
|
|
52
299
|
export interface SaveMediaOptions {
|
package/src/storage/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Storage
|
|
3
|
-
* Corresponds to: lingxia-logic/src/storage.rs,
|
|
2
|
+
* Storage APIs
|
|
3
|
+
* Corresponds to: lingxia-logic/src/storage.rs, env.rs
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export interface LxEnv {
|
|
@@ -17,9 +17,3 @@ export interface Storage {
|
|
|
17
17
|
has(key: string): boolean;
|
|
18
18
|
size(): number;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
export interface OpenDocumentOptions {
|
|
22
|
-
filePath: string;
|
|
23
|
-
fileType?: string;
|
|
24
|
-
showMenu?: boolean;
|
|
25
|
-
}
|
package/src/system/index.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* System APIs
|
|
3
|
-
* Corresponds to: lingxia-logic/src/system.rs
|
|
3
|
+
* Corresponds to: lingxia-logic/src/system.rs
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
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,17 +18,5 @@ export interface SystemSettingInfo {
|
|
|
17
18
|
|
|
18
19
|
export interface OpenURLOptions {
|
|
19
20
|
url: string;
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface NavigateToLxAppOptions {
|
|
24
|
-
appId: string;
|
|
25
|
-
path?: string;
|
|
26
|
-
envVersion?: 'develop' | 'trial' | 'release';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface UpdateManager {
|
|
30
|
-
applyUpdate(): void;
|
|
31
|
-
onUpdateReady(callback: () => void): void;
|
|
32
|
-
onUpdateFailed(callback: () => void): void;
|
|
21
|
+
target?: 'self' | 'external';
|
|
33
22
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update APIs
|
|
3
|
+
* Corresponds to: lingxia-logic/src/update.rs
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface UpdateManager {
|
|
7
|
+
applyUpdate(): 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;
|
|
20
|
+
}
|