babylonjs-accessibility 5.17.1 → 5.18.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.
@@ -1,16 +1,176 @@
1
1
 
2
2
  declare module BABYLON.Accessibility {
3
- /**
4
3
  * A abstract layer to store the html twin tree structure. It is constructed from the BabylonJS scene entities that need to be accessible. It informs the parent-children relationship of html twin tree, and informs how to render: description, isActionable, onclick/onrightclick/onfocus/onblur.
5
4
  */
6
5
  export class HTMLTwinGUIItem extends HTMLTwinItem {
7
6
  /**
8
7
  * The corresponding BabylonJS entity. Can be a Node or a BABYLON.GUI.Control.
9
8
  */
10
9
  entity: BABYLON.GUI.Control;
11
10
  /**
12
11
  * The children of this item in the html twin tree.
13
12
  */
14
13
  children: HTMLTwinGUIItem[];
15
14
  constructor(entity: BABYLON.GUI.Control, scene: BABYLON.Scene, children: HTMLTwinGUIItem[]);
16
15
  /**
17
16
  * The text content displayed in HTML element.
18
17
  */
19
18
  get description(): string;
20
19
  /**
21
20
  * If this entity is actionable (can be clicked).
22
21
  */
23
22
  get isActionable(): boolean;
24
23
  /**
25
24
  * If this entity is focusable (can be focused by tab key pressing).
26
25
  */
27
26
  get isFocusable(): boolean;
28
27
  /**
29
28
  * Callback when the HTML element is focused. Show visual indication on BabylonJS entity.
30
29
  */
31
30
  focus(): void;
32
31
  /**
33
32
  * Callback when the HTML element is blured. Dismiss visual indication on BabylonJS entity.
34
33
  */
35
34
  blur(): void;
36
35
  /**
37
36
  * Callback when an event (e.g. click/right click) happens on the HTML element.
38
37
  * Implemented by child classes
39
38
  * @param eventType - Which event is triggered. E.g. "click", "contextmenu"
40
39
  */
41
40
  triggerEvent(eventType: string): void;
42
41
  }
42
+ /**
43
+ * A abstract layer to store the html twin tree structure. It is constructed from the BabylonJS scene entities that need to be accessible. It informs the parent-children relationship of html twin tree, and informs how to render: description, isActionable, onclick/onrightclick/onfocus/onblur.
44
+ */
45
+ export class HTMLTwinGUIItem extends HTMLTwinItem {
46
+ /**
47
+ * The corresponding BabylonJS entity. Can be a Node or a BABYLON.GUI.Control.
48
+ */
49
+ entity: BABYLON.GUI.Control;
50
+ /**
51
+ * The children of this item in the html twin tree.
52
+ */
53
+ children: HTMLTwinGUIItem[];
54
+ constructor(entity: BABYLON.GUI.Control, scene: BABYLON.Scene, children: HTMLTwinGUIItem[]);
55
+ /**
56
+ * The text content displayed in HTML element.
57
+ */
58
+ get description(): string;
59
+ /**
60
+ * If this entity is actionable (can be clicked).
61
+ */
62
+ get isActionable(): boolean;
63
+ /**
64
+ * If this entity is focusable (can be focused by tab key pressing).
65
+ */
66
+ get isFocusable(): boolean;
67
+ /**
68
+ * Callback when the HTML element is focused. Show visual indication on BabylonJS entity.
69
+ */
70
+ focus(): void;
71
+ /**
72
+ * Callback when the HTML element is blured. Dismiss visual indication on BabylonJS entity.
73
+ */
74
+ blur(): void;
75
+ /**
76
+ * Callback when an event (e.g. click/right click) happens on the HTML element.
77
+ * Implemented by child classes
78
+ * @param eventType - Which event is triggered. E.g. "click", "contextmenu"
79
+ */
80
+ triggerEvent(eventType: string): void;
81
+ }
43
82
 
44
- interface IHTMLTwinHostComponentProps {
45
83
  scene: BABYLON.Scene;
46
84
  }
47
85
  interface IHTMLTwinHostComponentState {
48
86
  a11yTreeItems: HTMLTwinItem[];
49
87
  }
50
88
  export class HTMLTwinHostComponent extends React.Component<IHTMLTwinHostComponentProps, IHTMLTwinHostComponentState> {
51
89
  private _observersMap;
52
90
  constructor(props: IHTMLTwinHostComponentProps);
53
91
  componentDidMount(): void;
54
92
  componentWillUnmount(): void;
55
93
  render(): JSX.Element;
56
94
  private _updateHTMLTwinItems;
57
95
  private _getHTMLTwinItemsFromNodes;
58
96
  private _getHTMLTwinItemsFromGUI;
59
97
  private _isGUI;
60
98
  }
61
99
 
62
- export type AccessibilityEntity = BABYLON.Node | BABYLON.GUI.Control;
63
100
  /**
64
101
  * A abstract layer to store the html twin tree structure. It is constructed from the BabylonJS scene entities that need to be accessible. It informs the parent-children relationship of html twin tree, and informs how to render: description, isActionable, onclick/onrightclick/onfocus/onblur.
65
102
  */
66
103
  export class HTMLTwinItem {
67
104
  /**
68
105
  * The corresponding BabylonJS entity. Can be a BABYLON.Node or a BABYLON.GUI.Control.
69
106
  */
70
107
  entity: AccessibilityEntity;
71
108
  /**
72
109
  * The BabylonJS scene that the corresponding BabylonJS entity is in.
73
110
  */
74
111
  scene: BABYLON.Scene;
75
112
  /**
76
113
  * The children of this item in the html twin tree.
77
114
  */
78
115
  children: HTMLTwinItem[];
79
116
  constructor(entity: AccessibilityEntity, scene: BABYLON.Scene, children: HTMLTwinItem[]);
80
117
  /**
81
118
  * The text content displayed in HTML element.
82
119
  * Returns the description in accessibilityTag, if defined (returns "" by default).
83
120
  */
84
121
  get description(): string;
85
122
  /**
86
123
  * If this entity is actionable (can be clicked).
87
124
  * Implemented by child classes
88
125
  */
89
126
  get isActionable(): boolean;
90
127
  /**
91
128
  * If this entity is focusable (can be focused by tab key pressing).
92
129
  * Implemented by child classes
93
130
  */
94
131
  get isFocusable(): boolean;
95
132
  /**
96
133
  * Callback when the HTML element is focused. Show visual indication on BabylonJS entity.
97
134
  * Implemented by child classes
98
135
  */
99
136
  focus(): void;
100
137
  /**
101
138
  * Callback when the HTML element is blured. Dismiss visual indication on BabylonJS entity.
102
139
  * Implemented by child classes
103
140
  */
104
141
  blur(): void;
105
142
  /**
106
143
  * Callback when an event (e.g. click/right click) happens on the HTML element.
107
144
  * Implemented by child classes
108
145
  * @param _eventType - Which event is triggered. E.g. "click", "contextmenu"
109
146
  */
110
147
  triggerEvent(_eventType: string): void;
111
148
  protected _isActionable: boolean;
112
149
  protected _isFocusable: boolean;
113
150
  }
151
+ interface IHTMLTwinHostComponentProps {
152
+ scene: BABYLON.Scene;
153
+ }
154
+ interface IHTMLTwinHostComponentState {
155
+ a11yTreeItems: HTMLTwinItem[];
156
+ }
157
+ export class HTMLTwinHostComponent extends React.Component<IHTMLTwinHostComponentProps, IHTMLTwinHostComponentState> {
158
+ private _observersMap;
159
+ constructor(props: IHTMLTwinHostComponentProps);
160
+ componentDidMount(): void;
161
+ componentWillUnmount(): void;
162
+ render(): JSX.Element;
163
+ private _updateHTMLTwinItems;
164
+ private _getHTMLTwinItemsFromNodes;
165
+ private _getHTMLTwinItemsFromGUI;
166
+ private _isGUI;
167
+ }
114
168
 
115
- /**
116
169
  * A abstract layer to store the html twin tree structure. It is constructed from the BabylonJS scene entities that need to be accessible. It informs the parent-children relationship of html twin tree, and informs how to render: description, isActionable, onclick/onrightclick/onfocus/onblur.
117
170
  */
118
171
  export class HTMLTwinNodeItem extends HTMLTwinItem {
119
172
  /**
120
173
  * The corresponding BabylonJS entity. Can be a BABYLON.Node or a Control.
121
174
  */
122
175
  entity: BABYLON.Node;
123
176
  /**
124
177
  * The children of this item in the html twin tree.
125
178
  */
126
179
  children: HTMLTwinItem[];
127
180
  constructor(entity: BABYLON.Node, scene: BABYLON.Scene, children: HTMLTwinItem[]);
128
181
  /**
129
182
  * If this entity is actionable (can be clicked).
130
183
  */
131
184
  get isActionable(): boolean;
132
185
  /**
133
186
  * If this entity is focusable (can be focused by tab key pressing).
134
187
  */
135
188
  get isFocusable(): boolean;
136
189
  /**
137
190
  * Callback when the HTML element is focused. Show visual indication on BabylonJS entity.
138
191
  */
139
192
  focus(): void;
140
193
  /**
141
194
  * Callback when the HTML element is blured. Dismiss visual indication on BabylonJS entity.
142
195
  */
143
196
  blur(): void;
144
197
  /**
145
198
  * Callback when an event (e.g. click/right click) happens on the HTML element.
146
199
  * Implemented by child classes
147
200
  * @param eventType - Which event is triggered. E.g. "click", "contextmenu"
148
201
  */
149
202
  triggerEvent(eventType: string): void;
150
203
  private _getTriggerActions;
151
204
  }
152
205
 
153
- export class HTMLTwinRenderer {
154
206
  static Render(scene: BABYLON.Scene): void;
155
207
  }
208
+ export type AccessibilityEntity = BABYLON.Node | BABYLON.GUI.Control;
209
+ /**
210
+ * A abstract layer to store the html twin tree structure. It is constructed from the BabylonJS scene entities that need to be accessible. It informs the parent-children relationship of html twin tree, and informs how to render: description, isActionable, onclick/onrightclick/onfocus/onblur.
211
+ */
212
+ export class HTMLTwinItem {
213
+ /**
214
+ * The corresponding BabylonJS entity. Can be a BABYLON.Node or a BABYLON.GUI.Control.
215
+ */
216
+ entity: AccessibilityEntity;
217
+ /**
218
+ * The BabylonJS scene that the corresponding BabylonJS entity is in.
219
+ */
220
+ scene: BABYLON.Scene;
221
+ /**
222
+ * The children of this item in the html twin tree.
223
+ */
224
+ children: HTMLTwinItem[];
225
+ constructor(entity: AccessibilityEntity, scene: BABYLON.Scene, children: HTMLTwinItem[]);
226
+ /**
227
+ * The text content displayed in HTML element.
228
+ * Returns the description in accessibilityTag, if defined (returns "" by default).
229
+ */
230
+ get description(): string;
231
+ /**
232
+ * If this entity is actionable (can be clicked).
233
+ * Implemented by child classes
234
+ */
235
+ get isActionable(): boolean;
236
+ /**
237
+ * If this entity is focusable (can be focused by tab key pressing).
238
+ * Implemented by child classes
239
+ */
240
+ get isFocusable(): boolean;
241
+ /**
242
+ * Callback when the HTML element is focused. Show visual indication on BabylonJS entity.
243
+ * Implemented by child classes
244
+ */
245
+ focus(): void;
246
+ /**
247
+ * Callback when the HTML element is blured. Dismiss visual indication on BabylonJS entity.
248
+ * Implemented by child classes
249
+ */
250
+ blur(): void;
251
+ /**
252
+ * Callback when an event (e.g. click/right click) happens on the HTML element.
253
+ * Implemented by child classes
254
+ * @param _eventType - Which event is triggered. E.g. "click", "contextmenu"
255
+ */
256
+ triggerEvent(_eventType: string): void;
257
+ protected _isActionable: boolean;
258
+ protected _isFocusable: boolean;
259
+ }
260
+
261
+
262
+ /**
263
+ * A abstract layer to store the html twin tree structure. It is constructed from the BabylonJS scene entities that need to be accessible. It informs the parent-children relationship of html twin tree, and informs how to render: description, isActionable, onclick/onrightclick/onfocus/onblur.
264
+ */
265
+ export class HTMLTwinNodeItem extends HTMLTwinItem {
266
+ /**
267
+ * The corresponding BabylonJS entity. Can be a BABYLON.Node or a Control.
268
+ */
269
+ entity: BABYLON.Node;
270
+ /**
271
+ * The children of this item in the html twin tree.
272
+ */
273
+ children: HTMLTwinItem[];
274
+ constructor(entity: BABYLON.Node, scene: BABYLON.Scene, children: HTMLTwinItem[]);
275
+ /**
276
+ * If this entity is actionable (can be clicked).
277
+ */
278
+ get isActionable(): boolean;
279
+ /**
280
+ * If this entity is focusable (can be focused by tab key pressing).
281
+ */
282
+ get isFocusable(): boolean;
283
+ /**
284
+ * Callback when the HTML element is focused. Show visual indication on BabylonJS entity.
285
+ */
286
+ focus(): void;
287
+ /**
288
+ * Callback when the HTML element is blured. Dismiss visual indication on BabylonJS entity.
289
+ */
290
+ blur(): void;
291
+ /**
292
+ * Callback when an event (e.g. click/right click) happens on the HTML element.
293
+ * Implemented by child classes
294
+ * @param eventType - Which event is triggered. E.g. "click", "contextmenu"
295
+ */
296
+ triggerEvent(eventType: string): void;
297
+ private _getTriggerActions;
298
+ }
299
+
300
+
301
+ export class HTMLTwinRenderer {
302
+ static Render(scene: BABYLON.Scene): void;
303
+ }
304
+
305
+
306
+ interface IHTMLTwinItemComponentProps {
307
+ a11yItem: HTMLTwinItem;
308
+ level: number;
309
+ }
310
+ export class HTMLTwinItemComponent extends React.Component<IHTMLTwinItemComponentProps> {
311
+ constructor(props: IHTMLTwinItemComponentProps);
312
+ render(): JSX.Element;
313
+ private _renderLeafNode;
314
+ private _renderParentNode;
315
+ private _renderChildren;
316
+ }
156
317
 
157
- interface IHTMLTwinItemComponentProps {
158
318
  a11yItem: HTMLTwinItem;
159
319
  level: number;
160
320
  }
161
321
  export class HTMLTwinItemComponent extends React.Component<IHTMLTwinItemComponentProps> {
162
322
  constructor(props: IHTMLTwinItemComponentProps);
163
323
  render(): JSX.Element;
164
324
  private _renderLeafNode;
165
325
  private _renderParentNode;
166
326
  private _renderChildren;
167
327
  }
168
328
 
169
329
 
170
330