blockly 12.5.1 → 13.0.0-beta.1

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 (363) hide show
  1. package/blockly.min.js +1541 -700
  2. package/blockly.mjs +13 -5
  3. package/blockly_compressed.js +1449 -674
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js +16 -16
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block.d.ts +1 -1
  8. package/core/block_aria_composer.d.ts +119 -0
  9. package/core/block_svg.d.ts +59 -16
  10. package/core/blockly.d.ts +21 -16
  11. package/core/bubbles/bubble.d.ts +17 -2
  12. package/core/bubbles/mini_workspace_bubble.d.ts +9 -1
  13. package/core/bubbles/text_bubble.d.ts +4 -1
  14. package/core/bubbles/textinput_bubble.d.ts +5 -0
  15. package/core/comments/comment_editor.d.ts +2 -2
  16. package/core/comments/rendered_workspace_comment.d.ts +6 -1
  17. package/core/common.d.ts +1 -1
  18. package/core/css.d.ts +2 -1
  19. package/core/dragging/block_drag_strategy.d.ts +126 -14
  20. package/core/dragging/bubble_drag_strategy.d.ts +5 -4
  21. package/core/dragging/comment_drag_strategy.d.ts +4 -4
  22. package/core/dragging/dragger.d.ts +13 -14
  23. package/core/events/events_block_create.d.ts +0 -3
  24. package/core/events/events_block_delete.d.ts +0 -3
  25. package/core/events/events_comment_create.d.ts +0 -3
  26. package/core/events/events_comment_delete.d.ts +0 -3
  27. package/core/field.d.ts +69 -2
  28. package/core/field_input.d.ts +23 -0
  29. package/core/flyout_base.d.ts +1 -125
  30. package/core/flyout_button.d.ts +9 -0
  31. package/core/flyout_horizontal.d.ts +0 -11
  32. package/core/flyout_vertical.d.ts +0 -11
  33. package/core/focus_manager.d.ts +47 -2
  34. package/core/gesture.d.ts +0 -12
  35. package/core/hints.d.ts +44 -0
  36. package/core/icons/icon.d.ts +6 -0
  37. package/core/inputs/input.d.ts +22 -1
  38. package/core/interfaces/i_bounded_element.d.ts +7 -0
  39. package/core/interfaces/i_bubble.d.ts +3 -2
  40. package/core/interfaces/i_collapsible_toolbox_item.d.ts +5 -1
  41. package/core/interfaces/i_draggable.d.ts +22 -17
  42. package/core/interfaces/i_dragger.d.ts +19 -10
  43. package/core/interfaces/i_flyout.d.ts +1 -31
  44. package/core/interfaces/i_focusable_node.d.ts +8 -0
  45. package/core/interfaces/i_focusable_tree.d.ts +8 -0
  46. package/core/interfaces/i_json_block_definition.d.ts +102 -0
  47. package/core/interfaces/i_navigation_policy.d.ts +12 -0
  48. package/core/interfaces/i_selectable.d.ts +2 -2
  49. package/core/interfaces/i_selectable_toolbox_item.d.ts +3 -3
  50. package/core/interfaces/i_toolbox.d.ts +4 -0
  51. package/core/interfaces/i_toolbox_item.d.ts +6 -0
  52. package/core/keyboard_nav/keyboard_mover.d.ts +149 -0
  53. package/core/keyboard_nav/move_indicator.d.ts +35 -0
  54. package/core/keyboard_nav/{block_navigation_policy.d.ts → navigation_policies/block_navigation_policy.d.ts} +17 -25
  55. package/core/keyboard_nav/navigation_policies/bubble_navigation_policy.d.ts +63 -0
  56. package/core/keyboard_nav/{comment_bar_button_navigation_policy.d.ts → navigation_policies/comment_bar_button_navigation_policy.d.ts} +10 -3
  57. package/core/keyboard_nav/{comment_editor_navigation_policy.d.ts → navigation_policies/comment_editor_navigation_policy.d.ts} +10 -3
  58. package/core/keyboard_nav/{connection_navigation_policy.d.ts → navigation_policies/connection_navigation_policy.d.ts} +11 -16
  59. package/core/keyboard_nav/{field_navigation_policy.d.ts → navigation_policies/field_navigation_policy.d.ts} +10 -3
  60. package/core/keyboard_nav/{flyout_button_navigation_policy.d.ts → navigation_policies/flyout_button_navigation_policy.d.ts} +10 -3
  61. package/core/keyboard_nav/{flyout_separator_navigation_policy.d.ts → navigation_policies/flyout_separator_navigation_policy.d.ts} +9 -3
  62. package/core/keyboard_nav/{icon_navigation_policy.d.ts → navigation_policies/icon_navigation_policy.d.ts} +12 -5
  63. package/core/keyboard_nav/navigation_policies/toolbox_item_navigation_policy.d.ts +64 -0
  64. package/core/keyboard_nav/{workspace_comment_navigation_policy.d.ts → navigation_policies/workspace_comment_navigation_policy.d.ts} +14 -9
  65. package/core/keyboard_nav/{workspace_navigation_policy.d.ts → navigation_policies/workspace_navigation_policy.d.ts} +10 -3
  66. package/core/keyboard_nav/navigators/flyout_navigator.d.ts +63 -0
  67. package/core/keyboard_nav/navigators/navigator.d.ts +225 -0
  68. package/core/keyboard_nav/navigators/toolbox_navigator.d.ts +70 -0
  69. package/core/registry.d.ts +0 -2
  70. package/core/renderers/common/constants.d.ts +4 -7
  71. package/core/renderers/common/i_path_object.d.ts +8 -0
  72. package/core/renderers/common/path_object.d.ts +5 -14
  73. package/core/renderers/common/renderer.d.ts +3 -3
  74. package/core/renderers/zelos/constants.d.ts +1 -14
  75. package/core/renderers/zelos/measurables/bottom_row.d.ts +1 -1
  76. package/core/renderers/zelos/measurables/top_row.d.ts +1 -1
  77. package/core/renderers/zelos/path_object.d.ts +0 -3
  78. package/core/renderers/zelos/renderer.d.ts +8 -0
  79. package/core/shortcut_items.d.ts +73 -1
  80. package/core/shortcut_registry.d.ts +6 -0
  81. package/core/theme.d.ts +0 -2
  82. package/core/toast.d.ts +2 -11
  83. package/core/toolbox/category.d.ts +5 -0
  84. package/core/toolbox/separator.d.ts +4 -0
  85. package/core/toolbox/toolbox.d.ts +17 -33
  86. package/core/toolbox/toolbox_item.d.ts +4 -0
  87. package/core/utils/aria.d.ts +245 -28
  88. package/core/utils/dom.d.ts +1 -1
  89. package/core/utils/shortcut_formatting.d.ts +22 -0
  90. package/core/utils/useragent.d.ts +1 -0
  91. package/core/variables.d.ts +1 -1
  92. package/core/workspace_audio.d.ts +23 -0
  93. package/core/workspace_svg.d.ts +8 -50
  94. package/dart_compressed.js +9 -9
  95. package/dart_compressed.js.map +1 -1
  96. package/index.mjs +13 -5
  97. package/javascript_compressed.js +11 -10
  98. package/javascript_compressed.js.map +1 -1
  99. package/lua_compressed.js +7 -7
  100. package/lua_compressed.js.map +1 -1
  101. package/msg/ab.js +65 -0
  102. package/msg/ab.mjs +65 -0
  103. package/msg/ace.js +65 -0
  104. package/msg/ace.mjs +65 -0
  105. package/msg/af.js +65 -0
  106. package/msg/af.mjs +65 -0
  107. package/msg/am.js +65 -0
  108. package/msg/am.mjs +65 -0
  109. package/msg/ar.js +65 -0
  110. package/msg/ar.mjs +65 -0
  111. package/msg/ast.js +65 -0
  112. package/msg/ast.mjs +65 -0
  113. package/msg/az.js +65 -0
  114. package/msg/az.mjs +65 -0
  115. package/msg/ba.js +65 -0
  116. package/msg/ba.mjs +65 -0
  117. package/msg/bcc.js +65 -0
  118. package/msg/bcc.mjs +65 -0
  119. package/msg/be-tarask.js +65 -0
  120. package/msg/be-tarask.mjs +65 -0
  121. package/msg/be.js +65 -0
  122. package/msg/be.mjs +65 -0
  123. package/msg/bg.js +65 -0
  124. package/msg/bg.mjs +65 -0
  125. package/msg/bn.js +65 -0
  126. package/msg/bn.mjs +65 -0
  127. package/msg/br.js +65 -0
  128. package/msg/br.mjs +65 -0
  129. package/msg/bs.js +65 -0
  130. package/msg/bs.mjs +65 -0
  131. package/msg/ca.js +65 -0
  132. package/msg/ca.mjs +65 -0
  133. package/msg/cdo.js +65 -0
  134. package/msg/cdo.mjs +65 -0
  135. package/msg/ce.js +65 -0
  136. package/msg/ce.mjs +65 -0
  137. package/msg/cs.js +65 -0
  138. package/msg/cs.mjs +65 -0
  139. package/msg/da.js +65 -0
  140. package/msg/da.mjs +65 -0
  141. package/msg/de.js +65 -0
  142. package/msg/de.mjs +65 -0
  143. package/msg/diq.js +65 -0
  144. package/msg/diq.mjs +65 -0
  145. package/msg/dtp.js +65 -0
  146. package/msg/dtp.mjs +65 -0
  147. package/msg/dty.js +65 -0
  148. package/msg/dty.mjs +65 -0
  149. package/msg/ee.js +65 -0
  150. package/msg/ee.mjs +65 -0
  151. package/msg/el.js +65 -0
  152. package/msg/el.mjs +65 -0
  153. package/msg/en-gb.js +65 -0
  154. package/msg/en-gb.mjs +65 -0
  155. package/msg/en.js +65 -0
  156. package/msg/en.mjs +65 -0
  157. package/msg/eo.js +65 -0
  158. package/msg/eo.mjs +65 -0
  159. package/msg/es.js +65 -0
  160. package/msg/es.mjs +65 -0
  161. package/msg/et.js +65 -0
  162. package/msg/et.mjs +65 -0
  163. package/msg/eu.js +65 -0
  164. package/msg/eu.mjs +65 -0
  165. package/msg/fa.js +65 -0
  166. package/msg/fa.mjs +65 -0
  167. package/msg/fi.js +65 -0
  168. package/msg/fi.mjs +65 -0
  169. package/msg/fo.js +65 -0
  170. package/msg/fo.mjs +65 -0
  171. package/msg/fr.js +65 -0
  172. package/msg/fr.mjs +65 -0
  173. package/msg/frr.js +65 -0
  174. package/msg/frr.mjs +65 -0
  175. package/msg/gl.js +65 -0
  176. package/msg/gl.mjs +65 -0
  177. package/msg/gn.js +65 -0
  178. package/msg/gn.mjs +65 -0
  179. package/msg/gor.js +65 -0
  180. package/msg/gor.mjs +65 -0
  181. package/msg/ha.js +65 -0
  182. package/msg/ha.mjs +65 -0
  183. package/msg/hak.js +65 -0
  184. package/msg/hak.mjs +65 -0
  185. package/msg/he.js +65 -0
  186. package/msg/he.mjs +65 -0
  187. package/msg/hi.js +65 -0
  188. package/msg/hi.mjs +65 -0
  189. package/msg/hr.js +65 -0
  190. package/msg/hr.mjs +65 -0
  191. package/msg/hrx.js +65 -0
  192. package/msg/hrx.mjs +65 -0
  193. package/msg/hsb.js +65 -0
  194. package/msg/hsb.mjs +65 -0
  195. package/msg/hu.js +65 -0
  196. package/msg/hu.mjs +65 -0
  197. package/msg/hy.js +65 -0
  198. package/msg/hy.mjs +65 -0
  199. package/msg/ia.js +65 -0
  200. package/msg/ia.mjs +65 -0
  201. package/msg/id.js +65 -0
  202. package/msg/id.mjs +65 -0
  203. package/msg/ig.js +65 -0
  204. package/msg/ig.mjs +65 -0
  205. package/msg/inh.js +65 -0
  206. package/msg/inh.mjs +65 -0
  207. package/msg/is.js +65 -0
  208. package/msg/is.mjs +65 -0
  209. package/msg/it.js +65 -0
  210. package/msg/it.mjs +65 -0
  211. package/msg/ja.js +65 -0
  212. package/msg/ja.mjs +65 -0
  213. package/msg/ka.js +65 -0
  214. package/msg/ka.mjs +65 -0
  215. package/msg/kab.js +65 -0
  216. package/msg/kab.mjs +65 -0
  217. package/msg/kbd-cyrl.js +65 -0
  218. package/msg/kbd-cyrl.mjs +65 -0
  219. package/msg/km.js +65 -0
  220. package/msg/km.mjs +65 -0
  221. package/msg/kn.js +65 -0
  222. package/msg/kn.mjs +65 -0
  223. package/msg/ko.js +65 -0
  224. package/msg/ko.mjs +65 -0
  225. package/msg/ksh.js +65 -0
  226. package/msg/ksh.mjs +65 -0
  227. package/msg/ku-latn.js +65 -0
  228. package/msg/ku-latn.mjs +65 -0
  229. package/msg/ky.js +65 -0
  230. package/msg/ky.mjs +65 -0
  231. package/msg/la.js +65 -0
  232. package/msg/la.mjs +65 -0
  233. package/msg/lb.js +65 -0
  234. package/msg/lb.mjs +65 -0
  235. package/msg/lki.js +65 -0
  236. package/msg/lki.mjs +65 -0
  237. package/msg/lo.js +65 -0
  238. package/msg/lo.mjs +65 -0
  239. package/msg/lrc.js +65 -0
  240. package/msg/lrc.mjs +65 -0
  241. package/msg/lt.js +65 -0
  242. package/msg/lt.mjs +65 -0
  243. package/msg/lv.js +65 -0
  244. package/msg/lv.mjs +65 -0
  245. package/msg/mg.js +65 -0
  246. package/msg/mg.mjs +65 -0
  247. package/msg/mk.js +65 -0
  248. package/msg/mk.mjs +65 -0
  249. package/msg/ml.js +65 -0
  250. package/msg/ml.mjs +65 -0
  251. package/msg/mnw.js +65 -0
  252. package/msg/mnw.mjs +65 -0
  253. package/msg/ms.js +65 -0
  254. package/msg/ms.mjs +65 -0
  255. package/msg/my.js +65 -0
  256. package/msg/my.mjs +65 -0
  257. package/msg/mzn.js +65 -0
  258. package/msg/mzn.mjs +65 -0
  259. package/msg/nb.js +65 -0
  260. package/msg/nb.mjs +65 -0
  261. package/msg/ne.js +65 -0
  262. package/msg/ne.mjs +65 -0
  263. package/msg/nl.js +65 -0
  264. package/msg/nl.mjs +65 -0
  265. package/msg/oc.js +65 -0
  266. package/msg/oc.mjs +65 -0
  267. package/msg/olo.js +65 -0
  268. package/msg/olo.mjs +65 -0
  269. package/msg/pa.js +65 -0
  270. package/msg/pa.mjs +65 -0
  271. package/msg/pl.js +65 -0
  272. package/msg/pl.mjs +65 -0
  273. package/msg/pms.js +65 -0
  274. package/msg/pms.mjs +65 -0
  275. package/msg/ps.js +65 -0
  276. package/msg/ps.mjs +65 -0
  277. package/msg/pt-br.js +65 -0
  278. package/msg/pt-br.mjs +65 -0
  279. package/msg/pt.js +65 -0
  280. package/msg/pt.mjs +65 -0
  281. package/msg/ro.js +65 -0
  282. package/msg/ro.mjs +65 -0
  283. package/msg/ru.js +65 -0
  284. package/msg/ru.mjs +65 -0
  285. package/msg/sc.js +65 -0
  286. package/msg/sc.mjs +65 -0
  287. package/msg/sco.js +65 -0
  288. package/msg/sco.mjs +65 -0
  289. package/msg/sd.js +65 -0
  290. package/msg/sd.mjs +65 -0
  291. package/msg/shn.js +65 -0
  292. package/msg/shn.mjs +65 -0
  293. package/msg/si.js +65 -0
  294. package/msg/si.mjs +65 -0
  295. package/msg/sk.js +65 -0
  296. package/msg/sk.mjs +65 -0
  297. package/msg/skr-arab.js +65 -0
  298. package/msg/skr-arab.mjs +65 -0
  299. package/msg/sl.js +65 -0
  300. package/msg/sl.mjs +65 -0
  301. package/msg/smn.js +65 -0
  302. package/msg/smn.mjs +65 -0
  303. package/msg/sq.js +65 -0
  304. package/msg/sq.mjs +65 -0
  305. package/msg/sr-latn.js +65 -0
  306. package/msg/sr-latn.mjs +65 -0
  307. package/msg/sr.js +65 -0
  308. package/msg/sr.mjs +65 -0
  309. package/msg/sv.js +65 -0
  310. package/msg/sv.mjs +65 -0
  311. package/msg/sw.js +65 -0
  312. package/msg/sw.mjs +65 -0
  313. package/msg/ta.js +65 -0
  314. package/msg/ta.mjs +65 -0
  315. package/msg/tcy.js +65 -0
  316. package/msg/tcy.mjs +65 -0
  317. package/msg/tdd.js +65 -0
  318. package/msg/tdd.mjs +65 -0
  319. package/msg/te.js +65 -0
  320. package/msg/te.mjs +65 -0
  321. package/msg/th.js +65 -0
  322. package/msg/th.mjs +65 -0
  323. package/msg/ti.js +65 -0
  324. package/msg/ti.mjs +65 -0
  325. package/msg/tl.js +65 -0
  326. package/msg/tl.mjs +65 -0
  327. package/msg/tlh.js +65 -0
  328. package/msg/tlh.mjs +65 -0
  329. package/msg/tr.js +65 -0
  330. package/msg/tr.mjs +65 -0
  331. package/msg/ug-arab.js +65 -0
  332. package/msg/ug-arab.mjs +65 -0
  333. package/msg/uk.js +65 -0
  334. package/msg/uk.mjs +65 -0
  335. package/msg/ur.js +65 -0
  336. package/msg/ur.mjs +65 -0
  337. package/msg/uz.js +65 -0
  338. package/msg/uz.mjs +65 -0
  339. package/msg/vi.js +65 -0
  340. package/msg/vi.mjs +65 -0
  341. package/msg/xmf.js +65 -0
  342. package/msg/xmf.mjs +65 -0
  343. package/msg/yo.js +65 -0
  344. package/msg/yo.mjs +65 -0
  345. package/msg/zgh.js +65 -0
  346. package/msg/zgh.mjs +65 -0
  347. package/msg/zh-hans.js +65 -0
  348. package/msg/zh-hans.mjs +65 -0
  349. package/msg/zh-hant.js +65 -0
  350. package/msg/zh-hant.mjs +65 -0
  351. package/package.json +11 -11
  352. package/php_compressed.js +2 -2
  353. package/php_compressed.js.map +1 -1
  354. package/python_compressed.js +2 -2
  355. package/python_compressed.js.map +1 -1
  356. package/core/flyout_navigator.d.ts +0 -11
  357. package/core/keyboard_nav/block_comment_navigation_policy.d.ts +0 -56
  358. package/core/keyboard_nav/flyout_navigation_policy.d.ts +0 -65
  359. package/core/keyboard_nav/line_cursor.d.ts +0 -187
  360. package/core/keyboard_nav/marker.d.ts +0 -53
  361. package/core/marker_manager.d.ts +0 -72
  362. package/core/navigator.d.ts +0 -65
  363. package/media/sprites.png +0 -0
