@gtkx/testing 1.6.0 → 2.0.0-beta.2

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/README.md +5 -5
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +1 -3
  4. package/dist/config.js.map +1 -1
  5. package/dist/fire-event.js +1 -1
  6. package/dist/fire-event.js.map +1 -1
  7. package/dist/matchers.d.ts.map +1 -1
  8. package/dist/matchers.js +1 -14
  9. package/dist/matchers.js.map +1 -1
  10. package/dist/queries.d.ts +30 -126
  11. package/dist/queries.d.ts.map +1 -1
  12. package/dist/queries.js +30 -126
  13. package/dist/queries.js.map +1 -1
  14. package/dist/query-helpers.d.ts.map +1 -1
  15. package/dist/query-helpers.js +8 -2
  16. package/dist/query-helpers.js.map +1 -1
  17. package/dist/screenshot.d.ts.map +1 -1
  18. package/dist/screenshot.js +1 -3
  19. package/dist/screenshot.js.map +1 -1
  20. package/dist/user-event/adjustment.d.ts +2 -14
  21. package/dist/user-event/adjustment.d.ts.map +1 -1
  22. package/dist/user-event/adjustment.js +2 -14
  23. package/dist/user-event/adjustment.js.map +1 -1
  24. package/dist/user-event/click.d.ts +3 -41
  25. package/dist/user-event/click.d.ts.map +1 -1
  26. package/dist/user-event/click.js +5 -43
  27. package/dist/user-event/click.js.map +1 -1
  28. package/dist/user-event/gesture.d.ts +9 -43
  29. package/dist/user-event/gesture.d.ts.map +1 -1
  30. package/dist/user-event/gesture.js +9 -43
  31. package/dist/user-event/gesture.js.map +1 -1
  32. package/dist/user-event/index.d.ts +16 -85
  33. package/dist/user-event/index.d.ts.map +1 -1
  34. package/dist/user-event/index.js +1 -5
  35. package/dist/user-event/index.js.map +1 -1
  36. package/dist/user-event/keyboard.d.ts +1 -1
  37. package/dist/user-event/keyboard.d.ts.map +1 -1
  38. package/dist/user-event/keyboard.js +1 -1
  39. package/dist/user-event/keyboard.js.map +1 -1
  40. package/dist/user-event/list-row-click.d.ts +1 -1
  41. package/dist/user-event/list-row-click.d.ts.map +1 -1
  42. package/dist/user-event/list-row-click.js +2 -1
  43. package/dist/user-event/list-row-click.js.map +1 -1
  44. package/dist/user-event/selection.d.ts +2 -18
  45. package/dist/user-event/selection.d.ts.map +1 -1
  46. package/dist/user-event/selection.js +3 -21
  47. package/dist/user-event/selection.js.map +1 -1
  48. package/dist/user-event/text.d.ts +5 -34
  49. package/dist/user-event/text.d.ts.map +1 -1
  50. package/dist/user-event/text.js +5 -34
  51. package/dist/user-event/text.js.map +1 -1
  52. package/dist/widget-accessible-properties.d.ts.map +1 -1
  53. package/dist/widget-accessible-properties.js +14 -34
  54. package/dist/widget-accessible-properties.js.map +1 -1
  55. package/package.json +12 -8
  56. package/src/config.ts +1 -3
  57. package/src/fire-event.ts +1 -1
  58. package/src/matchers.ts +1 -22
  59. package/src/queries.ts +30 -126
  60. package/src/query-helpers.ts +8 -2
  61. package/src/screenshot.ts +1 -3
  62. package/src/user-event/adjustment.ts +2 -14
  63. package/src/user-event/click.ts +5 -43
  64. package/src/user-event/gesture.ts +9 -43
  65. package/src/user-event/index.ts +16 -85
  66. package/src/user-event/keyboard.ts +1 -1
  67. package/src/user-event/list-row-click.ts +2 -2
  68. package/src/user-event/selection.ts +3 -21
  69. package/src/user-event/text.ts +5 -34
  70. package/src/widget-accessible-properties.ts +22 -44
package/dist/queries.d.ts CHANGED
@@ -4,161 +4,65 @@ import { type Container } from "./traversal.js";
4
4
  /** The built-in queries in their unbound form, each taking the container to search as its first argument. */
5
5
  type BuiltinQueries = QueryFamilies<[container: Container]>;
6
6
  declare const builtinQueries: BuiltinQueries;
7
- /**
8
- * Returns the single mapped widget with a matching accessible role and options, or null when none
9
- * match. Widgets that are not mapped are never matched. Throws when more than one matches.
10
- */
7
+ /** Queries one mapped widget by accessible role. */
11
8
  declare const queryByRole: BuiltinQueries["queryByRole"];
12
- /**
13
- * Returns every mapped widget with a matching accessible role and options. Widgets that are not
14
- * mapped are never matched. Throws when none match.
15
- */
9
+ /** Gets all mapped widgets with an accessible role. */
16
10
  declare const getAllByRole: BuiltinQueries["getAllByRole"];
17
- /**
18
- * Returns the single mapped widget with a matching accessible role and options. Widgets that are not
19
- * mapped are never matched. Throws when none or more than one matches.
20
- */
11
+ /** Gets one mapped widget by accessible role. */
21
12
  declare const getByRole: BuiltinQueries["getByRole"];
22
- /**
23
- * Waits for and returns every mapped widget with a matching accessible role and options, retrying
24
- * until at least one appears or the timeout elapses. Widgets that are not mapped are never matched.
25
- */
13
+ /** Finds all mapped widgets with an accessible role. */
26
14
  declare const findAllByRole: BuiltinQueries["findAllByRole"];
27
- /**
28
- * Waits for and returns the single mapped widget with a matching accessible role and options,
29
- * retrying until it appears or the timeout elapses. Widgets that are not mapped are never matched.
30
- * Rejects when none or more than one matches.
31
- */
15
+ /** Finds one mapped widget by accessible role. */
32
16
  declare const findByRole: BuiltinQueries["findByRole"];
33
- /**
34
- * Returns the single mapped widget with matching associated label text, or null when none match.
35
- * Widgets that are not mapped are never matched. Throws when more than one matches.
36
- */
17
+ /** Queries one mapped widget by label text. */
37
18
  declare const queryByLabelText: BuiltinQueries["queryByLabelText"];
38
- /**
39
- * Returns every mapped widget with matching associated label text. Widgets that are not mapped are
40
- * never matched. Throws when none match.
41
- */
19
+ /** Gets all mapped widgets with label text. */
42
20
  declare const getAllByLabelText: BuiltinQueries["getAllByLabelText"];
43
- /**
44
- * Returns the single mapped widget with matching associated label text. Widgets that are not mapped
45
- * are never matched. Throws when none or more than one matches.
46
- */
21
+ /** Gets one mapped widget by label text. */
47
22
  declare const getByLabelText: BuiltinQueries["getByLabelText"];
48
- /**
49
- * Waits for and returns every mapped widget with matching associated label text, retrying until at
50
- * least one appears or the timeout elapses. Widgets that are not mapped are never matched.
51
- */
23
+ /** Finds all mapped widgets with label text. */
52
24
  declare const findAllByLabelText: BuiltinQueries["findAllByLabelText"];
53
- /**
54
- * Waits for and returns the single mapped widget with matching associated label text, retrying until
55
- * it appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when
56
- * none or more than one matches.
57
- */
25
+ /** Finds one mapped widget by label text. */
58
26
  declare const findByLabelText: BuiltinQueries["findByLabelText"];
59
- /**
60
- * Returns the single mapped widget with matching rendered text content, or null when none match.
61
- * Widgets that are not mapped are never matched. Throws when more than one matches.
62
- */
27
+ /** Queries one mapped widget by rendered text. */
63
28
  declare const queryByText: BuiltinQueries["queryByText"];
64
- /**
65
- * Returns every mapped widget with matching rendered text content. Widgets that are not mapped are
66
- * never matched. Throws when none match.
67
- */
29
+ /** Gets all mapped widgets with rendered text. */
68
30
  declare const getAllByText: BuiltinQueries["getAllByText"];
69
- /**
70
- * Returns the single mapped widget with matching rendered text content. Widgets that are not mapped
71
- * are never matched. Throws when none or more than one matches.
72
- */
31
+ /** Gets one mapped widget by rendered text. */
73
32
  declare const getByText: BuiltinQueries["getByText"];
74
- /**
75
- * Waits for and returns every mapped widget with matching rendered text content, retrying until at
76
- * least one appears or the timeout elapses. Widgets that are not mapped are never matched.
77
- */
33
+ /** Finds all mapped widgets with rendered text. */
78
34
  declare const findAllByText: BuiltinQueries["findAllByText"];
79
- /**
80
- * Waits for and returns the single mapped widget with matching rendered text content, retrying until
81
- * it appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when
82
- * none or more than one matches.
83
- */
35
+ /** Finds one mapped widget by rendered text. */
84
36
  declare const findByText: BuiltinQueries["findByText"];
85
- /**
86
- * Returns the single mapped widget with a matching widget name, or null when none match. Widgets
87
- * that are not mapped are never matched. Throws when more than one matches.
88
- */
37
+ /** Queries one mapped widget by GTK name. */
89
38
  declare const queryByName: BuiltinQueries["queryByName"];
