gestament 0.1.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 (68) hide show
  1. package/README.md +122 -0
  2. package/dist/element.d.ts +15 -0
  3. package/dist/element.d.ts.map +1 -0
  4. package/dist/errors.d.ts +28 -0
  5. package/dist/errors.d.ts.map +1 -0
  6. package/dist/generated/packageMetadata.d.ts +18 -0
  7. package/dist/generated/packageMetadata.d.ts.map +1 -0
  8. package/dist/gestament-config.cjs +87 -0
  9. package/dist/gestament-config.cjs.map +1 -0
  10. package/dist/gestament-config.d.ts +18 -0
  11. package/dist/gestament-config.d.ts.map +1 -0
  12. package/dist/gestament-config.mjs +86 -0
  13. package/dist/gestament-config.mjs.map +1 -0
  14. package/dist/gestament-tray-host.cjs +12 -0
  15. package/dist/gestament-tray-host.cjs.map +1 -0
  16. package/dist/gestament-tray-host.d.ts +13 -0
  17. package/dist/gestament-tray-host.d.ts.map +1 -0
  18. package/dist/gestament-tray-host.mjs +11 -0
  19. package/dist/gestament-tray-host.mjs.map +1 -0
  20. package/dist/gestament-xvfb-worker.cjs +138 -0
  21. package/dist/gestament-xvfb-worker.cjs.map +1 -0
  22. package/dist/gestament-xvfb-worker.d.ts +13 -0
  23. package/dist/gestament-xvfb-worker.d.ts.map +1 -0
  24. package/dist/gestament-xvfb-worker.mjs +137 -0
  25. package/dist/gestament-xvfb-worker.mjs.map +1 -0
  26. package/dist/gestament-xvfb.cjs +132 -0
  27. package/dist/gestament-xvfb.cjs.map +1 -0
  28. package/dist/gestament-xvfb.d.ts +13 -0
  29. package/dist/gestament-xvfb.d.ts.map +1 -0
  30. package/dist/gestament-xvfb.mjs +131 -0
  31. package/dist/gestament-xvfb.mjs.map +1 -0
  32. package/dist/index.cjs +1077 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.ts +13 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.mjs +1077 -0
  37. package/dist/index.mjs.map +1 -0
  38. package/dist/launchGtkApp.d.ts +37 -0
  39. package/dist/launchGtkApp.d.ts.map +1 -0
  40. package/dist/native-BRnrsqMn.cjs +249 -0
  41. package/dist/native-BRnrsqMn.cjs.map +1 -0
  42. package/dist/native-DAhTiLnf.js +249 -0
  43. package/dist/native-DAhTiLnf.js.map +1 -0
  44. package/dist/native.d.ts +170 -0
  45. package/dist/native.d.ts.map +1 -0
  46. package/dist/testing.cjs +1180 -0
  47. package/dist/testing.cjs.map +1 -0
  48. package/dist/testing.d.ts +329 -0
  49. package/dist/testing.d.ts.map +1 -0
  50. package/dist/testing.mjs +1158 -0
  51. package/dist/testing.mjs.map +1 -0
  52. package/dist/tray.d.ts +17 -0
  53. package/dist/tray.d.ts.map +1 -0
  54. package/dist/types.d.ts +920 -0
  55. package/dist/types.d.ts.map +1 -0
  56. package/images/gestament-120.png +0 -0
  57. package/include/gestament/gtk.h +112 -0
  58. package/package.json +92 -0
  59. package/prebuilds/linux-arm/gtk3/node.napi.armv7.glibc.node +0 -0
  60. package/prebuilds/linux-arm/gtk4/node.napi.armv7.glibc.node +0 -0
  61. package/prebuilds/linux-arm64/gtk3/node.napi.glibc.node +0 -0
  62. package/prebuilds/linux-arm64/gtk4/node.napi.glibc.node +0 -0
  63. package/prebuilds/linux-ia32/gtk3/node.napi.glibc.node +0 -0
  64. package/prebuilds/linux-ia32/gtk4/node.napi.glibc.node +0 -0
  65. package/prebuilds/linux-riscv64/gtk3/node.napi.glibc.node +0 -0
  66. package/prebuilds/linux-riscv64/gtk4/node.napi.glibc.node +0 -0
  67. package/prebuilds/linux-x64/gtk3/node.napi.glibc.node +0 -0
  68. package/prebuilds/linux-x64/gtk4/node.napi.glibc.node +0 -0