package/core/block.d.ts CHANGED
@@ -548,6 +548,7 @@ export declare class Block {
548
548
  /**
549
549
  * Return all variables referenced by this block.
550
550
  *
551
+ * @deprecated v13: Use Blockly.Block.getVarModels().map(m => m.getId())
551
552
  * @returns List of variable ids.
552
553
  */
553
554
  getVars(): string[];
@@ -555,7 +556,6 @@ export declare class Block {
555
556
  * Return all variables referenced by this block.
556
557
  *
557
558
  * @returns List of variable models.
558
- * @internal
559
559
  */
560
560
  getVarModels(): IVariableModel<IVariableState>[];
561
561
  /**
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Raspberry Pi Foundation
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { BlockSvg } from './block_svg.js';
7
+ import { RenderedConnection } from './blockly.js';
8
+ import type { Input } from './inputs/input.js';
9
+ import { Verbosity } from './utils/aria.js';
10
+ /**
11
+ * Prepositions to use when describing the relationship between two blocks based
12
+ * on their connection types.
13
+ */
14
+ export declare enum ConnectionPreposition {
15
+ UNKNOWN = 0,
16
+ BEFORE = 1,
17
+ AFTER = 2,
18
+ AROUND = 3,
19
+ INSIDE = 4
20
+ }
21
+ /**
22
+ * Returns an ARIA representation of the specified block.
23
+ *
24
+ * The returned label will contain a complete context of the block, including:
25
+ * - Whether it begins a block stack or statement input stack.
26
+ * - Its constituent editable and non-editable fields.
27
+ * - Properties, including: disabled, collapsed, replaceable (a shadow), etc.
28
+ * - Its parent toolbox category.
29
+ * - Whether it has inputs.
30
+ *
31
+ * Beyond this, the returned label is specifically assembled with commas in
32
+ * select locations with the intention of better 'prosody' in the screen reader
33
+ * readouts since there's a lot of information being shared with the user. The
34
+ * returned label also places more important information earlier in the label so
35
+ * that the user gets the most important context as soon as possible in case
36
+ * they wish to stop readout early.
37
+ *
38
+ * The returned label will be specialized based on whether the block is part of a
39
+ * flyout.
40
+ *
41
+ * @internal
42
+ * @param block The block for which an ARIA representation should be created.
43
+ * @param verbosity How much detail to include in the description.
44
+ * @returns The ARIA representation for the specified block.
45
+ */
46
+ export declare function computeAriaLabel(block: BlockSvg, verbosity?: Verbosity): string;
47
+ /**
48
+ * Sets the ARIA role and role description for the specified block, accounting
49
+ * for whether the block is part of a flyout.
50
+ *
51
+ * @internal
52
+ * @param block The block to set ARIA role and roledescription attributes on.
53
+ */
54
+ export declare function configureAriaRole(block: BlockSvg): void;
55
+ /**
56
+ * Returns a list of ARIA labels for the 'field row' for the specified Input.
57
+ *
58
+ * 'Field row' essentially means the horizontal run of readable fields that
59
+ * precede the Input. Together, these provide the domain context for the input,
60
+ * particularly in the context of connections. In some cases, there may not be
61
+ * any readable fields immediately prior to the Input. In that case, if the
62
+ * `lookback` attribute is specified, all of the fields on the row immediately
63
+ * above the Input will be used instead.
64
+ *
65
+ * @internal
66
+ * @param input The Input to compute a description/context label for.
67
+ * @param lookback If true, will use labels for fields on the previous row if
68
+ * the given input's row has no fields itself.
69
+ * @returns A list of labels for fields on the same row (or previous row, if
70
+ * lookback is specified) as the given input.
71
+ */
72
+ export declare function computeFieldRowLabel(input: Input, lookback: boolean, verbosity?: Verbosity): string[];
73
+ /**
74
+ * Returns a list of accessibility labels for fields and inputs on a block.
75
+ * Each entry in the returned array corresponds to one of: (a) a label for a
76
+ * continuous run of non-interactable fields, (b) a label for an editable field,
77
+ * (c) a label for an input. When an input contains nested blocks/fields/inputs,
78
+ * their contents are returned as a single item in the array per top-level
79
+ * input.
80
+ *
81
+ * @internal
82
+ * @param block The block to retrieve a list of field/input labels for.
83
+ * @returns A list of field/input labels for the given block.
84
+ */
85
+ export declare function getInputLabels(block: BlockSvg, verbosity?: Verbosity): string[];
86
+ /**
87
+ * Returns a subset of labels for inputs on the given block, ending at the
88
+ * specified input.
89
+ *
90
+ * The subset is determined based on the input type:
91
+ * - For non-statement inputs, only the label for the given input is returned.
92
+ * - For statement inputs, labels are collected from the start of the current
93
+ * statement section up to and including the given input. A statement section
94
+ * begins immediately after the previous statement input, or at the start of
95
+ * the block if none exists.
96
+ *
97
+ * @internal
98
+ * @param block The block to retrieve a list of field/input labels for.
99
+ * @param input The input that defines the end of the subset.
100
+ * @returns A list of field/input labels for the given block.
101
+ */
102
+ export declare function getInputLabelsSubset(block: BlockSvg, input: Input, verbosity?: Verbosity): string[];
103
+ /**
104
+ * Returns a translated string describing an in-progress move of a block to a new
105
+ * connection, suitable for announcement on the ARIA live region. The returned string
106
+ * will be assembled based on the types of the local and neighbour connections and
107
+ * the presence of any readable fields on the block's inputs. If multiple potential
108
+ * candidate connections are present, additional context will be included in the
109
+ * returned string to help disambiguate between them.
110
+ *
111
+ * @param local The moving side of the candidate connection pair
112
+ * @param neighbour The target side of the candidate connection pair
113
+ * @param disambiguationPolicy A function that determines whether it's useful to
114
+ * include parent input labels for disambiguation.
115
+ * @param isMoveStart Whether this announcement is for the start of a move. If false,
116
+ * skip announcing the block label since it should have already been announced.
117
+ */
118
+ export declare function computeMoveLabel(local: RenderedConnection, neighbour: RenderedConnection, disambiguationPolicy: (forLocal: boolean) => boolean, isMoveStart?: boolean): string;
119
+ //# sourceMappingURL=block_aria_composer.d.ts.map
@@ -21,13 +21,14 @@ import type { IBoundedElement } from './interfaces/i_bounded_element.js';
21
21
  import { IContextMenu } from './interfaces/i_contextmenu.js';
22
22
  import type { ICopyable } from './interfaces/i_copyable.js';
23
23
  import { IDeletable } from './interfaces/i_deletable.js';
24
- import type { IDragStrategy, IDraggable } from './interfaces/i_draggable.js';
24
+ import type { DragDisposition, IDragStrategy, IDraggable } from './interfaces/i_draggable.js';
25
25
  import type { IFocusableNode } from './interfaces/i_focusable_node.js';
26
26
  import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
27
27
  import { IIcon } from './interfaces/i_icon.js';
28
28
  import { RenderedConnection } from './rendered_connection.js';
29
29
  import type { IPathObject } from './renderers/common/i_path_object.js';
30
30
  import type { BlockStyle } from './theme.js';
31
+ import * as aria from './utils/aria.js';
31
32
  import { Coordinate } from './utils/coordinate.js';
32
33
  import { Rect } from './utils/rect.js';
33
34
  import { FlyoutItemInfo } from './utils/toolbox.js';
@@ -100,9 +101,9 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
100
101
  readonly rendered = true;
101
102
  private visuallyDisabled;
102
103
  workspace: WorkspaceSvg;
103
- outputConnection: RenderedConnection;
104
- nextConnection: RenderedConnection;
105
- previousConnection: RenderedConnection;
104
+ outputConnection: RenderedConnection | null;
105
+ nextConnection: RenderedConnection | null;
106
+ previousConnection: RenderedConnection | null;
106
107
  private translation;
107
108
  /** Whether this block is currently being dragged. */
108
109
  private dragging;
@@ -301,6 +302,10 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
301
302
  * @internal
302
303
  */
303
304
  setDragging(adding: boolean): void;
305
+ /**
306
+ * Returns whether or not this block is currently being dragged.
307
+ */
308
+ isDragging(): boolean;
304
309
  /**
305
310
  * Set whether this block is movable or not.
306
311
  *
@@ -688,15 +693,6 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
688
693
  * @internal
689
694
  */
690
695
  fadeForReplacement(add: boolean): void;
691
- /**
692
- * Visual effect to show that if the dragging block is dropped it will connect
693
- * to this input.
694
- *
695
- * @param conn The connection on the input to highlight.
696
- * @param add True if highlighting should be added.
697
- * @internal
698
- */
699
- highlightShapeForInput(conn: RenderedConnection, add: boolean): void;
700
696
  /**
701
697
  * Returns the drag strategy currently in use by this block.
702
698
  *
@@ -711,11 +707,11 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
711
707
  /** Returns whether this block is movable or not. */
712
708
  isMovable(): boolean;
713
709
  /** Starts a drag on the block. */
714
- startDrag(e?: PointerEvent): void;
710
+ startDrag(e?: PointerEvent | KeyboardEvent): IDraggable;
715
711
  /** Drags the block to the given location. */
716
- drag(newLoc: Coordinate, e?: PointerEvent): void;
712
+ drag(newLoc: Coordinate, e?: PointerEvent | KeyboardEvent): void;
717
713
  /** Ends the drag on the block. */
718
- endDrag(e?: PointerEvent): void;
714
+ endDrag(e: PointerEvent | KeyboardEvent | undefined, disposition: DragDisposition): void;
719
715
  /** Moves the block back to where it was at the start of a drag. */
720
716
  revertDrag(): void;
721
717
  /**
@@ -733,5 +729,52 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
733
729
  onNodeBlur(): void;
734
730
  /** See IFocusableNode.canBeFocused. */
735
731
  canBeFocused(): boolean;
732
+ /**
733
+ * Handles the user acting on this block via keyboard navigation.
734
+ * If this block is in the flyout, a new copy is spawned in move mode on the
735
+ * main workspace. If this block has a single full-block field, that field
736
+ * will be focused. Otherwise, this is a no-op.
737
+ */
738
+ performAction(e?: KeyboardEvent): void;
739
+ /**
740
+ * Returns a set of all of the parent blocks of the given block.
741
+ *
742
+ * @internal
743
+ * @returns A set of the parents of the given block.
744
+ */
745
+ getParents(): Set<BlockSvg>;
746
+ /**
747
+ * Returns a set of all of the parent blocks connected to an output of the
748
+ * given block or one of its parents. Also includes the given block.
749
+ *
750
+ * @internal
751
+ * @returns A set of the output-connected parents of the given block.
752
+ */
753
+ getOutputParents(): Set<BlockSvg>;
754
+ /**
755
+ * Returns an ID for the visual "row" this block is part of.
756
+ *
757
+ * @internal
758
+ */
759
+ getRowId(): string;
760
+ /**
761
+ * Updates the ARIA label, role and roledescription for this block.
762
+ */
763
+ private recomputeAriaAttributes;
764
+ /**
765
+ * Returns a description of this block suitable for screenreaders or use in
766
+ * ARIA attributes.
767
+ *
768
+ * @param verbosity How much detail to include in the description.
769
+ * @returns An accessibility description of this block.
770
+ */
771
+ getAriaLabel(verbosity: aria.Verbosity): string;
772
+ /**
773
+ * Count the number of blocks in this stack (connected by next connections)
774
+ * and return a label to describe it. Uses the standard label if there is only one block.
775
+ *
776
+ * @internal
777
+ */
778
+ getStackBlocksCountLabel(): string;
736
779
  }
737
780
  //# sourceMappingURL=block_svg.d.ts.map
package/core/blockly.d.ts CHANGED
@@ -63,13 +63,15 @@ import * as icons from './icons.js';
63
63
  import { inject } from './inject.js';
64
64
  import * as inputs from './inputs.js';
65
65
  import { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
66
+ import { Direction, KeyboardMover } from './keyboard_nav/keyboard_mover.js';
67
+ import { MoveIndicator } from './keyboard_nav/move_indicator.js';
66
68
  import { LabelFlyoutInflater } from './label_flyout_inflater.js';
67
69
  import { SeparatorFlyoutInflater } from './separator_flyout_inflater.js';
68
70
  import { FocusableTreeTraverser } from './utils/focusable_tree_traverser.js';
69
71
  import { Input } from './inputs/input.js';
70
72
  import { InsertionMarkerPreviewer } from './insertion_marker_previewer.js';
71
73
  import { IAutoHideable } from './interfaces/i_autohideable.js';
72
- import { IBoundedElement } from './interfaces/i_bounded_element.js';
74
+ import { IBoundedElement, isBoundedElement } from './interfaces/i_bounded_element.js';
73
75
  import { IBubble } from './interfaces/i_bubble.js';
74
76
  import { ICollapsibleToolboxItem } from './interfaces/i_collapsible_toolbox_item.js';
75
77
  import { IComponent } from './interfaces/i_component.js';
@@ -80,7 +82,7 @@ import { ICopyData, ICopyable, isCopyable } from './interfaces/i_copyable.js';
80
82
  import { IDeletable, isDeletable } from './interfaces/i_deletable.js';
81
83
  import { IDeleteArea } from './interfaces/i_delete_area.js';
82
84
  import { IDragTarget } from './interfaces/i_drag_target.js';
83
- import { IDragStrategy, IDraggable, isDraggable } from './interfaces/i_draggable.js';
85
+ import { DragDisposition, IDragStrategy, IDraggable, isDraggable } from './interfaces/i_draggable.js';
84
86
  import { IDragger } from './interfaces/i_dragger.js';
85
87
  import { IFlyout } from './interfaces/i_flyout.js';
86
88
  import { IFocusableNode } from './interfaces/i_focusable_node.js';
@@ -104,12 +106,10 @@ import { IToolboxItem } from './interfaces/i_toolbox_item.js';
104
106
  import { IVariableBackedParameterModel, isVariableBackedParameterModel } from './interfaces/i_variable_backed_parameter_model.js';
105
107
  import { IVariableMap } from './interfaces/i_variable_map.js';
106
108
  import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
107
- import { LineCursor } from './keyboard_nav/line_cursor.js';
108
- import { Marker } from './keyboard_nav/marker.js';
109
+ import { ToolboxNavigator } from './keyboard_nav/navigators/toolbox_navigator.js';
109
110
  import { KeyboardNavigationController, keyboardNavigationController } from './keyboard_navigation_controller.js';
110
111
  import type { LayerManager } from './layer_manager.js';
111
112
  import * as layers from './layers.js';
112
- import { MarkerManager } from './marker_manager.js';
113
113
  import { Menu } from './menu.js';
114
114
  import { MenuItem } from './menuitem.js';
115
115
  import { MetricsManager } from './metrics_manager.js';
@@ -269,18 +269,23 @@ export declare const VARIABLE_DYNAMIC_CATEGORY_NAME: string;
269
269
  * procedure blocks.
270
270
  */
271
271
  export declare const PROCEDURE_CATEGORY_NAME: string;
272
- export * from './flyout_navigator.js';
273
272
  export * from './interfaces/i_navigation_policy.js';
274
- export * from './keyboard_nav/block_navigation_policy.js';
275
- export * from './keyboard_nav/connection_navigation_policy.js';
276
- export * from './keyboard_nav/field_navigation_policy.js';
277
- export * from './keyboard_nav/flyout_button_navigation_policy.js';
278
- export * from './keyboard_nav/flyout_navigation_policy.js';
279
- export * from './keyboard_nav/flyout_separator_navigation_policy.js';
280
- export * from './keyboard_nav/workspace_navigation_policy.js';
281
- export * from './navigator.js';
273
+ export * from './keyboard_nav/navigation_policies/block_navigation_policy.js';
274
+ export * from './keyboard_nav/navigation_policies/bubble_navigation_policy.js';
275
+ export * from './keyboard_nav/navigation_policies/comment_bar_button_navigation_policy.js';
276
+ export * from './keyboard_nav/navigation_policies/comment_editor_navigation_policy.js';
277
+ export * from './keyboard_nav/navigation_policies/connection_navigation_policy.js';
278
+ export * from './keyboard_nav/navigation_policies/field_navigation_policy.js';
279
+ export * from './keyboard_nav/navigation_policies/flyout_button_navigation_policy.js';
280
+ export * from './keyboard_nav/navigation_policies/flyout_separator_navigation_policy.js';
281
+ export * from './keyboard_nav/navigation_policies/icon_navigation_policy.js';
282
+ export * from './keyboard_nav/navigation_policies/toolbox_item_navigation_policy.js';
283
+ export * from './keyboard_nav/navigation_policies/workspace_comment_navigation_policy.js';
284
+ export * from './keyboard_nav/navigation_policies/workspace_navigation_policy.js';
285
+ export * from './keyboard_nav/navigators/flyout_navigator.js';
286
+ export * from './keyboard_nav/navigators/navigator.js';
282
287
  export * from './toast.js';
283
- export { Block, BlockSvg, BlocklyOptions, Blocks, CollapsibleToolboxCategory, ComponentManager, Connection, ConnectionChecker, ConnectionDB, ConnectionType, ContextMenu, ContextMenuItems, ContextMenuRegistry, Css, 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, };
288
+ export { Block, BlockSvg, BlocklyOptions, Blocks, CollapsibleToolboxCategory, ComponentManager, Connection, ConnectionChecker, ConnectionDB, ConnectionType, ContextMenu, ContextMenuItems, ContextMenuRegistry, Css, DeleteArea, DragTarget, Events, Extensions, 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, };
284
289
  export declare const DropDownDiv: typeof dropDownDiv;
285
- 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, 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, KeyboardNavigationController, 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, keyboardNavigationController, layers, renderManagement, serialization, setLocale, };
290
+ export { BlockFlyoutInflater, ButtonFlyoutInflater, CodeGenerator, Direction, DragDisposition, 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, 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, KeyboardMover, KeyboardNavigationController, LabelFlyoutInflater, LayerManager, Menu, MenuGenerator, MenuGeneratorFunction, MenuItem, MenuOption, MetricsManager, MoveIndicator, Msg, Names, Options, RenderedConnection, ReturnEphemeralFocus, Scrollbar, ScrollbarPair, SeparatorFlyoutInflater, ShortcutRegistry, Theme, ThemeManager, Toolbox, ToolboxCategory, ToolboxItem, ToolboxNavigator, ToolboxSeparator, Trashcan, UnattachedFieldError, VariableMap, VariableModel, VerticalFlyout, Workspace, WorkspaceAudio, WorkspaceDragger, WorkspaceSvg, ZoomControls, config, getFocusManager, hasBubble, icons, inject, inputs, isBoundedElement, isCopyable, isDeletable, isDraggable, isIcon, isObservable, isPaster, isRenderedElement, isSelectable, isSerializable, isVariableBackedParameterModel, keyboardNavigationController, layers, renderManagement, serialization, setLocale, };
286
291
  //# sourceMappingURL=blockly.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * Copyright 2023 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { IBoundedElement } from '../interfaces/i_bounded_element.js';
6
7
  import { IBubble } from '../interfaces/i_bubble.js';
7
8
  import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
8
9
  import type { IFocusableTree } from '../interfaces/i_focusable_tree.js';
@@ -17,7 +18,7 @@ import { WorkspaceSvg } from '../workspace_svg.js';
17
18
  * bubble, where it has a "tail" that points to the block, and a "head" that
18
19
  * displays arbitrary svg elements.
19
20
  */
20
- export declare abstract class Bubble implements IBubble, ISelectable, IFocusableNode {
21
+ export declare abstract class Bubble implements IBubble, ISelectable, IFocusableNode, IBoundedElement {
21
22
  readonly workspace: WorkspaceSvg;
22
23
  protected anchor: Coordinate;
23
24
  protected ownerRect?: Rect | undefined;
@@ -126,6 +127,14 @@ export declare abstract class Bubble implements IBubble, ISelectable, IFocusable
126
127
  * @internal
127
128
  */
128
129
  moveTo(x: number, y: number): void;
130
+ /**
131
+ * Moves the bubble by the given amounts in the x and y directions.
132
+ *
133
+ * @param dx The distance to move along the x axis.
134
+ * @param dy The distance to move along the y axis.
135
+ * @param _reason A description of why this move is happening.
136
+ */
137
+ moveBy(dx: number, dy: number, _reason?: string[]): void;
129
138
  /**
130
139
  * Positions the bubble "optimally" so that the most of it is visible and
131
140
  * it does not overlap the rect (if provided).
@@ -182,6 +191,12 @@ export declare abstract class Bubble implements IBubble, ISelectable, IFocusable
182
191
  bringToFront(): boolean;
183
192
  /** @internal */
184
193
  getRelativeToSurfaceXY(): Coordinate;
194
+ /**
195
+ * Returns the bounds of this bubble.
196
+ *
197
+ * @returns A bounding box for this bubble.
198
+ */
199
+ getBoundingRectangle(): Rect;
185
200
  /** @internal */
186
201
  getSvgRoot(): SVGElement;
187
202
  /**
@@ -201,7 +216,7 @@ export declare abstract class Bubble implements IBubble, ISelectable, IFocusable
201
216
  /** Returns whether this bubble is movable or not. */
202
217
  isMovable(): boolean;
203
218
  /** Starts a drag on the bubble. */
204
- startDrag(): void;
219
+ startDrag(): IBubble;
205
220
  /** Drags the bubble to the given location. */
206
221
  drag(newLoc: Coordinate): void;
207
222
  /** Ends the drag on the bubble. */
@@ -5,6 +5,8 @@
5
5
  */
6
6
  import type { BlocklyOptions } from '../blockly_options.js';
7
7
  import { Abstract as AbstractEvent } from '../events/events_abstract.js';
8
+ import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
9
+ import type { IHasBubble } from '../interfaces/i_has_bubble.js';
8
10
  import { Options } from '../options.js';
9
11
  import { Coordinate } from '../utils/coordinate.js';
10
12
  import type { Rect } from '../utils/rect.js';
@@ -18,6 +20,7 @@ export declare class MiniWorkspaceBubble extends Bubble {
18
20
  readonly workspace: WorkspaceSvg;
19
21
  protected anchor: Coordinate;
20
22
  protected ownerRect?: Rect | undefined;
23
+ protected owner?: (IHasBubble & IFocusableNode) | undefined;
21
24
  /**
22
25
  * The minimum amount of change to the mini workspace view to trigger
23
26
  * resizing the bubble.
@@ -38,7 +41,7 @@ export declare class MiniWorkspaceBubble extends Bubble {
38
41
  */
39
42
  private autoLayout;
40
43
  /** @internal */
41
- constructor(workspaceOptions: BlocklyOptions, workspace: WorkspaceSvg, anchor: Coordinate, ownerRect?: Rect | undefined);
44
+ constructor(workspaceOptions: BlocklyOptions, workspace: WorkspaceSvg, anchor: Coordinate, ownerRect?: Rect | undefined, owner?: (IHasBubble & IFocusableNode) | undefined);
42
45
  dispose(): void;
43
46
  /** @internal */
44
47
  getWorkspace(): WorkspaceSvg;
@@ -80,5 +83,10 @@ export declare class MiniWorkspaceBubble extends Bubble {
80
83
  moveTo(x: number, y: number): void;
81
84
  /** @internal */
82
85
  newWorkspaceSvg(options: Options): WorkspaceSvg;
86
+ /**
87
+ * Handles the user acting on this bubble via keyboard navigation by focusing
88
+ * the mutator workspace.
89
+ */
90
+ performAction(): void;
83
91
  }
84
92
  //# sourceMappingURL=mini_workspace_bubble.d.ts.map
@@ -3,6 +3,8 @@
3
3
  * Copyright 2023 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
7
+ import type { IHasBubble } from '../interfaces/i_has_bubble.js';
6
8
  import { Coordinate } from '../utils/coordinate.js';
7
9
  import { Rect } from '../utils/rect.js';
8
10
  import { WorkspaceSvg } from '../workspace_svg.js';
@@ -15,8 +17,9 @@ export declare class TextBubble extends Bubble {
15
17
  readonly workspace: WorkspaceSvg;
16
18
  protected anchor: Coordinate;
17
19
  protected ownerRect?: Rect | undefined;
20
+ protected owner?: (IHasBubble & IFocusableNode) | undefined;
18
21
  private paragraph;
19
- constructor(text: string, workspace: WorkspaceSvg, anchor: Coordinate, ownerRect?: Rect | undefined);
22
+ constructor(text: string, workspace: WorkspaceSvg, anchor: Coordinate, ownerRect?: Rect | undefined, owner?: (IHasBubble & IFocusableNode) | undefined);
20
23
  /** @returns the current text of this text bubble. */
21
24
  getText(): string;
22
25
  /** Sets the current text of this text bubble, and updates the display. */
@@ -98,5 +98,10 @@ export declare class TextInputBubble extends Bubble {
98
98
  * @internal
99
99
  */
100
100
  getEditor(): CommentEditor;
101
+ /**
102
+ * Handles the user acting on this bubble via keyboard navigation by focusing
103
+ * the comment editor.
104
+ */
105
+ performAction(): void;
101
106
  }
102
107
  //# sourceMappingURL=textinput_bubble.d.ts.map
@@ -16,7 +16,7 @@ export declare const COMMENT_EDITOR_FOCUS_IDENTIFIER = "_comment_textarea_";
16
16
  export declare class CommentEditor implements IFocusableNode {
17
17
  workspace: WorkspaceSvg;
18
18
  private onFinishEditing?;
19
- id?: string;
19
+ id: string;
20
20
  /** The foreignObject containing the HTML text area. */
21
21
  private foreignObject;
22
22
  /** The text area where the user can type. */
@@ -25,7 +25,7 @@ export declare class CommentEditor implements IFocusableNode {
25
25
  private textChangeListeners;
26
26
  /** The current text of the comment. Updates on text area change. */
27
27
  private text;
28
- constructor(workspace: WorkspaceSvg, commentId?: string, onFinishEditing?: (() => void) | undefined);
28
+ constructor(workspace: WorkspaceSvg, commentId: string, onFinishEditing?: (() => void) | undefined);
29
29
  /** Gets the dom structure for this comment editor. */
30
30
  getDom(): SVGForeignObjectElement;
31
31
  /** Gets the current text of the comment. */
@@ -83,7 +83,7 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
83
83
  /** Returns whether this comment is movable or not. */
84
84
  isMovable(): boolean;
85
85
  /** Starts a drag on the comment. */
86
- startDrag(): void;
86
+ startDrag(): RenderedWorkspaceComment;
87
87
  /** Drags the comment to the given location. */
88
88
  drag(newLoc: Coordinate): void;
89
89
  /** Ends the drag on the comment. */
@@ -117,5 +117,10 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
117
117
  onNodeBlur(): void;
118
118
  /** See IFocusableNode.canBeFocused. */
119
119
  canBeFocused(): boolean;
120
+ /**
121
+ * Handles the user acting on this comment via keyboard navigation.
122
+ * Expands the comment and focuses its editor.
123
+ */
124
+ performAction(): void;
120
125
  }
121
126
  //# sourceMappingURL=rendered_workspace_comment.d.ts.map
package/core/common.d.ts CHANGED
@@ -79,7 +79,7 @@ export declare function fireSelectedEvent(newSelection: ISelectable | null): voi
79
79
  *
80
80
  * @returns The parent container.
81
81
  */
82
- export declare function getParentContainer(): Element | null;
82
+ export declare function getParentContainer(workspace?: Workspace): Element | null;
83
83
  /**
84
84
  * Set the parent container. This is the container element that the WidgetDiv,
85
85
  * DropDownDiv, and Tooltip are rendered into the first time `Blockly.inject`
package/core/css.d.ts CHANGED
@@ -17,9 +17,10 @@ export declare function register(cssContent: string): void;
17
17
  * b) It speeds up loading by not blocking on a separate HTTP transfer.
18
18
  * c) The CSS content may be made dynamic depending on init options.
19
19
  *
20
+ * @param container The div or other HTML element into which Blockly was injected.
20
21
  * @param hasCss If false, don't inject CSS (providing CSS becomes the
21
22
  * document's responsibility).
22
23
  * @param pathToMedia Path from page to the Blockly media directory.
23
24
  */
24
- export declare function inject(hasCss: boolean, pathToMedia: string): void;
25
+ export declare function inject(container: HTMLElement, hasCss: boolean, pathToMedia: string): void;
25
26
  //# sourceMappingURL=css.d.ts.map