blockly 12.0.0-beta.3 → 12.0.0-beta.5

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 (319) hide show
  1. package/blockly.min.js +565 -503
  2. package/blockly.mjs +10 -0
  3. package/blockly_compressed.js +530 -501
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js +2 -2
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block_svg.d.ts +53 -23
  8. package/core/blockly.d.ts +13 -1
  9. package/core/comments/rendered_workspace_comment.d.ts +1 -1
  10. package/core/connection.d.ts +2 -0
  11. package/core/contextmenu.d.ts +6 -2
  12. package/core/contextmenu_registry.d.ts +21 -16
  13. package/core/dialog.d.ts +36 -16
  14. package/core/field.d.ts +29 -31
  15. package/core/field_checkbox.d.ts +9 -0
  16. package/core/field_dropdown.d.ts +19 -2
  17. package/core/field_image.d.ts +9 -0
  18. package/core/field_label.d.ts +9 -0
  19. package/core/field_number.d.ts +9 -0
  20. package/core/field_textinput.d.ts +9 -0
  21. package/core/flyout_base.d.ts +23 -1
  22. package/core/flyout_button.d.ts +30 -7
  23. package/core/flyout_item.d.ts +3 -9
  24. package/core/flyout_separator.d.ts +18 -1
  25. package/core/focus_manager.d.ts +82 -14
  26. package/core/interfaces/i_ast_node_location_svg.d.ts +0 -12
  27. package/core/interfaces/i_autohideable.d.ts +2 -0
  28. package/core/interfaces/i_flyout.d.ts +2 -1
  29. package/core/interfaces/i_focusable_node.d.ts +31 -2
  30. package/core/interfaces/i_focusable_tree.d.ts +67 -0
  31. package/core/interfaces/i_navigable.d.ts +30 -0
  32. package/core/interfaces/i_navigation_policy.d.ts +42 -0
  33. package/core/interfaces/i_toolbox.d.ts +2 -1
  34. package/core/interfaces/i_toolbox_item.d.ts +2 -1
  35. package/core/keyboard_nav/ast_node.d.ts +1 -113
  36. package/core/keyboard_nav/block_navigation_policy.d.ts +56 -0
  37. package/core/keyboard_nav/connection_navigation_policy.d.ts +53 -0
  38. package/core/keyboard_nav/field_navigation_policy.d.ts +42 -0
  39. package/core/keyboard_nav/flyout_button_navigation_policy.d.ts +42 -0
  40. package/core/keyboard_nav/flyout_navigation_policy.d.ts +51 -0
  41. package/core/keyboard_nav/flyout_separator_navigation_policy.d.ts +19 -0
  42. package/core/keyboard_nav/line_cursor.d.ts +60 -96
  43. package/core/keyboard_nav/marker.d.ts +20 -29
  44. package/core/keyboard_nav/workspace_navigation_policy.d.ts +42 -0
  45. package/core/marker_manager.d.ts +0 -26
  46. package/core/menuitem.d.ts +5 -2
  47. package/core/navigator.d.ts +65 -0
  48. package/core/rendered_connection.d.ts +35 -1
  49. package/core/renderers/common/block_rendering.d.ts +1 -2
  50. package/core/renderers/common/drawer.d.ts +1 -1
  51. package/core/renderers/common/i_path_object.d.ts +1 -25
  52. package/core/renderers/common/path_object.d.ts +1 -26
  53. package/core/renderers/common/renderer.d.ts +0 -11
  54. package/core/renderers/zelos/drawer.d.ts +1 -1
  55. package/core/renderers/zelos/renderer.d.ts +0 -11
  56. package/core/renderers/zelos/zelos.d.ts +1 -2
  57. package/core/shortcut_registry.d.ts +7 -2
  58. package/core/toast.d.ts +74 -0
  59. package/core/toolbox/toolbox.d.ts +23 -1
  60. package/core/toolbox/toolbox_item.d.ts +9 -0
  61. package/core/utils/aria.d.ts +5 -2
  62. package/core/variable_map.d.ts +4 -4
  63. package/core/variables.d.ts +3 -1
  64. package/core/workspace.d.ts +10 -9
  65. package/core/workspace_svg.d.ts +105 -48
  66. package/index.mjs +10 -0
  67. package/msg/ab.js +33 -0
  68. package/msg/ab.mjs +33 -0
  69. package/msg/ace.js +33 -0
  70. package/msg/ace.mjs +33 -0
  71. package/msg/af.js +33 -0
  72. package/msg/af.mjs +33 -0
  73. package/msg/am.js +33 -0
  74. package/msg/am.mjs +33 -0
  75. package/msg/ar.js +33 -0
  76. package/msg/ar.mjs +33 -0
  77. package/msg/ast.js +33 -0
  78. package/msg/ast.mjs +33 -0
  79. package/msg/az.js +33 -0
  80. package/msg/az.mjs +33 -0
  81. package/msg/ba.js +33 -0
  82. package/msg/ba.mjs +33 -0
  83. package/msg/bcc.js +33 -0
  84. package/msg/bcc.mjs +33 -0
  85. package/msg/be-tarask.js +33 -0
  86. package/msg/be-tarask.mjs +33 -0
  87. package/msg/be.js +33 -0
  88. package/msg/be.mjs +33 -0
  89. package/msg/bg.js +33 -0
  90. package/msg/bg.mjs +33 -0
  91. package/msg/bn.js +33 -0
  92. package/msg/bn.mjs +33 -0
  93. package/msg/br.js +33 -0
  94. package/msg/br.mjs +33 -0
  95. package/msg/bs.js +33 -0
  96. package/msg/bs.mjs +33 -0
  97. package/msg/ca.js +33 -0
  98. package/msg/ca.mjs +33 -0
  99. package/msg/cdo.js +33 -0
  100. package/msg/cdo.mjs +33 -0
  101. package/msg/ce.js +33 -0
  102. package/msg/ce.mjs +33 -0
  103. package/msg/cs.js +33 -0
  104. package/msg/cs.mjs +33 -0
  105. package/msg/da.js +33 -0
  106. package/msg/da.mjs +33 -0
  107. package/msg/de.js +33 -0
  108. package/msg/de.mjs +33 -0
  109. package/msg/diq.js +33 -0
  110. package/msg/diq.mjs +33 -0
  111. package/msg/dtp.js +33 -0
  112. package/msg/dtp.mjs +33 -0
  113. package/msg/dty.js +33 -0
  114. package/msg/dty.mjs +33 -0
  115. package/msg/ee.js +33 -0
  116. package/msg/ee.mjs +33 -0
  117. package/msg/el.js +33 -0
  118. package/msg/el.mjs +33 -0
  119. package/msg/en-gb.js +33 -0
  120. package/msg/en-gb.mjs +33 -0
  121. package/msg/en.js +33 -0
  122. package/msg/en.mjs +33 -0
  123. package/msg/eo.js +33 -0
  124. package/msg/eo.mjs +33 -0
  125. package/msg/es.js +33 -0
  126. package/msg/es.mjs +33 -0
  127. package/msg/et.js +33 -0
  128. package/msg/et.mjs +33 -0
  129. package/msg/eu.js +33 -0
  130. package/msg/eu.mjs +33 -0
  131. package/msg/fa.js +33 -0
  132. package/msg/fa.mjs +33 -0
  133. package/msg/fi.js +33 -0
  134. package/msg/fi.mjs +33 -0
  135. package/msg/fo.js +33 -0
  136. package/msg/fo.mjs +33 -0
  137. package/msg/fr.js +33 -0
  138. package/msg/fr.mjs +33 -0
  139. package/msg/frr.js +33 -0
  140. package/msg/frr.mjs +33 -0
  141. package/msg/gl.js +33 -0
  142. package/msg/gl.mjs +33 -0
  143. package/msg/gn.js +33 -0
  144. package/msg/gn.mjs +33 -0
  145. package/msg/gor.js +33 -0
  146. package/msg/gor.mjs +33 -0
  147. package/msg/ha.js +33 -0
  148. package/msg/ha.mjs +33 -0
  149. package/msg/hak.js +33 -0
  150. package/msg/hak.mjs +33 -0
  151. package/msg/he.js +33 -0
  152. package/msg/he.mjs +33 -0
  153. package/msg/hi.js +33 -0
  154. package/msg/hi.mjs +33 -0
  155. package/msg/hr.js +33 -0
  156. package/msg/hr.mjs +33 -0
  157. package/msg/hrx.js +33 -0
  158. package/msg/hrx.mjs +33 -0
  159. package/msg/hsb.js +33 -0
  160. package/msg/hsb.mjs +33 -0
  161. package/msg/hu.js +33 -0
  162. package/msg/hu.mjs +33 -0
  163. package/msg/hy.js +33 -0
  164. package/msg/hy.mjs +33 -0
  165. package/msg/ia.js +33 -0
  166. package/msg/ia.mjs +33 -0
  167. package/msg/id.js +33 -0
  168. package/msg/id.mjs +33 -0
  169. package/msg/ig.js +33 -0
  170. package/msg/ig.mjs +33 -0
  171. package/msg/inh.js +33 -0
  172. package/msg/inh.mjs +33 -0
  173. package/msg/is.js +33 -0
  174. package/msg/is.mjs +33 -0
  175. package/msg/it.js +33 -0
  176. package/msg/it.mjs +33 -0
  177. package/msg/ja.js +33 -0
  178. package/msg/ja.mjs +33 -0
  179. package/msg/ka.js +33 -0
  180. package/msg/ka.mjs +33 -0
  181. package/msg/kab.js +33 -0
  182. package/msg/kab.mjs +33 -0
  183. package/msg/kbd-cyrl.js +33 -0
  184. package/msg/kbd-cyrl.mjs +33 -0
  185. package/msg/km.js +33 -0
  186. package/msg/km.mjs +33 -0
  187. package/msg/kn.js +33 -0
  188. package/msg/kn.mjs +33 -0
  189. package/msg/ko.js +33 -0
  190. package/msg/ko.mjs +33 -0
  191. package/msg/ksh.js +33 -0
  192. package/msg/ksh.mjs +33 -0
  193. package/msg/ku-latn.js +33 -0
  194. package/msg/ku-latn.mjs +33 -0
  195. package/msg/ky.js +33 -0
  196. package/msg/ky.mjs +33 -0
  197. package/msg/la.js +33 -0
  198. package/msg/la.mjs +33 -0
  199. package/msg/lb.js +33 -0
  200. package/msg/lb.mjs +33 -0
  201. package/msg/lki.js +33 -0
  202. package/msg/lki.mjs +33 -0
  203. package/msg/lo.js +33 -0
  204. package/msg/lo.mjs +33 -0
  205. package/msg/lrc.js +33 -0
  206. package/msg/lrc.mjs +33 -0
  207. package/msg/lt.js +33 -0
  208. package/msg/lt.mjs +33 -0
  209. package/msg/lv.js +33 -0
  210. package/msg/lv.mjs +33 -0
  211. package/msg/mg.js +33 -0
  212. package/msg/mg.mjs +33 -0
  213. package/msg/mk.js +33 -0
  214. package/msg/mk.mjs +33 -0
  215. package/msg/ml.js +33 -0
  216. package/msg/ml.mjs +33 -0
  217. package/msg/mnw.js +33 -0
  218. package/msg/mnw.mjs +33 -0
  219. package/msg/ms.js +33 -0
  220. package/msg/ms.mjs +33 -0
  221. package/msg/my.js +33 -0
  222. package/msg/my.mjs +33 -0
  223. package/msg/mzn.js +33 -0
  224. package/msg/mzn.mjs +33 -0
  225. package/msg/nb.js +33 -0
  226. package/msg/nb.mjs +33 -0
  227. package/msg/ne.js +33 -0
  228. package/msg/ne.mjs +33 -0
  229. package/msg/nl.js +33 -0
  230. package/msg/nl.mjs +33 -0
  231. package/msg/oc.js +33 -0
  232. package/msg/oc.mjs +33 -0
  233. package/msg/olo.js +33 -0
  234. package/msg/olo.mjs +33 -0
  235. package/msg/pa.js +33 -0
  236. package/msg/pa.mjs +33 -0
  237. package/msg/pl.js +33 -0
  238. package/msg/pl.mjs +33 -0
  239. package/msg/pms.js +33 -0
  240. package/msg/pms.mjs +33 -0
  241. package/msg/ps.js +33 -0
  242. package/msg/ps.mjs +33 -0
  243. package/msg/pt-br.js +33 -0
  244. package/msg/pt-br.mjs +33 -0
  245. package/msg/pt.js +33 -0
  246. package/msg/pt.mjs +33 -0
  247. package/msg/ro.js +33 -0
  248. package/msg/ro.mjs +33 -0
  249. package/msg/ru.js +33 -0
  250. package/msg/ru.mjs +33 -0
  251. package/msg/sc.js +33 -0
  252. package/msg/sc.mjs +33 -0
  253. package/msg/sco.js +33 -0
  254. package/msg/sco.mjs +33 -0
  255. package/msg/sd.js +33 -0
  256. package/msg/sd.mjs +33 -0
  257. package/msg/shn.js +33 -0
  258. package/msg/shn.mjs +33 -0
  259. package/msg/si.js +33 -0
  260. package/msg/si.mjs +33 -0
  261. package/msg/sk.js +33 -0
  262. package/msg/sk.mjs +33 -0
  263. package/msg/skr-arab.js +33 -0
  264. package/msg/skr-arab.mjs +33 -0
  265. package/msg/sl.js +33 -0
  266. package/msg/sl.mjs +33 -0
  267. package/msg/smn.js +33 -0
  268. package/msg/smn.mjs +33 -0
  269. package/msg/sq.js +33 -0
  270. package/msg/sq.mjs +33 -0
  271. package/msg/sr-latn.js +33 -0
  272. package/msg/sr-latn.mjs +33 -0
  273. package/msg/sr.js +33 -0
  274. package/msg/sr.mjs +33 -0
  275. package/msg/sv.js +33 -0
  276. package/msg/sv.mjs +33 -0
  277. package/msg/sw.js +33 -0
  278. package/msg/sw.mjs +33 -0
  279. package/msg/ta.js +33 -0
  280. package/msg/ta.mjs +33 -0
  281. package/msg/tcy.js +33 -0
  282. package/msg/tcy.mjs +33 -0
  283. package/msg/tdd.js +33 -0
  284. package/msg/tdd.mjs +33 -0
  285. package/msg/te.js +33 -0
  286. package/msg/te.mjs +33 -0
  287. package/msg/th.js +33 -0
  288. package/msg/th.mjs +33 -0
  289. package/msg/ti.js +33 -0
  290. package/msg/ti.mjs +33 -0
  291. package/msg/tl.js +33 -0
  292. package/msg/tl.mjs +33 -0
  293. package/msg/tlh.js +33 -0
  294. package/msg/tlh.mjs +33 -0
  295. package/msg/tr.js +33 -0
  296. package/msg/tr.mjs +33 -0
  297. package/msg/ug-arab.js +33 -0
  298. package/msg/ug-arab.mjs +33 -0
  299. package/msg/uk.js +33 -0
  300. package/msg/uk.mjs +33 -0
  301. package/msg/ur.js +33 -0
  302. package/msg/ur.mjs +33 -0
  303. package/msg/uz.js +33 -0
  304. package/msg/uz.mjs +33 -0
  305. package/msg/vi.js +33 -0
  306. package/msg/vi.mjs +33 -0
  307. package/msg/xmf.js +33 -0
  308. package/msg/xmf.mjs +33 -0
  309. package/msg/yo.js +33 -0
  310. package/msg/yo.mjs +33 -0
  311. package/msg/zgh.js +33 -0
  312. package/msg/zgh.mjs +33 -0
  313. package/msg/zh-hans.js +33 -0
  314. package/msg/zh-hans.mjs +33 -0
  315. package/msg/zh-hant.js +33 -0
  316. package/msg/zh-hant.mjs +33 -0
  317. package/package.json +4 -4
  318. package/core/renderers/common/marker_svg.d.ts +0 -256
  319. package/core/renderers/zelos/marker_svg.d.ts +0 -49
