@stacksjs/desktop 0.2.126 → 0.2.128

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/dist/focus.d.ts CHANGED
@@ -6,6 +6,11 @@
6
6
  * not at the moment a meeting starts.
7
7
  */
8
8
  export declare function hasFocusShortcuts(...names: string[]): Promise<boolean>;
9
+ /**
10
+ * Like `hasFocusShortcuts`, but distinguishes "not installed" from "could not
11
+ * check". Prefer this anywhere the answer drives a setup prompt.
12
+ */
13
+ export declare function focusShortcutsReady(...names: string[]): Promise<boolean | 'unknown'>;
9
14
  export declare const focus: FocusAPI;
10
15
  export declare interface FocusStatus {
11
16
  supported: boolean
@@ -15,23 +20,41 @@ export declare interface FocusStatus {
15
20
  export declare interface FocusShortcutOptions {
16
21
  onShortcut?: string
17
22
  offShortcut?: string
23
+ strategy?: FocusStrategy
18
24
  }
19
25
  export declare interface FocusResult {
20
26
  ok: boolean
21
- strategy?: 'shortcut'
27
+ strategy?: 'shortcut' | 'url'
22
28
  exitCode?: number
29
+ dispatched?: boolean
23
30
  shortcut?: string
24
31
  error?: string
25
32
  }
33
+ export declare interface FocusShortcutList {
34
+ canList: boolean
35
+ shortcuts: string[]
36
+ }
26
37
  export declare interface FocusAPI {
27
38
  getStatus: () => Promise<FocusStatus>
28
39
  requestAuthorization: () => Promise<FocusAuthorization>
29
40
  setEnabled: (enabled: boolean, options?: FocusShortcutOptions) => Promise<FocusResult>
30
41
  runShortcut: (name: string) => Promise<FocusResult>
31
42
  listShortcuts: () => Promise<string[]>
43
+ listShortcutsResult: () => Promise<FocusShortcutList>
32
44
  }
33
45
  /**
34
46
  * Mirrors `INFocusStatusAuthorizationStatus`. `unsupported` is Craft's own
35
47
  * value for platforms where the framework isn't present at all.
36
48
  */
37
49
  export type FocusAuthorization = 'notDetermined' | 'restricted' | 'denied' | 'authorized' | 'unsupported';
50
+ /**
51
+ * How the shortcut is run.
52
+ *
53
+ * `cli` execs `/usr/bin/shortcuts` and reports the shortcut's real exit
54
+ * status. `url` opens `shortcuts://run-shortcut`, the only route the App
55
+ * Sandbox permits — but it is fire-and-forget: LaunchServices confirms it
56
+ * handed the URL over, never that the shortcut ran. `auto` picks `url` under
57
+ * sandbox and `cli` everywhere else, so a real status is used where one
58
+ * exists.
59
+ */
60
+ export type FocusStrategy = 'auto' | 'cli' | 'url';
package/dist/index.d.ts CHANGED
@@ -214,8 +214,10 @@ export type {
214
214
  FocusAPI,
215
215
  FocusAuthorization,
216
216
  FocusResult,
217
+ FocusShortcutList,
217
218
  FocusShortcutOptions,
218
219
  FocusStatus,
220
+ FocusStrategy,
219
221
  } from './focus';
220
222
  export type {
221
223
  LocalServerAPI,
@@ -588,7 +590,7 @@ export {
588
590
  // =============================================================================
589
591
  // Focus / Do Not Disturb
590
592
  // =============================================================================
591
- export { focus, hasFocusShortcuts } from './focus';
593
+ export { focus, focusShortcutsReady, hasFocusShortcuts } from './focus';
592
594
  // =============================================================================
593
595
  // Local HTTP Server (OAuth callbacks)
594
596
  // =============================================================================
package/dist/index.js CHANGED
@@ -5858,6 +5858,12 @@ var focus = {
5858
5858
  if (!hasBridge("focus"))
5859
5859
  return [];
5860
5860
  return await window.craft.focus.listShortcuts();
5861
+ },
5862
+ async listShortcutsResult() {
5863
+ if (!hasBridge("focus"))
5864
+ return { canList: false, shortcuts: [] };
5865
+ const r = await window.craft.focus.listShortcutsResult();
5866
+ return { canList: Boolean(r?.canList), shortcuts: r?.shortcuts || [] };
5861
5867
  }
5862
5868
  };
5863
5869
  async function hasFocusShortcuts(...names) {
@@ -5866,6 +5872,15 @@ async function hasFocusShortcuts(...names) {
5866
5872
  const installed = new Set(await focus.listShortcuts());
5867
5873
  return names.every((name) => installed.has(name));
5868
5874
  }
5875
+ async function focusShortcutsReady(...names) {
5876
+ if (names.length === 0)
5877
+ return false;
5878
+ const { canList, shortcuts } = await focus.listShortcutsResult();
5879
+ if (!canList)
5880
+ return "unknown";
5881
+ const installed = new Set(shortcuts);
5882
+ return names.every((name) => installed.has(name));
5883
+ }
5869
5884
  // src/local-server.ts
5870
5885
  var localServer = {
5871
5886
  async start(port = 0, host = "127.0.0.1") {
@@ -6457,6 +6472,7 @@ export {
6457
6472
  formatRemainingTime,
6458
6473
  formatDuration,
6459
6474
  formatCompact,
6475
+ focusShortcutsReady,
6460
6476
  focus,
6461
6477
  fileAssociations,
6462
6478
  dragOut,
@@ -6538,4 +6554,4 @@ export {
6538
6554
  AVAILABLE_COMPONENTS
6539
6555
  };
6540
6556
 
6541
- //# debugId=E90C218C8E34E21564756E2164756E21
6557
+ //# debugId=4BACEAAC5AF2924164756E2164756E21