90
- /**
91
- * Returns every mapped widget with a matching widget name. Widgets that are not mapped are never
92
- * matched. Throws when none match.
93
- */
39
+ /** Gets all mapped widgets with a GTK name. */
94
40
  declare const getAllByName: BuiltinQueries["getAllByName"];
95
- /**
96
- * Returns the single mapped widget with a matching widget name. Widgets that are not mapped are
97
- * never matched. Throws when none or more than one matches.
98
- */
41
+ /** Gets one mapped widget by GTK name. */
99
42
  declare const getByName: BuiltinQueries["getByName"];
100
- /**
101
- * Waits for and returns every mapped widget with a matching widget name, retrying until at least one
102
- * appears or the timeout elapses. Widgets that are not mapped are never matched.
103
- */
43
+ /** Finds all mapped widgets with a GTK name. */
104
44
  declare const findAllByName: BuiltinQueries["findAllByName"];
105
- /**
106
- * Waits for and returns the single mapped widget with a matching widget name, retrying until it
107
- * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none
108
- * or more than one matches.
109
- */
45
+ /** Finds one mapped widget by GTK name. */
110
46
  declare const findByName: BuiltinQueries["findByName"];
111
- /**
112
- * Returns the single mapped widget with matching placeholder text, or null when none match. Widgets
113
- * that are not mapped are never matched. Throws when more than one matches.
114
- */
47
+ /** Queries one mapped widget by placeholder text. */
115
48
  declare const queryByPlaceholderText: BuiltinQueries["queryByPlaceholderText"];
116
- /**
117
- * Returns every mapped widget with matching placeholder text. Widgets that are not mapped are never
118
- * matched. Throws when none match.
119
- */
49
+ /** Gets all mapped widgets with placeholder text. */
120
50
  declare const getAllByPlaceholderText: BuiltinQueries["getAllByPlaceholderText"];
121
- /**
122
- * Returns the single mapped widget with matching placeholder text. Widgets that are not mapped are
123
- * never matched. Throws when none or more than one matches.
124
- */
51
+ /** Gets one mapped widget by placeholder text. */
125
52
  declare const getByPlaceholderText: BuiltinQueries["getByPlaceholderText"];
126
- /**
127
- * Waits for and returns every mapped widget with matching placeholder text, retrying until at least
128
- * one appears or the timeout elapses. Widgets that are not mapped are never matched.
129
- */
53
+ /** Finds all mapped widgets with placeholder text. */
130
54
  declare const findAllByPlaceholderText: BuiltinQueries["findAllByPlaceholderText"];
131
- /**
132
- * Waits for and returns the single mapped widget with matching placeholder text, retrying until it
133
- * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none
134
- * or more than one matches.
135
- */
55
+ /** Finds one mapped widget by placeholder text. */
136
56
  declare const findByPlaceholderText: BuiltinQueries["findByPlaceholderText"];
137
- /**
138
- * Returns the single mapped widget with a matching display value, or null when none match. Widgets
139
- * that are not mapped are never matched. Throws when more than one matches.
140
- */
57
+ /** Queries one mapped widget by display value. */
141
58
  declare const queryByDisplayValue: BuiltinQueries["queryByDisplayValue"];
142
- /**
143
- * Returns every mapped widget with a matching display value. Widgets that are not mapped are never
144
- * matched. Throws when none match.
145
- */
59
+ /** Gets all mapped widgets with a display value. */
146
60
  declare const getAllByDisplayValue: BuiltinQueries["getAllByDisplayValue"];
147
- /**
148
- * Returns the single mapped widget with a matching display value. Widgets that are not mapped are
149
- * never matched. Throws when none or more than one matches.
150
- */
61
+ /** Gets one mapped widget by display value. */
151
62
  declare const getByDisplayValue: BuiltinQueries["getByDisplayValue"];
152
- /**
153
- * Waits for and returns every mapped widget with a matching display value, retrying until at least
154
- * one appears or the timeout elapses. Widgets that are not mapped are never matched.
155
- */
63
+ /** Finds all mapped widgets with a display value. */
156
64
  declare const findAllByDisplayValue: BuiltinQueries["findAllByDisplayValue"];
157
- /**
158
- * Waits for and returns the single mapped widget with a matching display value, retrying until it
159
- * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none
160
- * or more than one matches.
161
- */
65
+ /** Finds one mapped widget by display value. */
162
66
  declare const findByDisplayValue: BuiltinQueries["findByDisplayValue"];
163
67
  declare const isTextMatch: (actual: string | null, expected: Matcher, widget: Gtk.Widget, options?: MatcherOptions) => boolean;
164
68
  declare const isMatchingWidgetType: (widget: Gtk.Widget, options?: MatcherOptions) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,EACR,aAAa,EAEb,OAAO,EACP,cAAc,EAEd,aAAa,EAChB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAuBnE,6GAA6G;AAC7G,KAAK,cAAc,GA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AAc,GAAG,GAAG,CAAC,MAAM,EAAE,CAQxG;AAED;;;;;;GAMG;AACH,iBAAS,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,CAMnG;AAED;;;;;;GAMG;AACH,iBAAS,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,CAKnG;AAED;;;;;;GAMG;AACH,iBAAS,yBAAyB,CAC9B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,cAAc,GACzB,GAAG,CAAC,MAAM,EAAE,CAOd;AAED;;;;;;GAMG;AACH,iBAAS,sBAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,CAO5G;AAED,OAAO,EACH,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,sBAAsB,GACzB,CAAC"}
package/dist/queries.js CHANGED
@@ -18,161 +18,65 @@ const builtinQueries = {
18
18
  ...placeholderTextQueries,
19
19
  ...displayValueQueries,
20
20
  };
21
- /**
22
- * Returns the single mapped widget with a matching accessible role and options, or null when none
23
- * match. Widgets that are not mapped are never matched. Throws when more than one matches.
24
- */
21
+ /** Queries one mapped widget by accessible role. */
25
22
  const queryByRole = builtinQueries.queryByRole;
26
- /**
27
- * Returns every mapped widget with a matching accessible role and options. Widgets that are not
28
- * mapped are never matched. Throws when none match.
29
- */
23
+ /** Gets all mapped widgets with an accessible role. */
30
24
  const getAllByRole = builtinQueries.getAllByRole;
31
- /**
32
- * Returns the single mapped widget with a matching accessible role and options. Widgets that are not
33
- * mapped are never matched. Throws when none or more than one matches.
34
- */
25
+ /** Gets one mapped widget by accessible role. */
35
26
  const getByRole = builtinQueries.getByRole;
36
- /**
37
- * Waits for and returns every mapped widget with a matching accessible role and options, retrying
38
- * until at least one appears or the timeout elapses. Widgets that are not mapped are never matched.
39
- */
27
+ /** Finds all mapped widgets with an accessible role. */
40
28
  const findAllByRole = builtinQueries.findAllByRole;
41
- /**
42
- * Waits for and returns the single mapped widget with a matching accessible role and options,
43
- * retrying until it appears or the timeout elapses. Widgets that are not mapped are never matched.
44
- * Rejects when none or more than one matches.
45
- */
29
+ /** Finds one mapped widget by accessible role. */
46
30
  const findByRole = builtinQueries.findByRole;
47
- /**
48
- * Returns the single mapped widget with matching associated label text, or null when none match.
49
- * Widgets that are not mapped are never matched. Throws when more than one matches.
50
- */
31
+ /** Queries one mapped widget by label text. */
51
32
  const queryByLabelText = builtinQueries.queryByLabelText;
52
- /**
53
- * Returns every mapped widget with matching associated label text. Widgets that are not mapped are
54
- * never matched. Throws when none match.
55
- */
33
+ /** Gets all mapped widgets with label text. */
56
34
  const getAllByLabelText = builtinQueries.getAllByLabelText;
57
- /**
58
- * Returns the single mapped widget with matching associated label text. Widgets that are not mapped
59
- * are never matched. Throws when none or more than one matches.
60
- */
35
+ /** Gets one mapped widget by label text. */
61
36
  const getByLabelText = builtinQueries.getByLabelText;
62
- /**
63
- * Waits for and returns every mapped widget with matching associated label text, retrying until at
64
- * least one appears or the timeout elapses. Widgets that are not mapped are never matched.
65
- */
37
+ /** Finds all mapped widgets with label text. */
66
38
  const findAllByLabelText = builtinQueries.findAllByLabelText;
67
- /**
68
- * Waits for and returns the single mapped widget with matching associated label text, retrying until
69
- * it appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when
70
- * none or more than one matches.
71
- */
39
+ /** Finds one mapped widget by label text. */
72
40
  const findByLabelText = builtinQueries.findByLabelText;
73
- /**
74
- * Returns the single mapped widget with matching rendered text content, or null when none match.
75
- * Widgets that are not mapped are never matched. Throws when more than one matches.
76
- */
41
+ /** Queries one mapped widget by rendered text. */
77
42
  const queryByText = builtinQueries.queryByText;
78
- /**
79
- * Returns every mapped widget with matching rendered text content. Widgets that are not mapped are
80
- * never matched. Throws when none match.
81
- */
43
+ /** Gets all mapped widgets with rendered text. */
82
44
  const getAllByText = builtinQueries.getAllByText;
