@lingxia/types 0.5.1 → 0.6.0

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 (96) hide show
  1. package/dist/app/index.d.ts +121 -16
  2. package/dist/app/index.d.ts.map +1 -1
  3. package/dist/app/index.js +1 -2
  4. package/dist/app/index.js.map +1 -1
  5. package/dist/device/actions.d.ts +1 -2
  6. package/dist/device/actions.d.ts.map +1 -1
  7. package/dist/device/actions.js +1 -2
  8. package/dist/device/actions.js.map +1 -1
  9. package/dist/device/info.d.ts +1 -2
  10. package/dist/device/info.d.ts.map +1 -1
  11. package/dist/device/info.js +1 -2
  12. package/dist/device/info.js.map +1 -1
  13. package/dist/device/network.d.ts +1 -2
  14. package/dist/device/network.d.ts.map +1 -1
  15. package/dist/device/network.js +1 -2
  16. package/dist/device/network.js.map +1 -1
  17. package/dist/device/wifi.d.ts +1 -2
  18. package/dist/device/wifi.d.ts.map +1 -1
  19. package/dist/device/wifi.js +1 -2
  20. package/dist/device/wifi.js.map +1 -1
  21. package/dist/display/index.d.ts +1 -2
  22. package/dist/display/index.d.ts.map +1 -1
  23. package/dist/display/index.js +1 -2
  24. package/dist/display/index.js.map +1 -1
  25. package/dist/env/index.d.ts +8 -0
  26. package/dist/env/index.d.ts.map +1 -0
  27. package/dist/env/index.js +6 -0
  28. package/dist/env/index.js.map +1 -0
  29. package/dist/file/index.d.ts +88 -52
  30. package/dist/file/index.d.ts.map +1 -1
  31. package/dist/file/index.js +0 -1
  32. package/dist/file/index.js.map +1 -1
  33. package/dist/index.d.ts +25 -11
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +3 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/input/index.d.ts +1 -2
  38. package/dist/input/index.d.ts.map +1 -1
  39. package/dist/input/index.js +1 -2
  40. package/dist/input/index.js.map +1 -1
  41. package/dist/location/index.d.ts +1 -2
  42. package/dist/location/index.d.ts.map +1 -1
  43. package/dist/location/index.js +1 -2
  44. package/dist/location/index.js.map +1 -1
  45. package/dist/lxapp/index.d.ts +11 -0
  46. package/dist/lxapp/index.d.ts.map +1 -0
  47. package/dist/lxapp/index.js +6 -0
  48. package/dist/lxapp/index.js.map +1 -0
  49. package/dist/media/index.d.ts +4 -10
  50. package/dist/media/index.d.ts.map +1 -1
  51. package/dist/media/index.js +1 -2
  52. package/dist/media/index.js.map +1 -1
  53. package/dist/navigator/index.d.ts +7 -3
  54. package/dist/navigator/index.d.ts.map +1 -1
  55. package/dist/navigator/index.js +1 -2
  56. package/dist/navigator/index.js.map +1 -1
  57. package/dist/storage/index.d.ts +1 -6
  58. package/dist/storage/index.d.ts.map +1 -1
  59. package/dist/storage/index.js +1 -2
  60. package/dist/storage/index.js.map +1 -1
  61. package/dist/system/index.d.ts +1 -8
  62. package/dist/system/index.d.ts.map +1 -1
  63. package/dist/system/index.js +1 -2
  64. package/dist/system/index.js.map +1 -1
  65. package/dist/transfer/index.d.ts +121 -0
  66. package/dist/transfer/index.d.ts.map +1 -0
  67. package/dist/transfer/index.js +6 -0
  68. package/dist/transfer/index.js.map +1 -0
  69. package/dist/ui/index.d.ts +63 -25
  70. package/dist/ui/index.d.ts.map +1 -1
  71. package/dist/ui/index.js +1 -2
  72. package/dist/ui/index.js.map +1 -1
  73. package/dist/update/index.d.ts +2 -3
  74. package/dist/update/index.d.ts.map +1 -1
  75. package/dist/update/index.js +1 -2
  76. package/dist/update/index.js.map +1 -1
  77. package/package.json +11 -1
  78. package/src/app/index.ts +151 -19
  79. package/src/device/actions.ts +1 -2
  80. package/src/device/info.ts +1 -2
  81. package/src/device/network.ts +1 -2
  82. package/src/device/wifi.ts +1 -2
  83. package/src/display/index.ts +1 -2
  84. package/src/env/index.ts +8 -0
  85. package/src/file/index.ts +100 -51
  86. package/src/index.ts +36 -17
  87. package/src/input/index.ts +1 -2
  88. package/src/location/index.ts +1 -2
  89. package/src/lxapp/index.ts +12 -0
  90. package/src/media/index.ts +4 -10
  91. package/src/navigator/index.ts +9 -3
  92. package/src/storage/index.ts +1 -7
  93. package/src/system/index.ts +1 -9
  94. package/src/transfer/index.ts +136 -0
  95. package/src/ui/index.ts +75 -25
  96. package/src/update/index.ts +2 -3
