@stacksjs/desktop 0.2.120 → 0.2.121
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/_bridge.d.ts +1 -0
- package/dist/browser.d.ts +73 -0
- package/dist/browser.js +4044 -0
- package/dist/browser.js.map +65 -0
- package/dist/focus.d.ts +37 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +102 -1
- package/dist/index.js.map +6 -4
- package/dist/screen-sharing.d.ts +37 -0
- package/package.json +5 -1
package/dist/focus.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether every shortcut the app depends on is installed.
|
|
3
|
+
*
|
|
4
|
+
* Worth calling on launch: the shortcuts are user-created, so the honest time
|
|
5
|
+
* to discover they're missing is before the user is relying on the feature,
|
|
6
|
+
* not at the moment a meeting starts.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hasFocusShortcuts(...names: string[]): Promise<boolean>;
|
|
9
|
+
export declare const focus: FocusAPI;
|
|
10
|
+
export declare interface FocusStatus {
|
|
11
|
+
supported: boolean
|
|
12
|
+
isFocused: boolean | null
|
|
13
|
+
authorization: FocusAuthorization
|
|
14
|
+
}
|
|
15
|
+
export declare interface FocusShortcutOptions {
|
|
16
|
+
onShortcut?: string
|
|
17
|
+
offShortcut?: string
|
|
18
|
+
}
|
|
19
|
+
export declare interface FocusResult {
|
|
20
|
+
ok: boolean
|
|
21
|
+
strategy?: 'shortcut'
|
|
22
|
+
exitCode?: number
|
|
23
|
+
shortcut?: string
|
|
24
|
+
error?: string
|
|
25
|
+
}
|
|
26
|
+
export declare interface FocusAPI {
|
|
27
|
+
getStatus: () => Promise<FocusStatus>
|
|
28
|
+
requestAuthorization: () => Promise<FocusAuthorization>
|
|
29
|
+
setEnabled: (enabled: boolean, options?: FocusShortcutOptions) => Promise<FocusResult>
|
|
30
|
+
runShortcut: (name: string) => Promise<FocusResult>
|
|
31
|
+
listShortcuts: () => Promise<string[]>
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Mirrors `INFocusStatusAuthorizationStatus`. `unsupported` is Craft's own
|
|
35
|
+
* value for platforms where the framework isn't present at all.
|
|
36
|
+
*/
|
|
37
|
+
export type FocusAuthorization = 'notDetermined' | 'restricted' | 'denied' | 'authorized' | 'unsupported';
|
package/dist/index.d.ts
CHANGED
|
@@ -203,6 +203,20 @@ export type {
|
|
|
203
203
|
LocationWatchOptions,
|
|
204
204
|
} from './location';
|
|
205
205
|
export type { CapturableWindow, ScreenCaptureAPI } from './screen-capture';
|
|
206
|
+
export type {
|
|
207
|
+
ScreenSharingAPI,
|
|
208
|
+
ScreenSharingKind,
|
|
209
|
+
ScreenSharingSignals,
|
|
210
|
+
ScreenSharingSource,
|
|
211
|
+
ScreenSharingState,
|
|
212
|
+
} from './screen-sharing';
|
|
213
|
+
export type {
|
|
214
|
+
FocusAPI,
|
|
215
|
+
FocusAuthorization,
|
|
216
|
+
FocusResult,
|
|
217
|
+
FocusShortcutOptions,
|
|
218
|
+
FocusStatus,
|
|
219
|
+
} from './focus';
|
|
206
220
|
export type {
|
|
207
221
|
LocalServerAPI,
|
|
208
222
|
LocalServerRequestEvent,
|
|
@@ -562,6 +576,20 @@ export { location } from './location';
|
|
|
562
576
|
// =============================================================================
|
|
563
577
|
export { screenCapture } from './screen-capture';
|
|
564
578
|
// =============================================================================
|
|
579
|
+
// Screen Sharing Detection (is the screen being shared or recorded?)
|
|
580
|
+
// =============================================================================
|
|
581
|
+
export {
|
|
582
|
+
DEFAULT_WATCH_INTERVAL_MS,
|
|
583
|
+
MAX_WATCH_INTERVAL_MS,
|
|
584
|
+
MIN_WATCH_INTERVAL_MS,
|
|
585
|
+
screenSharing,
|
|
586
|
+
watchScreenSharing,
|
|
587
|
+
} from './screen-sharing';
|
|
588
|
+
// =============================================================================
|
|
589
|
+
// Focus / Do Not Disturb
|
|
590
|
+
// =============================================================================
|
|
591
|
+
export { focus, hasFocusShortcuts } from './focus';
|
|
592
|
+
// =============================================================================
|
|
565
593
|
// Local HTTP Server (OAuth callbacks)
|
|
566
594
|
// =============================================================================
|
|
567
595
|
export { localServer } from './local-server';
|
package/dist/index.js
CHANGED
|
@@ -5772,6 +5772,100 @@ var screenCapture = {
|
|
|
5772
5772
|
return await window.craft.screenCapture.listWindows();
|
|
5773
5773
|
}
|
|
5774
5774
|
};
|
|
5775
|
+
// src/screen-sharing.ts
|
|
5776
|
+
var MIN_WATCH_INTERVAL_MS = 250;
|
|
5777
|
+
var MAX_WATCH_INTERVAL_MS = 60000;
|
|
5778
|
+
var DEFAULT_WATCH_INTERVAL_MS = 2000;
|
|
5779
|
+
var IDLE = {
|
|
5780
|
+
sharing: false,
|
|
5781
|
+
signals: {
|
|
5782
|
+
systemScreenShare: false,
|
|
5783
|
+
remoteSession: false,
|
|
5784
|
+
conferenceSharing: false,
|
|
5785
|
+
screenRecording: false
|
|
5786
|
+
},
|
|
5787
|
+
sources: []
|
|
5788
|
+
};
|
|
5789
|
+
function idleState() {
|
|
5790
|
+
return { ...IDLE, signals: { ...IDLE.signals }, sources: [] };
|
|
5791
|
+
}
|
|
5792
|
+
var screenSharing = {
|
|
5793
|
+
async getState() {
|
|
5794
|
+
if (!hasBridge("screenSharing"))
|
|
5795
|
+
return idleState();
|
|
5796
|
+
return await window.craft.screenSharing.getState();
|
|
5797
|
+
},
|
|
5798
|
+
async watch(intervalMs = DEFAULT_WATCH_INTERVAL_MS) {
|
|
5799
|
+
const clamped = Math.min(MAX_WATCH_INTERVAL_MS, Math.max(MIN_WATCH_INTERVAL_MS, Math.round(intervalMs)));
|
|
5800
|
+
if (!hasBridge("screenSharing"))
|
|
5801
|
+
return clamped;
|
|
5802
|
+
const r = await window.craft.screenSharing.watch(clamped);
|
|
5803
|
+
return r && r.intervalMs || clamped;
|
|
5804
|
+
},
|
|
5805
|
+
async stop() {
|
|
5806
|
+
if (!hasBridge("screenSharing"))
|
|
5807
|
+
return;
|
|
5808
|
+
await window.craft.screenSharing.unwatch();
|
|
5809
|
+
},
|
|
5810
|
+
onChange(cb) {
|
|
5811
|
+
return onCraftEvent("craft:screenSharing:change", cb);
|
|
5812
|
+
}
|
|
5813
|
+
};
|
|
5814
|
+
async function watchScreenSharing(cb, intervalMs = DEFAULT_WATCH_INTERVAL_MS) {
|
|
5815
|
+
const off = screenSharing.onChange(cb);
|
|
5816
|
+
await screenSharing.watch(intervalMs);
|
|
5817
|
+
return () => {
|
|
5818
|
+
off();
|
|
5819
|
+
screenSharing.stop();
|
|
5820
|
+
};
|
|
5821
|
+
}
|
|
5822
|
+
// src/focus.ts
|
|
5823
|
+
var UNSUPPORTED = { supported: false, isFocused: null, authorization: "unsupported" };
|
|
5824
|
+
function unavailable() {
|
|
5825
|
+
return { ok: false, error: "Focus control is only available in a Craft window on macOS" };
|
|
5826
|
+
}
|
|
5827
|
+
var focus = {
|
|
5828
|
+
async getStatus() {
|
|
5829
|
+
if (!hasBridge("focus"))
|
|
5830
|
+
return { ...UNSUPPORTED };
|
|
5831
|
+
return await window.craft.focus.getStatus();
|
|
5832
|
+
},
|
|
5833
|
+
async requestAuthorization() {
|
|
5834
|
+
if (!hasBridge("focus"))
|
|
5835
|
+
return "unsupported";
|
|
5836
|
+
return await window.craft.focus.requestAuthorization();
|
|
5837
|
+
},
|
|
5838
|
+
async setEnabled(enabled, options = {}) {
|
|
5839
|
+
if (!hasBridge("focus"))
|
|
5840
|
+
return unavailable();
|
|
5841
|
+
const name = enabled ? options.onShortcut : options.offShortcut;
|
|
5842
|
+
if (!name) {
|
|
5843
|
+
return {
|
|
5844
|
+
ok: false,
|
|
5845
|
+
error: `focus.setEnabled: no ${enabled ? "onShortcut" : "offShortcut"} configured`
|
|
5846
|
+
};
|
|
5847
|
+
}
|
|
5848
|
+
return await window.craft.focus.setEnabled(enabled, options);
|
|
5849
|
+
},
|
|
5850
|
+
async runShortcut(name) {
|
|
5851
|
+
if (!hasBridge("focus"))
|
|
5852
|
+
return unavailable();
|
|
5853
|
+
if (!name)
|
|
5854
|
+
throw new Error("focus.runShortcut: name is required");
|
|
5855
|
+
return await window.craft.focus.runShortcut(name);
|
|
5856
|
+
},
|
|
5857
|
+
async listShortcuts() {
|
|
5858
|
+
if (!hasBridge("focus"))
|
|
5859
|
+
return [];
|
|
5860
|
+
return await window.craft.focus.listShortcuts();
|
|
5861
|
+
}
|
|
5862
|
+
};
|
|
5863
|
+
async function hasFocusShortcuts(...names) {
|
|
5864
|
+
if (names.length === 0)
|
|
5865
|
+
return false;
|
|
5866
|
+
const installed = new Set(await focus.listShortcuts());
|
|
5867
|
+
return names.every((name) => installed.has(name));
|
|
5868
|
+
}
|
|
5775
5869
|
// src/local-server.ts
|
|
5776
5870
|
var localServer = {
|
|
5777
5871
|
async start(port = 0, host = "127.0.0.1") {
|
|
@@ -6264,6 +6358,7 @@ function isAvailable(name) {
|
|
|
6264
6358
|
}
|
|
6265
6359
|
export {
|
|
6266
6360
|
windowEvents,
|
|
6361
|
+
watchScreenSharing,
|
|
6267
6362
|
vision,
|
|
6268
6363
|
updater,
|
|
6269
6364
|
unregisterHotkey,
|
|
@@ -6302,6 +6397,7 @@ export {
|
|
|
6302
6397
|
setAutoLaunch,
|
|
6303
6398
|
serviceMenu,
|
|
6304
6399
|
serial,
|
|
6400
|
+
screenSharing,
|
|
6305
6401
|
screenCapture,
|
|
6306
6402
|
screen,
|
|
6307
6403
|
resolveCraftBinary2 as resolveCraftBinary,
|
|
@@ -6334,6 +6430,7 @@ export {
|
|
|
6334
6430
|
isAvailable,
|
|
6335
6431
|
isAutoLaunchEnabled,
|
|
6336
6432
|
iap,
|
|
6433
|
+
hasFocusShortcuts,
|
|
6337
6434
|
handoff,
|
|
6338
6435
|
globalShortcuts,
|
|
6339
6436
|
githubReleaseAssetUrl,
|
|
@@ -6360,6 +6457,7 @@ export {
|
|
|
6360
6457
|
formatRemainingTime,
|
|
6361
6458
|
formatDuration,
|
|
6362
6459
|
formatCompact,
|
|
6460
|
+
focus,
|
|
6363
6461
|
fileAssociations,
|
|
6364
6462
|
dragOut,
|
|
6365
6463
|
dismissAllAlerts,
|
|
@@ -6432,9 +6530,12 @@ export {
|
|
|
6432
6530
|
TRAY_MENU_STYLES,
|
|
6433
6531
|
TOAST_STYLES,
|
|
6434
6532
|
MODAL_STYLES,
|
|
6533
|
+
MIN_WATCH_INTERVAL_MS,
|
|
6534
|
+
MAX_WATCH_INTERVAL_MS,
|
|
6535
|
+
DEFAULT_WATCH_INTERVAL_MS,
|
|
6435
6536
|
COMPONENT_STYLES,
|
|
6436
6537
|
AutoUpdater,
|
|
6437
6538
|
AVAILABLE_COMPONENTS
|
|
6438
6539
|
};
|
|
6439
6540
|
|
|
6440
|
-
//# debugId=
|
|
6541
|
+
//# debugId=E90C218C8E34E21564756E2164756E21
|