@lynx-js/lynxtron 0.0.1 → 0.0.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 (51) hide show
  1. package/README.md +80 -0
  2. package/apis/api/app.d.ts +1848 -0
  3. package/apis/api/asar.d.ts +124 -0
  4. package/apis/api/base-window.d.ts +1712 -0
  5. package/apis/api/clipboard.d.ts +54 -0
  6. package/apis/api/command-line.d.ts +46 -0
  7. package/apis/api/context-bridge.d.ts +8 -0
  8. package/apis/api/devtool.d.ts +34 -0
  9. package/apis/api/dialog.d.ts +633 -0
  10. package/apis/api/dock.d.ts +88 -0
  11. package/apis/api/environment.d.ts +9 -0
  12. package/apis/api/event.d.ts +8 -0
  13. package/apis/api/jump-list-item.d.ts +83 -0
  14. package/apis/api/lynx-library.d.ts +7 -0
  15. package/apis/api/lynx-template-bundle.d.ts +32 -0
  16. package/apis/api/lynx-template-data.d.ts +10 -0
  17. package/apis/api/lynx-update-meta.d.ts +16 -0
  18. package/apis/api/lynx-window.d.ts +405 -0
  19. package/apis/api/menu.d.ts +96 -0
  20. package/apis/api/native-image.d.ts +268 -0
  21. package/apis/api/notification-response.d.ts +26 -0
  22. package/apis/api/notification.d.ts +242 -0
  23. package/apis/api/power-monitor.d.ts +121 -0
  24. package/apis/api/process-metric.d.ts +93 -0
  25. package/apis/api/protocol.d.ts +54 -0
  26. package/apis/api/screen.d.ts +222 -0
  27. package/apis/api/shell.d.ts +124 -0
  28. package/apis/api/task.d.ts +39 -0
  29. package/apis/api/touch-bar.d.ts +206 -0
  30. package/apis/api/tray.d.ts +44 -0
  31. package/apis/api/utility-process.d.ts +73 -0
  32. package/apis/lynx.d.ts +15 -0
  33. package/apis/lynxtron.d.ts +39 -0
  34. package/apis/structures/point.d.ts +10 -0
  35. package/apis/structures/rectangle.d.ts +22 -0
  36. package/apis/structures/size.d.ts +8 -0
  37. package/apis/web-host.d.ts +24 -0
  38. package/cli.js +28 -0
  39. package/context-bridge.js +6 -0
  40. package/fuses-cli.js +143 -0
  41. package/fuses.js +299 -0
  42. package/install.js +127 -0
  43. package/lynx.js +1 -0
  44. package/lynxtron.js +43 -0
  45. package/lynxtron_bin.js +10 -0
  46. package/native-paths.cjs +38 -0
  47. package/package.json +71 -4
  48. package/utils/download.js +72 -0
  49. package/utils/env-config.js +35 -0
  50. package/web-host/index.js +110 -0
  51. package/web-worker.js +12 -0