@@ -1,8 +1,6 @@
1
1
  /**
2
- * UI APIs
3
- * Corresponds to: lingxia-logic/src/ui/
2
+ * UI feedback, navigation, and surface control APIs.
4
3
  */
5
- import type { EventEmitter } from '../app';
6
4
  export interface ShowToastOptions {
7
5
  title: string;
8
6
  icon?: 'success' | 'error' | 'loading' | 'none';
@@ -31,24 +29,24 @@ export interface ShowActionSheetOptions {
31
29
  export interface ActionSheetResult {
32
30
  tapIndex: number;
33
31
  }
34
- export interface NavigateToOptions {
35
- url: string;
36
- }
37
- export interface NavigateToResult {
38
- eventEmitter: EventEmitter;
39
- }
32
+ export type PageQueryValue = string | number | boolean | null | undefined;
33
+ export type PageQuery = Record<string, PageQueryValue>;
34
+ export type PageTargetOptions = {
35
+ page: string;
36
+ path?: never;
37
+ query?: PageQuery;
38
+ } | {
39
+ path: string;
40
+ page?: never;
41
+ query?: PageQuery;
42
+ };
43
+ export type NavigateToOptions = PageTargetOptions;
40
44
  export interface NavigateBackOptions {
41
45
  delta: number;
42
46
  }
43
- export interface RedirectToOptions {
44
- url: string;
45
- }
46
- export interface SwitchTabOptions {
47
- url: string;
48
- }
49
- export interface ReLaunchOptions {
50
- url: string;
51
- }
47
+ export type RedirectToOptions = PageTargetOptions;
48
+ export type SwitchTabOptions = PageTargetOptions;
49
+ export type ReLaunchOptions = PageTargetOptions;
52
50
  export interface SetNavigationBarTitleOptions {
53
51
  title: string;
54
52
  }
@@ -78,15 +76,55 @@ export interface SetTabBarItemOptions {
78
76
  iconPath?: string;
79
77
  selectedIconPath?: string;
80
78
  }
81
- export interface ShowPopupOptions {
79
+ export type SurfaceQueryValue = PageQueryValue;
80
+ export type SurfaceQuery = PageQuery;
81
+ export type SurfacePageTargetOptions = {
82
+ page: string;
83
+ path?: never;
84
+ url?: never;
85
+ query?: SurfaceQuery;
86
+ } | {
87
+ path: string;
88
+ page?: never;
89
+ url?: never;
90
+ query?: SurfaceQuery;
91
+ };
92
+ export type SurfaceUrlTargetOptions = {
82
93
  url: string;
83
- widthRatio?: number;
84
- heightRatio?: number;
85
- position?: 'center' | 'bottom' | 'left' | 'right';
86
- }
87
- export interface ShowPopupResult {
88
- eventEmitter: EventEmitter;
94
+ page?: never;
95
+ path?: never;
96
+ query?: never;
97
+ };
98
+ export type SurfaceTargetOptions = SurfacePageTargetOptions | SurfaceUrlTargetOptions;
99
+ /**
100
+ * Popup size value.
101
+ *
102
+ * - number: absolute size, must be > 0
103
+ * - `${number}%`: percentage size, must be > 0% and <= 100%
104
+ */
105
+ export type PopupSurfaceSizeValue = number | `${number}%`;
106
+ export interface PopupSurfaceSize {
107
+ /** Width for popup surface. */
108
+ width?: PopupSurfaceSizeValue;
109
+ /** Height for popup surface. */
110
+ height?: PopupSurfaceSizeValue;
111
+ }
112
+ export type PopupSurfaceOptions = SurfaceTargetOptions & {
113
+ kind: 'popup';
114
+ position?: 'center' | 'bottom' | 'left' | 'right' | 'top';
115
+ size?: PopupSurfaceSize;
116
+ };
117
+ export interface WindowSurfaceSize {
118
+ /** Window width, must be a positive number. */
119
+ width?: number;
120
+ /** Window height, must be a positive number. */
121
+ height?: number;
89
122
  }
123
+ export type WindowSurfaceOptions = SurfaceTargetOptions & {
124
+ kind: 'window';
125
+ size?: WindowSurfaceSize;
126
+ };
127
+ export type SurfaceOpenOptions = PopupSurfaceOptions | WindowSurfaceOptions;
90
128
  export interface CapsuleRect {
91
129
  width?: number;
92
130
  height?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,C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AM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
package/dist/ui/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * UI APIs
4
- * Corresponds to: lingxia-logic/src/ui/
3
+ * UI feedback, navigation, and surface control APIs.
5
4
  */
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Update APIs
3
- * Corresponds to: lingxia-logic/src/update.rs
2
+ * Runtime update APIs.
4
3
  */
5
4
  export interface UpdateManager {
6
5
  applyUpdate(): void;
@@ -10,7 +9,7 @@ export interface UpdateManager {
10
9
  export interface UpdateReadyInfo {
11
10
  version?: string;
12
11
  isForceUpdate?: boolean;
13
- releaseType?: "release" | "preview" | "developer" | string;
12
+ channel?: "release" | "preview" | "developer" | string;
14
13
  }
15
14
  export interface UpdateFailedInfo extends UpdateReadyInfo {
16
15
  error?: string;
@@ -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,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":"AAAA;;GAEG;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,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;CACxD;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Update APIs
4
- * Corresponds to: lingxia-logic/src/update.rs
3
+ * Runtime update APIs.
5
4
  */
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/update/index.ts"],"names":[],"mappings":";AAAA;;GAEG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxia/types",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "TypeScript type definitions for the LingXia JS API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,6 +21,11 @@
21
21
  "import": "./dist/app/index.js",
22
22
  "require": "./dist/app/index.js"
23
23
  },
24
+ "./lxapp": {
25
+ "types": "./dist/lxapp/index.d.ts",
26
+ "import": "./dist/lxapp/index.js",
27
+ "require": "./dist/lxapp/index.js"
28
+ },
24
29
  "./device": {
25
30
  "types": "./dist/device/index.d.ts",
26
31
  "import": "./dist/device/index.js",
@@ -46,6 +51,11 @@
46
51
  "import": "./dist/file/index.js",
47
52
  "require": "./dist/file/index.js"
48
53
  },
54
+ "./transfer": {
55
+ "types": "./dist/transfer/index.d.ts",
56
+ "import": "./dist/transfer/index.js",
57
+ "require": "./dist/transfer/index.js"
58
+ },
49
59
  "./location": {
50
60
  "types": "./dist/location/index.d.ts",
51
61
  "import": "./dist/location/index.js",
package/src/app/index.ts CHANGED
@@ -1,8 +1,115 @@
1
1
  /**
2
- * App & Page APIs
3
- * Corresponds to: lingxia-lxapp/src/appservice/
2
+ * Host app, app lifecycle, and page instance APIs.
4
3
  */
5
4
 
5
+ export interface AppBaseInfo {
6
+ language: string;
7
+ productName: string;
8
+ version: string;
9
+ SDKVersion: string;
10
+ }
11
+
12
+ export interface HostAppUpdateInfo {
13
+ version: string;
14
+ size?: number;
15
+ releaseNotes?: string[];
16
+ isForceUpdate: boolean;
17
+ /**
18
+ * Download and apply this checked update.
19
+ *
20
+ * `apply()` is single-use for this update object.
21
+ *
22
+ * The returned task can be awaited directly when progress is not needed, or
23
+ * consumed with `for await...of` to render progress.
24
+ *
25
+ * Direct package handoff is currently supported on Android and macOS. Other
26
+ * platforms reject with an unsupported-operation error; use `version` and
27
+ * `releaseNotes` to guide users to the appropriate app marketplace.
28
+ */
29
+ apply(): HostAppUpdateTask;
30
+ }
31
+
32
+ export type HostAppUpdateApplyStage = 'download' | 'install';
33
+
34
+ export type HostAppUpdateCheckResult =
35
+ | {
36
+ hasUpdate: false;
37
+ update?: never;
38
+ }
39
+ | {
40
+ hasUpdate: true;
41
+ update: HostAppUpdateInfo;
42
+ };
43
+
44
+ export type HostAppUpdateEvent =
45
+ | {
46
+ state: 'downloading';
47
+ downloadedBytes?: number;
48
+ progress?: number;
49
+ }
50
+ | {
51
+ state: 'downloaded' | 'installRequested';
52
+ }
53
+ | {
54
+ state: 'failed';
55
+ stage: HostAppUpdateApplyStage;
56
+ error: string;
57
+ };
58
+
59
+ export interface HostAppUpdateResult {
60
+ state: 'installRequested';
61
+ }
62
+
63
+ export interface HostAppUpdateIteratorResult {
64
+ done: boolean;
65
+ value?: HostAppUpdateEvent;
66
+ }
67
+
68
+ export interface HostAppUpdateTask
69
+ extends PromiseLike<HostAppUpdateResult>,
70
+ AsyncIterable<HostAppUpdateEvent> {
71
+ next(): Promise<HostAppUpdateIteratorResult>;
72
+ /** Stops iteration only. It does not cancel an app update already handed to the platform. */
73
+ return(): Promise<HostAppUpdateIteratorResult>;
74
+ catch<TResult = never>(
75
+ onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,
76
+ ): Promise<HostAppUpdateResult | TResult>;
77
+ finally(onfinally?: (() => void) | null): Promise<HostAppUpdateResult>;
78
+ wait(): Promise<HostAppUpdateResult>;
79
+ }
80
+
81
+ export interface HostAppApi {
82
+ getBaseInfo(): AppBaseInfo;
83
+
84
+ /**
85
+ * Check whether the host app has an update.
86
+ *
87
+ * This is a host app level capability and is only available to the home
88
+ * lxapp. Non-home lxapps receive a permission error.
89
+ *
90
+ * Calling this API opts the host app into custom update handling for this
91
+ * process. LingXia will not show its built-in host app update UI or
92
+ * auto-install host app updates after that point.
93
+ *
94
+ * If no update is available, or if an update requires a newer LingXia
95
+ * runtime than the current host app provides, `hasUpdate` is `false`.
96
+ *
97
+ * `checkUpdate()` may return version metadata on platforms that cannot apply
98
+ * host app packages directly. In that case, `update.apply()` rejects with an
99
+ * unsupported-operation error.
100
+ */
101
+ checkUpdate(): Promise<HostAppUpdateCheckResult>;
102
+
103
+ /**
104
+ * Exit the host app immediately.
105
+ *
106
+ * This API does not show a confirmation dialog. If the user should confirm
107
+ * first, call `lx.showModal(...)` in page logic and invoke `lx.app.exit()`
108
+ * only after the user confirms.
109
+ */
110
+ exit(): void;
111
+ }
112
+
6
113
  export interface AppLifecycleEventArgs {
7
114
  source: 'host' | 'lxapp';
8
115
  reason:
@@ -15,15 +122,6 @@ export interface AppLifecycleEventArgs {
15
122
  | 'switch_away';
16
123
  }
17
124
 
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
-
27
125
  export interface AppLaunchOptions {
28
126
  path?: string;
29
127
  query?: Record<string, string>;
@@ -62,18 +160,52 @@ export interface PageConfig<TData extends Record<string, unknown> = Record<strin
62
160
  [key: string]: unknown;
63
161
  }
64
162
 
163
+ export type SurfaceCloseReason =
164
+ | 'user'
165
+ | 'programmatic'
166
+ | 'owner_closed'
167
+ | 'app_closed'
168
+ | 'failed'
169
+ | 'unknown';
170
+
171
+ export interface SurfaceClosedEvent {
172
+ id: string;
173
+ kind: 'popup' | 'window';
174
+ reason: SurfaceCloseReason;
175
+ }
176
+
177
+ export interface Surface {
178
+ readonly id: string;
179
+ readonly kind: 'popup' | 'window';
180
+ /**
181
+ * Sends a message to the other side of a page surface.
182
+ *
183
+ * For the opener this targets the opened page. For the opened page this
184
+ * targets the opener. URL surfaces have no page-side receiver.
185
+ */
186
+ postMessage(message: unknown): void;
187
+ onMessage(handler: (message: unknown) => void): () => void;
188
+ onClose(handler: (event: SurfaceClosedEvent) => void): () => void;
189
+ close(): Promise<void>;
190
+ }
191
+
192
+ export interface PageMessagePort {
193
+ postMessage(message: unknown): void;
194
+ onMessage(handler: (message: unknown) => void): () => void;
195
+ }
196
+
65
197
  export interface PageInstance<TData extends Record<string, unknown> = Record<string, unknown>> {
66
198
  data: TData;
67
199
  route: string;
200
+ /**
201
+ * Available when this page was opened by `lx.surface.open(...)`.
202
+ */
203
+ surface?: Surface;
204
+ /**
205
+ * Available when this page was opened by `lx.navigateTo(...)`.
206
+ */
207
+ opener?: PageMessagePort;
68
208
  setData(data: Partial<TData> | Record<string, unknown>, callback?: () => void): void;
69
- getEventEmitter(): EventEmitter;
70
- }
71
-
72
- export interface EventEmitter {
73
- on(event: string, handler: (...args: unknown[]) => void): void;
74
- off(event: string, handler: (...args: unknown[]) => void): void;
75
- emit(event: string, ...args: unknown[]): void;
76
- once(event: string, handler: (...args: unknown[]) => void): void;
77
209
  }
78
210
 
79
211
  /**
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Device action APIs
3
- * Corresponds to: lingxia-logic/src/device/actions.rs
2
+ * Device action APIs.
4
3
  */
5
4
 
6
5
  export interface MakePhoneCallOptions {
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Device info APIs
3
- * Corresponds to: lingxia-logic/src/device/info.rs
2
+ * Device info APIs.
4
3
  */
5
4
 
6
5
  export interface DeviceInfo {
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Network APIs
3
- * Corresponds to: lingxia-logic/src/device/network.rs
2
+ * Network status APIs.
4
3
  */
5
4
 
6
5
  // Matches mini-program style where possible: wifi/2g/3g/4g/5g/none/unknown.
@@ -1,6 +1,5 @@
1
1
  /**
2
- * WiFi APIs
3
- * Corresponds to: lingxia-logic/src/device/wifi.rs
2
+ * Wi-Fi APIs.
4
3
  */
5
4
 
6
5
  export interface WifiInfo {
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Display APIs
3
- * Corresponds to: lingxia-logic/src/display.rs
2
+ * Display and orientation APIs.
4
3
  */
5
4
 
6
5
  export type DeviceOrientation = "portrait" | "landscape";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Runtime environment constants.
3
+ */
4
+
5
+ export interface LxEnv {
6
+ USER_DATA_PATH: string;
7
+ USER_CACHE_PATH: string;
8
+ }
package/src/file/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * File system APIs.
3
- * Corresponds to: lingxia-logic/src/fs.rs
4
3
  */
5
4
 
6
5
  export interface OpenFileOptions {
@@ -18,7 +17,6 @@ export interface OpenFileOptions {
18
17
  showMenu?: boolean;
19
18
  }
20
19
 
21
- /** Desktop only. Currently supported on macOS. Windows is planned. */
22
20
  export interface FileDialogFilter {
23
21
  /** Optional label shown in the native dialog. */
24
22
  name?: string;
@@ -26,88 +24,139 @@ export interface FileDialogFilter {
26
24
  extensions: string[];
27
25
  }
28
26
 
29
- /** Desktop only. Currently supported on macOS. Windows is planned. */
30
27
  export interface ChooseFileOptions {
31
28
  /** Allow selecting multiple files. Default: false */
32
29
  multiple?: boolean;
33
30
  /** Optional file filters. Empty or omitted means all file types. */
34
31
  filters?: FileDialogFilter[];
35
- /** Dialog window title. Platform provides a default if omitted. */
36
- title?: string;
37
32
  /** Initial directory the dialog opens in. Platform default if omitted. */
38
33
  defaultPath?: string;
39
34
  }
40
35
 
41
- /** Desktop only. Currently supported on macOS. Windows is planned. */
42
36
  export interface ChooseFileResult {
43
37
  /** True if the user dismissed the dialog without selecting. */
44
38
  canceled: boolean;
45
- /** Absolute system paths of selected files. Empty when canceled. */
39
+ /** Native-consumable file references (paths or URIs). Empty when canceled. */
46
40
  paths: string[];
47
41
  }
48
42
 
49
- /** Desktop only. Currently supported on macOS. Windows is planned. */
50
43
  export interface ChooseDirectoryOptions {
51
- /** Dialog window title. Platform provides a default if omitted. */
52
- title?: string;
53
44
  /** Initial directory the dialog opens in. Platform default if omitted. */
54
45
  defaultPath?: string;
55
46
  }
56
47
 
57
- /** Desktop only. Currently supported on macOS. Windows is planned. */
58
48
  export interface ChooseDirectoryResult {
59
49
  /** True if the user dismissed the dialog without selecting. */
60
50
  canceled: boolean;
61
- /** Absolute system path of the selected directory. Undefined when canceled. */
51
+ /** Native-consumable directory reference (path or URI). Undefined when canceled. */
62
52
  path?: string;
63
53
  }
64
54
 
65
- export interface DownloadOptions {
66
- /** HTTP(S) source URL. */
67
- url: string;
68
- /** Optional request headers. */
69
- headers?: Record<string, string>;
70
- /** Request timeout in milliseconds. */
71
- timeout?: number;
72
- /** Optional destination path. Relative paths resolve under user data. */
73
- filePath?: string;
74
- /** Optional abort signal. */
75
- signal?: AbortSignal;
55
+ export interface ExistsOptions {
56
+ path: string;
76
57
  }
77
58
 
78
- export interface DownloadProgressEvent {
79
- kind: 'progress' | 'paused' | 'resumed' | 'canceled' | 'success';
80
- downloadedBytes?: number;
81
- totalBytes?: number;
82
- /** Present only when the total size is known. */
83
- progress?: number;
84
- result?: DownloadResult;
59
+ export interface StatOptions {
60
+ path: string;
85
61
  }
86
62
 
87
- export interface DownloadIteratorResult {
88
- done: boolean;
89
- value?: DownloadProgressEvent;
63
+ export interface FileStats {
64
+ isFile: boolean;
65
+ isDirectory: boolean;
66
+ isSymlink: boolean;
67
+ size: number;
68
+ lastModifiedTime?: number;
69
+ lastAccessedTime?: number;
70
+ createTime?: number;
71
+ }
72
+
73
+ export interface ReadDirOptions {
74
+ path: string;
75
+ }
76
+
77
+ export interface DirEntry {
78
+ name: string;
79
+ isFile: boolean;
80
+ isDirectory: boolean;
81
+ isSymlink: boolean;
82
+ }
83
+
84
+ export interface MkdirOptions {
85
+ path: string;
86
+ recursive?: boolean;
90
87
  }
91
88
 
92
- export interface DownloadResult {
93
- /** Final accessible file path or URI. */
89
+ export interface ReadTextFileOptions {
94
90
  filePath: string;
95
- /** MIME type when available. */
96
- mimeType?: string;
97
- /** File size in bytes. */
98
- size: number;
91
+ encoding: 'utf8' | 'base64';
92
+ }
93
+
94
+ export interface ReadBinaryFileOptions {
95
+ filePath: string;
96
+ encoding?: undefined;
97
+ }
98
+
99
+ export type ReadFileOptions = ReadTextFileOptions | ReadBinaryFileOptions;
100
+
101
+ export interface ReadTextFileResult {
102
+ data: string;
103
+ }
104
+
105
+ export interface ReadBinaryFileResult {
106
+ data: ArrayBuffer;
107
+ }
108
+
109
+ export type ReadFileResult = ReadTextFileResult | ReadBinaryFileResult;
110
+
111
+ export type BinaryFileData = ArrayBuffer | ArrayBufferView;
112
+
113
+ export interface WriteTextFileOptions {
114
+ filePath: string;
115
+ data: string;
116
+ encoding?: 'utf8' | 'base64';
117
+ /** Defaults to false. */
118
+ overwrite?: boolean;
119
+ }
120
+
121
+ export interface WriteBinaryFileOptions {
122
+ filePath: string;
123
+ data: BinaryFileData;
124
+ encoding?: never;
125
+ /** Defaults to false. */
126
+ overwrite?: boolean;
127
+ }
128
+
129
+ export type WriteFileOptions = WriteTextFileOptions | WriteBinaryFileOptions;
130
+
131
+ export interface CopyFileOptions {
132
+ srcPath: string;
133
+ destPath: string;
134
+ /** Defaults to false. */
135
+ overwrite?: boolean;
136
+ }
137
+
138
+ export interface RenameOptions {
139
+ oldPath: string;
140
+ newPath: string;
141
+ /** Defaults to false. */
142
+ overwrite?: boolean;
143
+ }
144
+
145
+ export interface RemoveOptions {
146
+ path: string;
147
+ recursive?: boolean;
99
148
  }
100
149
 
101
- export interface DownloadTask extends PromiseLike<DownloadResult>, AsyncIterable<DownloadProgressEvent> {
102
- next(): Promise<DownloadIteratorResult>;
103
- return(): Promise<DownloadIteratorResult>;
104
- catch<TResult = never>(
105
- onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,
106
- ): Promise<DownloadResult | TResult>;
107
- finally(onfinally?: (() => void) | null): Promise<DownloadResult>;
108
- pause(): Promise<void>;
109
- resume(): Promise<void>;
110
- cancel(): Promise<void>;
111
- abort(): Promise<void>;
112
- wait(): Promise<DownloadResult>;
150
+ export interface FileManager {
151
+ exists(options: ExistsOptions): Promise<boolean>;
152
+ stat(options: StatOptions): Promise<FileStats>;
153
+ readDir(options: ReadDirOptions): Promise<AsyncIterableIterator<DirEntry>>;
154
+ mkdir(options: MkdirOptions): Promise<void>;
155
+ readFile(options: ReadTextFileOptions): Promise<ReadTextFileResult>;
156
+ readFile(options: ReadBinaryFileOptions): Promise<ReadBinaryFileResult>;
157
+ readFile(options: ReadFileOptions): Promise<ReadFileResult>;
158
+ writeFile(options: WriteFileOptions): Promise<void>;
159
+ copyFile(options: CopyFileOptions): Promise<void>;
160
+ rename(options: RenameOptions): Promise<void>;
161
+ remove(options: RemoveOptions): Promise<void>;
113
162
  }