blockly 8.0.4 → 8.0.5-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (858) hide show
  1. package/blockly.min.js +2421 -2688
  2. package/blockly_compressed.js +1499 -1994
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks/blocks.js +3 -2
  5. package/blocks/colour.js +3 -1
  6. package/blocks/lists.js +94 -22
  7. package/blocks/logic.js +14 -6
  8. package/blocks/loops.js +5 -3
  9. package/blocks/math.js +3 -1
  10. package/blocks/procedures.js +3 -1
  11. package/blocks/text.js +14 -6
  12. package/blocks/variables.js +3 -1
  13. package/blocks/variables_dynamic.js +3 -1
  14. package/blocks.d.ts +0 -2
  15. package/blocks_compressed.js +189 -171
  16. package/blocks_compressed.js.map +1 -1
  17. package/closure/goog/base.d.ts +1 -0
  18. package/closure/goog/base_minimal.d.ts +18 -0
  19. package/closure/goog/goog.d.ts +25 -0
  20. package/core/any_aliases.d.ts +1 -0
  21. package/core/any_aliases.ts +1 -0
  22. package/core/block.d.ts +779 -0
  23. package/core/{block.js → block.ts} +610 -719
  24. package/core/block_animations.d.ts +33 -0
  25. package/core/{block_animations.js → block_animations.ts} +75 -79
  26. package/core/block_drag_surface.d.ts +111 -0
  27. package/core/{block_drag_surface.js → block_drag_surface.ts} +85 -117
  28. package/core/block_dragger.d.ts +143 -0
  29. package/core/{block_dragger.js → block_dragger.ts} +139 -176
  30. package/core/block_svg.d.ts +588 -0
  31. package/core/{block_svg.js → block_svg.ts} +494 -630
  32. package/core/blockly.d.ts +562 -0
  33. package/core/blockly.js +1 -1
  34. package/core/blockly.ts +749 -0
  35. package/core/blockly_options.d.ts +69 -0
  36. package/core/blockly_options.ts +81 -0
  37. package/core/blocks.d.ts +17 -0
  38. package/core/{blocks.js → blocks.ts} +4 -8
  39. package/core/browser_events.d.ts +85 -0
  40. package/core/{browser_events.js → browser_events.ts} +98 -93
  41. package/core/bubble.d.ts +279 -0
  42. package/core/{bubble.js → bubble.ts} +277 -370
  43. package/core/bubble_dragger.d.ts +73 -0
  44. package/core/bubble_dragger.ts +229 -0
  45. package/core/bump_objects.d.ts +34 -0
  46. package/core/{bump_objects.js → bump_objects.ts} +54 -52
  47. package/core/clipboard.d.ts +42 -0
  48. package/core/clipboard.ts +91 -0
  49. package/core/comment.d.ts +113 -0
  50. package/core/{comment.js → comment.ts} +135 -185
  51. package/core/common.d.ts +129 -0
  52. package/core/{common.js → common.ts} +105 -82
  53. package/core/component_manager.d.ts +91 -0
  54. package/core/component_manager.ts +211 -0
  55. package/core/config.d.ts +23 -0
  56. package/core/{config.js → config.ts} +12 -19
  57. package/core/connection.d.ts +232 -0
  58. package/core/{connection.js → connection.ts} +187 -237
  59. package/core/connection_checker.d.ts +78 -0
  60. package/core/{connection_checker.js → connection_checker.ts} +66 -77
  61. package/core/connection_db.d.ts +91 -0
  62. package/core/{connection_db.js → connection_db.ts} +62 -87
  63. package/core/connection_type.d.ts +15 -0
  64. package/core/{connection_type.js → connection_type.ts} +8 -12
  65. package/core/constants.d.ts +15 -0
  66. package/core/{constants.js → constants.ts} +4 -8
  67. package/core/contextmenu.d.ts +80 -0
  68. package/core/{contextmenu.js → contextmenu.ts} +118 -153
  69. package/core/contextmenu_items.d.ts +77 -0
  70. package/core/contextmenu_items.ts +576 -0
  71. package/core/contextmenu_registry.d.ts +105 -0
  72. package/core/contextmenu_registry.ts +179 -0
  73. package/core/css.d.ts +24 -0
  74. package/core/{css.js → css.ts} +16 -24
  75. package/core/delete_area.d.ts +47 -0
  76. package/core/delete_area.ts +82 -0
  77. package/core/dialog.d.ts +61 -0
  78. package/core/dialog.ts +127 -0
  79. package/core/drag_target.d.ts +63 -0
  80. package/core/drag_target.ts +94 -0
  81. package/core/dropdowndiv.d.ts +155 -0
  82. package/core/{dropdowndiv.js → dropdowndiv.ts} +262 -333
  83. package/core/events/events.d.ts +102 -0
  84. package/core/events/events.ts +123 -0
  85. package/core/events/events_abstract.d.ts +51 -0
  86. package/core/events/events_abstract.ts +112 -0
  87. package/core/events/events_block_base.d.ts +31 -0
  88. package/core/events/events_block_base.ts +65 -0
  89. package/core/events/events_block_change.d.ts +55 -0
  90. package/core/events/{events_block_change.js → events_block_change.ts} +45 -48
  91. package/core/events/events_block_create.d.ts +35 -0
  92. package/core/events/{events_block_create.js → events_block_create.ts} +30 -35
  93. package/core/events/events_block_delete.d.ts +36 -0
  94. package/core/events/{events_block_delete.js → events_block_delete.ts} +34 -39
  95. package/core/events/events_block_drag.d.ts +36 -0
  96. package/core/events/events_block_drag.ts +82 -0
  97. package/core/events/events_block_move.d.ts +51 -0
  98. package/core/events/{events_block_move.js → events_block_move.ts} +54 -50
  99. package/core/events/events_bubble_open.d.ts +35 -0
  100. package/core/events/events_bubble_open.ts +82 -0
  101. package/core/events/events_click.d.ts +36 -0
  102. package/core/events/{events_click.js → events_click.ts} +27 -30
  103. package/core/events/events_comment_base.d.ts +39 -0
  104. package/core/events/events_comment_base.ts +107 -0
  105. package/core/events/events_comment_change.d.ts +43 -0
  106. package/core/events/{events_comment_change.js → events_comment_change.ts} +31 -28
  107. package/core/events/events_comment_create.d.ts +35 -0
  108. package/core/events/{events_comment_create.js → events_comment_create.ts} +24 -26
  109. package/core/events/events_comment_delete.d.ts +35 -0
  110. package/core/events/{events_comment_delete.js → events_comment_delete.ts} +20 -24
  111. package/core/events/events_comment_move.d.ts +55 -0
  112. package/core/events/{events_comment_move.js → events_comment_move.ts} +39 -42
  113. package/core/events/events_marker_move.d.ts +40 -0
  114. package/core/events/events_marker_move.ts +99 -0
  115. package/core/events/events_selected.d.ts +34 -0
  116. package/core/events/events_selected.ts +78 -0
  117. package/core/events/events_theme_change.d.ts +30 -0
  118. package/core/events/{events_theme_change.js → events_theme_change.ts} +19 -24
  119. package/core/events/events_toolbox_item_select.d.ts +34 -0
  120. package/core/events/events_toolbox_item_select.ts +79 -0
  121. package/core/events/events_trashcan_open.d.ts +31 -0
  122. package/core/events/events_trashcan_open.ts +68 -0
  123. package/core/events/events_ui.d.ts +37 -0
  124. package/core/events/{events_ui.js → events_ui.ts} +27 -26
  125. package/core/events/events_ui_base.d.ts +26 -0
  126. package/core/events/{events_ui_base.js → events_ui_base.ts} +17 -26
  127. package/core/events/events_var_base.d.ts +31 -0
  128. package/core/events/events_var_base.ts +65 -0
  129. package/core/events/events_var_create.d.ts +35 -0
  130. package/core/events/{events_var_create.js → events_var_create.ts} +24 -25
  131. package/core/events/events_var_delete.d.ts +35 -0
  132. package/core/events/{events_var_delete.js → events_var_delete.ts} +24 -25
  133. package/core/events/events_var_rename.d.ts +36 -0
  134. package/core/events/{events_var_rename.js → events_var_rename.ts} +25 -26
  135. package/core/events/events_viewport.d.ts +39 -0
  136. package/core/events/events_viewport.ts +100 -0
  137. package/core/events/utils.d.ts +272 -0
  138. package/core/events/{utils.js → utils.ts} +148 -219
  139. package/core/events/workspace_events.d.ts +36 -0
  140. package/core/events/workspace_events.ts +86 -0
  141. package/core/extensions.d.ts +107 -0
  142. package/core/{extensions.js → extensions.ts} +153 -172
  143. package/core/field.d.ts +534 -0
  144. package/core/{field.js → field.ts} +413 -489
  145. package/core/field_angle.d.ts +176 -0
  146. package/core/field_angle.ts +563 -0
  147. package/core/field_checkbox.d.ts +124 -0
  148. package/core/field_checkbox.ts +243 -0
  149. package/core/field_colour.d.ts +200 -0
  150. package/core/field_colour.ts +632 -0
  151. package/core/field_dropdown.d.ts +222 -0
  152. package/core/{field_dropdown.js → field_dropdown.ts} +277 -299
  153. package/core/field_image.d.ts +134 -0
  154. package/core/field_image.ts +282 -0
  155. package/core/field_label.d.ts +71 -0
  156. package/core/field_label.ts +152 -0
  157. package/core/field_label_serializable.d.ts +42 -0
  158. package/core/field_label_serializable.ts +76 -0
  159. package/core/field_multilineinput.d.ts +146 -0
  160. package/core/{field_multilineinput.js → field_multilineinput.ts} +166 -163
  161. package/core/field_number.d.ts +156 -0
  162. package/core/{field_number.js → field_number.ts} +110 -123
  163. package/core/field_registry.d.ts +45 -0
  164. package/core/{field_registry.js → field_registry.ts} +37 -30
  165. package/core/field_textinput.d.ts +219 -0
  166. package/core/field_textinput.ts +591 -0
  167. package/core/field_variable.d.ts +217 -0
  168. package/core/{field_variable.js → field_variable.ts} +174 -187
  169. package/core/flyout_base.d.ts +459 -0
  170. package/core/{flyout_base.js → flyout_base.ts} +429 -518
  171. package/core/flyout_button.d.ts +81 -0
  172. package/core/flyout_button.ts +292 -0
  173. package/core/flyout_horizontal.d.ts +82 -0
  174. package/core/{flyout_horizontal.js → flyout_horizontal.ts} +97 -107
  175. package/core/flyout_metrics_manager.d.ts +40 -0
  176. package/core/{flyout_metrics_manager.js → flyout_metrics_manager.ts} +22 -34
  177. package/core/flyout_vertical.d.ts +83 -0
  178. package/core/{flyout_vertical.js → flyout_vertical.ts} +106 -117
  179. package/core/generator.d.ts +205 -0
  180. package/core/{generator.js → generator.ts} +168 -193
  181. package/core/gesture.d.ts +357 -0
  182. package/core/{gesture.js → gesture.ts} +289 -369
  183. package/core/grid.d.ts +83 -0
  184. package/core/grid.ts +192 -0
  185. package/core/icon.d.ts +78 -0
  186. package/core/icon.ts +189 -0
  187. package/core/inject.d.ts +15 -0
  188. package/core/{inject.js → inject.ts} +101 -100
  189. package/core/input.d.ts +128 -0
  190. package/core/input.ts +309 -0
  191. package/core/input_types.d.ts +14 -0
  192. package/core/{input_types.js → input_types.ts} +8 -12
  193. package/core/insertion_marker_manager.d.ts +212 -0
  194. package/core/{insertion_marker_manager.js → insertion_marker_manager.ts} +234 -236
  195. package/core/interfaces/i_ast_node_location.d.ts +11 -0
  196. package/core/interfaces/{i_ast_node_location.js → i_ast_node_location.ts} +4 -7
  197. package/core/interfaces/i_ast_node_location_svg.d.ts +22 -0
  198. package/core/interfaces/i_ast_node_location_svg.ts +37 -0
  199. package/core/interfaces/i_ast_node_location_with_block.d.ts +18 -0
  200. package/core/interfaces/i_ast_node_location_with_block.ts +38 -0
  201. package/core/interfaces/i_autohideable.d.ts +18 -0
  202. package/core/interfaces/i_autohideable.ts +34 -0
  203. package/core/interfaces/i_block_dragger.d.ts +43 -0
  204. package/core/interfaces/i_block_dragger.ts +67 -0
  205. package/core/interfaces/i_bounded_element.d.ts +24 -0
  206. package/core/interfaces/i_bounded_element.ts +42 -0
  207. package/core/interfaces/i_bubble.d.ts +59 -0
  208. package/core/interfaces/i_bubble.ts +88 -0
  209. package/core/interfaces/i_collapsible_toolbox_item.d.ts +26 -0
  210. package/core/interfaces/i_collapsible_toolbox_item.ts +47 -0
  211. package/core/interfaces/i_component.d.ts +17 -0
  212. package/core/interfaces/{i_component.js → i_component.ts} +9 -14
  213. package/core/interfaces/i_connection_checker.d.ts +69 -0
  214. package/core/interfaces/i_connection_checker.ts +102 -0
  215. package/core/interfaces/i_contextmenu.d.ts +13 -0
  216. package/core/interfaces/i_contextmenu.ts +26 -0
  217. package/core/interfaces/i_copyable.d.ts +24 -0
  218. package/core/interfaces/i_copyable.ts +40 -0
  219. package/core/interfaces/i_deletable.d.ts +16 -0
  220. package/core/interfaces/{i_deletable.js → i_deletable.ts} +9 -13
  221. package/core/interfaces/i_delete_area.d.ts +25 -0
  222. package/core/interfaces/i_delete_area.ts +46 -0
  223. package/core/interfaces/i_drag_target.d.ts +53 -0
  224. package/core/interfaces/i_drag_target.ts +84 -0
  225. package/core/interfaces/i_draggable.d.ts +12 -0
  226. package/core/interfaces/{i_draggable.js → i_draggable.ts} +4 -10
  227. package/core/interfaces/i_flyout.d.ts +134 -0
  228. package/core/interfaces/i_flyout.ts +186 -0
  229. package/core/interfaces/i_keyboard_accessible.d.ts +18 -0
  230. package/core/interfaces/i_keyboard_accessible.ts +35 -0
  231. package/core/interfaces/i_metrics_manager.d.ts +117 -0
  232. package/core/interfaces/i_metrics_manager.ts +151 -0
  233. package/core/interfaces/i_movable.d.ts +16 -0
  234. package/core/interfaces/{i_movable.js → i_movable.ts} +9 -13
  235. package/core/interfaces/i_positionable.d.ts +27 -0
  236. package/core/interfaces/i_positionable.ts +50 -0
  237. package/core/interfaces/i_registrable.d.ts +11 -0
  238. package/core/interfaces/{i_registrable.js → i_registrable.ts} +3 -7
  239. package/core/interfaces/i_registrable_field.d.ts +17 -0
  240. package/core/interfaces/{i_registrable_field.js → i_registrable_field.ts} +8 -16
  241. package/core/interfaces/i_selectable.d.ts +18 -0
  242. package/core/interfaces/i_selectable.ts +34 -0
  243. package/core/interfaces/i_selectable_toolbox_item.d.ts +42 -0
  244. package/core/interfaces/i_selectable_toolbox_item.ts +64 -0
  245. package/core/interfaces/i_serializer.d.ts +42 -0
  246. package/core/interfaces/i_serializer.ts +65 -0
  247. package/core/interfaces/i_styleable.d.ts +21 -0
  248. package/core/interfaces/i_styleable.ts +35 -0
  249. package/core/interfaces/i_toolbox.d.ts +85 -0
  250. package/core/interfaces/i_toolbox.ts +127 -0
  251. package/core/interfaces/i_toolbox_item.d.ts +62 -0
  252. package/core/interfaces/i_toolbox_item.ts +84 -0
  253. package/core/internal_constants.d.ts +40 -0
  254. package/core/{internal_constants.js → internal_constants.ts} +13 -18
  255. package/core/keyboard_nav/ast_node.d.ts +239 -0
  256. package/core/keyboard_nav/{ast_node.js → ast_node.ts} +207 -231
  257. package/core/keyboard_nav/basic_cursor.d.ts +88 -0
  258. package/core/keyboard_nav/{basic_cursor.js → basic_cursor.ts} +55 -66
  259. package/core/keyboard_nav/cursor.d.ts +41 -0
  260. package/core/keyboard_nav/{cursor.js → cursor.ts} +25 -35
  261. package/core/keyboard_nav/marker.d.ts +58 -0
  262. package/core/keyboard_nav/{marker.js → marker.ts} +36 -55
  263. package/core/keyboard_nav/tab_navigate_cursor.d.ts +19 -0
  264. package/core/keyboard_nav/{tab_navigate_cursor.js → tab_navigate_cursor.ts} +11 -15
  265. package/core/main.d.ts +11 -0
  266. package/core/main.js +303 -0
  267. package/core/marker_manager.d.ts +85 -0
  268. package/core/marker_manager.ts +181 -0
  269. package/core/menu.d.ts +149 -0
  270. package/core/{menu.js → menu.ts} +141 -174
  271. package/core/menuitem.d.ts +118 -0
  272. package/core/menuitem.ts +240 -0
  273. package/core/metrics_manager.d.ts +201 -0
  274. package/core/{metrics_manager.js → metrics_manager.ts} +117 -156
  275. package/core/msg.d.ts +9 -0
  276. package/core/{msg.js → msg.ts} +4 -8
  277. package/core/mutator.d.ts +128 -0
  278. package/core/{mutator.js → mutator.ts} +196 -211
  279. package/core/names.d.ts +124 -0
  280. package/core/names.ts +267 -0
  281. package/core/options.d.ts +137 -0
  282. package/core/{options.js → options.ts} +147 -173
  283. package/core/positionable_helpers.d.ts +88 -0
  284. package/core/{positionable_helpers.js → positionable_helpers.ts} +63 -70
  285. package/core/procedures.d.ts +108 -0
  286. package/core/{procedures.js → procedures.ts} +143 -152
  287. package/core/registry.d.ts +137 -0
  288. package/core/registry.ts +339 -0
  289. package/core/rendered_connection.d.ts +191 -0
  290. package/core/{rendered_connection.js → rendered_connection.ts} +164 -184
  291. package/core/renderers/common/block_rendering.d.ts +114 -0
  292. package/core/renderers/common/block_rendering.ts +164 -0
  293. package/core/renderers/common/constants.d.ts +458 -0
  294. package/core/renderers/common/constants.ts +1124 -0
  295. package/core/renderers/common/debug.d.ts +28 -0
  296. package/core/renderers/common/{debug.js → debug.ts} +14 -20
  297. package/core/renderers/common/debugger.d.ts +120 -0
  298. package/core/renderers/common/{debugger.js → debugger.ts} +100 -124
  299. package/core/renderers/common/drawer.d.ts +132 -0
  300. package/core/renderers/common/{drawer.js → drawer.ts} +112 -137
  301. package/core/renderers/common/i_path_object.d.ts +117 -0
  302. package/core/renderers/common/i_path_object.ts +161 -0
  303. package/core/renderers/common/info.d.ts +194 -0
  304. package/core/renderers/common/{info.js → info.ts} +165 -222
  305. package/core/renderers/common/marker_svg.d.ts +220 -0
  306. package/core/renderers/common/marker_svg.ts +680 -0
  307. package/core/renderers/common/path_object.d.ts +146 -0
  308. package/core/renderers/common/path_object.ts +272 -0
  309. package/core/renderers/common/renderer.d.ts +157 -0
  310. package/core/renderers/common/renderer.ts +271 -0
  311. package/core/renderers/geras/constants.d.ts +23 -0
  312. package/core/renderers/geras/constants.ts +61 -0
  313. package/core/renderers/geras/drawer.d.ts +43 -0
  314. package/core/renderers/geras/{drawer.js → drawer.ts} +40 -84
  315. package/core/renderers/geras/geras.d.ts +11 -0
  316. package/core/renderers/geras/geras.ts +37 -0
  317. package/core/renderers/geras/highlight_constants.d.ts +108 -0
  318. package/core/renderers/geras/{highlight_constants.js → highlight_constants.ts} +107 -69
  319. package/core/renderers/geras/highlighter.d.ts +98 -0
  320. package/core/renderers/geras/{highlighter.js → highlighter.ts} +81 -86
  321. package/core/renderers/geras/info.d.ts +45 -0
  322. package/core/renderers/geras/{info.js → info.ts} +61 -99
  323. package/core/renderers/geras/measurables/inline_input.d.ts +23 -0
  324. package/core/renderers/geras/measurables/inline_input.ts +51 -0
  325. package/core/renderers/geras/measurables/statement_input.d.ts +23 -0
  326. package/core/renderers/geras/measurables/statement_input.ts +50 -0
  327. package/core/renderers/geras/path_object.d.ts +47 -0
  328. package/core/renderers/geras/{path_object.js → path_object.ts} +46 -74
  329. package/core/renderers/geras/renderer.d.ts +69 -0
  330. package/core/renderers/geras/renderer.ts +126 -0
  331. package/core/renderers/measurables/base.d.ts +27 -0
  332. package/core/renderers/measurables/base.ts +53 -0
  333. package/core/renderers/measurables/bottom_row.d.ts +61 -0
  334. package/core/renderers/measurables/bottom_row.ts +120 -0
  335. package/core/renderers/measurables/connection.d.ts +25 -0
  336. package/core/renderers/measurables/connection.ts +52 -0
  337. package/core/renderers/measurables/external_value_input.d.ts +27 -0
  338. package/core/renderers/measurables/external_value_input.ts +65 -0
  339. package/core/renderers/measurables/field.d.ts +30 -0
  340. package/core/renderers/measurables/field.ts +63 -0
  341. package/core/renderers/measurables/hat.d.ts +21 -0
  342. package/core/renderers/measurables/{hat.js → hat.ts} +12 -14
  343. package/core/renderers/measurables/icon.d.ts +26 -0
  344. package/core/renderers/measurables/{icon.js → icon.ts} +14 -18
  345. package/core/renderers/measurables/in_row_spacer.d.ts +21 -0
  346. package/core/renderers/measurables/in_row_spacer.ts +44 -0
  347. package/core/renderers/measurables/inline_input.d.ts +24 -0
  348. package/core/renderers/measurables/{inline_input.js → inline_input.ts} +22 -26
  349. package/core/renderers/measurables/input_connection.d.ts +29 -0
  350. package/core/renderers/measurables/input_connection.ts +66 -0
  351. package/core/renderers/measurables/input_row.d.ts +30 -0
  352. package/core/renderers/measurables/{input_row.js → input_row.ts} +24 -31
  353. package/core/renderers/measurables/jagged_edge.d.ts +20 -0
  354. package/core/renderers/measurables/{jagged_edge.js → jagged_edge.ts} +10 -13
  355. package/core/renderers/measurables/next_connection.d.ts +23 -0
  356. package/core/renderers/measurables/next_connection.ts +47 -0
  357. package/core/renderers/measurables/output_connection.d.ts +26 -0
  358. package/core/renderers/measurables/output_connection.ts +56 -0
  359. package/core/renderers/measurables/previous_connection.d.ts +23 -0
  360. package/core/renderers/measurables/previous_connection.ts +47 -0
  361. package/core/renderers/measurables/round_corner.d.ts +21 -0
  362. package/core/renderers/measurables/round_corner.ts +49 -0
  363. package/core/renderers/measurables/row.d.ts +141 -0
  364. package/core/renderers/measurables/row.ts +225 -0
  365. package/core/renderers/measurables/spacer_row.d.ts +29 -0
  366. package/core/renderers/measurables/spacer_row.ts +55 -0
  367. package/core/renderers/measurables/square_corner.d.ts +21 -0
  368. package/core/renderers/measurables/square_corner.ts +47 -0
  369. package/core/renderers/measurables/statement_input.d.ts +22 -0
  370. package/core/renderers/measurables/{statement_input.js → statement_input.ts} +14 -18
  371. package/core/renderers/measurables/top_row.d.ts +56 -0
  372. package/core/renderers/measurables/top_row.ts +122 -0
  373. package/core/renderers/measurables/types.d.ts +235 -0
  374. package/core/renderers/measurables/types.ts +332 -0
  375. package/core/renderers/minimalist/constants.d.ts +14 -0
  376. package/core/renderers/minimalist/{constants.js → constants.ts} +5 -10
  377. package/core/renderers/minimalist/drawer.d.ts +21 -0
  378. package/core/renderers/minimalist/drawer.ts +38 -0
  379. package/core/renderers/minimalist/info.d.ts +30 -0
  380. package/core/renderers/minimalist/info.ts +52 -0
  381. package/core/renderers/minimalist/minimalist.d.ts +6 -0
  382. package/core/renderers/minimalist/minimalist.ts +22 -0
  383. package/core/renderers/minimalist/renderer.d.ts +41 -0
  384. package/core/renderers/minimalist/renderer.ts +71 -0
  385. package/core/renderers/thrasos/info.d.ts +40 -0
  386. package/core/renderers/thrasos/{info.js → info.ts} +66 -67
  387. package/core/renderers/thrasos/renderer.d.ts +25 -0
  388. package/core/renderers/thrasos/renderer.ts +48 -0
  389. package/core/renderers/thrasos/thrasos.d.ts +4 -0
  390. package/core/renderers/thrasos/thrasos.ts +20 -0
  391. package/core/renderers/zelos/constants.d.ts +186 -0
  392. package/core/renderers/zelos/{constants.js → constants.ts} +294 -441
  393. package/core/renderers/zelos/drawer.d.ts +47 -0
  394. package/core/renderers/zelos/{drawer.js → drawer.ts} +73 -95
  395. package/core/renderers/zelos/info.d.ts +88 -0
  396. package/core/renderers/zelos/{info.js → info.ts} +111 -142
  397. package/core/renderers/zelos/marker_svg.d.ts +46 -0
  398. package/core/renderers/zelos/marker_svg.ts +151 -0
  399. package/core/renderers/zelos/measurables/bottom_row.d.ts +27 -0
  400. package/core/renderers/zelos/measurables/bottom_row.ts +53 -0
  401. package/core/renderers/zelos/measurables/inputs.d.ts +23 -0
  402. package/core/renderers/zelos/measurables/{inputs.js → inputs.ts} +14 -15
  403. package/core/renderers/zelos/measurables/row_elements.d.ts +21 -0
  404. package/core/renderers/zelos/measurables/row_elements.ts +45 -0
  405. package/core/renderers/zelos/measurables/top_row.d.ts +29 -0
  406. package/core/renderers/zelos/measurables/{top_row.js → top_row.ts} +14 -27
  407. package/core/renderers/zelos/path_object.d.ts +77 -0
  408. package/core/renderers/zelos/path_object.ts +215 -0
  409. package/core/renderers/zelos/renderer.d.ts +74 -0
  410. package/core/renderers/zelos/renderer.ts +142 -0
  411. package/core/renderers/zelos/zelos.d.ts +12 -0
  412. package/core/renderers/zelos/zelos.ts +39 -0
  413. package/core/scrollbar.d.ts +277 -0
  414. package/core/{scrollbar.js → scrollbar.ts} +307 -328
  415. package/core/scrollbar_pair.d.ts +105 -0
  416. package/core/{scrollbar_pair.js → scrollbar_pair.ts} +71 -79
  417. package/core/serialization/blocks.d.ts +98 -0
  418. package/core/serialization/{blocks.js → blocks.ts} +229 -228
  419. package/core/serialization/exceptions.d.ts +73 -0
  420. package/core/serialization/exceptions.ts +98 -0
  421. package/core/serialization/priorities.d.ts +15 -0
  422. package/core/serialization/{priorities.js → priorities.ts} +4 -10
  423. package/core/serialization/registry.d.ts +20 -0
  424. package/core/serialization/{registry.js → registry.ts} +11 -13
  425. package/core/serialization/variables.d.ts +14 -0
  426. package/core/serialization/{variables.js → variables.ts} +30 -32
  427. package/core/serialization/workspaces.d.ts +28 -0
  428. package/core/serialization/{workspaces.js → workspaces.ts} +30 -27
  429. package/core/shortcut_items.d.ts +61 -0
  430. package/core/{shortcut_items.js → shortcut_items.ts} +121 -157
  431. package/core/shortcut_registry.d.ts +151 -0
  432. package/core/shortcut_registry.ts +355 -0
  433. package/core/sprites.d.ts +19 -0
  434. package/core/{sprites.js → sprites.ts} +4 -6
  435. package/core/theme/classic.d.ts +12 -0
  436. package/core/theme/{classic.js → classic.ts} +5 -7
  437. package/core/theme/themes.d.ts +8 -0
  438. package/core/theme/themes.ts +22 -0
  439. package/core/theme/zelos.d.ts +11 -0
  440. package/core/theme/{zelos.js → zelos.ts} +4 -7
  441. package/core/theme.d.ts +142 -0
  442. package/core/theme.ts +221 -0
  443. package/core/theme_manager.d.ts +81 -0
  444. package/core/theme_manager.ts +186 -0
  445. package/core/toolbox/category.d.ts +239 -0
  446. package/core/toolbox/category.ts +679 -0
  447. package/core/toolbox/collapsible_category.d.ts +91 -0
  448. package/core/toolbox/collapsible_category.ts +273 -0
  449. package/core/toolbox/separator.d.ts +39 -0
  450. package/core/toolbox/separator.ts +105 -0
  451. package/core/toolbox/toolbox.d.ts +352 -0
  452. package/core/toolbox/{toolbox.js → toolbox.ts} +316 -432
  453. package/core/toolbox/toolbox_item.d.ts +85 -0
  454. package/core/toolbox/toolbox_item.ts +147 -0
  455. package/core/tooltip.d.ts +126 -0
  456. package/core/{tooltip.js → tooltip.ts} +136 -214
  457. package/core/touch.d.ts +121 -0
  458. package/core/touch.ts +306 -0
  459. package/core/touch_gesture.d.ts +115 -0
  460. package/core/{touch_gesture.js → touch_gesture.ts} +87 -125
  461. package/core/trashcan.d.ts +195 -0
  462. package/core/{trashcan.js → trashcan.ts} +226 -312
  463. package/core/utils/aria.d.ts +67 -0
  464. package/core/utils/{aria.js → aria.ts} +47 -61
  465. package/core/utils/array.d.ts +14 -0
  466. package/core/utils/{array.js → array.ts} +10 -12
  467. package/core/utils/colour.d.ts +103 -0
  468. package/core/utils/{colour.js → colour.ts} +60 -72
  469. package/core/utils/coordinate.d.ts +72 -0
  470. package/core/utils/coordinate.ts +124 -0
  471. package/core/utils/deprecation.d.ts +17 -0
  472. package/core/utils/{deprecation.js → deprecation.ts} +11 -11
  473. package/core/utils/dom.d.ts +165 -0
  474. package/core/utils/{dom.js → dom.ts} +125 -147
  475. package/core/utils/idgenerator.d.ts +25 -0
  476. package/core/utils/{idgenerator.js → idgenerator.ts} +15 -18
  477. package/core/utils/keycodes.d.ts +137 -0
  478. package/core/utils/keycodes.ts +169 -0
  479. package/core/utils/math.d.ts +30 -0
  480. package/core/utils/{math.js → math.ts} +17 -19
  481. package/core/utils/metrics.d.ts +64 -0
  482. package/core/utils/metrics.ts +97 -0
  483. package/core/utils/object.d.ts +35 -0
  484. package/core/utils/{object.js → object.ts} +30 -26
  485. package/core/utils/parsing.d.ts +50 -0
  486. package/core/utils/{parsing.js → parsing.ts} +50 -50
  487. package/core/utils/rect.d.ts +38 -0
  488. package/core/utils/{rect.js → rect.ts} +18 -31
  489. package/core/utils/sentinel.d.ts +11 -0
  490. package/core/utils/{sentinel.js → sentinel.ts} +3 -5
  491. package/core/utils/size.d.ts +27 -0
  492. package/core/utils/{size.js → size.ts} +12 -26
  493. package/core/utils/string.d.ts +55 -0
  494. package/core/utils/{string.js → string.ts} +64 -61
  495. package/core/utils/style.d.ts +127 -0
  496. package/core/utils/{style.js → style.ts} +102 -92
  497. package/core/utils/svg.d.ts +68 -0
  498. package/core/utils/svg.ts +88 -0
  499. package/core/utils/svg_math.d.ts +70 -0
  500. package/core/utils/{svg_math.js → svg_math.ts} +72 -71
  501. package/core/utils/svg_paths.d.ts +101 -0
  502. package/core/utils/{svg_paths.js → svg_paths.ts} +56 -65
  503. package/core/utils/toolbox.d.ts +193 -0
  504. package/core/utils/toolbox.ts +433 -0
  505. package/core/utils/useragent.d.ts +33 -0
  506. package/core/utils/useragent.ts +135 -0
  507. package/core/utils/xml.d.ts +52 -0
  508. package/core/utils/{xml.js → xml.ts} +26 -36
  509. package/core/utils.d.ts +217 -0
  510. package/core/utils.ts +428 -0
  511. package/core/variable_map.d.ts +141 -0
  512. package/core/{variable_map.js → variable_map.ts} +131 -149
  513. package/core/variable_model.d.ts +40 -0
  514. package/core/variable_model.ts +82 -0
  515. package/core/variables.d.ts +181 -0
  516. package/core/{variables.js → variables.ts} +206 -188
  517. package/core/variables_dynamic.d.ts +38 -0
  518. package/core/{variables_dynamic.js → variables_dynamic.ts} +47 -43
  519. package/core/warning.d.ts +50 -0
  520. package/core/{warning.js → warning.ts} +52 -66
  521. package/core/widgetdiv.d.ts +69 -0
  522. package/core/widgetdiv.ts +257 -0
  523. package/core/workspace.d.ts +386 -0
  524. package/core/workspace.ts +801 -0
  525. package/core/workspace_audio.d.ts +47 -0
  526. package/core/{workspace_audio.js → workspace_audio.ts} +47 -60
  527. package/core/workspace_comment.d.ts +170 -0
  528. package/core/workspace_comment.ts +398 -0
  529. package/core/workspace_comment_svg.d.ts +329 -0
  530. package/core/{workspace_comment_svg.js → workspace_comment_svg.ts} +347 -444
  531. package/core/workspace_drag_surface_svg.d.ts +68 -0
  532. package/core/{workspace_drag_surface_svg.js → workspace_drag_surface_svg.ts} +75 -82
  533. package/core/workspace_dragger.d.ts +48 -0
  534. package/core/workspace_dragger.ts +104 -0
  535. package/core/workspace_svg.d.ts +920 -0
  536. package/core/{workspace_svg.js → workspace_svg.ts} +855 -935
  537. package/core/xml.d.ts +117 -0
  538. package/core/{xml.js → xml.ts} +306 -326
  539. package/core/zoom_controls.d.ts +130 -0
  540. package/core/{zoom_controls.js → zoom_controls.ts} +185 -251
  541. package/core.d.ts +1 -3
  542. package/core.js +1 -2
  543. package/dart.d.ts +0 -3
  544. package/dart_compressed.js +387 -99
  545. package/dart_compressed.js.map +1 -1
  546. package/generators/dart/all.js +2 -0
  547. package/generators/dart/colour.js +1 -1
  548. package/generators/dart/lists.js +1 -1
  549. package/generators/dart/logic.js +1 -1
  550. package/generators/dart/loops.js +1 -1
  551. package/generators/dart/math.js +1 -1
  552. package/generators/dart/procedures.js +1 -1
  553. package/generators/dart/text.js +1 -1
  554. package/generators/dart/variables.js +1 -1
  555. package/generators/dart/variables_dynamic.js +1 -1
  556. package/generators/dart.js +1 -2
  557. package/generators/javascript/all.js +2 -0
  558. package/generators/javascript/colour.js +1 -1
  559. package/generators/javascript/lists.js +1 -1
  560. package/generators/javascript/logic.js +1 -1
  561. package/generators/javascript/loops.js +1 -1
  562. package/generators/javascript/math.js +4 -4
  563. package/generators/javascript/procedures.js +1 -1
  564. package/generators/javascript/text.js +2 -2
  565. package/generators/javascript/variables.js +1 -1
  566. package/generators/javascript/variables_dynamic.js +1 -1
  567. package/generators/javascript.js +1 -3
  568. package/generators/lua/all.js +2 -0
  569. package/generators/lua/colour.js +1 -1
  570. package/generators/lua/lists.js +1 -1
  571. package/generators/lua/logic.js +1 -1
  572. package/generators/lua/loops.js +1 -1
  573. package/generators/lua/math.js +1 -1
  574. package/generators/lua/procedures.js +1 -1
  575. package/generators/lua/text.js +1 -1
  576. package/generators/lua/variables.js +1 -1
  577. package/generators/lua/variables_dynamic.js +1 -1
  578. package/generators/lua.js +1 -2
  579. package/generators/php/all.js +2 -0
  580. package/generators/php/colour.js +1 -1
  581. package/generators/php/lists.js +1 -2
  582. package/generators/php/logic.js +1 -1
  583. package/generators/php/loops.js +1 -1
  584. package/generators/php/math.js +1 -1
  585. package/generators/php/procedures.js +1 -1
  586. package/generators/php/text.js +1 -1
  587. package/generators/php/variables.js +1 -1
  588. package/generators/php/variables_dynamic.js +1 -1
  589. package/generators/php.js +1 -2
  590. package/generators/python/all.js +2 -0
  591. package/generators/python/colour.js +3 -3
  592. package/generators/python/lists.js +1 -1
  593. package/generators/python/logic.js +1 -1
  594. package/generators/python/loops.js +4 -7
  595. package/generators/python/math.js +1 -1
  596. package/generators/python/procedures.js +1 -1
  597. package/generators/python/text.js +1 -1
  598. package/generators/python/variables.js +1 -1
  599. package/generators/python/variables_dynamic.js +1 -1
  600. package/generators/python.js +1 -2
  601. package/index.d.ts +2 -8
  602. package/javascript.d.ts +0 -3
  603. package/javascript_compressed.js +314 -104
  604. package/javascript_compressed.js.map +1 -1
  605. package/lua.d.ts +0 -3
  606. package/lua_compressed.js +399 -81
  607. package/lua_compressed.js.map +1 -1
  608. package/msg/ab.js +420 -420
  609. package/msg/ace.js +420 -420
  610. package/msg/af.js +420 -420
  611. package/msg/am.js +420 -420
  612. package/msg/ar.js +420 -420
  613. package/msg/ast.js +420 -420
  614. package/msg/az.js +420 -420
  615. package/msg/ba.js +420 -420
  616. package/msg/bcc.js +420 -420
  617. package/msg/be-tarask.js +420 -420
  618. package/msg/be.js +420 -420
  619. package/msg/bg.js +420 -420
  620. package/msg/bn.js +420 -420
  621. package/msg/br.js +420 -420
  622. package/msg/bs.js +420 -420
  623. package/msg/ca.js +420 -420
  624. package/msg/cdo.js +420 -420
  625. package/msg/cs.js +420 -420
  626. package/msg/da.js +420 -420
  627. package/msg/de.js +420 -420
  628. package/msg/diq.js +420 -420
  629. package/msg/dty.js +420 -420
  630. package/msg/ee.js +420 -420
  631. package/msg/el.js +420 -420
  632. package/msg/en-gb.js +420 -420
  633. package/msg/en.js +420 -420
  634. package/msg/eo.js +420 -420
  635. package/msg/es.js +420 -420
  636. package/msg/et.js +420 -420
  637. package/msg/eu.js +420 -420
  638. package/msg/fa.js +420 -420
  639. package/msg/fi.js +420 -420
  640. package/msg/fo.js +420 -420
  641. package/msg/fr.js +420 -420
  642. package/msg/frr.js +420 -420
  643. package/msg/gl.js +420 -420
  644. package/msg/gn.js +420 -420
  645. package/msg/gor.js +420 -420
  646. package/msg/ha.js +420 -420
  647. package/msg/hak.js +420 -420
  648. package/msg/he.js +420 -420
  649. package/msg/hi.js +420 -420
  650. package/msg/hr.js +420 -420
  651. package/msg/hrx.js +420 -420
  652. package/msg/hu.js +420 -420
  653. package/msg/hy.js +420 -420
  654. package/msg/ia.js +420 -420
  655. package/msg/id.js +420 -420
  656. package/msg/ig.js +420 -420
  657. package/msg/inh.js +420 -420
  658. package/msg/is.js +420 -420
  659. package/msg/it.js +420 -420
  660. package/msg/ja.js +420 -420
  661. package/msg/ka.js +420 -420
  662. package/msg/kab.js +420 -420
  663. package/msg/kbd-cyrl.js +420 -420
  664. package/msg/km.js +420 -420
  665. package/msg/kn.js +420 -420
  666. package/msg/ko.js +420 -420
  667. package/msg/ksh.js +420 -420
  668. package/msg/ku-latn.js +420 -420
  669. package/msg/ky.js +420 -420
  670. package/msg/la.js +420 -420
  671. package/msg/lb.js +420 -420
  672. package/msg/lki.js +420 -420
  673. package/msg/lo.js +420 -420
  674. package/msg/lrc.js +420 -420
  675. package/msg/lt.js +420 -420
  676. package/msg/lv.js +420 -420
  677. package/msg/mg.js +420 -420
  678. package/msg/mk.js +420 -420
  679. package/msg/ml.js +420 -420
  680. package/msg/mnw.js +420 -420
  681. package/msg/ms.js +420 -420
  682. package/msg/my.js +420 -420
  683. package/msg/mzn.js +420 -420
  684. package/msg/nb.js +420 -420
  685. package/msg/ne.js +420 -420
  686. package/msg/nl.js +420 -420
  687. package/msg/oc.js +420 -420
  688. package/msg/olo.js +420 -420
  689. package/msg/pa.js +420 -420
  690. package/msg/pl.js +420 -420
  691. package/msg/pms.js +420 -420
  692. package/msg/ps.js +420 -420
  693. package/msg/pt-br.js +420 -420
  694. package/msg/pt.js +420 -420
  695. package/msg/ro.js +420 -420
  696. package/msg/ru.js +420 -420
  697. package/msg/sc.js +420 -420
  698. package/msg/sco.js +420 -420
  699. package/msg/sd.js +420 -420
  700. package/msg/shn.js +420 -420
  701. package/msg/si.js +420 -420
  702. package/msg/sk.js +420 -420
  703. package/msg/skr-arab.js +420 -420
  704. package/msg/sl.js +420 -420
  705. package/msg/smn.js +420 -420
  706. package/msg/sq.js +420 -420
  707. package/msg/sr-latn.js +420 -420
  708. package/msg/sr.js +420 -420
  709. package/msg/sv.js +420 -420
  710. package/msg/sw.js +420 -420
  711. package/msg/ta.js +420 -420
  712. package/msg/tcy.js +420 -420
  713. package/msg/te.js +420 -420
  714. package/msg/th.js +420 -420
  715. package/msg/ti.js +420 -420
  716. package/msg/tl.js +420 -420
  717. package/msg/tlh.js +420 -420
  718. package/msg/tr.js +420 -420
  719. package/msg/ug-arab.js +420 -420
  720. package/msg/uk.js +420 -420
  721. package/msg/ur.js +420 -420
  722. package/msg/uz.js +420 -420
  723. package/msg/vi.js +420 -420
  724. package/msg/xmf.js +420 -420
  725. package/msg/yo.js +420 -420
  726. package/msg/yue.js +420 -420
  727. package/msg/zgh.js +420 -420
  728. package/msg/zh-hans.js +420 -420
  729. package/msg/zh-hant.js +420 -420
  730. package/package.json +5 -5
  731. package/php.d.ts +0 -3
  732. package/php_compressed.js +322 -93
  733. package/php_compressed.js.map +1 -1
  734. package/python.d.ts +0 -3
  735. package/python_compressed.js +237 -90
  736. package/python_compressed.js.map +1 -1
  737. package/blockly.d.ts +0 -26127
  738. package/core/blockly_options.js +0 -28
  739. package/core/bubble_dragger.js +0 -298
  740. package/core/clipboard.js +0 -80
  741. package/core/component_manager.js +0 -263
  742. package/core/contextmenu_items.js +0 -651
  743. package/core/contextmenu_registry.js +0 -178
  744. package/core/delete_area.js +0 -87
  745. package/core/dialog.js +0 -107
  746. package/core/drag_target.js +0 -98
  747. package/core/events/events.js +0 -147
  748. package/core/events/events_abstract.js +0 -133
  749. package/core/events/events_block_base.js +0 -70
  750. package/core/events/events_block_drag.js +0 -89
  751. package/core/events/events_bubble_open.js +0 -90
  752. package/core/events/events_comment_base.js +0 -121
  753. package/core/events/events_marker_move.js +0 -110
  754. package/core/events/events_selected.js +0 -83
  755. package/core/events/events_toolbox_item_select.js +0 -84
  756. package/core/events/events_trashcan_open.js +0 -73
  757. package/core/events/events_var_base.js +0 -70
  758. package/core/events/events_viewport.js +0 -107
  759. package/core/events/workspace_events.js +0 -93
  760. package/core/field_angle.js +0 -591
  761. package/core/field_checkbox.js +0 -255
  762. package/core/field_colour.js +0 -717
  763. package/core/field_image.js +0 -304
  764. package/core/field_label.js +0 -149
  765. package/core/field_label_serializable.js +0 -80
  766. package/core/field_textinput.js +0 -619
  767. package/core/flyout_button.js +0 -356
  768. package/core/grid.js +0 -226
  769. package/core/icon.js +0 -225
  770. package/core/input.js +0 -335
  771. package/core/interfaces/i_ast_node_location_svg.js +0 -45
  772. package/core/interfaces/i_ast_node_location_with_block.js +0 -41
  773. package/core/interfaces/i_autohideable.js +0 -40
  774. package/core/interfaces/i_block_dragger.js +0 -66
  775. package/core/interfaces/i_bounded_element.js +0 -45
  776. package/core/interfaces/i_bubble.js +0 -95
  777. package/core/interfaces/i_collapsible_toolbox_item.js +0 -53
  778. package/core/interfaces/i_connection_checker.js +0 -104
  779. package/core/interfaces/i_contextmenu.js +0 -32
  780. package/core/interfaces/i_copyable.js +0 -49
  781. package/core/interfaces/i_delete_area.js +0 -50
  782. package/core/interfaces/i_drag_target.js +0 -88
  783. package/core/interfaces/i_flyout.js +0 -201
  784. package/core/interfaces/i_keyboard_accessible.js +0 -38
  785. package/core/interfaces/i_metrics_manager.js +0 -154
  786. package/core/interfaces/i_positionable.js +0 -51
  787. package/core/interfaces/i_selectable.js +0 -51
  788. package/core/interfaces/i_selectable_toolbox_item.js +0 -73
  789. package/core/interfaces/i_serializer.js +0 -77
  790. package/core/interfaces/i_styleable.js +0 -39
  791. package/core/interfaces/i_toolbox.js +0 -142
  792. package/core/interfaces/i_toolbox_item.js +0 -85
  793. package/core/marker_manager.js +0 -213
  794. package/core/menuitem.js +0 -292
  795. package/core/names.js +0 -293
  796. package/core/registry.js +0 -384
  797. package/core/renderers/common/block_rendering.js +0 -170
  798. package/core/renderers/common/constants.js +0 -1250
  799. package/core/renderers/common/i_path_object.js +0 -162
  800. package/core/renderers/common/marker_svg.js +0 -721
  801. package/core/renderers/common/path_object.js +0 -283
  802. package/core/renderers/common/renderer.js +0 -305
  803. package/core/renderers/geras/constants.js +0 -73
  804. package/core/renderers/geras/geras.js +0 -36
  805. package/core/renderers/geras/measurables/inline_input.js +0 -58
  806. package/core/renderers/geras/measurables/statement_input.js +0 -57
  807. package/core/renderers/geras/renderer.js +0 -149
  808. package/core/renderers/measurables/base.js +0 -64
  809. package/core/renderers/measurables/bottom_row.js +0 -138
  810. package/core/renderers/measurables/connection.js +0 -56
  811. package/core/renderers/measurables/external_value_input.js +0 -70
  812. package/core/renderers/measurables/field.js +0 -71
  813. package/core/renderers/measurables/in_row_spacer.js +0 -47
  814. package/core/renderers/measurables/input_connection.js +0 -75
  815. package/core/renderers/measurables/next_connection.js +0 -50
  816. package/core/renderers/measurables/output_connection.js +0 -61
  817. package/core/renderers/measurables/previous_connection.js +0 -50
  818. package/core/renderers/measurables/round_corner.js +0 -52
  819. package/core/renderers/measurables/row.js +0 -247
  820. package/core/renderers/measurables/spacer_row.js +0 -69
  821. package/core/renderers/measurables/square_corner.js +0 -50
  822. package/core/renderers/measurables/top_row.js +0 -143
  823. package/core/renderers/measurables/types.js +0 -353
  824. package/core/renderers/minimalist/drawer.js +0 -42
  825. package/core/renderers/minimalist/info.js +0 -54
  826. package/core/renderers/minimalist/minimalist.js +0 -26
  827. package/core/renderers/minimalist/renderer.js +0 -80
  828. package/core/renderers/thrasos/renderer.js +0 -53
  829. package/core/renderers/thrasos/thrasos.js +0 -22
  830. package/core/renderers/zelos/marker_svg.js +0 -179
  831. package/core/renderers/zelos/measurables/bottom_row.js +0 -66
  832. package/core/renderers/zelos/measurables/row_elements.js +0 -46
  833. package/core/renderers/zelos/path_object.js +0 -247
  834. package/core/renderers/zelos/renderer.js +0 -147
  835. package/core/renderers/zelos/zelos.js +0 -38
  836. package/core/serialization/exceptions.js +0 -144
  837. package/core/shortcut_registry.js +0 -366
  838. package/core/theme/themes.js +0 -23
  839. package/core/theme.js +0 -228
  840. package/core/theme_manager.js +0 -211
  841. package/core/toolbox/category.js +0 -751
  842. package/core/toolbox/collapsible_category.js +0 -311
  843. package/core/toolbox/separator.js +0 -133
  844. package/core/toolbox/toolbox_item.js +0 -173
  845. package/core/touch.js +0 -285
  846. package/core/utils/coordinate.js +0 -138
  847. package/core/utils/global.js +0 -41
  848. package/core/utils/keycodes.js +0 -172
  849. package/core/utils/metrics.js +0 -154
  850. package/core/utils/svg.js +0 -186
  851. package/core/utils/toolbox.js +0 -459
  852. package/core/utils/useragent.js +0 -197
  853. package/core/utils.js +0 -383
  854. package/core/variable_model.js +0 -96
  855. package/core/widgetdiv.js +0 -290
  856. package/core/workspace.js +0 -836
  857. package/core/workspace_comment.js +0 -400
  858. package/core/workspace_dragger.js +0 -115
