@swipt/api 0.1.0-nightly.9 → 0.1.0-nightly.90

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/input.d.ts CHANGED
@@ -2,21 +2,53 @@ import type { CallOptions, Point } from "./index";
2
2
 
3
3
  export interface TapOptions extends CallOptions {
4
4
  readonly count?: number;
5
- readonly holdMs?: number;
6
5
  }
7
6
 
8
- export type KeyboardKey = "return" | "backspace" | "forwardDelete" | "tab" | "escape" | "space" | "left" | "right" | "up" | "down"
9
- | "home" | "end" | "pageUp" | "pageDown" | `f${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`;
7
+ export type KeyboardKey =
8
+ | "return"
9
+ | "backspace"
10
+ | "forwardDelete"
11
+ | "tab"
12
+ | "escape"
13
+ | "space"
14
+ | "left"
15
+ | "right"
16
+ | "up"
17
+ | "down"
18
+ | "home"
19
+ | "end"
20
+ | "pageUp"
21
+ | "pageDown"
22
+ | `f${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`;
10
23
  export type KeyboardModifier = "cmd" | "shift" | "ctrl" | "alt";
11
- export type KeyCombination = KeyboardKey | `${KeyboardModifier}+${KeyboardKey}` | (string & {});
24
+ export type KeyCombination =
25
+ KeyboardKey | `${KeyboardModifier}+${KeyboardKey}` | (string & {});
12
26
  export type TouchSample = [x: number, y: number, ms: number];
13
27
 
14
28
  export declare function tap(point: Point, options?: TapOptions): Promise<void>;
15
- export declare function swipe(from: Point, to: Point, options?: CallOptions & { durationMs?: number }): Promise<void>;
16
- export declare function drag(from: Point, to: Point, options?: CallOptions & { durationMs?: number; pressMs?: number }): Promise<void>;
17
- export declare function pinch(center: Point, scale: number, options?: CallOptions & { durationMs?: number }): Promise<void>;
18
- export declare function touch(fingers: readonly (readonly TouchSample[])[], options?: CallOptions): Promise<void>;
19
- export declare function pressKey(combination: KeyCombination, options?: CallOptions): Promise<void>;
29
+ export declare function swipe(
30
+ from: Point,
31
+ to: Point,
32
+ options?: CallOptions & { durationMs?: number },
33
+ ): Promise<void>;
34
+ export declare function drag(
35
+ from: Point,
36
+ to: Point,
37
+ options?: CallOptions & { durationMs?: number; pressMs?: number },
38
+ ): Promise<void>;
39
+ export declare function pinch(
40
+ center: Point,
41
+ scale: number,
42
+ options?: CallOptions & { durationMs?: number },
43
+ ): Promise<void>;
44
+ export declare function touch(
45
+ fingers: readonly (readonly TouchSample[])[],
46
+ options?: CallOptions,
47
+ ): Promise<void>;
48
+ export declare function pressKey(
49
+ combination: KeyCombination,
50
+ options?: CallOptions,
51
+ ): Promise<void>;
20
52
  export declare function pressHome(options?: CallOptions): Promise<void>;
21
53
  export declare function openAppSwitcher(options?: CallOptions): Promise<void>;
22
54
  export declare function pressPower(options?: CallOptions): Promise<void>;
package/input.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  const outside = () => {
2
- throw new Error("@swipt/api/input runs inside Swipt; build the swiplet with `swiplet build`");
2
+ throw new Error(
3
+ "@swipt/api/input runs inside Swipt; build the swiplet with `swipt project build`",
4
+ );
3
5
  };
4
6
 
5
7
  export const tap = outside;
@@ -0,0 +1,3 @@
1
+ export declare function preferredLocalizations(
2
+ localizations: readonly string[],
3
+ ): string[];
@@ -0,0 +1,7 @@
1
+ const outside = () => {
2
+ throw new Error(
3
+ "@swipt/api/localization runs inside Swipt; build the swiplet with `swipt project build`",
4
+ );
5
+ };
6
+
7
+ export const preferredLocalizations = outside;
package/maps.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { Placemark } from "./app-intents";
2
+
3
+ export declare function searchPlaces(
4
+ query: string,
5
+ options?: { signal?: AbortSignal },
6
+ ): Promise<(Placemark & Required<Pick<Placemark, "coordinate">>)[]>;
package/maps.mjs ADDED
@@ -0,0 +1,7 @@
1
+ const outside = () => {
2
+ throw new Error(
3
+ "@swipt/api/maps runs inside Swipt; build the swiplet with `swipt project build`",
4
+ );
5
+ };
6
+
7
+ export const searchPlaces = outside;
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@swipt/api",
3
- "version": "0.1.0-nightly.9",
3
+ "version": "0.1.0-nightly.90",
4
+ "apiLevel": 3,
5
+ "oldestAPILevel": 2,
6
+ "minimumIOSVersion": 17.4,
4
7
  "license": "GPL-3.0-or-later",
