@stacksjs/desktop 0.2.118 → 0.2.120

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
@@ -92,13 +92,30 @@ export declare interface CraftEventMap {
92
92
  * Internal — not re-exported from index.ts. Apps that want to call the
93
93
  * bridge directly should use the namespaced public modules.
94
94
  */
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.
95
+ // The bridge is built on the Zig side and exposes far more namespaces than
96
+ // craft-native's published types declare (audio, bluetooth, menu, updater,
97
+ // touchbar, iap, …). Widen the published interface instead of re-declaring
98
+ // `Window.craft` here: craft-native already declares that property globally as
99
+ // `CraftBridgeAPI & CraftEventEmitter`, so a second, looser declaration is a
100
+ // conflicting merge (TS2717) — and the narrower published type wins, which made
101
+ // every `craft.<ns>` access fail with TS2339 and every `craft[ns]` lookup with
102
+ // TS7053.
103
+ //
104
+ // An index signature keeps the declared namespaces exactly as typed while
105
+ // letting the ones the bridge ships ahead of the types resolve, which preserves
106
+ // the original intent: don't make the TS layer drift out of sync when a single
107
+ // field renames.
108
+ declare module 'craft-native' {
109
+ interface CraftBridgeAPI {
110
+ [namespace: string]: any
111
+ }
112
+ interface CraftAppAPI {
113
+ setBadge: (count: number) => Promise<void>
114
+ bounce: (type?: 'critical' | 'informational') => Promise<void>
115
+ }
116
+ }
99
117
  declare global {
100
118
  interface Window {
101
- craft?: Record<string, any>
102
119
  __craftPendingDeepLink?: string
103
120
  __craftCurrentTheme?: { appearance: 'light' | 'dark' }
104
121
  }
package/dist/index.d.ts CHANGED
@@ -74,6 +74,15 @@ export type {
74
74
  } from './types';
75
75
  export type { DesktopConfig } from './window';
76
76
  export type { PackageConfig, PackageResult } from './packaging';
77
+ export type {
78
+ GitHubManifestOptions,
79
+ GitHubUpdaterOptions,
80
+ PlatformUpdate,
81
+ UpdateManifest,
82
+ UpdaterConfig,
83
+ UpdaterEvent,
84
+ UpdateProgress,
85
+ } from './self-update';
77
86
  export type {
78
87
  CaffeinateInstance,
79
88
  CaffeinateOptions,
@@ -380,6 +389,18 @@ export {
380
389
  // =============================================================================
381
390
  export { craftBinaryNotFoundMessage, pack, packageApp, resolveCraftBinary } from './packaging';
382
391
  // =============================================================================
392
+ // Self-Update (re-exported from Craft, plus GitHub Releases helpers)
393
+ // =============================================================================
394
+ export {
395
+ AutoUpdater,
396
+ createGitHubUpdateManifest,
397
+ createGitHubUpdater,
398
+ generateUpdateManifest,
399
+ githubLatestAssetUrl,
400
+ githubReleaseAssetUrl,
401
+ UPDATE_MANIFEST_ASSET,
402
+ } from './self-update';
403
+ // =============================================================================
383
404
  // Power Management / Caffeinate
384
405
  // =============================================================================
385
406
  export {
package/dist/index.js CHANGED
@@ -2983,6 +2983,39 @@ window.desktop = window.stxWindow;
2983
2983
  // src/packaging.ts
2984
2984
  import { pack, packageApp } from "craft-native";
2985
2985
  import { craftBinaryNotFoundMessage as craftBinaryNotFoundMessage2, resolveCraftBinary as resolveCraftBinary2 } from "craft-native";
2986
+ // src/self-update.ts
2987
+ import { AutoUpdater, generateUpdateManifest } from "craft-native";
2988
+ var UPDATE_MANIFEST_ASSET = "update.json";
2989
+ function githubLatestAssetUrl(repository, asset) {
2990
+ return `https://github.com/${repository}/releases/latest/download/${asset}`;
2991
+ }
2992
+ function githubReleaseAssetUrl(repository, tag, asset) {
2993
+ return `https://github.com/${repository}/releases/download/${tag}/${asset}`;
2994
+ }
2995
+ function createGitHubUpdater(options) {
2996
+ const { repository, manifestAsset = UPDATE_MANIFEST_ASSET, ...config } = options;
2997
+ return new AutoUpdater({
2998
+ ...config,
2999
+ updateUrl: githubLatestAssetUrl(repository, manifestAsset)
3000
+ });
3001
+ }
3002
+ function createGitHubUpdateManifest(options) {
3003
+ const tag = options.tag ?? `v${options.version}`;
3004
+ const platforms = {};
3005
+ for (const [platform, path] of Object.entries(options.artifacts)) {
3006
+ if (!path)
3007
+ continue;
3008
+ platforms[platform] = {
3009
+ path,
3010
+ url: githubReleaseAssetUrl(options.repository, tag, path.split("/").pop())
3011
+ };
3012
+ }
3013
+ return generateUpdateManifest({
3014
+ version: options.version,
3015
+ releaseNotes: options.releaseNotes,
3016
+ platforms
3017
+ });
3018
+ }
2986
3019
  // src/power.ts
2987
3020
  var currentProcess = null;
2988
3021
  var currentInstance = null;
@@ -6303,6 +6336,8 @@ export {
6303
6336
  iap,
6304
6337
  handoff,
6305
6338
  globalShortcuts,
6339
+ githubReleaseAssetUrl,
6340
+ githubLatestAssetUrl,
6306
6341
  getWindowBridgeScript,
6307
6342
  getWindow,
6308
6343
  getTrayInstance,
@@ -6318,6 +6353,7 @@ export {
6318
6353
  getActiveTrayInstances,
6319
6354
  getActiveModalCount,
6320
6355
  getActiveAlertCount,
6356
+ generateUpdateManifest,
6321
6357
  fs,
6322
6358
  formatTime,
6323
6359
  formatShortcut,
@@ -6357,6 +6393,8 @@ export {
6357
6393
  createLabel,
6358
6394
  createInterval,
6359
6395
  createImageView,
6396
+ createGitHubUpdater,
6397
+ createGitHubUpdateManifest,
6360
6398
  createFileExplorer,
6361
6399
  createDropdown,
6362
6400
  createDatePicker,
@@ -6390,11 +6428,13 @@ export {
6390
6428
  appleScript,
6391
6429
  app as appInfo,
6392
6430
  alert2 as alert,
6431
+ UPDATE_MANIFEST_ASSET,
6393
6432
  TRAY_MENU_STYLES,
6394
6433
  TOAST_STYLES,
6395
6434
  MODAL_STYLES,
6396
6435
  COMPONENT_STYLES,
6436
+ AutoUpdater,
6397
6437
  AVAILABLE_COMPONENTS
6398
6438
  };
6399
6439
 
6400
- //# debugId=AE9E1125250DCDAC64756E2164756E21
6440
+ //# debugId=3B1F86F62D9B26A764756E2164756E21