@domicile-desktop/sdk 0.0.0-alpha-e455955b57c7 → 0.0.0-alpha-cd52ce30fbe6
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/README.md +1 -1
- package/dist/desktop/capture.d.ts +3 -1
- package/dist/desktop/capture.js +3 -2
- package/dist/desktop/portal-wire.d.ts +6 -0
- package/dist/desktop/portal-wire.js +35 -0
- package/dist/desktop/portals.d.ts +6 -0
- package/dist/desktop/portals.js +10 -1
- package/dist/desktop/system-calls.d.ts +7 -0
- package/dist/desktop/system-calls.js +1 -0
- package/dist/portal.d.ts +77 -11
- package/dist/portal.js +43 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ See [docs/ELEMENTS.md](docs/ELEMENTS.md) for `<app>` input and focus, and the
|
|
|
68
68
|
| `./file-preview` | `previewFile(domicile, path)`: a launcher's preview of a path, read through `domicile.files`: a directory's entries, a song's tags and cover, or the start of a text file. |
|
|
69
69
|
| `./dbusmenu` | `watchMenu(domicile, { bus, path })`: a tray item's `com.canonical.dbusmenu` menu, read again on each change, with `click` and `aboutToShow`. Hidden entries are left out; labels lose their mnemonic underscore, and `mnemonic` says where it was. `icon-data` comes as a PNG `data:` URL. See [SYSTEM-TRAY.md](/docs/architecture/SYSTEM-TRAY.md). |
|
|
70
70
|
| `./system` | The types of the compositor's system calls: `SystemError`, `FileType`, `Listening`, … The calls are the desktop's `files`, `processes`, `dbus` and the rest; the compositor refuses most while the desktop is locked. See [SHELL-SYSTEM-ACCESS.md](/docs/SHELL-SYSTEM-ACCESS.md). |
|
|
71
|
-
| `./portal` | The types of application dialogs from `xdg-desktop-portal` (`PortalRequest`, `PortalAnswer`, …) and of running sessions that record the screen or control or capture input (`Capturing`). The desktop's `portals` lists and answers them; `<PortalDialogs />` in component-library draws them. See [PORTALS.md](/docs/PORTALS.md). |
|
|
71
|
+
| `./portal` | The types of application dialogs from `xdg-desktop-portal` (`PortalRequest`, `PortalAnswer`, …) and of running sessions that record the screen or control or capture input (`Capturing`). The desktop's `portals` lists and answers them, and pauses, resumes and discards the shell's own recording; `hideFromCaptures` leaves an element of the shell's out of every capture of the desk; `<PortalDialogs />` in component-library draws them. See [PORTALS.md](/docs/PORTALS.md). |
|
|
72
72
|
| `./global-shortcuts` | `fireGlobalShortcuts`: grab the chords applications hold through the GlobalShortcuts portal and report each press and release. `<PortalDialogs />` calls it. |
|
|
73
73
|
| `./options` | `defineOptions` and `option`: the options a shell declares as its `options` export, which the Settings app edits. `watchShellOptions` reads the config's values of them, live. See [WRITING-A-SHELL.md](/docs/WRITING-A-SHELL.md#options). |
|
|
74
74
|
| `./icon-theme` | `readIconTheme(domicile)`: the config's `theme.icon_theme`, read from the compositor's Settings portal, or `None` for `hicolor` only. `watchIconTheme` reads it and follows `SettingChanged`. `@domicile-desktop/system-apps/app-icons` takes it. |
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { System } from "./system-calls";
|
|
2
2
|
export type Capture = {
|
|
3
3
|
screenshot: System["screenshot"];
|
|
4
|
+
/** Record what the shell's dialog picks; see {@link System.screenRecord}. */
|
|
5
|
+
screenRecord: System["screenRecord"];
|
|
4
6
|
/** A window as it last drew itself, as a `data:` URL of a PNG. */
|
|
5
7
|
preview: System["previewWindow"];
|
|
6
8
|
};
|
|
7
|
-
export declare const capture: (calls: Pick<System, "previewWindow" | "screenshot">) => Capture;
|
|
9
|
+
export declare const capture: (calls: Pick<System, "previewWindow" | "screenRecord" | "screenshot">) => Capture;
|
package/dist/desktop/capture.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
// Pictures of the desk: a screenshot through the shell's
|
|
2
|
-
// window's last frame for a picker.
|
|
1
|
+
// Pictures of the desk: a screenshot or a screen recording through the shell's
|
|
2
|
+
// dialog, and a window's last frame for a picker.
|
|
3
3
|
export const capture = (calls) => ({
|
|
4
4
|
preview: (window) => calls.previewWindow(window),
|
|
5
|
+
screenRecord: () => calls.screenRecord(),
|
|
5
6
|
screenshot: () => calls.screenshot(),
|
|
6
7
|
});
|
|
@@ -32,3 +32,9 @@ export declare const watchPortalWallpaper: (host: PortalHost, listener: (wallpap
|
|
|
32
32
|
export declare const answerPortalRequest: (host: PortalHost, id: number, answer: PortalAnswer) => void;
|
|
33
33
|
/** End capturing session `id`. */
|
|
34
34
|
export declare const stopCapturing: (host: PortalHost, id: number) => void;
|
|
35
|
+
/** Pause recording `id`. Its file leaves the pause out. */
|
|
36
|
+
export declare const pauseRecording: (host: PortalHost, id: number) => void;
|
|
37
|
+
/** Resume paused recording `id`. */
|
|
38
|
+
export declare const resumeRecording: (host: PortalHost, id: number) => void;
|
|
39
|
+
/** Stop recording `id` and delete its file. */
|
|
40
|
+
export declare const discardRecording: (host: PortalHost, id: number) => void;
|
|
@@ -59,6 +59,18 @@ export const answerPortalRequest = (host, id, answer) => {
|
|
|
59
59
|
export const stopCapturing = (host, id) => {
|
|
60
60
|
answerPortalRequest(host, id, PortalAnswer.Stop());
|
|
61
61
|
};
|
|
62
|
+
/** Pause recording `id`. Its file leaves the pause out. */
|
|
63
|
+
export const pauseRecording = (host, id) => {
|
|
64
|
+
answerPortalRequest(host, id, PortalAnswer.Pause());
|
|
65
|
+
};
|
|
66
|
+
/** Resume paused recording `id`. */
|
|
67
|
+
export const resumeRecording = (host, id) => {
|
|
68
|
+
answerPortalRequest(host, id, PortalAnswer.Resume());
|
|
69
|
+
};
|
|
70
|
+
/** Stop recording `id` and delete its file. */
|
|
71
|
+
export const discardRecording = (host, id) => {
|
|
72
|
+
answerPortalRequest(host, id, PortalAnswer.Discard());
|
|
73
|
+
};
|
|
62
74
|
/** Each `portal_requests` push, parsed. */
|
|
63
75
|
const watch = (host, listener) => {
|
|
64
76
|
const heard = (event) => {
|
|
@@ -263,6 +275,19 @@ const capturedSchema = z
|
|
|
263
275
|
}
|
|
264
276
|
});
|
|
265
277
|
const screenCastingSchema = z.object({ sources: z.array(capturedSchema) });
|
|
278
|
+
const recordingSchema = z
|
|
279
|
+
.object({
|
|
280
|
+
file: z.string(),
|
|
281
|
+
recorded_ms: z.number(),
|
|
282
|
+
running_since_ms: z.number().optional(),
|
|
283
|
+
sources: z.array(capturedSchema),
|
|
284
|
+
})
|
|
285
|
+
.transform((recording) => ({
|
|
286
|
+
file: recording.file,
|
|
287
|
+
recordedMs: recording.recorded_ms,
|
|
288
|
+
runningSinceMs: recording.running_since_ms,
|
|
289
|
+
sources: recording.sources,
|
|
290
|
+
}));
|
|
266
291
|
const shortcutsSchema = z
|
|
267
292
|
.object({
|
|
268
293
|
shortcuts: z.array(z.object({
|
|
@@ -539,6 +564,10 @@ const CAPTURING_KINDS = new Map([
|
|
|
539
564
|
"screen_cast",
|
|
540
565
|
(base, body) => Capturing.ScreenCast(base, screenCastingSchema.parse(body)),
|
|
541
566
|
],
|
|
567
|
+
[
|
|
568
|
+
"recording",
|
|
569
|
+
(base, body) => Capturing.Recording(base, recordingSchema.parse(body)),
|
|
570
|
+
],
|
|
542
571
|
]);
|
|
543
572
|
const itemSchema = z.object({
|
|
544
573
|
app_id: z.string(),
|
|
@@ -623,6 +652,12 @@ const wireAnswer = (answer) => {
|
|
|
623
652
|
};
|
|
624
653
|
case PortalAnswerKind.Stop:
|
|
625
654
|
return { kind: "stop" };
|
|
655
|
+
case PortalAnswerKind.Pause:
|
|
656
|
+
return { kind: "pause" };
|
|
657
|
+
case PortalAnswerKind.Resume:
|
|
658
|
+
return { kind: "resume" };
|
|
659
|
+
case PortalAnswerKind.Discard:
|
|
660
|
+
return { kind: "discard" };
|
|
626
661
|
case PortalAnswerKind.Canceled:
|
|
627
662
|
return { kind: "canceled" };
|
|
628
663
|
case PortalAnswerKind.DynamicLauncher:
|
|
@@ -19,6 +19,12 @@ export type Portals = {
|
|
|
19
19
|
answer: (id: number, answer: PortalAnswer) => void;
|
|
20
20
|
/** End capturing session `id`. */
|
|
21
21
|
stopCapturing: (id: number) => void;
|
|
22
|
+
/** Pause the shell's screen recording `id`. */
|
|
23
|
+
pauseRecording: (id: number) => void;
|
|
24
|
+
/** Resume the shell's paused screen recording `id`. */
|
|
25
|
+
resumeRecording: (id: number) => void;
|
|
26
|
+
/** End the shell's screen recording `id` and delete its file. */
|
|
27
|
+
discardRecording: (id: number) => void;
|
|
22
28
|
/**
|
|
23
29
|
* Tell the application holding bound shortcut `id` its chord went down or
|
|
24
30
|
* up. See {@link Portals.boundShortcuts}.
|
package/dist/desktop/portals.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Portal dialogs and the sessions they started: Domicile is the only
|
|
2
2
|
// xdg-desktop-portal backend, and the shell draws its dialogs. See
|
|
3
3
|
// docs/PORTALS.md.
|
|
4
|
-
import { answerPortalRequest, stopCapturing, watchBoundShortcuts, watchCapturing, watchPortalRequests, watchPortalWallpaper, } from "./portal-wire";
|
|
4
|
+
import { answerPortalRequest, discardRecording, pauseRecording, resumeRecording, stopCapturing, watchBoundShortcuts, watchCapturing, watchPortalRequests, watchPortalWallpaper, } from "./portal-wire";
|
|
5
5
|
import { hostEvent, on } from "./subscribe";
|
|
6
6
|
/** Listens from the start: the engine sends the latest push to a new listener. */
|
|
7
7
|
export const portals = (host) => {
|
|
@@ -28,15 +28,24 @@ export const portals = (host) => {
|
|
|
28
28
|
get capturing() {
|
|
29
29
|
return latest.capturing;
|
|
30
30
|
},
|
|
31
|
+
discardRecording: (id) => {
|
|
32
|
+
discardRecording(host, id);
|
|
33
|
+
},
|
|
31
34
|
fireShortcut: (id, kind) => {
|
|
32
35
|
host.answerPortalRequest(id, JSON.stringify({ kind }));
|
|
33
36
|
},
|
|
34
37
|
on: on({
|
|
35
38
|
change: (listener) => hostEvent(host, "portalrequests", () => listener()),
|
|
36
39
|
}),
|
|
40
|
+
pauseRecording: (id) => {
|
|
41
|
+
pauseRecording(host, id);
|
|
42
|
+
},
|
|
37
43
|
get requests() {
|
|
38
44
|
return latest.requests;
|
|
39
45
|
},
|
|
46
|
+
resumeRecording: (id) => {
|
|
47
|
+
resumeRecording(host, id);
|
|
48
|
+
},
|
|
40
49
|
stopCapturing: (id) => {
|
|
41
50
|
stopCapturing(host, id);
|
|
42
51
|
},
|
|
@@ -38,6 +38,13 @@ export type System = {
|
|
|
38
38
|
* the user presses Ctrl+C. Resolves with where it went.
|
|
39
39
|
*/
|
|
40
40
|
screenshot: () => Promise<Result<ScreenshotKept, SystemError>>;
|
|
41
|
+
/**
|
|
42
|
+
* Record the screen: `<PortalDialogs />` draws the screen cast picker, and
|
|
43
|
+
* what is picked is recorded, with its sound, until its toolbar stops it.
|
|
44
|
+
* Resolves with the WebM under `$XDG_VIDEOS_DIR/Screen recordings/`, or
|
|
45
|
+
* fails `Canceled` when the picker is dismissed or the recording discarded.
|
|
46
|
+
*/
|
|
47
|
+
screenRecord: () => Promise<Result<string, SystemError>>;
|
|
41
48
|
/**
|
|
42
49
|
* Draw `window` as it last drew itself, as a `data:` URL of a PNG, for a
|
|
43
50
|
* picker to preview a window that is not on screen. A browser window's page
|
|
@@ -76,6 +76,7 @@ export const system = (host) => {
|
|
|
76
76
|
]);
|
|
77
77
|
return exited.map((exit) => ({ ...exit, stderr, stdout }));
|
|
78
78
|
}),
|
|
79
|
+
screenRecord: () => oneShot(calls, { call: "screen_record" }, (reply) => reply.kind === "saved" ? reply.path : unexpected(reply)),
|
|
79
80
|
screenshot: () => oneShot(calls, { call: "screenshot" }, (reply) => keptOf(reply)),
|
|
80
81
|
selectKeymap: (choice) => oneShot(calls, { call: "select_keymap", keymap: wireKeymapChoice(choice) }, (reply) => (reply.kind === "set" ? "set" : unexpected(reply))),
|
|
81
82
|
setWindowStates: (appId, states) => oneShot(calls, {
|
package/dist/portal.d.ts
CHANGED
|
@@ -468,6 +468,19 @@ export declare const Captured: {
|
|
|
468
468
|
};
|
|
469
469
|
/** One source a running screen cast records. */
|
|
470
470
|
export type Captured = ReturnType<(typeof Captured)[keyof typeof Captured]>;
|
|
471
|
+
/** A {@link CapturingKind.Recording}: what it records, where, and for how long. */
|
|
472
|
+
export type RecordingBody = {
|
|
473
|
+
sources: readonly Captured[];
|
|
474
|
+
/** The absolute path of the WebM it records into. */
|
|
475
|
+
file: string;
|
|
476
|
+
/** How long it recorded until `runningSinceMs`, or until it paused. */
|
|
477
|
+
recordedMs: number;
|
|
478
|
+
/**
|
|
479
|
+
* When it last started or resumed, in milliseconds since the Unix epoch, as
|
|
480
|
+
* `Date.now()` counts. Undefined while it is paused.
|
|
481
|
+
*/
|
|
482
|
+
runningSinceMs: number | undefined;
|
|
483
|
+
};
|
|
471
484
|
/** IPP's `sides`. */
|
|
472
485
|
export declare enum Sides {
|
|
473
486
|
OneSided = 0,
|
|
@@ -729,32 +742,38 @@ export declare enum PortalAnswerKind {
|
|
|
729
742
|
ScreenCast = 5,
|
|
730
743
|
/** The user stopped a {@link Capturing} session. */
|
|
731
744
|
Stop = 6,
|
|
745
|
+
/** The user paused a {@link CapturingKind.Recording}. */
|
|
746
|
+
Pause = 7,
|
|
747
|
+
/** The user resumed a paused {@link CapturingKind.Recording}. */
|
|
748
|
+
Resume = 8,
|
|
749
|
+
/** The user stopped a {@link CapturingKind.Recording} and threw it away. */
|
|
750
|
+
Discard = 9,
|
|
732
751
|
/** The chords the user chose in a {@link PortalKind.GlobalShortcuts} review. */
|
|
733
|
-
GlobalShortcuts =
|
|
752
|
+
GlobalShortcuts = 10,
|
|
734
753
|
/** The name the user installs a {@link PortalKind.DynamicLauncher} under. */
|
|
735
|
-
DynamicLauncher =
|
|
754
|
+
DynamicLauncher = 11,
|
|
736
755
|
/** The printer and options the user chose in a {@link PortalKind.Print}. */
|
|
737
|
-
Print =
|
|
756
|
+
Print = 12,
|
|
738
757
|
/** The file a {@link PortalKind.Print} saves its PDF to, and its options. */
|
|
739
|
-
SaveToPdf =
|
|
758
|
+
SaveToPdf = 13,
|
|
740
759
|
/** The area of a {@link PortalKind.Screenshot} the user kept. */
|
|
741
|
-
Screenshot =
|
|
760
|
+
Screenshot = 14,
|
|
742
761
|
/**
|
|
743
762
|
* The window of a {@link PortalKind.Screenshot} the user picked, saved from
|
|
744
763
|
* its own last frame.
|
|
745
764
|
*/
|
|
746
|
-
ScreenshotWindow =
|
|
765
|
+
ScreenshotWindow = 15,
|
|
747
766
|
/**
|
|
748
767
|
* A browser window of a {@link PortalKind.Screenshot} the user picked, saved
|
|
749
768
|
* from the engine's capture of its page alone.
|
|
750
769
|
*/
|
|
751
|
-
ScreenshotBrowserWindow =
|
|
770
|
+
ScreenshotBrowserWindow = 16,
|
|
752
771
|
/** The pixel of a {@link PortalKind.PickColor} the user picked. */
|
|
753
|
-
PickColor =
|
|
772
|
+
PickColor = 17,
|
|
754
773
|
/** The user dismissed or denied the dialog. */
|
|
755
|
-
Canceled =
|
|
774
|
+
Canceled = 18,
|
|
756
775
|
/** The shell has no dialog for this kind. */
|
|
757
|
-
Refused =
|
|
776
|
+
Refused = 19
|
|
758
777
|
}
|
|
759
778
|
export declare const PortalAnswer: {
|
|
760
779
|
Access: () => {
|
|
@@ -768,6 +787,9 @@ export declare const PortalAnswer: {
|
|
|
768
787
|
Canceled: () => {
|
|
769
788
|
kind: PortalAnswerKind.Canceled;
|
|
770
789
|
};
|
|
790
|
+
Discard: () => {
|
|
791
|
+
kind: PortalAnswerKind.Discard;
|
|
792
|
+
};
|
|
771
793
|
/** Not empty; the request's own name unless `editableName`. */
|
|
772
794
|
DynamicLauncher: (name: string) => {
|
|
773
795
|
kind: PortalAnswerKind.DynamicLauncher;
|
|
@@ -784,6 +806,9 @@ export declare const PortalAnswer: {
|
|
|
784
806
|
InputCapture: () => {
|
|
785
807
|
kind: PortalAnswerKind.InputCapture;
|
|
786
808
|
};
|
|
809
|
+
Pause: () => {
|
|
810
|
+
kind: PortalAnswerKind.Pause;
|
|
811
|
+
};
|
|
787
812
|
/** A pixel inside the request's frame. */
|
|
788
813
|
PickColor: (at: {
|
|
789
814
|
x: number;
|
|
@@ -809,6 +834,9 @@ export declare const PortalAnswer: {
|
|
|
809
834
|
devices: Devices;
|
|
810
835
|
kind: PortalAnswerKind.RemoteDesktop;
|
|
811
836
|
};
|
|
837
|
+
Resume: () => {
|
|
838
|
+
kind: PortalAnswerKind.Resume;
|
|
839
|
+
};
|
|
812
840
|
/** An absolute `path`; `options` within the request's `pdf`. */
|
|
813
841
|
SaveToPdf: (path: string, options: PrintOptions) => {
|
|
814
842
|
kind: PortalAnswerKind.SaveToPdf;
|
|
@@ -861,8 +889,13 @@ export declare enum CapturingKind {
|
|
|
861
889
|
InputCapture = 1,
|
|
862
890
|
/** An application records windows, monitors or a region. */
|
|
863
891
|
ScreenCast = 2,
|
|
892
|
+
/**
|
|
893
|
+
* The shell's own screen recording, which `System.screenRecord` started.
|
|
894
|
+
* Paused, resumed and discarded as well as stopped.
|
|
895
|
+
*/
|
|
896
|
+
Recording = 3,
|
|
864
897
|
/** A kind this SDK cannot parse. It can still be stopped. */
|
|
865
|
-
Unknown =
|
|
898
|
+
Unknown = 4
|
|
866
899
|
}
|
|
867
900
|
/** What every capturing session carries. */
|
|
868
901
|
export type CapturingBase = {
|
|
@@ -880,6 +913,23 @@ export declare const Capturing: {
|
|
|
880
913
|
appId: string;
|
|
881
914
|
kind: CapturingKind.InputCapture;
|
|
882
915
|
};
|
|
916
|
+
Recording: (base: CapturingBase, body: RecordingBody) => {
|
|
917
|
+
sources: readonly Captured[];
|
|
918
|
+
/** The absolute path of the WebM it records into. */
|
|
919
|
+
file: string;
|
|
920
|
+
/** How long it recorded until `runningSinceMs`, or until it paused. */
|
|
921
|
+
recordedMs: number;
|
|
922
|
+
/**
|
|
923
|
+
* When it last started or resumed, in milliseconds since the Unix epoch, as
|
|
924
|
+
* `Date.now()` counts. Undefined while it is paused.
|
|
925
|
+
*/
|
|
926
|
+
runningSinceMs: number | undefined;
|
|
927
|
+
/** The id {@link stopCapturing} takes. */
|
|
928
|
+
id: number;
|
|
929
|
+
/** The application's desktop file id. Empty when unknown. */
|
|
930
|
+
appId: string;
|
|
931
|
+
kind: CapturingKind.Recording;
|
|
932
|
+
};
|
|
883
933
|
RemoteDesktop: (base: CapturingBase, body: RemoteDesktopBody) => {
|
|
884
934
|
devices: Devices;
|
|
885
935
|
clipboard: boolean;
|
|
@@ -909,3 +959,19 @@ export declare const Capturing: {
|
|
|
909
959
|
};
|
|
910
960
|
};
|
|
911
961
|
export type Capturing = ReturnType<(typeof Capturing)[keyof typeof Capturing]>;
|
|
962
|
+
/** Element Capture's `RestrictionTarget`, which TypeScript's DOM lacks. */
|
|
963
|
+
type RestrictionTargets = {
|
|
964
|
+
fromElement: (element: Element) => Promise<unknown>;
|
|
965
|
+
};
|
|
966
|
+
/**
|
|
967
|
+
* Leave `element` out of every capture of the desk: screen recordings, screen
|
|
968
|
+
* casts and screenshots. It still shows on screen. For the shell's page only;
|
|
969
|
+
* see `docs/PORTALS.md#screen-recording`.
|
|
970
|
+
*
|
|
971
|
+
* The element must be a stacking context and its own group, such as with
|
|
972
|
+
* `isolation: isolate`, or Element Capture ignores it. `targets` is
|
|
973
|
+
* `RestrictionTarget`, absent in an engine without Element Capture, where this
|
|
974
|
+
* does nothing.
|
|
975
|
+
*/
|
|
976
|
+
export declare const hideFromCaptures: (element: Element, targets?: RestrictionTargets | undefined) => Promise<void>;
|
|
977
|
+
export {};
|
package/dist/portal.js
CHANGED
|
@@ -272,32 +272,38 @@ export var PortalAnswerKind;
|
|
|
272
272
|
PortalAnswerKind[PortalAnswerKind["ScreenCast"] = 5] = "ScreenCast";
|
|
273
273
|
/** The user stopped a {@link Capturing} session. */
|
|
274
274
|
PortalAnswerKind[PortalAnswerKind["Stop"] = 6] = "Stop";
|
|
275
|
+
/** The user paused a {@link CapturingKind.Recording}. */
|
|
276
|
+
PortalAnswerKind[PortalAnswerKind["Pause"] = 7] = "Pause";
|
|
277
|
+
/** The user resumed a paused {@link CapturingKind.Recording}. */
|
|
278
|
+
PortalAnswerKind[PortalAnswerKind["Resume"] = 8] = "Resume";
|
|
279
|
+
/** The user stopped a {@link CapturingKind.Recording} and threw it away. */
|
|
280
|
+
PortalAnswerKind[PortalAnswerKind["Discard"] = 9] = "Discard";
|
|
275
281
|
/** The chords the user chose in a {@link PortalKind.GlobalShortcuts} review. */
|
|
276
|
-
PortalAnswerKind[PortalAnswerKind["GlobalShortcuts"] =
|
|
282
|
+
PortalAnswerKind[PortalAnswerKind["GlobalShortcuts"] = 10] = "GlobalShortcuts";
|
|
277
283
|
/** The name the user installs a {@link PortalKind.DynamicLauncher} under. */
|
|
278
|
-
PortalAnswerKind[PortalAnswerKind["DynamicLauncher"] =
|
|
284
|
+
PortalAnswerKind[PortalAnswerKind["DynamicLauncher"] = 11] = "DynamicLauncher";
|
|
279
285
|
/** The printer and options the user chose in a {@link PortalKind.Print}. */
|
|
280
|
-
PortalAnswerKind[PortalAnswerKind["Print"] =
|
|
286
|
+
PortalAnswerKind[PortalAnswerKind["Print"] = 12] = "Print";
|
|
281
287
|
/** The file a {@link PortalKind.Print} saves its PDF to, and its options. */
|
|
282
|
-
PortalAnswerKind[PortalAnswerKind["SaveToPdf"] =
|
|
288
|
+
PortalAnswerKind[PortalAnswerKind["SaveToPdf"] = 13] = "SaveToPdf";
|
|
283
289
|
/** The area of a {@link PortalKind.Screenshot} the user kept. */
|
|
284
|
-
PortalAnswerKind[PortalAnswerKind["Screenshot"] =
|
|
290
|
+
PortalAnswerKind[PortalAnswerKind["Screenshot"] = 14] = "Screenshot";
|
|
285
291
|
/**
|
|
286
292
|
* The window of a {@link PortalKind.Screenshot} the user picked, saved from
|
|
287
293
|
* its own last frame.
|
|
288
294
|
*/
|
|
289
|
-
PortalAnswerKind[PortalAnswerKind["ScreenshotWindow"] =
|
|
295
|
+
PortalAnswerKind[PortalAnswerKind["ScreenshotWindow"] = 15] = "ScreenshotWindow";
|
|
290
296
|
/**
|
|
291
297
|
* A browser window of a {@link PortalKind.Screenshot} the user picked, saved
|
|
292
298
|
* from the engine's capture of its page alone.
|
|
293
299
|
*/
|
|
294
|
-
PortalAnswerKind[PortalAnswerKind["ScreenshotBrowserWindow"] =
|
|
300
|
+
PortalAnswerKind[PortalAnswerKind["ScreenshotBrowserWindow"] = 16] = "ScreenshotBrowserWindow";
|
|
295
301
|
/** The pixel of a {@link PortalKind.PickColor} the user picked. */
|
|
296
|
-
PortalAnswerKind[PortalAnswerKind["PickColor"] =
|
|
302
|
+
PortalAnswerKind[PortalAnswerKind["PickColor"] = 17] = "PickColor";
|
|
297
303
|
/** The user dismissed or denied the dialog. */
|
|
298
|
-
PortalAnswerKind[PortalAnswerKind["Canceled"] =
|
|
304
|
+
PortalAnswerKind[PortalAnswerKind["Canceled"] = 18] = "Canceled";
|
|
299
305
|
/** The shell has no dialog for this kind. */
|
|
300
|
-
PortalAnswerKind[PortalAnswerKind["Refused"] =
|
|
306
|
+
PortalAnswerKind[PortalAnswerKind["Refused"] = 19] = "Refused";
|
|
301
307
|
})(PortalAnswerKind || (PortalAnswerKind = {}));
|
|
302
308
|
export const PortalAnswer = {
|
|
303
309
|
Access: () => ({ kind: PortalAnswerKind.Access }),
|
|
@@ -307,6 +313,7 @@ export const PortalAnswer = {
|
|
|
307
313
|
kind: PortalAnswerKind.AppChooser,
|
|
308
314
|
}),
|
|
309
315
|
Canceled: () => ({ kind: PortalAnswerKind.Canceled }),
|
|
316
|
+
Discard: () => ({ kind: PortalAnswerKind.Discard }),
|
|
310
317
|
/** Not empty; the request's own name unless `editableName`. */
|
|
311
318
|
DynamicLauncher: (name) => ({
|
|
312
319
|
kind: PortalAnswerKind.DynamicLauncher,
|
|
@@ -321,6 +328,7 @@ export const PortalAnswer = {
|
|
|
321
328
|
triggers,
|
|
322
329
|
}),
|
|
323
330
|
InputCapture: () => ({ kind: PortalAnswerKind.InputCapture }),
|
|
331
|
+
Pause: () => ({ kind: PortalAnswerKind.Pause }),
|
|
324
332
|
/** A pixel inside the request's frame. */
|
|
325
333
|
PickColor: (at) => ({
|
|
326
334
|
at,
|
|
@@ -338,6 +346,7 @@ export const PortalAnswer = {
|
|
|
338
346
|
devices,
|
|
339
347
|
kind: PortalAnswerKind.RemoteDesktop,
|
|
340
348
|
}),
|
|
349
|
+
Resume: () => ({ kind: PortalAnswerKind.Resume }),
|
|
341
350
|
/** An absolute `path`; `options` within the request's `pdf`. */
|
|
342
351
|
SaveToPdf: (path, options) => ({
|
|
343
352
|
kind: PortalAnswerKind.SaveToPdf,
|
|
@@ -388,8 +397,13 @@ export var CapturingKind;
|
|
|
388
397
|
CapturingKind[CapturingKind["InputCapture"] = 1] = "InputCapture";
|
|
389
398
|
/** An application records windows, monitors or a region. */
|
|
390
399
|
CapturingKind[CapturingKind["ScreenCast"] = 2] = "ScreenCast";
|
|
400
|
+
/**
|
|
401
|
+
* The shell's own screen recording, which `System.screenRecord` started.
|
|
402
|
+
* Paused, resumed and discarded as well as stopped.
|
|
403
|
+
*/
|
|
404
|
+
CapturingKind[CapturingKind["Recording"] = 3] = "Recording";
|
|
391
405
|
/** A kind this SDK cannot parse. It can still be stopped. */
|
|
392
|
-
CapturingKind[CapturingKind["Unknown"] =
|
|
406
|
+
CapturingKind[CapturingKind["Unknown"] = 4] = "Unknown";
|
|
393
407
|
})(CapturingKind || (CapturingKind = {}));
|
|
394
408
|
export const Capturing = {
|
|
395
409
|
InputCapture: (base, body) => ({
|
|
@@ -397,6 +411,11 @@ export const Capturing = {
|
|
|
397
411
|
...body,
|
|
398
412
|
kind: CapturingKind.InputCapture,
|
|
399
413
|
}),
|
|
414
|
+
Recording: (base, body) => ({
|
|
415
|
+
...base,
|
|
416
|
+
...body,
|
|
417
|
+
kind: CapturingKind.Recording,
|
|
418
|
+
}),
|
|
400
419
|
RemoteDesktop: (base, body) => ({
|
|
401
420
|
...base,
|
|
402
421
|
...body,
|
|
@@ -413,3 +432,16 @@ export const Capturing = {
|
|
|
413
432
|
wireKind,
|
|
414
433
|
}),
|
|
415
434
|
};
|
|
435
|
+
/**
|
|
436
|
+
* Leave `element` out of every capture of the desk: screen recordings, screen
|
|
437
|
+
* casts and screenshots. It still shows on screen. For the shell's page only;
|
|
438
|
+
* see `docs/PORTALS.md#screen-recording`.
|
|
439
|
+
*
|
|
440
|
+
* The element must be a stacking context and its own group, such as with
|
|
441
|
+
* `isolation: isolate`, or Element Capture ignores it. `targets` is
|
|
442
|
+
* `RestrictionTarget`, absent in an engine without Element Capture, where this
|
|
443
|
+
* does nothing.
|
|
444
|
+
*/
|
|
445
|
+
export const hideFromCaptures = async (element, targets = globalThis.RestrictionTarget) => {
|
|
446
|
+
await targets?.fromElement(element);
|
|
447
|
+
};
|
package/package.json
CHANGED