@stacksjs/desktop 0.2.726 → 0.2.728

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.
@@ -5,7 +5,10 @@ declare function call(action: (tray: CraftTrayNamespace) => Promise<unknown>): P
5
5
  * {
6
6
  * setIcon: (icon: string) => Promise<void>,
7
7
  * setTitle: (title: string) => Promise<void>,
8
- * setTooltip: (tooltip: string) => Promise<void>
8
+ * setTooltip: (tooltip: string) => Promise<void>,
9
+ * setMenu: (items: NativeTrayMenuItem[]) => Promise<void>,
10
+ * onClick: (callback: (event: NativeTrayClick) => void) => (() => void),
11
+ * onMenuAction: (callback: (event: { action: string }) => void) => (() => void)
9
12
  * }
10
13
  * ```
11
14
  */
@@ -13,11 +16,33 @@ export declare const nativeTray: {
13
16
  /** An SF Symbol name, file URL, or PNG data URL. Craft draws it as a template. */
14
17
  setIcon: (icon: string) => Promise<void>;
15
18
  setTitle: (title: string) => Promise<void>;
16
- setTooltip: (tooltip: string) => Promise<void>
19
+ setTooltip: (tooltip: string) => Promise<void>;
20
+ /** Replace the native right-click menu. Built-in actions include show, hide and quit. */
21
+ setMenu: (items: NativeTrayMenuItem[]) => Promise<void>;
22
+ /** Left clicks arrive directly from AppKit, including while the window is hidden. */
23
+ onClick: (callback: (event: NativeTrayClick) => void) => (() => void);
24
+ /** Custom menu actions; built-in show/hide/quit are handled by Craft. */
25
+ onMenuAction: (callback: (event: { action: string }) => void) => (() => void)
17
26
  };
27
+ export declare interface NativeTrayMenuItem {
28
+ id?: string
29
+ label?: string
30
+ action?: string
31
+ type?: 'normal' | 'separator' | 'checkbox' | 'radio'
32
+ checked?: boolean
33
+ enabled?: boolean
34
+ shortcut?: string
35
+ submenu?: NativeTrayMenuItem[]
36
+ }
37
+ export declare interface NativeTrayClick {
38
+ button: 'left' | 'right'
39
+ timestamp: number
40
+ modifiers: Record<string, boolean>
41
+ }
18
42
  /** Update the existing Craft status item from its page, without host imports. */
19
43
  declare interface CraftTrayNamespace {
20
44
  setIcon: (icon: string) => Promise<unknown>
21
45
  setTitle: (title: string) => Promise<unknown>
22
46
  setTooltip: (tooltip: string) => Promise<unknown>
47
+ setMenu: (items: NativeTrayMenuItem[]) => Promise<unknown>
23
48
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/desktop",
3
3
  "type": "module",
4
- "version": "0.2.726",
4
+ "version": "0.2.728",
5
5
  "description": "Native desktop application framework for stx (powered by Craft)",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",