@lynx-js/lynxtron 0.0.1 → 0.0.2
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/README.md +80 -0
- package/apis/api/app.d.ts +1848 -0
- package/apis/api/asar.d.ts +124 -0
- package/apis/api/base-window.d.ts +1712 -0
- package/apis/api/clipboard.d.ts +54 -0
- package/apis/api/command-line.d.ts +46 -0
- package/apis/api/context-bridge.d.ts +8 -0
- package/apis/api/devtool.d.ts +34 -0
- package/apis/api/dialog.d.ts +633 -0
- package/apis/api/dock.d.ts +88 -0
- package/apis/api/environment.d.ts +9 -0
- package/apis/api/event.d.ts +8 -0
- package/apis/api/jump-list-item.d.ts +83 -0
- package/apis/api/lynx-library.d.ts +7 -0
- package/apis/api/lynx-template-bundle.d.ts +32 -0
- package/apis/api/lynx-template-data.d.ts +10 -0
- package/apis/api/lynx-update-meta.d.ts +16 -0
- package/apis/api/lynx-window.d.ts +405 -0
- package/apis/api/menu.d.ts +96 -0
- package/apis/api/native-image.d.ts +268 -0
- package/apis/api/notification-response.d.ts +26 -0
- package/apis/api/notification.d.ts +242 -0
- package/apis/api/power-monitor.d.ts +121 -0
- package/apis/api/process-metric.d.ts +93 -0
- package/apis/api/protocol.d.ts +54 -0
- package/apis/api/screen.d.ts +222 -0
- package/apis/api/shell.d.ts +124 -0
- package/apis/api/task.d.ts +39 -0
- package/apis/api/touch-bar.d.ts +206 -0
- package/apis/api/tray.d.ts +44 -0
- package/apis/api/utility-process.d.ts +73 -0
- package/apis/lynx.d.ts +15 -0
- package/apis/lynxtron.d.ts +39 -0
- package/apis/structures/point.d.ts +10 -0
- package/apis/structures/rectangle.d.ts +22 -0
- package/apis/structures/size.d.ts +8 -0
- package/apis/web-host.d.ts +24 -0
- package/cli.js +28 -0
- package/context-bridge.js +6 -0
- package/fuses-cli.js +143 -0
- package/fuses.js +299 -0
- package/install.js +127 -0
- package/lynx.js +1 -0
- package/lynxtron.js +43 -0
- package/lynxtron_bin.js +10 -0
- package/native-paths.cjs +38 -0
- package/package.json +71 -4
- package/utils/download.js +72 -0
- package/utils/env-config.js +35 -0
- package/web-host/index.js +110 -0
- package/web-worker.js +12 -0
|
@@ -0,0 +1,88 @@
|
|
|
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 { Menu } from './menu';
|
|
6
|
+
import { NativeImage } from './native-image';
|
|
7
|
+
|
|
8
|
+
export declare class Dock {
|
|
9
|
+
/**
|
|
10
|
+
* an ID representing the request.
|
|
11
|
+
*
|
|
12
|
+
* When `critical` is passed, the dock icon will bounce until either the
|
|
13
|
+
* application becomes active or the request is canceled.
|
|
14
|
+
*
|
|
15
|
+
* When `informational` is passed, the dock icon will bounce for one second.
|
|
16
|
+
* However, the request remains active until either the application becomes active
|
|
17
|
+
* or the request is canceled.
|
|
18
|
+
*
|
|
19
|
+
* > [!NOTE] This method can only be used while the app is not focused; when the
|
|
20
|
+
* app is focused it will return -1.
|
|
21
|
+
*
|
|
22
|
+
* @platform darwin
|
|
23
|
+
*/
|
|
24
|
+
bounce(type?: 'critical' | 'informational'): number;
|
|
25
|
+
/**
|
|
26
|
+
* Cancel the bounce of `id`.
|
|
27
|
+
*
|
|
28
|
+
* @platform darwin
|
|
29
|
+
*/
|
|
30
|
+
cancelBounce(id: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Bounces the Downloads stack if the filePath is inside the Downloads folder.
|
|
33
|
+
*
|
|
34
|
+
* @platform darwin
|
|
35
|
+
*/
|
|
36
|
+
downloadFinished(filePath: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* The badge string of the dock.
|
|
39
|
+
*
|
|
40
|
+
* @platform darwin
|
|
41
|
+
*/
|
|
42
|
+
getBadge(): string;
|
|
43
|
+
/**
|
|
44
|
+
* The application's dock menu.
|
|
45
|
+
*
|
|
46
|
+
* @platform darwin
|
|
47
|
+
*/
|
|
48
|
+
getMenu(): Menu | null;
|
|
49
|
+
/**
|
|
50
|
+
* Hides the dock icon.
|
|
51
|
+
*
|
|
52
|
+
* @platform darwin
|
|
53
|
+
*/
|
|
54
|
+
hide(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the dock icon is visible.
|
|
57
|
+
*
|
|
58
|
+
* @platform darwin
|
|
59
|
+
*/
|
|
60
|
+
isVisible(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Sets the string to be displayed in the dock’s badging area.
|
|
63
|
+
*
|
|
64
|
+
* > [!IMPORTANT] You need to ensure that your application has the permission to
|
|
65
|
+
* display notifications for this method to work.
|
|
66
|
+
*
|
|
67
|
+
* @platform darwin
|
|
68
|
+
*/
|
|
69
|
+
setBadge(text: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Sets the `image` associated with this dock icon.
|
|
72
|
+
*
|
|
73
|
+
* @platform darwin
|
|
74
|
+
*/
|
|
75
|
+
setIcon(image: NativeImage | string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Sets the application's dock menu.
|
|
78
|
+
*
|
|
79
|
+
* @platform darwin
|
|
80
|
+
*/
|
|
81
|
+
setMenu(menu: Menu): void;
|
|
82
|
+
/**
|
|
83
|
+
* Resolves when the dock icon is shown.
|
|
84
|
+
*
|
|
85
|
+
* @platform darwin
|
|
86
|
+
*/
|
|
87
|
+
show(): Promise<void>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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 declare function getVar(name: string): string | null;
|
|
6
|
+
|
|
7
|
+
export declare function hasVar(name: string): boolean;
|
|
8
|
+
|
|
9
|
+
export declare function setVar(name: string, value: string): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 type Event<Params extends object = {}> = {
|
|
6
|
+
preventDefault: () => void;
|
|
7
|
+
readonly defaultPrevented: boolean;
|
|
8
|
+
} & Params;
|
|
@@ -0,0 +1,83 @@
|
|
|
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 JumpListCategory {
|
|
6
|
+
/**
|
|
7
|
+
* Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
|
|
8
|
+
* should be omitted.
|
|
9
|
+
*/
|
|
10
|
+
items?: JumpListItem[];
|
|
11
|
+
/**
|
|
12
|
+
* Must be set if `type` is `custom`, otherwise it should be omitted.
|
|
13
|
+
*/
|
|
14
|
+
name?: string;
|
|
15
|
+
/**
|
|
16
|
+
* One of the following:
|
|
17
|
+
*/
|
|
18
|
+
type?: 'tasks' | 'frequent' | 'recent' | 'custom';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface JumpListSettings {
|
|
22
|
+
/**
|
|
23
|
+
* The minimum number of items that will be shown in the Jump List (for a more
|
|
24
|
+
* detailed description of this value see the MSDN docs).
|
|
25
|
+
*/
|
|
26
|
+
minItems: number;
|
|
27
|
+
/**
|
|
28
|
+
* Array of `JumpListItem` objects that correspond to items that the user has
|
|
29
|
+
* explicitly removed from custom categories in the Jump List. These items must not
|
|
30
|
+
* be re-added to the Jump List in the **next** call to `app.setJumpList()`,
|
|
31
|
+
* Windows will not display any custom category that contains any of the removed
|
|
32
|
+
* items.
|
|
33
|
+
*/
|
|
34
|
+
removedItems: JumpListItem[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface JumpListItem {
|
|
38
|
+
/**
|
|
39
|
+
* The command line arguments when `program` is executed. Should only be set if
|
|
40
|
+
* `type` is `task`.
|
|
41
|
+
*/
|
|
42
|
+
args?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Description of the task (displayed in a tooltip). Should only be set if `type`
|
|
45
|
+
* is `task`. Maximum length 260 characters.
|
|
46
|
+
*/
|
|
47
|
+
description?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The index of the icon in the resource file. If a resource file contains multiple
|
|
50
|
+
* icons this value can be used to specify the zero-based index of the icon that
|
|
51
|
+
* should be displayed for this task. If a resource file contains only one icon,
|
|
52
|
+
* this property should be set to zero.
|
|
53
|
+
*/
|
|
54
|
+
iconIndex?: number;
|
|
55
|
+
/**
|
|
56
|
+
* The absolute path to an icon to be displayed in a Jump List, which can be an
|
|
57
|
+
* arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
|
|
58
|
+
* can usually specify `process.execPath` to show the program icon.
|
|
59
|
+
*/
|
|
60
|
+
iconPath?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Path of the file to open, should only be set if `type` is `file`.
|
|
63
|
+
*/
|
|
64
|
+
path?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Path of the program to execute, usually you should specify `process.execPath`
|
|
67
|
+
* which opens the current program. Should only be set if `type` is `task`.
|
|
68
|
+
*/
|
|
69
|
+
program?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The text to be displayed for the item in the Jump List. Should only be set if
|
|
72
|
+
* `type` is `task`.
|
|
73
|
+
*/
|
|
74
|
+
title?: string;
|
|
75
|
+
/**
|
|
76
|
+
* One of the following:
|
|
77
|
+
*/
|
|
78
|
+
type?: 'task' | 'separator' | 'file';
|
|
79
|
+
/**
|
|
80
|
+
* The working directory. Default is empty.
|
|
81
|
+
*/
|
|
82
|
+
workingDirectory?: string;
|
|
83
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
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 type LynxLibraryRegistry = Record<never, never>;
|
|
6
|
+
|
|
7
|
+
export declare const lynx: LynxLibraryRegistry;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 class LynxTemplateBundle {
|
|
6
|
+
/**
|
|
7
|
+
* A pre-decoded Lynx template bundle.
|
|
8
|
+
*
|
|
9
|
+
* This class corresponds to Lynx SDK's `LynxTemplateBundle` (TemplateBundle),
|
|
10
|
+
* which is the output of Lynx's pre-decode capability. You can parse a Lynx
|
|
11
|
+
* App Bundle ahead of time to obtain a TemplateBundle and then load it via
|
|
12
|
+
* `LynxWindow.loadBundle(templateBundle)` for faster startup.
|
|
13
|
+
*
|
|
14
|
+
* Notes:
|
|
15
|
+
* - A LynxTemplateBundle instance can be non-null but still invalid. Use
|
|
16
|
+
* `isValid()` to check and `getErrorMessage()` to inspect the parsing error.
|
|
17
|
+
* - The constructor accepts either a Node.js `Buffer` or any `ArrayBufferView`
|
|
18
|
+
* containing the bundle bytes.
|
|
19
|
+
*/
|
|
20
|
+
constructor(buffer: Buffer | ArrayBufferView);
|
|
21
|
+
/**
|
|
22
|
+
* Returns whether this TemplateBundle is valid.
|
|
23
|
+
*/
|
|
24
|
+
isValid(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns an error message when the TemplateBundle is invalid, otherwise an
|
|
27
|
+
* empty string.
|
|
28
|
+
*/
|
|
29
|
+
getErrorMessage(): string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default LynxTemplateBundle;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 class LynxTemplateData<T extends object = Record<string, unknown>> {
|
|
6
|
+
constructor(value: T);
|
|
7
|
+
toObject(): T;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default LynxTemplateData;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 type LynxTemplateData from './lynx-template-data';
|
|
6
|
+
|
|
7
|
+
export class LynxUpdateMeta {
|
|
8
|
+
constructor(init?: {
|
|
9
|
+
updateData?: LynxTemplateData;
|
|
10
|
+
globalProps?: LynxTemplateData;
|
|
11
|
+
});
|
|
12
|
+
updateData: LynxTemplateData;
|
|
13
|
+
globalProps: LynxTemplateData;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default LynxUpdateMeta;
|
|
@@ -0,0 +1,405 @@
|
|
|
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 { NativeImage } from './native-image';
|
|
6
|
+
import { BaseWindow, WillResizeDetails } from './base-window';
|
|
7
|
+
import { LynxTemplateBundle } from './lynx-template-bundle';
|
|
8
|
+
import { LynxUpdateMeta } from './lynx-update-meta';
|
|
9
|
+
import { Point } from '../structures/point';
|
|
10
|
+
import { Rectangle } from '../structures/rectangle';
|
|
11
|
+
|
|
12
|
+
export interface LynxPreference {
|
|
13
|
+
/**
|
|
14
|
+
* Script path to load before the Lynx page runs, mirroring Electron's
|
|
15
|
+
* `webPreferences.preload` option.
|
|
16
|
+
*/
|
|
17
|
+
preload?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface LynxWindowConstructorOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Window's width in pixels. Default is `800`.
|
|
23
|
+
*/
|
|
24
|
+
width?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Window's height in pixels. Default is `600`.
|
|
27
|
+
*/
|
|
28
|
+
height?: number;
|
|
29
|
+
/**
|
|
30
|
+
* (**required** if y is used) Window's left offset from screen. Default is to
|
|
31
|
+
* center the window.
|
|
32
|
+
*/
|
|
33
|
+
x?: number;
|
|
34
|
+
/**
|
|
35
|
+
* (**required** if x is used) Window's top offset from screen. Default is to
|
|
36
|
+
* center the window.
|
|
37
|
+
*/
|
|
38
|
+
y?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The `width` and `height` would be used as the content area's size, which means
|
|
41
|
+
* the actual window's size will include the window frame's size and be slightly
|
|
42
|
+
* larger. Default is `false`.
|
|
43
|
+
*/
|
|
44
|
+
useContentSize?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Show window in the center of the screen.
|
|
47
|
+
*/
|
|
48
|
+
center?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Window's minimum width. Default is `0`.
|
|
51
|
+
*/
|
|
52
|
+
minWidth?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Window's minimum height. Default is `0`.
|
|
55
|
+
*/
|
|
56
|
+
minHeight?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Window's maximum width. Default is no limit.
|
|
59
|
+
*/
|
|
60
|
+
maxWidth?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Window's maximum height. Default is no limit.
|
|
63
|
+
*/
|
|
64
|
+
maxHeight?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Whether window is resizable. Default is `true`.
|
|
67
|
+
*/
|
|
68
|
+
resizable?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether window is movable. This is not implemented on Linux. Default is `true`.
|
|
71
|
+
*/
|
|
72
|
+
movable?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether window is minimizable. This is not implemented on Linux. Default is
|
|
75
|
+
* `true`.
|
|
76
|
+
*/
|
|
77
|
+
minimizable?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether window is maximizable. This is not implemented on Linux. Default is
|
|
80
|
+
* `true`.
|
|
81
|
+
*/
|
|
82
|
+
maximizable?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Whether window is closable. This is not implemented on Linux. Default is `true`.
|
|
85
|
+
*/
|
|
86
|
+
closable?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Whether the window can be focused. Default is `true`. On Windows setting
|
|
89
|
+
* `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
|
|
90
|
+
* `focusable: false` makes the window stop interacting with wm, so the window will
|
|
91
|
+
* always stay on top in all workspaces.
|
|
92
|
+
*/
|
|
93
|
+
focusable?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the window should always stay on top of other windows. Default is
|
|
96
|
+
* `false`.
|
|
97
|
+
*/
|
|
98
|
+
alwaysOnTop?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the window should show in fullscreen. When explicitly set to `false` the
|
|
101
|
+
* fullscreen button will be hidden or disabled on macOS. Default is `false`.
|
|
102
|
+
*/
|
|
103
|
+
fullscreen?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the window can be put into fullscreen mode. On macOS, also whether the
|
|
106
|
+
* maximize/zoom button should toggle full screen mode or maximize window. Default
|
|
107
|
+
* is `true`.
|
|
108
|
+
*/
|
|
109
|
+
fullscreenable?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Use pre-Lion fullscreen on macOS. Default is `false`.
|
|
112
|
+
*/
|
|
113
|
+
simpleFullscreen?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Whether to show the window in taskbar. Default is `false`.
|
|
116
|
+
*/
|
|
117
|
+
skipTaskbar?: boolean;
|
|
118
|
+
hiddenInMissionControl?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* The window icon. On Windows it is recommended to use `ICO` icons to get best
|
|
121
|
+
* visual effects, you can also leave it undefined so the executable's icon will be
|
|
122
|
+
* used.
|
|
123
|
+
*/
|
|
124
|
+
icon?: NativeImage | string;
|
|
125
|
+
/**
|
|
126
|
+
* Whether window should be shown when created. Default is `true`.
|
|
127
|
+
*/
|
|
128
|
+
show?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Specify `false` to create a [Frameless Window]. Default is `true`.
|
|
131
|
+
*/
|
|
132
|
+
frame?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Specify parent window. Default is `null`.
|
|
135
|
+
*/
|
|
136
|
+
parent?: LynxWindow;
|
|
137
|
+
/**
|
|
138
|
+
* Whether this is a modal window. This only works when the window is a child
|
|
139
|
+
* window. Default is `false`.
|
|
140
|
+
*/
|
|
141
|
+
modal?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Whether to hide cursor when typing. Default is `false`.
|
|
144
|
+
*/
|
|
145
|
+
disableAutoHideCursor?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
|
|
148
|
+
*/
|
|
149
|
+
autoHideMenuBar?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Enable the window to be resized larger than screen. Only relevant for macOS, as
|
|
152
|
+
* other OSes allow larger-than-screen windows by default. Default is `false`.
|
|
153
|
+
*/
|
|
154
|
+
enableLargerThanScreen?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Window's background color as a hexadecimal value, like `#66CD00` or `#FFF` or
|
|
157
|
+
* `#80FFFFFF` (alpha in #AARRGGBB format is supported if `transparent` is set to
|
|
158
|
+
* `true`). Default is `#FFF` (white).
|
|
159
|
+
*/
|
|
160
|
+
backgroundColor?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Whether window should have a shadow. Default is `true`.
|
|
163
|
+
*/
|
|
164
|
+
hasShadow?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
|
|
167
|
+
* (fully opaque). This is only implemented on Windows and macOS.
|
|
168
|
+
*/
|
|
169
|
+
opacity?: number;
|
|
170
|
+
/**
|
|
171
|
+
* Makes the window [transparent]. Default is `false`. On Windows, does not work
|
|
172
|
+
* unless the window is frameless.
|
|
173
|
+
*/
|
|
174
|
+
transparent?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* The type of window, default is normal window. See more about this below.
|
|
177
|
+
*/
|
|
178
|
+
type?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Specify how the material appearance should reflect window activity state on
|
|
181
|
+
* macOS. Must be used with the `vibrancy` property. Possible values are:
|
|
182
|
+
*/
|
|
183
|
+
visualEffectState?: 'followWindow' | 'active' | 'inactive';
|
|
184
|
+
/**
|
|
185
|
+
* The style of window title bar. Default is `default`. Only supported on macOS.
|
|
186
|
+
* Other platforms ignore this option.
|
|
187
|
+
*
|
|
188
|
+
* @platform darwin
|
|
189
|
+
*/
|
|
190
|
+
titleBarStyle?: 'default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover';
|
|
191
|
+
/**
|
|
192
|
+
* Set a custom position for the traffic light buttons in frameless windows.
|
|
193
|
+
*/
|
|
194
|
+
trafficLightPosition?: Point;
|
|
195
|
+
/**
|
|
196
|
+
* Whether frameless window should have rounded corners on macOS. Default is
|
|
197
|
+
* `true`.
|
|
198
|
+
*/
|
|
199
|
+
roundedCorners?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
|
|
202
|
+
* window frame. Setting it to `false` will remove window shadow and window
|
|
203
|
+
* animations. Default is `true`.
|
|
204
|
+
*/
|
|
205
|
+
thickFrame?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Add a type of vibrancy effect to the window, only on macOS. Can be
|
|
208
|
+
* `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
|
|
209
|
+
* `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
|
|
210
|
+
* `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
|
|
211
|
+
* note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
|
|
212
|
+
* are deprecated and have been removed in macOS Catalina (10.15).
|
|
213
|
+
*/
|
|
214
|
+
vibrancy?:
|
|
215
|
+
| 'appearance-based'
|
|
216
|
+
| 'light'
|
|
217
|
+
| 'dark'
|
|
218
|
+
| 'titlebar'
|
|
219
|
+
| 'selection'
|
|
220
|
+
| 'menu'
|
|
221
|
+
| 'popover'
|
|
222
|
+
| 'sidebar'
|
|
223
|
+
| 'medium-light'
|
|
224
|
+
| 'ultra-dark'
|
|
225
|
+
| 'header'
|
|
226
|
+
| 'sheet'
|
|
227
|
+
| 'window'
|
|
228
|
+
| 'hud'
|
|
229
|
+
| 'fullscreen-ui'
|
|
230
|
+
| 'tooltip'
|
|
231
|
+
| 'content'
|
|
232
|
+
| 'under-window'
|
|
233
|
+
| 'under-page';
|
|
234
|
+
/**
|
|
235
|
+
* Tab group name, allows opening the window as a native tab on macOS 10.12+.
|
|
236
|
+
* Windows with the same tabbing identifier will be grouped together. This also
|
|
237
|
+
* adds a native new tab button to your window's tab bar and allows your `app` and
|
|
238
|
+
* window to receive the `new-window-for-tab` event.
|
|
239
|
+
*/
|
|
240
|
+
tabbingIdentifier?: string;
|
|
241
|
+
/**
|
|
242
|
+
* Lynx page preferences.
|
|
243
|
+
*/
|
|
244
|
+
lynxPreference?: LynxPreference;
|
|
245
|
+
|
|
246
|
+
title?: string;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface LynxBridgeInvokeEvent {
|
|
250
|
+
sendReply(result?: unknown): boolean;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export type LynxBridgeInvokeListener = (
|
|
254
|
+
event: LynxBridgeInvokeEvent,
|
|
255
|
+
methodName: string,
|
|
256
|
+
params: unknown
|
|
257
|
+
) => void | Promise<void>;
|
|
258
|
+
|
|
259
|
+
export type LynxBridgeMessageListener = (
|
|
260
|
+
methodName: string,
|
|
261
|
+
params: unknown
|
|
262
|
+
) => void;
|
|
263
|
+
|
|
264
|
+
export declare class LynxWindow extends BaseWindow {
|
|
265
|
+
/**
|
|
266
|
+
* LynxWindow
|
|
267
|
+
*/
|
|
268
|
+
constructor(options?: LynxWindowConstructorOptions);
|
|
269
|
+
on(event: '-lynx-invoke', listener: LynxBridgeInvokeListener): this;
|
|
270
|
+
on(event: '-lynx-message', listener: LynxBridgeMessageListener): this;
|
|
271
|
+
on(
|
|
272
|
+
event: 'app-command',
|
|
273
|
+
listener: (event: Event, command: string) => void
|
|
274
|
+
): this;
|
|
275
|
+
on(event: 'blur', listener: (event: Event) => void): this;
|
|
276
|
+
on(event: 'close', listener: (event: Event) => void): this;
|
|
277
|
+
on(event: 'closed', listener: () => void): this;
|
|
278
|
+
on(event: 'will-enter-full-screen', listener: () => void): this;
|
|
279
|
+
on(event: 'enter-full-screen', listener: () => void): this;
|
|
280
|
+
on(event: 'focus', listener: (event: Event) => void): this;
|
|
281
|
+
on(event: 'hide', listener: () => void): this;
|
|
282
|
+
on(event: 'will-leave-full-screen', listener: () => void): this;
|
|
283
|
+
on(event: 'leave-full-screen', listener: () => void): this;
|
|
284
|
+
on(event: 'maximize', listener: () => void): this;
|
|
285
|
+
on(event: 'minimize', listener: () => void): this;
|
|
286
|
+
on(event: 'move', listener: () => void): this;
|
|
287
|
+
on(event: 'moved', listener: () => void): this;
|
|
288
|
+
on(event: 'resize', listener: () => void): this;
|
|
289
|
+
on(event: 'resized', listener: () => void): this;
|
|
290
|
+
on(event: 'restore', listener: () => void): this;
|
|
291
|
+
on(
|
|
292
|
+
event: 'always-on-top-changed',
|
|
293
|
+
listener: (event: Event, isAlwaysOnTop: boolean) => void
|
|
294
|
+
): this;
|
|
295
|
+
on(
|
|
296
|
+
event: 'rotate-gesture',
|
|
297
|
+
listener: (event: Event, rotation: number) => void
|
|
298
|
+
): this;
|
|
299
|
+
on(event: 'session-end', listener: (event: any) => void): this;
|
|
300
|
+
on(event: 'sheet-begin', listener: () => void): this;
|
|
301
|
+
on(event: 'sheet-end', listener: () => void): this;
|
|
302
|
+
on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
|
|
303
|
+
on(event: 'show', listener: () => void): this;
|
|
304
|
+
on(event: 'swipe', listener: (event: Event, direction: string) => void): this;
|
|
305
|
+
on(
|
|
306
|
+
event: 'system-context-menu',
|
|
307
|
+
listener: (event: Event, point: Point) => void
|
|
308
|
+
): this;
|
|
309
|
+
on(event: 'unmaximize', listener: () => void): this;
|
|
310
|
+
on(
|
|
311
|
+
event: 'will-move',
|
|
312
|
+
listener: (event: Event, newBounds: Rectangle) => void
|
|
313
|
+
): this;
|
|
314
|
+
on(
|
|
315
|
+
event: 'will-resize',
|
|
316
|
+
listener: (
|
|
317
|
+
event: Event,
|
|
318
|
+
newBounds: Rectangle,
|
|
319
|
+
details: WillResizeDetails
|
|
320
|
+
) => void
|
|
321
|
+
): this;
|
|
322
|
+
/**
|
|
323
|
+
* The window with the given `id`.
|
|
324
|
+
*/
|
|
325
|
+
static fromId(id: number): LynxWindow | null;
|
|
326
|
+
/**
|
|
327
|
+
* An array of all opened windows.
|
|
328
|
+
*/
|
|
329
|
+
static getAllWindows(): LynxWindow[];
|
|
330
|
+
/**
|
|
331
|
+
* The window that is focused in this application, otherwise returns `null`.
|
|
332
|
+
*/
|
|
333
|
+
static getFocusedWindow(): LynxWindow | null;
|
|
334
|
+
tabbingIdentifier: string;
|
|
335
|
+
/**
|
|
336
|
+
* Starts loading a Lynx bundle from a local file path.
|
|
337
|
+
*
|
|
338
|
+
* Returns `true` when the request is accepted synchronously. Final load
|
|
339
|
+
* completion is reported asynchronously via window events such as
|
|
340
|
+
* `ready-to-show` and `--lynx-error`.
|
|
341
|
+
*/
|
|
342
|
+
loadFile(
|
|
343
|
+
filePath: string,
|
|
344
|
+
options?: {
|
|
345
|
+
data?: Object;
|
|
346
|
+
globalProps?: Object;
|
|
347
|
+
}
|
|
348
|
+
): boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Load a Lynx bundle from a URL.
|
|
351
|
+
*
|
|
352
|
+
* Supported URLs include remote URLs such as `https://...` and local file
|
|
353
|
+
* URLs such as `file:///abs/path/to/main.lynx.bundle`.
|
|
354
|
+
*
|
|
355
|
+
* Returns `true` when the request is accepted synchronously. Final load
|
|
356
|
+
* completion is reported asynchronously via window events such as
|
|
357
|
+
* `ready-to-show` and `--lynx-error`.
|
|
358
|
+
*/
|
|
359
|
+
loadURL(
|
|
360
|
+
url: string,
|
|
361
|
+
options?: {
|
|
362
|
+
data?: Object;
|
|
363
|
+
globalProps?: Object;
|
|
364
|
+
}
|
|
365
|
+
): boolean;
|
|
366
|
+
/**
|
|
367
|
+
* Load a pre-decoded Lynx template bundle.
|
|
368
|
+
*
|
|
369
|
+
* Returns `true` when the request is accepted synchronously. Final load
|
|
370
|
+
* completion is reported asynchronously via window events such as
|
|
371
|
+
* `ready-to-show` and `--lynx-error`.
|
|
372
|
+
*/
|
|
373
|
+
loadBundle(
|
|
374
|
+
templateBundle: LynxTemplateBundle,
|
|
375
|
+
options?: {
|
|
376
|
+
data?: Object;
|
|
377
|
+
globalProps?: Object;
|
|
378
|
+
}
|
|
379
|
+
): boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Updates the Lynx view with new template data.
|
|
382
|
+
*
|
|
383
|
+
* This is the primary entry point for triggering template data updates on the client side.
|
|
384
|
+
*
|
|
385
|
+
* - `meta.updateData`: Template data content used to update the page.
|
|
386
|
+
* - `meta.globalProps`: Global props content used to update the page.
|
|
387
|
+
*
|
|
388
|
+
* When called before the first template load, updates are cached and applied after the view is created and the first load finishes.
|
|
389
|
+
*/
|
|
390
|
+
updateMetaData(meta: LynxUpdateMeta): boolean;
|
|
391
|
+
/**
|
|
392
|
+
* Set global props for the Lynx view.
|
|
393
|
+
*
|
|
394
|
+
* This is the primary entry point for setting global props on the client side.
|
|
395
|
+
*
|
|
396
|
+
* When called before the first template load, updates are cached and applied after the view is created and the first load finishes.
|
|
397
|
+
*/
|
|
398
|
+
setGlobalProps(globalProps: Object): boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Send global event to the window.
|
|
401
|
+
* Lynx-side GlobalEventListener signature:
|
|
402
|
+
* `(...args) => { }`
|
|
403
|
+
*/
|
|
404
|
+
sendGlobalEvent(eventName: string, ...args: any[]): boolean;
|
|
405
|
+
}
|