@@ -0,0 +1,96 @@
1
+ // Copyright 2026 The Lynxtron Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { EventEmitter } from 'node:events';
6
+ import { NativeImage } from './native-image';
7
+
8
+ export type MenuItemType =
9
+ | 'normal'
10
+ | 'separator'
11
+ | 'submenu'
12
+ | 'checkbox'
13
+ | 'radio'
14
+ | 'header'
15
+ | 'palette';
16
+
17
+ export interface MenuItemConstructorOptions {
18
+ id?: string;
19
+ label?: string;
20
+ sublabel?: string;
21
+ toolTip?: string;
22
+ enabled?: boolean;
23
+ visible?: boolean;
24
+ checked?: boolean;
25
+ type?: MenuItemType;
26
+ role?: string;
27
+ accelerator?: string | null;
28
+ acceleratorWorksWhenHidden?: boolean;
29
+ registerAccelerator?: boolean;
30
+ icon?: NativeImage | null;
31
+ submenu?: Menu | MenuItemConstructorOptions[] | null;
32
+ selector?: string;
33
+ click?: (menuItem: MenuItem, focusedWindow: any, event: any) => void;
34
+ after?: string[];
35
+ before?: string[];
36
+ afterGroupContaining?: string[];
37
+ beforeGroupContaining?: string[];
38
+ }
39
+
40
+ export interface PopupOptions {
41
+ window?: any;
42
+ x?: number;
43
+ y?: number;
44
+ positioningItem?: number;
45
+ callback?: () => void;
46
+ }
47
+
48
+ export declare class MenuItem {
49
+ constructor(options?: MenuItemConstructorOptions);
50
+ id?: string;
51
+ label: string;
52
+ type: MenuItemType;
53
+ commandId: number;
54
+ checked: boolean;
55
+ enabled: boolean;
56
+ visible: boolean;
57
+ submenu?: Menu | null;
58
+ role?: string;
59
+ accelerator?: string | null;
60
+ acceleratorWorksWhenHidden: boolean;
61
+ registerAccelerator: boolean;
62
+ icon?: NativeImage | null;
63
+ sublabel?: string;
64
+ toolTip?: string;
65
+ menu?: Menu;
66
+ selector?: string;
67
+ groupId: number;
68
+ click: (event: any, focusedWindow: any) => void;
69
+ getDefaultRoleAccelerator(): string | null;
70
+ getCheckStatus(): boolean;
71
+ overrideProperty(name: string, defaultValue?: any): void;
72
+ overrideReadOnlyProperty(name: string, defaultValue?: any): void;
73
+ }
74
+
75
+ export declare class Menu extends EventEmitter {
76
+ constructor();
77
+ static getApplicationMenu(): Menu | null;
78
+ static setApplicationMenu(menu: Menu | null): void;
79
+ static sendActionToFirstResponder(action: string): void;
80
+ static buildFromTemplate(
81
+ template: Array<MenuItemConstructorOptions | MenuItem>
82
+ ): Menu;
83
+ popup(
84
+ options?: PopupOptions
85
+ ): {
86
+ lynxWindow: any;
87
+ x: number;
88
+ y: number;
89
+ position: number;
90
+ };
91
+ closePopup(window?: any): void;
92
+ getMenuItemById(id: string): MenuItem | null;
93
+ append(item: MenuItem): void;
94
+ insert(pos: number, item: MenuItem): void;
95
+ items: MenuItem[];
96
+ }
@@ -0,0 +1,268 @@
1
+ // Copyright 2026 The Lynxtron Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { Size } from '../structures/size';
6
+ import { Rectangle } from '../structures/rectangle';
7
+
8
+ export interface CreateFromBitmapOptions {
9
+ width: number;
10
+ height: number;
11
+ /**
12
+ * Defaults to 1.0.
13
+ */
14
+ scaleFactor?: number;
15
+ }
16
+
17
+ export interface CreateFromBufferOptions {
18
+ /**
19
+ * Required for bitmap buffers.
20
+ */
21
+ width?: number;
22
+ /**
23
+ * Required for bitmap buffers.
24
+ */
25
+ height?: number;
26
+ /**
27
+ * Defaults to 1.0.
28
+ */
29
+ scaleFactor?: number;
30
+ }
31
+
32
+ export interface AddRepresentationOptions {
33
+ /**
34
+ * The scale factor to add the image representation for.
35
+ */
36
+ scaleFactor?: number;
37
+ /**
38
+ * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
39
+ */
40
+ width?: number;
41
+ /**
42
+ * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
43
+ */
44
+ height?: number;
45
+ /**
46
+ * The buffer containing the raw image data.
47
+ */
48
+ buffer?: Buffer;
49
+ /**
50
+ * The data URL containing either a base 64 encoded PNG or JPEG image.
51
+ */
52
+ dataURL?: string;
53
+ }
54
+
55
+ export interface BitmapOptions {
56
+ /**
57
+ * Defaults to 1.0.
58
+ */
59
+ scaleFactor?: number;
60
+ }
61
+
62
+ export interface ResizeOptions {
63
+ /**
64
+ * Defaults to the image's width.
65
+ */
66
+ width?: number;
67
+ /**
68
+ * Defaults to the image's height.
69
+ */
70
+ height?: number;
71
+ /**
72
+ * The desired quality of the resize image. Possible values include `good`,
73
+ * `better`, or `best`. The default is `best`. These values express a desired
74
+ * quality/speed tradeoff. They are translated into an algorithm-specific method
75
+ * that depends on the capabilities (CPU, GPU) of the underlying platform. It is
76
+ * possible for all three methods to be mapped to the same algorithm on a given
77
+ * platform.
78
+ */
79
+ quality?: 'good' | 'better' | 'best';
80
+ }
81
+
82
+ export interface ToBitmapOptions {
83
+ /**
84
+ * Defaults to 1.0.
85
+ */
86
+ scaleFactor?: number;
87
+ }
88
+
89
+ export interface ToDataURLOptions {
90
+ /**
91
+ * Defaults to 1.0.
92
+ */
93
+ scaleFactor?: number;
94
+ }
95
+
96
+ export interface ToPNGOptions {
97
+ /**
98
+ * Defaults to 1.0.
99
+ */
100
+ scaleFactor?: number;
101
+ }
102
+
103
+ export declare class NativeImage {
104
+ /**
105
+ * Creates an empty `NativeImage` instance.
106
+ */
107
+ static createEmpty(): NativeImage;
108
+ /**
109
+ * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
110
+ * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
111
+ */
112
+ static createFromBitmap(
113
+ buffer: Buffer,
114
+ options: CreateFromBitmapOptions
115
+ ): NativeImage;
116
+ /**
117
+ * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
118
+ * JPEG first.
119
+ */
120
+ static createFromBuffer(
121
+ buffer: Buffer,
122
+ options?: CreateFromBufferOptions
123
+ ): NativeImage;
124
+ /**
125
+ * Creates a new `NativeImage` instance from `dataUrl`, a base 64 encoded Data URL
126
+ * string.
127
+ */
128
+ static createFromDataURL(dataURL: string): NativeImage;
129
+ /**
130
+ * Creates a new `NativeImage` instance from the `NSImage` that maps to the given
131
+ * image name. See Apple's `NSImageName` documentation for a list of possible
132
+ * values.
133
+ *
134
+ * The `hslShift` is applied to the image with the following rules:
135
+ *
136
+ * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
137
+ * and 360 on the hue color wheel (red).
138
+ * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
139
+ * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
140
+ * saturate the image.
141
+ * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
142
+ * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
143
+ * leave unchanged. 1 = full lightness (make all pixels white).
144
+ *
145
+ * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,0]`
146
+ * will make the image completely black.
147
+ *
148
+ * In some cases, the `NSImageName` doesn't match its string representation; one
149
+ * example of this is `NSFolderImageName`, whose string representation would
150
+ * actually be `NSFolder`. Therefore, you'll need to determine the correct string
151
+ * representation for your image before passing it in. This can be done with the
152
+ * following:
153
+ *
154
+ * where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
155
+ *
156
+ * @platform darwin
157
+ */
158
+ static createFromNamedImage(
159
+ imageName: string,
160
+ hslShift?: number[]
161
+ ): NativeImage;
162
+ /**
163
+ * Creates a new `NativeImage` instance from an image file (e.g., PNG or JPEG)
164
+ * located at `path`. This method returns an empty image if the `path` does not
165
+ * exist, cannot be read, or is not a valid image.
166
+ */
167
+ static createFromPath(path: string): NativeImage;
168
+ /**
169
+ * fulfilled with the file's thumbnail preview image, which is a NativeImage.
170
+ *
171
+ * Windows implementation will ignore `size.height` and scale the height
172
+ * according to `size.width`.
173
+ *
174
+ * @platform darwin,win32
175
+ */
176
+ static createThumbnailFromPath(
177
+ path: string,
178
+ size: Size
179
+ ): Promise<NativeImage>;
180
+ /**
181
+ * Add an image representation for a specific scale factor. This can be used to
182
+ * programmatically add different scale factor representations to an image. This
183
+ * can be called on empty images.
184
+ */
185
+ addRepresentation(options: AddRepresentationOptions): void;
186
+ /**
187
+ * The cropped image.
188
+ */
189
+ crop(rect: Rectangle): NativeImage;
190
+ /**
191
+ * The image's aspect ratio (width divided by height).
192
+ *
193
+ * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
194
+ * the image representation most closely matching the passed value.
195
+ */
196
+ getAspectRatio(scaleFactor?: number): number;
197
+ /**
198
+ * Legacy alias for `image.toBitmap()`.
199
+ *
200
+ * @deprecated Use `image.toBitmap()` instead.
201
+ */
202
+ getBitmap(options?: BitmapOptions): void;
203
+ /**
204
+ * A Buffer that stores C pointer to underlying native handle of the image. On
205
+ * macOS, a pointer to `NSImage` instance is returned.
206
+ *
207
+ * Notice that the returned pointer is a weak pointer to the underlying native
208
+ * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
209
+ * instance is kept around.
210
+ *
211
+ * @platform darwin
212
+ */
213
+ getNativeHandle(): Buffer;
214
+ /**
215
+ * An array of all scale factors corresponding to representations for a given
216
+ * `NativeImage`.
217
+ */
218
+ getScaleFactors(): number[];
219
+ /**
220
+ * If `scaleFactor` is passed, this will return the size corresponding to the image
221
+ * representation most closely matching the passed value.
222
+ */
223
+ getSize(scaleFactor?: number): Size;
224
+ /**
225
+ * Whether the image is empty.
226
+ */
227
+ isEmpty(): boolean;
228
+ /**
229
+ * Whether the image is a macOS template image.
230
+ */
231
+ isTemplateImage(): boolean;
232
+ /**
233
+ * The resized image.
234
+ *
235
+ * If only the `height` or the `width` are specified then the current aspect ratio
236
+ * will be preserved in the resized image.
237
+ */
238
+ resize(options: ResizeOptions): NativeImage;
239
+ /**
240
+ * Marks the image as a macOS template image.
241
+ */
242
+ setTemplateImage(option: boolean): void;
243
+ /**
244
+ * A Buffer that contains a copy of the image's raw bitmap pixel data.
245
+ */
246
+ toBitmap(options?: ToBitmapOptions): Buffer;
247
+ /**
248
+ * The Data URL of the image.
249
+ */
250
+ toDataURL(options?: ToDataURLOptions): string;
251
+ /**
252
+ * A Buffer that contains the image's `JPEG` encoded data.
253
+ */
254
+ toJPEG(quality: number): Buffer;
255
+ /**
256
+ * A Buffer that contains the image's `PNG` encoded data.
257
+ */
258
+ toPNG(options?: ToPNGOptions): Buffer;
259
+ /**
260
+ * A `boolean` property that determines whether the image is considered a template
261
+ * image.
262
+ *
263
+ * Please note that this property only has an effect on macOS.
264
+ *
265
+ * @platform darwin
266
+ */
267
+ isMacTemplateImage: boolean;
268
+ }
@@ -0,0 +1,26 @@
1
+ // Copyright 2026 The Lynxtron Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ export interface NotificationResponse {
6
+ /**
7
+ * The identifier string of the action that the user selected.
8
+ */
9
+ actionIdentifier: string;
10
+ /**
11
+ * The delivery date of the notification.
12
+ */
13
+ date: number;
14
+ /**
15
+ * The unique identifier for this notification request.
16
+ */
17
+ identifier: string;
18
+ /**
19
+ * A dictionary of custom information associated with the notification.
20
+ */
21
+ userInfo: Record<string, any>;
22
+ /**
23
+ * The text entered or chosen by the user.
24
+ */
25
+ userText?: string;
26
+ }
@@ -0,0 +1,242 @@
1
+ // Copyright 2026 The Lynxtron Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { EventEmitter } from 'node:events';
6
+
7
+ export interface NotificationAction {
8
+ /**
9
+ * The label for the given action.
10
+ */
11
+ text?: string;
12
+ /**
13
+ * The type of action, can be `button`.
14
+ */
15
+ type: 'button';
16
+ }
17
+
18
+ export interface NotificationConstructorOptions {
19
+ /**
20
+ * A title for the notification, which will be shown at the top of the notification
21
+ * window when it is shown.
22
+ */
23
+ title?: string;
24
+ /**
25
+ * A subtitle for the notification, which will be displayed below the title.
26
+ *
27
+ * @platform darwin
28
+ */
29
+ subtitle?: string;
30
+ /**
31
+ * The body text of the notification, which will be displayed below the title or
32
+ * subtitle.
33
+ */
34
+ body?: string;
35
+ /**
36
+ * Whether to show the notification without sound.
37
+ */
38
+ silent?: boolean;
39
+ /**
40
+ * An icon to use in the notification.
41
+ */
42
+ icon?: string;
43
+ /**
44
+ * Whether or not to add a reply option to the notification.
45
+ *
46
+ * @platform darwin
47
+ */
48
+ hasReply?: boolean;
49
+ /**
50
+ * The timeout duration of the notification. Can be 'default' or 'never'.
51
+ *
52
+ * @platform win32
53
+ */
54
+ timeoutType?: 'default' | 'never';
55
+ /**
56
+ * The placeholder to write in the reply input field.
57
+ *
58
+ * @platform darwin
59
+ */
60
+ replyPlaceholder?: string;
61
+ /**
62
+ * The name of the sound file to play when the notification is shown.
63
+ *
64
+ * @platform darwin
65
+ */
66
+ sound?: string;
67
+ /**
68
+ * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
69
+ *
70
+ * @platform linux
71
+ */
72
+ urgency?: 'normal' | 'critical' | 'low';
73
+ /**
74
+ * Actions to add to the notification.
75
+ *
76
+ * @platform darwin
77
+ */
78
+ actions?: NotificationAction[];
79
+ /**
80
+ * A custom title for the close button of an alert. An empty string will cause the
81
+ * default localized text to be used.
82
+ *
83
+ * @platform darwin
84
+ */
85
+ closeButtonText?: string;
86
+ /**
87
+ * A custom XML string to use for the toast notification.
88
+ *
89
+ * @platform win32
90
+ */
91
+ toastXml?: string;
92
+ }
93
+
94
+ export declare class Notification extends EventEmitter {
95
+ /**
96
+ * A `NotificationAction[]` property representing the actions of the notification.
97
+ */
98
+ actions: NotificationAction[];
99
+ /**
100
+ * A `string` property representing the body of the notification.
101
+ */
102
+ body: string;
103
+ /**
104
+ * A `string` property representing the close button text of the notification.
105
+ */
106
+ closeButtonText: string;
107
+ /**
108
+ * A `boolean` property representing whether the notification has a reply action.
109
+ */
110
+ hasReply: boolean;
111
+ /**
112
+ * A `string` property representing the reply placeholder of the notification.
113
+ */
114
+ replyPlaceholder: string;
115
+ /**
116
+ * A `boolean` property representing whether the notification is silent.
117
+ */
118
+ silent: boolean;
119
+ /**
120
+ * A `string` property representing the sound of the notification.
121
+ */
122
+ sound: string;
123
+ /**
124
+ * A `string` property representing the subtitle of the notification.
125
+ */
126
+ subtitle: string;
127
+ /**
128
+ * A `string` property representing the type of timeout duration for the
129
+ * notification. Can be 'default' or 'never'.
130
+ *
131
+ * If `timeoutType` is set to 'never', the notification never expires. It stays
132
+ * open until closed by the calling API or the user.
133
+ *
134
+ * @platform win32
135
+ */
136
+ timeoutType: 'default' | 'never';
137
+ /**
138
+ * A `string` property representing the title of the notification.
139
+ */
140
+ title: string;
141
+ /**
142
+ * A `string` property representing the custom Toast XML of the notification.
143
+ *
144
+ * @platform win32
145
+ */
146
+ toastXml: string;
147
+
148
+ constructor(options?: NotificationConstructorOptions);
149
+
150
+ /**
151
+ * Immediately shows the notification to the user.
152
+ */
153
+ public show(): void;
154
+
155
+ /**
156
+ * Dismisses the notification.
157
+ */
158
+ public close(): void;
159
+
160
+ /**
161
+ * Whether or not desktop notifications are supported on the current system.
162
+ */
163
+ public static isSupported(): boolean;
164
+
165
+ /**
166
+ * Emitted when the notification is shown to the user.
167
+ */
168
+ on(event: 'show', listener: () => void): this;
169
+ off(event: 'show', listener: () => void): this;
170
+ once(event: 'show', listener: () => void): this;
171
+ addListener(event: 'show', listener: () => void): this;
172
+ removeListener(event: 'show', listener: () => void): this;
173
+
174
+ /**
175
+ * Emitted when the notification is clicked by the user.
176
+ */
177
+ on(event: 'click', listener: () => void): this;
178
+ off(event: 'click', listener: () => void): this;
179
+ once(event: 'click', listener: () => void): this;
180
+ addListener(event: 'click', listener: () => void): this;
181
+ removeListener(event: 'click', listener: () => void): this;
182
+
183
+ /**
184
+ * Emitted when the notification is closed by manual intervention from the user.
185
+ */
186
+ on(event: 'close', listener: () => void): this;
187
+ off(event: 'close', listener: () => void): this;
188
+ once(event: 'close', listener: () => void): this;
189
+ addListener(event: 'close', listener: () => void): this;
190
+ removeListener(event: 'close', listener: () => void): this;
191
+
192
+ /**
193
+ * Emitted when the user clicks the "Reply" button on a notification with `hasReply: true`.
194
+ *
195
+ * @platform darwin
196
+ */
197
+ on(event: 'reply', listener: (event: Event, reply: string) => void): this;
198
+ off(event: 'reply', listener: (event: Event, reply: string) => void): this;
199
+ once(event: 'reply', listener: (event: Event, reply: string) => void): this;
200
+ addListener(
201
+ event: 'reply',
202
+ listener: (event: Event, reply: string) => void
203
+ ): this;
204
+ removeListener(
205
+ event: 'reply',
206
+ listener: (event: Event, reply: string) => void
207
+ ): this;
208
+
209
+ /**
210
+ * Emitted when the user clicks one of the actions on a notification.
211
+ *
212
+ * @platform darwin
213
+ */
214
+ on(event: 'action', listener: (event: Event, index: number) => void): this;
215
+ off(event: 'action', listener: (event: Event, index: number) => void): this;
216
+ once(event: 'action', listener: (event: Event, index: number) => void): this;
217
+ addListener(
218
+ event: 'action',
219
+ listener: (event: Event, index: number) => void
220
+ ): this;
221
+ removeListener(
222
+ event: 'action',
223
+ listener: (event: Event, index: number) => void
224
+ ): this;
225
+
226
+ /**
227
+ * Emitted when an error is encountered while showing the notification.
228
+ *
229
+ * @platform win32
230
+ */
231
+ on(event: 'failed', listener: (event: Event, error: string) => void): this;
232
+ off(event: 'failed', listener: (event: Event, error: string) => void): this;
233
+ once(event: 'failed', listener: (event: Event, error: string) => void): this;
234
+ addListener(
235
+ event: 'failed',
236
+ listener: (event: Event, error: string) => void
237
+ ): this;
238
+ removeListener(
239
+ event: 'failed',
240
+ listener: (event: Event, error: string) => void
241
+ ): this;
242
+ }