gestament 0.6.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.
Files changed (70) hide show
  1. package/dist/displaySession.d.ts +2 -2
  2. package/dist/displaySession.d.ts.map +1 -1
  3. package/dist/element.d.ts +2 -2
  4. package/dist/element.d.ts.map +1 -1
  5. package/dist/errors.d.ts +2 -2
  6. package/dist/generated/packageMetadata.d.ts +4 -4
  7. package/dist/gestament-config.d.ts +2 -2
  8. package/dist/gestament-launcher-driver.cjs +34 -1
  9. package/dist/gestament-launcher-driver.cjs.map +1 -1
  10. package/dist/gestament-launcher-driver.d.ts +2 -2
  11. package/dist/gestament-launcher-driver.mjs +34 -1
  12. package/dist/gestament-launcher-driver.mjs.map +1 -1
  13. package/dist/gestament-tray-host.cjs +1 -1
  14. package/dist/gestament-tray-host.d.ts +2 -2
  15. package/dist/gestament-tray-host.mjs +1 -1
  16. package/dist/gestament-xvfb-pool-probe.cjs +1 -1
  17. package/dist/gestament-xvfb-pool-probe.d.ts +2 -2
  18. package/dist/gestament-xvfb-pool-probe.mjs +1 -1
  19. package/dist/gestament-xvfb-worker.d.ts +2 -2
  20. package/dist/gestament-xvfb.d.ts +2 -2
  21. package/dist/gestament.cjs +1 -1
  22. package/dist/gestament.d.ts +2 -2
  23. package/dist/gestament.mjs +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.mjs +1 -1
  27. package/dist/input.d.ts +21 -0
  28. package/dist/input.d.ts.map +1 -0
  29. package/dist/{launchGtkApp-B3FMzhrc.js → launchGtkApp-BTBwPwyj.js} +166 -2
  30. package/dist/launchGtkApp-BTBwPwyj.js.map +1 -0
  31. package/dist/{launchGtkApp-OggUtTTC.cjs → launchGtkApp-Csx4r7AQ.cjs} +168 -4
  32. package/dist/launchGtkApp-Csx4r7AQ.cjs.map +1 -0
  33. package/dist/launchGtkApp.d.ts +2 -2
  34. package/dist/launchGtkApp.d.ts.map +1 -1
  35. package/dist/launcherDriverProtocol.d.ts +26 -4
  36. package/dist/launcherDriverProtocol.d.ts.map +1 -1
  37. package/dist/{native-C2tzSvVW.js → native-BRWJbzfa.js} +42 -14
  38. package/dist/native-BRWJbzfa.js.map +1 -0
  39. package/dist/{native-Xz0gjKti.cjs → native-C1llTPc6.cjs} +32 -4
  40. package/dist/native-C1llTPc6.cjs.map +1 -0
  41. package/dist/native.d.ts +16 -2
  42. package/dist/native.d.ts.map +1 -1
  43. package/dist/output.d.ts +2 -2
  44. package/dist/packageMetadata-DSIckEfC.cjs +4 -0
  45. package/dist/{packageMetadata-BqAHZ5WO.cjs.map → packageMetadata-DSIckEfC.cjs.map} +1 -1
  46. package/dist/packageMetadata-__qCDuxC.js +5 -0
  47. package/dist/{packageMetadata-BQE2KNaa.js.map → packageMetadata-__qCDuxC.js.map} +1 -1
  48. package/dist/prerequisites.d.ts +2 -2
  49. package/dist/testing.d.ts +2 -2
  50. package/dist/tray.d.ts +2 -2
  51. package/dist/types.d.ts +83 -2
  52. package/dist/types.d.ts.map +1 -1
  53. package/dist/wait.d.ts +2 -2
  54. package/package.json +7 -7
  55. package/prebuilds/linux-arm/gtk3/node.napi.armv7.glibc.node +0 -0
  56. package/prebuilds/linux-arm/gtk4/node.napi.armv7.glibc.node +0 -0
  57. package/prebuilds/linux-arm64/gtk3/node.napi.glibc.node +0 -0
  58. package/prebuilds/linux-arm64/gtk4/node.napi.glibc.node +0 -0
  59. package/prebuilds/linux-ia32/gtk3/node.napi.glibc.node +0 -0
  60. package/prebuilds/linux-ia32/gtk4/node.napi.glibc.node +0 -0
  61. package/prebuilds/linux-riscv64/gtk3/node.napi.glibc.node +0 -0
  62. package/prebuilds/linux-riscv64/gtk4/node.napi.glibc.node +0 -0
  63. package/prebuilds/linux-x64/gtk3/node.napi.glibc.node +0 -0
  64. package/prebuilds/linux-x64/gtk4/node.napi.glibc.node +0 -0
  65. package/dist/launchGtkApp-B3FMzhrc.js.map +0 -1
  66. package/dist/launchGtkApp-OggUtTTC.cjs.map +0 -1
  67. package/dist/native-C2tzSvVW.js.map +0 -1
  68. package/dist/native-Xz0gjKti.cjs.map +0 -1
  69. package/dist/packageMetadata-BQE2KNaa.js +0 -5
  70. package/dist/packageMetadata-BqAHZ5WO.cjs +0 -4
