@stacksjs/desktop 0.2.119 → 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 CHANGED
@@ -33,6 +33,7 @@ export declare interface CraftEventMap {
33
33
  'craft:powerWake': void
34
34
  'craft:networkChange': { type: import('./network').ConnectionType, online: boolean }
35
35
  'craft:screen:change': void
36
+ 'craft:screenSharing:change': import('./screen-sharing').ScreenSharingState
36
37
  'craft:theme': import('./theme').ThemeInfo
37
38
  'craft:bluetooth:deviceFound': import('./bluetooth').BluetoothDevice
38
39
  'craft:bluetooth:deviceConnected': import('./bluetooth').BluetoothDevice
@@ -92,13 +93,30 @@ export declare interface CraftEventMap {
92
93
  * Internal — not re-exported from index.ts. Apps that want to call the
93
94
  * bridge directly should use the namespaced public modules.
94
95
  */
95
- // Augment the global window type so callers can import from this module
96
- // without each one redeclaring `(window as any).craft`. Kept as a loose
97
- // shape because the bridge is built from the Zig side and we don't want
98
- // the TS layer to drift out of sync if a single field renames.
96
+ // The bridge is built on the Zig side and exposes far more namespaces than
97
+ // craft-native's published types declare (audio, bluetooth, menu, updater,
98
+ // touchbar, iap, …). Widen the published interface instead of re-declaring
99
+ // `Window.craft` here: craft-native already declares that property globally as
100
+ // `CraftBridgeAPI & CraftEventEmitter`, so a second, looser declaration is a
101
+ // conflicting merge (TS2717) — and the narrower published type wins, which made
102
+ // every `craft.<ns>` access fail with TS2339 and every `craft[ns]` lookup with
103
+ // TS7053.
104
+ //
105
+ // An index signature keeps the declared namespaces exactly as typed while
106
+ // letting the ones the bridge ships ahead of the types resolve, which preserves
107
+ // the original intent: don't make the TS layer drift out of sync when a single
108
+ // field renames.
109
+ declare module 'craft-native' {
110
+ interface CraftBridgeAPI {
111
+ [namespace: string]: any
112
+ }
113
+ interface CraftAppAPI {
114
+ setBadge: (count: number) => Promise<void>
115
+ bounce: (type?: 'critical' | 'informational') => Promise<void>
116
+ }
117
+ }
99
118
  declare global {
100
119
  interface Window {
101
- craft?: Record<string, any>
102
120
  __craftPendingDeepLink?: string
103
121
  __craftCurrentTheme?: { appearance: 'light' | 'dark' }
104
122
  }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @stacksjs/desktop/browser — the half of this package that runs *inside* a
3
+ * Craft window.
4
+ *
5
+ * The default entry point is a single bundle that also carries the host-side
6
+ * pieces: `window.ts` spawns the Craft process, `packaging.ts` assembles
7
+ * installers, `preferences.ts` and `autolaunch.ts` write files with `node:fs`.
8
+ * Those belong to the build/launch side of an app and pull in `node:child_process`
9
+ * and friends, so bundling the barrel for a webview fails outright:
10
+ *
11
+ * Browser build cannot import Node.js builtin: "child_process"
12
+ *
13
+ * That left no way to use the bridge wrappers from the UI they were written
14
+ * for. This entry exports only the modules that talk to `window.craft`, so a
15
+ * Craft app can bundle it with `target: 'browser'`.
16
+ *
17
+ * Host-side code keeps importing `@stacksjs/desktop` and is unaffected.
18
+ */
19
+ export * from './alerts';
20
+ export * from './app-info';
21
+ export * from './apple-script';
22
+ export * from './audio';
23
+ export * from './battery';
24
+ export * from './biometric';
25
+ export * from './bluetooth';
26
+ export * from './bonjour';
27
+ export * from './capabilities';
28
+ export * from './clipboard';
29
+ export * from './continuity-camera';
30
+ export * from './coreml';
31
+ export * from './crash-reporter';
32
+ export * from './deep-link';
33
+ export * from './dialogs';
34
+ export * from './drag-out';
35
+ export * from './file-associations';
36
+ export * from './focus';
37
+ export * from './fs';
38
+ export * from './global-shortcuts';
39
+ export * from './handoff';
40
+ export * from './hotkeys';
41
+ export * from './iap';
42
+ export * from './keychain';
43
+ export * from './live-activities';
44
+ export * from './local-server';
45
+ export * from './location';
46
+ export * from './log';
47
+ export * from './menu';
48
+ export * from './midi';
49
+ export * from './modals';
50
+ export * from './native-autolaunch';
51
+ export * from './network';
52
+ export * from './notifications';
53
+ export * from './pdf';
54
+ export * from './permissions';
55
+ export * from './power';
56
+ export * from './printing';
57
+ export * from './screen';
58
+ export * from './screen-capture';
59
+ export * from './screen-sharing';
60
+ export * from './self-update';
61
+ export * from './serial';
62
+ export * from './service-menu';
63
+ export * from './shell';
64
+ export * from './speech';
65
+ export * from './speech-recognition';
66
+ export * from './spotlight';
67
+ export * from './tags';
68
+ export * from './theme';
69
+ export * from './timer';
70
+ export * from './touchbar';
71
+ export * from './updater';
72
+ export * from './vision';
73
+ export * from './window-events';