@@ -7,50 +7,52 @@
7
7
  /**
8
8
  * @fileoverview XML reader and writer.
9
9
  */
10
- 'use strict';
11
10
 
12
11
  /**
13
12
  * XML reader and writer.
14
13
  * @namespace Blockly.Xml
15
14
  */
16
- goog.module('Blockly.Xml');
17
-
18
- const dom = goog.require('Blockly.utils.dom');
19
- const eventUtils = goog.require('Blockly.Events.utils');
20
- const utilsXml = goog.require('Blockly.utils.xml');
21
- /* eslint-disable-next-line no-unused-vars */
22
- const {Block} = goog.requireType('Blockly.Block');
23
- /* eslint-disable-next-line no-unused-vars */
24
- const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
25
- /* eslint-disable-next-line no-unused-vars */
26
- const {Connection} = goog.requireType('Blockly.Connection');
27
- /* eslint-disable-next-line no-unused-vars */
28
- const {Field} = goog.requireType('Blockly.Field');
29
- const {Size} = goog.require('Blockly.utils.Size');
30
- /* eslint-disable-next-line no-unused-vars */
31
- const {VariableModel} = goog.requireType('Blockly.VariableModel');
32
- /* eslint-disable-next-line no-unused-vars */
33
- const {WorkspaceSvg} = goog.requireType('Blockly.WorkspaceSvg');
34
- /* eslint-disable-next-line no-unused-vars */
35
- const {Workspace} = goog.requireType('Blockly.Workspace');
36
- const {inputTypes} = goog.require('Blockly.inputTypes');
37
- goog.requireType('Blockly.Comment');
38
- goog.requireType('Blockly.Variables');
39
- goog.requireType('Blockly.WorkspaceComment');
40
- goog.requireType('Blockly.WorkspaceCommentSvg');
15
+ import * as goog from '../closure/goog/goog.js';
16
+ goog.declareModuleId('Blockly.Xml');
17
+
18
+ // Unused import preserved for side-effects. Remove if unneeded.
19
+ // import './comment.js';
20
+ // Unused import preserved for side-effects. Remove if unneeded.
21
+ // import './variables.js';
22
+ // Unused import preserved for side-effects. Remove if unneeded.
23
+ // import './workspace_comment.js';
24
+ // Unused import preserved for side-effects. Remove if unneeded.
25
+ // import './workspace_comment_svg.js';
26
+
27
+ import type {Block} from './block.js';
28
+ import type {BlockSvg} from './block_svg.js';
29
+ import type {Connection} from './connection.js';
30
+ import * as eventUtils from './events/utils.js';
31
+ import type {Field} from './field.js';
32
+ import {inputTypes} from './input_types.js';
33
+ import * as dom from './utils/dom.js';
34
+ import {Size} from './utils/size.js';
35
+ import * as utilsXml from './utils/xml.js';
36
+ import type {VariableModel} from './variable_model.js';
37
+ import * as Variables from './variables.js';
38
+ import type {Workspace} from './workspace.js';
39
+ import {WorkspaceComment} from './workspace_comment.js';
40
+ import {WorkspaceCommentSvg} from './workspace_comment_svg.js';
41
+ import type {WorkspaceSvg} from './workspace_svg.js';
41
42
 
