@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.
Files changed (80) hide show
  1. package/dist/app/index.d.ts +7 -0
  2. package/dist/app/index.d.ts.map +1 -1
  3. package/dist/device/actions.d.ts +8 -0
  4. package/dist/device/actions.d.ts.map +1 -0
  5. package/dist/device/actions.js +7 -0
  6. package/dist/device/actions.js.map +1 -0
  7. package/dist/device/index.d.ts +4 -37
  8. package/dist/device/index.d.ts.map +1 -1
  9. package/dist/device/index.js +18 -4
  10. package/dist/device/index.js.map +1 -1
  11. package/dist/device/info.d.ts +17 -0
  12. package/dist/device/info.d.ts.map +1 -0
  13. package/dist/device/info.js +7 -0
  14. package/dist/device/info.js.map +1 -0
  15. package/dist/device/network.d.ts +13 -0
  16. package/dist/device/network.d.ts.map +1 -0
  17. package/dist/device/network.js +7 -0
  18. package/dist/device/network.js.map +1 -0
  19. package/dist/device/wifi.d.ts +21 -0
  20. package/dist/device/wifi.d.ts.map +1 -0
  21. package/dist/device/wifi.js +7 -0
  22. package/dist/device/wifi.js.map +1 -0
  23. package/dist/display/index.d.ts +9 -0
  24. package/dist/display/index.d.ts.map +1 -0
  25. package/dist/display/index.js +7 -0
  26. package/dist/display/index.js.map +1 -0
  27. package/dist/error.d.ts +15 -0
  28. package/dist/error.d.ts.map +1 -0
  29. package/dist/error.js +85 -0
  30. package/dist/error.js.map +1 -0
  31. package/dist/file/index.d.ts +102 -0
  32. package/dist/file/index.d.ts.map +1 -0
  33. package/dist/file/index.js +7 -0
  34. package/dist/file/index.js.map +1 -0
  35. package/dist/generated/error.d.ts +165 -0
  36. package/dist/generated/error.d.ts.map +1 -0
  37. package/dist/generated/error.js +46 -0
  38. package/dist/generated/error.js.map +1 -0
  39. package/dist/generated/i18n.d.ts +3 -0
  40. package/dist/generated/i18n.d.ts.map +1 -0
  41. package/dist/generated/i18n.js +124 -0
  42. package/dist/generated/i18n.js.map +1 -0
  43. package/dist/index.d.ts +44 -8
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +7 -0
  46. package/dist/index.js.map +1 -1
  47. package/dist/media/index.d.ts +233 -3
  48. package/dist/media/index.d.ts.map +1 -1
  49. package/dist/navigator/index.d.ts +10 -0
  50. package/dist/navigator/index.d.ts.map +1 -0
  51. package/dist/navigator/index.js +7 -0
  52. package/dist/navigator/index.js.map +1 -0
  53. package/dist/storage/index.d.ts +2 -7
  54. package/dist/storage/index.d.ts.map +1 -1
  55. package/dist/storage/index.js +2 -2
  56. package/dist/system/index.d.ts +3 -12
  57. package/dist/system/index.d.ts.map +1 -1
  58. package/dist/system/index.js +1 -1
  59. package/dist/update/index.d.ts +18 -0
  60. package/dist/update/index.d.ts.map +1 -0
  61. package/dist/update/index.js +7 -0
  62. package/dist/update/index.js.map +1 -0
  63. package/package.json +29 -3
  64. package/src/app/index.ts +9 -0
  65. package/src/device/actions.ts +8 -0
  66. package/src/device/index.ts +4 -46
  67. package/src/device/info.ts +18 -0
  68. package/src/device/network.ts +24 -0
  69. package/src/device/wifi.ts +24 -0
  70. package/src/display/index.ts +10 -0
  71. package/src/error.ts +82 -0
  72. package/src/file/index.ts +121 -0
  73. package/src/generated/error.ts +52 -0
  74. package/src/generated/i18n.ts +123 -0
  75. package/src/index.ts +65 -8
  76. package/src/media/index.ts +250 -3
  77. package/src/navigator/index.ts +10 -0
  78. package/src/storage/index.ts +2 -8
  79. package/src/system/index.ts +3 -14
  80. package/src/update/index.ts +20 -0
