gestament 0.5.0 → 0.7.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.
- package/dist/displaySession.d.ts +2 -2
- package/dist/displaySession.d.ts.map +1 -1
- package/dist/element.d.ts +2 -2
- package/dist/element.d.ts.map +1 -1
- package/dist/errors.d.ts +2 -2
- package/dist/generated/packageMetadata.d.ts +4 -4
- package/dist/gestament-config.d.ts +2 -2
- package/dist/gestament-launcher-driver.cjs +46 -1
- package/dist/gestament-launcher-driver.cjs.map +1 -1
- package/dist/gestament-launcher-driver.d.ts +2 -2
- package/dist/gestament-launcher-driver.mjs +46 -1
- package/dist/gestament-launcher-driver.mjs.map +1 -1
- package/dist/gestament-tray-host.cjs +1 -1
- package/dist/gestament-tray-host.d.ts +2 -2
- package/dist/gestament-tray-host.mjs +1 -1
- package/dist/gestament-xvfb-pool-probe.cjs +1 -1
- package/dist/gestament-xvfb-pool-probe.d.ts +2 -2
- package/dist/gestament-xvfb-pool-probe.mjs +1 -1
- package/dist/gestament-xvfb-worker.d.ts +2 -2
- package/dist/gestament-xvfb.d.ts +2 -2
- package/dist/gestament.cjs +1 -1
- package/dist/gestament.d.ts +2 -2
- package/dist/gestament.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/input.d.ts +21 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/{launchGtkApp-EI6OIpPI.js → launchGtkApp-BTBwPwyj.js} +216 -2
- package/dist/launchGtkApp-BTBwPwyj.js.map +1 -0
- package/dist/{launchGtkApp-CzYcrc9f.cjs → launchGtkApp-Csx4r7AQ.cjs} +218 -4
- package/dist/launchGtkApp-Csx4r7AQ.cjs.map +1 -0
- package/dist/launchGtkApp.d.ts +2 -2
- package/dist/launchGtkApp.d.ts.map +1 -1
- package/dist/launcherDriverProtocol.d.ts +37 -4
- package/dist/launcherDriverProtocol.d.ts.map +1 -1
- package/dist/{native-DlCBBWlV.js → native-BRWJbzfa.js} +53 -11
- package/dist/native-BRWJbzfa.js.map +1 -0
- package/dist/{native-Kfm95Uxw.cjs → native-C1llTPc6.cjs} +46 -4
- package/dist/native-C1llTPc6.cjs.map +1 -0
- package/dist/native.d.ts +22 -2
- package/dist/native.d.ts.map +1 -1
- package/dist/output.d.ts +2 -2
- package/dist/packageMetadata-DSIckEfC.cjs +4 -0
- package/dist/{packageMetadata-CewXH0iF.cjs.map → packageMetadata-DSIckEfC.cjs.map} +1 -1
- package/dist/packageMetadata-__qCDuxC.js +5 -0
- package/dist/{packageMetadata-DjxyJCJm.js.map → packageMetadata-__qCDuxC.js.map} +1 -1
- package/dist/prerequisites.d.ts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/tray.d.ts +2 -2
- package/dist/types.d.ts +106 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/wait.d.ts +2 -2
- package/package.json +7 -7
- package/prebuilds/linux-arm/gtk3/node.napi.armv7.glibc.node +0 -0
- package/prebuilds/linux-arm/gtk4/node.napi.armv7.glibc.node +0 -0
- package/prebuilds/linux-arm64/gtk3/node.napi.glibc.node +0 -0
- package/prebuilds/linux-arm64/gtk4/node.napi.glibc.node +0 -0
- package/prebuilds/linux-ia32/gtk3/node.napi.glibc.node +0 -0
- package/prebuilds/linux-ia32/gtk4/node.napi.glibc.node +0 -0
- package/prebuilds/linux-riscv64/gtk3/node.napi.glibc.node +0 -0
- package/prebuilds/linux-riscv64/gtk4/node.napi.glibc.node +0 -0
- package/prebuilds/linux-x64/gtk3/node.napi.glibc.node +0 -0
- package/prebuilds/linux-x64/gtk4/node.napi.glibc.node +0 -0
- package/dist/launchGtkApp-CzYcrc9f.cjs.map +0 -1
- package/dist/launchGtkApp-EI6OIpPI.js.map +0 -1
- package/dist/native-DlCBBWlV.js.map +0 -1
- package/dist/native-Kfm95Uxw.cjs.map +0 -1
- package/dist/packageMetadata-CewXH0iF.cjs +0 -4
- package/dist/packageMetadata-DjxyJCJm.js +0 -5
|
@@ -7,7 +7,7 @@ import { tmpdir } from "node:os";
|
|
|
7
7
|
import { join, resolve, dirname } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { a as appendPrerequisiteInstallHint } from "./prerequisites-JB0SKPVd.js";
|
|
10
|
-
import { c as nativeElementInfo, d as nativeClick, e as nativeImageInfo, f as nativeCaptureBounds, g as nativeTableDeselectColumn, h as nativeTableSelectColumn, i as nativeTableDeselectRow, j as nativeTableSelectRow, k as nativeTableIsCellSelected, l as nativeTableIsColumnSelected, m as nativeTableIsRowSelected, o as nativeTableSelectedColumns, p as nativeTableSelectedRows, q as nativeTableColumnCount, r as nativeTableRowCount, s as nativeClearSelection, t as nativeSelectAllChildren, u as nativeDeselectChildAt, v as nativeSelectChildAt, w as nativeIsChildSelected, x as nativeSelectedChildAt, y as nativeSelectedChildCount, z as nativeChildCount, A as nativeChildAt, B as nativeValueInfo, C as nativeSetValue, D as nativeText, E as nativeSetText, F as nativeX11Info, G as nativeResizeHints, H as
|
|
10
|
+
import { c as nativeElementInfo, d as nativeClick, e as nativeImageInfo, f as nativeCaptureBounds, g as nativeTableDeselectColumn, h as nativeTableSelectColumn, i as nativeTableDeselectRow, j as nativeTableSelectRow, k as nativeTableIsCellSelected, l as nativeTableIsColumnSelected, m as nativeTableIsRowSelected, o as nativeTableSelectedColumns, p as nativeTableSelectedRows, q as nativeTableColumnCount, r as nativeTableRowCount, s as nativeClearSelection, t as nativeSelectAllChildren, u as nativeDeselectChildAt, v as nativeSelectChildAt, w as nativeIsChildSelected, x as nativeSelectedChildAt, y as nativeSelectedChildCount, z as nativeChildCount, A as nativeChildAt, B as nativeValueInfo, C as nativeSetValue, D as nativeText, E as nativeSetText, F as nativeX11Info, G as nativeResizeHints, H as nativeActivateWindow, I as nativeSetWindowBounds, J as nativeResizeWindow, K as nativeMoveWindow, L as nativeBounds, M as nativeCapture, N as nativeTableCellAt, O as nativeFindAnyById, P as nativeTrayItems, Q as nativeWindowCount, R as nativeWindowAt, a as nativeCaptureScreen, S as nativeFindById, T as nativeProcessAtspiReadiness, U as nativeInputScrollWheel, V as nativeInputSetMouseButton, W as nativeInputMoveMouse, X as nativeInputPressKeySym, Y as nativeInputPressKeyName, Z as nativeInputSetModifier } from "./native-BRWJbzfa.js";
|
|
11
11
|
const normalizeOutputBufferBytes = (value, optionName = "outputBufferBytes") => {
|
|
12
12
|
if (value === void 0) {
|
|
13
13
|
return void 0;
|
|
@@ -233,6 +233,113 @@ const notifyGtkSystemOutput = (callback, event) => {
|
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
+
const keyboardModifiers = ["shift", "control", "alt", "super"];
|
|
237
|
+
const mouseButtons = ["left", "middle", "right", "back", "forward"];
|
|
238
|
+
const modifierKeyNames = /* @__PURE__ */ new Set([
|
|
239
|
+
"alt",
|
|
240
|
+
"alt_l",
|
|
241
|
+
"alt_r",
|
|
242
|
+
"control",
|
|
243
|
+
"control_l",
|
|
244
|
+
"control_r",
|
|
245
|
+
"ctrl",
|
|
246
|
+
"ctrl_l",
|
|
247
|
+
"ctrl_r",
|
|
248
|
+
"hyper",
|
|
249
|
+
"hyper_l",
|
|
250
|
+
"hyper_r",
|
|
251
|
+
"meta",
|
|
252
|
+
"meta_l",
|
|
253
|
+
"meta_r",
|
|
254
|
+
"shift",
|
|
255
|
+
"shift_l",
|
|
256
|
+
"shift_r",
|
|
257
|
+
"super",
|
|
258
|
+
"super_l",
|
|
259
|
+
"super_r"
|
|
260
|
+
]);
|
|
261
|
+
const isKeyboardModifier = (value) => keyboardModifiers.includes(value);
|
|
262
|
+
const isMouseButton = (value) => mouseButtons.includes(value);
|
|
263
|
+
const assertBoolean = (name, value) => {
|
|
264
|
+
if (typeof value !== "boolean") {
|
|
265
|
+
throw createGtkInvalidArgumentError(`${name} must be a boolean.`);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const assertInt32$1 = (name, value) => {
|
|
269
|
+
if (!Number.isInteger(value) || value < -2147483648 || value > 2147483647) {
|
|
270
|
+
throw createGtkInvalidArgumentError(`${name} must be a 32-bit integer.`);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const assertFiniteInteger = (name, value) => {
|
|
274
|
+
if (!Number.isInteger(value)) {
|
|
275
|
+
throw createGtkInvalidArgumentError(`${name} must be an integer.`);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
const assertKeysym = (value) => {
|
|
279
|
+
if (!Number.isInteger(value) || value < 0 || value > 4294967295) {
|
|
280
|
+
throw createGtkInvalidArgumentError(
|
|
281
|
+
"key numeric value must be an unsigned 32-bit integer."
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const normalizedKeyName = (key) => key.trim().toLowerCase().replace(/[-\s]+/gu, "_");
|
|
286
|
+
const assertNonModifierKeyName = (key) => {
|
|
287
|
+
if (key.length === 0) {
|
|
288
|
+
throw createGtkInvalidArgumentError("key must not be empty.");
|
|
289
|
+
}
|
|
290
|
+
if (modifierKeyNames.has(normalizedKeyName(key))) {
|
|
291
|
+
throw createGtkInvalidArgumentError(
|
|
292
|
+
"modifier keys must be controlled with setModifier()."
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const createGtkInputController = (backend) => ({
|
|
297
|
+
setModifier: async (modifier, pressed) => {
|
|
298
|
+
if (!isKeyboardModifier(modifier)) {
|
|
299
|
+
throw createGtkInvalidArgumentError(
|
|
300
|
+
`modifier must be shift, control, alt, or super: ${String(modifier)}`
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
assertBoolean("pressed", pressed);
|
|
304
|
+
await backend.setModifier(modifier, pressed);
|
|
305
|
+
},
|
|
306
|
+
pressKey: async (key) => {
|
|
307
|
+
if (typeof key === "string") {
|
|
308
|
+
assertNonModifierKeyName(key);
|
|
309
|
+
await backend.pressKeyName(key);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (typeof key === "number") {
|
|
313
|
+
assertKeysym(key);
|
|
314
|
+
await backend.pressKeySym(key);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
throw createGtkInvalidArgumentError(
|
|
318
|
+
"key must be a string keysym name or numeric keysym value."
|
|
319
|
+
);
|
|
320
|
+
},
|
|
321
|
+
moveMouseTo: async (x, y) => {
|
|
322
|
+
assertInt32$1("x", x);
|
|
323
|
+
assertInt32$1("y", y);
|
|
324
|
+
await backend.moveMouseTo(x, y);
|
|
325
|
+
},
|
|
326
|
+
setMouseButton: async (button, pressed) => {
|
|
327
|
+
if (!isMouseButton(button)) {
|
|
328
|
+
throw createGtkInvalidArgumentError(
|
|
329
|
+
`button must be left, middle, right, back, or forward: ${String(
|
|
330
|
+
button
|
|
331
|
+
)}`
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
assertBoolean("pressed", pressed);
|
|
335
|
+
await backend.setMouseButton(button, pressed);
|
|
336
|
+
},
|
|
337
|
+
scrollWheel: async (xSteps, ySteps) => {
|
|
338
|
+
assertFiniteInteger("xSteps", xSteps);
|
|
339
|
+
assertFiniteInteger("ySteps", ySteps);
|
|
340
|
+
await backend.scrollWheel(xSteps, ySteps);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
236
343
|
const defaultDisplay = "xvfb";
|
|
237
344
|
const defaultGSettings = "memory";
|
|
238
345
|
const defaultTheme = "Adwaita";
|
|
@@ -1667,6 +1774,25 @@ const createProxyGtkApp = (session, ref, outputSubscription) => {
|
|
|
1667
1774
|
await appRequest("app.environment")
|
|
1668
1775
|
),
|
|
1669
1776
|
output: () => appRequest("app.output"),
|
|
1777
|
+
input: createGtkInputController({
|
|
1778
|
+
setModifier: (modifier, pressed) => appRequest("app.inputSetModifier", { modifier, pressed }).then(
|
|
1779
|
+
() => void 0
|
|
1780
|
+
),
|
|
1781
|
+
pressKeyName: (key) => appRequest("app.inputPressKeyName", { key }).then(
|
|
1782
|
+
() => void 0
|
|
1783
|
+
),
|
|
1784
|
+
pressKeySym: (keysym) => appRequest("app.inputPressKeySym", { keysym }).then(
|
|
1785
|
+
() => void 0
|
|
1786
|
+
),
|
|
1787
|
+
moveMouseTo: (x, y) => appRequest("app.inputMoveMouse", { x, y }).then(() => void 0),
|
|
1788
|
+
setMouseButton: (button, pressed) => appRequest("app.inputSetMouseButton", {
|
|
1789
|
+
button,
|
|
1790
|
+
pressed
|
|
1791
|
+
}).then(() => void 0),
|
|
1792
|
+
scrollWheel: (xSteps, ySteps) => appRequest("app.inputScrollWheel", { xSteps, ySteps }).then(
|
|
1793
|
+
() => void 0
|
|
1794
|
+
)
|
|
1795
|
+
}),
|
|
1670
1796
|
findById: async (id) => elementRefToProxy(
|
|
1671
1797
|
session,
|
|
1672
1798
|
await appRequest("app.findById", { id })
|
|
@@ -1780,9 +1906,24 @@ const createProxyGtkElement = (session, ref) => {
|
|
|
1780
1906
|
switch (ref.kind) {
|
|
1781
1907
|
case "window":
|
|
1782
1908
|
target.bounds = () => session.request("element.bounds", { elementId });
|
|
1909
|
+
target.moveTo = (x, y) => session.request("window.moveTo", {
|
|
1910
|
+
elementId,
|
|
1911
|
+
x,
|
|
1912
|
+
y
|
|
1913
|
+
});
|
|
1783
1914
|
target.resizeHints = () => session.request("window.resizeHints", {
|
|
1784
1915
|
elementId
|
|
1785
1916
|
});
|
|
1917
|
+
target.resizeTo = (width, height) => session.request("window.resizeTo", {
|
|
1918
|
+
elementId,
|
|
1919
|
+
height,
|
|
1920
|
+
width
|
|
1921
|
+
});
|
|
1922
|
+
target.setBounds = (bounds) => session.request("window.setBounds", {
|
|
1923
|
+
bounds,
|
|
1924
|
+
elementId
|
|
1925
|
+
});
|
|
1926
|
+
target.activate = () => session.request("window.activate", { elementId }).then(() => void 0);
|
|
1786
1927
|
target.x11Info = () => session.request("window.x11Info", { elementId });
|
|
1787
1928
|
addChildContainerProxyOperations(session, elementId, target);
|
|
1788
1929
|
break;
|
|
@@ -2005,6 +2146,19 @@ const assertFiniteNumber = (name, value) => {
|
|
|
2005
2146
|
throw createGtkInvalidArgumentError(`${name} must be a finite number.`);
|
|
2006
2147
|
}
|
|
2007
2148
|
};
|
|
2149
|
+
const int32Min = -2147483648;
|
|
2150
|
+
const int32Max = 2147483647;
|
|
2151
|
+
const assertInt32 = (name, value) => {
|
|
2152
|
+
if (!Number.isInteger(value) || value < int32Min || value > int32Max) {
|
|
2153
|
+
throw createGtkInvalidArgumentError(`${name} must be a 32-bit integer.`);
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
const assertPositiveInt32 = (name, value) => {
|
|
2157
|
+
assertInt32(name, value);
|
|
2158
|
+
if (value <= 0) {
|
|
2159
|
+
throw createGtkInvalidArgumentError(`${name} must be greater than zero.`);
|
|
2160
|
+
}
|
|
2161
|
+
};
|
|
2008
2162
|
const normalizeRoleName = (roleName) => roleName.trim().toLowerCase().replace(/[_-]+/g, " ").replace(/\s+/g, " ");
|
|
2009
2163
|
const hasInterface = (info, name) => info.interfaces.some(
|
|
2010
2164
|
(interfaceName) => interfaceName.toLowerCase() === name.toLowerCase()
|
|
@@ -2397,6 +2551,29 @@ const createImageInfoOperation = (handle) => async () => {
|
|
|
2397
2551
|
};
|
|
2398
2552
|
};
|
|
2399
2553
|
const createBoundsOperation = (handle) => async () => nativeBounds(handle);
|
|
2554
|
+
const createMoveToOperation = (handle) => async (x, y) => {
|
|
2555
|
+
assertInt32("x", x);
|
|
2556
|
+
assertInt32("y", y);
|
|
2557
|
+
return nativeMoveWindow(handle, x, y);
|
|
2558
|
+
};
|
|
2559
|
+
const createResizeToOperation = (handle) => async (width, height) => {
|
|
2560
|
+
assertPositiveInt32("width", width);
|
|
2561
|
+
assertPositiveInt32("height", height);
|
|
2562
|
+
return nativeResizeWindow(handle, width, height);
|
|
2563
|
+
};
|
|
2564
|
+
const createSetBoundsOperation = (handle) => async (bounds) => {
|
|
2565
|
+
if (typeof bounds !== "object" || bounds === null) {
|
|
2566
|
+
throw createGtkInvalidArgumentError("bounds must be an object.");
|
|
2567
|
+
}
|
|
2568
|
+
assertInt32("bounds.x", bounds.x);
|
|
2569
|
+
assertInt32("bounds.y", bounds.y);
|
|
2570
|
+
assertPositiveInt32("bounds.width", bounds.width);
|
|
2571
|
+
assertPositiveInt32("bounds.height", bounds.height);
|
|
2572
|
+
return nativeSetWindowBounds(handle, bounds);
|
|
2573
|
+
};
|
|
2574
|
+
const createActivateWindowOperation = (handle) => async () => {
|
|
2575
|
+
nativeActivateWindow(handle);
|
|
2576
|
+
};
|
|
2400
2577
|
const createResizeHintsOperation = (handle) => async () => nativeResizeHints(handle);
|
|
2401
2578
|
const createX11InfoOperation = (handle) => async () => nativeX11Info(handle);
|
|
2402
2579
|
const createValueOperation = (handle) => async () => nativeValueInfo(handle).value;
|
|
@@ -2571,7 +2748,11 @@ const createGtkElement = (handle) => {
|
|
|
2571
2748
|
...common,
|
|
2572
2749
|
kind: "window",
|
|
2573
2750
|
bounds: createBoundsOperation(handle),
|
|
2751
|
+
moveTo: createMoveToOperation(handle),
|
|
2574
2752
|
...createChildContainerOperations(handle, void 0),
|
|
2753
|
+
resizeTo: createResizeToOperation(handle),
|
|
2754
|
+
setBounds: createSetBoundsOperation(handle),
|
|
2755
|
+
activate: createActivateWindowOperation(handle),
|
|
2575
2756
|
resizeHints: createResizeHintsOperation(handle),
|
|
2576
2757
|
x11Info: createX11InfoOperation(handle)
|
|
2577
2758
|
};
|
|
@@ -3088,6 +3269,38 @@ const launchGtkApp = (appPath, args, options) => {
|
|
|
3088
3269
|
}
|
|
3089
3270
|
return trayItem;
|
|
3090
3271
|
};
|
|
3272
|
+
const input = createGtkInputController({
|
|
3273
|
+
setModifier: async (modifier, pressed) => {
|
|
3274
|
+
assertNotReleased();
|
|
3275
|
+
assertProcessRunning(state, appPath);
|
|
3276
|
+
nativeInputSetModifier(modifier, pressed);
|
|
3277
|
+
},
|
|
3278
|
+
pressKeyName: async (key) => {
|
|
3279
|
+
assertNotReleased();
|
|
3280
|
+
assertProcessRunning(state, appPath);
|
|
3281
|
+
nativeInputPressKeyName(key);
|
|
3282
|
+
},
|
|
3283
|
+
pressKeySym: async (keysym) => {
|
|
3284
|
+
assertNotReleased();
|
|
3285
|
+
assertProcessRunning(state, appPath);
|
|
3286
|
+
nativeInputPressKeySym(keysym);
|
|
3287
|
+
},
|
|
3288
|
+
moveMouseTo: async (x, y) => {
|
|
3289
|
+
assertNotReleased();
|
|
3290
|
+
assertProcessRunning(state, appPath);
|
|
3291
|
+
nativeInputMoveMouse(x, y);
|
|
3292
|
+
},
|
|
3293
|
+
setMouseButton: async (button, pressed) => {
|
|
3294
|
+
assertNotReleased();
|
|
3295
|
+
assertProcessRunning(state, appPath);
|
|
3296
|
+
nativeInputSetMouseButton(button, pressed);
|
|
3297
|
+
},
|
|
3298
|
+
scrollWheel: async (xSteps, ySteps) => {
|
|
3299
|
+
assertNotReleased();
|
|
3300
|
+
assertProcessRunning(state, appPath);
|
|
3301
|
+
nativeInputScrollWheel(xSteps, ySteps);
|
|
3302
|
+
}
|
|
3303
|
+
});
|
|
3091
3304
|
const app = {
|
|
3092
3305
|
capture: async () => {
|
|
3093
3306
|
assertNotReleased();
|
|
@@ -3113,6 +3326,7 @@ const launchGtkApp = (appPath, args, options) => {
|
|
|
3113
3326
|
state.exitSignal === null ? null : state.exitSignal
|
|
3114
3327
|
);
|
|
3115
3328
|
},
|
|
3329
|
+
input,
|
|
3116
3330
|
findById,
|
|
3117
3331
|
findByPath,
|
|
3118
3332
|
getById,
|
|
@@ -3181,4 +3395,4 @@ export {
|
|
|
3181
3395
|
createGtkAppEnvironment as c,
|
|
3182
3396
|
launchGtkApp as l
|
|
3183
3397
|
};
|
|
3184
|
-
//# sourceMappingURL=launchGtkApp-
|
|
3398
|
+
//# sourceMappingURL=launchGtkApp-BTBwPwyj.js.map
|