83
- /**
84
- * Returns the single mapped widget with matching rendered text content. Widgets that are not mapped
85
- * are never matched. Throws when none or more than one matches.
86
- */
45
+ /** Gets one mapped widget by rendered text. */
87
46
  const getByText = builtinQueries.getByText;
88
- /**
89
- * Waits for and returns every mapped widget with matching rendered text content, retrying until at
90
- * least one appears or the timeout elapses. Widgets that are not mapped are never matched.
91
- */
47
+ /** Finds all mapped widgets with rendered text. */
92
48
  const findAllByText = builtinQueries.findAllByText;
93
- /**
94
- * Waits for and returns the single mapped widget with matching rendered text content, retrying until
95
- * it appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when
96
- * none or more than one matches.
97
- */
49
+ /** Finds one mapped widget by rendered text. */
98
50
  const findByText = builtinQueries.findByText;
99
- /**
100
- * Returns the single mapped widget with a matching widget name, or null when none match. Widgets
101
- * that are not mapped are never matched. Throws when more than one matches.
102
- */
51
+ /** Queries one mapped widget by GTK name. */
103
52
  const queryByName = builtinQueries.queryByName;
104
- /**
105
- * Returns every mapped widget with a matching widget name. Widgets that are not mapped are never
106
- * matched. Throws when none match.
107
- */
53
+ /** Gets all mapped widgets with a GTK name. */
108
54
  const getAllByName = builtinQueries.getAllByName;
109
- /**
110
- * Returns the single mapped widget with a matching widget name. Widgets that are not mapped are
111
- * never matched. Throws when none or more than one matches.
112
- */
55
+ /** Gets one mapped widget by GTK name. */
113
56
  const getByName = builtinQueries.getByName;
114
- /**
115
- * Waits for and returns every mapped widget with a matching widget name, retrying until at least one
116
- * appears or the timeout elapses. Widgets that are not mapped are never matched.
117
- */
57
+ /** Finds all mapped widgets with a GTK name. */
118
58
  const findAllByName = builtinQueries.findAllByName;
119
- /**
120
- * Waits for and returns the single mapped widget with a matching widget name, retrying until it
121
- * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none
122
- * or more than one matches.
123
- */
59
+ /** Finds one mapped widget by GTK name. */
124
60
  const findByName = builtinQueries.findByName;
125
- /**
126
- * Returns the single mapped widget with matching placeholder text, or null when none match. Widgets
127
- * that are not mapped are never matched. Throws when more than one matches.
128
- */
61
+ /** Queries one mapped widget by placeholder text. */
129
62
  const queryByPlaceholderText = builtinQueries.queryByPlaceholderText;
130
- /**
131
- * Returns every mapped widget with matching placeholder text. Widgets that are not mapped are never
132
- * matched. Throws when none match.
133
- */
63
+ /** Gets all mapped widgets with placeholder text. */
134
64
  const getAllByPlaceholderText = builtinQueries.getAllByPlaceholderText;
135
- /**
136
- * Returns the single mapped widget with matching placeholder text. Widgets that are not mapped are
137
- * never matched. Throws when none or more than one matches.
138
- */
65
+ /** Gets one mapped widget by placeholder text. */
139
66
  const getByPlaceholderText = builtinQueries.getByPlaceholderText;
140
- /**
141
- * Waits for and returns every mapped widget with matching placeholder text, retrying until at least
142
- * one appears or the timeout elapses. Widgets that are not mapped are never matched.
143
- */
67
+ /** Finds all mapped widgets with placeholder text. */
144
68
  const findAllByPlaceholderText = builtinQueries.findAllByPlaceholderText;
145
- /**
146
- * Waits for and returns the single mapped widget with matching placeholder text, retrying until it
147
- * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none
148
- * or more than one matches.
149
- */
69
+ /** Finds one mapped widget by placeholder text. */
150
70
  const findByPlaceholderText = builtinQueries.findByPlaceholderText;
151
- /**
152
- * Returns the single mapped widget with a matching display value, or null when none match. Widgets
153
- * that are not mapped are never matched. Throws when more than one matches.
154
- */
71
+ /** Queries one mapped widget by display value. */
155
72
  const queryByDisplayValue = builtinQueries.queryByDisplayValue;
156
- /**
157
- * Returns every mapped widget with a matching display value. Widgets that are not mapped are never
158
- * matched. Throws when none match.
159
- */
73
+ /** Gets all mapped widgets with a display value. */
160
74
  const getAllByDisplayValue = builtinQueries.getAllByDisplayValue;
161
- /**
162
- * Returns the single mapped widget with a matching display value. Widgets that are not mapped are
163
- * never matched. Throws when none or more than one matches.
164
- */
75
+ /** Gets one mapped widget by display value. */
165
76
  const getByDisplayValue = builtinQueries.getByDisplayValue;
166
- /**
167
- * Waits for and returns every mapped widget with a matching display value, retrying until at least
168
- * one appears or the timeout elapses. Widgets that are not mapped are never matched.
169
- */
77
+ /** Finds all mapped widgets with a display value. */
170
78
  const findAllByDisplayValue = builtinQueries.findAllByDisplayValue;
171
- /**
172
- * Waits for and returns the single mapped widget with a matching display value, retrying until it
173
- * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none
174
- * or more than one matches.
175
- */
79
+ /** Finds one mapped widget by display value. */
176
80
  const findByDisplayValue = builtinQueries.findByDisplayValue;