@@ -20,6 +20,139 @@ export interface CompressImageOptions {
20
20
  export interface CompressImageResult {
21
21
  tempFilePath: string;
22
22
  }
23
+ export type VideoCompressQuality = 'low' | 'medium' | 'high';
24
+ export interface CompressVideoOptions {
25
+ /**
26
+ * Source video path or `lx://` URI.
27
+ */
28
+ path: string;
29
+ /**
30
+ * Cross-platform note: video compression parameters are best-effort and may map to
31
+ * native presets instead of exact encoder settings.
32
+ *
33
+ * Compression quality preset.
34
+ * When provided, `bitrate`, `fps`, and `resolution` are ignored.
35
+ */
36
+ quality?: VideoCompressQuality;
37
+ /**
38
+ * Preferred target video bitrate in kbps.
39
+ * May be adjusted or ignored by platform codec/runtime limitations.
40
+ */
41
+ bitrate?: number;
42
+ /**
43
+ * Preferred target frame rate in fps.
44
+ * Some platforms may ignore this option.
45
+ */
46
+ fps?: number;
47
+ /**
48
+ * Target resolution scale ratio relative to source size, in range `(0, 1]`.
49
+ * May be approximated or ignored by platform transcoder capabilities.
50
+ */
51
+ resolution?: number;
52
+ /**
53
+ * Optional output path for compressed file.
54
+ */
55
+ outputPath?: string;
56
+ }
57
+ export interface CompressVideoResult {
58
+ tempFilePath: string;
59
+ width: number;
60
+ height: number;
61
+ durationMs: number;
62
+ /**
63
+ * Output file size in bytes.
64
+ * Could be close to source size when platform falls back to source content.
65
+ */
66
+ size: number;
67
+ type: string;
68
+ }
69
+ export interface GetVideoInfoOptions {
70
+ /**
71
+ * Video file path or `lx://` URI.
72
+ */
73
+ path: string;
74
+ }
75
+ export interface VideoInfo {
76
+ /**
77
+ * Encoded display width in pixels.
78
+ */
79
+ width: number;
80
+ /**
81
+ * Encoded display height in pixels.
82
+ */
83
+ height: number;
84
+ /**
85
+ * Video duration in milliseconds.
86
+ */
87
+ durationMs: number;
88
+ /**
89
+ * Clockwise rotation in degrees (usually `0 | 90 | 180 | 270`).
90
+ */
91
+ rotation?: number;
92
+ /**
93
+ * Average bitrate in bits per second (bps).
94
+ */
95
+ bitrate?: number;
96
+ /**
97
+ * Frame rate in frames per second (fps).
98
+ */
99
+ fps?: number;
100
+ /**
101
+ * MIME type, e.g. `video/mp4`.
102
+ */
103
+ type?: string;
104
+ /**
105
+ * Resolved path used by runtime (typically `lx://...`).
106
+ */
107
+ path: string;
108
+ }
109
+ export interface ExtractVideoThumbnailOptions {
110
+ /**
111
+ * Source video path or `lx://` URI.
112
+ */
113
+ path: string;
114
+ /**
115
+ * Optional output image path. If omitted, runtime chooses a temporary path.
116
+ */
117
+ outputPath?: string;
118
+ /**
119
+ * Max output width in pixels.
120
+ * Optional; when set with/without `maxHeight`, output keeps aspect ratio (no cropping).
121
+ */
122
+ maxWidth?: number;
123
+ /**
124
+ * Max output height in pixels.
125
+ * Optional; when set with/without `maxWidth`, output keeps aspect ratio (no cropping).
126
+ */
127
+ maxHeight?: number;
128
+ /**
129
+ * Target frame time in milliseconds from video start.
130
+ * `0` means first frame.
131
+ */
132
+ timeMs?: number;
133
+ /**
134
+ * JPEG quality in range `0-100`.
135
+ */
136
+ quality?: number;
137
+ }
138
+ export interface ExtractVideoThumbnailResult {
139
+ /**
140
+ * Generated thumbnail file path.
141
+ */
142
+ tempFilePath: string;
143
+ /**
144
+ * Output image width in pixels.
145
+ */
146
+ width: number;
147
+ /**
148
+ * Output image height in pixels.
149
+ */
150
+ height: number;
151
+ /**
152
+ * Output MIME type, usually `image/jpeg`.
153
+ */
154
+ type: string;
155
+ }
23
156
  export interface ChooseMediaOptions {
24
157
  count?: number;
25
158
  mediaType?: ('image' | 'video')[];
@@ -32,13 +165,110 @@ export interface ChosenMediaEntry {
32
165
  fileType: 'image' | 'video';
33
166
  isOriginal: boolean;
34
167
  }
35
- export interface PreviewMediaItem {
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
+ */
36
176
  path: string;
37
177
  type?: 'image' | 'video';
178
+ /**
179
+ * Optional poster image path for video preview.
180
+ * Uses the same path contract as `path`.
181
+ */
38
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;
39
260
  }
40
- export interface PreviewMediaOptions {
41
- sources: PreviewMediaItem[];
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;
42
272
  }
43
273
  export interface SaveMediaOptions {
44
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,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,C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AAC;IAChC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC/D;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,IAAI,IAAI,CAAC;IAC1B,cAAc,IAAI,IAAI,CAAC;IACvB,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACrD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * LxApp navigator APIs
3
+ * Corresponds to: lingxia-logic/src/navigator.rs
4
+ */
5
+ export interface NavigateToLxAppOptions {
6
+ appId: string;
7
+ path?: string;
8
+ envVersion?: 'develop' | 'trial' | 'release';
9
+ }
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigator/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;CAC9C"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * LxApp navigator APIs
4
+ * Corresponds to: lingxia-logic/src/navigator.rs
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigator/index.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Storage & File System APIs
3
- * Corresponds to: lingxia-logic/src/storage.rs, fs.rs, env.rs
2
+ * Storage APIs
3
+ * Corresponds to: lingxia-logic/src/storage.rs, env.rs
4
4
  */
5
5
  export interface LxEnv {
6
6
  USER_DATA_PATH: string;
@@ -15,9 +15,4 @@ export interface Storage {
15
15
  has(key: string): boolean;
16
16
  size(): number;
17
17
  }
18
- export interface OpenDocumentOptions {
19
- filePath: string;
20
- fileType?: string;
21
- showMenu?: boolean;
22
- }
23
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,KAAK;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,IAAI,IAAI,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,KAAK;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,IAAI,IAAI,MAAM,CAAC;CAChB"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
- * Storage & File System APIs
4
- * Corresponds to: lingxia-logic/src/storage.rs, fs.rs, env.rs
3
+ * Storage APIs
4
+ * Corresponds to: lingxia-logic/src/storage.rs, env.rs
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * System APIs
3
- * Corresponds to: lingxia-logic/src/system.rs, navigator.rs, update.rs
3
+ * Corresponds to: lingxia-logic/src/system.rs
4
4
  */
5
5
  export interface AppBaseInfo {
6
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,16 +15,6 @@ export interface SystemSettingInfo {
14
15
  }
15
16
  export interface OpenURLOptions {
16
17
  url: string;
17
- openIn?: 'external' | 'internal';
18
- }
19
- export interface NavigateToLxAppOptions {
20
- appId: string;
21
- path?: string;
22
- envVersion?: 'develop' | 'trial' | 'release';
23
- }
24
- export interface UpdateManager {
25
- applyUpdate(): void;
26
- onUpdateReady(callback: () => void): void;
27
- onUpdateFailed(callback: () => void): void;
18
+ target?: 'self' | 'external';
28
19
  }
29
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;CACjB;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,UAAU,GAAG,UAAU,CAAC;CAClC;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;CAC9C;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,IAAI,IAAI,CAAC;IACpB,aAAa,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC1C,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC5C"}
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"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * System APIs
4
- * Corresponds to: lingxia-logic/src/system.rs, navigator.rs, update.rs
4
+ * Corresponds to: lingxia-logic/src/system.rs
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Update APIs
3
+ * Corresponds to: lingxia-logic/src/update.rs
4
+ */
5
+ export interface UpdateManager {
6
+ applyUpdate(): 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;
17
+ }
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,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"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Update APIs
4
+ * Corresponds to: lingxia-logic/src/update.rs
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@lingxia/types",
3
- "version": "0.1.2",
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",
@@ -26,6 +26,11 @@
26
26
  "import": "./dist/device/index.js",
27
27
  "require": "./dist/device/index.js"
28
28
  },
29
+ "./display": {
30
+ "types": "./dist/display/index.d.ts",
31
+ "import": "./dist/display/index.js",
32
+ "require": "./dist/display/index.js"
33
+ },
29
34
  "./input": {
30
35
  "types": "./dist/input/index.d.ts",
31
36
  "import": "./dist/input/index.js",
@@ -36,16 +41,31 @@
36
41
  "import": "./dist/storage/index.js",
37
42
  "require": "./dist/storage/index.js"
38
43
  },
44
+ "./file": {
45
+ "types": "./dist/file/index.d.ts",
46
+ "import": "./dist/file/index.js",
47
+ "require": "./dist/file/index.js"
48
+ },
39
49
  "./location": {
40
50
  "types": "./dist/location/index.d.ts",
41
51
  "import": "./dist/location/index.js",
42
52
  "require": "./dist/location/index.js"
43
53
  },
54
+ "./navigator": {
55
+ "types": "./dist/navigator/index.d.ts",
56
+ "import": "./dist/navigator/index.js",
57
+ "require": "./dist/navigator/index.js"
58
+ },
44
59
  "./system": {
45
60
  "types": "./dist/system/index.d.ts",
46
61
  "import": "./dist/system/index.js",
47
62
  "require": "./dist/system/index.js"
48
63
  },
64
+ "./update": {
65
+ "types": "./dist/update/index.d.ts",
66
+ "import": "./dist/update/index.js",
67
+ "require": "./dist/update/index.js"
68
+ },
49
69
  "./media": {
50
70
  "types": "./dist/media/index.d.ts",
51
71
  "import": "./dist/media/index.js",
@@ -55,6 +75,11 @@
55
75
  "types": "./dist/ui/index.d.ts",
56
76
  "import": "./dist/ui/index.js",
57
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"
58
83
  }
59
84
  },
60
85
  "files": [
@@ -62,7 +87,8 @@
62
87
  "src"
63
88
  ],
64
89
  "scripts": {
65
- "build": "tsc",
90
+ "gen:i18n": "node scripts/gen-i18n.mjs",
91
+ "build": "npm run gen:i18n && tsc",
66
92
  "clean": "rm -rf dist",
67
93
  "prepublishOnly": "npm run clean && npm run build"
68
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>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Device action APIs
3
+ * Corresponds to: lingxia-logic/src/device/actions.rs
4
+ */
5
+
6
+ export interface MakePhoneCallOptions {
7
+ phoneNumber: string;
8
+ }
@@ -1,46 +1,4 @@
1
- /**
2
- * Device APIs
3
- * Corresponds to: lingxia-logic/src/device/
4
- */
5
-
6
- export interface DeviceInfo {
7
- brand: string;
8
- model: string;
9
- marketName: string;
10
- system: string;
11
- }
12
-
13
- export interface ScreenInfo {
14
- width: number;
15
- height: number;
16
- scale: number;
17
- }
18
-
19
- export interface MakePhoneCallOptions {
20
- phoneNumber: string;
21
- }
22
-
23
- export interface WifiInfo {
24
- SSID: string;
25
- BSSID?: string;
26
- secure: boolean;
27
- signalStrength: number;
28
- frequency?: number;
29
- }
30
-
31
- export interface ConnectWifiOptions {
32
- SSID: string;
33
- password?: string;
34
- }
35
-
36
- export type WifiConnectedCallback = (info: WifiInfo) => void;
37
-
38
- export interface AppOrientationInfo {
39
- orientation: string;
40
- }
41
-
42
- export interface SetAppOrientationOptions {
43
- orientation: string;
44
- }
45
-
46
- export type { KeyEvent, KeyEventCallback } from '../input';
1
+ export * from './info';
2
+ export * from './actions';
3
+ export * from './wifi';
4
+ export * from './network';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Device info APIs
3
+ * Corresponds to: lingxia-logic/src/device/info.rs
4
+ */
5
+
6
+ export interface DeviceInfo {
7
+ brand: string;
8
+ model: string;
9
+ marketName: string;
10
+ osName: string;
11
+ osVersion: string;
12
+ }
13
+
14
+ export interface ScreenInfo {
15
+ width: number;
16
+ height: number;
17
+ scale: number;
18
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Network APIs
3
+ * Corresponds to: lingxia-logic/src/device/network.rs
4
+ */
5
+
6
+ // Matches mini-program style where possible: wifi/2g/3g/4g/5g/none/unknown.
7
+ export type NetworkType =
8
+ | 'none'
9
+ | 'unknown'
10
+ | 'wifi'
11
+ | '2g'
12
+ | '3g'
13
+ | '4g'
14
+ | '5g'
15
+ | 'ethernet';
16
+
17
+ export interface NetworkInfo {
18
+ isConnected: boolean;
19
+ networkType: NetworkType;
20
+ ipv4: string[];
21
+ ipv6: string[];
22
+ }
23
+
24
+ export type NetworkChangeCallback = (info: NetworkInfo) => void;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * WiFi APIs
3
+ * Corresponds to: lingxia-logic/src/device/wifi.rs
4
+ */
5
+
6
+ export interface WifiInfo {
7
+ SSID: string;
8
+ BSSID?: string;
9
+ secure: boolean;
10
+ signalStrength: number;
11
+ frequency?: number;
12
+ }
13
+
14
+ export interface WifiConnectedInfo extends WifiInfo {
15
+ connected: boolean;
16
+ state: string;
17
+ }
18
+
19
+ export interface ConnectWifiOptions {
20
+ SSID: string;
21
+ password?: string;
22
+ }
23
+
24
+ export type WifiConnectedCallback = (info: WifiConnectedInfo) => void;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Display APIs
3
+ * Corresponds to: lingxia-logic/src/display.rs
4
+ */
5
+
6
+ export type DeviceOrientation = "portrait" | "landscape";
7
+
8
+ export interface DeviceOrientationChangeEvent {
9
+ value: DeviceOrientation;
10
+ }