5
8
  "repository": {
6
9
  "type": "git",
@@ -33,6 +36,10 @@
33
36
  "types": "./device.d.ts",
34
37
  "default": "./device.mjs"
35
38
  },
39
+ "./process": {
40
+ "types": "./process.d.ts",
41
+ "default": "./process.mjs"
42
+ },
36
43
  "./screen": {
37
44
  "types": "./screen.d.ts",
38
45
  "default": "./screen.mjs"
@@ -41,6 +48,26 @@
41
48
  "types": "./image.d.ts",
42
49
  "default": "./image.mjs"
43
50
  },
51
+ "./app-intents": {
52
+ "types": "./app-intents.d.ts",
53
+ "default": "./app-intents.mjs"
54
+ },
55
+ "./localization": {
56
+ "types": "./localization.d.ts",
57
+ "default": "./localization.mjs"
58
+ },
59
+ "./maps": {
60
+ "types": "./maps.d.ts",
61
+ "default": "./maps.mjs"
62
+ },
63
+ "./http": {
64
+ "types": "./http.d.ts",
65
+ "default": "./http.mjs"
66
+ },
67
+ "./swift-ui": {
68
+ "types": "./swift-ui.d.ts",
69
+ "default": "./swift-ui.mjs"
70
+ },
44
71
  "./package.json": "./package.json"
45
72
  },
46
73
  "files": [
@@ -54,12 +81,15 @@
54
81
  "@standard-schema/spec": "^1.1.0"
55
82
  },
56
83
  "peerDependencies": {
57
- "@expo/ui": "~58.0.25",
84
+ "@expo/ui": "~58.0.26",
58
85
  "@types/react": "~19.3.0",
59
- "expo": "~58.0.21",
86
+ "expo": "~58.0.22",
60
87
  "expo-localization": "~58.0.5",
88
+ "expo-maps": "~58.0.11",
89
+ "expo-sqlite": "~58.0.15",
61
90
  "react": "19.3.0",
62
- "react-native": "0.88.1"
91
+ "react-native": "0.88.1",
92
+ "react-native-worklets": "0.13.0"
63
93
  },
64
94
  "peerDependenciesMeta": {
65
95
  "@expo/ui": {
@@ -74,11 +104,20 @@
74
104
  "expo-localization": {
75
105
  "optional": true
76
106
  },
107
+ "expo-maps": {
108
+ "optional": true
109
+ },
110
+ "expo-sqlite": {
111
+ "optional": true
112
+ },
77
113
  "react": {
78
114
  "optional": true
79
115
  },
80
116
  "react-native": {
81
117
  "optional": true
118
+ },
119
+ "react-native-worklets": {
120
+ "optional": true
82
121
  }
83
122
  }
84
123
  }