@@ -10,7 +10,6 @@
10
10
  */
11
11
  import './events/events_selected.js';
12
12
  import { Block } from './block.js';
13
- import { IDeletable } from './blockly.js';
14
13
  import { BlockCopyData } from './clipboard/block_paster.js';
15
14
  import type { Connection } from './connection.js';
16
15
  import { ConnectionType } from './connection_type.js';
@@ -20,9 +19,14 @@ import { MutatorIcon } from './icons/mutator_icon.js';
20
19
  import type { Input } from './inputs/input.js';
21
20
  import type { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
22
21
  import type { IBoundedElement } from './interfaces/i_bounded_element.js';
22
+ import { IContextMenu } from './interfaces/i_contextmenu.js';
23
23
  import type { ICopyable } from './interfaces/i_copyable.js';
24
+ import { IDeletable } from './interfaces/i_deletable.js';
24
25
  import type { IDragStrategy, IDraggable } from './interfaces/i_draggable.js';
26
+ import type { IFocusableNode } from './interfaces/i_focusable_node.js';
27
+ import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
25
28
  import { IIcon } from './interfaces/i_icon.js';
29
+ import type { INavigable } from './interfaces/i_navigable.js';
26
30
  import { RenderedConnection } from './rendered_connection.js';
27
31
  import type { IPathObject } from './renderers/common/i_path_object.js';
28
32
  import type { BlockStyle } from './theme.js';
@@ -35,7 +39,7 @@ import type { WorkspaceSvg } from './workspace_svg.js';
35
39
  * Class for a block's SVG representation.
36
40
  * Not normally called directly, workspace.newBlock() is preferred.
37
41
  */
38
- export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBoundedElement, ICopyable<BlockCopyData>, IDraggable, IDeletable {
42
+ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBoundedElement, IContextMenu, ICopyable<BlockCopyData>, IDraggable, IDeletable, IFocusableNode, INavigable<BlockSvg> {
39
43
  /**
40
44
  * Constant for identifying rows that are to be rendered inline.
41
45
  * Don't collide with Blockly.inputTypes.
@@ -226,6 +230,12 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
226
230
  * @param collapsed True if collapsed.
227
231
  */
228
232
  setCollapsed(collapsed: boolean): void;
233
+ /**
234
+ * Traverses child blocks to see if any of them have a warning.
235
+ *
236
+ * @returns true if any child has a warning, false otherwise.
237
+ */
238
+ private childHasWarning;
229
239
  /**
230
240
  * Makes sure that when the block is collapsed, it is rendered correctly
231
241
  * for that state.
@@ -248,14 +258,20 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
248
258
  *
249
259
  * @returns Context menu options or null if no menu.
250
260
  */
251
- protected generateContextMenu(): Array<ContextMenuOption | LegacyContextMenuOption> | null;
261
+ protected generateContextMenu(e: Event): Array<ContextMenuOption | LegacyContextMenuOption> | null;
262
+ /**
263
+ * Gets the location in which to show the context menu for this block.
264
+ * Use the location of a click if the block was clicked, or a location
265
+ * based on the block's fields otherwise.
266
+ */
267
+ protected calculateContextMenuLocation(e: Event): Coordinate;
252
268
  /**
253
269
  * Show the context menu for this block.
254
270
  *
255
271
  * @param e Mouse event.
256
272
  * @internal
257
273
  */
258
- showContextMenu(e: PointerEvent): void;
274
+ showContextMenu(e: Event): void;
259
275
  /**
260
276
  * Updates the locations of any parts of the block that need to know where
261
277
  * they are (e.g. connections, icons).
@@ -385,13 +401,15 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
385
401
  private createIconPointerDownListener;
386
402
  removeIcon(type: IconType<IIcon>): boolean;
387
403
  /**
388
- * @deprecated v11 - Set whether the block is manually enabled or disabled.
404
+ * Set whether the block is manually enabled or disabled.
405
+ *
389
406
  * The user can toggle whether a block is disabled from a context menu
390
407
  * option. A block may still be disabled for other reasons even if the user
391
408
  * attempts to manually enable it, such as when the block is in an invalid
392
409
  * location. This method is deprecated and setDisabledReason should be used
393
410
  * instead.
394
411
  *
412
+ * @deprecated v11: use setDisabledReason.
395
413
  * @param enabled True if enabled.
396
414
  */
397
415
  setEnabled(enabled: boolean): void;
@@ -658,24 +676,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
658
676
  * @internal
659
677
  */
660
678
  tightenChildrenEfficiently(): void;
661
- /** Redraw any attached marker or cursor svgs if needed. */
662
- protected updateMarkers_(): void;
663
- /**
664
- * Add the cursor SVG to this block's SVG group.
665
- *
666
- * @param cursorSvg The SVG root of the cursor to be added to the block SVG
667
- * group.
668
- * @internal
669
- */
670
- setCursorSvg(cursorSvg: SVGElement): void;
671
- /**
672
- * Add the marker SVG to this block's SVG group.
673
- *
674
- * @param markerSvg The SVG root of the marker to be added to the block SVG
675
- * group.
676
- * @internal
677
- */
678
- setMarkerSvg(markerSvg: SVGElement): void;
679
679
  /**
680
680
  * Returns a bounding box describing the dimensions of this block
681
681
  * and any blocks stacked below it.
@@ -705,6 +705,13 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
705
705
  * @internal
706
706
  */
707
707
  highlightShapeForInput(conn: RenderedConnection, add: boolean): void;
708
+ /**
709
+ * Returns the drag strategy currently in use by this block.
710
+ *
711
+ * @internal
712
+ * @returns This block's drag strategy.
713
+ */
714
+ getDragStrategy(): IDragStrategy;
708
715
  /** Sets the drag strategy for this block. */
709
716
  setDragStrategy(dragStrategy: IDragStrategy): void;
710
717
  /** Returns whether this block is movable or not. */
@@ -722,5 +729,28 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
722
729
  */
723
730
  toFlyoutInfo(): FlyoutItemInfo[];
724
731
  jsonInit(json: any): void;
732
+ /** See IFocusableNode.getFocusableElement. */
733
+ getFocusableElement(): HTMLElement | SVGElement;
734
+ /** See IFocusableNode.getFocusableTree. */
735
+ getFocusableTree(): IFocusableTree;
736
+ /** See IFocusableNode.onNodeFocus. */
737
+ onNodeFocus(): void;
738
+ /** See IFocusableNode.onNodeBlur. */
739
+ onNodeBlur(): void;
740
+ /**
741
+ * Returns whether or not this block can be navigated to via the keyboard.
742
+ *
743
+ * @returns True if this block is keyboard navigable, otherwise false.
744
+ */
745
+ isNavigable(): boolean;
746
+ /**
747
+ * Returns this block's class.
748
+ *
749
+ * Used by keyboard navigation to look up the rules for navigating from this
750
+ * block.
751
+ *
752
+ * @returns This block's class.
753
+ */
754
+ getClass(): typeof BlockSvg;
725
755
  }
726
756
  //# sourceMappingURL=block_svg.d.ts.map
package/core/blockly.d.ts CHANGED
@@ -65,6 +65,7 @@ import * as inputs from './inputs.js';
65
65
  import { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
66
66
  import { LabelFlyoutInflater } from './label_flyout_inflater.js';
67
67
  import { SeparatorFlyoutInflater } from './separator_flyout_inflater.js';
68
+ import { FocusableTreeTraverser } from './utils/focusable_tree_traverser.js';
68
69
  import { Input } from './inputs/input.js';
69
70
  import { InsertionMarkerPreviewer } from './insertion_marker_previewer.js';
70
71
  import { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
@@ -271,7 +272,18 @@ export declare const VARIABLE_DYNAMIC_CATEGORY_NAME: string;
271
272
  * procedure blocks.
272
273
  */
273
274
  export declare const PROCEDURE_CATEGORY_NAME: string;
275
+ export * from './interfaces/i_navigable.js';
276
+ export * from './interfaces/i_navigation_policy.js';
277
+ export * from './keyboard_nav/block_navigation_policy.js';
278
+ export * from './keyboard_nav/connection_navigation_policy.js';
279
+ export * from './keyboard_nav/field_navigation_policy.js';
280
+ export * from './keyboard_nav/flyout_button_navigation_policy.js';
281
+ export * from './keyboard_nav/flyout_navigation_policy.js';
282
+ export * from './keyboard_nav/flyout_separator_navigation_policy.js';
283
+ export * from './keyboard_nav/workspace_navigation_policy.js';
284
+ export * from './navigator.js';
285
+ export * from './toast.js';
274
286
  export { ASTNode, Block, BlockSvg, BlocklyOptions, Blocks, CollapsibleToolboxCategory, ComponentManager, Connection, ConnectionChecker, ConnectionDB, ConnectionType, ContextMenu, ContextMenuItems, ContextMenuRegistry, Css, CursorOptions, DeleteArea, DragTarget, Events, Extensions, LineCursor, Procedures, ShortcutItems, Themes, Tooltip, Touch, Variables, VariablesDynamic, WidgetDiv, Xml, blockAnimations, blockRendering, browserEvents, bubbles, bumpObjects, clipboard, comments, common, constants, dialog, dragging, fieldRegistry, geras, Procedures as procedures, registry, thrasos, uiPosition, utils, zelos, };
275
287
  export declare const DropDownDiv: typeof dropDownDiv;
276
- export { BlockFlyoutInflater, ButtonFlyoutInflater, CodeGenerator, Field, FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator, FieldConfig, FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, FieldImage, FieldImageConfig, FieldImageFromJsonConfig, FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig, FieldLabelSerializable, FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberValidator, FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator, FieldValidator, FieldVariable, FieldVariableConfig, FieldVariableFromJsonConfig, FieldVariableValidator, Flyout, FlyoutButton, FlyoutItem, FlyoutMetricsManager, FlyoutSeparator, FocusManager, CodeGenerator as Generator, Gesture, Grid, HorizontalFlyout, IASTNodeLocation, IASTNodeLocationSvg, IASTNodeLocationWithBlock, IAutoHideable, IBoundedElement, IBubble, ICollapsibleToolboxItem, IComponent, IConnectionChecker, IConnectionPreviewer, IContextMenu, ICopyData, ICopyable, IDeletable, IDeleteArea, IDragStrategy, IDragTarget, IDraggable, IDragger, IFlyout, IFlyoutInflater, IFocusableNode, IFocusableTree, IHasBubble, IIcon, IKeyboardAccessible, IMetricsManager, IMovable, IObservable, IPaster, IPositionable, IRegistrable, IRenderedElement, ISelectable, ISelectableToolboxItem, ISerializable, IStyleable, IToolbox, IToolboxItem, IVariableBackedParameterModel, IVariableMap, IVariableModel, IVariableState, ImageProperties, Input, InsertionMarkerPreviewer, LabelFlyoutInflater, LayerManager, Marker, MarkerManager, Menu, MenuGenerator, MenuGeneratorFunction, MenuItem, MenuOption, MetricsManager, Msg, Names, Options, RenderedConnection, ReturnEphemeralFocus, Scrollbar, ScrollbarPair, SeparatorFlyoutInflater, ShortcutRegistry, Theme, ThemeManager, Toolbox, ToolboxCategory, ToolboxItem, ToolboxSeparator, Trashcan, UnattachedFieldError, VariableMap, VariableModel, VerticalFlyout, Workspace, WorkspaceAudio, WorkspaceDragger, WorkspaceSvg, ZoomControls, config, getFocusManager, hasBubble, icons, inject, inputs, isCopyable, isDeletable, isDraggable, isIcon, isObservable, isPaster, isRenderedElement, isSelectable, isSerializable, isVariableBackedParameterModel, layers, renderManagement, serialization, setLocale, };
288
+ export { BlockFlyoutInflater, ButtonFlyoutInflater, CodeGenerator, Field, FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator, FieldConfig, FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, FieldImage, FieldImageConfig, FieldImageFromJsonConfig, FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig, FieldLabelSerializable, FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberValidator, FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator, FieldValidator, FieldVariable, FieldVariableConfig, FieldVariableFromJsonConfig, FieldVariableValidator, Flyout, FlyoutButton, FlyoutItem, FlyoutMetricsManager, FlyoutSeparator, FocusManager, FocusableTreeTraverser, CodeGenerator as Generator, Gesture, Grid, HorizontalFlyout, IASTNodeLocation, IASTNodeLocationSvg, IASTNodeLocationWithBlock, IAutoHideable, IBoundedElement, IBubble, ICollapsibleToolboxItem, IComponent, IConnectionChecker, IConnectionPreviewer, IContextMenu, ICopyData, ICopyable, IDeletable, IDeleteArea, IDragStrategy, IDragTarget, IDraggable, IDragger, IFlyout, IFlyoutInflater, IFocusableNode, IFocusableTree, IHasBubble, IIcon, IKeyboardAccessible, IMetricsManager, IMovable, IObservable, IPaster, IPositionable, IRegistrable, IRenderedElement, ISelectable, ISelectableToolboxItem, ISerializable, IStyleable, IToolbox, IToolboxItem, IVariableBackedParameterModel, IVariableMap, IVariableModel, IVariableState, ImageProperties, Input, InsertionMarkerPreviewer, LabelFlyoutInflater, LayerManager, Marker, MarkerManager, Menu, MenuGenerator, MenuGeneratorFunction, MenuItem, MenuOption, MetricsManager, Msg, Names, Options, RenderedConnection, ReturnEphemeralFocus, Scrollbar, ScrollbarPair, SeparatorFlyoutInflater, ShortcutRegistry, Theme, ThemeManager, Toolbox, ToolboxCategory, ToolboxItem, ToolboxSeparator, Trashcan, UnattachedFieldError, VariableMap, VariableModel, VerticalFlyout, Workspace, WorkspaceAudio, WorkspaceDragger, WorkspaceSvg, ZoomControls, config, getFocusManager, hasBubble, icons, inject, inputs, isCopyable, isDeletable, isDraggable, isIcon, isObservable, isPaster, isRenderedElement, isSelectable, isSerializable, isVariableBackedParameterModel, layers, renderManagement, serialization, setLocale, };
277
289
  //# sourceMappingURL=blockly.d.ts.map
@@ -95,7 +95,7 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
95
95
  */
96
96
  toCopyData(): WorkspaceCommentCopyData | null;
97
97
  /** Show a context menu for this comment. */
98
- showContextMenu(e: PointerEvent): void;
98
+ showContextMenu(e: Event): void;
99
99
  /** Snap this comment to the nearest grid point. */
100
100
  snapToGrid(): void;
101
101
  }
@@ -41,6 +41,8 @@ export declare class Connection implements IASTNodeLocationWithBlock {
41
41
  private check;
42
42
  /** DOM representation of a shadow block, or null if none. */
43
43
  private shadowDom;
44
+ /** The unique ID of this connection. */
45
+ id: string;
44
46
  /**
45
47
  * Horizontal location of this connection.
46
48
  *
@@ -7,9 +7,12 @@ import type { Block } from './block.js';
7
7
  import type { BlockSvg } from './block_svg.js';
8
8
  import type { ContextMenuOption, LegacyContextMenuOption } from './contextmenu_registry.js';
9
9
  import * as serializationBlocks from './serialization/blocks.js';
10
+ import { Coordinate } from './utils/coordinate.js';
10
11
  import type { WorkspaceSvg } from './workspace_svg.js';
11
12
  /**
12
13
  * Gets the block the context menu is currently attached to.
14
+ * It is not recommended that you use this function; instead,
15
+ * use the scope object passed to the context menu callback.
13
16
  *
14
17
  * @returns The block the context menu is attached to.
15
18
  */
@@ -23,12 +26,13 @@ export declare function setCurrentBlock(block: Block | null): void;
23
26
  /**
24
27
  * Construct the menu based on the list of options and show the menu.
25
28
  *
26
- * @param e Mouse event.
29
+ * @param menuOpenEvent Event that caused the menu to open.
27
30
  * @param options Array of menu options.
28
31
  * @param rtl True if RTL, false if LTR.
29
32
  * @param workspace The workspace associated with the context menu, if any.
33
+ * @param location The screen coordinates at which to show the menu.
30
34
  */
31
- export declare function show(e: PointerEvent, options: (ContextMenuOption | LegacyContextMenuOption)[], rtl: boolean, workspace?: WorkspaceSvg): void;
35
+ export declare function show(menuOpenEvent: Event, options: (ContextMenuOption | LegacyContextMenuOption)[], rtl: boolean, workspace?: WorkspaceSvg, location?: Coordinate): void;
32
36
  /**
33
37
  * Hide the context menu.
34
38
  */
@@ -10,6 +10,8 @@
10
10
  */
11
11
  import type { BlockSvg } from './block_svg.js';
12
12
  import { RenderedWorkspaceComment } from './comments/rendered_workspace_comment.js';
13
+ import type { IFocusableNode } from './interfaces/i_focusable_node.js';
14
+ import { Coordinate } from './utils/coordinate.js';
13
15
  import type { WorkspaceSvg } from './workspace_svg.js';
14
16
  /**
15
17
  * Class for the registry of context menu items. This is intended to be a
@@ -44,17 +46,16 @@ export declare class ContextMenuRegistry {
44
46
  */
45
47
  getItem(id: string): RegistryItem | null;
46
48
  /**
47
- * Gets the valid context menu options for the given scope type (e.g. block or
48
- * workspace) and scope. Blocks are only shown if the preconditionFn shows
49
+ * Gets the valid context menu options for the given scope.
50
+ * Options are only included if the preconditionFn shows
49
51
  * they should not be hidden.
50
52
  *
51
- * @param scopeType Type of scope where menu should be shown (e.g. on a block
52
- * or on a workspace)
53
53
  * @param scope Current scope of context menu (i.e., the exact workspace or
54
- * block being clicked on)
54
+ * block being clicked on).
55
+ * @param menuOpenEvent Event that caused the menu to open.
55
56
  * @returns the list of ContextMenuOptions
56
57
  */
57
- getContextMenuOptions(scopeType: ScopeType, scope: Scope): ContextMenuOption[];
58
+ getContextMenuOptions(scope: Scope, menuOpenEvent: Event): ContextMenuOption[];
58
59
  }
59
60
  export declare namespace ContextMenuRegistry {
60
61
  /**
@@ -68,19 +69,21 @@ export declare namespace ContextMenuRegistry {
68
69
  COMMENT = "comment"
69
70
  }
70
71
  /**
71
- * The actual workspace/block where the menu is being rendered. This is passed
72
- * to callback and displayText functions that depend on this information.
72
+ * The actual workspace/block/focused object where the menu is being
73
+ * rendered. This is passed to callback and displayText functions
74
+ * that depend on this information.
73
75
  */
74
76
  export interface Scope {
75
77
  block?: BlockSvg;
76
78
  workspace?: WorkspaceSvg;
77
79
  comment?: RenderedWorkspaceComment;
80
+ focusedNode?: IFocusableNode | any;
78
81
  }
79
82
  /**
80
83
  * Fields common to all context menu registry items.
81
84
  */
82
85
  interface CoreRegistryItem {
83
- scopeType: ScopeType;
86
+ scopeType?: ScopeType;
84
87
  weight: number;
85
88
  id: string;
86
89
  }
@@ -91,12 +94,13 @@ export declare namespace ContextMenuRegistry {
91
94
  /**
92
95
  * @param scope Object that provides a reference to the thing that had its
93
96
  * context menu opened.
94
- * @param e The original event that triggered the context menu to open. Not
95
- * the event that triggered the click on the option.
97
+ * @param menuOpenEvent The original event that triggered the context menu to open.
98
+ * @param menuSelectEvent The event that triggered the option being selected.
99
+ * @param location The location in screen coordinates where the menu was opened.
96
100
  */
97
- callback: (scope: Scope, e: PointerEvent) => void;
101
+ callback: (scope: Scope, menuOpenEvent: Event, menuSelectEvent: Event, location: Coordinate) => void;
98
102
  displayText: ((p1: Scope) => string | HTMLElement) | string | HTMLElement;
99
- preconditionFn: (p1: Scope) => string;
103
+ preconditionFn: (p1: Scope, menuOpenEvent: Event) => string;
100
104
  separator?: never;
101
105
  }
102
106
  /**
@@ -128,10 +132,11 @@ export declare namespace ContextMenuRegistry {
128
132
  /**
129
133
  * @param scope Object that provides a reference to the thing that had its
130
134
  * context menu opened.
131
- * @param e The original event that triggered the context menu to open. Not
132
- * the event that triggered the click on the option.
135
+ * @param menuOpenEvent The original event that triggered the context menu to open.
136
+ * @param menuSelectEvent The event that triggered the option being selected.
137
+ * @param location The location in screen coordinates where the menu was opened.
133
138
  */
134
- callback: (scope: Scope, e: PointerEvent) => void;
139
+ callback: (scope: Scope, menuOpenEvent: Event, menuSelectEvent: Event, location: Coordinate) => void;
135
140
  separator?: never;
136
141
  }
137
142
  /**
package/core/dialog.d.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import type { ToastOptions } from './toast.js';
7
+ import type { WorkspaceSvg } from './workspace_svg.js';
6
8
  /**
7
9
  * Wrapper to window.alert() that app developers may override via setAlert to
8
10
  * provide alternatives to the modal browser window.
@@ -14,10 +16,11 @@ export declare function alert(message: string, opt_callback?: () => void): void;
14
16
  /**
15
17
  * Sets the function to be run when Blockly.dialog.alert() is called.
16
18
  *
17
- * @param alertFunction The function to be run.
19
+ * @param alertFunction The function to be run, or undefined to restore the
20
+ * default implementation.
18
21
  * @see Blockly.dialog.alert
19
22
  */
20
- export declare function setAlert(alertFunction: (p1: string, p2?: () => void) => void): void;
23
+ export declare function setAlert(alertFunction?: (message: string, callback?: () => void) => void): void;
21
24
  /**
22
25
  * Wrapper to window.confirm() that app developers may override via setConfirm
23
26
  * to provide alternatives to the modal browser window.
@@ -25,18 +28,15 @@ export declare function setAlert(alertFunction: (p1: string, p2?: () => void) =>
25
28
  * @param message The message to display to the user.
26
29
  * @param callback The callback for handling user response.
27
30
  */
28
- export declare function confirm(message: string, callback: (p1: boolean) => void): void;
29
- /**
30
- * Private version of confirm for stubbing in tests.
31
- */
32
- declare function confirmInternal(message: string, callback: (p1: boolean) => void): void;
31
+ export declare function confirm(message: string, callback: (result: boolean) => void): void;
33
32
  /**
34
33
  * Sets the function to be run when Blockly.dialog.confirm() is called.
35
34
  *
36
- * @param confirmFunction The function to be run.
35
+ * @param confirmFunction The function to be run, or undefined to restore the
36
+ * default implementation.
37
37
  * @see Blockly.dialog.confirm
38
38
  */
39
- export declare function setConfirm(confirmFunction: (p1: string, p2: (p1: boolean) => void) => void): void;
39
+ export declare function setConfirm(confirmFunction?: (message: string, callback: (result: boolean) => void) => void): void;
40
40
  /**
41
41
  * Wrapper to window.prompt() that app developers may override via setPrompt to
42
42
  * provide alternatives to the modal browser window. Built-in browser prompts
@@ -47,16 +47,36 @@ export declare function setConfirm(confirmFunction: (p1: string, p2: (p1: boolea
47
47
  * @param defaultValue The value to initialize the prompt with.
48
48
  * @param callback The callback for handling user response.
49
49
  */
50
- export declare function prompt(message: string, defaultValue: string, callback: (p1: string | null) => void): void;
50
+ export declare function prompt(message: string, defaultValue: string, callback: (result: string | null) => void): void;
51
51
  /**
52
52
  * Sets the function to be run when Blockly.dialog.prompt() is called.
53
53
  *
54
- * @param promptFunction The function to be run.
54
+ * **Important**: When overridding this, be aware that non-native prompt
55
+ * experiences may require managing ephemeral focus in FocusManager. This isn't
56
+ * needed for the native window prompt because it prevents focus from being
57
+ * changed while open.
58
+ *
59
+ * @param promptFunction The function to be run, or undefined to restore the
60
+ * default implementation.
55
61
  * @see Blockly.dialog.prompt
56
62
  */
57
- export declare function setPrompt(promptFunction: (p1: string, p2: string, p3: (p1: string | null) => void) => void): void;
58
- export declare const TEST_ONLY: {
59
- confirmInternal: typeof confirmInternal;
60
- };
61
- export {};
63
+ export declare function setPrompt(promptFunction?: (message: string, defaultValue: string, callback: (result: string | null) => void) => void): void;
64
+ /**
65
+ * Displays a temporary notification atop the workspace. Blockly provides a
66
+ * default toast implementation, but developers may provide their own via
67
+ * setToast. For simple appearance customization, CSS should be sufficient.
68
+ *
69
+ * @param workspace The workspace to display the toast notification atop.
70
+ * @param options Configuration options for the notification, including its
71
+ * message and duration.
72
+ */
73
+ export declare function toast(workspace: WorkspaceSvg, options: ToastOptions): void;
74
+ /**
75
+ * Sets the function to be run when Blockly.dialog.toast() is called.
76
+ *
77
+ * @param toastFunction The function to be run, or undefined to restore the
78
+ * default implementation.
79
+ * @see Blockly.dialog.toast
80
+ */
81
+ export declare function setToast(toastFunction?: (workspace: WorkspaceSvg, options: ToastOptions) => void): void;
62
82
  //# sourceMappingURL=dialog.d.ts.map
package/core/field.d.ts CHANGED
@@ -15,7 +15,10 @@ import type { Block } from './block.js';
15
15
  import type { Input } from './inputs/input.js';
16
16
  import type { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
17
17
  import type { IASTNodeLocationWithBlock } from './interfaces/i_ast_node_location_with_block.js';
18
+ import type { IFocusableNode } from './interfaces/i_focusable_node.js';
19
+ import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
18
20
  import type { IKeyboardAccessible } from './interfaces/i_keyboard_accessible.js';
21
+ import type { INavigable } from './interfaces/i_navigable.js';
19
22
  import type { IRegistrable } from './interfaces/i_registrable.js';
20
23
  import { ISerializable } from './interfaces/i_serializable.js';
21
24
  import type { ConstantProvider } from './renderers/common/constants.js';
@@ -45,7 +48,7 @@ export type FieldValidator<T = any> = (newValue: T) => T | null | undefined;
45
48
  *
46
49
  * @typeParam T - The value stored on the field.
47
50
  */
48
- export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IASTNodeLocationWithBlock, IKeyboardAccessible, IRegistrable, ISerializable {
51
+ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IASTNodeLocationWithBlock, IKeyboardAccessible, IRegistrable, ISerializable, IFocusableNode, INavigable<Field<T>> {
49
52
  /**
50
53
  * To overwrite the default value which is set in **Field**, directly update
51
54
  * the prototype.
@@ -74,16 +77,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
74
77
  */
75
78
  private tooltip;
76
79
  protected size_: Size;
77
- /**
78
- * Holds the cursors svg element when the cursor is attached to the field.
79
- * This is null if there is no cursor on the field.
80
- */
81
- private cursorSvg;
82
- /**
83
- * Holds the markers svg element when the marker is attached to the field.
84
- * This is null if there is no marker on the field.
85
- */
86
- private markerSvg;
87
80
  /** The rendered field's SVG group element. */
88
81
  protected fieldGroup_: SVGGElement | null;
89
82
  /** The rendered field's SVG border element. */
@@ -139,6 +132,8 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
139
132
  * case by default so that SERIALIZABLE is backwards compatible.
140
133
  */
141
134
  SERIALIZABLE: boolean;
135
+ /** The unique ID of this field. */
136
+ private id_;
142
137
  /**
143
138
  * @param value The initial value of the field.
144
139
  * Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by
@@ -669,26 +664,14 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
669
664
  * @returns True if the shortcut has been handled, false otherwise.
670
665
  */
671
666
  onShortcut(_shortcut: KeyboardShortcut): boolean;
672
- /**
673
- * Add the cursor SVG to this fields SVG group.
674
- *
675
- * @param cursorSvg The SVG root of the cursor to be added to the field group.
676
- * @internal
677
- */
678
- setCursorSvg(cursorSvg: SVGElement): void;
679
- /**
680
- * Add the marker SVG to this fields SVG group.
681
- *
682
- * @param markerSvg The SVG root of the marker to be added to the field group.
683
- * @internal
684
- */
685
- setMarkerSvg(markerSvg: SVGElement): void;
686
- /**
687
- * Redraw any attached marker or cursor svgs if needed.
688
- *
689
- * @internal
690
- */
691
- updateMarkers_(): void;
667
+ /** See IFocusableNode.getFocusableElement. */
668
+ getFocusableElement(): HTMLElement | SVGElement;
669
+ /** See IFocusableNode.getFocusableTree. */
670
+ getFocusableTree(): IFocusableTree;
671
+ /** See IFocusableNode.onNodeFocus. */
672
+ onNodeFocus(): void;
673
+ /** See IFocusableNode.onNodeBlur. */
674
+ onNodeBlur(): void;
692
675
  /**
693
676
  * Subclasses should reimplement this method to construct their Field
694
677
  * subclass from a JSON arg object.
@@ -700,6 +683,21 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
700
683
  * to configure a specific field.
701
684
  */
702
685
  static fromJson(_options: FieldConfig): Field;
686
+ /**
687
+ * Returns whether or not this field is accessible by keyboard navigation.
688
+ *
689
+ * @returns True if this field is keyboard accessible, otherwise false.
690
+ */
691
+ isNavigable(): boolean;
692
+ /**
693
+ * Returns this field's class.
694
+ *
695
+ * Used by keyboard navigation to look up the rules for navigating from this
696
+ * field. Must be implemented by subclasses.
697
+ *
698
+ * @returns This field's class.
699
+ */
700
+ abstract getClass(): new (...args: any) => Field<T>;
703
701
  }
704
702
  /**
705
703
  * Extra configuration options for the base field.
@@ -123,6 +123,15 @@ export declare class FieldCheckbox extends Field<CheckboxBool> {
123
123
  * @internal
124
124
  */
125
125
  static fromJson(options: FieldCheckboxFromJsonConfig): FieldCheckbox;
126
+ /**
127
+ * Returns this field's class.
128
+ *
129
+ * Used by keyboard navigation to look up the rules for navigating from this
130
+ * field.
131
+ *
132
+ * @returns This field's class.
133
+ */
134
+ getClass(): typeof FieldCheckbox;
126
135
  }
127
136
  /**
128
137
  * Config options for the checkbox field.
@@ -144,6 +144,13 @@ export declare class FieldDropdown extends Field<string> {
144
144
  * @throws {TypeError} If generated options are incorrectly structured.
145
145
  */
146
146
  getOptions(useCache?: boolean): MenuOption[];
147
+ /**
148
+ * Update the options on this dropdown. This will reset the selected item to
149
+ * the first item in the list.
150
+ *
151
+ * @param menuGenerator The array of options or a generator function.
152
+ */
153
+ setOptions(menuGenerator: MenuGenerator): void;
147
154
  /**
148
155
  * Ensure that the input value is a valid language-neutral option.
149
156
  *
@@ -225,6 +232,15 @@ export declare class FieldDropdown extends Field<string> {
225
232
  * @throws {TypeError} If proposed options are incorrectly structured.
226
233
  */
227
234
  protected validateOptions(options: MenuOption[]): void;
235
+ /**
236
+ * Returns this field's class.
237
+ *
238
+ * Used by keyboard navigation to look up the rules for navigating from this
239
+ * field.
240
+ *
241
+ * @returns This field's class.
242
+ */
243
+ getClass(): typeof FieldDropdown;
228
244
  }
229
245
  /**
230
246
  * Definition of a human-readable image dropdown option.
@@ -239,9 +255,10 @@ export interface ImageProperties {
239
255
  * An individual option in the dropdown menu. Can be either the string literal
240
256
  * `separator` for a menu separator item, or an array for normal action menu
241
257
  * items. In the latter case, the first element is the human-readable value
242
- * (text or image), and the second element is the language-neutral value.
258
+ * (text, ImageProperties object, or HTML element), and the second element is
259
+ * the language-neutral value.
243
260
  */
244
- export type MenuOption = [string | ImageProperties, string] | 'separator';
261
+ export type MenuOption = [string | ImageProperties | HTMLElement, string] | 'separator';
245
262
  /**
246
263
  * A function that generates an array of menu options for FieldDropdown
247
264
  * or its descendants.
@@ -125,6 +125,15 @@ export declare class FieldImage extends Field<string> {
125
125
  * @internal
126
126
  */
127
127
  static fromJson(options: FieldImageFromJsonConfig): FieldImage;
128
+ /**
129
+ * Returns this field's class.
130
+ *
131
+ * Used by keyboard navigation to look up the rules for navigating from this
132
+ * field.
133
+ *
134
+ * @returns This field's class.
135
+ */
136
+ getClass(): typeof FieldImage;
128
137
  }
129
138
  /**
130
139
  * Config options for the image field.
@@ -64,6 +64,15 @@ export declare class FieldLabel extends Field<string> {
64
64
  * @internal
65
65
  */
66
66
  static fromJson(options: FieldLabelFromJsonConfig): FieldLabel;
67
+ /**
68
+ * Returns this field's class.
69
+ *
70
+ * Used by keyboard navigation to look up the rules for navigating from this
71
+ * field.
72
+ *
73
+ * @returns This field's class.
74
+ */
75
+ getClass(): typeof FieldLabel;
67
76
  }
68
77
  /**
69
78
  * Config options for the label field.
@@ -160,6 +160,15 @@ export declare class FieldNumber extends FieldInput<number> {
160
160
  * @internal
161
161
  */
162
162
  static fromJson(options: FieldNumberFromJsonConfig): FieldNumber;
163
+ /**
164
+ * Returns this field's class.
165
+ *
166
+ * Used by keyboard navigation to look up the rules for navigating from this
167
+ * field.
168
+ *
169
+ * @returns This field's class.
170
+ */
171
+ getClass(): typeof FieldNumber;
163
172
  }
164
173
  /**
165
174
  * Config options for the number field.
@@ -48,6 +48,15 @@ export declare class FieldTextInput extends FieldInput<string> {
48
48
  * @internal
49
49
  */
50
50
  static fromJson(options: FieldTextInputFromJsonConfig): FieldTextInput;
51
+ /**
52
+ * Returns this field's class.
53
+ *
54
+ * Used by keyboard navigation to look up the rules for navigating from this
55
+ * field.
56
+ *
57
+ * @returns This field's class.
58
+ */
59
+ getClass(): typeof FieldTextInput;
51
60
  }
52
61
  /**
53
62
  * Config options for the text input field.