@domicile-desktop/sdk 0.0.0-alpha-59b63cdb292c → 0.0.0-alpha-452a746292aa

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/portal.d.ts CHANGED
@@ -318,11 +318,15 @@ export declare const CastSource: {
318
318
  id: string;
319
319
  /** Its title as the shell named it, for the sharing indicator. */
320
320
  title: string;
321
+ /** Part of its page alone, as a window's `area` is. */
322
+ area?: ShotRect | undefined;
321
323
  }) => {
322
324
  /** Its id, as `DomicileHost.browserWindows` lists it. */
323
325
  id: string;
324
326
  /** Its title as the shell named it, for the sharing indicator. */
325
327
  title: string;
328
+ /** Part of its page alone, as a window's `area` is. */
329
+ area?: ShotRect | undefined;
326
330
  kind: CastSourceKind.BrowserWindow;
327
331
  };
328
332
  Monitor: (monitor: {
@@ -357,6 +361,11 @@ export declare const CastSource: {
357
361
  title: string;
358
362
  /** Its Wayland app id, which names its desktop entry; empty if unset. */
359
363
  appId: string;
364
+ /**
365
+ * Part of the window alone, in pixels of its frame as
366
+ * `System.previewWindow` draws it. All of it when unset.
367
+ */
368
+ area?: ShotRect | undefined;
360
369
  }) => {
361
370
  /** The window's id, as `DomicileHost.windows` lists it. */
362
371
  id: string;
@@ -364,6 +373,11 @@ export declare const CastSource: {
364
373
  title: string;
365
374
  /** Its Wayland app id, which names its desktop entry; empty if unset. */
366
375
  appId: string;
376
+ /**
377
+ * Part of the window alone, in pixels of its frame as
378
+ * `System.previewWindow` draws it. All of it when unset.
379
+ */
380
+ area?: ShotRect | undefined;
367
381
  kind: CastSourceKind.Window;
368
382
  };
369
383
  };
@@ -796,13 +810,19 @@ export declare const PortalAnswer: {
796
810
  * A browser window, by its `DomicileBrowserWindow` id; `copy` as above.
797
811
  * Nothing the shell draws over the window is in the shot.
798
812
  */
799
- ScreenshotBrowserWindow: (id: string, copy: boolean) => {
813
+ ScreenshotBrowserWindow: (id: string, copy: boolean, area?: ShotRect | undefined) => {
814
+ area: ShotRect | undefined;
800
815
  copy: boolean;
801
816
  id: string;
802
817
  kind: PortalAnswerKind.ScreenshotBrowserWindow;
803
818
  };
804
- /** One of the request's windows, by {@link ShotWindow.id}; `copy` as above. */
805
- ScreenshotWindow: (id: string, copy: boolean) => {
819
+ /**
820
+ * One of the request's windows, by {@link ShotWindow.id}; `copy` as above.
821
+ * `area` is part of it, in pixels of its frame as `System.previewWindow`
822
+ * draws it; all of it when unset.
823
+ */
824
+ ScreenshotWindow: (id: string, copy: boolean, area?: ShotRect | undefined) => {
825
+ area: ShotRect | undefined;
806
826
  copy: boolean;
807
827
  id: string;
808
828
  kind: PortalAnswerKind.ScreenshotWindow;
package/dist/portal.js CHANGED
@@ -353,13 +353,19 @@ export const PortalAnswer = {
353
353
  * A browser window, by its `DomicileBrowserWindow` id; `copy` as above.
354
354
  * Nothing the shell draws over the window is in the shot.
355
355
  */
356
- ScreenshotBrowserWindow: (id, copy) => ({
356
+ ScreenshotBrowserWindow: (id, copy, area) => ({
357
+ area,
357
358
  copy,
358
359
  id,
359
360
  kind: PortalAnswerKind.ScreenshotBrowserWindow,
360
361
  }),
361
- /** One of the request's windows, by {@link ShotWindow.id}; `copy` as above. */
362
- ScreenshotWindow: (id, copy) => ({
362
+ /**
363
+ * One of the request's windows, by {@link ShotWindow.id}; `copy` as above.
364
+ * `area` is part of it, in pixels of its frame as `System.previewWindow`
365
+ * draws it; all of it when unset.
366
+ */
367
+ ScreenshotWindow: (id, copy, area) => ({
368
+ area,
363
369
  copy,
364
370
  id,
365
371
  kind: PortalAnswerKind.ScreenshotWindow,
@@ -1029,9 +1035,15 @@ const wireAnswer = (answer) => {
1029
1035
  case PortalAnswerKind.Screenshot:
1030
1036
  return { area: answer.area, copy: answer.copy, kind: "screenshot" };
1031
1037
  case PortalAnswerKind.ScreenshotWindow:
1032
- return { copy: answer.copy, id: answer.id, kind: "screenshot_window" };
1038
+ return {
1039
+ ...wireArea(answer.area),
1040
+ copy: answer.copy,
1041
+ id: answer.id,
1042
+ kind: "screenshot_window",
1043
+ };
1033
1044
  case PortalAnswerKind.ScreenshotBrowserWindow:
1034
1045
  return {
1046
+ ...wireArea(answer.area),
1035
1047
  copy: answer.copy,
1036
1048
  id: answer.id,
1037
1049
  kind: "screenshot_browser_window",
@@ -1054,15 +1066,22 @@ const wireOptions = (options) => ({
1054
1066
  const wireSource = (source) => {
1055
1067
  switch (source.kind) {
1056
1068
  case CastSourceKind.Window:
1057
- return { id: source.id, type: "window" };
1069
+ return { ...wireArea(source.area), id: source.id, type: "window" };
1058
1070
  case CastSourceKind.BrowserWindow:
1059
- return { id: source.id, title: source.title, type: "browser_window" };
1071
+ return {
1072
+ ...wireArea(source.area),
1073
+ id: source.id,
1074
+ title: source.title,
1075
+ type: "browser_window",
1076
+ };
1060
1077
  case CastSourceKind.Monitor:
1061
1078
  return { name: source.name, type: "monitor" };
1062
1079
  case CastSourceKind.Region:
1063
1080
  return { position: source.position, size: source.size, type: "region" };
1064
1081
  }
1065
1082
  };
1083
+ /** Part of a window, when only part is picked. */
1084
+ const wireArea = (area) => area === undefined ? {} : { area };
1066
1085
  /** The value `pairs` gives `wire`. Every wire name the schema takes is listed. */
1067
1086
  const valueFor = (pairs, wire) => {
1068
1087
  const found = pairs.find(([listed]) => listed === wire);
package/package.json CHANGED
@@ -140,7 +140,7 @@
140
140
  "test:unit": "bun test"
141
141
  },
142
142
  "type": "module",
143
- "version": "0.0.0-alpha-59b63cdb292c",
143
+ "version": "0.0.0-alpha-452a746292aa",
144
144
  "repository": {
145
145
  "type": "git",
146
146
  "url": "git+https://github.com/cprussin/domicile.git",