177
81
  const buildNormalizer = (options) => {
178
82
  const { normalizer, trim, collapseWhitespace } = options ?? {};
@@ -1 +1 @@
1
- {"version":3,"file":"queries.js","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AASpC,OAAO,EAAE,YAAY,EAAsC,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAkB,OAAO,EAA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["import * as Gtk from \"@gtkx/gi/gtk\";\nimport type {\n ByRoleOptions,\n ByRoleValue,\n Matcher,\n MatcherOptions,\n NormalizerFn,\n QueryFamilies,\n} from \"./types.js\";\nimport { buildQueries, type BuiltQueries, type QueryAllBy } from \"./build-queries.js\";\nimport { multipleFoundError, notFoundError } from \"./errors.js\";\nimport { getDefaultNormalizer } from \"./normalize.js\";\nimport { type Container, findAll, traverse } from \"./traversal.js\";\nimport {\n getWidgetAccessibleName,\n getWidgetBusyState,\n getWidgetDescription,\n getWidgetDisplayValue,\n getWidgetExpandedState,\n getWidgetExternalLabelText,\n getWidgetLabelText,\n getWidgetLevel,\n getWidgetName,\n getWidgetOwnLabel,\n getWidgetPlaceholderText,\n getWidgetPressedState,\n getWidgetSelectedState,\n getWidgetValueText,\n isInaccessible,\n isWidgetChecked,\n isWidgetValueMatch,\n namingLabelText,\n type WidgetValueField,\n} from \"./widget-accessible-properties.js\";\n\n/** The built-in queries in their unbound form, each taking the container to search as its first argument. */\ntype BuiltinQueries = QueryFamilies<[container: Container]>;\n\nconst roleQueries = nameQueryFamily(\n \"Role\",\n queryAllByRole,\n buildQueries<[role: Gtk.AccessibleRole, options?: ByRoleOptions]>(\n queryAllByRole,\n (container, matches, role, options) =>\n multipleFoundError(container, { queryType: \"role\", role, options }, matches),\n (container, role, options) => notFoundError(container, { queryType: \"role\", role, options }),\n ),\n);\n\nconst labelTextQueries = nameQueryFamily(\n \"LabelText\",\n queryAllByLabelText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n queryAllByLabelText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"labelText\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"labelText\", text }),\n ),\n);\n\nconst textQueries = nameQueryFamily(\n \"Text\",\n queryAllByText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n queryAllByText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"text\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"text\", text }),\n ),\n);\n\nconst nameQueries = nameQueryFamily(\n \"Name\",\n queryAllByName,\n buildQueries<[name: Matcher, options?: MatcherOptions]>(\n queryAllByName,\n (container, matches, name) => multipleFoundError(container, { queryType: \"name\", name }, matches),\n (container, name) => notFoundError(container, { queryType: \"name\", name }),\n ),\n);\n\nconst placeholderTextQueries = nameQueryFamily(\n \"PlaceholderText\",\n queryAllByPlaceholderText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n queryAllByPlaceholderText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"placeholderText\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"placeholderText\", text }),\n ),\n);\n\nconst displayValueQueries = nameQueryFamily(\n \"DisplayValue\",\n queryAllByDisplayValue,\n buildQueries<[value: Matcher, options?: MatcherOptions]>(\n queryAllByDisplayValue,\n (container, matches, value) => multipleFoundError(container, { queryType: \"displayValue\", value }, matches),\n (container, value) => notFoundError(container, { queryType: \"displayValue\", value }),\n ),\n);\n\nconst builtinQueries = {\n ...roleQueries,\n ...labelTextQueries,\n ...textQueries,\n ...nameQueries,\n ...placeholderTextQueries,\n ...displayValueQueries,\n} as BuiltinQueries;\n\n/**\n * Returns the single mapped widget with a matching accessible role and options, or null when none\n * match. Widgets that are not mapped are never matched. Throws when more than one matches.\n */\nconst queryByRole: BuiltinQueries[\"queryByRole\"] = builtinQueries.queryByRole;\n/**\n * Returns every mapped widget with a matching accessible role and options. Widgets that are not\n * mapped are never matched. Throws when none match.\n */\nconst getAllByRole: BuiltinQueries[\"getAllByRole\"] = builtinQueries.getAllByRole;\n/**\n * Returns the single mapped widget with a matching accessible role and options. Widgets that are not\n * mapped are never matched. Throws when none or more than one matches.\n */\nconst getByRole: BuiltinQueries[\"getByRole\"] = builtinQueries.getByRole;\n/**\n * Waits for and returns every mapped widget with a matching accessible role and options, retrying\n * until at least one appears or the timeout elapses. Widgets that are not mapped are never matched.\n */\nconst findAllByRole: BuiltinQueries[\"findAllByRole\"] = builtinQueries.findAllByRole;\n/**\n * Waits for and returns the single mapped widget with a matching accessible role and options,\n * retrying until it appears or the timeout elapses. Widgets that are not mapped are never matched.\n * Rejects when none or more than one matches.\n */\nconst findByRole: BuiltinQueries[\"findByRole\"] = builtinQueries.findByRole;\n/**\n * Returns the single mapped widget with matching associated label text, or null when none match.\n * Widgets that are not mapped are never matched. Throws when more than one matches.\n */\nconst queryByLabelText: BuiltinQueries[\"queryByLabelText\"] = builtinQueries.queryByLabelText;\n/**\n * Returns every mapped widget with matching associated label text. Widgets that are not mapped are\n * never matched. Throws when none match.\n */\nconst getAllByLabelText: BuiltinQueries[\"getAllByLabelText\"] = builtinQueries.getAllByLabelText;\n/**\n * Returns the single mapped widget with matching associated label text. Widgets that are not mapped\n * are never matched. Throws when none or more than one matches.\n */\nconst getByLabelText: BuiltinQueries[\"getByLabelText\"] = builtinQueries.getByLabelText;\n/**\n * Waits for and returns every mapped widget with matching associated label text, retrying until at\n * least one appears or the timeout elapses. Widgets that are not mapped are never matched.\n */\nconst findAllByLabelText: BuiltinQueries[\"findAllByLabelText\"] = builtinQueries.findAllByLabelText;\n/**\n * Waits for and returns the single mapped widget with matching associated label text, retrying until\n * it appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when\n * none or more than one matches.\n */\nconst findByLabelText: BuiltinQueries[\"findByLabelText\"] = builtinQueries.findByLabelText;\n/**\n * Returns the single mapped widget with matching rendered text content, or null when none match.\n * Widgets that are not mapped are never matched. Throws when more than one matches.\n */\nconst queryByText: BuiltinQueries[\"queryByText\"] = builtinQueries.queryByText;\n/**\n * Returns every mapped widget with matching rendered text content. Widgets that are not mapped are\n * never matched. Throws when none match.\n */\nconst getAllByText: BuiltinQueries[\"getAllByText\"] = builtinQueries.getAllByText;\n/**\n * Returns the single mapped widget with matching rendered text content. Widgets that are not mapped\n * are never matched. Throws when none or more than one matches.\n */\nconst getByText: BuiltinQueries[\"getByText\"] = builtinQueries.getByText;\n/**\n * Waits for and returns every mapped widget with matching rendered text content, retrying until at\n * least one appears or the timeout elapses. Widgets that are not mapped are never matched.\n */\nconst findAllByText: BuiltinQueries[\"findAllByText\"] = builtinQueries.findAllByText;\n/**\n * Waits for and returns the single mapped widget with matching rendered text content, retrying until\n * it appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when\n * none or more than one matches.\n */\nconst findByText: BuiltinQueries[\"findByText\"] = builtinQueries.findByText;\n/**\n * Returns the single mapped widget with a matching widget name, or null when none match. Widgets\n * that are not mapped are never matched. Throws when more than one matches.\n */\nconst queryByName: BuiltinQueries[\"queryByName\"] = builtinQueries.queryByName;\n/**\n * Returns every mapped widget with a matching widget name. Widgets that are not mapped are never\n * matched. Throws when none match.\n */\nconst getAllByName: BuiltinQueries[\"getAllByName\"] = builtinQueries.getAllByName;\n/**\n * Returns the single mapped widget with a matching widget name. Widgets that are not mapped are\n * never matched. Throws when none or more than one matches.\n */\nconst getByName: BuiltinQueries[\"getByName\"] = builtinQueries.getByName;\n/**\n * Waits for and returns every mapped widget with a matching widget name, retrying until at least one\n * appears or the timeout elapses. Widgets that are not mapped are never matched.\n */\nconst findAllByName: BuiltinQueries[\"findAllByName\"] = builtinQueries.findAllByName;\n/**\n * Waits for and returns the single mapped widget with a matching widget name, retrying until it\n * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none\n * or more than one matches.\n */\nconst findByName: BuiltinQueries[\"findByName\"] = builtinQueries.findByName;\n/**\n * Returns the single mapped widget with matching placeholder text, or null when none match. Widgets\n * that are not mapped are never matched. Throws when more than one matches.\n */\nconst queryByPlaceholderText: BuiltinQueries[\"queryByPlaceholderText\"] = builtinQueries.queryByPlaceholderText;\n/**\n * Returns every mapped widget with matching placeholder text. Widgets that are not mapped are never\n * matched. Throws when none match.\n */\nconst getAllByPlaceholderText: BuiltinQueries[\"getAllByPlaceholderText\"] = builtinQueries.getAllByPlaceholderText;\n/**\n * Returns the single mapped widget with matching placeholder text. Widgets that are not mapped are\n * never matched. Throws when none or more than one matches.\n */\nconst getByPlaceholderText: BuiltinQueries[\"getByPlaceholderText\"] = builtinQueries.getByPlaceholderText;\n/**\n * Waits for and returns every mapped widget with matching placeholder text, retrying until at least\n * one appears or the timeout elapses. Widgets that are not mapped are never matched.\n */\nconst findAllByPlaceholderText: BuiltinQueries[\"findAllByPlaceholderText\"] = builtinQueries.findAllByPlaceholderText;\n/**\n * Waits for and returns the single mapped widget with matching placeholder text, retrying until it\n * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none\n * or more than one matches.\n */\nconst findByPlaceholderText: BuiltinQueries[\"findByPlaceholderText\"] = builtinQueries.findByPlaceholderText;\n/**\n * Returns the single mapped widget with a matching display value, or null when none match. Widgets\n * that are not mapped are never matched. Throws when more than one matches.\n */\nconst queryByDisplayValue: BuiltinQueries[\"queryByDisplayValue\"] = builtinQueries.queryByDisplayValue;\n/**\n * Returns every mapped widget with a matching display value. Widgets that are not mapped are never\n * matched. Throws when none match.\n */\nconst getAllByDisplayValue: BuiltinQueries[\"getAllByDisplayValue\"] = builtinQueries.getAllByDisplayValue;\n/**\n * Returns the single mapped widget with a matching display value. Widgets that are not mapped are\n * never matched. Throws when none or more than one matches.\n */\nconst getByDisplayValue: BuiltinQueries[\"getByDisplayValue\"] = builtinQueries.getByDisplayValue;\n/**\n * Waits for and returns every mapped widget with a matching display value, retrying until at least\n * one appears or the timeout elapses. Widgets that are not mapped are never matched.\n */\nconst findAllByDisplayValue: BuiltinQueries[\"findAllByDisplayValue\"] = builtinQueries.findAllByDisplayValue;\n/**\n * Waits for and returns the single mapped widget with a matching display value, retrying until it\n * appears or the timeout elapses. Widgets that are not mapped are never matched. Rejects when none\n * or more than one matches.\n */\nconst findByDisplayValue: BuiltinQueries[\"findByDisplayValue\"] = builtinQueries.findByDisplayValue;\n\nconst buildNormalizer = (options?: MatcherOptions): NormalizerFn => {\n const { normalizer, trim, collapseWhitespace } = options ?? {};\n\n if (!normalizer) {\n return getDefaultNormalizer({ trim, collapseWhitespace });\n }\n\n if (trim !== undefined || collapseWhitespace !== undefined) {\n throw new Error(\n \"trim and collapseWhitespace are not supported with a normalizer. \" +\n \"If you want to use the default trim and collapseWhitespace logic in your normalizer, \" +\n \"use \\\"getDefaultNormalizer({ trim, collapseWhitespace })\\\" and compose that into your normalizer\",\n );\n }\n\n return normalizer;\n};\n\nconst normalizeText = (text: string, options?: MatcherOptions): string => {\n const normalizer = buildNormalizer(options);\n\n return normalizer(text);\n};\n\nconst isTextMatch = (\n actual: string | null,\n expected: Matcher,\n widget: Gtk.Widget,\n options?: MatcherOptions,\n): boolean => {\n if (actual === null) {\n return false;\n }\n\n const normalizedActual = normalizeText(actual, options);\n\n if (typeof expected === \"function\") {\n return expected(normalizedActual, widget);\n }\n\n if (expected instanceof RegExp) {\n expected.lastIndex = 0;\n\n return expected.test(normalizedActual);\n }\n\n const normalizedExpected = normalizeText(String(expected), options);\n const isExact = options?.exact ?? true;\n\n return isExact\n ? normalizedActual === normalizedExpected\n : normalizedActual.toLowerCase().includes(normalizedExpected.toLowerCase());\n};\n\nconst hasMatchingAccessibleName = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {\n if (options.name === undefined) {\n return true;\n }\n\n const text = getWidgetAccessibleName(widget);\n\n return isTextMatch(text, options.name, widget, options);\n};\n\nconst isNumericValueMatch = (widget: Gtk.Widget, field: WidgetValueField, expected: number | undefined): boolean =>\n expected === undefined || isWidgetValueMatch(widget, field, expected);\n\nconst hasMatchingAccessibleValue = (widget: Gtk.Widget, value: ByRoleValue, options: ByRoleOptions): boolean => {\n const numericChecks: [WidgetValueField, number | undefined][] = [\n [\"now\", value.now],\n [\"min\", value.min],\n [\"max\", value.max],\n ];\n\n for (const [field, expected] of numericChecks) {\n if (!isNumericValueMatch(widget, field, expected)) {\n return false;\n }\n }\n\n return value.text === undefined || isTextMatch(getWidgetValueText(widget), value.text, widget, options);\n};\n\nconst hasMatchingBooleanStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {\n const stateChecks: [boolean | undefined, () => boolean | null][] = [\n [options.checked, () => isWidgetChecked(widget)],\n [options.pressed, () => getWidgetPressedState(widget)],\n [options.expanded, () => getWidgetExpandedState(widget)],\n [options.selected, () => getWidgetSelectedState(widget)],\n [options.busy, () => getWidgetBusyState(widget) ?? false],\n ];\n\n for (const [expected, getActual] of stateChecks) {\n if (expected !== undefined && getActual() !== expected) {\n return false;\n }\n }\n\n return true;\n};\n\nconst hasMatchingLevelState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>\n options.level === undefined || getWidgetLevel(widget) === options.level;\n\nconst hasMatchingDescriptionState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>\n options.description === undefined ||\n isTextMatch(getWidgetDescription(widget), options.description, widget, options);\n\nconst hasMatchingValueState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>\n options.value === undefined || hasMatchingAccessibleValue(widget, options.value, options);\n\nconst hasMatchingAccessibleStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>\n hasMatchingBooleanStates(widget, options) &&\n hasMatchingLevelState(widget, options) &&\n hasMatchingDescriptionState(widget, options) &&\n hasMatchingValueState(widget, options);\n\nconst isMatchingWidgetType = (widget: Gtk.Widget, options?: MatcherOptions): boolean =>\n options?.as === undefined || widget instanceof options.as;\n\nconst hasMatchingByRoleOptions = (widget: Gtk.Widget, options?: ByRoleOptions): boolean => {\n if (!options) {\n return true;\n }\n\n return (\n isMatchingWidgetType(widget, options) &&\n hasMatchingAccessibleName(widget, options) &&\n hasMatchingAccessibleStates(widget, options)\n );\n};\n\nfunction nameQueryFamily<Args extends unknown[]>(\n suffix: string,\n queryAllBy: QueryAllBy<Args>,\n built: BuiltQueries<Args>,\n): Record<string, unknown> {\n const [queryBy, getAllBy, getBy, findAllBy, findBy] = built;\n\n return {\n [`queryBy${suffix}`]: queryBy,\n [`queryAllBy${suffix}`]: queryAllBy,\n [`getBy${suffix}`]: getBy,\n [`getAllBy${suffix}`]: getAllBy,\n [`findBy${suffix}`]: findBy,\n [`findAllBy${suffix}`]: findAllBy,\n };\n}\n\n/**\n * Finds every widget under the container whose accessible role matches `role` and that satisfies the given options.\n * Widgets that are not mapped are never matched, and widgets excluded from the accessibility tree are\n * skipped unless `options.hidden` is set.\n * @param container Widget subtree to search.\n * @param role Accessible role to match.\n * @param options Additional accessible name, state, and value constraints.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByRole(\n container: Container,\n role: Gtk.AccessibleRole,\n options?: ByRoleOptions,\n): Gtk.Widget[] {\n return findAll(container, (widget) => {\n if (widget.getAccessibleRole() !== role) {\n return false;\n }\n\n if (!options?.hidden && isInaccessible(widget)) {\n return false;\n }\n\n return hasMatchingByRoleOptions(widget, options);\n });\n}\n\nconst collectMnemonicMatch = (\n widget: Gtk.Widget,\n text: Matcher,\n options: MatcherOptions | undefined,\n): Gtk.Widget | null => {\n if (!(widget instanceof Gtk.Label)) {\n return null;\n }\n\n const labelText = namingLabelText(widget);\n\n if (!labelText || !isTextMatch(labelText, text, widget, options)) {\n return null;\n }\n\n return widget.getMnemonicWidget();\n};\n\nconst labellingText = (widget: Gtk.Widget): string | null => {\n const ownLabel = widget.getAccessibleRole() === Gtk.AccessibleRole.LABEL ? null : getWidgetOwnLabel(widget);\n\n return ownLabel ?? getWidgetExternalLabelText(widget);\n};\n\nconst collectLabelMatches = (\n results: Set<Gtk.Widget>,\n widget: Gtk.Widget,\n text: Matcher,\n options: MatcherOptions | undefined,\n): void => {\n const mnemonicTarget = collectMnemonicMatch(widget, text, options);\n\n if (mnemonicTarget) {\n results.add(mnemonicTarget);\n }\n\n const labelText = labellingText(widget);\n\n if (labelText !== null && isTextMatch(labelText, text, widget, options)) {\n results.add(widget);\n }\n};\n\n/**\n * Finds every widget associated with a label whose text matches: a Gtk.Label mnemonic target, the\n * widget's own accessible label, or its labelled-by relation. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param text Matcher for the label text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByLabelText(container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] {\n const results: Set<Gtk.Widget> = new Set();\n\n for (const widget of traverse(container)) {\n collectLabelMatches(results, widget, text, options);\n }\n\n return [...results].filter((widget) => isMatchingWidgetType(widget, options));\n}\n\n/**\n * Finds every widget whose rendered text content matches. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param text Matcher for the widget text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByText(container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] {\n return findAll(\n container,\n (widget) =>\n isMatchingWidgetType(widget, options) && isTextMatch(getWidgetLabelText(widget), text, widget, options),\n );\n}\n\n/**\n * Finds every widget whose widget name matches. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param name Matcher for the widget name.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByName(container: Container, name: Matcher, options?: MatcherOptions): Gtk.Widget[] {\n return findAll(\n container,\n (widget) => isMatchingWidgetType(widget, options) && isTextMatch(getWidgetName(widget), name, widget, options),\n );\n}\n\n/**\n * Finds every widget whose placeholder text matches. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param text Matcher for the placeholder text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByPlaceholderText(\n container: Container,\n text: Matcher,\n options?: MatcherOptions,\n): Gtk.Widget[] {\n return findAll(\n container,\n (widget) =>\n isMatchingWidgetType(widget, options) &&\n isTextMatch(getWidgetPlaceholderText(widget), text, widget, options),\n );\n}\n\n/**\n * Finds every widget whose current display value matches. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param value Matcher for the display value.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByDisplayValue(container: Container, value: Matcher, options?: MatcherOptions): Gtk.Widget[] {\n return findAll(\n container,\n (widget) =>\n isMatchingWidgetType(widget, options) &&\n isTextMatch(getWidgetDisplayValue(widget), value, widget, options),\n );\n}\n\nexport {\n builtinQueries,\n isMatchingWidgetType,\n isTextMatch,\n queryByRole,\n getAllByRole,\n getByRole,\n findAllByRole,\n findByRole,\n queryByLabelText,\n getAllByLabelText,\n getByLabelText,\n findAllByLabelText,\n findByLabelText,\n queryByText,\n getAllByText,\n getByText,\n findAllByText,\n findByText,\n queryByName,\n getAllByName,\n getByName,\n findAllByName,\n findByName,\n queryByPlaceholderText,\n getAllByPlaceholderText,\n getByPlaceholderText,\n findAllByPlaceholderText,\n findByPlaceholderText,\n queryByDisplayValue,\n getAllByDisplayValue,\n getByDisplayValue,\n findAllByDisplayValue,\n findByDisplayValue,\n queryAllByRole,\n queryAllByLabelText,\n queryAllByText,\n queryAllByName,\n queryAllByPlaceholderText,\n queryAllByDisplayValue,\n};\n"]}
1
+ {"version":3,"file":"queries.js","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AASpC,OAAO,EAAE,YAAY,EAAsC,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAkB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EACH,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,eAAe,GAElB,MAAM,mCAAmC,CAAC;AAK3C,MAAM,WAAW,GAAG,eAAe,CAC/B,MAAM,EACN,cAAc,EACd,YAAY,CACR,cAAc,EACd,CAAC,SAAS,EAAE,OAAO,EAAE,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AE,OAAO,CAAC,CAC3E,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,SAAS,sBAAsB,CAAC,SAAoB,EAAE,KAAc,EAAE,OAAwB;IAC1F,OAAO,OAAO,CACV,SAAS,EACT,CAAC,MAAM,EAAE,EAAE,CACP,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC;QACrC,WAAW,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CACzE,CAAC;AACN,CAAC;AAED,OAAO,EACH,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,sBAAsB,GACzB,CAAC","sourcesContent":["import * as Gtk from \"@gtkx/gi/gtk\";\nimport type {\n ByRoleOptions,\n ByRoleValue,\n Matcher,\n MatcherOptions,\n NormalizerFn,\n QueryFamilies,\n} from \"./types.js\";\nimport { buildQueries, type BuiltQueries, type QueryAllBy } from \"./build-queries.js\";\nimport { multipleFoundError, notFoundError } from \"./errors.js\";\nimport { getDefaultNormalizer } from \"./normalize.js\";\nimport { type Container, findAll, traverse } from \"./traversal.js\";\nimport {\n getWidgetAccessibleName,\n getWidgetBusyState,\n getWidgetDescription,\n getWidgetDisplayValue,\n getWidgetExpandedState,\n getWidgetExternalLabelText,\n getWidgetLabelText,\n getWidgetLevel,\n getWidgetName,\n getWidgetOwnLabel,\n getWidgetPlaceholderText,\n getWidgetPressedState,\n getWidgetSelectedState,\n getWidgetValueText,\n isInaccessible,\n isWidgetChecked,\n isWidgetValueMatch,\n namingLabelText,\n type WidgetValueField,\n} from \"./widget-accessible-properties.js\";\n\n/** The built-in queries in their unbound form, each taking the container to search as its first argument. */\ntype BuiltinQueries = QueryFamilies<[container: Container]>;\n\nconst roleQueries = nameQueryFamily(\n \"Role\",\n queryAllByRole,\n buildQueries<[role: Gtk.AccessibleRole, options?: ByRoleOptions]>(\n queryAllByRole,\n (container, matches, role, options) =>\n multipleFoundError(container, { queryType: \"role\", role, options }, matches),\n (container, role, options) => notFoundError(container, { queryType: \"role\", role, options }),\n ),\n);\n\nconst labelTextQueries = nameQueryFamily(\n \"LabelText\",\n queryAllByLabelText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n queryAllByLabelText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"labelText\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"labelText\", text }),\n ),\n);\n\nconst textQueries = nameQueryFamily(\n \"Text\",\n queryAllByText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n queryAllByText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"text\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"text\", text }),\n ),\n);\n\nconst nameQueries = nameQueryFamily(\n \"Name\",\n queryAllByName,\n buildQueries<[name: Matcher, options?: MatcherOptions]>(\n queryAllByName,\n (container, matches, name) => multipleFoundError(container, { queryType: \"name\", name }, matches),\n (container, name) => notFoundError(container, { queryType: \"name\", name }),\n ),\n);\n\nconst placeholderTextQueries = nameQueryFamily(\n \"PlaceholderText\",\n queryAllByPlaceholderText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n queryAllByPlaceholderText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"placeholderText\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"placeholderText\", text }),\n ),\n);\n\nconst displayValueQueries = nameQueryFamily(\n \"DisplayValue\",\n queryAllByDisplayValue,\n buildQueries<[value: Matcher, options?: MatcherOptions]>(\n queryAllByDisplayValue,\n (container, matches, value) => multipleFoundError(container, { queryType: \"displayValue\", value }, matches),\n (container, value) => notFoundError(container, { queryType: \"displayValue\", value }),\n ),\n);\n\nconst builtinQueries = {\n ...roleQueries,\n ...labelTextQueries,\n ...textQueries,\n ...nameQueries,\n ...placeholderTextQueries,\n ...displayValueQueries,\n} as BuiltinQueries;\n\n/** Queries one mapped widget by accessible role. */\nconst queryByRole: BuiltinQueries[\"queryByRole\"] = builtinQueries.queryByRole;\n/** Gets all mapped widgets with an accessible role. */\nconst getAllByRole: BuiltinQueries[\"getAllByRole\"] = builtinQueries.getAllByRole;\n/** Gets one mapped widget by accessible role. */\nconst getByRole: BuiltinQueries[\"getByRole\"] = builtinQueries.getByRole;\n/** Finds all mapped widgets with an accessible role. */\nconst findAllByRole: BuiltinQueries[\"findAllByRole\"] = builtinQueries.findAllByRole;\n/** Finds one mapped widget by accessible role. */\nconst findByRole: BuiltinQueries[\"findByRole\"] = builtinQueries.findByRole;\n/** Queries one mapped widget by label text. */\nconst queryByLabelText: BuiltinQueries[\"queryByLabelText\"] = builtinQueries.queryByLabelText;\n/** Gets all mapped widgets with label text. */\nconst getAllByLabelText: BuiltinQueries[\"getAllByLabelText\"] = builtinQueries.getAllByLabelText;\n/** Gets one mapped widget by label text. */\nconst getByLabelText: BuiltinQueries[\"getByLabelText\"] = builtinQueries.getByLabelText;\n/** Finds all mapped widgets with label text. */\nconst findAllByLabelText: BuiltinQueries[\"findAllByLabelText\"] = builtinQueries.findAllByLabelText;\n/** Finds one mapped widget by label text. */\nconst findByLabelText: BuiltinQueries[\"findByLabelText\"] = builtinQueries.findByLabelText;\n/** Queries one mapped widget by rendered text. */\nconst queryByText: BuiltinQueries[\"queryByText\"] = builtinQueries.queryByText;\n/** Gets all mapped widgets with rendered text. */\nconst getAllByText: BuiltinQueries[\"getAllByText\"] = builtinQueries.getAllByText;\n/** Gets one mapped widget by rendered text. */\nconst getByText: BuiltinQueries[\"getByText\"] = builtinQueries.getByText;\n/** Finds all mapped widgets with rendered text. */\nconst findAllByText: BuiltinQueries[\"findAllByText\"] = builtinQueries.findAllByText;\n/** Finds one mapped widget by rendered text. */\nconst findByText: BuiltinQueries[\"findByText\"] = builtinQueries.findByText;\n/** Queries one mapped widget by GTK name. */\nconst queryByName: BuiltinQueries[\"queryByName\"] = builtinQueries.queryByName;\n/** Gets all mapped widgets with a GTK name. */\nconst getAllByName: BuiltinQueries[\"getAllByName\"] = builtinQueries.getAllByName;\n/** Gets one mapped widget by GTK name. */\nconst getByName: BuiltinQueries[\"getByName\"] = builtinQueries.getByName;\n/** Finds all mapped widgets with a GTK name. */\nconst findAllByName: BuiltinQueries[\"findAllByName\"] = builtinQueries.findAllByName;\n/** Finds one mapped widget by GTK name. */\nconst findByName: BuiltinQueries[\"findByName\"] = builtinQueries.findByName;\n/** Queries one mapped widget by placeholder text. */\nconst queryByPlaceholderText: BuiltinQueries[\"queryByPlaceholderText\"] = builtinQueries.queryByPlaceholderText;\n/** Gets all mapped widgets with placeholder text. */\nconst getAllByPlaceholderText: BuiltinQueries[\"getAllByPlaceholderText\"] = builtinQueries.getAllByPlaceholderText;\n/** Gets one mapped widget by placeholder text. */\nconst getByPlaceholderText: BuiltinQueries[\"getByPlaceholderText\"] = builtinQueries.getByPlaceholderText;\n/** Finds all mapped widgets with placeholder text. */\nconst findAllByPlaceholderText: BuiltinQueries[\"findAllByPlaceholderText\"] = builtinQueries.findAllByPlaceholderText;\n/** Finds one mapped widget by placeholder text. */\nconst findByPlaceholderText: BuiltinQueries[\"findByPlaceholderText\"] = builtinQueries.findByPlaceholderText;\n/** Queries one mapped widget by display value. */\nconst queryByDisplayValue: BuiltinQueries[\"queryByDisplayValue\"] = builtinQueries.queryByDisplayValue;\n/** Gets all mapped widgets with a display value. */\nconst getAllByDisplayValue: BuiltinQueries[\"getAllByDisplayValue\"] = builtinQueries.getAllByDisplayValue;\n/** Gets one mapped widget by display value. */\nconst getByDisplayValue: BuiltinQueries[\"getByDisplayValue\"] = builtinQueries.getByDisplayValue;\n/** Finds all mapped widgets with a display value. */\nconst findAllByDisplayValue: BuiltinQueries[\"findAllByDisplayValue\"] = builtinQueries.findAllByDisplayValue;\n/** Finds one mapped widget by display value. */\nconst findByDisplayValue: BuiltinQueries[\"findByDisplayValue\"] = builtinQueries.findByDisplayValue;\n\nconst buildNormalizer = (options?: MatcherOptions): NormalizerFn => {\n const { normalizer, trim, collapseWhitespace } = options ?? {};\n\n if (!normalizer) {\n return getDefaultNormalizer({ trim, collapseWhitespace });\n }\n\n if (trim !== undefined || collapseWhitespace !== undefined) {\n throw new Error(\n \"trim and collapseWhitespace are not supported with a normalizer. \" +\n \"If you want to use the default trim and collapseWhitespace logic in your normalizer, \" +\n \"use \\\"getDefaultNormalizer({ trim, collapseWhitespace })\\\" and compose that into your normalizer\",\n );\n }\n\n return normalizer;\n};\n\nconst normalizeText = (text: string, options?: MatcherOptions): string => {\n const normalizer = buildNormalizer(options);\n\n return normalizer(text);\n};\n\nconst isTextMatch = (\n actual: string | null,\n expected: Matcher,\n widget: Gtk.Widget,\n options?: MatcherOptions,\n): boolean => {\n if (actual === null) {\n return false;\n }\n\n const normalizedActual = normalizeText(actual, options);\n\n if (typeof expected === \"function\") {\n return expected(normalizedActual, widget);\n }\n\n if (expected instanceof RegExp) {\n expected.lastIndex = 0;\n\n return expected.test(normalizedActual);\n }\n\n const normalizedExpected = normalizeText(String(expected), options);\n const isExact = options?.exact ?? true;\n\n return isExact\n ? normalizedActual === normalizedExpected\n : normalizedActual.toLowerCase().includes(normalizedExpected.toLowerCase());\n};\n\nconst hasMatchingAccessibleName = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {\n if (options.name === undefined) {\n return true;\n }\n\n const text = getWidgetAccessibleName(widget);\n\n return isTextMatch(text, options.name, widget, options);\n};\n\nconst isNumericValueMatch = (widget: Gtk.Widget, field: WidgetValueField, expected: number | undefined): boolean =>\n expected === undefined || isWidgetValueMatch(widget, field, expected);\n\nconst hasMatchingAccessibleValue = (widget: Gtk.Widget, value: ByRoleValue, options: ByRoleOptions): boolean => {\n const numericChecks: [WidgetValueField, number | undefined][] = [\n [\"now\", value.now],\n [\"min\", value.min],\n [\"max\", value.max],\n ];\n\n for (const [field, expected] of numericChecks) {\n if (!isNumericValueMatch(widget, field, expected)) {\n return false;\n }\n }\n\n return value.text === undefined || isTextMatch(getWidgetValueText(widget), value.text, widget, options);\n};\n\nconst hasMatchingBooleanStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {\n const stateChecks: [boolean | undefined, () => boolean | null][] = [\n [options.checked, () => isWidgetChecked(widget)],\n [options.pressed, () => getWidgetPressedState(widget)],\n [options.expanded, () => getWidgetExpandedState(widget)],\n [options.selected, () => getWidgetSelectedState(widget)],\n [options.busy, () => getWidgetBusyState(widget) ?? false],\n ];\n\n for (const [expected, getActual] of stateChecks) {\n if (expected !== undefined && getActual() !== expected) {\n return false;\n }\n }\n\n return true;\n};\n\nconst hasMatchingLevelState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>\n options.level === undefined || getWidgetLevel(widget) === options.level;\n\nconst hasMatchingDescriptionState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>\n options.description === undefined ||\n isTextMatch(getWidgetDescription(widget), options.description, widget, options);\n\nconst hasMatchingValueState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>\n options.value === undefined || hasMatchingAccessibleValue(widget, options.value, options);\n\nconst hasMatchingAccessibleStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>\n hasMatchingBooleanStates(widget, options) &&\n hasMatchingLevelState(widget, options) &&\n hasMatchingDescriptionState(widget, options) &&\n hasMatchingValueState(widget, options);\n\nconst isMatchingWidgetType = (widget: Gtk.Widget, options?: MatcherOptions): boolean =>\n options?.as === undefined || widget instanceof options.as;\n\nconst hasMatchingByRoleOptions = (widget: Gtk.Widget, options?: ByRoleOptions): boolean => {\n if (!options) {\n return true;\n }\n\n return (\n isMatchingWidgetType(widget, options) &&\n hasMatchingAccessibleName(widget, options) &&\n hasMatchingAccessibleStates(widget, options)\n );\n};\n\nfunction nameQueryFamily<Args extends unknown[]>(\n suffix: string,\n queryAllBy: QueryAllBy<Args>,\n built: BuiltQueries<Args>,\n): Record<string, unknown> {\n const [queryBy, getAllBy, getBy, findAllBy, findBy] = built;\n\n return {\n [`queryBy${suffix}`]: queryBy,\n [`queryAllBy${suffix}`]: queryAllBy,\n [`getBy${suffix}`]: getBy,\n [`getAllBy${suffix}`]: getAllBy,\n [`findBy${suffix}`]: findBy,\n [`findAllBy${suffix}`]: findAllBy,\n };\n}\n\n/**\n * Finds every widget under the container whose accessible role matches `role` and that satisfies the given options.\n * Widgets that are not mapped are never matched, and widgets excluded from the accessibility tree are\n * skipped unless `options.hidden` is set.\n * @param container Widget subtree to search.\n * @param role Accessible role to match.\n * @param options Additional accessible name, state, and value constraints.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByRole(\n container: Container,\n role: Gtk.AccessibleRole,\n options?: ByRoleOptions,\n): Gtk.Widget[] {\n return findAll(container, (widget) => {\n if (widget.getAccessibleRole() !== role) {\n return false;\n }\n\n if (!options?.hidden && isInaccessible(widget)) {\n return false;\n }\n\n return hasMatchingByRoleOptions(widget, options);\n });\n}\n\nconst collectMnemonicMatch = (\n widget: Gtk.Widget,\n text: Matcher,\n options: MatcherOptions | undefined,\n): Gtk.Widget | null => {\n if (!(widget instanceof Gtk.Label)) {\n return null;\n }\n\n const labelText = namingLabelText(widget);\n\n if (!labelText || !isTextMatch(labelText, text, widget, options)) {\n return null;\n }\n\n return widget.getMnemonicWidget();\n};\n\nconst labellingText = (widget: Gtk.Widget): string | null => {\n const ownLabel = widget.getAccessibleRole() === Gtk.AccessibleRole.LABEL ? null : getWidgetOwnLabel(widget);\n\n return ownLabel ?? getWidgetExternalLabelText(widget);\n};\n\nconst collectLabelMatches = (\n results: Set<Gtk.Widget>,\n widget: Gtk.Widget,\n text: Matcher,\n options: MatcherOptions | undefined,\n): void => {\n const mnemonicTarget = collectMnemonicMatch(widget, text, options);\n\n if (mnemonicTarget) {\n results.add(mnemonicTarget);\n }\n\n const labelText = labellingText(widget);\n\n if (labelText !== null && isTextMatch(labelText, text, widget, options)) {\n results.add(widget);\n }\n};\n\n/**\n * Finds every widget associated with a label whose text matches: a Gtk.Label mnemonic target, the\n * widget's own accessible label, or its labelled-by relation. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param text Matcher for the label text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByLabelText(container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] {\n const results: Set<Gtk.Widget> = new Set();\n\n for (const widget of traverse(container)) {\n collectLabelMatches(results, widget, text, options);\n }\n\n return [...results].filter((widget) => isMatchingWidgetType(widget, options));\n}\n\n/**\n * Finds every widget whose rendered text content matches. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param text Matcher for the widget text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByText(container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] {\n return findAll(\n container,\n (widget) =>\n isMatchingWidgetType(widget, options) && isTextMatch(getWidgetLabelText(widget), text, widget, options),\n );\n}\n\n/**\n * Finds every widget whose widget name matches. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param name Matcher for the widget name.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByName(container: Container, name: Matcher, options?: MatcherOptions): Gtk.Widget[] {\n return findAll(\n container,\n (widget) => isMatchingWidgetType(widget, options) && isTextMatch(getWidgetName(widget), name, widget, options),\n );\n}\n\n/**\n * Finds every widget whose placeholder text matches. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param text Matcher for the placeholder text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByPlaceholderText(\n container: Container,\n text: Matcher,\n options?: MatcherOptions,\n): Gtk.Widget[] {\n return findAll(\n container,\n (widget) =>\n isMatchingWidgetType(widget, options) &&\n isTextMatch(getWidgetPlaceholderText(widget), text, widget, options),\n );\n}\n\n/**\n * Finds every widget whose current display value matches. Widgets that are not mapped are never matched.\n * @param container Widget subtree to search.\n * @param value Matcher for the display value.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByDisplayValue(container: Container, value: Matcher, options?: MatcherOptions): Gtk.Widget[] {\n return findAll(\n container,\n (widget) =>\n isMatchingWidgetType(widget, options) &&\n isTextMatch(getWidgetDisplayValue(widget), value, widget, options),\n );\n}\n\nexport {\n builtinQueries,\n isMatchingWidgetType,\n isTextMatch,\n queryByRole,\n getAllByRole,\n getByRole,\n findAllByRole,\n findByRole,\n queryByLabelText,\n getAllByLabelText,\n getByLabelText,\n findAllByLabelText,\n findByLabelText,\n queryByText,\n getAllByText,\n getByText,\n findAllByText,\n findByText,\n queryByName,\n getAllByName,\n getByName,\n findAllByName,\n findByName,\n queryByPlaceholderText,\n getAllByPlaceholderText,\n getByPlaceholderText,\n findAllByPlaceholderText,\n findByPlaceholderText,\n queryByDisplayValue,\n getAllByDisplayValue,\n getByDisplayValue,\n findAllByDisplayValue,\n findByDisplayValue,\n queryAllByRole,\n queryAllByLabelText,\n queryAllByText,\n queryAllByName,\n queryAllByPlaceholderText,\n queryAllByDisplayValue,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"query-helpers.d.ts","sourceRoot":"","sources":["../src/query-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE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G;AAClG,KAAK,YAAY,GAAG;IAChB,wEAAwE;IACxE,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,+CAA+C;IAC/C,eAAe,EAAE,OAAO,eAAe,CAAC;IACxC,yDAAyD;IACzD,wBAAwB,EAAE,OAAO,wBAAwB,CAAC;IAC1D,8DAA8D;IAC9D,qBAAqB,EAAE,OAAO,qBAAqB,CAAC;CACvD,CAAC;AAEF,wFAAwF;AACxF,QAAA,MAAM,YAAY,EAAE,YAKnB,CAAC;AAsBF;;;;;;;;;;GAUG;AACH,iBAAS,wBAAwB,CAC7B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,cAAc,GACzB,GAAG,CAAC,MAAM,EAAE,CAOd;AAED;;;;;;;;;;GAUG;AACH,iBAAS,qBAAqB,CAC1B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,cAAc,GACzB,GAAG,CAAC,MAAM,GAAG,IAAI,CAWnB;AAED,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { camelCase } from "@gtkx/utils";
1
+ import { getObjectProperty } from "@gtkx/gi/gobject";
2
2
  import { buildQueries } from "./build-queries.js";
3
3
  import { getElementError } from "./errors.js";
4
4
  import { isMatchingWidgetType, isTextMatch } from "./queries.js";
@@ -11,7 +11,13 @@ const queryHelpers = {
11
11
  queryByObjectProperty,
12
12
  };
13
13
  const readObjectProperty = (widget, property) => {
14
- const value = Reflect.get(widget, camelCase(property));
14
+ let value;
15
+ try {
16
+ value = Reflect.apply(getObjectProperty, undefined, [widget, property]);
17
+ }
18
+ catch {
19
+ return null;
20
+ }
15
21
  if (typeof value === "string") {
16
22
  return value;
17
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query-helpers.js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1B,QAAgB,EAChB,SAAoB,EACpB,IAAa,EACb,OAAwB;IAExB,MAAM,OAAO,GAAG,wBAAwB,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAE7E,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,eAAe,CACjB,SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,uBAAuB,QAAQ,mCAAmC,EACjG,SAAS,CACZ,CAAC;IACN,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC9B,CAAC;AAED,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,YAAY,EAAqB,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { camelCase } from \"@gtkx/utils\";\nimport type { Matcher, MatcherOptions } from \"./types.js\";\nimport { buildQueries } from \"./build-queries.js\";\nimport { getElementError } from \"./errors.js\";\nimport { isMatchingWidgetType, isTextMatch } from \"./queries.js\";\nimport { type Container, findAll } from \"./traversal.js\";\n\n/** The helpers used to build custom queries, bundled the way DOM Testing Library exposes them. */\ntype QueryHelpers = {\n /** Derives a query family's variants from its `queryAllBy` function. */\n buildQueries: typeof buildQueries;\n /** Builds the error a failing query throws. */\n getElementError: typeof getElementError;\n /** Finds every widget whose GObject property matches. */\n queryAllByObjectProperty: typeof queryAllByObjectProperty;\n /** Finds the single widget whose GObject property matches. */\n queryByObjectProperty: typeof queryByObjectProperty;\n};\n\n/** The query-building helpers, bundled so they can be reached under a single import. */\nconst queryHelpers: QueryHelpers = {\n buildQueries,\n getElementError,\n queryAllByObjectProperty,\n queryByObjectProperty,\n};\n\nconst readObjectProperty = (widget: Gtk.Widget, property: string): string | null => {\n const value: unknown = Reflect.get(widget, camelCase(property));\n\n if (typeof value === \"string\") {\n return value;\n }\n\n if (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") {\n return String(value);\n }\n\n return null;\n};\n\n/**\n * Finds every widget carrying a GObject property whose value matches, the counterpart of DOM Testing\n * Library's `queryAllByAttribute`. The property name may be given in kebab-case or camelCase, and\n * widgets that are not mapped are never matched.\n *\n * @param property Name of the GObject property to read.\n * @param container Widget subtree to search.\n * @param text Matcher for the property's value.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByObjectProperty(\n property: string,\n container: Container,\n text: Matcher,\n options?: MatcherOptions,\n): Gtk.Widget[] {\n return findAll(\n container,\n (widget) =>\n isMatchingWidgetType(widget, options) &&\n isTextMatch(readObjectProperty(widget, property), text, widget, options),\n );\n}\n\n/**\n * Returns the single widget carrying a GObject property whose value matches, or null when none do,\n * the counterpart of DOM Testing Library's `queryByAttribute`.\n *\n * @param property Name of the GObject property to read.\n * @param container Widget subtree to search.\n * @param text Matcher for the property's value.\n * @param options Text matching options.\n * @returns The matching widget, or null when none match.\n * @throws When more than one widget matches.\n */\nfunction queryByObjectProperty(\n property: string,\n container: Container,\n text: Matcher,\n options?: MatcherOptions,\n): Gtk.Widget | null {\n const matches = queryAllByObjectProperty(property, container, text, options);\n\n if (matches.length > 1) {\n throw getElementError(\n `Found ${String(matches.length)} elements with the '${property}' property, but expected only one`,\n container,\n );\n }\n\n return matches[0] ?? null;\n}\n\nexport { queryAllByObjectProperty, queryByObjectProperty, queryHelpers, type QueryHelpers };\n"]}
1
+ {"version":3,"file":"query-helpers.js","sourceRoot":"","sources":["../src/query-helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAkB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAczD,wFAAwF;AACxF,MAAM,YAAY,GA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SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,uBAAuB,QAAQ,mCAAmC,EACjG,SAAS,CACZ,CAAC;IACN,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC9B,CAAC;AAED,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,YAAY,EAAqB,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { getObjectProperty } from \"@gtkx/gi/gobject\";\nimport type { Matcher, MatcherOptions } from \"./types.js\";\nimport { buildQueries } from \"./build-queries.js\";\nimport { getElementError } from \"./errors.js\";\nimport { isMatchingWidgetType, isTextMatch } from \"./queries.js\";\nimport { type Container, findAll } from \"./traversal.js\";\n\n/** The helpers used to build custom queries, bundled the way DOM Testing Library exposes them. */\ntype QueryHelpers = {\n /** Derives a query family's variants from its `queryAllBy` function. */\n buildQueries: typeof buildQueries;\n /** Builds the error a failing query throws. */\n getElementError: typeof getElementError;\n /** Finds every widget whose GObject property matches. */\n queryAllByObjectProperty: typeof queryAllByObjectProperty;\n /** Finds the single widget whose GObject property matches. */\n queryByObjectProperty: typeof queryByObjectProperty;\n};\n\n/** The query-building helpers, bundled so they can be reached under a single import. */\nconst queryHelpers: QueryHelpers = {\n buildQueries,\n getElementError,\n queryAllByObjectProperty,\n queryByObjectProperty,\n};\n\nconst readObjectProperty = (widget: Gtk.Widget, property: string): string | null => {\n let value: unknown;\n\n try {\n value = Reflect.apply(getObjectProperty, undefined, [widget, property]);\n } catch {\n return null;\n }\n\n if (typeof value === \"string\") {\n return value;\n }\n\n if (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") {\n return String(value);\n }\n\n return null;\n};\n\n/**\n * Finds every widget carrying a GObject property whose value matches, the counterpart of DOM Testing\n * Library's `queryAllByAttribute`. The property name may be given in kebab-case or camelCase, and\n * widgets that are not mapped are never matched.\n *\n * @param property Name of the GObject property to read.\n * @param container Widget subtree to search.\n * @param text Matcher for the property's value.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nfunction queryAllByObjectProperty(\n property: string,\n container: Container,\n text: Matcher,\n options?: MatcherOptions,\n): Gtk.Widget[] {\n return findAll(\n container,\n (widget) =>\n isMatchingWidgetType(widget, options) &&\n isTextMatch(readObjectProperty(widget, property), text, widget, options),\n );\n}\n\n/**\n * Returns the single widget carrying a GObject property whose value matches, or null when none do,\n * the counterpart of DOM Testing Library's `queryByAttribute`.\n *\n * @param property Name of the GObject property to read.\n * @param container Widget subtree to search.\n * @param text Matcher for the property's value.\n * @param options Text matching options.\n * @returns The matching widget, or null when none match.\n * @throws When more than one widget matches.\n */\nfunction queryByObjectProperty(\n property: string,\n container: Container,\n text: Matcher,\n options?: MatcherOptions,\n): Gtk.Widget | null {\n const matches = queryAllByObjectProperty(property, container, text, options);\n\n if (matches.length > 1) {\n throw getElementError(\n `Found ${String(matches.length)} elements with the '${property}' property, but expected only one`,\n container,\n );\n }\n\n return matches[0] ?? null;\n}\n\nexport { queryAllByObjectProperty, queryByObjectProperty, queryHelpers, type QueryHelpers };\n"]}