@decaf-ts/for-os 0.0.0-stage → 0.2.7
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/LICENSE.md +21 -0
- package/README.md +380 -2
- package/lib/cjs/errors.cjs +73 -0
- package/lib/cjs/errors.cjs.map +1 -0
- package/lib/cjs/index.cjs +46 -0
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/native/icons.cjs +123 -0
- package/lib/cjs/native/icons.cjs.map +1 -0
- package/lib/cjs/native/loader.cjs +123 -0
- package/lib/cjs/native/loader.cjs.map +1 -0
- package/lib/cjs/native/types.cjs +4 -0
- package/lib/cjs/native/types.cjs.map +1 -0
- package/lib/cjs/notifications/NotificationCenter.cjs +328 -0
- package/lib/cjs/notifications/NotificationCenter.cjs.map +1 -0
- package/lib/cjs/tray/TrayIcon.cjs +367 -0
- package/lib/cjs/tray/TrayIcon.cjs.map +1 -0
- package/lib/cjs/tray/assets.cjs +31 -0
- package/lib/cjs/tray/assets.cjs.map +1 -0
- package/lib/esm/errors.js +65 -0
- package/lib/esm/errors.js.map +1 -0
- package/lib/esm/index.js +28 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/native/icons.js +117 -0
- package/lib/esm/native/icons.js.map +1 -0
- package/lib/esm/native/loader.js +116 -0
- package/lib/esm/native/loader.js.map +1 -0
- package/lib/esm/native/types.js +8 -0
- package/lib/esm/native/types.js.map +1 -0
- package/lib/esm/notifications/NotificationCenter.js +322 -0
- package/lib/esm/notifications/NotificationCenter.js.map +1 -0
- package/lib/esm/tray/TrayIcon.js +362 -0
- package/lib/esm/tray/TrayIcon.js.map +1 -0
- package/lib/esm/tray/assets.js +26 -0
- package/lib/esm/tray/assets.js.map +1 -0
- package/lib/types/errors.d.cts +56 -0
- package/lib/types/errors.d.mts +56 -0
- package/lib/types/index.d.cts +27 -0
- package/lib/types/index.d.mts +27 -0
- package/lib/types/native/icons.d.cts +71 -0
- package/lib/types/native/icons.d.mts +71 -0
- package/lib/types/native/loader.d.cts +37 -0
- package/lib/types/native/loader.d.mts +37 -0
- package/lib/types/native/types.d.cts +104 -0
- package/lib/types/native/types.d.mts +104 -0
- package/lib/types/notifications/NotificationCenter.d.cts +163 -0
- package/lib/types/notifications/NotificationCenter.d.mts +163 -0
- package/lib/types/tray/TrayIcon.d.cts +174 -0
- package/lib/types/tray/TrayIcon.d.mts +174 -0
- package/lib/types/tray/assets.d.cts +25 -0
- package/lib/types/tray/assets.d.mts +25 -0
- package/native/tray-icon-node/Cargo.lock +1511 -0
- package/native/tray-icon-node/Cargo.toml +45 -0
- package/native/tray-icon-node/Cross.toml +10 -0
- package/native/tray-icon-node/LICENSE +21 -0
- package/native/tray-icon-node/UPSTREAM-README.md +281 -0
- package/native/tray-icon-node/UPSTREAM.md +213 -0
- package/native/tray-icon-node/build-manifest.json +16 -0
- package/native/tray-icon-node/build.rs +5 -0
- package/native/tray-icon-node/index.d.ts +368 -0
- package/native/tray-icon-node/index.js +609 -0
- package/native/tray-icon-node/package.json +55 -0
- package/native/tray-icon-node/rustfmt.toml +31 -0
- package/native/tray-icon-node/source-manifest.json +30 -0
- package/native/tray-icon-node/src/common.rs +101 -0
- package/native/tray-icon-node/src/icon.rs +255 -0
- package/native/tray-icon-node/src/lib.rs +449 -0
- package/native/tray-icon-node/src/menu.rs +849 -0
- package/native/tray-icon-node/src/tray.rs +251 -0
- package/native/tray-icon-node/tray-icon-node.linux-x64-gnu.node +0 -0
- package/package.json +131 -4
- package/scripts/for-os-build.mjs +60 -0
- package/scripts/for-os-init.mjs +327 -0
- package/scripts/for-os-install.mjs +47 -0
- package/scripts/for-os-integration.mjs +137 -0
- package/scripts/for-os-integrity.mjs +51 -0
- package/scripts/for-os-package.mjs +49 -0
- package/scripts/lib/native.mjs +591 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module for-os.tray
|
|
3
|
+
* @description Runtime-switchable system-tray icon and menu bridge.
|
|
4
|
+
* @summary `TrayIcon` owns one native tray host, a menu with JavaScript
|
|
5
|
+
* callbacks, and the cooperative native event pump. Icons can be replaced at
|
|
6
|
+
* runtime with {@link TrayIcon.setIcon} (path, bytes, base64, or RGBA), menu
|
|
7
|
+
* entries can be relabelled/enabled/checked, and unknown native failures
|
|
8
|
+
* degrade the tray without throwing into the host application.
|
|
9
|
+
*/
|
|
10
|
+
import { type IconSource } from "../native/icons.d.cts";
|
|
11
|
+
import type { NativeModule, NativeTrayEvent } from "../native/types.d.cts";
|
|
12
|
+
/** Callback invoked when a tray menu action is activated. */
|
|
13
|
+
export type TrayActionHandler = (id: string) => void;
|
|
14
|
+
/** One entry in the tray menu. */
|
|
15
|
+
export type TrayMenuItem = {
|
|
16
|
+
/** Stable action id reported to {@link TrayActionHandler}s. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Rendered label. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Whether the entry is clickable (defaults to true). */
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
/** Renders a checkable item instead of a normal item. */
|
|
23
|
+
checkable?: boolean;
|
|
24
|
+
/** Initial checked state for a checkable item. */
|
|
25
|
+
checked?: boolean;
|
|
26
|
+
/** Renders a separator instead of a labelled item. */
|
|
27
|
+
separator?: boolean;
|
|
28
|
+
/** Per-item callback; global handlers registered with {@link TrayIcon.on} also run. */
|
|
29
|
+
onClick?: TrayActionHandler;
|
|
30
|
+
};
|
|
31
|
+
/** Mutable fields accepted by {@link TrayIcon.updateMenuItem}. */
|
|
32
|
+
export type TrayMenuItemPatch = {
|
|
33
|
+
/** Replacement label text. */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Whether the entry is clickable. */
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
/** New checked state for a checkable item. */
|
|
38
|
+
checked?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/** Construction options for {@link TrayIcon}. */
|
|
41
|
+
export type TrayIconOptions = {
|
|
42
|
+
/** Initial tray icon. */
|
|
43
|
+
icon: IconSource;
|
|
44
|
+
/** Hover tooltip. */
|
|
45
|
+
tooltip?: string;
|
|
46
|
+
/** macOS title text shown next to the icon. */
|
|
47
|
+
title?: string;
|
|
48
|
+
/** Menu entries; omitted means the tray has no context menu. */
|
|
49
|
+
menu?: TrayMenuItem[];
|
|
50
|
+
/** Native event pump interval in milliseconds (defaults to 100). */
|
|
51
|
+
pollIntervalMs?: number;
|
|
52
|
+
/** Best-effort diagnostics sink (defaults to `console.warn`). */
|
|
53
|
+
log?: (message: string) => void;
|
|
54
|
+
/** Raw tray-icon events (click/enter/leave/move). */
|
|
55
|
+
onEvent?: (event: NativeTrayEvent) => void;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* @description A live system-tray icon with a JavaScript-driven menu.
|
|
59
|
+
* @summary Create one with {@link TrayIcon.create}. Call {@link close} when the
|
|
60
|
+
* host application shuts the tray down. `active` turns false after a native
|
|
61
|
+
* failure; every mutating method is a no-op after that.
|
|
62
|
+
* @class TrayIcon
|
|
63
|
+
* @example
|
|
64
|
+
* import { TrayIcon, TRAY_ICON_BASE64 } from "@decaf-ts/for-os";
|
|
65
|
+
* const tray = TrayIcon.create({
|
|
66
|
+
* icon: { base64: TRAY_ICON_BASE64.idle },
|
|
67
|
+
* tooltip: "Decaf",
|
|
68
|
+
* menu: [{ id: "quit", label: "Quit" }],
|
|
69
|
+
* });
|
|
70
|
+
* tray.on("quit", () => tray.close());
|
|
71
|
+
*/
|
|
72
|
+
export declare class TrayIcon {
|
|
73
|
+
private readonly api;
|
|
74
|
+
private readonly host;
|
|
75
|
+
private readonly handlers;
|
|
76
|
+
private readonly itemHandlers;
|
|
77
|
+
private readonly menuHandles;
|
|
78
|
+
private readonly menu?;
|
|
79
|
+
private readonly resolver;
|
|
80
|
+
private readonly log;
|
|
81
|
+
private readonly pollIntervalMs;
|
|
82
|
+
private readonly onEvent?;
|
|
83
|
+
private pump?;
|
|
84
|
+
private closed;
|
|
85
|
+
private isActive;
|
|
86
|
+
private constructor();
|
|
87
|
+
/**
|
|
88
|
+
* Creates a tray icon and its menu.
|
|
89
|
+
* @param {TrayIconOptions} options icon, tooltip, title, and menu entries
|
|
90
|
+
* @param {NativeModule} [api] native module override (tests/embedding)
|
|
91
|
+
* @return {TrayIcon} the live tray
|
|
92
|
+
* @throws {NativeModuleUnavailableError} when the native addon is unavailable
|
|
93
|
+
* @throws {TrayError} when the native tray host or menu cannot be created
|
|
94
|
+
*/
|
|
95
|
+
static create(options: TrayIconOptions, api?: NativeModule): TrayIcon;
|
|
96
|
+
/**
|
|
97
|
+
* Creates a tray icon, returning `undefined` instead of throwing.
|
|
98
|
+
* @param {TrayIconOptions} options tray construction options
|
|
99
|
+
* @param {NativeModule} [api] native module override
|
|
100
|
+
* @return {TrayIcon|undefined} the tray, or `undefined` when it cannot be created
|
|
101
|
+
*/
|
|
102
|
+
static tryCreate(options: TrayIconOptions, api?: NativeModule): TrayIcon | undefined;
|
|
103
|
+
/** Whether the tray still exists and has not degraded. */
|
|
104
|
+
get active(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Switches the tray icon at runtime.
|
|
107
|
+
* @param {IconSource} source the new icon
|
|
108
|
+
* @return {boolean} `true` when applied
|
|
109
|
+
*/
|
|
110
|
+
setIcon(source: IconSource): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Updates the hover tooltip.
|
|
113
|
+
* @param {string} tooltip new tooltip text
|
|
114
|
+
* @return {boolean} `true` when applied
|
|
115
|
+
*/
|
|
116
|
+
setTooltip(tooltip: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Updates the macOS title text.
|
|
119
|
+
* @param {string} title new title
|
|
120
|
+
* @return {boolean} `true` when applied
|
|
121
|
+
*/
|
|
122
|
+
setTitle(title: string): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Shows or hides the tray icon.
|
|
125
|
+
* @param {boolean} visible desired visibility
|
|
126
|
+
* @return {boolean} `true` when applied
|
|
127
|
+
*/
|
|
128
|
+
setVisible(visible: boolean): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Registers a global menu-action handler.
|
|
131
|
+
* @param {string} id menu action id
|
|
132
|
+
* @param {TrayActionHandler} handler callback
|
|
133
|
+
* @return {TrayIcon} this instance
|
|
134
|
+
*/
|
|
135
|
+
on(id: string, handler: TrayActionHandler): this;
|
|
136
|
+
/**
|
|
137
|
+
* Removes a previously registered global handler.
|
|
138
|
+
* @param {string} id menu action id
|
|
139
|
+
* @param {TrayActionHandler} handler callback to remove
|
|
140
|
+
* @return {TrayIcon} this instance
|
|
141
|
+
*/
|
|
142
|
+
off(id: string, handler: TrayActionHandler): this;
|
|
143
|
+
/**
|
|
144
|
+
* Relabels, enables/disables, or checks a menu entry.
|
|
145
|
+
* @param {string} id menu entry id
|
|
146
|
+
* @param {TrayMenuItemPatch} patch fields to update
|
|
147
|
+
* @return {boolean} `true` when the entry exists and the change was applied
|
|
148
|
+
*/
|
|
149
|
+
updateMenuItem(id: string, patch: TrayMenuItemPatch): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Reads the checked state of a checkable menu entry.
|
|
152
|
+
* @param {string} id menu entry id
|
|
153
|
+
* @return {boolean} whether the entry is checked
|
|
154
|
+
*/
|
|
155
|
+
isMenuItemChecked(id: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Toggles a checkable menu entry.
|
|
158
|
+
* @param {string} id menu entry id
|
|
159
|
+
* @return {boolean} the resulting checked state
|
|
160
|
+
*/
|
|
161
|
+
toggleMenuItem(id: string): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Processes pending native events immediately.
|
|
164
|
+
* @return {string[]} menu action ids dispatched in this drain
|
|
165
|
+
*/
|
|
166
|
+
poll(): string[];
|
|
167
|
+
/** Releases the native tray, event pump, and materialized icon files; idempotent. */
|
|
168
|
+
close(): void;
|
|
169
|
+
private startPump;
|
|
170
|
+
private pumpOnce;
|
|
171
|
+
private dispatchMenuAction;
|
|
172
|
+
private invoke;
|
|
173
|
+
private degrade;
|
|
174
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module for-os.tray
|
|
3
|
+
* @description Runtime-switchable system-tray icon and menu bridge.
|
|
4
|
+
* @summary `TrayIcon` owns one native tray host, a menu with JavaScript
|
|
5
|
+
* callbacks, and the cooperative native event pump. Icons can be replaced at
|
|
6
|
+
* runtime with {@link TrayIcon.setIcon} (path, bytes, base64, or RGBA), menu
|
|
7
|
+
* entries can be relabelled/enabled/checked, and unknown native failures
|
|
8
|
+
* degrade the tray without throwing into the host application.
|
|
9
|
+
*/
|
|
10
|
+
import { type IconSource } from "../native/icons.d.mts";
|
|
11
|
+
import type { NativeModule, NativeTrayEvent } from "../native/types.d.mts";
|
|
12
|
+
/** Callback invoked when a tray menu action is activated. */
|
|
13
|
+
export type TrayActionHandler = (id: string) => void;
|
|
14
|
+
/** One entry in the tray menu. */
|
|
15
|
+
export type TrayMenuItem = {
|
|
16
|
+
/** Stable action id reported to {@link TrayActionHandler}s. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Rendered label. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Whether the entry is clickable (defaults to true). */
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
/** Renders a checkable item instead of a normal item. */
|
|
23
|
+
checkable?: boolean;
|
|
24
|
+
/** Initial checked state for a checkable item. */
|
|
25
|
+
checked?: boolean;
|
|
26
|
+
/** Renders a separator instead of a labelled item. */
|
|
27
|
+
separator?: boolean;
|
|
28
|
+
/** Per-item callback; global handlers registered with {@link TrayIcon.on} also run. */
|
|
29
|
+
onClick?: TrayActionHandler;
|
|
30
|
+
};
|
|
31
|
+
/** Mutable fields accepted by {@link TrayIcon.updateMenuItem}. */
|
|
32
|
+
export type TrayMenuItemPatch = {
|
|
33
|
+
/** Replacement label text. */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Whether the entry is clickable. */
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
/** New checked state for a checkable item. */
|
|
38
|
+
checked?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/** Construction options for {@link TrayIcon}. */
|
|
41
|
+
export type TrayIconOptions = {
|
|
42
|
+
/** Initial tray icon. */
|
|
43
|
+
icon: IconSource;
|
|
44
|
+
/** Hover tooltip. */
|
|
45
|
+
tooltip?: string;
|
|
46
|
+
/** macOS title text shown next to the icon. */
|
|
47
|
+
title?: string;
|
|
48
|
+
/** Menu entries; omitted means the tray has no context menu. */
|
|
49
|
+
menu?: TrayMenuItem[];
|
|
50
|
+
/** Native event pump interval in milliseconds (defaults to 100). */
|
|
51
|
+
pollIntervalMs?: number;
|
|
52
|
+
/** Best-effort diagnostics sink (defaults to `console.warn`). */
|
|
53
|
+
log?: (message: string) => void;
|
|
54
|
+
/** Raw tray-icon events (click/enter/leave/move). */
|
|
55
|
+
onEvent?: (event: NativeTrayEvent) => void;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* @description A live system-tray icon with a JavaScript-driven menu.
|
|
59
|
+
* @summary Create one with {@link TrayIcon.create}. Call {@link close} when the
|
|
60
|
+
* host application shuts the tray down. `active` turns false after a native
|
|
61
|
+
* failure; every mutating method is a no-op after that.
|
|
62
|
+
* @class TrayIcon
|
|
63
|
+
* @example
|
|
64
|
+
* import { TrayIcon, TRAY_ICON_BASE64 } from "@decaf-ts/for-os";
|
|
65
|
+
* const tray = TrayIcon.create({
|
|
66
|
+
* icon: { base64: TRAY_ICON_BASE64.idle },
|
|
67
|
+
* tooltip: "Decaf",
|
|
68
|
+
* menu: [{ id: "quit", label: "Quit" }],
|
|
69
|
+
* });
|
|
70
|
+
* tray.on("quit", () => tray.close());
|
|
71
|
+
*/
|
|
72
|
+
export declare class TrayIcon {
|
|
73
|
+
private readonly api;
|
|
74
|
+
private readonly host;
|
|
75
|
+
private readonly handlers;
|
|
76
|
+
private readonly itemHandlers;
|
|
77
|
+
private readonly menuHandles;
|
|
78
|
+
private readonly menu?;
|
|
79
|
+
private readonly resolver;
|
|
80
|
+
private readonly log;
|
|
81
|
+
private readonly pollIntervalMs;
|
|
82
|
+
private readonly onEvent?;
|
|
83
|
+
private pump?;
|
|
84
|
+
private closed;
|
|
85
|
+
private isActive;
|
|
86
|
+
private constructor();
|
|
87
|
+
/**
|
|
88
|
+
* Creates a tray icon and its menu.
|
|
89
|
+
* @param {TrayIconOptions} options icon, tooltip, title, and menu entries
|
|
90
|
+
* @param {NativeModule} [api] native module override (tests/embedding)
|
|
91
|
+
* @return {TrayIcon} the live tray
|
|
92
|
+
* @throws {NativeModuleUnavailableError} when the native addon is unavailable
|
|
93
|
+
* @throws {TrayError} when the native tray host or menu cannot be created
|
|
94
|
+
*/
|
|
95
|
+
static create(options: TrayIconOptions, api?: NativeModule): TrayIcon;
|
|
96
|
+
/**
|
|
97
|
+
* Creates a tray icon, returning `undefined` instead of throwing.
|
|
98
|
+
* @param {TrayIconOptions} options tray construction options
|
|
99
|
+
* @param {NativeModule} [api] native module override
|
|
100
|
+
* @return {TrayIcon|undefined} the tray, or `undefined` when it cannot be created
|
|
101
|
+
*/
|
|
102
|
+
static tryCreate(options: TrayIconOptions, api?: NativeModule): TrayIcon | undefined;
|
|
103
|
+
/** Whether the tray still exists and has not degraded. */
|
|
104
|
+
get active(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Switches the tray icon at runtime.
|
|
107
|
+
* @param {IconSource} source the new icon
|
|
108
|
+
* @return {boolean} `true` when applied
|
|
109
|
+
*/
|
|
110
|
+
setIcon(source: IconSource): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Updates the hover tooltip.
|
|
113
|
+
* @param {string} tooltip new tooltip text
|
|
114
|
+
* @return {boolean} `true` when applied
|
|
115
|
+
*/
|
|
116
|
+
setTooltip(tooltip: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Updates the macOS title text.
|
|
119
|
+
* @param {string} title new title
|
|
120
|
+
* @return {boolean} `true` when applied
|
|
121
|
+
*/
|
|
122
|
+
setTitle(title: string): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Shows or hides the tray icon.
|
|
125
|
+
* @param {boolean} visible desired visibility
|
|
126
|
+
* @return {boolean} `true` when applied
|
|
127
|
+
*/
|
|
128
|
+
setVisible(visible: boolean): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Registers a global menu-action handler.
|
|
131
|
+
* @param {string} id menu action id
|
|
132
|
+
* @param {TrayActionHandler} handler callback
|
|
133
|
+
* @return {TrayIcon} this instance
|
|
134
|
+
*/
|
|
135
|
+
on(id: string, handler: TrayActionHandler): this;
|
|
136
|
+
/**
|
|
137
|
+
* Removes a previously registered global handler.
|
|
138
|
+
* @param {string} id menu action id
|
|
139
|
+
* @param {TrayActionHandler} handler callback to remove
|
|
140
|
+
* @return {TrayIcon} this instance
|
|
141
|
+
*/
|
|
142
|
+
off(id: string, handler: TrayActionHandler): this;
|
|
143
|
+
/**
|
|
144
|
+
* Relabels, enables/disables, or checks a menu entry.
|
|
145
|
+
* @param {string} id menu entry id
|
|
146
|
+
* @param {TrayMenuItemPatch} patch fields to update
|
|
147
|
+
* @return {boolean} `true` when the entry exists and the change was applied
|
|
148
|
+
*/
|
|
149
|
+
updateMenuItem(id: string, patch: TrayMenuItemPatch): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Reads the checked state of a checkable menu entry.
|
|
152
|
+
* @param {string} id menu entry id
|
|
153
|
+
* @return {boolean} whether the entry is checked
|
|
154
|
+
*/
|
|
155
|
+
isMenuItemChecked(id: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Toggles a checkable menu entry.
|
|
158
|
+
* @param {string} id menu entry id
|
|
159
|
+
* @return {boolean} the resulting checked state
|
|
160
|
+
*/
|
|
161
|
+
toggleMenuItem(id: string): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Processes pending native events immediately.
|
|
164
|
+
* @return {string[]} menu action ids dispatched in this drain
|
|
165
|
+
*/
|
|
166
|
+
poll(): string[];
|
|
167
|
+
/** Releases the native tray, event pump, and materialized icon files; idempotent. */
|
|
168
|
+
close(): void;
|
|
169
|
+
private startPump;
|
|
170
|
+
private pumpOnce;
|
|
171
|
+
private dispatchMenuAction;
|
|
172
|
+
private invoke;
|
|
173
|
+
private degrade;
|
|
174
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module for-os.tray.assets
|
|
3
|
+
* @description Embedded 16x16 tray icons for runtime icon-switching examples.
|
|
4
|
+
* @summary Icons are base64 PNG strings so no binary asset has to be resolved
|
|
5
|
+
* at runtime. Pass them directly to {@link TrayIcon.setIcon} or decode them
|
|
6
|
+
* with {@link trayIconPng}.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Embedded base64 PNG icons keyed by tray state.
|
|
10
|
+
* @summary Values are 16x16 PNGs encoded as base64 strings. Decode them with
|
|
11
|
+
* {@link trayIconPng}, or pass `{ base64 }` directly to
|
|
12
|
+
* {@link TrayIcon.setIcon}.
|
|
13
|
+
* @constant
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
16
|
+
export declare const TRAY_ICON_BASE64: {
|
|
17
|
+
/** Base64 PNG shown while the tray is idle. */
|
|
18
|
+
readonly idle: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAaUlEQVR42q2TwQ3AIAhFvbof2zDC28IZvbdpIkljitHC4V0k/0UBC1AieIUKCKADGWdbgifQgWuij9pS0D6CM80T6EbY0FlQnWt7dOuJCeQgbMhboD8EmioIPyHcxPAYUxYpZZVTPtMRNxn8JW/L/TDsAAAAAElFTkSuQmCC";
|
|
19
|
+
/** Base64 PNG shown while the tray is active. */
|
|
20
|
+
readonly active: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAbUlEQVR42mN46uHLQAnGJcH51MM35KmHbzUUh0DFiDIApOHLUw/f/2j4C1QOrwGLsGhEx4twGVBNhGYYrkY3gBOHs3HhL7AwgRkQQoJmGA5BNqCaDAOqqWoAxV6gOBApjkaqJCSqJGWqZCaSMABh2/5gh+Rb1AAAAABJRU5ErkJggg==";
|
|
21
|
+
};
|
|
22
|
+
/** Name of an embedded tray icon state. */
|
|
23
|
+
export type TrayIconName = keyof typeof TRAY_ICON_BASE64;
|
|
24
|
+
/** Decodes an embedded tray icon back into PNG bytes. */
|
|
25
|
+
export declare function trayIconPng(name: TrayIconName): Buffer;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module for-os.tray.assets
|
|
3
|
+
* @description Embedded 16x16 tray icons for runtime icon-switching examples.
|
|
4
|
+
* @summary Icons are base64 PNG strings so no binary asset has to be resolved
|
|
5
|
+
* at runtime. Pass them directly to {@link TrayIcon.setIcon} or decode them
|
|
6
|
+
* with {@link trayIconPng}.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Embedded base64 PNG icons keyed by tray state.
|
|
10
|
+
* @summary Values are 16x16 PNGs encoded as base64 strings. Decode them with
|
|
11
|
+
* {@link trayIconPng}, or pass `{ base64 }` directly to
|
|
12
|
+
* {@link TrayIcon.setIcon}.
|
|
13
|
+
* @constant
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
16
|
+
export declare const TRAY_ICON_BASE64: {
|
|
17
|
+
/** Base64 PNG shown while the tray is idle. */
|
|
18
|
+
readonly idle: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAaUlEQVR42q2TwQ3AIAhFvbof2zDC28IZvbdpIkljitHC4V0k/0UBC1AieIUKCKADGWdbgifQgWuij9pS0D6CM80T6EbY0FlQnWt7dOuJCeQgbMhboD8EmioIPyHcxPAYUxYpZZVTPtMRNxn8JW/L/TDsAAAAAElFTkSuQmCC";
|
|
19
|
+
/** Base64 PNG shown while the tray is active. */
|
|
20
|
+
readonly active: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAbUlEQVR42mN46uHLQAnGJcH51MM35KmHbzUUh0DFiDIApOHLUw/f/2j4C1QOrwGLsGhEx4twGVBNhGYYrkY3gBOHs3HhL7AwgRkQQoJmGA5BNqCaDAOqqWoAxV6gOBApjkaqJCSqJGWqZCaSMABh2/5gh+Rb1AAAAABJRU5ErkJggg==";
|
|
21
|
+
};
|
|
22
|
+
/** Name of an embedded tray icon state. */
|
|
23
|
+
export type TrayIconName = keyof typeof TRAY_ICON_BASE64;
|
|
24
|
+
/** Decodes an embedded tray icon back into PNG bytes. */
|
|
25
|
+
export declare function trayIconPng(name: TrayIconName): Buffer;
|