42
43
 
43
44
  /**
44
45
  * Encode a block tree as XML.
45
- * @param {!Workspace} workspace The workspace containing blocks.
46
- * @param {boolean=} opt_noId True if the encoder should skip the block IDs.
47
- * @return {!Element} XML DOM element.
46
+ * @param workspace The workspace containing blocks.
47
+ * @param opt_noId True if the encoder should skip the block IDs.
48
+ * @return XML DOM element.
48
49
  * @alias Blockly.Xml.workspaceToDom
49
50
  */
50
- const workspaceToDom = function(workspace, opt_noId) {
51
+ export function workspaceToDom(
52
+ workspace: Workspace, opt_noId?: boolean): Element {
51
53
  const treeXml = utilsXml.createElement('xml');
52
- const variablesElement = variablesToDom(
53
- goog.module.get('Blockly.Variables').allUsedVarModels(workspace));
54
+ const variablesElement =
55
+ variablesToDom(Variables.allUsedVarModels(workspace));
54
56
  if (variablesElement.hasChildNodes()) {
55
57
  treeXml.appendChild(variablesElement);
56
58
  }
@@ -65,17 +67,15 @@ const workspaceToDom = function(workspace, opt_noId) {
65
67
  treeXml.appendChild(blockToDomWithXY(block, opt_noId));
66
68
  }
67
69
  return treeXml;
68
- };
69
- exports.workspaceToDom = workspaceToDom;
70
+ }
70
71
 