package/process.d.ts ADDED
@@ -0,0 +1,190 @@
1
+ /** @available apiLevel 3 */
2
+ import type { CallOptions } from "./index";
3
+
4
+ export interface Process {
5
+ readonly pid: number;
6
+ readonly executablePath?: string;
7
+ readonly bundleId?: string;
8
+ }
9
+
10
+ export interface ProcessAttributes {
11
+ readonly procFlags: number;
12
+ readonly procStatus: number;
13
+ readonly procXstatus: number;
14
+ readonly pid: number;
15
+ readonly ppid: number;
16
+ readonly uid: number;
17
+ readonly gid: number;
18
+ readonly ruid: number;
19
+ readonly rgid: number;
20
+ readonly svuid: number;
21
+ readonly svgid: number;
22
+ readonly comm: string;
23
+ readonly name: string;
24
+ readonly nfiles: number;
25
+ readonly pgid: number;
26
+ readonly pjobc: number;
27
+ readonly tdev: number;
28
+ readonly tpgid: number;
29
+ readonly nice: number;
30
+ readonly memVirtualSize: number;
31
+ readonly memResidentSize: number;
32
+ readonly cpuTotalUser: number;
33
+ readonly cpuTotalSystem: number;
34
+ readonly threadsUser: number;
35
+ readonly threadsSystem: number;
36
+ readonly policy: number;
37
+ readonly faults: number;
38
+ readonly vmPageIns: number;
39
+ readonly cowFaults: number;
40
+ readonly msgSent: number;
41
+ readonly msgRecv: number;
42
+ readonly sysCallsMach: number;
43
+ readonly sysCallsUnix: number;
44
+ readonly ctxSwitch: number;
45
+ readonly threadCount: number;
46
+ readonly numRunning: number;
47
+ readonly priority: number;
48
+ readonly wqNumThreads: number;
49
+ readonly wqRunThreads: number;
50
+ readonly wqBlockedThreads: number;
51
+ readonly wqState: number;
52
+ readonly intWakeups: number;
53
+ readonly platIdleWakeups: number;
54
+ readonly timerWakeBin1: number;
55
+ readonly timerWakeBin2: number;
56
+ readonly machPortCount: number;
57
+ /** Absent without a usable CPU-time baseline. */
58
+ readonly cpuUsage?: number;
59
+ /** Absent without a usable CPU-time baseline. */
60
+ readonly powerScore?: number;
61
+ readonly memRPrvt: number;
62
+ readonly memRShrd: number;
63
+ readonly responsiblePID: number;
64
+ readonly appSleep: boolean;
65
+ readonly latencyQosTier: number;
66
+ readonly throughputQosTier: number;
67
+ readonly memPurgeable: number;
68
+ readonly totalEnergyScore: number;
69
+ readonly procAge: number;
70
+ readonly avgPowerScore: number;
71
+ readonly startAbsTime: number;
72
+ readonly wiredSize: number;
73
+ readonly physFootprint: number;
74
+ readonly memAnon: number;
75
+ readonly memAnonPeak: number;
76
+ readonly uniqueID: number;
77
+ readonly parentUniqueID: number;
78
+ readonly responsibleUniqueID: number;
79
+ readonly diskBytesRead: number;
80
+ readonly diskBytesWritten: number;
81
+ readonly memCompressed: number;
82
+ readonly coalitionID: number;
83
+ readonly __arch: number;
84
+ readonly __restricted: boolean;
85
+ readonly __sandbox: boolean;
86
+ readonly __suddenTerm: boolean;
87
+ }
88
+
89
+ export interface SystemAttributes {
90
+ readonly vmFreeCount: number;
91
+ readonly vmActiveCount: number;
92
+ readonly vmInactiveCount: number;
93
+ readonly vmWireCount: number;
94
+ readonly vmZeroFillCount: number;
95
+ readonly vmReactivations: number;
96
+ readonly vmPageIns: number;
97
+ readonly vmPageOuts: number;
98
+ readonly vmFaults: number;
99
+ readonly vmCowFaults: number;
100
+ readonly vmLookups: number;
101
+ readonly vmHits: number;
102
+ readonly vmPurges: number;
103
+ readonly vmPurgeableCount: number;
104
+ readonly vmSpeculativeCount: number;
105
+ readonly vmDecompressions: number;
106
+ readonly vmCompressions: number;
107
+ readonly vmSwapIns: number;
108
+ readonly vmSwapOuts: number;
109
+ readonly vmCompressorPageCount: number;
110
+ readonly vmThrottledCount: number;
111
+ readonly threadCount: number;
112
+ readonly diskReadOps: number;
113
+ readonly diskWriteOps: number;
114
+ readonly diskBytesRead: number;
115
+ readonly diskBytesWritten: number;
116
+ readonly netPacketsIn: number;
117
+ readonly netBytesIn: number;
118
+ readonly netPacketsOut: number;
119
+ readonly netBytesOut: number;
120
+ readonly vmExtPageCount: number;
121
+ readonly vmIntPageCount: number;
122
+ readonly vmTotalUncompPagesInComp: number;
123
+ readonly physMemSize: number;
124
+ readonly vmSize: number;
125
+ readonly vmUsedCount: number;
126
+ readonly __vmSwapUsage: number;
127
+ }
128
+
129
+ export interface ResourceUsage<
130
+ ProcessAttribute extends keyof ProcessAttributes = never,
131
+ SystemAttribute extends keyof SystemAttributes = never,
132
+ > {
133
+ readonly time: number;
134
+ readonly pageSize: number;
135
+ /** Empty in the first sample. */
136
+ readonly cpuLoadPerCore: readonly number[];
137
+ readonly system: Pick<SystemAttributes, SystemAttribute>;
138
+ readonly processes: readonly (Process &
139
+ Pick<ProcessAttributes, ProcessAttribute>)[];
140
+ }
141
+
142
+ export type Signal =
143
+ | "SIGHUP"
144
+ | "SIGINT"
145
+ | "SIGQUIT"
146
+ | "SIGILL"
147
+ | "SIGTRAP"
148
+ | "SIGABRT"
149
+ | "SIGEMT"
150
+ | "SIGFPE"
151
+ | "SIGKILL"
152
+ | "SIGBUS"
153
+ | "SIGSEGV"
154
+ | "SIGSYS"
155
+ | "SIGPIPE"
156
+ | "SIGALRM"
157
+ | "SIGTERM"
158
+ | "SIGURG"
159
+ | "SIGSTOP"
160
+ | "SIGTSTP"
161
+ | "SIGCONT"
162
+ | "SIGCHLD"
163
+ | "SIGTTIN"
164
+ | "SIGTTOU"
165
+ | "SIGIO"
166
+ | "SIGXCPU"
167
+ | "SIGXFSZ"
168
+ | "SIGVTALRM"
169
+ | "SIGPROF"
170
+ | "SIGWINCH"
171
+ | "SIGINFO"
172
+ | "SIGUSR1"
173
+ | "SIGUSR2";
174
+
175
+ export declare function list(options?: CallOptions): Promise<Process[]>;
176
+ export declare function resourceUsage<
177
+ ProcessAttribute extends keyof ProcessAttributes = never,
178
+ SystemAttribute extends keyof SystemAttributes = never,
179
+ >(
180
+ options?: CallOptions & {
181
+ readonly intervalMs?: number;
182
+ readonly processAttributes?: readonly ProcessAttribute[];
183
+ readonly systemAttributes?: readonly SystemAttribute[];
184
+ },
185
+ ): AsyncIterable<ResourceUsage<ProcessAttribute, SystemAttribute>>;
186
+ export declare function kill(
187
+ pid: number,
188
+ signal?: Signal | number,
189
+ options?: CallOptions,
190
+ ): Promise<void>;
package/process.mjs ADDED
@@ -0,0 +1,9 @@
1
+ const outside = () => {
2
+ throw new Error(
3
+ "@swipt/api/process runs inside Swipt; build the swiplet with `swipt project build`",
4
+ );
5
+ };
6
+
7
+ export const list = outside;
8
+ export const resourceUsage = outside;
9
+ export const kill = outside;
package/repl.d.ts CHANGED
@@ -2,9 +2,12 @@ declare global {
2
2
  const accessibility: typeof import("@swipt/api/accessibility");
3
3
  const input: typeof import("@swipt/api/input");
4
4
  const device: typeof import("@swipt/api/device");
5
- const screen: typeof import("@swipt/api/screen");
5
+ var screen: Screen;
6
+ interface Screen extends Readonly<typeof import("@swipt/api/screen")> {}
6
7
  const image: typeof import("@swipt/api/image");
7
- const dialog: import("@swipt/api/swiplet").IntentDialog;
8
+ const dataDirectory: import("@swipt/api/file-system").DirectoryHandle;
9
+ const appIntents: typeof import("@swipt/api/app-intents");
10
+ const args: readonly string[];
8
11
 
9
12
  function show(image: import("@swipt/api/image").RasterImage): void;
10
13
  }
