@stacksjs/desktop 0.2.975 → 0.2.979

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.
@@ -7,6 +7,16 @@ declare function api(): CraftWindowNamespace | null;
7
7
  * to control its window should keep working rather than throw on load.
8
8
  */
9
9
  declare function call(action: (ns: CraftWindowNamespace) => Promise<unknown> | undefined): Promise<void>;
10
+ /**
11
+ * Open Settings as its own macOS System Settings window (or bring the existing
12
+ * one forward). Uses Apple System Settings proportions (715x640, min 660x460),
13
+ * hidden titlebar, vibrant window material, and shared persistent storage.
14
+ *
15
+ * When a `pane` is given and the window is already open, notifies it over
16
+ * `BroadcastChannel('stx:settings-window:<storageKey>')` so `<SettingsWindow>`
17
+ * switches straight to that pane without reloading.
18
+ */
19
+ export declare function openSettingsWindow(options?: SettingsWindowOptions): Promise<{ name: string }>;
10
20
  export declare const nativeWindow: NativeWindow;
11
21
  /**
12
22
  * A second window, described the way Craft's CLI describes the first.
@@ -69,5 +79,16 @@ export declare interface NativeWindow {
69
79
  setSize: (width: number, height: number) => Promise<void>
70
80
  setAppearance: (appearance: WindowAppearance) => Promise<void>
71
81
  }
82
+ export declare interface SettingsWindowOptions {
83
+ url?: string
84
+ pane?: string
85
+ name?: string
86
+ title?: string
87
+ storageKey?: string
88
+ width?: number
89
+ height?: number
90
+ minWidth?: number
91
+ minHeight?: number
92
+ }
72
93
  /** Which appearance the *window* resolves its native chrome against. */
73
94
  export type WindowAppearance = 'light' | 'dark' | 'system';
@@ -1,5 +1,5 @@
1
1
  import { AutoUpdater, canReplaceBundle, clearQuarantine, extractBundle, generateUpdateManifest, readBundleIdentity, swapBundle, verifyBundleTrust } from 'craft-native';
2
- import type { BundleIdentity, BundleTrustPolicy, BundleTrustResult, UpdateManifest, UpdaterConfig } from 'craft-native';
2
+ import type { BundleIdentity, BundleTrustPolicy, BundleTrustResult, UpdateManifest, UpdateProgress, UpdaterConfig } from 'craft-native';
3
3
  export type { BundleIdentity, BundleTrustPolicy, BundleTrustResult };
4
4
  export type { PlatformUpdate, UpdateManifest, UpdaterConfig, UpdaterEvent, UpdateProgress } from 'craft-native';
5
5
  /**
@@ -76,6 +76,15 @@ export declare function relaunchBundle(options?: RelaunchOptions): void;
76
76
  * cannot get them subtly wrong by copying an example.
77
77
  */
78
78
  export declare function createSelfUpdater(options: SelfUpdaterOptions): Promise<AutoUpdater>;
79
+ /** Compare two semver-like strings (`"0.3.7"` vs `"0.3.6"`). Returns >0 if `a > b`. */
80
+ export declare function compareVersions(a: string, b: string): number;
81
+ /**
82
+ * Stateful self-update controller backed by `@stacksjs/desktop`'s
83
+ * `createSelfUpdater` (Craft AutoUpdater + SHA-256 + Apple Team ID check +
84
+ * atomic bundle swap) when running from a packaged `.app`, and live GitHub
85
+ * release version checking when running from source.
86
+ */
87
+ export declare function createSelfUpdateController(options: SelfUpdateControllerOptions): SelfUpdateController;
79
88
  /** Manifest asset name an app publishes alongside its release artifacts. */
80
89
  export declare const UPDATE_MANIFEST_ASSET: 'update.json';
81
90
  export declare interface GitHubUpdaterOptions extends Omit<UpdaterConfig, 'updateUrl'> {
@@ -109,6 +118,50 @@ export declare interface SelfUpdaterOptions extends Omit<GitHubUpdaterOptions, '
109
118
  appPath?: string
110
119
  requireSameTeam?: boolean
111
120
  }
121
+ /**
122
+ * Status object directly compatible with `<SettingsUpdateRow :status="..." />`
123
+ * in `@stacksjs/components`.
124
+ */
125
+ export declare interface SelfUpdateStatus {
126
+ currentVersion: string
127
+ state: SelfUpdateState
128
+ selfUpdating: boolean
129
+ reason?: string
130
+ version?: string
131
+ notes?: string
132
+ publishedAt?: string
133
+ progress?: number
134
+ error?: string
135
+ lastCheckedAt?: string
136
+ repository?: string
137
+ teamId?: string | null
138
+ }
139
+ export declare interface SelfUpdateControllerOptions {
140
+ repository: string
141
+ currentVersion: string
142
+ appName?: string
143
+ appPath?: string | null
144
+ manifestAsset?: string
145
+ fetchFn?: typeof fetch
146
+ }
147
+ export declare interface SelfUpdateController {
148
+ getStatus: () => Promise<SelfUpdateStatus>
149
+ check: () => Promise<SelfUpdateStatus>
150
+ downloadAndInstall: () => Promise<SelfUpdateStatus>
151
+ relaunch: () => Promise<SelfUpdateStatus>
152
+ }
153
+ // =============================================================================
154
+ // High-level self-update controller (feeds <SettingsUpdateRow> directly)
155
+ // =============================================================================
156
+ export type SelfUpdateState = | 'unavailable'
157
+ | 'idle'
158
+ | 'checking'
159
+ | 'current'
160
+ | 'available'
161
+ | 'downloading'
162
+ | 'installing'
163
+ | 'installed'
164
+ | 'error';
112
165
  export { AutoUpdater, generateUpdateManifest };
113
166
  // The macOS bundle primitives, forwarded so an app never has to reach past
114
167
  // `@stacksjs/desktop` into Craft for the half of self-updating that is file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/desktop",
3
3
  "type": "module",
4
- "version": "0.2.975",
4
+ "version": "0.2.979",
5
5
  "description": "Native desktop application framework for stx (powered by Craft)",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",