@gd-kirie/tray 0.13.0 → 0.14.1
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 +43 -8
- package/addon/kirie_tray/bin/aarch64-apple-darwin/libkirie_tray_native.dylib +0 -0
- package/addon/kirie_tray/bin/aarch64-pc-windows-msvc/kirie_tray_native.dll +0 -0
- package/addon/kirie_tray/bin/{linux-arm64 → aarch64-unknown-linux-gnu}/libkirie_tray_native.so +0 -0
- package/addon/kirie_tray/bin/x86_64-apple-darwin/libkirie_tray_native.dylib +0 -0
- package/addon/kirie_tray/bin/x86_64-pc-windows-msvc/kirie_tray_native.dll +0 -0
- package/addon/kirie_tray/bin/{linux-x64 → x86_64-unknown-linux-gnu}/libkirie_tray_native.so +0 -0
- package/addon/kirie_tray/kirie_tray.gdextension +6 -6
- package/addon/kirie_tray/plugin.cfg +1 -1
- package/dist/index.d.ts +642 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +334 -32
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +5 -5
- package/addon/kirie_tray/bin/osx-arm64/libkirie_tray_native.dylib +0 -0
- package/addon/kirie_tray/bin/osx-x64/libkirie_tray_native.dylib +0 -0
- package/addon/kirie_tray/bin/win-arm64/kirie_tray_native.dll +0 -0
- package/addon/kirie_tray/bin/win-x64/kirie_tray_native.dll +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
# `@gd-kirie/tray`
|
|
2
2
|
|
|
3
|
-
`@gd-kirie/tray` adds system tray
|
|
4
|
-
uses the application's existing Eventa context.
|
|
3
|
+
`@gd-kirie/tray` adds system tray icons and menus to desktop Kirie applications.
|
|
4
|
+
It uses the application's existing Eventa context.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
Install the package in a Kirie project:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
pnpm add @gd-kirie/tray
|
|
12
|
+
```
|
|
5
13
|
|
|
6
14
|
Add the plugin to `kirie.config.ts`:
|
|
7
15
|
|
|
@@ -21,10 +29,37 @@ Install the plugin dependencies:
|
|
|
21
29
|
pnpm kirie doctor --fix plugin:tray
|
|
22
30
|
```
|
|
23
31
|
|
|
24
|
-
This command installs
|
|
25
|
-
The
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
This command installs the Godot addon and the `GdKirie.Tray` NuGet package.
|
|
33
|
+
The plugin supports macOS, Windows, and Linux on x64 and Arm64.
|
|
34
|
+
Linux requires a StatusNotifierItem host.
|
|
35
|
+
|
|
36
|
+
## Use
|
|
37
|
+
|
|
38
|
+
In Godot, [register and attach the adapter](../GdKirie.Tray/README.md#browser-access).
|
|
39
|
+
Create a client with the application's Eventa context:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createTrayClient } from "@gd-kirie/tray";
|
|
43
|
+
|
|
44
|
+
const client = createTrayClient(context);
|
|
45
|
+
const open = await client.createMenuItem({ text: "Open" });
|
|
46
|
+
const menu = await client.createMenu({ items: [open] });
|
|
47
|
+
const tray = await client.createTray({
|
|
48
|
+
icon: { kind: "resource", path: "res://tray.svg" },
|
|
49
|
+
menu,
|
|
50
|
+
tooltip: "My application",
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const stopEvents = client.onEvent((event) => {
|
|
54
|
+
if (event.type === "menu" && event.id === open.id) {
|
|
55
|
+
console.log("Open");
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Keep `res://tray.svg` in the Godot project.
|
|
61
|
+
Call `stopEvents()` when the page closes.
|
|
62
|
+
Release browser handles with `close()` when they are no longer needed.
|
|
29
63
|
|
|
30
|
-
See
|
|
64
|
+
See [GdKirie.Tray](../GdKirie.Tray/README.md) for C# usage and the
|
|
65
|
+
[tray example](https://github.com/gd-kirie/kirie-examples/blob/main/examples/tray/README.md) for a complete application.
|
package/addon/kirie_tray/bin/{linux-arm64 → aarch64-unknown-linux-gnu}/libkirie_tray_native.so
RENAMED
|
Binary file
|
|
Binary file
|
|
@@ -3,9 +3,9 @@ entry_symbol = "gdext_rust_init"
|
|
|
3
3
|
compatibility_minimum = "4.7"
|
|
4
4
|
|
|
5
5
|
[libraries]
|
|
6
|
-
macos.arm64 = "./bin/
|
|
7
|
-
macos.x86_64 = "./bin/
|
|
8
|
-
linux.arm64 = "./bin/linux-
|
|
9
|
-
linux.x86_64 = "./bin/linux-
|
|
10
|
-
windows.arm64 = "./bin/
|
|
11
|
-
windows.x86_64 = "./bin/
|
|
6
|
+
macos.arm64 = "./bin/aarch64-apple-darwin/libkirie_tray_native.dylib"
|
|
7
|
+
macos.x86_64 = "./bin/x86_64-apple-darwin/libkirie_tray_native.dylib"
|
|
8
|
+
linux.arm64 = "./bin/aarch64-unknown-linux-gnu/libkirie_tray_native.so"
|
|
9
|
+
linux.x86_64 = "./bin/x86_64-unknown-linux-gnu/libkirie_tray_native.so"
|
|
10
|
+
windows.arm64 = "./bin/aarch64-pc-windows-msvc/kirie_tray_native.dll"
|
|
11
|
+
windows.x86_64 = "./bin/x86_64-pc-windows-msvc/kirie_tray_native.dll"
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,653 @@
|
|
|
1
|
-
import { InboundEventa } from "@moeru/eventa";
|
|
2
1
|
import { KirieEventaContext } from "@gd-kirie/ipc-eventa";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
interface
|
|
6
|
-
|
|
2
|
+
//#region src/contracts.d.ts
|
|
3
|
+
type ResourceKind = "tray" | "menu" | "submenu" | "item" | "check" | "icon" | "predefined";
|
|
4
|
+
interface Resource {
|
|
5
|
+
handle: string;
|
|
6
|
+
kind: ResourceKind;
|
|
7
|
+
id: string;
|
|
8
|
+
}
|
|
9
|
+
type IconSource = {
|
|
10
|
+
kind: "resource";
|
|
11
|
+
path: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "rgba";
|
|
14
|
+
rgba: readonly number[];
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "native" | "native-name";
|
|
19
|
+
name: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "windows-stock";
|
|
22
|
+
id: number;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "windows-path";
|
|
25
|
+
path: string;
|
|
26
|
+
width?: number;
|
|
27
|
+
height?: number;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "windows-resource";
|
|
30
|
+
resource: number | string;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
};
|
|
34
|
+
interface Accelerator {
|
|
35
|
+
kind: "physical" | "logical";
|
|
36
|
+
value: string;
|
|
37
|
+
}
|
|
38
|
+
interface AboutMetadata {
|
|
39
|
+
name?: string | null;
|
|
40
|
+
version?: string | null;
|
|
41
|
+
shortVersion?: string | null;
|
|
42
|
+
authors?: string[] | null;
|
|
43
|
+
comments?: string | null;
|
|
44
|
+
copyright?: string | null;
|
|
45
|
+
license?: string | null;
|
|
46
|
+
website?: string | null;
|
|
47
|
+
websiteLabel?: string | null;
|
|
48
|
+
credits?: string | null;
|
|
49
|
+
icon?: IconSource | null;
|
|
50
|
+
}
|
|
51
|
+
interface TrayCreateOptions {
|
|
52
|
+
id?: string;
|
|
53
|
+
icon?: IconSource | null;
|
|
7
54
|
iconAsTemplate?: boolean;
|
|
55
|
+
menu?: string | null;
|
|
56
|
+
tooltip?: string | null;
|
|
57
|
+
title?: string | null;
|
|
58
|
+
menuOnLeftClick?: boolean;
|
|
59
|
+
menuOnRightClick?: boolean;
|
|
60
|
+
guid?: string;
|
|
61
|
+
autosaveName?: string;
|
|
62
|
+
tempDirPath?: string;
|
|
8
63
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
64
|
+
interface MenuCreateOptions {
|
|
65
|
+
id?: string;
|
|
66
|
+
items?: string[];
|
|
67
|
+
}
|
|
68
|
+
interface SubmenuCreateOptions extends MenuCreateOptions {
|
|
12
69
|
text: string;
|
|
13
70
|
enabled?: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
71
|
+
icon?: IconSource | null;
|
|
72
|
+
iconAsTemplate?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface MenuItemOptions {
|
|
75
|
+
id?: string;
|
|
17
76
|
text: string;
|
|
18
77
|
enabled?: boolean;
|
|
78
|
+
accelerator?: Accelerator | null;
|
|
79
|
+
}
|
|
80
|
+
interface CheckMenuItemOptions extends MenuItemOptions {
|
|
19
81
|
checked?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
82
|
+
}
|
|
83
|
+
interface IconMenuItemOptions extends MenuItemOptions {
|
|
84
|
+
icon?: IconSource | null;
|
|
85
|
+
iconAsTemplate?: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface Position {
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
}
|
|
91
|
+
interface Rect {
|
|
92
|
+
position: Position;
|
|
93
|
+
size: {
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface MenuEvent {
|
|
99
|
+
type: "menu";
|
|
100
|
+
id: string;
|
|
101
|
+
}
|
|
102
|
+
interface TrayEvent {
|
|
103
|
+
type: "Click" | "DoubleClick" | "Enter" | "Move" | "Leave";
|
|
104
|
+
id: string;
|
|
105
|
+
position: Position;
|
|
106
|
+
rect: Rect;
|
|
107
|
+
button?: "Left" | "Right" | "Middle";
|
|
108
|
+
buttonState?: "Up" | "Down";
|
|
109
|
+
}
|
|
110
|
+
type NativeEvent = MenuEvent | TrayEvent;
|
|
111
|
+
interface Methods {
|
|
112
|
+
"resource.close": {
|
|
113
|
+
args: {
|
|
114
|
+
handle: string;
|
|
115
|
+
};
|
|
116
|
+
result: null;
|
|
117
|
+
};
|
|
118
|
+
"tray.create": {
|
|
119
|
+
args: {
|
|
120
|
+
options: TrayCreateOptions;
|
|
121
|
+
};
|
|
122
|
+
result: Resource;
|
|
123
|
+
};
|
|
124
|
+
"tray.set-icon": {
|
|
125
|
+
args: {
|
|
126
|
+
handle: string;
|
|
127
|
+
icon: IconSource | null;
|
|
128
|
+
iconAsTemplate?: boolean;
|
|
129
|
+
};
|
|
130
|
+
result: null;
|
|
131
|
+
};
|
|
132
|
+
"tray.set-menu": {
|
|
133
|
+
args: {
|
|
134
|
+
handle: string;
|
|
135
|
+
menu: string | null;
|
|
136
|
+
};
|
|
137
|
+
result: null;
|
|
138
|
+
};
|
|
139
|
+
"tray.set-tooltip": {
|
|
140
|
+
args: {
|
|
141
|
+
handle: string;
|
|
142
|
+
tooltip: string | null;
|
|
143
|
+
};
|
|
144
|
+
result: null;
|
|
145
|
+
};
|
|
146
|
+
"tray.set-title": {
|
|
147
|
+
args: {
|
|
148
|
+
handle: string;
|
|
149
|
+
title: string | null;
|
|
150
|
+
};
|
|
151
|
+
result: null;
|
|
152
|
+
};
|
|
153
|
+
"tray.set-visible": {
|
|
154
|
+
args: {
|
|
155
|
+
handle: string;
|
|
156
|
+
visible: boolean;
|
|
157
|
+
};
|
|
158
|
+
result: null;
|
|
159
|
+
};
|
|
160
|
+
"tray.set-menu-on-left-click": {
|
|
161
|
+
args: {
|
|
162
|
+
handle: string;
|
|
163
|
+
enabled: boolean;
|
|
164
|
+
};
|
|
165
|
+
result: null;
|
|
166
|
+
};
|
|
167
|
+
"tray.set-menu-on-right-click": {
|
|
168
|
+
args: {
|
|
169
|
+
handle: string;
|
|
170
|
+
enabled: boolean;
|
|
171
|
+
};
|
|
172
|
+
result: null;
|
|
173
|
+
};
|
|
174
|
+
"tray.show-menu": {
|
|
175
|
+
args: {
|
|
176
|
+
handle: string;
|
|
177
|
+
};
|
|
178
|
+
result: null;
|
|
179
|
+
};
|
|
180
|
+
"tray.rect": {
|
|
181
|
+
args: {
|
|
182
|
+
handle: string;
|
|
183
|
+
};
|
|
184
|
+
result: Rect | null;
|
|
185
|
+
};
|
|
186
|
+
"tray.icon-is-template": {
|
|
187
|
+
args: {
|
|
188
|
+
handle: string;
|
|
189
|
+
};
|
|
190
|
+
result: boolean;
|
|
191
|
+
};
|
|
192
|
+
"tray.set-temp-dir-path": {
|
|
193
|
+
args: {
|
|
194
|
+
handle: string;
|
|
195
|
+
path: string | null;
|
|
196
|
+
};
|
|
197
|
+
result: null;
|
|
198
|
+
};
|
|
199
|
+
"menu.create": {
|
|
200
|
+
args: {
|
|
201
|
+
options: MenuCreateOptions;
|
|
202
|
+
};
|
|
203
|
+
result: Resource;
|
|
204
|
+
};
|
|
205
|
+
"submenu.create": {
|
|
206
|
+
args: {
|
|
207
|
+
options: SubmenuCreateOptions;
|
|
208
|
+
};
|
|
209
|
+
result: Resource;
|
|
210
|
+
};
|
|
211
|
+
"item.create": {
|
|
212
|
+
args: {
|
|
213
|
+
options: MenuItemOptions;
|
|
214
|
+
};
|
|
215
|
+
result: Resource;
|
|
216
|
+
};
|
|
217
|
+
"check.create": {
|
|
218
|
+
args: {
|
|
219
|
+
options: CheckMenuItemOptions;
|
|
220
|
+
};
|
|
221
|
+
result: Resource;
|
|
222
|
+
};
|
|
223
|
+
"icon.create": {
|
|
224
|
+
args: {
|
|
225
|
+
options: IconMenuItemOptions;
|
|
226
|
+
};
|
|
227
|
+
result: Resource;
|
|
228
|
+
};
|
|
229
|
+
"predefined.separator": {
|
|
230
|
+
args: Record<string, never>;
|
|
231
|
+
result: Resource;
|
|
232
|
+
};
|
|
233
|
+
"predefined.section-header": {
|
|
234
|
+
args: {
|
|
235
|
+
text: string;
|
|
236
|
+
};
|
|
237
|
+
result: Resource;
|
|
238
|
+
};
|
|
239
|
+
"predefined.copy": {
|
|
240
|
+
args: {
|
|
241
|
+
text?: string | null;
|
|
242
|
+
};
|
|
243
|
+
result: Resource;
|
|
244
|
+
};
|
|
245
|
+
"predefined.cut": {
|
|
246
|
+
args: {
|
|
247
|
+
text?: string | null;
|
|
248
|
+
};
|
|
249
|
+
result: Resource;
|
|
250
|
+
};
|
|
251
|
+
"predefined.paste": {
|
|
252
|
+
args: {
|
|
253
|
+
text?: string | null;
|
|
254
|
+
};
|
|
255
|
+
result: Resource;
|
|
256
|
+
};
|
|
257
|
+
"predefined.paste-and-match-style": {
|
|
258
|
+
args: {
|
|
259
|
+
text?: string | null;
|
|
260
|
+
};
|
|
261
|
+
result: Resource;
|
|
262
|
+
};
|
|
263
|
+
"predefined.delete": {
|
|
264
|
+
args: {
|
|
265
|
+
text?: string | null;
|
|
266
|
+
};
|
|
267
|
+
result: Resource;
|
|
268
|
+
};
|
|
269
|
+
"predefined.select-all": {
|
|
270
|
+
args: {
|
|
271
|
+
text?: string | null;
|
|
272
|
+
};
|
|
273
|
+
result: Resource;
|
|
274
|
+
};
|
|
275
|
+
"predefined.undo": {
|
|
276
|
+
args: {
|
|
277
|
+
text?: string | null;
|
|
278
|
+
};
|
|
279
|
+
result: Resource;
|
|
280
|
+
};
|
|
281
|
+
"predefined.redo": {
|
|
282
|
+
args: {
|
|
283
|
+
text?: string | null;
|
|
284
|
+
};
|
|
285
|
+
result: Resource;
|
|
286
|
+
};
|
|
287
|
+
"predefined.minimize": {
|
|
288
|
+
args: {
|
|
289
|
+
text?: string | null;
|
|
290
|
+
};
|
|
291
|
+
result: Resource;
|
|
292
|
+
};
|
|
293
|
+
"predefined.maximize": {
|
|
294
|
+
args: {
|
|
295
|
+
text?: string | null;
|
|
296
|
+
};
|
|
297
|
+
result: Resource;
|
|
298
|
+
};
|
|
299
|
+
"predefined.zoom": {
|
|
300
|
+
args: {
|
|
301
|
+
text?: string | null;
|
|
302
|
+
};
|
|
303
|
+
result: Resource;
|
|
304
|
+
};
|
|
305
|
+
"predefined.actual-size": {
|
|
306
|
+
args: {
|
|
307
|
+
text?: string | null;
|
|
308
|
+
};
|
|
309
|
+
result: Resource;
|
|
310
|
+
};
|
|
311
|
+
"predefined.zoom-in": {
|
|
312
|
+
args: {
|
|
313
|
+
text?: string | null;
|
|
314
|
+
};
|
|
315
|
+
result: Resource;
|
|
316
|
+
};
|
|
317
|
+
"predefined.zoom-out": {
|
|
318
|
+
args: {
|
|
319
|
+
text?: string | null;
|
|
320
|
+
};
|
|
321
|
+
result: Resource;
|
|
322
|
+
};
|
|
323
|
+
"predefined.fullscreen": {
|
|
324
|
+
args: {
|
|
325
|
+
text?: string | null;
|
|
326
|
+
};
|
|
327
|
+
result: Resource;
|
|
328
|
+
};
|
|
329
|
+
"predefined.hide": {
|
|
330
|
+
args: {
|
|
331
|
+
text?: string | null;
|
|
332
|
+
};
|
|
333
|
+
result: Resource;
|
|
334
|
+
};
|
|
335
|
+
"predefined.hide-others": {
|
|
336
|
+
args: {
|
|
337
|
+
text?: string | null;
|
|
338
|
+
};
|
|
339
|
+
result: Resource;
|
|
340
|
+
};
|
|
341
|
+
"predefined.show-all": {
|
|
342
|
+
args: {
|
|
343
|
+
text?: string | null;
|
|
344
|
+
};
|
|
345
|
+
result: Resource;
|
|
346
|
+
};
|
|
347
|
+
"predefined.close-window": {
|
|
348
|
+
args: {
|
|
349
|
+
text?: string | null;
|
|
350
|
+
};
|
|
351
|
+
result: Resource;
|
|
352
|
+
};
|
|
353
|
+
"predefined.quit": {
|
|
354
|
+
args: {
|
|
355
|
+
text?: string | null;
|
|
356
|
+
};
|
|
357
|
+
result: Resource;
|
|
358
|
+
};
|
|
359
|
+
"predefined.services": {
|
|
360
|
+
args: {
|
|
361
|
+
text?: string | null;
|
|
362
|
+
};
|
|
363
|
+
result: Resource;
|
|
364
|
+
};
|
|
365
|
+
"predefined.bring-all-to-front": {
|
|
366
|
+
args: {
|
|
367
|
+
text?: string | null;
|
|
368
|
+
};
|
|
369
|
+
result: Resource;
|
|
370
|
+
};
|
|
371
|
+
"predefined.start-speaking": {
|
|
372
|
+
args: {
|
|
373
|
+
text?: string | null;
|
|
374
|
+
};
|
|
375
|
+
result: Resource;
|
|
376
|
+
};
|
|
377
|
+
"predefined.stop-speaking": {
|
|
378
|
+
args: {
|
|
379
|
+
text?: string | null;
|
|
380
|
+
};
|
|
381
|
+
result: Resource;
|
|
382
|
+
};
|
|
383
|
+
"predefined.start-dictation": {
|
|
384
|
+
args: {
|
|
385
|
+
text?: string | null;
|
|
386
|
+
};
|
|
387
|
+
result: Resource;
|
|
388
|
+
};
|
|
389
|
+
"predefined.emoji-and-symbols": {
|
|
390
|
+
args: {
|
|
391
|
+
text?: string | null;
|
|
392
|
+
};
|
|
393
|
+
result: Resource;
|
|
394
|
+
};
|
|
395
|
+
"predefined.about": {
|
|
396
|
+
args: {
|
|
397
|
+
text?: string | null;
|
|
398
|
+
metadata?: AboutMetadata | null;
|
|
399
|
+
};
|
|
400
|
+
result: Resource;
|
|
401
|
+
};
|
|
402
|
+
"menu.items": {
|
|
403
|
+
args: {
|
|
404
|
+
handle: string;
|
|
405
|
+
};
|
|
406
|
+
result: Resource[];
|
|
407
|
+
};
|
|
408
|
+
"menu.append": {
|
|
409
|
+
args: {
|
|
410
|
+
handle: string;
|
|
411
|
+
items: string[];
|
|
412
|
+
};
|
|
413
|
+
result: null;
|
|
414
|
+
};
|
|
415
|
+
"menu.prepend": {
|
|
416
|
+
args: {
|
|
417
|
+
handle: string;
|
|
418
|
+
items: string[];
|
|
419
|
+
};
|
|
420
|
+
result: null;
|
|
421
|
+
};
|
|
422
|
+
"menu.insert": {
|
|
423
|
+
args: {
|
|
424
|
+
handle: string;
|
|
425
|
+
items: string[];
|
|
426
|
+
position: number;
|
|
427
|
+
};
|
|
428
|
+
result: null;
|
|
429
|
+
};
|
|
430
|
+
"menu.remove": {
|
|
431
|
+
args: {
|
|
432
|
+
handle: string;
|
|
433
|
+
item: string;
|
|
434
|
+
};
|
|
435
|
+
result: null;
|
|
436
|
+
};
|
|
437
|
+
"menu.remove-at": {
|
|
438
|
+
args: {
|
|
439
|
+
handle: string;
|
|
440
|
+
position: number;
|
|
441
|
+
};
|
|
442
|
+
result: Resource | null;
|
|
443
|
+
};
|
|
444
|
+
"item.text": {
|
|
445
|
+
args: {
|
|
446
|
+
handle: string;
|
|
447
|
+
};
|
|
448
|
+
result: string;
|
|
449
|
+
};
|
|
450
|
+
"item.set-text": {
|
|
451
|
+
args: {
|
|
452
|
+
handle: string;
|
|
453
|
+
text: string;
|
|
454
|
+
};
|
|
455
|
+
result: null;
|
|
456
|
+
};
|
|
457
|
+
"item.is-enabled": {
|
|
458
|
+
args: {
|
|
459
|
+
handle: string;
|
|
460
|
+
};
|
|
461
|
+
result: boolean;
|
|
462
|
+
};
|
|
463
|
+
"item.set-enabled": {
|
|
464
|
+
args: {
|
|
465
|
+
handle: string;
|
|
466
|
+
enabled: boolean;
|
|
467
|
+
};
|
|
468
|
+
result: null;
|
|
469
|
+
};
|
|
470
|
+
"item.set-accelerator": {
|
|
471
|
+
args: {
|
|
472
|
+
handle: string;
|
|
473
|
+
accelerator: Accelerator | null;
|
|
474
|
+
};
|
|
475
|
+
result: null;
|
|
476
|
+
};
|
|
477
|
+
"check.is-checked": {
|
|
478
|
+
args: {
|
|
479
|
+
handle: string;
|
|
480
|
+
};
|
|
481
|
+
result: boolean;
|
|
482
|
+
};
|
|
483
|
+
"check.set-checked": {
|
|
484
|
+
args: {
|
|
485
|
+
handle: string;
|
|
486
|
+
checked: boolean;
|
|
487
|
+
};
|
|
488
|
+
result: null;
|
|
489
|
+
};
|
|
490
|
+
"item.set-icon": {
|
|
491
|
+
args: {
|
|
492
|
+
handle: string;
|
|
493
|
+
icon: IconSource | null;
|
|
494
|
+
iconAsTemplate?: boolean;
|
|
495
|
+
};
|
|
496
|
+
result: null;
|
|
497
|
+
};
|
|
498
|
+
"item.icon-is-template": {
|
|
499
|
+
args: {
|
|
500
|
+
handle: string;
|
|
501
|
+
};
|
|
502
|
+
result: boolean;
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
type MethodName = keyof Methods;
|
|
506
|
+
type Arguments<M extends MethodName> = Methods[M]["args"];
|
|
507
|
+
type Result<M extends MethodName> = Methods[M]["result"];
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region src/index.d.ts
|
|
510
|
+
interface TrayOptions extends Omit<TrayCreateOptions, "menu"> {
|
|
511
|
+
menu?: Menu | Submenu | null;
|
|
512
|
+
}
|
|
513
|
+
interface MenuOptions extends Omit<MenuCreateOptions, "items"> {
|
|
514
|
+
items?: readonly MenuEntry[];
|
|
515
|
+
}
|
|
516
|
+
interface SubmenuOptions extends Omit<SubmenuCreateOptions, "items"> {
|
|
517
|
+
items?: readonly MenuEntry[];
|
|
518
|
+
}
|
|
519
|
+
type MenuEntry = MenuItem | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu;
|
|
520
|
+
type TrayResource = TrayIcon | Menu | MenuEntry;
|
|
521
|
+
declare class TrayError extends Error {
|
|
522
|
+
readonly code: string;
|
|
523
|
+
constructor(code: string, message: string);
|
|
524
|
+
}
|
|
525
|
+
declare class Connection {
|
|
526
|
+
readonly context: KirieEventaContext;
|
|
527
|
+
constructor(context: KirieEventaContext);
|
|
528
|
+
request<M extends MethodName>(name: M, args: Arguments<M>): Promise<Result<M>>;
|
|
529
|
+
handle(resource: TrayObject): string;
|
|
530
|
+
onEvent(handler: (event: NativeEvent) => void): () => void;
|
|
531
|
+
object(resource: Resource): TrayResource;
|
|
532
|
+
}
|
|
533
|
+
declare abstract class TrayObject {
|
|
534
|
+
readonly handle: string;
|
|
535
|
+
readonly id: string;
|
|
536
|
+
abstract readonly kind: ResourceKind;
|
|
537
|
+
protected readonly connection: Connection;
|
|
538
|
+
/** @internal */
|
|
539
|
+
constructor(connection: Connection, resource: Resource);
|
|
540
|
+
/** @internal */
|
|
541
|
+
belongsTo(context: KirieEventaContext): boolean;
|
|
542
|
+
/** Closes this shared browser handle without removing the object from its native parents. */
|
|
543
|
+
close(): Promise<void>;
|
|
544
|
+
}
|
|
545
|
+
declare class TrayIcon extends TrayObject {
|
|
546
|
+
readonly kind: "tray";
|
|
547
|
+
setIcon(icon: IconSource | null, iconAsTemplate?: boolean): Promise<void>;
|
|
548
|
+
setMenu(menu: Menu | Submenu | null): Promise<void>;
|
|
549
|
+
setTooltip(tooltip: string | null): Promise<void>;
|
|
550
|
+
setTitle(title: string | null): Promise<void>;
|
|
551
|
+
setVisible(visible: boolean): Promise<void>;
|
|
552
|
+
setMenuOnLeftClick(enabled: boolean): Promise<void>;
|
|
553
|
+
setMenuOnRightClick(enabled: boolean): Promise<void>;
|
|
554
|
+
showMenu(): Promise<void>;
|
|
555
|
+
rect(): Promise<Rect | null>;
|
|
556
|
+
iconIsTemplate(): Promise<boolean>;
|
|
557
|
+
setTempDirPath(path: string | null): Promise<void>;
|
|
558
|
+
}
|
|
559
|
+
declare abstract class MenuContainer extends TrayObject {
|
|
560
|
+
items(): Promise<MenuEntry[]>;
|
|
561
|
+
append(...items: MenuEntry[]): Promise<void>;
|
|
562
|
+
prepend(...items: MenuEntry[]): Promise<void>;
|
|
563
|
+
insert(position: number, ...items: MenuEntry[]): Promise<void>;
|
|
564
|
+
remove(item: MenuEntry): Promise<void>;
|
|
565
|
+
removeAt(position: number): Promise<MenuEntry | null>;
|
|
566
|
+
}
|
|
567
|
+
declare class Menu extends MenuContainer {
|
|
568
|
+
readonly kind: "menu";
|
|
569
|
+
}
|
|
570
|
+
declare class Submenu extends MenuContainer {
|
|
571
|
+
readonly kind: "submenu";
|
|
572
|
+
text(): Promise<string>;
|
|
573
|
+
setText(text: string): Promise<void>;
|
|
574
|
+
isEnabled(): Promise<boolean>;
|
|
575
|
+
setEnabled(enabled: boolean): Promise<void>;
|
|
576
|
+
setIcon(icon: IconSource | null, iconAsTemplate?: boolean): Promise<void>;
|
|
577
|
+
iconIsTemplate(): Promise<boolean>;
|
|
578
|
+
}
|
|
579
|
+
declare abstract class TextMenuItem extends TrayObject {
|
|
580
|
+
text(): Promise<string>;
|
|
581
|
+
setText(text: string): Promise<void>;
|
|
582
|
+
}
|
|
583
|
+
declare abstract class EditableMenuItem extends TextMenuItem {
|
|
584
|
+
isEnabled(): Promise<boolean>;
|
|
585
|
+
setEnabled(enabled: boolean): Promise<void>;
|
|
586
|
+
setAccelerator(accelerator: Accelerator | null): Promise<void>;
|
|
587
|
+
}
|
|
588
|
+
declare class MenuItem extends EditableMenuItem {
|
|
589
|
+
readonly kind: "item";
|
|
590
|
+
}
|
|
591
|
+
declare class CheckMenuItem extends EditableMenuItem {
|
|
592
|
+
readonly kind: "check";
|
|
593
|
+
isChecked(): Promise<boolean>;
|
|
594
|
+
setChecked(checked: boolean): Promise<void>;
|
|
595
|
+
}
|
|
596
|
+
declare class IconMenuItem extends EditableMenuItem {
|
|
597
|
+
readonly kind: "icon";
|
|
598
|
+
setIcon(icon: IconSource | null, iconAsTemplate?: boolean): Promise<void>;
|
|
599
|
+
iconIsTemplate(): Promise<boolean>;
|
|
600
|
+
}
|
|
601
|
+
declare class PredefinedMenuItem extends TextMenuItem {
|
|
602
|
+
readonly kind: "predefined";
|
|
603
|
+
}
|
|
604
|
+
declare class TrayClient {
|
|
605
|
+
private readonly connection;
|
|
606
|
+
constructor(context: KirieEventaContext);
|
|
607
|
+
createTray(options?: TrayOptions): Promise<TrayIcon>;
|
|
608
|
+
createMenu(options?: MenuOptions): Promise<Menu>;
|
|
609
|
+
createSubmenu(options: SubmenuOptions): Promise<Submenu>;
|
|
610
|
+
createMenuItem(options: MenuItemOptions): Promise<MenuItem>;
|
|
611
|
+
createCheckMenuItem(options: CheckMenuItemOptions): Promise<CheckMenuItem>;
|
|
612
|
+
createIconMenuItem(options: IconMenuItemOptions): Promise<IconMenuItem>;
|
|
613
|
+
/** Calls the public upstream PredefinedMenuItem constructors. */
|
|
614
|
+
readonly predefined: {
|
|
615
|
+
separator: () => Promise<PredefinedMenuItem>;
|
|
616
|
+
sectionHeader: (text: string) => Promise<PredefinedMenuItem>;
|
|
617
|
+
copy: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
618
|
+
cut: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
619
|
+
paste: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
620
|
+
pasteAndMatchStyle: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
621
|
+
delete: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
622
|
+
selectAll: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
623
|
+
undo: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
624
|
+
redo: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
625
|
+
minimize: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
626
|
+
maximize: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
627
|
+
zoom: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
628
|
+
actualSize: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
629
|
+
zoomIn: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
630
|
+
zoomOut: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
631
|
+
fullscreen: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
632
|
+
hide: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
633
|
+
hideOthers: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
634
|
+
showAll: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
635
|
+
closeWindow: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
636
|
+
quit: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
637
|
+
services: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
638
|
+
bringAllToFront: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
639
|
+
startSpeaking: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
640
|
+
stopSpeaking: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
641
|
+
startDictation: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
642
|
+
emojiAndSymbols: (text?: string | null) => Promise<PredefinedMenuItem>;
|
|
643
|
+
about: (text?: string | null, metadata?: AboutMetadata | null) => Promise<PredefinedMenuItem>;
|
|
644
|
+
};
|
|
645
|
+
/** Wraps an application-provided descriptor without creating another native reference. */
|
|
646
|
+
fromResource(resource: Resource): TrayResource;
|
|
647
|
+
/** Receives global upstream events by native ID, independent of resource handles. */
|
|
648
|
+
onEvent(handler: (event: NativeEvent) => void): () => void;
|
|
649
|
+
}
|
|
37
650
|
declare function createTrayClient(context: KirieEventaContext): TrayClient;
|
|
38
651
|
//#endregion
|
|
39
|
-
export { TrayClient, TrayIcon,
|
|
652
|
+
export { type AboutMetadata, type Accelerator, CheckMenuItem, type CheckMenuItemOptions, IconMenuItem, type IconMenuItemOptions, type IconSource, Menu, MenuEntry, type MenuEvent, MenuItem, type MenuItemOptions, MenuOptions, type NativeEvent, type Position, PredefinedMenuItem, type Rect, type Resource, type ResourceKind, Submenu, SubmenuOptions, TrayClient, TrayError, type TrayEvent, TrayIcon, TrayOptions, TrayResource, createTrayClient };
|
|
40
653
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/contracts.ts","../src/index.ts"],"mappings":";;KAAY;UAEK;EACf;EACA,MAAM;EACN;;KAGU;EACN;EAAkB;;EACpB;EAAc;EAAyB;EAAe;;EACtD;EAAgC;;EAChC;EAAuB;;EACvB;EAAsB;EAAc;EAAgB;;EACpD;EAA0B;EAA2B;EAAgB;;UAExD;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OA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e,yBAAuB,QAAQ;IAE9C,UAAgB,yBAAuB,QAAQ;IAE/C,aAAmB,yBAAuB,QAAQ;IAElD,OAAa,yBAAuB,QAAQ;IAE5C,aAAmB,yBAAuB,QAAQ;IAElD,UAAgB,yBAAuB,QAAQ;IAE/C,cAAoB,yBAAuB,QAAQ;IAEnD,OAAa,yBAAuB,QAAQ;IAE5C,WAAiB,yBAAuB,QAAQ;IAEhD,kBAAwB,yBAAuB,QAAQ;IAEvD,gBAAsB,yBAAuB,QAAQ;IAErD,eAAqB,yBAAuB,QAAQ;IAEpD,iBAAuB,yBAAuB,QAAQ;IAEtD,kBAAwB,yBAAuB,QAAQ;IAEvD,QAAc,sBAAsB,WAAW,yBAAuB,QAAQ;;;EAKhF,aAAa,UAAU,WAAW;;EAKlC,QAAQ,UAAU,OAAO;;iBAKX,iBAAiB,SAAS,qBAAqB"}
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,340 @@
|
|
|
1
|
-
import { defineInboundEventa,
|
|
1
|
+
import { defineInboundEventa, defineInvoke, defineInvokeEventa } from "@moeru/eventa";
|
|
2
2
|
//#region src/index.ts
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
3
|
+
const nativeEvent = defineInboundEventa("kirie:tray:event");
|
|
4
|
+
var TrayError = class extends Error {
|
|
5
|
+
code;
|
|
6
|
+
constructor(code, message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "TrayError";
|
|
9
|
+
this.code = code;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var Connection = class {
|
|
13
|
+
context;
|
|
14
|
+
constructor(context) {
|
|
15
|
+
this.context = context;
|
|
16
|
+
}
|
|
17
|
+
async request(name, args) {
|
|
18
|
+
const event = defineInvokeEventa(`kirie:tray:${name.replace(".", "-")}`);
|
|
19
|
+
const reply = await defineInvoke(this.context, event)(args);
|
|
20
|
+
if (!reply.ok) throw new TrayError(reply.error.code, reply.error.message);
|
|
21
|
+
return reply.value;
|
|
22
|
+
}
|
|
23
|
+
handle(resource) {
|
|
24
|
+
if (!resource.belongsTo(this.context)) throw new TrayError("invalid-argument", "Tray resources belong to different Eventa contexts.");
|
|
25
|
+
return resource.handle;
|
|
26
|
+
}
|
|
27
|
+
onEvent(handler) {
|
|
28
|
+
return this.context.on(nativeEvent, ({ body }) => {
|
|
29
|
+
handler(body);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
object(resource) {
|
|
33
|
+
const Constructor = {
|
|
34
|
+
tray: TrayIcon,
|
|
35
|
+
menu: Menu,
|
|
36
|
+
submenu: Submenu,
|
|
37
|
+
item: MenuItem,
|
|
38
|
+
check: CheckMenuItem,
|
|
39
|
+
icon: IconMenuItem,
|
|
40
|
+
predefined: PredefinedMenuItem
|
|
41
|
+
}[resource.kind];
|
|
42
|
+
return new Constructor(this, resource);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var TrayObject = class {
|
|
46
|
+
handle;
|
|
47
|
+
id;
|
|
48
|
+
connection;
|
|
49
|
+
/** @internal */
|
|
50
|
+
constructor(connection, resource) {
|
|
51
|
+
this.connection = connection;
|
|
52
|
+
this.handle = resource.handle;
|
|
53
|
+
this.id = resource.id;
|
|
54
|
+
}
|
|
55
|
+
/** @internal */
|
|
56
|
+
belongsTo(context) {
|
|
57
|
+
return this.connection.context === context;
|
|
58
|
+
}
|
|
59
|
+
/** Closes this shared browser handle without removing the object from its native parents. */
|
|
60
|
+
async close() {
|
|
61
|
+
await this.connection.request("resource.close", { handle: this.handle });
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var TrayIcon = class extends TrayObject {
|
|
65
|
+
kind = "tray";
|
|
66
|
+
async setIcon(icon, iconAsTemplate) {
|
|
67
|
+
await this.connection.request("tray.set-icon", {
|
|
68
|
+
handle: this.handle,
|
|
69
|
+
icon,
|
|
70
|
+
iconAsTemplate
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async setMenu(menu) {
|
|
74
|
+
await this.connection.request("tray.set-menu", {
|
|
75
|
+
handle: this.handle,
|
|
76
|
+
menu: menu === null ? null : this.connection.handle(menu)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async setTooltip(tooltip) {
|
|
80
|
+
await this.connection.request("tray.set-tooltip", {
|
|
81
|
+
handle: this.handle,
|
|
82
|
+
tooltip
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
async setTitle(title) {
|
|
86
|
+
await this.connection.request("tray.set-title", {
|
|
87
|
+
handle: this.handle,
|
|
88
|
+
title
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async setVisible(visible) {
|
|
92
|
+
await this.connection.request("tray.set-visible", {
|
|
93
|
+
handle: this.handle,
|
|
94
|
+
visible
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async setMenuOnLeftClick(enabled) {
|
|
98
|
+
await this.connection.request("tray.set-menu-on-left-click", {
|
|
99
|
+
handle: this.handle,
|
|
100
|
+
enabled
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async setMenuOnRightClick(enabled) {
|
|
104
|
+
await this.connection.request("tray.set-menu-on-right-click", {
|
|
105
|
+
handle: this.handle,
|
|
106
|
+
enabled
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async showMenu() {
|
|
110
|
+
await this.connection.request("tray.show-menu", { handle: this.handle });
|
|
111
|
+
}
|
|
112
|
+
rect() {
|
|
113
|
+
return this.connection.request("tray.rect", { handle: this.handle });
|
|
114
|
+
}
|
|
115
|
+
iconIsTemplate() {
|
|
116
|
+
return this.connection.request("tray.icon-is-template", { handle: this.handle });
|
|
117
|
+
}
|
|
118
|
+
async setTempDirPath(path) {
|
|
119
|
+
await this.connection.request("tray.set-temp-dir-path", {
|
|
120
|
+
handle: this.handle,
|
|
121
|
+
path
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var MenuContainer = class extends TrayObject {
|
|
126
|
+
async items() {
|
|
127
|
+
return (await this.connection.request("menu.items", { handle: this.handle })).map((item) => this.connection.object(item));
|
|
128
|
+
}
|
|
129
|
+
async append(...items) {
|
|
130
|
+
await this.connection.request("menu.append", {
|
|
131
|
+
handle: this.handle,
|
|
132
|
+
items: items.map((item) => this.connection.handle(item))
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async prepend(...items) {
|
|
136
|
+
await this.connection.request("menu.prepend", {
|
|
137
|
+
handle: this.handle,
|
|
138
|
+
items: items.map((item) => this.connection.handle(item))
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async insert(position, ...items) {
|
|
142
|
+
await this.connection.request("menu.insert", {
|
|
143
|
+
handle: this.handle,
|
|
144
|
+
items: items.map((item) => this.connection.handle(item)),
|
|
145
|
+
position
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async remove(item) {
|
|
149
|
+
await this.connection.request("menu.remove", {
|
|
150
|
+
handle: this.handle,
|
|
151
|
+
item: this.connection.handle(item)
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async removeAt(position) {
|
|
155
|
+
const item = await this.connection.request("menu.remove-at", {
|
|
156
|
+
handle: this.handle,
|
|
157
|
+
position
|
|
158
|
+
});
|
|
159
|
+
return item === null ? null : this.connection.object(item);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var Menu = class extends MenuContainer {
|
|
163
|
+
kind = "menu";
|
|
164
|
+
};
|
|
165
|
+
var Submenu = class extends MenuContainer {
|
|
166
|
+
kind = "submenu";
|
|
167
|
+
text() {
|
|
168
|
+
return this.connection.request("item.text", { handle: this.handle });
|
|
169
|
+
}
|
|
170
|
+
async setText(text) {
|
|
171
|
+
await this.connection.request("item.set-text", {
|
|
172
|
+
handle: this.handle,
|
|
173
|
+
text
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
isEnabled() {
|
|
177
|
+
return this.connection.request("item.is-enabled", { handle: this.handle });
|
|
178
|
+
}
|
|
179
|
+
async setEnabled(enabled) {
|
|
180
|
+
await this.connection.request("item.set-enabled", {
|
|
181
|
+
handle: this.handle,
|
|
182
|
+
enabled
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
async setIcon(icon, iconAsTemplate) {
|
|
186
|
+
await this.connection.request("item.set-icon", {
|
|
187
|
+
handle: this.handle,
|
|
188
|
+
icon,
|
|
189
|
+
iconAsTemplate
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
iconIsTemplate() {
|
|
193
|
+
return this.connection.request("item.icon-is-template", { handle: this.handle });
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
var TextMenuItem = class extends TrayObject {
|
|
197
|
+
text() {
|
|
198
|
+
return this.connection.request("item.text", { handle: this.handle });
|
|
199
|
+
}
|
|
200
|
+
async setText(text) {
|
|
201
|
+
await this.connection.request("item.set-text", {
|
|
202
|
+
handle: this.handle,
|
|
203
|
+
text
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var EditableMenuItem = class extends TextMenuItem {
|
|
208
|
+
isEnabled() {
|
|
209
|
+
return this.connection.request("item.is-enabled", { handle: this.handle });
|
|
210
|
+
}
|
|
211
|
+
async setEnabled(enabled) {
|
|
212
|
+
await this.connection.request("item.set-enabled", {
|
|
213
|
+
handle: this.handle,
|
|
214
|
+
enabled
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
async setAccelerator(accelerator) {
|
|
218
|
+
await this.connection.request("item.set-accelerator", {
|
|
219
|
+
handle: this.handle,
|
|
220
|
+
accelerator
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
var MenuItem = class extends EditableMenuItem {
|
|
225
|
+
kind = "item";
|
|
226
|
+
};
|
|
227
|
+
var CheckMenuItem = class extends EditableMenuItem {
|
|
228
|
+
kind = "check";
|
|
229
|
+
isChecked() {
|
|
230
|
+
return this.connection.request("check.is-checked", { handle: this.handle });
|
|
231
|
+
}
|
|
232
|
+
async setChecked(checked) {
|
|
233
|
+
await this.connection.request("check.set-checked", {
|
|
234
|
+
handle: this.handle,
|
|
235
|
+
checked
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var IconMenuItem = class extends EditableMenuItem {
|
|
240
|
+
kind = "icon";
|
|
241
|
+
async setIcon(icon, iconAsTemplate) {
|
|
242
|
+
await this.connection.request("item.set-icon", {
|
|
243
|
+
handle: this.handle,
|
|
244
|
+
icon,
|
|
245
|
+
iconAsTemplate
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
iconIsTemplate() {
|
|
249
|
+
return this.connection.request("item.icon-is-template", { handle: this.handle });
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
var PredefinedMenuItem = class extends TextMenuItem {
|
|
253
|
+
kind = "predefined";
|
|
254
|
+
};
|
|
255
|
+
var TrayClient = class {
|
|
256
|
+
connection;
|
|
257
|
+
constructor(context) {
|
|
258
|
+
this.connection = new Connection(context);
|
|
259
|
+
}
|
|
260
|
+
async createTray(options = {}) {
|
|
261
|
+
const resource = await this.connection.request("tray.create", { options: {
|
|
262
|
+
...options,
|
|
263
|
+
menu: options.menu == null ? options.menu : this.connection.handle(options.menu)
|
|
264
|
+
} });
|
|
265
|
+
return new TrayIcon(this.connection, resource);
|
|
266
|
+
}
|
|
267
|
+
async createMenu(options = {}) {
|
|
268
|
+
const resource = await this.connection.request("menu.create", { options: {
|
|
269
|
+
...options,
|
|
270
|
+
items: options.items?.map((item) => this.connection.handle(item))
|
|
271
|
+
} });
|
|
272
|
+
return new Menu(this.connection, resource);
|
|
273
|
+
}
|
|
274
|
+
async createSubmenu(options) {
|
|
275
|
+
const resource = await this.connection.request("submenu.create", { options: {
|
|
276
|
+
...options,
|
|
277
|
+
items: options.items?.map((item) => this.connection.handle(item))
|
|
278
|
+
} });
|
|
279
|
+
return new Submenu(this.connection, resource);
|
|
280
|
+
}
|
|
281
|
+
async createMenuItem(options) {
|
|
282
|
+
return new MenuItem(this.connection, await this.connection.request("item.create", { options }));
|
|
283
|
+
}
|
|
284
|
+
async createCheckMenuItem(options) {
|
|
285
|
+
return new CheckMenuItem(this.connection, await this.connection.request("check.create", { options }));
|
|
286
|
+
}
|
|
287
|
+
async createIconMenuItem(options) {
|
|
288
|
+
return new IconMenuItem(this.connection, await this.connection.request("icon.create", { options }));
|
|
289
|
+
}
|
|
290
|
+
/** Calls the public upstream PredefinedMenuItem constructors. */
|
|
291
|
+
predefined = {
|
|
292
|
+
separator: async () => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.separator", {})),
|
|
293
|
+
sectionHeader: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.section-header", { text })),
|
|
294
|
+
copy: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.copy", { text })),
|
|
295
|
+
cut: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.cut", { text })),
|
|
296
|
+
paste: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.paste", { text })),
|
|
297
|
+
pasteAndMatchStyle: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.paste-and-match-style", { text })),
|
|
298
|
+
delete: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.delete", { text })),
|
|
299
|
+
selectAll: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.select-all", { text })),
|
|
300
|
+
undo: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.undo", { text })),
|
|
301
|
+
redo: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.redo", { text })),
|
|
302
|
+
minimize: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.minimize", { text })),
|
|
303
|
+
maximize: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.maximize", { text })),
|
|
304
|
+
zoom: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.zoom", { text })),
|
|
305
|
+
actualSize: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.actual-size", { text })),
|
|
306
|
+
zoomIn: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.zoom-in", { text })),
|
|
307
|
+
zoomOut: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.zoom-out", { text })),
|
|
308
|
+
fullscreen: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.fullscreen", { text })),
|
|
309
|
+
hide: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.hide", { text })),
|
|
310
|
+
hideOthers: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.hide-others", { text })),
|
|
311
|
+
showAll: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.show-all", { text })),
|
|
312
|
+
closeWindow: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.close-window", { text })),
|
|
313
|
+
quit: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.quit", { text })),
|
|
314
|
+
services: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.services", { text })),
|
|
315
|
+
bringAllToFront: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.bring-all-to-front", { text })),
|
|
316
|
+
startSpeaking: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.start-speaking", { text })),
|
|
317
|
+
stopSpeaking: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.stop-speaking", { text })),
|
|
318
|
+
startDictation: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.start-dictation", { text })),
|
|
319
|
+
emojiAndSymbols: async (text) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.emoji-and-symbols", { text })),
|
|
320
|
+
about: async (text, metadata) => new PredefinedMenuItem(this.connection, await this.connection.request("predefined.about", {
|
|
321
|
+
text,
|
|
322
|
+
metadata
|
|
323
|
+
}))
|
|
33
324
|
};
|
|
325
|
+
/** Wraps an application-provided descriptor without creating another native reference. */
|
|
326
|
+
fromResource(resource) {
|
|
327
|
+
return this.connection.object(resource);
|
|
328
|
+
}
|
|
329
|
+
/** Receives global upstream events by native ID, independent of resource handles. */
|
|
330
|
+
onEvent(handler) {
|
|
331
|
+
return this.connection.onEvent(handler);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
function createTrayClient(context) {
|
|
335
|
+
return new TrayClient(context);
|
|
34
336
|
}
|
|
35
337
|
//#endregion
|
|
36
|
-
export {
|
|
338
|
+
export { CheckMenuItem, IconMenuItem, Menu, MenuItem, PredefinedMenuItem, Submenu, TrayClient, TrayError, TrayIcon, createTrayClient };
|
|
37
339
|
|
|
38
340
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { KirieEventaContext } from \"@gd-kirie/ipc-eventa\";\nimport type { InboundEventa } from \"@moeru/eventa\";\nimport { defineInboundEventa, defineInvokeEventa, defineInvokes } from \"@moeru/eventa\";\n\nexport interface TrayIcon {\n icon: string;\n iconAsTemplate?: boolean;\n}\n\nexport type TrayMenuItem =\n | { type: \"item\"; id: string; text: string; enabled?: boolean } |\n { type: \"check\"; id: string; text: string; enabled?: boolean; checked?: boolean } |\n { type: \"submenu\"; text: string; enabled?: boolean; children: TrayMenuItem[] } |\n { type: \"separator\" };\n\nexport interface TrayClient {\n create: (icon: TrayIcon) => Promise<void>;\n setIcon: (icon: TrayIcon) => Promise<void>;\n setMenu: (items: TrayMenuItem[]) => Promise<void>;\n setTooltip: (tooltip: string | null) => Promise<void>;\n setVisible: (visible: boolean) => Promise<void>;\n destroy: () => Promise<void>;\n}\n\ntype EmptyPayload = Record<string, never>;\n\nconst events = {\n create: defineInvokeEventa<EmptyPayload, TrayIcon>(\"kirie:tray:create\"),\n setIcon: defineInvokeEventa<EmptyPayload, TrayIcon>(\"kirie:tray:set-icon\"),\n setMenu: defineInvokeEventa<EmptyPayload, TrayMenuItem[]>(\"kirie:tray:set-menu\"),\n setTooltip: defineInvokeEventa<EmptyPayload, string | null>(\"kirie:tray:set-tooltip\"),\n setVisible: defineInvokeEventa<EmptyPayload, boolean>(\"kirie:tray:set-visible\"),\n destroy: defineInvokeEventa<EmptyPayload, EmptyPayload>(\"kirie:tray:destroy\"),\n};\n\nexport const trayMenuItemActivated: InboundEventa<string> = defineInboundEventa(\n \"kirie:tray:menu-item-activated\",\n);\n\nexport function createTrayClient(context: KirieEventaContext): TrayClient {\n const invokes = defineInvokes(context, events);\n\n return {\n async create(icon) {\n await invokes.create(icon);\n },\n async setIcon(icon) {\n await invokes.setIcon(icon);\n },\n async setMenu(items) {\n await invokes.setMenu(items);\n },\n async setTooltip(tooltip) {\n await invokes.setTooltip(tooltip);\n },\n async setVisible(visible) {\n await invokes.setVisible(visible);\n },\n async destroy() {\n await invokes.destroy({});\n },\n };\n}\n"],"mappings":";;AA0BA,MAAM,SAAS;CACb,QAAQ,mBAA2C,mBAAmB;CACtE,SAAS,mBAA2C,qBAAqB;CACzE,SAAS,mBAAiD,qBAAqB;CAC/E,YAAY,mBAAgD,wBAAwB;CACpF,YAAY,mBAA0C,wBAAwB;CAC9E,SAAS,mBAA+C,oBAAoB;AAC9E;AAEA,MAAa,wBAA+C,oBAC1D,gCACF;AAEA,SAAgB,iBAAiB,SAAyC;CACxE,MAAM,UAAU,cAAc,SAAS,MAAM;CAE7C,OAAO;EACL,MAAM,OAAO,MAAM;GACjB,MAAM,QAAQ,OAAO,IAAI;EAC3B;EACA,MAAM,QAAQ,MAAM;GAClB,MAAM,QAAQ,QAAQ,IAAI;EAC5B;EACA,MAAM,QAAQ,OAAO;GACnB,MAAM,QAAQ,QAAQ,KAAK;EAC7B;EACA,MAAM,WAAW,SAAS;GACxB,MAAM,QAAQ,WAAW,OAAO;EAClC;EACA,MAAM,WAAW,SAAS;GACxB,MAAM,QAAQ,WAAW,OAAO;EAClC;EACA,MAAM,UAAU;GACd,MAAM,QAAQ,QAAQ,CAAC,CAAC;EAC1B;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { KirieEventaContext } from \"@gd-kirie/ipc-eventa\";\nimport type {\n AboutMetadata,\n Accelerator,\n Arguments,\n CheckMenuItemOptions,\n IconMenuItemOptions,\n IconSource,\n MenuCreateOptions,\n MenuItemOptions,\n MethodName,\n NativeEvent,\n Rect,\n Reply,\n Resource,\n ResourceKind,\n Result,\n SubmenuCreateOptions,\n TrayCreateOptions,\n} from \"./contracts\";\nimport { defineInboundEventa, defineInvoke, defineInvokeEventa } from \"@moeru/eventa\";\n\nexport type {\n AboutMetadata,\n Accelerator,\n CheckMenuItemOptions,\n IconMenuItemOptions,\n IconSource,\n MenuEvent,\n MenuItemOptions,\n NativeEvent,\n Position,\n Rect,\n Resource,\n ResourceKind,\n TrayEvent,\n} from \"./contracts\";\n\nexport interface TrayOptions extends Omit<TrayCreateOptions, \"menu\"> {\n menu?: Menu | Submenu | null;\n}\n\nexport interface MenuOptions extends Omit<MenuCreateOptions, \"items\"> {\n items?: readonly MenuEntry[];\n}\n\nexport interface SubmenuOptions extends Omit<SubmenuCreateOptions, \"items\"> {\n items?: readonly MenuEntry[];\n}\n\nexport type MenuEntry = MenuItem | CheckMenuItem | IconMenuItem | PredefinedMenuItem | Submenu;\nexport type TrayResource = TrayIcon | Menu | MenuEntry;\n\nconst nativeEvent = defineInboundEventa<NativeEvent>(\"kirie:tray:event\");\n\nexport class TrayError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string) {\n super(message);\n this.name = \"TrayError\";\n this.code = code;\n }\n}\n\nclass Connection {\n readonly context: KirieEventaContext;\n\n constructor(context: KirieEventaContext) {\n this.context = context;\n }\n\n async request<M extends MethodName>(name: M, args: Arguments<M>): Promise<Result<M>> {\n const event = defineInvokeEventa<Reply, Arguments<M>>(`kirie:tray:${name.replace(\".\", \"-\")}`);\n const reply = await defineInvoke(this.context, event)(args);\n if (!reply.ok) {\n throw new TrayError(reply.error.code, reply.error.message);\n }\n\n return reply.value as Result<M>;\n }\n\n handle(resource: TrayObject): string {\n if (!resource.belongsTo(this.context)) {\n throw new TrayError(\"invalid-argument\", \"Tray resources belong to different Eventa contexts.\");\n }\n\n return resource.handle;\n }\n\n onEvent(handler: (event: NativeEvent) => void): () => void {\n return this.context.on(nativeEvent, ({ body }) => {\n handler(body!);\n });\n }\n\n object(resource: Resource): TrayResource {\n const constructors = {\n tray: TrayIcon,\n menu: Menu,\n submenu: Submenu,\n item: MenuItem,\n check: CheckMenuItem,\n icon: IconMenuItem,\n predefined: PredefinedMenuItem,\n };\n const Constructor = constructors[resource.kind];\n return new Constructor(this, resource);\n }\n}\n\nabstract class TrayObject {\n readonly handle: string;\n readonly id: string;\n abstract readonly kind: ResourceKind;\n protected readonly connection: Connection;\n\n /** @internal */\n constructor(connection: Connection, resource: Resource) {\n this.connection = connection;\n this.handle = resource.handle;\n this.id = resource.id;\n }\n\n /** @internal */\n belongsTo(context: KirieEventaContext): boolean {\n return this.connection.context === context;\n }\n\n /** Closes this shared browser handle without removing the object from its native parents. */\n async close(): Promise<void> {\n await this.connection.request(\"resource.close\", { handle: this.handle });\n }\n}\n\nexport class TrayIcon extends TrayObject {\n readonly kind = \"tray\" as const;\n\n async setIcon(icon: IconSource | null, iconAsTemplate?: boolean): Promise<void> {\n await this.connection.request(\"tray.set-icon\", { handle: this.handle, icon, iconAsTemplate });\n }\n\n async setMenu(menu: Menu | Submenu | null): Promise<void> {\n await this.connection.request(\"tray.set-menu\", {\n handle: this.handle,\n menu: menu === null ? null : this.connection.handle(menu),\n });\n }\n\n async setTooltip(tooltip: string | null): Promise<void> {\n await this.connection.request(\"tray.set-tooltip\", { handle: this.handle, tooltip });\n }\n\n async setTitle(title: string | null): Promise<void> {\n await this.connection.request(\"tray.set-title\", { handle: this.handle, title });\n }\n\n async setVisible(visible: boolean): Promise<void> {\n await this.connection.request(\"tray.set-visible\", { handle: this.handle, visible });\n }\n\n async setMenuOnLeftClick(enabled: boolean): Promise<void> {\n await this.connection.request(\"tray.set-menu-on-left-click\", { handle: this.handle, enabled });\n }\n\n async setMenuOnRightClick(enabled: boolean): Promise<void> {\n await this.connection.request(\"tray.set-menu-on-right-click\", { handle: this.handle, enabled });\n }\n\n async showMenu(): Promise<void> {\n await this.connection.request(\"tray.show-menu\", { handle: this.handle });\n }\n\n rect(): Promise<Rect | null> {\n return this.connection.request(\"tray.rect\", { handle: this.handle });\n }\n\n iconIsTemplate(): Promise<boolean> {\n return this.connection.request(\"tray.icon-is-template\", { handle: this.handle });\n }\n\n async setTempDirPath(path: string | null): Promise<void> {\n await this.connection.request(\"tray.set-temp-dir-path\", { handle: this.handle, path });\n }\n}\n\nabstract class MenuContainer extends TrayObject {\n async items(): Promise<MenuEntry[]> {\n const items = await this.connection.request(\"menu.items\", { handle: this.handle });\n return items.map((item) => this.connection.object(item) as MenuEntry);\n }\n\n async append(...items: MenuEntry[]): Promise<void> {\n await this.connection.request(\"menu.append\", {\n handle: this.handle,\n items: items.map((item) => this.connection.handle(item)),\n });\n }\n\n async prepend(...items: MenuEntry[]): Promise<void> {\n await this.connection.request(\"menu.prepend\", {\n handle: this.handle,\n items: items.map((item) => this.connection.handle(item)),\n });\n }\n\n async insert(position: number, ...items: MenuEntry[]): Promise<void> {\n await this.connection.request(\"menu.insert\", {\n handle: this.handle,\n items: items.map((item) => this.connection.handle(item)),\n position,\n });\n }\n\n async remove(item: MenuEntry): Promise<void> {\n await this.connection.request(\"menu.remove\", { handle: this.handle, item: this.connection.handle(item) });\n }\n\n async removeAt(position: number): Promise<MenuEntry | null> {\n const item = await this.connection.request(\"menu.remove-at\", { handle: this.handle, position });\n return item === null ? null : this.connection.object(item) as MenuEntry;\n }\n}\n\nexport class Menu extends MenuContainer {\n readonly kind = \"menu\" as const;\n}\n\nexport class Submenu extends MenuContainer {\n readonly kind = \"submenu\" as const;\n\n text(): Promise<string> {\n return this.connection.request(\"item.text\", { handle: this.handle });\n }\n\n async setText(text: string): Promise<void> {\n await this.connection.request(\"item.set-text\", { handle: this.handle, text });\n }\n\n isEnabled(): Promise<boolean> {\n return this.connection.request(\"item.is-enabled\", { handle: this.handle });\n }\n\n async setEnabled(enabled: boolean): Promise<void> {\n await this.connection.request(\"item.set-enabled\", { handle: this.handle, enabled });\n }\n\n async setIcon(icon: IconSource | null, iconAsTemplate?: boolean): Promise<void> {\n await this.connection.request(\"item.set-icon\", { handle: this.handle, icon, iconAsTemplate });\n }\n\n iconIsTemplate(): Promise<boolean> {\n return this.connection.request(\"item.icon-is-template\", { handle: this.handle });\n }\n}\n\nabstract class TextMenuItem extends TrayObject {\n text(): Promise<string> {\n return this.connection.request(\"item.text\", { handle: this.handle });\n }\n\n async setText(text: string): Promise<void> {\n await this.connection.request(\"item.set-text\", { handle: this.handle, text });\n }\n}\n\nabstract class EditableMenuItem extends TextMenuItem {\n isEnabled(): Promise<boolean> {\n return this.connection.request(\"item.is-enabled\", { handle: this.handle });\n }\n\n async setEnabled(enabled: boolean): Promise<void> {\n await this.connection.request(\"item.set-enabled\", { handle: this.handle, enabled });\n }\n\n async setAccelerator(accelerator: Accelerator | null): Promise<void> {\n await this.connection.request(\"item.set-accelerator\", { handle: this.handle, accelerator });\n }\n}\n\nexport class MenuItem extends EditableMenuItem {\n readonly kind = \"item\" as const;\n}\n\nexport class CheckMenuItem extends EditableMenuItem {\n readonly kind = \"check\" as const;\n\n isChecked(): Promise<boolean> {\n return this.connection.request(\"check.is-checked\", { handle: this.handle });\n }\n\n async setChecked(checked: boolean): Promise<void> {\n await this.connection.request(\"check.set-checked\", { handle: this.handle, checked });\n }\n}\n\nexport class IconMenuItem extends EditableMenuItem {\n readonly kind = \"icon\" as const;\n\n async setIcon(icon: IconSource | null, iconAsTemplate?: boolean): Promise<void> {\n await this.connection.request(\"item.set-icon\", { handle: this.handle, icon, iconAsTemplate });\n }\n\n iconIsTemplate(): Promise<boolean> {\n return this.connection.request(\"item.icon-is-template\", { handle: this.handle });\n }\n}\n\nexport class PredefinedMenuItem extends TextMenuItem {\n readonly kind = \"predefined\" as const;\n}\n\nexport class TrayClient {\n private readonly connection: Connection;\n\n constructor(context: KirieEventaContext) {\n this.connection = new Connection(context);\n }\n\n async createTray(options: TrayOptions = {}): Promise<TrayIcon> {\n const resource = await this.connection.request(\"tray.create\", {\n options: {\n ...options,\n menu: options.menu == null ? options.menu : this.connection.handle(options.menu),\n },\n });\n return new TrayIcon(this.connection, resource);\n }\n\n async createMenu(options: MenuOptions = {}): Promise<Menu> {\n const resource = await this.connection.request(\"menu.create\", {\n options: { ...options, items: options.items?.map((item) => this.connection.handle(item)) },\n });\n return new Menu(this.connection, resource);\n }\n\n async createSubmenu(options: SubmenuOptions): Promise<Submenu> {\n const resource = await this.connection.request(\"submenu.create\", {\n options: { ...options, items: options.items?.map((item) => this.connection.handle(item)) },\n });\n return new Submenu(this.connection, resource);\n }\n\n async createMenuItem(options: MenuItemOptions): Promise<MenuItem> {\n return new MenuItem(this.connection, await this.connection.request(\"item.create\", { options }));\n }\n\n async createCheckMenuItem(options: CheckMenuItemOptions): Promise<CheckMenuItem> {\n return new CheckMenuItem(this.connection, await this.connection.request(\"check.create\", { options }));\n }\n\n async createIconMenuItem(options: IconMenuItemOptions): Promise<IconMenuItem> {\n return new IconMenuItem(this.connection, await this.connection.request(\"icon.create\", { options }));\n }\n\n /** Calls the public upstream PredefinedMenuItem constructors. */\n readonly predefined = {\n separator: async (): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.separator\", {})),\n sectionHeader: async (text: string): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.section-header\", { text })),\n copy: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.copy\", { text })),\n cut: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.cut\", { text })),\n paste: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.paste\", { text })),\n pasteAndMatchStyle: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.paste-and-match-style\", { text })),\n delete: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.delete\", { text })),\n selectAll: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.select-all\", { text })),\n undo: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.undo\", { text })),\n redo: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.redo\", { text })),\n minimize: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.minimize\", { text })),\n maximize: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.maximize\", { text })),\n zoom: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.zoom\", { text })),\n actualSize: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.actual-size\", { text })),\n zoomIn: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.zoom-in\", { text })),\n zoomOut: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.zoom-out\", { text })),\n fullscreen: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.fullscreen\", { text })),\n hide: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.hide\", { text })),\n hideOthers: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.hide-others\", { text })),\n showAll: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.show-all\", { text })),\n closeWindow: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.close-window\", { text })),\n quit: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.quit\", { text })),\n services: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.services\", { text })),\n bringAllToFront: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.bring-all-to-front\", { text })),\n startSpeaking: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.start-speaking\", { text })),\n stopSpeaking: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.stop-speaking\", { text })),\n startDictation: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.start-dictation\", { text })),\n emojiAndSymbols: async (text?: string | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.emoji-and-symbols\", { text })),\n about: async (text?: string | null, metadata?: AboutMetadata | null): Promise<PredefinedMenuItem> =>\n new PredefinedMenuItem(this.connection, await this.connection.request(\"predefined.about\", { text, metadata })),\n };\n\n /** Wraps an application-provided descriptor without creating another native reference. */\n fromResource(resource: Resource): TrayResource {\n return this.connection.object(resource);\n }\n\n /** Receives global upstream events by native ID, independent of resource handles. */\n onEvent(handler: (event: NativeEvent) => void): () => void {\n return this.connection.onEvent(handler);\n }\n}\n\nexport function createTrayClient(context: KirieEventaContext): TrayClient {\n return new TrayClient(context);\n}\n"],"mappings":";;AAqDA,MAAM,cAAc,oBAAiC,kBAAkB;AAEvE,IAAa,YAAb,cAA+B,MAAM;CACnC;CAEA,YAAY,MAAc,SAAiB;EACzC,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;AAEA,IAAM,aAAN,MAAiB;CACf;CAEA,YAAY,SAA6B;EACvC,KAAK,UAAU;CACjB;CAEA,MAAM,QAA8B,MAAS,MAAwC;EACnF,MAAM,QAAQ,mBAAwC,cAAc,KAAK,QAAQ,KAAK,GAAG,GAAG;EAC5F,MAAM,QAAQ,MAAM,aAAa,KAAK,SAAS,KAAK,CAAC,CAAC,IAAI;EAC1D,IAAI,CAAC,MAAM,IACT,MAAM,IAAI,UAAU,MAAM,MAAM,MAAM,MAAM,MAAM,OAAO;EAG3D,OAAO,MAAM;CACf;CAEA,OAAO,UAA8B;EACnC,IAAI,CAAC,SAAS,UAAU,KAAK,OAAO,GAClC,MAAM,IAAI,UAAU,oBAAoB,qDAAqD;EAG/F,OAAO,SAAS;CAClB;CAEA,QAAQ,SAAmD;EACzD,OAAO,KAAK,QAAQ,GAAG,cAAc,EAAE,WAAW;GAChD,QAAQ,IAAK;EACf,CAAC;CACH;CAEA,OAAO,UAAkC;EAUvC,MAAM,cAAc;GARlB,MAAM;GACN,MAAM;GACN,SAAS;GACT,MAAM;GACN,OAAO;GACP,MAAM;GAC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QAAQ,4BAA4B,EAAE,KAAK,CAAC,CAAC;EAC7G,gBAAgB,OAAO,SACrB,IAAI,mBAAmB,KAAK,YAAY,MAAM,KAAK,WAAW,QAAQ,8BAA8B,EAAE,KAAK,CAAC,CAAC;EAC/G,iBAAiB,OAAO,SACtB,IAAI,mBAAmB,KAAK,YAAY,MAAM,KAAK,WAAW,QAAQ,gCAAgC,EAAE,KAAK,CAAC,CAAC;EACjH,OAAO,OAAO,MAAsB,aAClC,IAAI,mBAAmB,KAAK,YAAY,MAAM,KAAK,WAAW,QAAQ,oBAAoB;GAAE;GAAM;EAAS,CAAC,CAAC;CACjH;;CAGA,aAAa,UAAkC;EAC7C,OAAO,KAAK,WAAW,OAAO,QAAQ;CACxC;;CAGA,QAAQ,SAAmD;EACzD,OAAO,KAAK,WAAW,QAAQ,OAAO;CACxC;AACF;AAEA,SAAgB,iBAAiB,SAAyC;CACxE,OAAO,IAAI,WAAW,OAAO;AAC/B"}
|
package/dist/plugin.d.ts
CHANGED
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","names":[],"sources":["../src/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","names":[],"sources":["../src/plugin.ts"],"mappings":";;cAQA,UAmBM"}
|
package/dist/plugin.js
CHANGED
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","names":["packageJson.version"],"sources":["../package.json","../src/plugin.ts"],"sourcesContent":["","import type { KiriePlugin } from \"kirie/plugin\";\nimport { defineKiriePlugin } from \"kirie/plugin\";\nimport packageJson from \"../package.json\" with { type: \"json\" };\n\nconst bundledAddonUrl = new URL(\"../addon/kirie_tray\", import.meta.url).href;\n\n// ADR-0015: Godot loads and exports the optional Tray native library.\n// See docs/decisions/0015-load-tray-through-a-gdextension.md.\nexport default defineKiriePlugin({\n id: \"tray\",\n dotnetPackages: [\n {\n id: \"GdKirie.Tray\",\n version: packageJson.version,\n },\n ],\n godotAddons: [\n {\n id: \"kirie-tray\",\n path: \"addons/kirie_tray\",\n source: {\n type: \"bundled\",\n url: bundledAddonUrl,\n },\n version: packageJson.version,\n },\n ],\n}) as KiriePlugin;\n"],"mappings":";;;;;ACIA,MAAM,kBAAkB,IAAI,IAAI,uBAAuB,
|
|
1
|
+
{"version":3,"file":"plugin.js","names":["packageJson.version"],"sources":["../package.json","../src/plugin.ts"],"sourcesContent":["","import type { KiriePlugin } from \"kirie/plugin\";\nimport { defineKiriePlugin } from \"kirie/plugin\";\nimport packageJson from \"../package.json\" with { type: \"json\" };\n\nconst bundledAddonUrl = new URL(\"../addon/kirie_tray\", import.meta.url).href;\n\n// ADR-0015: Godot loads and exports the optional Tray native library.\n// See https://github.com/gd-kirie/gd-kirie/blob/main/docs/decisions/0015-load-tray-through-a-gdextension.md.\nexport default defineKiriePlugin({\n id: \"tray\",\n dotnetPackages: [\n {\n id: \"GdKirie.Tray\",\n version: packageJson.version,\n },\n ],\n godotAddons: [\n {\n id: \"kirie-tray\",\n path: \"addons/kirie_tray\",\n source: {\n type: \"bundled\",\n url: bundledAddonUrl,\n },\n version: packageJson.version,\n },\n ],\n}) as KiriePlugin;\n"],"mappings":";;;;;ACIA,MAAM,kBAAkB,IAAI,IAAI,uBAAuB,YAAY,GAAG,CAAC,CAAC;AAIxE,IAAA,iBAAe,kBAAkB;CAC/B,IAAI;CACJ,gBAAgB,CACd;EACE,IAAI;EACKA;CACX,CACF;CACA,aAAa,CACX;EACE,IAAI;EACJ,MAAM;EACN,QAAQ;GACN,MAAM;GACN,KAAK;EACP;EACSA;CACX,CACF;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gd-kirie/tray",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/
|
|
7
|
+
"url": "https://github.com/gd-kirie/kirie-plugins.git",
|
|
8
8
|
"directory": "packages/tray"
|
|
9
9
|
},
|
|
10
10
|
"main": "./dist/index.js",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@gd-kirie/ipc-eventa": "0.
|
|
27
|
+
"@gd-kirie/ipc-eventa": "0.14.2",
|
|
28
28
|
"@moeru/eventa": "^1.0.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"kirie": "^0.
|
|
31
|
+
"kirie": "^0.14.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"tsdown": "^0.22.2",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"registry": "https://registry.npmjs.org"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "tsdown
|
|
43
|
+
"build": "tsdown",
|
|
44
44
|
"test:run": "vitest run",
|
|
45
45
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
46
46
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|