@@ -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 nativeSetWindowBounds, I as nativeResizeWindow, J as nativeMoveWindow, K as nativeBounds, L as nativeCapture, M as nativeTableCellAt, N as nativeFindAnyById, O as nativeTrayItems, P as nativeWindowCount, Q as nativeWindowAt, a as nativeCaptureScreen, R as nativeFindById, S as nativeProcessAtspiReadiness } from "./native-C2tzSvVW.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 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 })
@@ -1797,6 +1923,7 @@ const createProxyGtkElement = (session, ref) => {
1797
1923
  bounds,
1798
1924
  elementId
1799
1925
  });
1926
+ target.activate = () => session.request("window.activate", { elementId }).then(() => void 0);
1800
1927
  target.x11Info = () => session.request("window.x11Info", { elementId });
1801
1928
  addChildContainerProxyOperations(session, elementId, target);
1802
1929
  break;
@@ -2444,6 +2571,9 @@ const createSetBoundsOperation = (handle) => async (bounds) => {
2444
2571
  assertPositiveInt32("bounds.height", bounds.height);
2445
2572
  return nativeSetWindowBounds(handle, bounds);
2446
2573
  };
2574
+ const createActivateWindowOperation = (handle) => async () => {
2575
+ nativeActivateWindow(handle);
2576
+ };
2447
2577
  const createResizeHintsOperation = (handle) => async () => nativeResizeHints(handle);
2448
2578
  const createX11InfoOperation = (handle) => async () => nativeX11Info(handle);
2449
2579
  const createValueOperation = (handle) => async () => nativeValueInfo(handle).value;
@@ -2622,6 +2752,7 @@ const createGtkElement = (handle) => {
2622
2752
  ...createChildContainerOperations(handle, void 0),
2623
2753
  resizeTo: createResizeToOperation(handle),
2624
2754
  setBounds: createSetBoundsOperation(handle),
2755
+ activate: createActivateWindowOperation(handle),
2625
2756
  resizeHints: createResizeHintsOperation(handle),
2626
2757
  x11Info: createX11InfoOperation(handle)
2627
2758
  };
@@ -3138,6 +3269,38 @@ const launchGtkApp = (appPath, args, options) => {
3138
3269
  }
3139
3270
  return trayItem;
3140
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
+ });
3141
3304
  const app = {
3142
3305
  capture: async () => {
3143
3306
  assertNotReleased();
@@ -3163,6 +3326,7 @@ const launchGtkApp = (appPath, args, options) => {
3163
3326
  state.exitSignal === null ? null : state.exitSignal
3164
3327
  );
3165
3328
  },
3329
+ input,
3166
3330
  findById,
3167
3331
  findByPath,
3168
3332
  getById,
@@ -3231,4 +3395,4 @@ export {
3231
3395
  createGtkAppEnvironment as c,
3232
3396
  launchGtkApp as l
3233
3397
  };
3234
- //# sourceMappingURL=launchGtkApp-B3FMzhrc.js.map
3398
+ //# sourceMappingURL=launchGtkApp-BTBwPwyj.js.map