@lynx-js/lynxtron 0.0.1-alpha.6 → 0.0.1-alpha.8
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/apis/api/base-window.d.ts +4 -4
- package/apis/api/lynx-bridge.d.ts +34 -0
- package/apis/api/lynx-window.d.ts +12 -3
- package/apis/lynxtron.d.ts +1 -0
- package/lynxtron.js +1 -0
- package/package.json +1 -1
- package/utils/env-config.js +2 -2
|
@@ -742,10 +742,10 @@ export declare class BaseWindow extends EventEmitter {
|
|
|
742
742
|
listener: (event: Event, direction: string) => void
|
|
743
743
|
): this;
|
|
744
744
|
/**
|
|
745
|
-
* Emitted when the system context menu is triggered on the window
|
|
746
|
-
* normally
|
|
747
|
-
*
|
|
748
|
-
* `-
|
|
745
|
+
* Emitted when the system context menu is triggered on the window. This is
|
|
746
|
+
* normally triggered when the user right clicks the system title bar or a
|
|
747
|
+
* draggable region in the Lynx UI. In a frameless window, draggable regions
|
|
748
|
+
* must be explicitly declared using the `-x-app-region: drag` CSS property.
|
|
749
749
|
*
|
|
750
750
|
* Calling `event.preventDefault()` will prevent the menu from being displayed.
|
|
751
751
|
*
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { LynxBridgeInvokeEvent } from './lynx-window';
|
|
6
|
+
|
|
7
|
+
export type LynxBridgeHandler = (
|
|
8
|
+
event: LynxBridgeInvokeEvent,
|
|
9
|
+
args: unknown
|
|
10
|
+
) => unknown | Promise<unknown>;
|
|
11
|
+
|
|
12
|
+
export interface LynxBridge extends NodeJS.EventEmitter {
|
|
13
|
+
/**
|
|
14
|
+
* Register a handler for an invoke method. The handler will be called when
|
|
15
|
+
* the Lynx side calls `bridge.call(method, args)`.
|
|
16
|
+
*
|
|
17
|
+
* The return value of the handler will be sent back to the Lynx side via
|
|
18
|
+
* `event.sendReply()`.
|
|
19
|
+
*/
|
|
20
|
+
handle(method: string, handler: LynxBridgeHandler): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Register a one-time handler for an invoke method. The handler will be
|
|
24
|
+
* removed after it is called once.
|
|
25
|
+
*/
|
|
26
|
+
handleOnce(method: string, handler: LynxBridgeHandler): void;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Remove a previously registered handler for the given method.
|
|
30
|
+
*/
|
|
31
|
+
removeHandler(method: string): void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare const lynxBridge: LynxBridge;
|
|
@@ -26,6 +26,15 @@ export interface LynxWindowConstructorOptions {
|
|
|
26
26
|
* Window's height in pixels. Default is `600`.
|
|
27
27
|
*/
|
|
28
28
|
height?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Device scale factor used by windowless rendering. Default is `1`.
|
|
31
|
+
*/
|
|
32
|
+
deviceScaleFactor?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to create the Lynx view with a windowless renderer instead of a
|
|
35
|
+
* native parent window. Default is `false`.
|
|
36
|
+
*/
|
|
37
|
+
windowless?: boolean;
|
|
29
38
|
/**
|
|
30
39
|
* (**required** if y is used) Window's left offset from screen. Default is to
|
|
31
40
|
* center the window.
|
|
@@ -247,18 +256,18 @@ export interface LynxWindowConstructorOptions {
|
|
|
247
256
|
}
|
|
248
257
|
|
|
249
258
|
export interface LynxBridgeInvokeEvent {
|
|
250
|
-
sendReply(result?:
|
|
259
|
+
sendReply(result?: any): boolean;
|
|
251
260
|
}
|
|
252
261
|
|
|
253
262
|
export type LynxBridgeInvokeListener = (
|
|
254
263
|
event: LynxBridgeInvokeEvent,
|
|
255
264
|
methodName: string,
|
|
256
|
-
params:
|
|
265
|
+
params: any
|
|
257
266
|
) => void | Promise<void>;
|
|
258
267
|
|
|
259
268
|
export type LynxBridgeMessageListener = (
|
|
260
269
|
methodName: string,
|
|
261
|
-
params:
|
|
270
|
+
params: any
|
|
262
271
|
) => void;
|
|
263
272
|
|
|
264
273
|
export declare class LynxWindow extends BaseWindow {
|
package/apis/lynxtron.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './api/base-window';
|
|
|
19
19
|
export * from './api/clipboard';
|
|
20
20
|
export * from './api/event';
|
|
21
21
|
export * from './api/lynx-window';
|
|
22
|
+
export * from './api/lynx-bridge';
|
|
22
23
|
export * from './api/lynx-library';
|
|
23
24
|
export * from './api/touch-bar';
|
|
24
25
|
export * from './api/screen';
|
package/lynxtron.js
CHANGED
|
@@ -39,5 +39,6 @@ export const Tray = lynxtron.Tray;
|
|
|
39
39
|
export const LynxTemplateData = lynxtron.LynxTemplateData;
|
|
40
40
|
export const LynxUpdateMeta = lynxtron.LynxUpdateMeta;
|
|
41
41
|
export const powerMonitor = lynxtron.powerMonitor;
|
|
42
|
+
export const lynxBridge = lynxtron.lynxBridge;
|
|
42
43
|
|
|
43
44
|
export const lynx = Object.freeze({});
|
package/package.json
CHANGED
package/utils/env-config.js
CHANGED
|
@@ -13,8 +13,8 @@ function getPlatformPath (platform) {
|
|
|
13
13
|
return 'lynxtron.app/Contents/MacOS/lynxtron';
|
|
14
14
|
// case 'freebsd':
|
|
15
15
|
// case 'openbsd':
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
case 'linux':
|
|
17
|
+
return 'lynxtron';
|
|
18
18
|
case 'win32':
|
|
19
19
|
return 'lynxtron.exe';
|
|
20
20
|
default:
|