@@ -0,0 +1,920 @@
1
+ /*!
2
+ * name: gestament
3
+ * version: 0.1.0
4
+ * description: TypeScript based test driver for GTK
5
+ * author: Kouji Matsui (@kekyo@mi.kekyo.net)
6
+ * license: MIT
7
+ * repository.url: https://github.com/kekyo/gestament.git
8
+ * git.commit.hash: 2e2298272ff7a9fff6945b8d87de6223ac4d7847
9
+ */
10
+
11
+ /** Error code values reported by the GTK automation library. */
12
+ export type GtkAutomationErrorCode = 'APP_EXITED' | 'ELEMENT_NOT_FOUND' | 'INVALID_ARGUMENT' | 'NATIVE_LOAD_FAILED' | 'OPERATION_FAILED' | 'STALE_ELEMENT' | 'TIMEOUT' | 'UNSUPPORTED_INTERFACE';
13
+ /** Base error for GTK automation failures. */
14
+ export interface GtkAutomationError extends Error {
15
+ /** Stable machine-readable error code. */
16
+ readonly code: GtkAutomationErrorCode;
17
+ }
18
+ /**
19
+ * Screen-relative rectangular bounds in physical pixels.
20
+ */
21
+ export interface GtkCaptureBounds {
22
+ /**
23
+ * Left coordinate relative to the root screen.
24
+ */
25
+ readonly x: number;
26
+ /**
27
+ * Top coordinate relative to the root screen.
28
+ */
29
+ readonly y: number;
30
+ /**
31
+ * Rectangle width in pixels.
32
+ */
33
+ readonly width: number;
34
+ /**
35
+ * Rectangle height in pixels.
36
+ */
37
+ readonly height: number;
38
+ }
39
+ /**
40
+ * Real screen capture for a GTK accessible element.
41
+ */
42
+ export interface GtkCapture {
43
+ /**
44
+ * PNG image buffer captured from the real root screen.
45
+ */
46
+ readonly image: Buffer;
47
+ /**
48
+ * Screen bounds reported by AT-SPI for the accessible element.
49
+ */
50
+ readonly bounds: GtkCaptureBounds;
51
+ /**
52
+ * Captured portion after clipping bounds to the root screen.
53
+ */
54
+ readonly visibleBounds: GtkCaptureBounds;
55
+ /**
56
+ * Whether the accessible bounds were clipped to the root screen.
57
+ */
58
+ readonly clipped: boolean;
59
+ }
60
+ /**
61
+ * Normalized accessible widget category used for test-side branching.
62
+ *
63
+ * This value is derived from AT-SPI role/capability information. It is not a
64
+ * GTK GObject class name such as GtkButton or GtkLabel.
65
+ */
66
+ export type GtkWidgetKind = 'window' | 'button' | 'container' | 'label' | 'entry' | 'text' | 'checkbox' | 'switch' | 'radio' | 'toggleButton' | 'slider' | 'spinButton' | 'progressBar' | 'comboBox' | 'list' | 'listItem' | 'table' | 'tableCell' | 'image' | 'menu' | 'menuItem' | 'unknown';
67
+ /** Metadata exposed by AT-SPI for a GTK accessible element. */
68
+ export interface GtkElementInfo {
69
+ /**
70
+ * Normalized widget category derived from the AT-SPI role.
71
+ */
72
+ readonly kind: GtkWidgetKind;
73
+ /**
74
+ * Stable AT-SPI role name reported for the accessible.
75
+ *
76
+ * The exact spelling is provided by the platform AT-SPI implementation.
77
+ */
78
+ readonly roleName: string;
79
+ /**
80
+ * Localized AT-SPI role name reported for the accessible.
81
+ */
82
+ readonly localizedRoleName: string;
83
+ /**
84
+ * Accessible id assigned to the element, when one is exposed.
85
+ */
86
+ readonly accessibleId: string;
87
+ /**
88
+ * Accessible name reported by the application.
89
+ */
90
+ readonly name: string;
91
+ /**
92
+ * Accessible description reported by the application.
93
+ */
94
+ readonly description: string;
95
+ /**
96
+ * AT-SPI interfaces currently exposed by the accessible.
97
+ */
98
+ readonly interfaces: readonly string[];
99
+ /**
100
+ * AT-SPI states currently exposed by the accessible.
101
+ */
102
+ readonly states: readonly string[];
103
+ }
104
+ /**
105
+ * Shared operation for objects that can capture their current screen area.
106
+ */
107
+ export interface GtkCapturable {
108
+ /**
109
+ * Captures pixels from the real screen area represented by this object.
110
+ *
111
+ * This does not render widgets off-screen. If another window covers the
112
+ * target area, the returned image contains the covering window pixels.
113
+ *
114
+ * @returns A promise that resolves to the captured PNG image and screen bounds.
115
+ */
116
+ readonly capture: () => Promise<GtkCapture>;
117
+ }
118
+ /**
119
+ * A GTK accessible element resolved within a launched application process.
120
+ *
121
+ * If the host widget or window disappears after this element is obtained,
122
+ * operations reject with STALE_ELEMENT.
123
+ */
124
+ export interface GtkElement extends GtkCapturable {
125
+ /**
126
+ * Normalized widget category captured when this element was resolved.
127
+ */
128
+ readonly kind: GtkWidgetKind;
129
+ /**
130
+ * Reads current AT-SPI metadata for this element.
131
+ *
132
+ * @returns A promise that resolves to the current element metadata.
133
+ */
134
+ readonly info: () => Promise<GtkElementInfo>;
135
+ }
136
+ /**
137
+ * Shared operations for widgets that expose typed direct children.
138
+ *
139
+ * @typeParam Child - Element type returned for child elements.
140
+ */
141
+ export interface GtkChildContainer<Child extends GtkWidgetElement> {
142
+ /**
143
+ * Resolves a direct child by AT-SPI child order.
144
+ *
145
+ * @param index - Zero-based AT-SPI child index.
146
+ * @returns A promise that resolves to the child element, or undefined when no child exists at the index.
147
+ */
148
+ readonly childAt: (index: number) => Promise<Child | undefined>;
149
+ /**
150
+ * Counts direct children currently exposed by this element.
151
+ *
152
+ * @returns A promise that resolves to the current direct child count.
153
+ */
154
+ readonly getChildCount: () => Promise<number>;
155
+ }
156
+ /**
157
+ * Shared operations for widgets that expose selectable direct children.
158
+ *
159
+ * @typeParam Child - Element type returned for child elements.
160
+ */
161
+ export interface GtkSelectableChildContainer<Child extends GtkWidgetElement> extends GtkChildContainer<Child> {
162
+ /**
163
+ * Counts currently selected children.
164
+ *
165
+ * @returns A promise that resolves to the current selected child count.
166
+ */
167
+ readonly getSelectedChildCount: () => Promise<number>;
168
+ /**
169
+ * Resolves a selected child by selected-child order.
170
+ *
171
+ * @param selectedIndex - Zero-based selected child index.
172
+ * @returns A promise that resolves to the selected child element, or undefined when no selected child exists at the index.
173
+ */
174
+ readonly selectedChildAt: (selectedIndex: number) => Promise<Child | undefined>;
175
+ /**
176
+ * Reads whether a direct child is selected.
177
+ *
178
+ * @param index - Zero-based direct child index.
179
+ * @returns A promise that resolves to true when the child is selected.
180
+ */
181
+ readonly isChildSelected: (index: number) => Promise<boolean>;
182
+ /**
183
+ * Selects a direct child.
184
+ *
185
+ * @param index - Zero-based direct child index.
186
+ * @returns A promise that resolves when the child has been selected.
187
+ */
188
+ readonly selectChildAt: (index: number) => Promise<void>;
189
+ /**
190
+ * Deselects a direct child.
191
+ *
192
+ * @param index - Zero-based direct child index.
193
+ * @returns A promise that resolves when the child has been deselected.
194
+ */
195
+ readonly deselectChildAt: (index: number) => Promise<void>;
196
+ /**
197
+ * Selects all direct children when the widget supports multi-selection.
198
+ *
199
+ * @returns A promise that resolves when all selectable children have been selected.
200
+ */
201
+ readonly selectAllChildren: () => Promise<void>;
202
+ /**
203
+ * Clears the current child selection.
204
+ *
205
+ * @returns A promise that resolves when selection has been cleared.
206
+ */
207
+ readonly clearSelection: () => Promise<void>;
208
+ }
209
+ /**
210
+ * A GTK top-level window element.
211
+ */
212
+ export interface GtkWindowElement extends GtkElement, GtkChildContainer<GtkWidgetElement> {
213
+ /**
214
+ * Discriminator for window elements.
215
+ */
216
+ readonly kind: 'window';
217
+ }
218
+ /**
219
+ * A generic GTK container element with typed child traversal.
220
+ */
221
+ export interface GtkContainerElement extends GtkElement, GtkChildContainer<GtkWidgetElement> {
222
+ /**
223
+ * Discriminator for generic container elements.
224
+ */
225
+ readonly kind: 'container';
226
+ }
227
+ /**
228
+ * Shared operation for widgets that expose an executable primary AT-SPI action.
229
+ */
230
+ export interface GtkClickable {
231
+ /**
232
+ * Executes the element's primary AT-SPI action.
233
+ *
234
+ * @returns A promise that resolves when the action has been executed.
235
+ */
236
+ readonly click: () => Promise<void>;
237
+ }
238
+ /**
239
+ * Shared operations for widgets with a checked, pressed, or selected state.
240
+ */
241
+ export interface GtkCheckable {
242
+ /**
243
+ * Reads whether the element is currently checked or pressed.
244
+ *
245
+ * @returns A promise that resolves to true when the element is checked or pressed.
246
+ */
247
+ readonly isChecked: () => Promise<boolean>;
248
+ /**
249
+ * Executes the element's primary action to toggle or select it.
250
+ *
251
+ * @remarks
252
+ * Radio elements usually become selected when toggled, but toggling an already
253
+ * selected radio element is not guaranteed to clear the selection.
254
+ *
255
+ * @returns A promise that resolves when the toggle action has been executed.
256
+ */
257
+ readonly toggle: () => Promise<void>;
258
+ }
259
+ /**
260
+ * A GTK button element with an executable primary action.
261
+ */
262
+ export interface GtkButtonElement extends GtkElement, GtkClickable {
263
+ /**
264
+ * Discriminator for button elements.
265
+ */
266
+ readonly kind: 'button';
267
+ }
268
+ /**
269
+ * Shared operation for widgets that expose readable text through AT-SPI.
270
+ */
271
+ export interface GtkTextDisplay {
272
+ /**
273
+ * Reads the element text through the AT-SPI Text interface.
274
+ *
275
+ * @returns A promise that resolves to the current element text.
276
+ */
277
+ readonly text: () => Promise<string>;
278
+ }
279
+ /**
280
+ * A GTK label element with readable text.
281
+ */
282
+ export interface GtkLabelElement extends GtkElement, GtkTextDisplay {
283
+ /**
284
+ * Discriminator for label elements.
285
+ */
286
+ readonly kind: 'label';
287
+ }
288
+ /**
289
+ * A GTK entry element with editable and readable text.
290
+ */
291
+ export interface GtkEntryElement extends GtkElement, GtkTextDisplay {
292
+ /**
293
+ * Discriminator for entry elements.
294
+ */
295
+ readonly kind: 'entry';
296
+ /**
297
+ * Replaces the element text through the AT-SPI EditableText interface.
298
+ *
299
+ * @param text - Text contents to set on the element.
300
+ * @returns A promise that resolves when the text has been replaced.
301
+ */
302
+ readonly setText: (text: string) => Promise<void>;
303
+ }
304
+ /**
305
+ * A GTK text element with readable text.
306
+ */
307
+ export interface GtkTextElement extends GtkElement, GtkTextDisplay {
308
+ /**
309
+ * Discriminator for text elements.
310
+ */
311
+ readonly kind: 'text';
312
+ }
313
+ /**
314
+ * A GTK checkbox element with executable and checkable operations.
315
+ */
316
+ export interface GtkCheckboxElement extends GtkElement, GtkClickable, GtkCheckable {
317
+ /**
318
+ * Discriminator for checkbox elements.
319
+ */
320
+ readonly kind: 'checkbox';
321
+ }
322
+ /**
323
+ * A GTK switch element with executable and checkable operations.
324
+ */
325
+ export interface GtkSwitchElement extends GtkElement, GtkClickable, GtkCheckable {
326
+ /**
327
+ * Discriminator for switch elements.
328
+ */
329
+ readonly kind: 'switch';
330
+ }
331
+ /**
332
+ * A GTK radio button element with executable and checkable operations.
333
+ */
334
+ export interface GtkRadioElement extends GtkElement, GtkClickable, GtkCheckable {
335
+ /**
336
+ * Discriminator for radio button elements.
337
+ */
338
+ readonly kind: 'radio';
339
+ }
340
+ /**
341
+ * A GTK toggle button element with executable and checkable operations.
342
+ */
343
+ export interface GtkToggleButtonElement extends GtkElement, GtkClickable, GtkCheckable {
344
+ /**
345
+ * Discriminator for toggle button elements.
346
+ */
347
+ readonly kind: 'toggleButton';
348
+ }
349
+ /**
350
+ * Numeric value metadata exposed through the AT-SPI Value interface.
351
+ */
352
+ export interface GtkValueInfo {
353
+ /**
354
+ * Current numeric value.
355
+ */
356
+ readonly value: number;
357
+ /**
358
+ * Minimum numeric value.
359
+ */
360
+ readonly minimum: number;
361
+ /**
362
+ * Maximum numeric value.
363
+ */
364
+ readonly maximum: number;
365
+ /**
366
+ * Minimum increment used by step-based controls.
367
+ */
368
+ readonly minimumIncrement: number;
369
+ /**
370
+ * Text representation reported by AT-SPI, when available.
371
+ */
372
+ readonly text: string;
373
+ }
374
+ /**
375
+ * Point reported by the AT-SPI Image interface.
376
+ */
377
+ export interface GtkImagePoint {
378
+ /**
379
+ * Horizontal pixel coordinate.
380
+ */
381
+ readonly x: number;
382
+ /**
383
+ * Vertical pixel coordinate.
384
+ */
385
+ readonly y: number;
386
+ }
387
+ /**
388
+ * Image size reported by the AT-SPI Image interface.
389
+ */
390
+ export interface GtkImageSize {
391
+ /**
392
+ * Image width in physical pixels.
393
+ */
394
+ readonly width: number;
395
+ /**
396
+ * Image height in physical pixels.
397
+ */
398
+ readonly height: number;
399
+ }
400
+ /**
401
+ * Metadata exposed through the AT-SPI Image interface.
402
+ */
403
+ export interface GtkImageInfo {
404
+ /**
405
+ * Text description of the displayed image.
406
+ */
407
+ readonly description: string;
408
+ /**
409
+ * Locale associated with the displayed image.
410
+ */
411
+ readonly locale: string;
412
+ /**
413
+ * Image position reported by AT-SPI.
414
+ *
415
+ * @remarks Some backends report this relative to the image widget rather than
416
+ * the root screen. Use `bounds` when screen-relative coordinates are required.
417
+ */
418
+ readonly position: GtkImagePoint;
419
+ /**
420
+ * Displayed image size.
421
+ */
422
+ readonly size: GtkImageSize;
423
+ /**
424
+ * Screen-relative image bounding box.
425
+ */
426
+ readonly bounds: GtkCaptureBounds;
427
+ /**
428
+ * Captures pixels for the current image area.
429
+ *
430
+ * @remarks The capture uses `bounds`, which is read from AT-SPI Image extents
431
+ * with screen coordinates. It does not use `position` because backends may
432
+ * report image position relative to the widget.
433
+ *
434
+ * @returns A promise that resolves to the captured PNG image and screen bounds.
435
+ */
436
+ readonly capture: () => Promise<GtkCapture>;
437
+ }
438
+ /**
439
+ * Shared read-only operations for widgets that expose AT-SPI Value.
440
+ */
441
+ export interface GtkValueDisplay {
442
+ /**
443
+ * Reads the current numeric value through the AT-SPI Value interface.
444
+ *
445
+ * @returns A promise that resolves to the current numeric value.
446
+ */
447
+ readonly value: () => Promise<number>;
448
+ /**
449
+ * Reads numeric value metadata through the AT-SPI Value interface.
450
+ *
451
+ * @returns A promise that resolves to the current value metadata.
452
+ */
453
+ readonly valueInfo: () => Promise<GtkValueInfo>;
454
+ }
455
+ /**
456
+ * Shared read-write operations for widgets that expose AT-SPI Value.
457
+ */
458
+ export interface GtkValueControl extends GtkValueDisplay {
459
+ /**
460
+ * Sets the current numeric value through the AT-SPI Value interface.
461
+ *
462
+ * @param value - Numeric value to set.
463
+ * @returns A promise that resolves when the value has been set.
464
+ */
465
+ readonly setValue: (value: number) => Promise<void>;
466
+ }
467
+ /**
468
+ * Step-based operations for spin button value controls.
469
+ */
470
+ export interface GtkSpinButtonControl {
471
+ /**
472
+ * Increments the spin button by one AT-SPI Value minimum increment.
473
+ *
474
+ * @remarks When a backend reports a zero minimum increment, gestament uses a
475
+ * fallback step so the operation can still move the value.
476
+ *
477
+ * @returns A promise that resolves when the value has been incremented.
478
+ */
479
+ readonly increment: () => Promise<void>;
480
+ /**
481
+ * Decrements the spin button by one AT-SPI Value minimum increment.
482
+ *
483
+ * @remarks When a backend reports a zero minimum increment, gestament uses a
484
+ * fallback step so the operation can still move the value.
485
+ *
486
+ * @returns A promise that resolves when the value has been decremented.
487
+ */
488
+ readonly decrement: () => Promise<void>;
489
+ }
490
+ /**
491
+ * A GTK slider element with read-write value operations.
492
+ */
493
+ export interface GtkSliderElement extends GtkElement, GtkValueControl {
494
+ /**
495
+ * Discriminator for slider elements.
496
+ */
497
+ readonly kind: 'slider';
498
+ }
499
+ /**
500
+ * A GTK spin button element with read-write and step value operations.
501
+ */
502
+ export interface GtkSpinButtonElement extends GtkElement, GtkValueControl, GtkSpinButtonControl {
503
+ /**
504
+ * Discriminator for spin button elements.
505
+ */
506
+ readonly kind: 'spinButton';
507
+ }
508
+ /**
509
+ * A GTK progress bar element with read-only value operations.
510
+ */
511
+ export interface GtkProgressBarElement extends GtkElement, GtkValueDisplay {
512
+ /**
513
+ * Discriminator for progress bar elements.
514
+ */
515
+ readonly kind: 'progressBar';
516
+ }
517
+ /**
518
+ * A GTK list item element with an executable primary action.
519
+ */
520
+ export interface GtkListItemElement extends GtkElement, GtkClickable {
521
+ /**
522
+ * Discriminator for list item elements.
523
+ */
524
+ readonly kind: 'listItem';
525
+ }
526
+ /**
527
+ * A GTK menu item element with an executable primary action.
528
+ */
529
+ export interface GtkMenuItemElement extends GtkElement, GtkClickable {
530
+ /**
531
+ * Discriminator for menu item elements.
532
+ */
533
+ readonly kind: 'menuItem';
534
+ }
535
+ /**
536
+ * Item element returned by combo box child traversal.
537
+ */
538
+ export type GtkComboBoxItemElement = GtkListItemElement | GtkMenuItemElement;
539
+ /**
540
+ * A GTK combo box element with executable and selectable child operations.
541
+ */
542
+ export interface GtkComboBoxElement extends GtkElement, GtkClickable, GtkSelectableChildContainer<GtkComboBoxItemElement> {
543
+ /**
544
+ * Discriminator for combo box elements.
545
+ */
546
+ readonly kind: 'comboBox';
547
+ }
548
+ /**
549
+ * A GTK list element with selectable list item operations.
550
+ */
551
+ export interface GtkListElement extends GtkElement, GtkSelectableChildContainer<GtkListItemElement> {
552
+ /**
553
+ * Discriminator for list elements.
554
+ */
555
+ readonly kind: 'list';
556
+ }
557
+ /**
558
+ * GTK table selection operations.
559
+ *
560
+ * @remarks
561
+ * These operations require AT-SPI Table selection support. GTK4 widgets such as
562
+ * GtkColumnView can expose visible table rows and cells without exposing this
563
+ * interface in current GTK4 versions.
564
+ */
565
+ export interface GtkTableSelection {
566
+ /**
567
+ * Reads selected row indexes.
568
+ *
569
+ * @returns A promise that resolves to selected row indexes.
570
+ */
571
+ readonly selectedRows: () => Promise<readonly number[]>;
572
+ /**
573
+ * Reads selected column indexes.
574
+ *
575
+ * @returns A promise that resolves to selected column indexes.
576
+ */
577
+ readonly selectedColumns: () => Promise<readonly number[]>;
578
+ /**
579
+ * Reads whether a row is selected.
580
+ *
581
+ * @param row - Zero-based table row index.
582
+ * @returns A promise that resolves to true when the row is selected.
583
+ */
584
+ readonly isRowSelected: (row: number) => Promise<boolean>;
585
+ /**
586
+ * Reads whether a column is selected.
587
+ *
588
+ * @param column - Zero-based table column index.
589
+ * @returns A promise that resolves to true when the column is selected.
590
+ */
591
+ readonly isColumnSelected: (column: number) => Promise<boolean>;
592
+ /**
593
+ * Reads whether a cell is selected.
594
+ *
595
+ * @param row - Zero-based table row index.
596
+ * @param column - Zero-based table column index.
597
+ * @returns A promise that resolves to true when the cell is selected.
598
+ */
599
+ readonly isCellSelected: (row: number, column: number) => Promise<boolean>;
600
+ /**
601
+ * Selects a row.
602
+ *
603
+ * @param row - Zero-based table row index.
604
+ * @returns A promise that resolves when the row has been selected.
605
+ */
606
+ readonly selectRow: (row: number) => Promise<void>;
607
+ /**
608
+ * Deselects a row.
609
+ *
610
+ * @param row - Zero-based table row index.
611
+ * @returns A promise that resolves when the row has been deselected.
612
+ */
613
+ readonly deselectRow: (row: number) => Promise<void>;
614
+ /**
615
+ * Selects a column.
616
+ *
617
+ * @param column - Zero-based table column index.
618
+ * @returns A promise that resolves when the column has been selected.
619
+ */
620
+ readonly selectColumn: (column: number) => Promise<void>;
621
+ /**
622
+ * Deselects a column.
623
+ *
624
+ * @param column - Zero-based table column index.
625
+ * @returns A promise that resolves when the column has been deselected.
626
+ */
627
+ readonly deselectColumn: (column: number) => Promise<void>;
628
+ }
629
+ /**
630
+ * A GTK table element.
631
+ */
632
+ export interface GtkTableElement extends GtkElement, GtkTableSelection {
633
+ /**
634
+ * Discriminator for table elements.
635
+ */
636
+ readonly kind: 'table';
637
+ /**
638
+ * Counts logical table rows.
639
+ *
640
+ * @returns A promise that resolves to the current row count.
641
+ */
642
+ readonly getRowCount: () => Promise<number>;
643
+ /**
644
+ * Counts logical table columns.
645
+ *
646
+ * @returns A promise that resolves to the current column count.
647
+ */
648
+ readonly getColumnCount: () => Promise<number>;
649
+ /**
650
+ * Resolves a logical table cell by row and column.
651
+ *
652
+ * @param row - Zero-based table row index.
653
+ * @param column - Zero-based table column index.
654
+ * @returns A promise that resolves to the table cell element, or undefined when no cell exists at the position.
655
+ */
656
+ readonly cellAt: (row: number, column: number) => Promise<GtkTableCellElement | undefined>;
657
+ }
658
+ /**
659
+ * A GTK table cell element.
660
+ */
661
+ export interface GtkTableCellElement extends GtkElement {
662
+ /**
663
+ * Discriminator for table cell elements.
664
+ */
665
+ readonly kind: 'tableCell';
666
+ }
667
+ /**
668
+ * A GTK image element.
669
+ */
670
+ export interface GtkImageElement extends GtkElement {
671
+ /**
672
+ * Discriminator for image elements.
673
+ */
674
+ readonly kind: 'image';
675
+ /**
676
+ * Reads image metadata through the AT-SPI Image interface.
677
+ *
678
+ * @returns A promise that resolves to the current image metadata.
679
+ */
680
+ readonly imageInfo: () => Promise<GtkImageInfo>;
681
+ }
682
+ /**
683
+ * A GTK menu element with typed menu item traversal.
684
+ */
685
+ export interface GtkMenuElement extends GtkElement, GtkChildContainer<GtkMenuItemElement> {
686
+ /**
687
+ * Discriminator for menu elements.
688
+ */
689
+ readonly kind: 'menu';
690
+ }
691
+ /**
692
+ * A GTK element whose widget category is not recognized.
693
+ */
694
+ export interface GtkUnknownElement extends GtkElement {
695
+ /**
696
+ * Discriminator for elements whose widget category is not recognized.
697
+ */
698
+ readonly kind: 'unknown';
699
+ }
700
+ /**
701
+ * Any specialized GTK element discriminated by its normalized widget kind.
702
+ */
703
+ export type GtkWidgetElement = GtkWindowElement | GtkButtonElement | GtkContainerElement | GtkLabelElement | GtkEntryElement | GtkTextElement | GtkCheckboxElement | GtkSwitchElement | GtkRadioElement | GtkToggleButtonElement | GtkSliderElement | GtkSpinButtonElement | GtkProgressBarElement | GtkComboBoxElement | GtkListElement | GtkListItemElement | GtkTableElement | GtkTableCellElement | GtkImageElement | GtkMenuElement | GtkMenuItemElement | GtkUnknownElement;
704
+ /**
705
+ * Specialized GTK element type for a normalized widget kind.
706
+ *
707
+ * @typeParam Kind - Normalized widget kind to extract from GtkWidgetElement.
708
+ *
709
+ * @remarks
710
+ * Returns never when the kind is not present in GtkWidgetElement.
711
+ */
712
+ export type GtkElementOfKind<Kind extends GtkWidgetKind> = Extract<GtkWidgetElement, {
713
+ readonly kind: Kind;
714
+ }>;
715
+ /**
716
+ * Selector used to resolve a StatusNotifier tray item.
717
+ */
718
+ export type GtkTrayItemSelector = {
719
+ /**
720
+ * StatusNotifierItem Id property.
721
+ */
722
+ readonly id: string;
723
+ } | {
724
+ /**
725
+ * StatusNotifierItem Title property.
726
+ */
727
+ readonly title: string;
728
+ } | {
729
+ /**
730
+ * DBus bus name that owns the StatusNotifierItem.
731
+ */
732
+ readonly busName: string;
733
+ /**
734
+ * Optional DBus object path for the StatusNotifierItem.
735
+ */
736
+ readonly objectPath?: string;
737
+ };
738
+ /**
739
+ * Metadata for a StatusNotifier tray item.
740
+ */
741
+ export interface GtkTrayItemMetadata {
742
+ /**
743
+ * StatusNotifierItem Id property when provided.
744
+ */
745
+ readonly id?: string;
746
+ /**
747
+ * StatusNotifierItem Title property when provided.
748
+ */
749
+ readonly title?: string;
750
+ /**
751
+ * StatusNotifierItem Status property when provided.
752
+ */
753
+ readonly status?: string;
754
+ /**
755
+ * StatusNotifierItem IconName property when provided.
756
+ */
757
+ readonly iconName?: string;
758
+ /**
759
+ * Backend used to discover this tray item.
760
+ */
761
+ readonly backend: 'status-notifier';
762
+ }
763
+ /**
764
+ * A logical StatusNotifier tray item owned by the launched application.
765
+ */
766
+ export interface GtkTrayItem extends GtkCapturable, GtkClickable {
767
+ /**
768
+ * Reads current tray item metadata and fails if the DBus item is stale.
769
+ *
770
+ * @returns A promise that resolves to the current tray item metadata.
771
+ */
772
+ readonly metadata: () => Promise<GtkTrayItemMetadata>;
773
+ /**
774
+ * Resolves the currently rendered tray item accessible when it is visible.
775
+ *
776
+ * @returns A promise that resolves to the tray item element, or undefined when it is not visible.
777
+ */
778
+ readonly element: () => Promise<GtkWidgetElement | undefined>;
779
+ /**
780
+ * Opens the tray menu when one is exposed by the tray item.
781
+ *
782
+ * @returns A promise that resolves to the menu element, or undefined when no menu is exposed.
783
+ */
784
+ readonly openMenu: () => Promise<GtkWidgetElement | undefined>;
785
+ }
786
+ /**
787
+ * Common interface for objects that own resources requiring explicit release.
788
+ */
789
+ export interface Releasable extends AsyncDisposable {
790
+ /**
791
+ * Releases resources owned by this object.
792
+ *
793
+ * @returns A promise-like value that resolves when release has completed.
794
+ */
795
+ readonly release: () => PromiseLike<void>;
796
+ }
797
+ /**
798
+ * Environment values passed to a launched GTK application.
799
+ *
800
+ * Undefined values remove or override inherited environment values according to
801
+ * Node.js child_process environment handling.
802
+ */
803
+ export type GtkAppEnvironment = Readonly<Record<string, string | undefined>>;
804
+ /**
805
+ * Options used when launching a GTK application.
806
+ */
807
+ export interface LaunchGtkAppOptions {
808
+ /**
809
+ * Environment overrides passed to the child process.
810
+ */
811
+ readonly env?: GtkAppEnvironment | undefined;
812
+ /**
813
+ * Timeout used by operations that wait for the application or elements.
814
+ * Default is 10000msec (10sec).
815
+ */
816
+ readonly timeoutMs?: number | undefined;
817
+ }
818
+ /**
819
+ * A launched GTK application controlled through AT-SPI.
820
+ */
821
+ export interface GtkApp extends Releasable, GtkCapturable {
822
+ /**
823
+ * Captures the full X11 root window currently addressed by DISPLAY.
824
+ *
825
+ * @returns A promise that resolves to a PNG image for the full root window.
826
+ * @remarks
827
+ * When the app runs under gestament-xvfb, this captures the full Xvfb screen.
828
+ * The capture bounds are the root window bounds, usually starting at 0,0.
829
+ */
830
+ readonly capture: () => Promise<GtkCapture>;
831
+ /**
832
+ * Waits for an accessible id and returns an element when it exists.
833
+ *
834
+ * @param id - Accessible id to resolve.
835
+ * @returns A promise that resolves to the matching element, or undefined when it is not found before timeout.
836
+ */
837
+ readonly findById: (id: string) => Promise<GtkWidgetElement | undefined>;
838
+ /**
839
+ * Waits for an accessible id and rejects when it does not exist.
840
+ *
841
+ * @param id - Accessible id to resolve.
842
+ * @returns A promise that resolves to the matching element.
843
+ */
844
+ readonly getById: (id: string) => Promise<GtkWidgetElement>;
845
+ /**
846
+ * Resolves a top-level window by AT-SPI traversal order.
847
+ *
848
+ * @param index - Zero-based top-level window index.
849
+ * @returns A promise that resolves to the window element, or undefined when no window exists at the index.
850
+ */
851
+ readonly windowAt: (index: number) => Promise<GtkWidgetElement | undefined>;
852
+ /**
853
+ * Counts top-level windows currently hosted by the application process.
854
+ *
855
+ * @returns A promise that resolves to the current top-level window count.
856
+ */
857
+ readonly getWindowCount: () => Promise<number>;
858
+ /**
859
+ * Waits for a StatusNotifier tray item and returns it when it exists.
860
+ *
861
+ * @param selector - Tray item selector used to match a StatusNotifier item.
862
+ * @returns A promise that resolves to the matching tray item, or undefined when it is not found before timeout.
863
+ */
864
+ readonly findTrayItem: (selector: GtkTrayItemSelector) => Promise<GtkTrayItem | undefined>;
865
+ /**
866
+ * Waits for a StatusNotifier tray item and rejects when it does not exist.
867
+ *
868
+ * @param selector - Tray item selector used to match a StatusNotifier item.
869
+ * @returns A promise that resolves to the matching tray item.
870
+ */
871
+ readonly getTrayItem: (selector: GtkTrayItemSelector) => Promise<GtkTrayItem>;
872
+ /**
873
+ * Resolves a StatusNotifier tray item by current registration order.
874
+ *
875
+ * @param index - Zero-based StatusNotifier tray item index.
876
+ * @returns A promise that resolves to the tray item, or undefined when no item exists at the index.
877
+ */
878
+ readonly trayItemAt: (index: number) => Promise<GtkTrayItem | undefined>;
879
+ /**
880
+ * Counts StatusNotifier tray items currently owned by the application.
881
+ *
882
+ * @returns A promise that resolves to the current tray item count.
883
+ */
884
+ readonly getTrayItemCount: () => Promise<number>;
885
+ }
886
+ /**
887
+ * Options used by a reusable GTK application launcher.
888
+ */
889
+ export interface GtkAppLauncherOptions {
890
+ /**
891
+ * Target GTK application path.
892
+ */
893
+ readonly appPath: string;
894
+ /**
895
+ * Base arguments passed to every launched application.
896
+ */
897
+ readonly args?: readonly string[] | undefined;
898
+ /**
899
+ * Environment overrides passed to every launched application.
900
+ */
901
+ readonly env?: GtkAppEnvironment | undefined;
902
+ /**
903
+ * Timeout used by operations that wait for the application or elements.
904
+ * Default is 10000msec (10sec).
905
+ */
906
+ readonly timeoutMs?: number | undefined;
907
+ }
908
+ /**
909
+ * Reusable launcher that tracks and releases launched GTK applications.
910
+ */
911
+ export interface GtkAppLauncher extends Releasable {
912
+ /**
913
+ * Launches the configured GTK application and tracks it for release().
914
+ *
915
+ * @param args - Additional arguments appended to the configured base arguments.
916
+ * @returns A promise that resolves to the launched application controller.
917
+ */
918
+ readonly launch: (args?: readonly string[]) => Promise<GtkApp>;
919
+ }
920
+ //# sourceMappingURL=types.d.ts.map