71
72
  /**
72
73
  * Encode a list of variables as XML.
73
- * @param {!Array<!VariableModel>} variableList List of all variable
74
- * models.
75
- * @return {!Element} Tree of XML elements.
74
+ * @param variableList List of all variable models.
75
+ * @return Tree of XML elements.
76
76
  * @alias Blockly.Xml.variablesToDom
77
77
  */
78
- const variablesToDom = function(variableList) {
78
+ export function variablesToDom(variableList: VariableModel[]): Element {
79
79
  const variables = utilsXml.createElement('variables');
80
80
  for (let i = 0; i < variableList.length; i++) {
81
81
  const variable = variableList[i];
@@ -88,18 +88,18 @@ const variablesToDom = function(variableList) {
88
88
  variables.appendChild(element);
89
89
  }
90
90
  return variables;
91
- };
92
- exports.variablesToDom = variablesToDom;
91
+ }
93
92
 
94
93
  /**
95
94
  * Encode a block subtree as XML with XY coordinates.
96
- * @param {!Block} block The root block to encode.
97
- * @param {boolean=} opt_noId True if the encoder should skip the block ID.
98
- * @return {!Element|!DocumentFragment} Tree of XML elements or an empty
99
- * document fragment if the block was an insertion marker.
95
+ * @param block The root block to encode.
96
+ * @param opt_noId True if the encoder should skip the block ID.
97
+ * @return Tree of XML elements or an empty document fragment if the block was
98
+ * an insertion marker.
100
99
  * @alias Blockly.Xml.blockToDomWithXY
101
100
  */
102
- const blockToDomWithXY = function(block, opt_noId) {
101
+ export function blockToDomWithXY(block: Block, opt_noId?: boolean): Element|
102
+ DocumentFragment {
103
103
  if (block.isInsertionMarker()) { // Skip over insertion markers.
104
104
  block = block.getChildren(false)[0];
105
105
  if (!block) {
@@ -108,43 +108,44 @@ const blockToDomWithXY = function(block, opt_noId) {
108
108
  }
109
109
  }
110
110
 
111
- let width; // Not used in LTR.
111
+ let width = 0; // Not used in LTR.
112
112
  if (block.workspace.RTL) {
113
113
  width = block.workspace.getWidth();
114
114
  }
115
115
 
116
116
  const element = blockToDom(block, opt_noId);
117
117
  const xy = block.getRelativeToSurfaceXY();
118
- element.setAttribute(
119
- 'x', Math.round(block.workspace.RTL ? width - xy.x : xy.x));
120
- element.setAttribute('y', Math.round(xy.y));
118
+ // AnyDuringMigration because: Property 'setAttribute' does not exist on type
119
+ // 'Element | DocumentFragment'.
120
+ (element as AnyDuringMigration)
121
+ .setAttribute('x', Math.round(block.workspace.RTL ? width - xy.x : xy.x));
122
+ // AnyDuringMigration because: Property 'setAttribute' does not exist on type
123
+ // 'Element | DocumentFragment'.
124
+ (element as AnyDuringMigration).setAttribute('y', Math.round(xy.y));
121
125
  return element;
122
- };
123
- exports.blockToDomWithXY = blockToDomWithXY;
126
+ }
124
127
 
125
128
  /**
126
129
  * Encode a field as XML.
127
- * @param {!Field} field The field to encode.
128
- * @return {?Element} XML element, or null if the field did not need to be
129
- * serialized.
130
+ * @param field The field to encode.
131
+ * @return XML element, or null if the field did not need to be serialized.
130
132
  */
131
- const fieldToDom = function(field) {
133
+ function fieldToDom(field: Field): Element|null {
132
134
  if (field.isSerializable()) {
133
135
  const container = utilsXml.createElement('field');
134
136
  container.setAttribute('name', field.name || '');
135
137
  return field.toXml(container);
136
138
  }
137
139
  return null;
138
- };
140
+ }
139
141
 
140
142
  /**
141
143
  * Encode all of a block's fields as XML and attach them to the given tree of
142
144
  * XML elements.
143
- * @param {!Block} block A block with fields to be encoded.
144
- * @param {!Element} element The XML element to which the field DOM should be
145
- * attached.
145
+ * @param block A block with fields to be encoded.
146
+ * @param element The XML element to which the field DOM should be attached.
146
147
  */
147
- const allFieldsToDom = function(block, element) {
148
+ function allFieldsToDom(block: Block, element: Element) {
148
149
  for (let i = 0; i < block.inputList.length; i++) {
149
150
  const input = block.inputList[i];
150
151
  for (let j = 0; j < input.fieldRow.length; j++) {
@@ -155,17 +156,18 @@ const allFieldsToDom = function(block, element) {
155
156
  }
156
157
  }
157
158
  }
158
- };
159
+ }
159
160
 
160
161
  /**
161
162
  * Encode a block subtree as XML.
162
- * @param {!Block} block The root block to encode.
163
- * @param {boolean=} opt_noId True if the encoder should skip the block ID.
164
- * @return {!Element|!DocumentFragment} Tree of XML elements or an empty
165
- * document fragment if the block was an insertion marker.
163
+ * @param block The root block to encode.
164
+ * @param opt_noId True if the encoder should skip the block ID.
165
+ * @return Tree of XML elements or an empty document fragment if the block was
166
+ * an insertion marker.
166
167
  * @alias Blockly.Xml.blockToDom
167
168
  */
168
- const blockToDom = function(block, opt_noId) {
169
+ export function blockToDom(block: Block, opt_noId?: boolean): Element|
170
+ DocumentFragment {
169
171
  // Skip over insertion markers.
170
172
  if (block.isInsertionMarker()) {
171
173
  const child = block.getChildren(false)[0];
@@ -201,9 +203,15 @@ const blockToDom = function(block, opt_noId) {
201
203
 
202
204
  const commentElement = utilsXml.createElement('comment');
203
205
  commentElement.appendChild(utilsXml.createTextNode(commentText));
204
- commentElement.setAttribute('pinned', pinned);
205
- commentElement.setAttribute('h', size.height);
206
- commentElement.setAttribute('w', size.width);
206
+ // AnyDuringMigration because: Argument of type 'boolean' is not assignable
207
+ // to parameter of type 'string'.
208
+ commentElement.setAttribute('pinned', pinned as AnyDuringMigration);
209
+ // AnyDuringMigration because: Argument of type 'number' is not assignable
210
+ // to parameter of type 'string'.
211
+ commentElement.setAttribute('h', size.height as AnyDuringMigration);
212
+ // AnyDuringMigration because: Argument of type 'number' is not assignable
213
+ // to parameter of type 'string'.
214
+ commentElement.setAttribute('w', size.width as AnyDuringMigration);
207
215
 
208
216
  element.appendChild(commentElement);
209
217
  }
@@ -216,56 +224,56 @@ const blockToDom = function(block, opt_noId) {
216
224
 
217
225
  for (let i = 0; i < block.inputList.length; i++) {
218
226
  const input = block.inputList[i];
219
- let container;
227
+ let container: Element;
220
228
  let empty = true;
221
229
  if (input.type === inputTypes.DUMMY) {
222
230
  continue;
223
231
  } else {
224
- const childBlock = input.connection.targetBlock();
232
+ const childBlock = input.connection!.targetBlock();
225
233
  if (input.type === inputTypes.VALUE) {
226
234
  container = utilsXml.createElement('value');
227
235
  } else if (input.type === inputTypes.STATEMENT) {
228
236
  container = utilsXml.createElement('statement');
229
237
  }
230
- const childShadow = input.connection.getShadowDom();
238
+ const childShadow = input.connection!.getShadowDom();
231
239
  if (childShadow && (!childBlock || !childBlock.isShadow())) {
232
- container.appendChild(cloneShadow(childShadow, opt_noId));
240
+ container!.appendChild(cloneShadow(childShadow, opt_noId));
233
241
  }
234
242
  if (childBlock) {
235
243
  const childElem = blockToDom(childBlock, opt_noId);
236
244
  if (childElem.nodeType === dom.NodeType.ELEMENT_NODE) {
237
- container.appendChild(childElem);
245
+ container!.appendChild(childElem);
238
246
  empty = false;
239
247
  }
240
248
  }
241
249
  }
242
- container.setAttribute('name', input.name);
250
+ container!.setAttribute('name', input.name);
243
251
  if (!empty) {
244
- element.appendChild(container);
252
+ element.appendChild(container!);
245
253
  }
246
254
  }
247
255
  if (block.inputsInline !== undefined &&
248
256
  block.inputsInline !== block.inputsInlineDefault) {
249
- element.setAttribute('inline', block.inputsInline);
257
+ element.setAttribute('inline', block.inputsInline.toString());
250
258
  }
251
259
  if (block.isCollapsed()) {
252
- element.setAttribute('collapsed', true);
260
+ element.setAttribute('collapsed', 'true');
253
261
  }
254
262
  if (!block.isEnabled()) {
255
- element.setAttribute('disabled', true);
263
+ element.setAttribute('disabled', 'true');
256
264
  }
257
265
  if (!block.isDeletable() && !block.isShadow()) {
258
- element.setAttribute('deletable', false);
266
+ element.setAttribute('deletable', 'false');
259
267
  }
260
268
  if (!block.isMovable() && !block.isShadow()) {
261
- element.setAttribute('movable', false);
269
+ element.setAttribute('movable', 'false');
262
270
  }
263
271
  if (!block.isEditable()) {
264
- element.setAttribute('editable', false);
272
+ element.setAttribute('editable', 'false');
265
273
  }
266
274
 
267
275
  const nextBlock = block.getNextBlock();
268
- let container;
276
+ let container: Element;
269
277
  if (nextBlock) {
270
278
  const nextElem = blockToDom(nextBlock, opt_noId);
271
279
  if (nextElem.nodeType === dom.NodeType.ELEMENT_NODE) {
@@ -277,29 +285,28 @@ const blockToDom = function(block, opt_noId) {
277
285
  const nextShadow =
278
286
  block.nextConnection && block.nextConnection.getShadowDom();
279
287
  if (nextShadow && (!nextBlock || !nextBlock.isShadow())) {
280
- container.appendChild(cloneShadow(nextShadow, opt_noId));
288
+ container!.appendChild(cloneShadow(nextShadow, opt_noId));
281
289
  }
282
290
 
283
291
  return element;
284
- };
285
- exports.blockToDom = blockToDom;
292
+ }
286
293
 
287
294
  /**
288
295
  * Deeply clone the shadow's DOM so that changes don't back-wash to the block.
289
- * @param {!Element} shadow A tree of XML elements.
290
- * @param {boolean=} opt_noId True if the encoder should skip the block ID.
291
- * @return {!Element} A tree of XML elements.
296
+ * @param shadow A tree of XML elements.
297
+ * @param opt_noId True if the encoder should skip the block ID.
298
+ * @return A tree of XML elements.
292
299
  */
293
- const cloneShadow = function(shadow, opt_noId) {
294
- shadow = shadow.cloneNode(true);
300
+ function cloneShadow(shadow: Element, opt_noId?: boolean): Element {
301
+ shadow = shadow.cloneNode(true) as Element;
295
302
  // Walk the tree looking for whitespace. Don't prune whitespace in a tag.
296
- let node = shadow;
303
+ let node: Node|null = shadow;
297
304
  let textNode;
298
305
  while (node) {
299
306
  if (opt_noId && node.nodeName === 'shadow') {
300
307
  // Strip off IDs from shadow blocks. There should never be a 'block' as
301
308
  // a child of a 'shadow', so no need to check that.
302
- node.removeAttribute('id');
309
+ (node as Element).removeAttribute('id');
303
310
  }
304
311
  if (node.firstChild) {
305
312
  node = node.firstChild;
@@ -308,7 +315,8 @@ const cloneShadow = function(shadow, opt_noId) {
308
315
  textNode = node;
309
316
  node = node.parentNode;
310
317
  if (textNode.nodeType === dom.NodeType.TEXT_NODE &&
311
- textNode.data.trim() === '' && node.firstChild !== textNode) {
318
+ (textNode as Text).data.trim() === '' &&
319
+ node?.firstChild !== textNode) {
312
320
  // Prune whitespace after a tag.
313
321
  dom.removeNode(textNode);
314
322
  }
@@ -317,7 +325,7 @@ const cloneShadow = function(shadow, opt_noId) {
317
325
  textNode = node;
318
326
  node = node.nextSibling;
319
327
  if (textNode.nodeType === dom.NodeType.TEXT_NODE &&
320
- textNode.data.trim() === '') {
328
+ (textNode as Text).data.trim() === '') {
321
329
  // Prune whitespace before a tag.
322
330
  dom.removeNode(textNode);
323
331
  }
@@ -325,31 +333,30 @@ const cloneShadow = function(shadow, opt_noId) {
325
333
  }
326
334
  }
327
335
  return shadow;
328
- };
336
+ }
329
337
 
330
338
  /**
331
339
  * Converts a DOM structure into plain text.
332
340
  * Currently the text format is fairly ugly: all one line with no whitespace,
333
341
  * unless the DOM itself has whitespace built-in.
334
- * @param {!Node} dom A tree of XML nodes.
335
- * @return {string} Text representation.
342
+ * @param dom A tree of XML nodes.
343
+ * @return Text representation.
336
344
  * @alias Blockly.Xml.domToText
337
345
  */
338
- const domToText = function(dom) {
346
+ export function domToText(dom: Node): string {
339
347
  const text = utilsXml.domToText(dom);
340
348
  // Unpack self-closing tags. These tags fail when embedded in HTML.
341
349
  // <block name="foo"/> -> <block name="foo"></block>
342
350
  return text.replace(/<(\w+)([^<]*)\/>/g, '<$1$2></$1>');
343
- };
344
- exports.domToText = domToText;
351
+ }
345
352
 
346
353
  /**
347
354
  * Converts a DOM structure into properly indented text.
348
- * @param {!Node} dom A tree of XML elements.
349
- * @return {string} Text representation.
355
+ * @param dom A tree of XML elements.
356
+ * @return Text representation.
350
357
  * @alias Blockly.Xml.domToPrettyText
351
358
  */
352
- const domToPrettyText = function(dom) {
359
+ export function domToPrettyText(dom: Node): string {
353
360
  // This function is not guaranteed to be correct for all XML.
354
361
  // But it handles the XML that Blockly generates.
355
362
  const blob = domToText(dom);
@@ -373,67 +380,54 @@ const domToPrettyText = function(dom) {
373
380
  text = text.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g, '$1</$2>');
374
381
  // Trim leading blank line.
375
382
  return text.replace(/^\n/, '');
376
- };
377
- exports.domToPrettyText = domToPrettyText;
383
+ }
378
384
 
379
385
  /**
380
386
  * Converts an XML string into a DOM structure.
381
- * @param {string} text An XML string.
382
- * @return {!Element} A DOM object representing the singular child of the
383
- * document element.
387
+ * @param text An XML string.
388
+ * @return A DOM object representing the singular child of the document element.
384
389
  * @throws if the text doesn't parse.
385
390
  * @alias Blockly.Xml.textToDom
386
391
  */
387
- const textToDom = function(text) {
392
+ export function textToDom(text: string): Element {
388
393
  const doc = utilsXml.textToDomDocument(text);
389
394
  if (!doc || !doc.documentElement ||
390
395
  doc.getElementsByTagName('parsererror').length) {
391
396
  throw Error('textToDom was unable to parse: ' + text);
392
397
  }
393
398
  return doc.documentElement;
394
- };
395
- exports.textToDom = textToDom;
399
+ }
396
400
 
397
401
  /**
398
402
  * Clear the given workspace then decode an XML DOM and
399
403
  * create blocks on the workspace.
400
- * @param {!Element} xml XML DOM.
401
- * @param {!WorkspaceSvg} workspace The workspace.
402
- * @return {!Array<string>} An array containing new block IDs.
404
+ * @param xml XML DOM.
405
+ * @param workspace The workspace.
406
+ * @return An array containing new block IDs.
403
407
  * @alias Blockly.Xml.clearWorkspaceAndLoadFromXml
404
408
  */
405
- const clearWorkspaceAndLoadFromXml = function(xml, workspace) {
409
+ export function clearWorkspaceAndLoadFromXml(
410
+ xml: Element, workspace: WorkspaceSvg): string[] {
406
411
  workspace.setResizesEnabled(false);
407
412
  workspace.clear();
408
- const blockIds = domToWorkspace(xml, workspace);
413
+ // AnyDuringMigration because: Argument of type 'WorkspaceSvg' is not
414
+ // assignable to parameter of type 'Workspace'.
415
+ const blockIds = domToWorkspace(xml, workspace as AnyDuringMigration);
409
416
  workspace.setResizesEnabled(true);
410
417
  return blockIds;
411
- };
412
- exports.clearWorkspaceAndLoadFromXml = clearWorkspaceAndLoadFromXml;
418
+ }
413
419
 
414
420
  /**
415
421
  * Decode an XML DOM and create blocks on the workspace.
416
- * @param {!Element} xml XML DOM.
417
- * @param {!Workspace} workspace The workspace.
418
- * @return {!Array<string>} An array containing new block IDs.
422
+ * @param xml XML DOM.
423
+ * @param workspace The workspace.
424
+ * @return An array containing new block IDs.
419
425
  * @suppress {strictModuleDepCheck} Suppress module check while workspace
420
- * comments are not bundled in.
426
+ * comments are not bundled in.
421
427
  * @alias Blockly.Xml.domToWorkspace
422
428
  */
423
- const domToWorkspace = function(xml, workspace) {
424
- const {Workspace} = goog.module.get('Blockly.Workspace');
425
- if (xml instanceof Workspace) {
426
- const swap = xml;
427
- // Closure Compiler complains here because the arguments are reversed.
428
- /** @suppress {checkTypes} */
429
- xml = workspace;
430
- workspace = swap;
431
- console.warn(
432
- 'Deprecated call to domToWorkspace, ' +
433
- 'swap the arguments.');
434
- }
435
-
436
- let width; // Not used in LTR.
429
+ export function domToWorkspace(xml: Element, workspace: Workspace): string[] {
430
+ let width = 0; // Not used in LTR.
437
431
  if (workspace.RTL) {
438
432
  width = workspace.getWidth();
439
433
  }
@@ -446,26 +440,32 @@ const domToWorkspace = function(xml, workspace) {
446
440
 
447
441
  // Disable workspace resizes as an optimization.
448
442
  // Assume it is rendered so we can check.
449
- if (/** @type {!WorkspaceSvg} */ (workspace).setResizesEnabled) {
450
- /** @type {!WorkspaceSvg} */ (workspace).setResizesEnabled(false);
443
+ if ((workspace as WorkspaceSvg).setResizesEnabled) {
444
+ (workspace as WorkspaceSvg).setResizesEnabled(false);
451
445
  }
452
446
  let variablesFirst = true;
453
447
  try {
454
- for (let i = 0, xmlChild; (xmlChild = xml.childNodes[i]); i++) {
448
+ for (let i = 0, xmlChild; xmlChild = xml.childNodes[i]; i++) {
455
449
  const name = xmlChild.nodeName.toLowerCase();
456
- const xmlChildElement = /** @type {!Element} */ (xmlChild);
450
+ const xmlChildElement = xmlChild as Element;
457
451
  if (name === 'block' ||
458
- (name === 'shadow' && !eventUtils.getRecordUndo())) {
452
+ name === 'shadow' && !eventUtils.getRecordUndo()) {
459
453
  // Allow top-level shadow blocks if recordUndo is disabled since
460
454
  // that means an undo is in progress. Such a block is expected
461
455
  // to be moved to a nested destination in the next operation.
462
456
  const block = domToBlock(xmlChildElement, workspace);
463
457
  newBlockIds.push(block.id);
458
+ // AnyDuringMigration because: Argument of type 'string | null' is not
459
+ // assignable to parameter of type 'string'.
464
460
  const blockX = xmlChildElement.hasAttribute('x') ?
465
- parseInt(xmlChildElement.getAttribute('x'), 10) :
461
+ parseInt(
462
+ xmlChildElement.getAttribute('x') as AnyDuringMigration, 10) :
466
463
  10;
464
+ // AnyDuringMigration because: Argument of type 'string | null' is not
465
+ // assignable to parameter of type 'string'.
467
466
  const blockY = xmlChildElement.hasAttribute('y') ?
468
- parseInt(xmlChildElement.getAttribute('y'), 10) :
467
+ parseInt(
468
+ xmlChildElement.getAttribute('y') as AnyDuringMigration, 10) :
469
469
  10;
470
470
  if (!isNaN(blockX) && !isNaN(blockY)) {
471
471
  block.moveBy(workspace.RTL ? width - blockX : blockX, blockY);
@@ -475,27 +475,10 @@ const domToWorkspace = function(xml, workspace) {
475
475
  throw TypeError('Shadow block cannot be a top-level block.');
476
476
  } else if (name === 'comment') {
477
477
  if (workspace.rendered) {
478
- const {WorkspaceCommentSvg} =
479
- goog.module.get('Blockly.WorkspaceCommentSvg');
480
- if (!WorkspaceCommentSvg) {
481
- console.warn(
482
- 'Missing require for Blockly.WorkspaceCommentSvg, ' +
483
- 'ignoring workspace comment.');
484
- } else {
485
- WorkspaceCommentSvg.fromXmlRendered(
486
- xmlChildElement,
487
- /** @type {!WorkspaceSvg} */ (workspace), width);
488
- }
478
+ WorkspaceCommentSvg.fromXmlRendered(
479
+ xmlChildElement, workspace as WorkspaceSvg, width);
489
480
  } else {
490
- const {WorkspaceComment} =
491
- goog.module.get('Blockly.WorkspaceComment');
492
- if (!WorkspaceComment) {
493
- console.warn(
494
- 'Missing require for Blockly.WorkspaceComment, ' +
495
- 'ignoring workspace comment.');
496
- } else {
497
- WorkspaceComment.fromXml(xmlChildElement, workspace);
498
- }
481
+ WorkspaceComment.fromXml(xmlChildElement, workspace);
499
482
  }
500
483
  } else if (name === 'variables') {
501
484
  if (variablesFirst) {
@@ -516,46 +499,47 @@ const domToWorkspace = function(xml, workspace) {
516
499
  dom.stopTextWidthCache();
517
500
  }
518
501
  // Re-enable workspace resizing.
519
- if (/** @type {!WorkspaceSvg} */ (workspace).setResizesEnabled) {
520
- /** @type {!WorkspaceSvg} */ (workspace).setResizesEnabled(true);
502
+ if ((workspace as WorkspaceSvg).setResizesEnabled) {
503
+ (workspace as WorkspaceSvg).setResizesEnabled(true);
521
504
  }
522
- eventUtils.fire(new (eventUtils.get(eventUtils.FINISHED_LOADING))(workspace));
505
+ eventUtils.fire(new (eventUtils.get(eventUtils.FINISHED_LOADING))!
506
+ (workspace));
523
507
  return newBlockIds;
524
- };
525
- exports.domToWorkspace = domToWorkspace;
508
+ }
526
509
 
527
510
  /**
528
511
  * Decode an XML DOM and create blocks on the workspace. Position the new
529
512
  * blocks immediately below prior blocks, aligned by their starting edge.
530
- * @param {!Element} xml The XML DOM.
531
- * @param {!Workspace} workspace The workspace to add to.
532
- * @return {!Array<string>} An array containing new block IDs.
513
+ * @param xml The XML DOM.
514
+ * @param workspace The workspace to add to.
515
+ * @return An array containing new block IDs.
533
516
  * @alias Blockly.Xml.appendDomToWorkspace
534
517
  */
535
- const appendDomToWorkspace = function(xml, workspace) {
518
+ export function appendDomToWorkspace(
519
+ xml: Element, workspace: WorkspaceSvg): string[] {
536
520
  // First check if we have a WorkspaceSvg, otherwise the blocks have no shape
537
521
  // and the position does not matter.
538
522
  // Assume it is rendered so we can check.
539
- if (!/** @type {!WorkspaceSvg} */ (workspace).getBlocksBoundingBox) {
523
+ if (!(workspace as WorkspaceSvg).getBlocksBoundingBox) {
540
524
  return domToWorkspace(xml, workspace);
541
525
  }
542
526
 
543
- const bbox = /** @type {!WorkspaceSvg} */ (workspace).getBlocksBoundingBox();
527
+ const bbox = (workspace as WorkspaceSvg).getBlocksBoundingBox();
544
528
  // Load the new blocks into the workspace and get the IDs of the new blocks.
545
529
  const newBlockIds = domToWorkspace(xml, workspace);
546
- if (bbox && bbox.top !== bbox.bottom) { // check if any previous block
547
- let offsetY = 0; // offset to add to y of the new block
530
+ if (bbox && bbox.top !== bbox.bottom) { // Check if any previous block.
531
+ let offsetY = 0; // Offset to add to y of the new block.
548
532
  let offsetX = 0;
549
- const farY = bbox.bottom; // bottom position
550
- const topX = workspace.RTL ? bbox.right : bbox.left; // x of bounding box
533
+ const farY = bbox.bottom; // Bottom position.
534
+ const topX = workspace.RTL ? bbox.right : bbox.left; // X of bounding box.
551
535
  // Check position of the new blocks.
552
- let newLeftX = Infinity; // x of top left corner
553
- let newRightX = -Infinity; // x of top right corner
554
- let newY = Infinity; // y of top corner
536
+ let newLeftX = Infinity; // X of top left corner.
537
+ let newRightX = -Infinity; // X of top right corner.
538
+ let newY = Infinity; // Y of top corner.
555
539
  const ySeparation = 10;
556
540
  for (let i = 0; i < newBlockIds.length; i++) {
557
541
  const blockXY =
558
- workspace.getBlockById(newBlockIds[i]).getRelativeToSurfaceXY();
542
+ workspace.getBlockById(newBlockIds[i])!.getRelativeToSurfaceXY();
559
543
  if (blockXY.y < newY) {
560
544
  newY = blockXY.y;
561
545
  }
@@ -570,33 +554,21 @@ const appendDomToWorkspace = function(xml, workspace) {
570
554
  offsetX = workspace.RTL ? topX - newRightX : topX - newLeftX;
571
555
  for (let i = 0; i < newBlockIds.length; i++) {
572
556
  const block = workspace.getBlockById(newBlockIds[i]);
573
- block.moveBy(offsetX, offsetY);
557
+ block!.moveBy(offsetX, offsetY);
574
558
  }
575
559
  }
576
560
  return newBlockIds;
577
- };
578
- exports.appendDomToWorkspace = appendDomToWorkspace;
561
+ }
579
562
 
580
563
  /**
581
564
  * Decode an XML block tag and create a block (and possibly sub blocks) on the
582
565
  * workspace.
583
- * @param {!Element} xmlBlock XML block element.
584
- * @param {!Workspace} workspace The workspace.
585
- * @return {!Block} The root block created.
566
+ * @param xmlBlock XML block element.
567
+ * @param workspace The workspace.
568
+ * @return The root block created.
586
569
  * @alias Blockly.Xml.domToBlock
587
570
  */
588
- const domToBlock = function(xmlBlock, workspace) {
589
- const {Workspace} = goog.module.get('Blockly.Workspace');
590
- if (xmlBlock instanceof Workspace) {
591
- const swap = xmlBlock;
592
- // Closure Compiler complains here because the arguments are reversed.
593
- /** @suppress {checkTypes} */
594
- xmlBlock = /** @type {!Element} */ (workspace);
595
- workspace = swap;
596
- console.warn(
597
- 'Deprecated call to domToBlock, ' +
598
- 'swap the arguments.');
599
- }
571
+ export function domToBlock(xmlBlock: Element, workspace: Workspace): Block {
600
572
  // Create top-level block.
601
573
  eventUtils.disable();
602
574
  const variablesBeforeCreation = workspace.getAllVariables();
@@ -605,15 +577,15 @@ const domToBlock = function(xmlBlock, workspace) {
605
577
  topBlock = domToBlockHeadless(xmlBlock, workspace);
606
578
  // Generate list of all blocks.
607
579
  if (workspace.rendered) {
608
- const topBlockSvg = /** @type {!BlockSvg} */ (topBlock);
580
+ const topBlockSvg = topBlock as BlockSvg;
609
581
  const blocks = topBlock.getDescendants(false);
610
582
  topBlockSvg.setConnectionTracking(false);
611
583
  // Render each block.
612
584
  for (let i = blocks.length - 1; i >= 0; i--) {
613
- blocks[i].initSvg();
585
+ (blocks[i] as BlockSvg).initSvg();
614
586
  }
615
587
  for (let i = blocks.length - 1; i >= 0; i--) {
616
- blocks[i].render(false);
588
+ (blocks[i] as BlockSvg).render(false);
617
589
  }
618
590
  // Populating the connection database may be deferred until after the
619
591
  // blocks have rendered.
@@ -625,7 +597,7 @@ const domToBlock = function(xmlBlock, workspace) {
625
597
  topBlockSvg.updateDisabled();
626
598
  // Allow the scrollbars to resize and move based on the new contents.
627
599
  // TODO(@picklesrus): #387. Remove when domToBlock avoids resizing.
628
- /** @type {!WorkspaceSvg} */ (workspace).resizeContents();
600
+ (workspace as WorkspaceSvg).resizeContents();
629
601
  } else {
630
602
  const blocks = topBlock.getDescendants(false);
631
603
  for (let i = blocks.length - 1; i >= 0; i--) {
@@ -636,70 +608,69 @@ const domToBlock = function(xmlBlock, workspace) {
636
608
  eventUtils.enable();
637
609
  }
638
610
  if (eventUtils.isEnabled()) {
611
+ // AnyDuringMigration because: Property 'get' does not exist on type
612
+ // '(name: string) => void'.
639
613
  const newVariables =
640
- goog.module.get('Blockly.Variables')
641
- .getAddedVariables(workspace, variablesBeforeCreation);
614
+ Variables.getAddedVariables(workspace, variablesBeforeCreation);
642
615
  // Fire a VarCreate event for each (if any) new variable created.
643
616
  for (let i = 0; i < newVariables.length; i++) {
644
617
  const thisVariable = newVariables[i];
645
- eventUtils.fire(
646
- new (eventUtils.get(eventUtils.VAR_CREATE))(thisVariable));
618
+ eventUtils.fire(new (eventUtils.get(eventUtils.VAR_CREATE))!
619
+ (thisVariable));
647
620
  }
648
621
  // Block events come after var events, in case they refer to newly created
649
622
  // variables.
650
- eventUtils.fire(new (eventUtils.get(eventUtils.CREATE))(topBlock));
623
+ eventUtils.fire(new (eventUtils.get(eventUtils.CREATE))!(topBlock));
651
624
  }
652
625
  return topBlock;
653
- };
654
- exports.domToBlock = domToBlock;
626
+ }
655
627
 
656
628
  /**
657
629
  * Decode an XML list of variables and add the variables to the workspace.
658
- * @param {!Element} xmlVariables List of XML variable elements.
659
- * @param {!Workspace} workspace The workspace to which the variable
660
- * should be added.
630
+ * @param xmlVariables List of XML variable elements.
631
+ * @param workspace The workspace to which the variable should be added.
661
632
  * @alias Blockly.Xml.domToVariables
662
633
  */
663
- const domToVariables = function(xmlVariables, workspace) {
664
- for (let i = 0; i < xmlVariables.childNodes.length; i++) {
665
- const xmlChild = xmlVariables.childNodes[i];
666
- if (xmlChild.nodeType !== dom.NodeType.ELEMENT_NODE) {
667
- continue; // Skip text nodes.
668
- }
634
+ export function domToVariables(xmlVariables: Element, workspace: Workspace) {
635
+ for (let i = 0; i < xmlVariables.children.length; i++) {
636
+ const xmlChild = xmlVariables.children[i];
669
637
  const type = xmlChild.getAttribute('type');
670
638
  const id = xmlChild.getAttribute('id');
671
639
  const name = xmlChild.textContent;
672
640
 
673
- workspace.createVariable(name, type, id);
641
+ // AnyDuringMigration because: Argument of type 'string | null' is not
642
+ // assignable to parameter of type 'string'.
643
+ workspace.createVariable(name as AnyDuringMigration, type, id);
674
644
  }
675
- };
676
- exports.domToVariables = domToVariables;
645
+ }
677
646
 
678
- /**
679
- * A mapping of nodeName to node for child nodes of xmlBlock.
680
- * @typedef {{
681
- * mutation: !Array<!Element>,
682
- * comment: !Array<!Element>,
683
- * data: !Array<!Element>,
684
- * field: !Array<!Element>,
685
- * input: !Array<!Element>,
686
- * next: !Array<!Element>
687
- * }}
688
- */
689
- let childNodeTagMap; // eslint-disable-line no-unused-vars
647
+ /** A mapping of nodeName to node for child nodes of xmlBlock. */
648
+ interface childNodeTagMap {
649
+ mutation: Element[];
650
+ comment: Element[];
651
+ data: Element[];
652
+ field: Element[];
653
+ input: Element[];
654
+ next: Element[];
655
+ }
690
656
 
691
657
  /**
692
658
  * Creates a mapping of childNodes for each supported XML tag for the provided
693
659
  * xmlBlock. Logs a warning for any encountered unsupported tags.
694
- * @param {!Element} xmlBlock XML block element.
695
- * @return {!childNodeTagMap} The childNode map from nodeName to
696
- * node.
660
+ * @param xmlBlock XML block element.
661
+ * @return The childNode map from nodeName to node.
697
662
  */
698
- const mapSupportedXmlTags = function(xmlBlock) {
699
- const childNodeMap =
700
- {mutation: [], comment: [], data: [], field: [], input: [], next: []};
701
- for (let i = 0; i < xmlBlock.childNodes.length; i++) {
702
- const xmlChild = xmlBlock.childNodes[i];
663
+ function mapSupportedXmlTags(xmlBlock: Element): childNodeTagMap {
664
+ const childNodeMap = {
665
+ mutation: new Array<Element>(),
666
+ comment: new Array<Element>(),
667
+ data: new Array<Element>(),
668
+ field: new Array<Element>(),
669
+ input: new Array<Element>(),
670
+ next: new Array<Element>()
671
+ };
672
+ for (let i = 0; i < xmlBlock.children.length; i++) {
673
+ const xmlChild = xmlBlock.children[i];
703
674
  if (xmlChild.nodeType === dom.NodeType.TEXT_NODE) {
704
675
  // Ignore any text at the <block> level. It's all whitespace anyway.
705
676
  continue;
@@ -709,20 +680,14 @@ const mapSupportedXmlTags = function(xmlBlock) {
709
680
  childNodeMap.mutation.push(xmlChild);
710
681
  break;
711
682
  case 'comment':
712
- if (!goog.module.get('Blockly.Comment')) {
713
- console.warn(
714
- 'Missing require for Comment, ' +
715
- 'ignoring block comment.');
716
- break;
717
- }
718
683
  childNodeMap.comment.push(xmlChild);
719
684
  break;
720
685
  case 'data':
721
686
  childNodeMap.data.push(xmlChild);
722
687
  break;
723
688
  case 'title':
724
- // Titles were renamed to field in December 2013.
725
- // Fall through.
689
+ // Titles were renamed to field in December 2013.
690
+ // Fall through.
726
691
  case 'field':
727
692
  childNodeMap.field.push(xmlChild);
728
693
  break;
@@ -739,43 +704,49 @@ const mapSupportedXmlTags = function(xmlBlock) {
739
704
  }
740
705
  }
741
706
  return childNodeMap;
742
- };
707
+ }
743
708
 
744
709
  /**
745
710
  * Applies mutation tag child nodes to the given block.
746
- * @param {!Array<!Element>} xmlChildren Child nodes.
747
- * @param {!Block} block The block to apply the child nodes on.
748
- * @return {boolean} True if mutation may have added some elements that need
749
- * initialization (requiring initSvg call).
711
+ * @param xmlChildren Child nodes.
712
+ * @param block The block to apply the child nodes on.
713
+ * @return True if mutation may have added some elements that need
714
+ * initialization (requiring initSvg call).
750
715
  */
751
- const applyMutationTagNodes = function(xmlChildren, block) {
716
+ function applyMutationTagNodes(xmlChildren: Element[], block: Block): boolean {
752
717
  let shouldCallInitSvg = false;
753
718
  for (let i = 0; i < xmlChildren.length; i++) {
754
719
  const xmlChild = xmlChildren[i];
755
720
  // Custom data for an advanced block.
756
721
  if (block.domToMutation) {
757
722
  block.domToMutation(xmlChild);
758
- if (block.initSvg) {
723
+ if ((block as BlockSvg).initSvg) {
759
724
  // Mutation may have added some elements that need initializing.
760
725
  shouldCallInitSvg = true;
761
726
  }
762
727
  }
763
728
  }
764
729
  return shouldCallInitSvg;
765
- };
730
+ }
766
731
 
767
732
  /**
768
733
  * Applies comment tag child nodes to the given block.
769
- * @param {!Array<!Element>} xmlChildren Child nodes.
770
- * @param {!Block} block The block to apply the child nodes on.
734
+ * @param xmlChildren Child nodes.
735
+ * @param block The block to apply the child nodes on.
771
736
  */
772
- const applyCommentTagNodes = function(xmlChildren, block) {
737
+ function applyCommentTagNodes(xmlChildren: Element[], block: Block) {
773
738
  for (let i = 0; i < xmlChildren.length; i++) {
774
739
  const xmlChild = xmlChildren[i];
775
740
  const text = xmlChild.textContent;
776
741
  const pinned = xmlChild.getAttribute('pinned') === 'true';
777
- const width = parseInt(xmlChild.getAttribute('w'), 10);
778
- const height = parseInt(xmlChild.getAttribute('h'), 10);
742
+ // AnyDuringMigration because: Argument of type 'string | null' is not
743
+ // assignable to parameter of type 'string'.
744
+ const width =
745
+ parseInt(xmlChild.getAttribute('w') as AnyDuringMigration, 10);
746
+ // AnyDuringMigration because: Argument of type 'string | null' is not
747
+ // assignable to parameter of type 'string'.
748
+ const height =
749
+ parseInt(xmlChild.getAttribute('h') as AnyDuringMigration, 10);
779
750
 
780
751
  block.setCommentText(text);
781
752
  block.commentModel.pinned = pinned;
@@ -783,75 +754,84 @@ const applyCommentTagNodes = function(xmlChildren, block) {
783
754
  block.commentModel.size = new Size(width, height);
784
755
  }
785
756
 
786
- if (pinned && block.getCommentIcon && !block.isInFlyout) {
787
- const blockSvg = /** @type {BlockSvg} */ (block);
757
+ if (pinned && (block as BlockSvg).getCommentIcon && !block.isInFlyout) {
758
+ const blockSvg = block as BlockSvg;
788
759
  setTimeout(function() {
789
- blockSvg.getCommentIcon().setVisible(true);
760
+ blockSvg.getCommentIcon()!.setVisible(true);
790
761
  }, 1);
791
762
  }
792
763
  }
793
- };
764
+ }
794
765
 
795
766
  /**
796
767
  * Applies data tag child nodes to the given block.
797
- * @param {!Array<!Element>} xmlChildren Child nodes.
798
- * @param {!Block} block The block to apply the child nodes on.
768
+ * @param xmlChildren Child nodes.
769
+ * @param block The block to apply the child nodes on.
799
770
  */
800
- const applyDataTagNodes = function(xmlChildren, block) {
771
+ function applyDataTagNodes(xmlChildren: Element[], block: Block) {
801
772
  for (let i = 0; i < xmlChildren.length; i++) {
802
773
  const xmlChild = xmlChildren[i];
803
774
  block.data = xmlChild.textContent;
804
775
  }
805
- };
776
+ }
806
777
 
807
778
  /**
808
779
  * Applies field tag child nodes to the given block.
809
- * @param {!Array<!Element>} xmlChildren Child nodes.
810
- * @param {!Block} block The block to apply the child nodes on.
780
+ * @param xmlChildren Child nodes.
781
+ * @param block The block to apply the child nodes on.
811
782
  */
812
- const applyFieldTagNodes = function(xmlChildren, block) {
783
+ function applyFieldTagNodes(xmlChildren: Element[], block: Block) {
813
784
  for (let i = 0; i < xmlChildren.length; i++) {
814
785
  const xmlChild = xmlChildren[i];
815
786
  const nodeName = xmlChild.getAttribute('name');
816
- domToField(block, nodeName, xmlChild);
787
+ // AnyDuringMigration because: Argument of type 'string | null' is not
788
+ // assignable to parameter of type 'string'.
789
+ domToField(block, nodeName as AnyDuringMigration, xmlChild);
817
790
  }
818
- };
791
+ }
819
792
 
820
793
  /**
821
794
  * Finds any enclosed blocks or shadows within this XML node.
822
- * @param {!Element} xmlNode The XML node to extract child block info from.
823
- * @return {{childBlockElement: ?Element, childShadowElement: ?Element}} Any
824
- * found child block.
795
+ * @param xmlNode The XML node to extract child block info from.
796
+ * @return Any found child block.
825
797
  */
826
- const findChildBlocks = function(xmlNode) {
798
+ function findChildBlocks(xmlNode: Element):
799
+ {childBlockElement: Element|null, childShadowElement: Element|null} {
827
800
  const childBlockInfo = {childBlockElement: null, childShadowElement: null};
828
801
  for (let i = 0; i < xmlNode.childNodes.length; i++) {
829
802
  const xmlChild = xmlNode.childNodes[i];
830
803
  if (xmlChild.nodeType === dom.NodeType.ELEMENT_NODE) {
831
804
  if (xmlChild.nodeName.toLowerCase() === 'block') {
832
- childBlockInfo.childBlockElement = /** @type {!Element} */ (xmlChild);
805
+ // AnyDuringMigration because: Type 'Element' is not assignable to type
806
+ // 'null'.
807
+ childBlockInfo.childBlockElement =
808
+ xmlChild as Element as AnyDuringMigration;
833
809
  } else if (xmlChild.nodeName.toLowerCase() === 'shadow') {
834
- childBlockInfo.childShadowElement = /** @type {!Element} */ (xmlChild);
810
+ // AnyDuringMigration because: Type 'Element' is not assignable to type
811
+ // 'null'.
812
+ childBlockInfo.childShadowElement =
813
+ xmlChild as Element as AnyDuringMigration;
835
814
  }
836
815
  }
837
816
  }
838
817
  return childBlockInfo;
839
- };
840
-
818
+ }
841
819
  /**
842
820
  * Applies input child nodes (value or statement) to the given block.
843
- * @param {!Array<!Element>} xmlChildren Child nodes.
844
- * @param {!Workspace} workspace The workspace containing the given
845
- * block.
846
- * @param {!Block} block The block to apply the child nodes on.
847
- * @param {string} prototypeName The prototype name of the block.
821
+ * @param xmlChildren Child nodes.
822
+ * @param workspace The workspace containing the given block.
823
+ * @param block The block to apply the child nodes on.
824
+ * @param prototypeName The prototype name of the block.
848
825
  */
849
- const applyInputTagNodes = function(
850
- xmlChildren, workspace, block, prototypeName) {
826
+ function applyInputTagNodes(
827
+ xmlChildren: Element[], workspace: Workspace, block: Block,
828
+ prototypeName: string) {
851
829
  for (let i = 0; i < xmlChildren.length; i++) {
852
830
  const xmlChild = xmlChildren[i];
853
831
  const nodeName = xmlChild.getAttribute('name');
854
- const input = block.getInput(nodeName);
832
+ // AnyDuringMigration because: Argument of type 'string | null' is not
833
+ // assignable to parameter of type 'string'.
834
+ const input = block.getInput(nodeName as AnyDuringMigration);
855
835
  if (!input) {
856
836
  console.warn(
857
837
  'Ignoring non-existent input ' + nodeName + ' in block ' +
@@ -868,19 +848,19 @@ const applyInputTagNodes = function(
868
848
  }
869
849
  // Set shadow after so we don't create a shadow we delete immediately.
870
850
  if (childBlockInfo.childShadowElement) {
871
- input.connection.setShadowDom(childBlockInfo.childShadowElement);
851
+ input.connection?.setShadowDom(childBlockInfo.childShadowElement);
872
852
  }
873
853
  }
874
- };
854
+ }
875
855
 
876
856
  /**
877
857
  * Applies next child nodes to the given block.
878
- * @param {!Array<!Element>} xmlChildren Child nodes.
879
- * @param {!Workspace} workspace The workspace containing the given
880
- * block.
881
- * @param {!Block} block The block to apply the child nodes on.
858
+ * @param xmlChildren Child nodes.
859
+ * @param workspace The workspace containing the given block.
860
+ * @param block The block to apply the child nodes on.
882
861
  */
883
- const applyNextTagNodes = function(xmlChildren, workspace, block) {
862
+ function applyNextTagNodes(
863
+ xmlChildren: Element[], workspace: Workspace, block: Block) {
884
864
  for (let i = 0; i < xmlChildren.length; i++) {
885
865
  const xmlChild = xmlChildren[i];
886
866
  const childBlockInfo = findChildBlocks(xmlChild);
@@ -902,30 +882,31 @@ const applyNextTagNodes = function(xmlChildren, workspace, block) {
902
882
  block.nextConnection.setShadowDom(childBlockInfo.childShadowElement);
903
883
  }
904
884
  }
905
- };
906
-
885
+ }
907
886
 
908
887
  /**
909
888
  * Decode an XML block tag and create a block (and possibly sub blocks) on the
910
889
  * workspace.
911
- * @param {!Element} xmlBlock XML block element.
912
- * @param {!Workspace} workspace The workspace.
913
- * @param {!Connection=} parentConnection The parent connection to
914
- * to connect this block to after instantiating.
915
- * @param {boolean=} connectedToParentNext Whether the provided parent
916
- * connection
917
- * is a next connection, rather than output or statement.
918
- * @return {!Block} The root block created.
890
+ * @param xmlBlock XML block element.
891
+ * @param workspace The workspace.
892
+ * @param parentConnection The parent connection to to connect this block to
893
+ * after instantiating.
894
+ * @param connectedToParentNext Whether the provided parent connection is a next
895
+ * connection, rather than output or statement.
896
+ * @return The root block created.
919
897
  */
920
- const domToBlockHeadless = function(
921
- xmlBlock, workspace, parentConnection, connectedToParentNext) {
898
+ function domToBlockHeadless(
899
+ xmlBlock: Element, workspace: Workspace, parentConnection?: Connection,
900
+ connectedToParentNext?: boolean): Block {
922
901
  let block = null;
923
902
  const prototypeName = xmlBlock.getAttribute('type');
924
903
  if (!prototypeName) {
925
904
  throw TypeError('Block type unspecified: ' + xmlBlock.outerHTML);
926
905
  }
927
906
  const id = xmlBlock.getAttribute('id');
928
- block = workspace.newBlock(prototypeName, id);
907
+ // AnyDuringMigration because: Argument of type 'string | null' is not
908
+ // assignable to parameter of type 'string | undefined'.
909
+ block = workspace.newBlock(prototypeName, id as AnyDuringMigration);
929
910
 
930
911
  // Preprocess childNodes so tags can be processed in a consistent order.
931
912
  const xmlChildNameMap = mapSupportedXmlTags(xmlBlock);
@@ -964,7 +945,7 @@ const domToBlockHeadless = function(
964
945
  // (ref: https://github.com/google/blockly/pull/4296#issuecomment-884226021
965
946
  // But the XML serializer/deserializer is iceboxed so I'm not going to fix
966
947
  // it.
967
- (/** @type {!BlockSvg} */ (block)).initSvg();
948
+ (block as BlockSvg).initSvg();
968
949
  }
969
950
 
970
951
  const inline = xmlBlock.getAttribute('inline');
@@ -1007,15 +988,15 @@ const domToBlockHeadless = function(
1007
988
  block.setShadow(true);
1008
989
  }
1009
990
  return block;
1010
- };
991
+ }
1011
992
 
1012
993
  /**
1013
994
  * Decode an XML field tag and set the value of that field on the given block.
1014
- * @param {!Block} block The block that is currently being deserialized.
1015
- * @param {string} fieldName The name of the field on the block.
1016
- * @param {!Element} xml The field tag to decode.
995
+ * @param block The block that is currently being deserialized.
996
+ * @param fieldName The name of the field on the block.
997
+ * @param xml The field tag to decode.
1017
998
  */
1018
- const domToField = function(block, fieldName, xml) {
999
+ function domToField(block: Block, fieldName: string, xml: Element) {
1019
1000
  const field = block.getField(fieldName);
1020
1001
  if (!field) {
1021
1002
  console.warn(
@@ -1023,15 +1004,15 @@ const domToField = function(block, fieldName, xml) {
1023
1004
  return;
1024
1005
  }
1025
1006
  field.fromXml(xml);
1026
- };
1007
+ }
1027
1008
 
1028
1009
  /**
1029
1010
  * Remove any 'next' block (statements in a stack).
1030
- * @param {!Element|!DocumentFragment} xmlBlock XML block element or an empty
1031
- * DocumentFragment if the block was an insertion marker.
1011
+ * @param xmlBlock XML block element or an empty DocumentFragment if the block
1012
+ * was an insertion marker.
1032
1013
  * @alias Blockly.Xml.deleteNext
1033
1014
  */
1034
- const deleteNext = function(xmlBlock) {
1015
+ export function deleteNext(xmlBlock: Element|DocumentFragment) {
1035
1016
  for (let i = 0; i < xmlBlock.childNodes.length; i++) {
1036
1017
  const child = xmlBlock.childNodes[i];
1037
1018
  if (child.nodeName.toLowerCase() === 'next') {
@@ -1039,5 +1020,4 @@ const deleteNext = function(xmlBlock) {
1039
1020
  break;
1040
1021
  }
1041
1022
  }
1042
- };
1043
- exports.deleteNext = deleteNext;
1023
+ }