@domicile-desktop/component-library 0.0.0-alpha-ee63a45c02dc → 0.0.0-alpha-8cd8292d48b7

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/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "dependencies": {
3
3
  "@base-ui/react": "^1.8.0",
4
4
  "@cprussin/option-result": "^2.0.1",
5
- "@domicile-desktop/sdk": "0.0.0-alpha-ee63a45c02dc",
6
- "@domicile-desktop/system-apps": "0.0.0-alpha-ee63a45c02dc",
5
+ "@domicile-desktop/sdk": "0.0.0-alpha-8cd8292d48b7",
6
+ "@domicile-desktop/system-apps": "0.0.0-alpha-8cd8292d48b7",
7
7
  "@pandacss/dev": "^1.12.1",
8
8
  "@phosphor-icons/react": "^2.1.10"
9
9
  },
@@ -116,5 +116,5 @@
116
116
  "test:unit": "bun test"
117
117
  },
118
118
  "type": "module",
119
- "version": "0.0.0-alpha-ee63a45c02dc"
119
+ "version": "0.0.0-alpha-8cd8292d48b7"
120
120
  }
@@ -79,8 +79,9 @@ type Props = {
79
79
 
80
80
  /**
81
81
  * Every dialog applications ask for through `xdg-desktop-portal`, one at a
82
- * time, oldest first, and an indicator for each session that controls or
83
- * captures input. Requests of a kind it has no dialog for are refused.
82
+ * time, oldest first, with a screenshot, color pick or screen cast stacked
83
+ * over it so the user can capture it, and an indicator for each session that
84
+ * controls or captures input. Requests of a kind it has no dialog for are refused.
84
85
  * Inhibitors are not questions, so it leaves them be. It also fires the
85
86
  * chords applications hold through the GlobalShortcuts portal. See
86
87
  * docs/PORTALS.md.
@@ -118,11 +119,6 @@ export const PortalDialogs = memo(
118
119
  }
119
120
  }, [host, requests]);
120
121
 
121
- const shown = requests.find(
122
- (request) =>
123
- isAsked(request) &&
124
- claims.get(request.id)?.kind !== CastClaimKind.Answered,
125
- );
126
122
  return (
127
123
  <>
128
124
  <CapturingIndicator
@@ -139,7 +135,12 @@ export const PortalDialogs = memo(
139
135
  stopCapturing(host, id);
140
136
  }}
141
137
  />
142
- {shown !== undefined && (
138
+ {stacked(
139
+ requests.filter(
140
+ (request) =>
141
+ claims.get(request.id)?.kind !== CastClaimKind.Answered,
142
+ ),
143
+ ).map((shown) => (
143
144
  <Dialog
144
145
  answer={(answer) => {
145
146
  answerPortalRequest(host, shown.id, answer);
@@ -156,7 +157,7 @@ export const PortalDialogs = memo(
156
157
  shownWindows={shownWindows}
157
158
  system={files}
158
159
  />
159
- )}
160
+ ))}
160
161
  </>
161
162
  );
162
163
  },
@@ -393,6 +394,43 @@ const otherAppIds = (request: PortalRequest): string[] => {
393
394
  }
394
395
  };
395
396
 
397
+ /**
398
+ * The dialogs to draw, bottom first: the oldest question and, over it, the
399
+ * oldest capture after it, so the user can capture the dialog under it.
400
+ * Anything asked after a capture waits for it.
401
+ */
402
+ const stacked = (requests: readonly PortalRequest[]): PortalRequest[] => {
403
+ const asked = requests.filter(isAsked);
404
+ const capture = asked.find(isCapture);
405
+ return capture === undefined || capture === asked[0]
406
+ ? asked.slice(0, 1)
407
+ : [...asked.slice(0, 1), capture];
408
+ };
409
+
410
+ /** Whether `request` captures the desk, so it can capture other dialogs. */
411
+ const isCapture = (request: PortalRequest): boolean => {
412
+ switch (request.kind) {
413
+ case PortalKind.Screenshot:
414
+ case PortalKind.PickColor:
415
+ case PortalKind.ScreenCast:
416
+ return true;
417
+ case PortalKind.Access:
418
+ case PortalKind.AppChooser:
419
+ case PortalKind.FileChooser:
420
+ case PortalKind.RemoteDesktop:
421
+ case PortalKind.InputCapture:
422
+ case PortalKind.DynamicLauncher:
423
+ case PortalKind.Usb:
424
+ case PortalKind.Account:
425
+ case PortalKind.GlobalShortcuts:
426
+ case PortalKind.Wallpaper:
427
+ case PortalKind.Print:
428
+ case PortalKind.Inhibit:
429
+ case PortalKind.Unknown:
430
+ return false;
431
+ }
432
+ };
433
+
396
434
  /** Whether `request` is a question this draws a dialog for. */
397
435
  const isAsked = (request: PortalRequest): boolean => {
398
436
  switch (request.kind) {