@stacksjs/desktop 0.2.279 → 0.2.281

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.
@@ -0,0 +1,48 @@
1
+ export declare const nativeWindow: NativeWindow;
2
+ /**
3
+ * A second window, described the way Craft's CLI describes the first.
4
+ *
5
+ * `name` is the one that matters. It is the window's identity: opening the
6
+ * same name twice brings the first window forward rather than stacking a
7
+ * second one behind it, which is what Cmd+, does in every Mac app. Without it
8
+ * an app has no way to say "the Settings window" — only "a window".
9
+ */
10
+ export declare interface NativeWindowOptions {
11
+ name: string
12
+ url?: string
13
+ html?: string
14
+ title?: string
15
+ width?: number
16
+ height?: number
17
+ x?: number
18
+ y?: number
19
+ minWidth?: number
20
+ minHeight?: number
21
+ resizable?: boolean
22
+ closable?: boolean
23
+ minimizable?: boolean
24
+ alwaysOnTop?: boolean
25
+ titlebarHidden?: boolean
26
+ webSidebarMaterial?: boolean
27
+ webSidebarWidth?: number
28
+ webSidebarMaterialOpacity?: number
29
+ webWindowMaterial?: boolean
30
+ chromeControls?: boolean
31
+ persistentStorage?: boolean
32
+ devTools?: boolean
33
+ }
34
+ export declare interface NativeWindow {
35
+ readonly available: boolean
36
+ open: (options: NativeWindowOptions) => Promise<{ name: string }>
37
+ close: () => Promise<void>
38
+ focus: () => Promise<void>
39
+ minimize: () => Promise<void>
40
+ maximize: () => Promise<void>
41
+ center: () => Promise<void>
42
+ startDrag: () => Promise<void>
43
+ setTitle: (title: string) => Promise<void>
44
+ setSize: (width: number, height: number) => Promise<void>
45
+ setAppearance: (appearance: WindowAppearance) => Promise<void>
46
+ }
47
+ /** Which appearance the *window* resolves its native chrome against. */
48
+ export type WindowAppearance = 'light' | 'dark' | 'system';
@@ -1,5 +1,6 @@
1
- import { AutoUpdater, generateUpdateManifest } from 'craft-native';
2
- import type { UpdateManifest, UpdaterConfig } from 'craft-native';
1
+ import { AutoUpdater, canReplaceBundle, clearQuarantine, extractBundle, generateUpdateManifest, readBundleIdentity, swapBundle, verifyBundleTrust } from 'craft-native';
2
+ import type { BundleIdentity, BundleTrustPolicy, BundleTrustResult, UpdateManifest, UpdaterConfig } from 'craft-native';
3
+ export type { BundleIdentity, BundleTrustPolicy, BundleTrustResult };
3
4
  export type { PlatformUpdate, UpdateManifest, UpdaterConfig, UpdaterEvent, UpdateProgress } from 'craft-native';
4
5
  /**
5
6
  * URL of an asset on the repository's newest release.
@@ -21,6 +22,60 @@ export declare function createGitHubUpdater(options: GitHubUpdaterOptions): Auto
21
22
  * its URL at the release's own tag.
22
23
  */
23
24
  export declare function createGitHubUpdateManifest(options: GitHubManifestOptions): UpdateManifest;
25
+ /**
26
+ * The `.app` the current process is running out of, or null outside one.
27
+ *
28
+ * Every self-updating app needs this and every one of them derives it
29
+ * differently — usually as `../../..` from `process.execPath`, which is right
30
+ * for `Foo.app/Contents/MacOS/Foo` and wrong for anything nested deeper.
31
+ *
32
+ * The *outermost* `.app` is the answer, not the nearest one. Apps embed whole
33
+ * bundles inside themselves — XPC services, login items, a Sparkle updater —
34
+ * and a process running from one of those is still part of the app the user
35
+ * launched and installed. Taking the nearest bundle would have such a process
36
+ * replace the fragment it happens to live in and leave the rest of the app at
37
+ * the old version.
38
+ *
39
+ * Returns null for `bun run` in development, rather than pointing the updater
40
+ * at a directory in the source tree.
41
+ */
42
+ export declare function bundlePathForExecutable(execPath?: string): string | null;
43
+ /**
44
+ * Team ID of the bundle this process is running from, or null.
45
+ *
46
+ * This is what makes "only install updates from us" a default rather than a
47
+ * configuration step: an app does not have to know or hardcode its own Team
48
+ * ID, because the copy already on disk is signed with it.
49
+ */
50
+ export declare function runningBundleTeamId(): Promise<string | null>;
51
+ /**
52
+ * Quit the launcher that started this process.
53
+ *
54
+ * The stx desktop shape is one binary running as three processes: a launcher,
55
+ * the agent it spawns, and the native window. Only the launcher can bring the
56
+ * other two down, and it is this process's parent — so a `SIGTERM` there is
57
+ * what "quit the app" means from inside the agent.
58
+ */
59
+ export declare function quitLauncher(): void;
60
+ /**
61
+ * Start a fresh copy of the bundle, then stand the current one down.
62
+ *
63
+ * `open -n` rather than executing the binary directly: it goes through
64
+ * LaunchServices, which registers the newly swapped bundle, gives it its own
65
+ * activation and Dock entry, and starts it detached from this process — so
66
+ * the new copy is not a child of the one that is about to exit.
67
+ */
68
+ export declare function relaunchBundle(options?: RelaunchOptions): void;
69
+ /**
70
+ * A GitHub-Releases updater for the app that is running, wired to the checks
71
+ * macOS itself performs.
72
+ *
73
+ * Two things it does that a bare {@link AutoUpdater} cannot: it finds its own
74
+ * bundle, and it pins the signing team to whatever signed that bundle. Both
75
+ * are facts about the running app, so neither has to be configured, and an app
76
+ * cannot get them subtly wrong by copying an example.
77
+ */
78
+ export declare function createSelfUpdater(options: SelfUpdaterOptions): Promise<AutoUpdater>;
24
79
  /** Manifest asset name an app publishes alongside its release artifacts. */
