@sdeck/plugin-system 0.0.0-stage → 0.3.0

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.
@@ -0,0 +1,36 @@
1
+ import { type Accelerator } from "@sdeck/schema";
2
+ export type MediaKey = "play-pause" | "next" | "previous" | "stop" | "mute" | "volume-up" | "volume-down";
3
+ export interface SystemControls {
4
+ media(key: MediaKey): Promise<void>;
5
+ /** Presses a shortcut: modifiers down, the key, everything up. */
6
+ hotkey(accelerator: Accelerator): Promise<void>;
7
+ type(text: string): Promise<void>;
8
+ lock(): Promise<void>;
9
+ sleep(): Promise<void>;
10
+ /** Saves the whole screen to `file` (a PNG). */
11
+ screenshot(file: string): Promise<void>;
12
+ /** Opens the system's own region picker. */
13
+ snip(): Promise<void>;
14
+ }
15
+ export interface KeyEvent {
16
+ /** Virtual-key code (0 for typed characters). */
17
+ vk: number;
18
+ /** UTF-16 code unit of a typed character. */
19
+ scan: number;
20
+ flags: number;
21
+ }
22
+ /** Down and up events for a shortcut. */
23
+ export declare function hotkeyEvents(accelerator: Accelerator): KeyEvent[];
24
+ /** Events typing `text`, whatever the keyboard layout. Newlines press Enter. */
25
+ export declare function textEvents(text: string): KeyEvent[];
26
+ /** `sizeof(INPUT)` on 64-bit Windows. */
27
+ export declare const INPUT_SIZE = 40;
28
+ /** `INPUT[]` for `SendInput`: type 1 (keyboard) and a `KEYBDINPUT` at offset 8. */
29
+ export declare function encodeInputs(events: readonly KeyEvent[]): Uint8Array;
30
+ /** The AppleScript pressing a shortcut. */
31
+ export declare function macHotkey(accelerator: Accelerator): string;
32
+ /** The `xdotool key` argument of a shortcut. */
33
+ export declare function xHotkey(accelerator: Accelerator): string;
34
+ /** The controls of this computer, loaded on first use. */
35
+ export declare function systemControls(): Promise<SystemControls>;
36
+ //# sourceMappingURL=controls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.ts"],"names":[],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gDAAgD;AAChD,wBAAgB,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAIxD;AAoBD,0DAA0D;AAC1D,wBAAgB,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CAMxD"}
@@ -0,0 +1,22 @@
1
+ export * from "./controls.ts";
2
+ export * from "./monitor.ts";
3
+ export * from "./watchers.ts";
4
+ /** Opens a URL, file, folder or app with the system's default handler. */
5
+ export declare function openWithSystem(target: string): void;
6
+ export interface ShellResult {
7
+ /** Exit code (`-1` if it could not start or was killed). */
8
+ code: number;
9
+ /** Standard output, trimmed and capped at 64 KB. */
10
+ output: string;
11
+ }
12
+ /** Runs a shell command; resolves with its exit code and output. Aborting kills it. */
13
+ export declare function runShell(command: string, cwd?: string, signal?: AbortSignal): Promise<ShellResult>;
14
+ /** CPU use since the previous call, 0–100. */
15
+ export declare function cpuSampler(): () => number;
16
+ /** Names of the running processes (`javaw.exe`, `firefox`), lowercased and de-duplicated. */
17
+ export declare function listProcesses(): Promise<string[]>;
18
+ /** `screenshot-20261130-142501.png`. */
19
+ export declare function screenshotName(at: Date): string;
20
+ declare const _default: import("@sdeck/plugin").PluginDef;
21
+ export default _default;
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AA0CA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAE9B,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAenD;AAED,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;CAChB;AAID,uFAAuF;AACvF,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,WAAW,CAAC,CAkBtB;AAmFD,8CAA8C;AAC9C,wBAAgB,UAAU,IAAI,MAAM,MAAM,CAmBzC;AAED,6FAA6F;AAC7F,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBjD;AA8QD,wCAAwC;AACxC,wBAAgB,cAAc,CAAC,EAAE,EAAE,IAAI,GAAG,MAAM,CAK/C"}