@domicile-desktop/sdk 0.0.0-alpha-a188e786941a → 0.0.0-alpha-e7fa166f70ee

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.
@@ -168,6 +168,12 @@ export type Browser = {
168
168
  * Electron app runs the entry.
169
169
  */
170
170
  answerPopupMenu: (id: string, command: number) => void;
171
+ /**
172
+ * The shell made window `id` `state`, whether or not its app asked (its
173
+ * `wantsMaximized` and the rest). Its Electron app hears each change; any
174
+ * other window ignores it.
175
+ */
176
+ setWindowState: (id: string, state: WindowStateReport) => void;
171
177
  /**
172
178
  * The user answered the message box window `id` shows (its `messageBox`)
173
179
  * with button `response`, an index into its `buttons`, leaving its checkbox
@@ -182,5 +188,11 @@ export type Browser = {
182
188
  fetch: (url: string, init?: FetchInit) => Promise<FetchResponse>;
183
189
  on: On<BrowserListeners>;
184
190
  };
185
- export type BrowserHost = Pick<DomicileHost, "addEventListener" | "answerBrowserWindowMessageBox" | "answerBrowserWindowPopupMenu" | "browserProfileFor" | "browserProfiles" | "browserSiteFor" | "browserWindows" | "clickBrowserWindowMatch" | "clickBrowserWindowMenu" | "closeBrowserWindow" | "countBrowserWindowMatches" | "fetchWithCookies" | "openAppWindow" | "openBrowserWindow" | "openPrivateBrowserWindow" | "pinBrowserSite" | "removeEventListener" | "reopenBrowserWindow" | "setBrowserProfileExtensionEnabled">;
191
+ export type BrowserHost = Pick<DomicileHost, "addEventListener" | "answerBrowserWindowMessageBox" | "answerBrowserWindowPopupMenu" | "browserProfileFor" | "browserProfiles" | "browserSiteFor" | "browserWindows" | "clickBrowserWindowMatch" | "clickBrowserWindowMenu" | "closeBrowserWindow" | "countBrowserWindowMatches" | "fetchWithCookies" | "openAppWindow" | "openBrowserWindow" | "openPrivateBrowserWindow" | "pinBrowserSite" | "removeEventListener" | "reopenBrowserWindow" | "setBrowserProfileExtensionEnabled" | "setBrowserWindowState">;
192
+ /** What the shell made a window, as `setWindowState` reports it. */
193
+ export type WindowStateReport = {
194
+ readonly maximized: boolean;
195
+ readonly minimized: boolean;
196
+ readonly fullscreen: boolean;
197
+ };
186
198
  export declare const browser: (host: BrowserHost) => Browser;
@@ -54,6 +54,9 @@ export const browser = (host) => {
54
54
  host.reopenBrowserWindow(id, profile);
55
55
  },
56
56
  setExtensionEnabled: (profile, id, enabled) => host.setBrowserProfileExtensionEnabled(profile, id, enabled),
57
+ setWindowState: (id, { fullscreen, maximized, minimized }) => {
58
+ host.setBrowserWindowState(id, maximized, minimized, fullscreen);
59
+ },
57
60
  siteFor: async (url) => {
58
61
  const site = await host.browserSiteFor(url);
59
62
  return site === "" ? undefined : site;
@@ -346,6 +346,14 @@ export type DomicileBrowserWindow = {
346
346
  * DomicileHost.answerBrowserWindowPopupMenu.
347
347
  */
348
348
  readonly popupMenu: string | null;
349
+ /**
350
+ * What an Electron app asks this window to be (win.maximize, minimize,
351
+ * setFullScreen). The shell decides, and says what it made the window with
352
+ * DomicileHost.setBrowserWindowState. Each is false for any other window.
353
+ */
354
+ readonly wantsMaximized: boolean;
355
+ readonly wantsMinimized: boolean;
356
+ readonly wantsFullscreen: boolean;
349
357
  };
350
358
  /**
351
359
  * A TV the desktop can cast to: a Google Cast receiver the browser's Media
@@ -1108,6 +1116,14 @@ export type DomicileHost = {
1108
1116
  * closed meanwhile, or shows no popup menu, does nothing.
1109
1117
  */
1110
1118
  answerBrowserWindowPopupMenu(id: string, command: number): void;
1119
+ /**
1120
+ * The shell made browser window `id` maximized, minimized and fullscreen as
1121
+ * these say, whether or not its app asked (DomicileBrowserWindow.
1122
+ * wantsMaximized and the rest). An Electron app's window tells its app of
1123
+ * each change; any other window, or one that closed meanwhile, does
1124
+ * nothing.
1125
+ */
1126
+ setBrowserWindowState(id: string, maximized: boolean, minimized: boolean, fullscreen: boolean): void;
1111
1127
  /**
1112
1128
  * The user answered the message box window `id` shows
1113
1129
  * (DomicileBrowserWindow.messageBox) with button `response`, an index into
@@ -59,6 +59,15 @@ export declare class FakeDomicileHost {
59
59
  autoHide?: boolean | undefined;
60
60
  visible?: boolean | undefined;
61
61
  }): void;
62
+ /**
63
+ * Browser window `id` shows its Electron app's popup menu `menu`, as the
64
+ * engine lists it (JSON), or null for none.
65
+ */
66
+ /**
67
+ * Browser window `id`'s Electron app asks to be maximized, minimized or
68
+ * fullscreen, as the engine lists it.
69
+ */
70
+ setWantedState(id: string, wants: Partial<Pick<DomicileBrowserWindow, "wantsFullscreen" | "wantsMaximized" | "wantsMinimized">>): void;
62
71
  /**
63
72
  * Browser window `id` shows its Electron app's popup menu `menu`, as the
64
73
  * engine lists it (JSON), or null for none.
package/dist/fake-host.js CHANGED
@@ -290,6 +290,9 @@ export class FakeDomicileHost {
290
290
  title: "",
291
291
  toplevelId: null,
292
292
  url,
293
+ wantsFullscreen: false,
294
+ wantsMaximized: false,
295
+ wantsMinimized: false,
293
296
  width,
294
297
  x,
295
298
  y,
@@ -349,6 +352,19 @@ export class FakeDomicileHost {
349
352
  : window),
350
353
  });
351
354
  }
355
+ /**
356
+ * Browser window `id` shows its Electron app's popup menu `menu`, as the
357
+ * engine lists it (JSON), or null for none.
358
+ */
359
+ /**
360
+ * Browser window `id`'s Electron app asks to be maximized, minimized or
361
+ * fullscreen, as the engine lists it.
362
+ */
363
+ setWantedState(id, wants) {
364
+ this.set({
365
+ browserWindows: (this.#state.browserWindows ?? []).map((window) => window.id === id ? { ...window, ...wants } : window),
366
+ });
367
+ }
352
368
  /**
353
369
  * Browser window `id` shows its Electron app's popup menu `menu`, as the
354
370
  * engine lists it (JSON), or null for none.
package/package.json CHANGED
@@ -265,7 +265,7 @@
265
265
  "test:unit": "bun test"
266
266
  },
267
267
  "type": "module",
268
- "version": "0.0.0-alpha-a188e786941a",
268
+ "version": "0.0.0-alpha-e7fa166f70ee",
269
269
  "repository": {
270
270
  "type": "git",
271
271
  "url": "git+https://github.com/cprussin/domicile.git",