25
80
  export declare const UPDATE_MANIFEST_ASSET: 'update.json';
26
81
  export declare interface GitHubUpdaterOptions extends Omit<UpdaterConfig, 'updateUrl'> {
@@ -38,4 +93,23 @@ export declare interface GitHubManifestOptions {
38
93
  linux?: string
39
94
  }
40
95
  }
96
+ // =============================================================================
97
+ // Relaunching
98
+ // =============================================================================
99
+ export declare interface RelaunchOptions {
100
+ appPath?: string
101
+ quit?: () => void
102
+ quitDelayMs?: number
103
+ }
104
+ // =============================================================================
105
+ // Self-updater
106
+ // =============================================================================
107
+ export declare interface SelfUpdaterOptions extends Omit<GitHubUpdaterOptions, 'appPath'> {
108
+ appPath?: string
109
+ requireSameTeam?: boolean
110
+ }
41
111
  export { AutoUpdater, generateUpdateManifest };
112
+ // The macOS bundle primitives, forwarded so an app never has to reach past
113
+ // `@stacksjs/desktop` into Craft for the half of self-updating that is file
114
+ // operations rather than HTTP.
115
+ export { canReplaceBundle, clearQuarantine, extractBundle, readBundleIdentity, swapBundle, verifyBundleTrust };
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-h05t5fn6.js";O();function O(){if(typeof window>"u")return;let A=window;if(typeof A.addEventListener==="function"&&typeof A.dispatchEvent==="function")return;let B=new Map;A.addEventListener=(j,q)=>{let D=B.get(j);if(!D)D=new Set,B.set(j,D);D.add(q)},A.removeEventListener=(j,q)=>{B.get(j)?.delete(q)},A.dispatchEvent=(j)=>{let q=B.get(j.type);if(q)for(let D of q)try{D(j)}catch{}return!0}}function P(A=[]){let B=[],j=new Map,q=window.craft,D=q&&q.__craft_bridge_loaded?void 0:q;function I(x,z){return(...C)=>{B.push({ns:x,method:z,args:C});let F=`${x}:${z}`;if(j.has(F)){let G=j.get(F),L=typeof G==="function"?G(...C):G;return Promise.resolve(L)}return Promise.resolve(void 0)}}function J(x){return new Proxy({},{get(z,C){if(typeof C!=="string")return;if(j.has(`${x}:${C}`)){let F=j.get(`${x}:${C}`);if(typeof F==="function"&&F.length===0)return()=>{return B.push({ns:x,method:C,args:[]}),F()}}return I(x,C)}})}let K=new Proxy({},{get(x,z){if(typeof z!=="string")return;return J(z)},has(x,z){if(typeof z!=="string")return!1;if(A.length===0)return!0;return A.includes(z)}});return window.craft=K,{calls:B,whenCalled(x,z,C){j.set(`${x}:${z}`,C)},uninstall(){if(D===void 0)delete window.craft;else window.craft=D}}}function Q(A,B,j){return A.find((q)=>q.ns===B&&q.method===j)}export{P as installMockBridge,Q as findCall};
2
+ import"./chunk-dr2ba0an.js";O();function O(){if(typeof window>"u")return;let A=window;if(typeof A.addEventListener==="function"&&typeof A.dispatchEvent==="function")return;let B=new Map;A.addEventListener=(j,q)=>{let D=B.get(j);if(!D)D=new Set,B.set(j,D);D.add(q)},A.removeEventListener=(j,q)=>{B.get(j)?.delete(q)},A.dispatchEvent=(j)=>{let q=B.get(j.type);if(q)for(let D of q)try{D(j)}catch{}return!0}}function P(A=[]){let B=[],j=new Map,q=window.craft,D=q&&q.__craft_bridge_loaded?void 0:q;function I(x,z){return(...C)=>{B.push({ns:x,method:z,args:C});let F=`${x}:${z}`;if(j.has(F)){let G=j.get(F),L=typeof G==="function"?G(...C):G;return Promise.resolve(L)}return Promise.resolve(void 0)}}function J(x){return new Proxy({},{get(z,C){if(typeof C!=="string")return;if(j.has(`${x}:${C}`)){let F=j.get(`${x}:${C}`);if(typeof F==="function"&&F.length===0)return()=>{return B.push({ns:x,method:C,args:[]}),F()}}return I(x,C)}})}let K=new Proxy({},{get(x,z){if(typeof z!=="string")return;return J(z)},has(x,z){if(typeof z!=="string")return!1;if(A.length===0)return!0;return A.includes(z)}});return window.craft=K,{calls:B,whenCalled(x,z,C){j.set(`${x}:${z}`,C)},uninstall(){if(D===void 0)delete window.craft;else window.craft=D}}}function Q(A,B,j){return A.find((q)=>q.ns===B&&q.method===j)}export{P as installMockBridge,Q as findCall};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/desktop",
3
3
  "type": "module",
4
- "version": "0.2.279",
4
+ "version": "0.2.281",
5
5
  "description": "Native desktop application framework for stx (powered by Craft)",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -59,6 +59,6 @@
59
59
  "typecheck": "bun tsc --noEmit"
60
60
  },
61
61
  "dependencies": {
62
- "craft-native": ">=0.0.76"
62
+ "craft-native": ">=0.0.88"
63
63
  }
64
64
  }