package/screen.d.ts CHANGED
@@ -1,63 +1,37 @@
1
- import type { CallOptions, ObservableState, Rect } from "./index";
2
- import type { FileHandle } from "./file-system";
3
- import type { ImageDifference, RasterImage } from "./image";
1
+ import type { CallOptions, ObservableState } from "./index";
2
+ import type { DirectoryHandle, FileHandle } from "./file-system";
3
+ import type { RasterImage } from "./image";
4
4
 
5
- export interface WaitOptions extends CallOptions {
6
- readonly region?: Rect;
7
- readonly timeoutMs?: number;
8
- readonly threshold?: number;
9
- }
5
+ export type ScreenStreamOptions = CallOptions &
6
+ (
7
+ | { readonly mode?: "remoteDesktop"; readonly maximumBitrate?: number }
8
+ | { readonly mode: "coreDevice" }
9
+ );
10
10
 
11
- export interface ScreenChange {
12
- readonly time: number;
13
- readonly end: number;
14
- readonly frames: readonly Rect[];
15
- readonly app: string | null;
16
- readonly before: RasterImage;
17
- readonly after: RasterImage;
11
+ export interface RecordingSession {
12
+ stop(options?: CallOptions): Promise<void>;
18
13
  }
19
14
 
20
- export type TimelineEvent =
21
- | { readonly time: number; readonly type: "operation"; readonly name: string; readonly arguments?: readonly unknown[]; readonly durationMs?: number; readonly error?: string }
22
- | { readonly time: number; readonly type: "action"; readonly swiplet: string; readonly action: string; readonly caller: "app" | "shortcuts" | "api" }
23
- | { readonly time: number; readonly type: "foreground"; readonly app: string }
24
- | { readonly time: number; readonly type: "log"; readonly swiplet: string; readonly level: "error" | "warn" | "info" | "debug"; readonly message: string };
15
+ export interface ScreenStream {
16
+ readonly frames: ObservableState<RasterImage>;
17
+ record(
18
+ directory: DirectoryHandle,
19
+ options?: CallOptions,
20
+ ): Promise<RecordingSession>;
21
+ close(options?: CallOptions): Promise<void>;
22
+ }
25
23
 
26
24
  export interface ScreenRecording {
27
- readonly file: FileHandle;
28
- readonly start: number | null;
25
+ readonly start: number;
29
26
  readonly duration: number;
30
- readonly width: number;
31
- readonly height: number;
32
- readonly scale: number;
33
- readonly changes: readonly ScreenChange[];
34
- readonly events: readonly TimelineEvent[];
35
-
36
27
  frame(time: number): RasterImage;
37
- frames(times: readonly number[] | { readonly everyMs: number; readonly from?: number; readonly to?: number }): RasterImage[];
38
- grid(options?: CallOptions & { readonly times?: readonly number[]; readonly columns?: number; readonly width?: number }): Promise<RasterImage>;
39
- diff(from: number, to: number, options?: CallOptions & { readonly threshold?: number }): Promise<ImageDifference>;
40
- export(options?: CallOptions & {
41
- readonly file?: FileHandle | string;
42
- readonly from?: number;
43
- readonly to?: number;
44
- readonly region?: Rect;
45
- readonly scale?: number;
46
- readonly format?: "mov" | "mp4" | "gif";
47
- readonly frameRate?: number;
48
- }): Promise<FileHandle>;
49
- }
50
-
51
- export interface RecordingSession {
52
- readonly file: FileHandle;
53
- readonly start: number;
54
- stop(options?: CallOptions): Promise<ScreenRecording>;
28
+ export(file: FileHandle, options?: CallOptions): Promise<void>;
55
29
  }
56
30
 
57
- export declare function screenshot(options?: CallOptions): Promise<RasterImage>;
58
- export declare const frames: ObservableState<RasterImage>;
59
- export declare function waitFor(predicate: (frame: RasterImage) => boolean | Promise<boolean>, options?: CallOptions & { readonly timeoutMs?: number }): Promise<RasterImage>;
60
- export declare function waitForChange(options?: WaitOptions & { readonly from?: RasterImage }): Promise<RasterImage>;
61
- export declare function waitForStable(options?: WaitOptions & { readonly durationMs?: number }): Promise<RasterImage>;
62
- export declare function record(options?: CallOptions & { readonly file?: FileHandle | string }): Promise<RecordingSession>;
63
- export declare function openRecording(file: FileHandle | string, options?: CallOptions): Promise<ScreenRecording>;
31
+ export declare function open(
32
+ options?: ScreenStreamOptions,
33
+ ): Promise<ScreenStream>;
34
+ export declare function openRecording(
35
+ directory: DirectoryHandle,
36
+ options?: CallOptions,
37
+ ): Promise<ScreenRecording>;
package/screen.mjs CHANGED
@@ -1,11 +1,8 @@
1
1
  const outside = () => {
2
- throw new Error("@swipt/api/screen runs inside Swipt; build the swiplet with `swiplet build`");
2
+ throw new Error(
3
+ "@swipt/api/screen runs inside Swipt; build the swiplet with `swipt project build`",
4
+ );
3
5
  };
4
6
 
5
- export const screenshot = outside;
6
- export const frames = undefined;
7
- export const waitFor = outside;
8
- export const waitForChange = outside;
9
- export const waitForStable = outside;
10
- export const record = outside;
7
+ export const open = outside;
11
8
  export const openRecording = outside;