@domicile-desktop/component-library 0.0.0-alpha-07457bed9f1f → 0.0.0-alpha-7d79eb2cfe38
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-
|
|
6
|
-
"@domicile-desktop/system-apps": "0.0.0-alpha-
|
|
5
|
+
"@domicile-desktop/sdk": "0.0.0-alpha-7d79eb2cfe38",
|
|
6
|
+
"@domicile-desktop/system-apps": "0.0.0-alpha-7d79eb2cfe38",
|
|
7
7
|
"@pandacss/dev": "^1.12.1",
|
|
8
8
|
"@phosphor-icons/react": "^2.1.10"
|
|
9
9
|
},
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"test:unit": "bun test"
|
|
110
110
|
},
|
|
111
111
|
"type": "module",
|
|
112
|
-
"version": "0.0.0-alpha-
|
|
112
|
+
"version": "0.0.0-alpha-7d79eb2cfe38"
|
|
113
113
|
}
|
|
@@ -39,13 +39,30 @@ type Props = {
|
|
|
39
39
|
enum PickKind {
|
|
40
40
|
Area,
|
|
41
41
|
Window,
|
|
42
|
+
BrowserWindow,
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
const Pick = {
|
|
45
46
|
/** An area of the frozen desk. */
|
|
46
47
|
Area: (area: ShotRect) => ({ area, kind: PickKind.Area as const }),
|
|
47
|
-
/**
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* A browser window from the engine's capture of its page, without what is
|
|
50
|
+
* over it. `area` is where the shell shows it on the frozen desk.
|
|
51
|
+
*/
|
|
52
|
+
BrowserWindow: (id: string, area: ShotRect) => ({
|
|
53
|
+
area,
|
|
54
|
+
id,
|
|
55
|
+
kind: PickKind.BrowserWindow as const,
|
|
56
|
+
}),
|
|
57
|
+
/**
|
|
58
|
+
* A window from its own last frame, without what is over it. `area` is
|
|
59
|
+
* where the shell shows it on the frozen desk, if it does.
|
|
60
|
+
*/
|
|
61
|
+
Window: (id: string, area: ShotRect | undefined) => ({
|
|
62
|
+
area,
|
|
63
|
+
id,
|
|
64
|
+
kind: PickKind.Window as const,
|
|
65
|
+
}),
|
|
49
66
|
};
|
|
50
67
|
|
|
51
68
|
type Pick = ReturnType<(typeof Pick)[keyof typeof Pick]>;
|
|
@@ -55,10 +72,9 @@ type Choice = { icon: ReactNode; name: string; pick: Pick };
|
|
|
55
72
|
|
|
56
73
|
/**
|
|
57
74
|
* Picks what to save of a frozen desk: all of it, a screen, a window, or an
|
|
58
|
-
* area dragged over it. A window
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* Dismissing it cancels.
|
|
75
|
+
* area dragged over it. A window is saved from its own frame, so what is
|
|
76
|
+
* over it, such as a notification, is left out. Ctrl+C copies the pick to
|
|
77
|
+
* the clipboard instead of saving it. Dismissing it cancels.
|
|
62
78
|
*/
|
|
63
79
|
export const ScreenshotDialog = ({
|
|
64
80
|
answer,
|
|
@@ -183,7 +199,7 @@ export const ScreenshotDialog = ({
|
|
|
183
199
|
</ChoiceGroup>
|
|
184
200
|
)}
|
|
185
201
|
</div>
|
|
186
|
-
{pick.kind === PickKind.Window && (
|
|
202
|
+
{pick.kind === PickKind.Window && pick.area === undefined && (
|
|
187
203
|
<p className={askerStyles}>
|
|
188
204
|
Not on screen: saved as it last drew itself.
|
|
189
205
|
</p>
|
|
@@ -212,7 +228,7 @@ export const ScreenshotDialog = ({
|
|
|
212
228
|
draggable={false}
|
|
213
229
|
src={body.frame}
|
|
214
230
|
/>
|
|
215
|
-
{pick.
|
|
231
|
+
{pick.area !== undefined && (
|
|
216
232
|
<div className={pickedStyles} style={placed(pick.area, body)} />
|
|
217
233
|
)}
|
|
218
234
|
</div>
|
|
@@ -297,6 +313,8 @@ const answerOf = (pick: Pick, copy: boolean): PortalAnswer => {
|
|
|
297
313
|
return Answer.Screenshot(pick.area, copy);
|
|
298
314
|
case PickKind.Window:
|
|
299
315
|
return Answer.ScreenshotWindow(pick.id, copy);
|
|
316
|
+
case PickKind.BrowserWindow:
|
|
317
|
+
return Answer.ScreenshotBrowserWindow(pick.id, copy);
|
|
300
318
|
}
|
|
301
319
|
};
|
|
302
320
|
|
|
@@ -308,10 +326,7 @@ const isCopy = (event: KeyboardEvent): boolean =>
|
|
|
308
326
|
!event.shiftKey &&
|
|
309
327
|
event.key.toLowerCase() === "c";
|
|
310
328
|
|
|
311
|
-
/**
|
|
312
|
-
* What saving window `id` keeps: its frame on the desk while the shell shows
|
|
313
|
-
* it there, else its own last frame.
|
|
314
|
-
*/
|
|
329
|
+
/** Window `id`, placed on the desk while the shell shows it there. */
|
|
315
330
|
const pickOf = (
|
|
316
331
|
desk: FrozenDesk,
|
|
317
332
|
shown: readonly ShownWindow[],
|
|
@@ -320,13 +335,16 @@ const pickOf = (
|
|
|
320
335
|
const window = shown.find(
|
|
321
336
|
(window) => window.kind === ShownWindowKind.App && window.appId === id,
|
|
322
337
|
);
|
|
323
|
-
|
|
324
|
-
|
|
338
|
+
return Pick.Window(
|
|
339
|
+
id,
|
|
340
|
+
window === undefined ? undefined : onFrame(desk, window.box),
|
|
341
|
+
);
|
|
325
342
|
};
|
|
326
343
|
|
|
327
344
|
/**
|
|
328
|
-
* `window` as a choice when it is a listed browser window on the desk.
|
|
329
|
-
*
|
|
345
|
+
* `window` as a choice when it is a listed browser window on the desk. A
|
|
346
|
+
* browser window's page draws only while shown, so one not on screen has
|
|
347
|
+
* nothing to save.
|
|
330
348
|
*/
|
|
331
349
|
const browserChoices = (
|
|
332
350
|
desk: FrozenDesk,
|
|
@@ -345,7 +363,7 @@ const browserChoices = (
|
|
|
345
363
|
{
|
|
346
364
|
icon: <GlobeIcon aria-hidden />,
|
|
347
365
|
name: `Browser: ${titled(browser.title)}`,
|
|
348
|
-
pick: Pick.
|
|
366
|
+
pick: Pick.BrowserWindow(browser.id, area),
|
|
349
367
|
},
|
|
350
368
|
];
|
|
351
369
|
}
|