scratch-blocks 2.0.0-beta.1 → 2.0.0-spork.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1065) hide show
  1. package/CHANGELOG.md +16 -16
  2. package/package.json +1 -1
  3. package/release.config.js +4 -0
  4. package/blockly-rc/.eslintignore +0 -28
  5. package/blockly-rc/.eslintrc.js +0 -187
  6. package/blockly-rc/.gitattributes +0 -1
  7. package/blockly-rc/.github/CODEOWNERS +0 -1
  8. package/blockly-rc/.github/CONTRIBUTING.md +0 -46
  9. package/blockly-rc/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -58
  10. package/blockly-rc/.github/ISSUE_TEMPLATE/config.yml +0 -7
  11. package/blockly-rc/.github/ISSUE_TEMPLATE/documentation.yaml +0 -38
  12. package/blockly-rc/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -39
  13. package/blockly-rc/.github/PULL_REQUEST_TEMPLATE.md +0 -42
  14. package/blockly-rc/.github/dependabot.yml +0 -27
  15. package/blockly-rc/.github/release.yml +0 -32
  16. package/blockly-rc/.github/workflows/appengine_deploy.yml +0 -54
  17. package/blockly-rc/.github/workflows/assign_reviewers.yml +0 -41
  18. package/blockly-rc/.github/workflows/browser_test.yml +0 -55
  19. package/blockly-rc/.github/workflows/build.yml +0 -86
  20. package/blockly-rc/.github/workflows/conventional-label.yml +0 -17
  21. package/blockly-rc/.github/workflows/develop_freeze.yml +0 -26
  22. package/blockly-rc/.github/workflows/tag_module_cleanup.yml +0 -37
  23. package/blockly-rc/.github/workflows/welcome_new_contributors.yml +0 -36
  24. package/blockly-rc/.prettierignore +0 -30
  25. package/blockly-rc/.prettierrc.js +0 -13
  26. package/blockly-rc/CHANGELOG.md +0 -77
  27. package/blockly-rc/LICENSE +0 -202
  28. package/blockly-rc/README.md +0 -80
  29. package/blockly-rc/_config.yml +0 -1
  30. package/blockly-rc/api-extractor.json +0 -385
  31. package/blockly-rc/appengine/.gcloudignore +0 -20
  32. package/blockly-rc/appengine/README.txt +0 -42
  33. package/blockly-rc/appengine/add_timestamps.py +0 -69
  34. package/blockly-rc/appengine/app.yaml +0 -104
  35. package/blockly-rc/appengine/apple-touch-icon.png +0 -0
  36. package/blockly-rc/appengine/blockly_compressed.js +0 -11
  37. package/blockly-rc/appengine/expiration.py +0 -52
  38. package/blockly-rc/appengine/favicon.ico +0 -0
  39. package/blockly-rc/appengine/index.yaml +0 -11
  40. package/blockly-rc/appengine/main.py +0 -39
  41. package/blockly-rc/appengine/redirect.html +0 -107
  42. package/blockly-rc/appengine/requirements.txt +0 -1
  43. package/blockly-rc/appengine/robots.txt +0 -2
  44. package/blockly-rc/appengine/storage.js +0 -190
  45. package/blockly-rc/appengine/storage.py +0 -125
  46. package/blockly-rc/blocks/blocks.ts +0 -44
  47. package/blockly-rc/blocks/lists.ts +0 -1085
  48. package/blockly-rc/blocks/logic.ts +0 -712
  49. package/blockly-rc/blocks/loops.ts +0 -408
  50. package/blockly-rc/blocks/math.ts +0 -591
  51. package/blockly-rc/blocks/procedures.ts +0 -1364
  52. package/blockly-rc/blocks/text.ts +0 -1007
  53. package/blockly-rc/blocks/variables.ts +0 -183
  54. package/blockly-rc/blocks/variables_dynamic.ts +0 -194
  55. package/blockly-rc/core/any_aliases.ts +0 -8
  56. package/blockly-rc/core/block.ts +0 -2523
  57. package/blockly-rc/core/block_animations.ts +0 -225
  58. package/blockly-rc/core/block_flyout_inflater.ts +0 -262
  59. package/blockly-rc/core/block_svg.ts +0 -1768
  60. package/blockly-rc/core/blockly.ts +0 -605
  61. package/blockly-rc/core/blockly_options.ts +0 -71
  62. package/blockly-rc/core/blocks.ts +0 -18
  63. package/blockly-rc/core/browser_events.ts +0 -244
  64. package/blockly-rc/core/bubbles/bubble.ts +0 -658
  65. package/blockly-rc/core/bubbles/mini_workspace_bubble.ts +0 -280
  66. package/blockly-rc/core/bubbles/text_bubble.ts +0 -103
  67. package/blockly-rc/core/bubbles/textinput_bubble.ts +0 -344
  68. package/blockly-rc/core/bubbles.ts +0 -12
  69. package/blockly-rc/core/bump_objects.ts +0 -192
  70. package/blockly-rc/core/button_flyout_inflater.ts +0 -63
  71. package/blockly-rc/core/clipboard/block_paster.ts +0 -142
  72. package/blockly-rc/core/clipboard/registry.ts +0 -31
  73. package/blockly-rc/core/clipboard/workspace_comment_paster.ts +0 -94
  74. package/blockly-rc/core/clipboard.ts +0 -113
  75. package/blockly-rc/core/comments/comment_view.ts +0 -899
  76. package/blockly-rc/core/comments/rendered_workspace_comment.ts +0 -297
  77. package/blockly-rc/core/comments/workspace_comment.ts +0 -237
  78. package/blockly-rc/core/comments.ts +0 -9
  79. package/blockly-rc/core/common.ts +0 -305
  80. package/blockly-rc/core/component_manager.ts +0 -235
  81. package/blockly-rc/core/config.ts +0 -65
  82. package/blockly-rc/core/connection.ts +0 -793
  83. package/blockly-rc/core/connection_checker.ts +0 -348
  84. package/blockly-rc/core/connection_db.ts +0 -297
  85. package/blockly-rc/core/connection_type.ts +0 -21
  86. package/blockly-rc/core/constants.ts +0 -23
  87. package/blockly-rc/core/contextmenu.ts +0 -268
  88. package/blockly-rc/core/contextmenu_items.ts +0 -700
  89. package/blockly-rc/core/contextmenu_registry.ts +0 -194
  90. package/blockly-rc/core/css.ts +0 -481
  91. package/blockly-rc/core/delete_area.ts +0 -77
  92. package/blockly-rc/core/dialog.ts +0 -121
  93. package/blockly-rc/core/drag_target.ts +0 -97
  94. package/blockly-rc/core/dragging/block_drag_strategy.ts +0 -454
  95. package/blockly-rc/core/dragging/bubble_drag_strategy.ts +0 -52
  96. package/blockly-rc/core/dragging/comment_drag_strategy.ts +0 -91
  97. package/blockly-rc/core/dragging/dragger.ts +0 -163
  98. package/blockly-rc/core/dragging.ts +0 -12
  99. package/blockly-rc/core/dropdowndiv.ts +0 -768
  100. package/blockly-rc/core/events/events.ts +0 -163
  101. package/blockly-rc/core/events/events_abstract.ts +0 -130
  102. package/blockly-rc/core/events/events_block_base.ts +0 -88
  103. package/blockly-rc/core/events/events_block_change.ts +0 -259
  104. package/blockly-rc/core/events/events_block_create.ts +0 -185
  105. package/blockly-rc/core/events/events_block_delete.ts +0 -182
  106. package/blockly-rc/core/events/events_block_drag.ts +0 -116
  107. package/blockly-rc/core/events/events_block_field_intermediate_change.ts +0 -167
  108. package/blockly-rc/core/events/events_block_move.ts +0 -307
  109. package/blockly-rc/core/events/events_bubble_open.ts +0 -120
  110. package/blockly-rc/core/events/events_click.ts +0 -110
  111. package/blockly-rc/core/events/events_comment_base.ts +0 -126
  112. package/blockly-rc/core/events/events_comment_change.ts +0 -161
  113. package/blockly-rc/core/events/events_comment_collapse.ts +0 -103
  114. package/blockly-rc/core/events/events_comment_create.ts +0 -118
  115. package/blockly-rc/core/events/events_comment_delete.ts +0 -117
  116. package/blockly-rc/core/events/events_comment_drag.ts +0 -99
  117. package/blockly-rc/core/events/events_comment_move.ts +0 -207
  118. package/blockly-rc/core/events/events_comment_resize.ts +0 -174
  119. package/blockly-rc/core/events/events_marker_move.ts +0 -134
  120. package/blockly-rc/core/events/events_selected.ts +0 -98
  121. package/blockly-rc/core/events/events_theme_change.ts +0 -84
  122. package/blockly-rc/core/events/events_toolbox_item_select.ts +0 -96
  123. package/blockly-rc/core/events/events_trashcan_open.ts +0 -88
  124. package/blockly-rc/core/events/events_ui_base.ts +0 -47
  125. package/blockly-rc/core/events/events_var_base.ts +0 -89
  126. package/blockly-rc/core/events/events_var_create.ts +0 -129
  127. package/blockly-rc/core/events/events_var_delete.ts +0 -124
  128. package/blockly-rc/core/events/events_var_rename.ts +0 -133
  129. package/blockly-rc/core/events/events_var_type_change.ts +0 -122
  130. package/blockly-rc/core/events/events_viewport.ts +0 -149
  131. package/blockly-rc/core/events/utils.ts +0 -595
  132. package/blockly-rc/core/events/workspace_events.ts +0 -46
  133. package/blockly-rc/core/extensions.ts +0 -491
  134. package/blockly-rc/core/field.ts +0 -1471
  135. package/blockly-rc/core/field_checkbox.ts +0 -271
  136. package/blockly-rc/core/field_dropdown.ts +0 -857
  137. package/blockly-rc/core/field_image.ts +0 -297
  138. package/blockly-rc/core/field_input.ts +0 -755
  139. package/blockly-rc/core/field_label.ts +0 -150
  140. package/blockly-rc/core/field_label_serializable.ts +0 -73
  141. package/blockly-rc/core/field_number.ts +0 -381
  142. package/blockly-rc/core/field_registry.ts +0 -115
  143. package/blockly-rc/core/field_textinput.ts +0 -117
  144. package/blockly-rc/core/field_variable.ts +0 -651
  145. package/blockly-rc/core/flyout_base.ts +0 -968
  146. package/blockly-rc/core/flyout_button.ts +0 -416
  147. package/blockly-rc/core/flyout_horizontal.ts +0 -374
  148. package/blockly-rc/core/flyout_metrics_manager.ts +0 -90
  149. package/blockly-rc/core/flyout_separator.ts +0 -61
  150. package/blockly-rc/core/flyout_vertical.ts +0 -353
  151. package/blockly-rc/core/generator.ts +0 -611
  152. package/blockly-rc/core/gesture.ts +0 -1191
  153. package/blockly-rc/core/grid.ts +0 -252
  154. package/blockly-rc/core/icons/comment_icon.ts +0 -435
  155. package/blockly-rc/core/icons/exceptions.ts +0 -23
  156. package/blockly-rc/core/icons/icon.ts +0 -147
  157. package/blockly-rc/core/icons/icon_types.ts +0 -32
  158. package/blockly-rc/core/icons/mutator_icon.ts +0 -354
  159. package/blockly-rc/core/icons/registry.ts +0 -33
  160. package/blockly-rc/core/icons/warning_icon.ts +0 -219
  161. package/blockly-rc/core/icons.ts +0 -24
  162. package/blockly-rc/core/inject.ts +0 -428
  163. package/blockly-rc/core/inputs/align.ts +0 -14
  164. package/blockly-rc/core/inputs/dummy_input.ts +0 -26
  165. package/blockly-rc/core/inputs/end_row_input.ts +0 -31
  166. package/blockly-rc/core/inputs/input.ts +0 -318
  167. package/blockly-rc/core/inputs/input_types.ts +0 -27
  168. package/blockly-rc/core/inputs/statement_input.ts +0 -34
  169. package/blockly-rc/core/inputs/value_input.ts +0 -30
  170. package/blockly-rc/core/inputs.ts +0 -23
  171. package/blockly-rc/core/insertion_marker_manager.ts +0 -742
  172. package/blockly-rc/core/insertion_marker_previewer.ts +0 -254
  173. package/blockly-rc/core/interfaces/i_ast_node_location.ts +0 -12
  174. package/blockly-rc/core/interfaces/i_ast_node_location_svg.ts +0 -28
  175. package/blockly-rc/core/interfaces/i_ast_node_location_with_block.ts +0 -22
  176. package/blockly-rc/core/interfaces/i_autohideable.ts +0 -22
  177. package/blockly-rc/core/interfaces/i_bounded_element.ts +0 -30
  178. package/blockly-rc/core/interfaces/i_bubble.ts +0 -63
  179. package/blockly-rc/core/interfaces/i_collapsible_toolbox_item.ts +0 -33
  180. package/blockly-rc/core/interfaces/i_comment_icon.ts +0 -47
  181. package/blockly-rc/core/interfaces/i_component.ts +0 -19
  182. package/blockly-rc/core/interfaces/i_connection_checker.ts +0 -100
  183. package/blockly-rc/core/interfaces/i_connection_previewer.ts +0 -50
  184. package/blockly-rc/core/interfaces/i_contextmenu.ts +0 -16
  185. package/blockly-rc/core/interfaces/i_copyable.ts +0 -31
  186. package/blockly-rc/core/interfaces/i_deletable.ts +0 -34
  187. package/blockly-rc/core/interfaces/i_delete_area.ts +0 -28
  188. package/blockly-rc/core/interfaces/i_drag_target.ts +0 -69
  189. package/blockly-rc/core/interfaces/i_draggable.ts +0 -72
  190. package/blockly-rc/core/interfaces/i_dragger.ts +0 -35
  191. package/blockly-rc/core/interfaces/i_flyout.ts +0 -189
  192. package/blockly-rc/core/interfaces/i_flyout_inflater.ts +0 -41
  193. package/blockly-rc/core/interfaces/i_has_bubble.ts +0 -20
  194. package/blockly-rc/core/interfaces/i_icon.ts +0 -114
  195. package/blockly-rc/core/interfaces/i_keyboard_accessible.ts +0 -21
  196. package/blockly-rc/core/interfaces/i_legacy_procedure_blocks.ts +0 -50
  197. package/blockly-rc/core/interfaces/i_metrics_manager.ts +0 -149
  198. package/blockly-rc/core/interfaces/i_movable.ts +0 -19
  199. package/blockly-rc/core/interfaces/i_observable.ts +0 -24
  200. package/blockly-rc/core/interfaces/i_parameter_model.ts +0 -51
  201. package/blockly-rc/core/interfaces/i_paster.ts +0 -25
  202. package/blockly-rc/core/interfaces/i_positionable.ts +0 -33
  203. package/blockly-rc/core/interfaces/i_procedure_block.ts +0 -27
  204. package/blockly-rc/core/interfaces/i_procedure_map.ts +0 -18
  205. package/blockly-rc/core/interfaces/i_procedure_model.ts +0 -71
  206. package/blockly-rc/core/interfaces/i_registrable.ts +0 -12
  207. package/blockly-rc/core/interfaces/i_rendered_element.ts +0 -22
  208. package/blockly-rc/core/interfaces/i_selectable.ts +0 -34
  209. package/blockly-rc/core/interfaces/i_selectable_toolbox_item.ts +0 -63
  210. package/blockly-rc/core/interfaces/i_serializable.ts +0 -28
  211. package/blockly-rc/core/interfaces/i_serializer.ts +0 -55
  212. package/blockly-rc/core/interfaces/i_styleable.ts +0 -26
  213. package/blockly-rc/core/interfaces/i_toolbox.ts +0 -112
  214. package/blockly-rc/core/interfaces/i_toolbox_item.ts +0 -81
  215. package/blockly-rc/core/interfaces/i_variable_backed_parameter_model.ts +0 -23
  216. package/blockly-rc/core/interfaces/i_variable_map.ts +0 -65
  217. package/blockly-rc/core/interfaces/i_variable_model.ts +0 -57
  218. package/blockly-rc/core/internal_constants.ts +0 -47
  219. package/blockly-rc/core/keyboard_nav/ast_node.ts +0 -884
  220. package/blockly-rc/core/keyboard_nav/basic_cursor.ts +0 -223
  221. package/blockly-rc/core/keyboard_nav/cursor.ts +0 -138
  222. package/blockly-rc/core/keyboard_nav/marker.ts +0 -113
  223. package/blockly-rc/core/keyboard_nav/tab_navigate_cursor.ts +0 -46
  224. package/blockly-rc/core/label_flyout_inflater.ts +0 -59
  225. package/blockly-rc/core/layer_manager.ts +0 -186
  226. package/blockly-rc/core/layers.ts +0 -17
  227. package/blockly-rc/core/main.ts +0 -31
  228. package/blockly-rc/core/marker_manager.ts +0 -189
  229. package/blockly-rc/core/menu.ts +0 -463
  230. package/blockly-rc/core/menuitem.ts +0 -221
  231. package/blockly-rc/core/metrics_manager.ts +0 -486
  232. package/blockly-rc/core/msg.ts +0 -27
  233. package/blockly-rc/core/names.ts +0 -275
  234. package/blockly-rc/core/observable_procedure_map.ts +0 -66
  235. package/blockly-rc/core/options.ts +0 -377
  236. package/blockly-rc/core/positionable_helpers.ts +0 -186
  237. package/blockly-rc/core/procedures.ts +0 -510
  238. package/blockly-rc/core/registry.ts +0 -400
  239. package/blockly-rc/core/render_management.ts +0 -193
  240. package/blockly-rc/core/rendered_connection.ts +0 -571
  241. package/blockly-rc/core/renderers/common/block_rendering.ts +0 -120
  242. package/blockly-rc/core/renderers/common/constants.ts +0 -1198
  243. package/blockly-rc/core/renderers/common/drawer.ts +0 -518
  244. package/blockly-rc/core/renderers/common/i_path_object.ts +0 -137
  245. package/blockly-rc/core/renderers/common/info.ts +0 -767
  246. package/blockly-rc/core/renderers/common/marker_svg.ts +0 -765
  247. package/blockly-rc/core/renderers/common/path_object.ts +0 -324
  248. package/blockly-rc/core/renderers/common/renderer.ts +0 -281
  249. package/blockly-rc/core/renderers/geras/constants.ts +0 -46
  250. package/blockly-rc/core/renderers/geras/drawer.ts +0 -167
  251. package/blockly-rc/core/renderers/geras/geras.ts +0 -31
  252. package/blockly-rc/core/renderers/geras/highlight_constants.ts +0 -342
  253. package/blockly-rc/core/renderers/geras/highlighter.ts +0 -313
  254. package/blockly-rc/core/renderers/geras/info.ts +0 -478
  255. package/blockly-rc/core/renderers/geras/measurables/inline_input.ts +0 -37
  256. package/blockly-rc/core/renderers/geras/measurables/statement_input.ts +0 -36
  257. package/blockly-rc/core/renderers/geras/path_object.ts +0 -135
  258. package/blockly-rc/core/renderers/geras/renderer.ts +0 -124
  259. package/blockly-rc/core/renderers/measurables/base.ts +0 -41
  260. package/blockly-rc/core/renderers/measurables/bottom_row.ts +0 -104
  261. package/blockly-rc/core/renderers/measurables/connection.ts +0 -43
  262. package/blockly-rc/core/renderers/measurables/external_value_input.ts +0 -53
  263. package/blockly-rc/core/renderers/measurables/field.ts +0 -50
  264. package/blockly-rc/core/renderers/measurables/hat.ts +0 -33
  265. package/blockly-rc/core/renderers/measurables/icon.ts +0 -42
  266. package/blockly-rc/core/renderers/measurables/in_row_spacer.ts +0 -29
  267. package/blockly-rc/core/renderers/measurables/inline_input.ts +0 -63
  268. package/blockly-rc/core/renderers/measurables/input_connection.ts +0 -57
  269. package/blockly-rc/core/renderers/measurables/input_row.ts +0 -67
  270. package/blockly-rc/core/renderers/measurables/jagged_edge.ts +0 -28
  271. package/blockly-rc/core/renderers/measurables/next_connection.ts +0 -34
  272. package/blockly-rc/core/renderers/measurables/output_connection.ts +0 -43
  273. package/blockly-rc/core/renderers/measurables/previous_connection.ts +0 -34
  274. package/blockly-rc/core/renderers/measurables/round_corner.ts +0 -34
  275. package/blockly-rc/core/renderers/measurables/row.ts +0 -191
  276. package/blockly-rc/core/renderers/measurables/spacer_row.ts +0 -44
  277. package/blockly-rc/core/renderers/measurables/square_corner.ts +0 -32
  278. package/blockly-rc/core/renderers/measurables/statement_input.ts +0 -41
  279. package/blockly-rc/core/renderers/measurables/top_row.ts +0 -110
  280. package/blockly-rc/core/renderers/measurables/types.ts +0 -319
  281. package/blockly-rc/core/renderers/thrasos/info.ts +0 -328
  282. package/blockly-rc/core/renderers/thrasos/renderer.ts +0 -40
  283. package/blockly-rc/core/renderers/thrasos/thrasos.ts +0 -14
  284. package/blockly-rc/core/renderers/zelos/constants.ts +0 -877
  285. package/blockly-rc/core/renderers/zelos/drawer.ts +0 -274
  286. package/blockly-rc/core/renderers/zelos/info.ts +0 -652
  287. package/blockly-rc/core/renderers/zelos/marker_svg.ts +0 -145
  288. package/blockly-rc/core/renderers/zelos/measurables/bottom_row.ts +0 -44
  289. package/blockly-rc/core/renderers/zelos/measurables/inputs.ts +0 -41
  290. package/blockly-rc/core/renderers/zelos/measurables/row_elements.ts +0 -29
  291. package/blockly-rc/core/renderers/zelos/measurables/top_row.ts +0 -50
  292. package/blockly-rc/core/renderers/zelos/path_object.ts +0 -209
  293. package/blockly-rc/core/renderers/zelos/renderer.ts +0 -143
  294. package/blockly-rc/core/renderers/zelos/zelos.ts +0 -33
  295. package/blockly-rc/core/scrollbar.ts +0 -898
  296. package/blockly-rc/core/scrollbar_pair.ts +0 -349
  297. package/blockly-rc/core/separator_flyout_inflater.ts +0 -69
  298. package/blockly-rc/core/serialization/blocks.ts +0 -868
  299. package/blockly-rc/core/serialization/exceptions.ts +0 -112
  300. package/blockly-rc/core/serialization/priorities.ts +0 -25
  301. package/blockly-rc/core/serialization/procedures.ts +0 -158
  302. package/blockly-rc/core/serialization/registry.ts +0 -30
  303. package/blockly-rc/core/serialization/variables.ts +0 -68
  304. package/blockly-rc/core/serialization/workspace_comments.ts +0 -143
  305. package/blockly-rc/core/serialization/workspaces.ts +0 -94
  306. package/blockly-rc/core/serialization.ts +0 -32
  307. package/blockly-rc/core/shortcut_items.ts +0 -338
  308. package/blockly-rc/core/shortcut_registry.ts +0 -368
  309. package/blockly-rc/core/sprites.ts +0 -15
  310. package/blockly-rc/core/theme/classic.ts +0 -40
  311. package/blockly-rc/core/theme/themes.ts +0 -12
  312. package/blockly-rc/core/theme/zelos.ts +0 -80
  313. package/blockly-rc/core/theme.ts +0 -232
  314. package/blockly-rc/core/theme_manager.ts +0 -192
  315. package/blockly-rc/core/toolbox/category.ts +0 -739
  316. package/blockly-rc/core/toolbox/collapsible_category.ts +0 -288
  317. package/blockly-rc/core/toolbox/separator.ts +0 -105
  318. package/blockly-rc/core/toolbox/toolbox.ts +0 -1134
  319. package/blockly-rc/core/toolbox/toolbox_item.ts +0 -152
  320. package/blockly-rc/core/tooltip.ts +0 -466
  321. package/blockly-rc/core/touch.ts +0 -155
  322. package/blockly-rc/core/trashcan.ts +0 -748
  323. package/blockly-rc/core/utils/aria.ts +0 -144
  324. package/blockly-rc/core/utils/array.ts +0 -24
  325. package/blockly-rc/core/utils/colour.ts +0 -265
  326. package/blockly-rc/core/utils/coordinate.ts +0 -129
  327. package/blockly-rc/core/utils/deprecation.ts +0 -47
  328. package/blockly-rc/core/utils/dom.ts +0 -356
  329. package/blockly-rc/core/utils/idgenerator.ts +0 -70
  330. package/blockly-rc/core/utils/keycodes.ts +0 -154
  331. package/blockly-rc/core/utils/math.ts +0 -50
  332. package/blockly-rc/core/utils/metrics.ts +0 -86
  333. package/blockly-rc/core/utils/object.ts +0 -28
  334. package/blockly-rc/core/utils/parsing.ts +0 -287
  335. package/blockly-rc/core/utils/rect.ts +0 -69
  336. package/blockly-rc/core/utils/size.ts +0 -62
  337. package/blockly-rc/core/utils/string.ts +0 -289
  338. package/blockly-rc/core/utils/style.ts +0 -219
  339. package/blockly-rc/core/utils/svg.ts +0 -84
  340. package/blockly-rc/core/utils/svg_math.ts +0 -208
  341. package/blockly-rc/core/utils/svg_paths.ts +0 -133
  342. package/blockly-rc/core/utils/toolbox.ts +0 -419
  343. package/blockly-rc/core/utils/useragent.ts +0 -86
  344. package/blockly-rc/core/utils/xml.ts +0 -165
  345. package/blockly-rc/core/utils.ts +0 -59
  346. package/blockly-rc/core/variable_map.ts +0 -437
  347. package/blockly-rc/core/variable_model.ts +0 -149
  348. package/blockly-rc/core/variables.ts +0 -773
  349. package/blockly-rc/core/variables_dynamic.ts +0 -142
  350. package/blockly-rc/core/widgetdiv.ts +0 -319
  351. package/blockly-rc/core/workspace.ts +0 -957
  352. package/blockly-rc/core/workspace_audio.ts +0 -171
  353. package/blockly-rc/core/workspace_dragger.ts +0 -97
  354. package/blockly-rc/core/workspace_svg.ts +0 -2519
  355. package/blockly-rc/core/xml.ts +0 -1133
  356. package/blockly-rc/core/zoom_controls.ts +0 -492
  357. package/blockly-rc/demos/blockfactory/analytics.js +0 -195
  358. package/blockly-rc/demos/blockfactory/app_controller.js +0 -726
  359. package/blockly-rc/demos/blockfactory/block_definition_extractor.js +0 -742
  360. package/blockly-rc/demos/blockfactory/block_exporter_controller.js +0 -311
  361. package/blockly-rc/demos/blockfactory/block_exporter_tools.js +0 -212
  362. package/blockly-rc/demos/blockfactory/block_exporter_view.js +0 -101
  363. package/blockly-rc/demos/blockfactory/block_library_controller.js +0 -325
  364. package/blockly-rc/demos/blockfactory/block_library_storage.js +0 -149
  365. package/blockly-rc/demos/blockfactory/block_library_view.js +0 -178
  366. package/blockly-rc/demos/blockfactory/block_option.js +0 -151
  367. package/blockly-rc/demos/blockfactory/blocks.js +0 -916
  368. package/blockly-rc/demos/blockfactory/cp.css +0 -46
  369. package/blockly-rc/demos/blockfactory/cp.js +0 -179
  370. package/blockly-rc/demos/blockfactory/factory.css +0 -586
  371. package/blockly-rc/demos/blockfactory/factory.js +0 -337
  372. package/blockly-rc/demos/blockfactory/factory_utils.js +0 -1036
  373. package/blockly-rc/demos/blockfactory/icon.png +0 -0
  374. package/blockly-rc/demos/blockfactory/index.html +0 -767
  375. package/blockly-rc/demos/blockfactory/link.png +0 -0
  376. package/blockly-rc/demos/blockfactory/standard_categories.js +0 -384
  377. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_controller.js +0 -1332
  378. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_generator.js +0 -224
  379. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_init.js +0 -541
  380. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_model.js +0 -548
  381. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_view.js +0 -424
  382. package/blockly-rc/demos/code/code.js +0 -626
  383. package/blockly-rc/demos/code/icon.png +0 -0
  384. package/blockly-rc/demos/code/icons.png +0 -0
  385. package/blockly-rc/demos/code/index.html +0 -359
  386. package/blockly-rc/demos/code/msg/ar.js +0 -24
  387. package/blockly-rc/demos/code/msg/be-tarask.js +0 -24
  388. package/blockly-rc/demos/code/msg/br.js +0 -24
  389. package/blockly-rc/demos/code/msg/ca.js +0 -24
  390. package/blockly-rc/demos/code/msg/cs.js +0 -24
  391. package/blockly-rc/demos/code/msg/da.js +0 -24
  392. package/blockly-rc/demos/code/msg/de.js +0 -24
  393. package/blockly-rc/demos/code/msg/el.js +0 -24
  394. package/blockly-rc/demos/code/msg/en.js +0 -24
  395. package/blockly-rc/demos/code/msg/es.js +0 -24
  396. package/blockly-rc/demos/code/msg/et.js +0 -24
  397. package/blockly-rc/demos/code/msg/fa.js +0 -24
  398. package/blockly-rc/demos/code/msg/fr.js +0 -24
  399. package/blockly-rc/demos/code/msg/he.js +0 -24
  400. package/blockly-rc/demos/code/msg/hr.js +0 -24
  401. package/blockly-rc/demos/code/msg/hrx.js +0 -24
  402. package/blockly-rc/demos/code/msg/hu.js +0 -24
  403. package/blockly-rc/demos/code/msg/ia.js +0 -24
  404. package/blockly-rc/demos/code/msg/is.js +0 -24
  405. package/blockly-rc/demos/code/msg/it.js +0 -24
  406. package/blockly-rc/demos/code/msg/ja.js +0 -24
  407. package/blockly-rc/demos/code/msg/kab.js +0 -24
  408. package/blockly-rc/demos/code/msg/ko.js +0 -24
  409. package/blockly-rc/demos/code/msg/mk.js +0 -24
  410. package/blockly-rc/demos/code/msg/ms.js +0 -24
  411. package/blockly-rc/demos/code/msg/nb.js +0 -24
  412. package/blockly-rc/demos/code/msg/nl.js +0 -24
  413. package/blockly-rc/demos/code/msg/oc.js +0 -24
  414. package/blockly-rc/demos/code/msg/pl.js +0 -24
  415. package/blockly-rc/demos/code/msg/pms.js +0 -24
  416. package/blockly-rc/demos/code/msg/pt-br.js +0 -24
  417. package/blockly-rc/demos/code/msg/ro.js +0 -24
  418. package/blockly-rc/demos/code/msg/ru.js +0 -24
  419. package/blockly-rc/demos/code/msg/sc.js +0 -24
  420. package/blockly-rc/demos/code/msg/sk.js +0 -24
  421. package/blockly-rc/demos/code/msg/sr.js +0 -24
  422. package/blockly-rc/demos/code/msg/sv.js +0 -24
  423. package/blockly-rc/demos/code/msg/ta.js +0 -24
  424. package/blockly-rc/demos/code/msg/th.js +0 -24
  425. package/blockly-rc/demos/code/msg/tlh.js +0 -24
  426. package/blockly-rc/demos/code/msg/tr.js +0 -24
  427. package/blockly-rc/demos/code/msg/uk.js +0 -24
  428. package/blockly-rc/demos/code/msg/vi.js +0 -24
  429. package/blockly-rc/demos/code/msg/zh-hans.js +0 -24
  430. package/blockly-rc/demos/code/msg/zh-hant.js +0 -24
  431. package/blockly-rc/demos/code/style.css +0 -184
  432. package/blockly-rc/demos/index.html +0 -68
  433. package/blockly-rc/demos/minimap/icon.png +0 -0
  434. package/blockly-rc/demos/minimap/index.html +0 -91
  435. package/blockly-rc/demos/minimap/minimap.js +0 -302
  436. package/blockly-rc/demos/mobile/README.md +0 -53
  437. package/blockly-rc/demos/mobile/android/README.md +0 -45
  438. package/blockly-rc/demos/mobile/android/app/build.gradle +0 -64
  439. package/blockly-rc/demos/mobile/android/app/proguard-rules.pro +0 -21
  440. package/blockly-rc/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java +0 -26
  441. package/blockly-rc/demos/mobile/android/app/src/main/AndroidManifest.xml +0 -21
  442. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java +0 -40
  443. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java +0 -150
  444. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java +0 -32
  445. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java +0 -18
  446. package/blockly-rc/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -74
  447. package/blockly-rc/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -34
  448. package/blockly-rc/demos/mobile/android/app/src/main/res/layout/activity_main.xml +0 -17
  449. package/blockly-rc/demos/mobile/android/app/src/main/res/layout/js_prompt.xml +0 -37
  450. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  451. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  452. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  453. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  454. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  455. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  456. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  457. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  458. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  459. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  460. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  461. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  462. package/blockly-rc/demos/mobile/android/app/src/main/res/values/colors.xml +0 -6
  463. package/blockly-rc/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml +0 -7
  464. package/blockly-rc/demos/mobile/android/app/src/main/res/values/strings.xml +0 -3
  465. package/blockly-rc/demos/mobile/android/app/src/main/res/values/styles.xml +0 -11
  466. package/blockly-rc/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java +0 -17
  467. package/blockly-rc/demos/mobile/android/build.gradle +0 -27
  468. package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  469. package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  470. package/blockly-rc/demos/mobile/android/gradle.properties +0 -13
  471. package/blockly-rc/demos/mobile/android/gradlew +0 -172
  472. package/blockly-rc/demos/mobile/android/gradlew.bat +0 -84
  473. package/blockly-rc/demos/mobile/android/settings.gradle +0 -1
  474. package/blockly-rc/demos/mobile/html/index.html +0 -31
  475. package/blockly-rc/demos/mobile/html/ln_resources.sh +0 -22
  476. package/blockly-rc/demos/mobile/html/toolbox_standard.js +0 -333
  477. package/blockly-rc/demos/mobile/ios/Blockly WebView/AppDelegate.swift +0 -46
  478. package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
  479. package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json +0 -6
  480. package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard +0 -25
  481. package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard +0 -44
  482. package/blockly-rc/demos/mobile/ios/Blockly WebView/Info.plist +0 -45
  483. package/blockly-rc/demos/mobile/ios/Blockly WebView/ViewController.swift +0 -110
  484. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj +0 -390
  485. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  486. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  487. package/blockly-rc/demos/mobile/ios/cp_resources.sh +0 -21
  488. package/blockly-rc/demos/storage/icon.png +0 -0
  489. package/blockly-rc/demos/storage/index.html +0 -104
  490. package/blockly-rc/generators/dart/dart_generator.ts +0 -321
  491. package/blockly-rc/generators/dart/lists.ts +0 -525
  492. package/blockly-rc/generators/dart/logic.ts +0 -155
  493. package/blockly-rc/generators/dart/loops.ts +0 -217
  494. package/blockly-rc/generators/dart/math.ts +0 -559
  495. package/blockly-rc/generators/dart/procedures.ts +0 -138
  496. package/blockly-rc/generators/dart/text.ts +0 -405
  497. package/blockly-rc/generators/dart/variables.ts +0 -32
  498. package/blockly-rc/generators/dart/variables_dynamic.ts +0 -17
  499. package/blockly-rc/generators/dart.ts +0 -50
  500. package/blockly-rc/generators/javascript/javascript_generator.ts +0 -346
  501. package/blockly-rc/generators/javascript/lists.ts +0 -465
  502. package/blockly-rc/generators/javascript/logic.ts +0 -153
  503. package/blockly-rc/generators/javascript/loops.ts +0 -245
  504. package/blockly-rc/generators/javascript/math.ts +0 -450
  505. package/blockly-rc/generators/javascript/procedures.ts +0 -142
  506. package/blockly-rc/generators/javascript/text.ts +0 -418
  507. package/blockly-rc/generators/javascript/variables.ts +0 -32
  508. package/blockly-rc/generators/javascript/variables_dynamic.ts +0 -17
  509. package/blockly-rc/generators/javascript.ts +0 -46
  510. package/blockly-rc/generators/lua/lists.ts +0 -445
  511. package/blockly-rc/generators/lua/logic.ts +0 -142
  512. package/blockly-rc/generators/lua/loops.ts +0 -192
  513. package/blockly-rc/generators/lua/lua_generator.ts +0 -225
  514. package/blockly-rc/generators/lua/math.ts +0 -473
  515. package/blockly-rc/generators/lua/procedures.ts +0 -144
  516. package/blockly-rc/generators/lua/text.ts +0 -380
  517. package/blockly-rc/generators/lua/variables.ts +0 -31
  518. package/blockly-rc/generators/lua/variables_dynamic.ts +0 -17
  519. package/blockly-rc/generators/lua.ts +0 -44
  520. package/blockly-rc/generators/php/lists.ts +0 -585
  521. package/blockly-rc/generators/php/logic.ts +0 -155
  522. package/blockly-rc/generators/php/loops.ts +0 -218
  523. package/blockly-rc/generators/php/math.ts +0 -408
  524. package/blockly-rc/generators/php/php_generator.ts +0 -320
  525. package/blockly-rc/generators/php/procedures.ts +0 -159
  526. package/blockly-rc/generators/php/text.ts +0 -315
  527. package/blockly-rc/generators/php/variables.ts +0 -32
  528. package/blockly-rc/generators/php/variables_dynamic.ts +0 -17
  529. package/blockly-rc/generators/php.ts +0 -46
  530. package/blockly-rc/generators/python/lists.ts +0 -398
  531. package/blockly-rc/generators/python/logic.ts +0 -148
  532. package/blockly-rc/generators/python/loops.ts +0 -251
  533. package/blockly-rc/generators/python/math.ts +0 -434
  534. package/blockly-rc/generators/python/procedures.ts +0 -159
  535. package/blockly-rc/generators/python/python_generator.ts +0 -355
  536. package/blockly-rc/generators/python/text.ts +0 -338
  537. package/blockly-rc/generators/python/variables.ts +0 -31
  538. package/blockly-rc/generators/python/variables_dynamic.ts +0 -17
  539. package/blockly-rc/generators/python.ts +0 -51
  540. package/blockly-rc/gulpfile.js +0 -54
  541. package/blockly-rc/jsconfig.json +0 -7
  542. package/blockly-rc/media/1x1.gif +0 -0
  543. package/blockly-rc/media/click.mp3 +0 -0
  544. package/blockly-rc/media/click.ogg +0 -0
  545. package/blockly-rc/media/click.wav +0 -0
  546. package/blockly-rc/media/delete-icon.svg +0 -1
  547. package/blockly-rc/media/delete.mp3 +0 -0
  548. package/blockly-rc/media/delete.ogg +0 -0
  549. package/blockly-rc/media/delete.wav +0 -0
  550. package/blockly-rc/media/disconnect.mp3 +0 -0
  551. package/blockly-rc/media/disconnect.ogg +0 -0
  552. package/blockly-rc/media/disconnect.wav +0 -0
  553. package/blockly-rc/media/dropdown-arrow.svg +0 -1
  554. package/blockly-rc/media/foldout-icon.svg +0 -1
  555. package/blockly-rc/media/handclosed.cur +0 -0
  556. package/blockly-rc/media/handdelete.cur +0 -0
  557. package/blockly-rc/media/handopen.cur +0 -0
  558. package/blockly-rc/media/pilcrow.png +0 -0
  559. package/blockly-rc/media/quote0.png +0 -0
  560. package/blockly-rc/media/quote1.png +0 -0
  561. package/blockly-rc/media/resize-handle.svg +0 -3
  562. package/blockly-rc/media/sprites.png +0 -0
  563. package/blockly-rc/media/sprites.svg +0 -74
  564. package/blockly-rc/msg/json/README.md +0 -33
  565. package/blockly-rc/msg/json/ab.json +0 -222
  566. package/blockly-rc/msg/json/ace.json +0 -7
  567. package/blockly-rc/msg/json/af.json +0 -34
  568. package/blockly-rc/msg/json/am.json +0 -30
  569. package/blockly-rc/msg/json/ar.json +0 -355
  570. package/blockly-rc/msg/json/ast.json +0 -10
  571. package/blockly-rc/msg/json/az.json +0 -332
  572. package/blockly-rc/msg/json/ba.json +0 -211
  573. package/blockly-rc/msg/json/bcc.json +0 -290
  574. package/blockly-rc/msg/json/be-tarask.json +0 -334
  575. package/blockly-rc/msg/json/be.json +0 -324
  576. package/blockly-rc/msg/json/bg.json +0 -345
  577. package/blockly-rc/msg/json/bn.json +0 -189
  578. package/blockly-rc/msg/json/br.json +0 -334
  579. package/blockly-rc/msg/json/bs.json +0 -166
  580. package/blockly-rc/msg/json/ca.json +0 -341
  581. package/blockly-rc/msg/json/cdo.json +0 -6
  582. package/blockly-rc/msg/json/ce.json +0 -326
  583. package/blockly-rc/msg/json/constants.json +0 -12
  584. package/blockly-rc/msg/json/cs.json +0 -343
  585. package/blockly-rc/msg/json/da.json +0 -346
  586. package/blockly-rc/msg/json/de.json +0 -369
  587. package/blockly-rc/msg/json/diq.json +0 -258
  588. package/blockly-rc/msg/json/dtp.json +0 -198
  589. package/blockly-rc/msg/json/dty.json +0 -97
  590. package/blockly-rc/msg/json/ee.json +0 -160
  591. package/blockly-rc/msg/json/el.json +0 -356
  592. package/blockly-rc/msg/json/en-gb.json +0 -199
  593. package/blockly-rc/msg/json/en.json +0 -400
  594. package/blockly-rc/msg/json/eo.json +0 -337
  595. package/blockly-rc/msg/json/es.json +0 -358
  596. package/blockly-rc/msg/json/et.json +0 -326
  597. package/blockly-rc/msg/json/eu.json +0 -219
  598. package/blockly-rc/msg/json/fa.json +0 -341
  599. package/blockly-rc/msg/json/fi.json +0 -350
  600. package/blockly-rc/msg/json/fo.json +0 -46
  601. package/blockly-rc/msg/json/fr.json +0 -373
  602. package/blockly-rc/msg/json/frr.json +0 -6
  603. package/blockly-rc/msg/json/gl.json +0 -338
  604. package/blockly-rc/msg/json/gn.json +0 -54
  605. package/blockly-rc/msg/json/gor.json +0 -87
  606. package/blockly-rc/msg/json/ha.json +0 -313
  607. package/blockly-rc/msg/json/hak.json +0 -17
  608. package/blockly-rc/msg/json/he.json +0 -354
  609. package/blockly-rc/msg/json/hi.json +0 -318
  610. package/blockly-rc/msg/json/hr.json +0 -327
  611. package/blockly-rc/msg/json/hrx.json +0 -287
  612. package/blockly-rc/msg/json/hsb.json +0 -128
  613. package/blockly-rc/msg/json/hu.json +0 -349
  614. package/blockly-rc/msg/json/hy.json +0 -337
  615. package/blockly-rc/msg/json/ia.json +0 -337
  616. package/blockly-rc/msg/json/id.json +0 -335
  617. package/blockly-rc/msg/json/ig.json +0 -323
  618. package/blockly-rc/msg/json/inh.json +0 -80
  619. package/blockly-rc/msg/json/is.json +0 -331
  620. package/blockly-rc/msg/json/it.json +0 -346
  621. package/blockly-rc/msg/json/ja.json +0 -361
  622. package/blockly-rc/msg/json/ka.json +0 -14
  623. package/blockly-rc/msg/json/kab.json +0 -323
  624. package/blockly-rc/msg/json/kbd-cyrl.json +0 -84
  625. package/blockly-rc/msg/json/km.json +0 -29
  626. package/blockly-rc/msg/json/kn.json +0 -332
  627. package/blockly-rc/msg/json/ko.json +0 -372
  628. package/blockly-rc/msg/json/ksh.json +0 -43
  629. package/blockly-rc/msg/json/ku-latn.json +0 -41
  630. package/blockly-rc/msg/json/ky.json +0 -71
  631. package/blockly-rc/msg/json/la.json +0 -6
  632. package/blockly-rc/msg/json/lb.json +0 -156
  633. package/blockly-rc/msg/json/lki.json +0 -282
  634. package/blockly-rc/msg/json/lo.json +0 -92
  635. package/blockly-rc/msg/json/lrc.json +0 -123
  636. package/blockly-rc/msg/json/lt.json +0 -321
  637. package/blockly-rc/msg/json/lv.json +0 -324
  638. package/blockly-rc/msg/json/mg.json +0 -58
  639. package/blockly-rc/msg/json/mk.json +0 -178
  640. package/blockly-rc/msg/json/ml.json +0 -35
  641. package/blockly-rc/msg/json/mnw.json +0 -90
  642. package/blockly-rc/msg/json/ms.json +0 -300
  643. package/blockly-rc/msg/json/my.json +0 -57
  644. package/blockly-rc/msg/json/mzn.json +0 -6
  645. package/blockly-rc/msg/json/nb.json +0 -330
  646. package/blockly-rc/msg/json/ne.json +0 -247
  647. package/blockly-rc/msg/json/nl.json +0 -357
  648. package/blockly-rc/msg/json/oc.json +0 -194
  649. package/blockly-rc/msg/json/olo.json +0 -37
  650. package/blockly-rc/msg/json/pa.json +0 -69
  651. package/blockly-rc/msg/json/pl.json +0 -357
  652. package/blockly-rc/msg/json/pms.json +0 -324
  653. package/blockly-rc/msg/json/ps.json +0 -50
  654. package/blockly-rc/msg/json/pt-br.json +0 -369
  655. package/blockly-rc/msg/json/pt.json +0 -358
  656. package/blockly-rc/msg/json/qqq.json +0 -406
  657. package/blockly-rc/msg/json/ro.json +0 -333
  658. package/blockly-rc/msg/json/ru.json +0 -363
  659. package/blockly-rc/msg/json/sc.json +0 -283
  660. package/blockly-rc/msg/json/sco.json +0 -11
  661. package/blockly-rc/msg/json/sd.json +0 -158
  662. package/blockly-rc/msg/json/shn.json +0 -109
  663. package/blockly-rc/msg/json/si.json +0 -16
  664. package/blockly-rc/msg/json/sk.json +0 -332
  665. package/blockly-rc/msg/json/skr-arab.json +0 -117
  666. package/blockly-rc/msg/json/sl.json +0 -355
  667. package/blockly-rc/msg/json/smn.json +0 -133
  668. package/blockly-rc/msg/json/sq.json +0 -343
  669. package/blockly-rc/msg/json/sr-latn.json +0 -324
  670. package/blockly-rc/msg/json/sr.json +0 -348
  671. package/blockly-rc/msg/json/sv.json +0 -347
  672. package/blockly-rc/msg/json/sw.json +0 -12
  673. package/blockly-rc/msg/json/synonyms.json +0 -22
  674. package/blockly-rc/msg/json/ta.json +0 -306
  675. package/blockly-rc/msg/json/tcy.json +0 -316
  676. package/blockly-rc/msg/json/tdd.json +0 -109
  677. package/blockly-rc/msg/json/te.json +0 -101
  678. package/blockly-rc/msg/json/th.json +0 -333
  679. package/blockly-rc/msg/json/ti.json +0 -50
  680. package/blockly-rc/msg/json/tl.json +0 -129
  681. package/blockly-rc/msg/json/tlh.json +0 -179
  682. package/blockly-rc/msg/json/tr.json +0 -369
  683. package/blockly-rc/msg/json/ug-arab.json +0 -132
  684. package/blockly-rc/msg/json/uk.json +0 -345
  685. package/blockly-rc/msg/json/ur.json +0 -117
  686. package/blockly-rc/msg/json/uz.json +0 -36
  687. package/blockly-rc/msg/json/vi.json +0 -345
  688. package/blockly-rc/msg/json/xmf.json +0 -96
  689. package/blockly-rc/msg/json/yo.json +0 -316
  690. package/blockly-rc/msg/json/zgh.json +0 -83
  691. package/blockly-rc/msg/json/zh-hans.json +0 -372
  692. package/blockly-rc/msg/json/zh-hant.json +0 -362
  693. package/blockly-rc/msg/messages.js +0 -1616
  694. package/blockly-rc/package-lock.json +0 -12324
  695. package/blockly-rc/package.json +0 -149
  696. package/blockly-rc/patches/@microsoft+api-documenter+7.22.4.patch +0 -81
  697. package/blockly-rc/scripts/goog_module/convert-file.sh +0 -406
  698. package/blockly-rc/scripts/gulpfiles/appengine_tasks.js +0 -195
  699. package/blockly-rc/scripts/gulpfiles/build_tasks.js +0 -752
  700. package/blockly-rc/scripts/gulpfiles/config.js +0 -41
  701. package/blockly-rc/scripts/gulpfiles/docs_tasks.js +0 -147
  702. package/blockly-rc/scripts/gulpfiles/git_tasks.js +0 -181
  703. package/blockly-rc/scripts/gulpfiles/helper_tasks.js +0 -19
  704. package/blockly-rc/scripts/gulpfiles/package_tasks.js +0 -262
  705. package/blockly-rc/scripts/gulpfiles/release_tasks.js +0 -183
  706. package/blockly-rc/scripts/gulpfiles/test_tasks.js +0 -405
  707. package/blockly-rc/scripts/helpers.js +0 -74
  708. package/blockly-rc/scripts/i18n/common.py +0 -233
  709. package/blockly-rc/scripts/i18n/create_messages.py +0 -167
  710. package/blockly-rc/scripts/i18n/dedup_json.py +0 -72
  711. package/blockly-rc/scripts/i18n/js_to_json.py +0 -135
  712. package/blockly-rc/scripts/i18n/tests.py +0 -46
  713. package/blockly-rc/scripts/migration/cjs2esm +0 -162
  714. package/blockly-rc/scripts/migration/js2ts +0 -168
  715. package/blockly-rc/scripts/migration/renamings.json5 +0 -1599
  716. package/blockly-rc/scripts/package/README.md +0 -93
  717. package/blockly-rc/scripts/package/core-node.js +0 -31
  718. package/blockly-rc/scripts/package/index.js +0 -23
  719. package/blockly-rc/scripts/package/templates/umd-msg.template +0 -16
  720. package/blockly-rc/scripts/package/templates/umd.template +0 -13
  721. package/blockly-rc/scripts/themes/blockStyles_example.json +0 -11
  722. package/blockly-rc/scripts/themes/create_blockStyles.py +0 -181
  723. package/blockly-rc/scripts/tsick.js +0 -86
  724. package/blockly-rc/tests/.eslintrc.json +0 -10
  725. package/blockly-rc/tests/browser/.eslintrc.json +0 -29
  726. package/blockly-rc/tests/browser/.mocharc.js +0 -6
  727. package/blockly-rc/tests/browser/test/basic_block_factory_test.mjs +0 -44
  728. package/blockly-rc/tests/browser/test/basic_block_test.mjs +0 -39
  729. package/blockly-rc/tests/browser/test/basic_playground_test.mjs +0 -198
  730. package/blockly-rc/tests/browser/test/block_undo_test.mjs +0 -50
  731. package/blockly-rc/tests/browser/test/delete_blocks_test.mjs +0 -211
  732. package/blockly-rc/tests/browser/test/extensive_test.mjs +0 -195
  733. package/blockly-rc/tests/browser/test/field_edits_test.mjs +0 -61
  734. package/blockly-rc/tests/browser/test/hooks.mjs +0 -23
  735. package/blockly-rc/tests/browser/test/mutator_test.mjs +0 -88
  736. package/blockly-rc/tests/browser/test/procedure_test.mjs +0 -109
  737. package/blockly-rc/tests/browser/test/test_setup.mjs +0 -589
  738. package/blockly-rc/tests/browser/test/toolbox_drag_test.mjs +0 -207
  739. package/blockly-rc/tests/browser/test/workspace_comment_test.mjs +0 -224
  740. package/blockly-rc/tests/compile/index.html +0 -43
  741. package/blockly-rc/tests/compile/main.js +0 -53
  742. package/blockly-rc/tests/compile/test_blocks.js +0 -47
  743. package/blockly-rc/tests/compile/webdriver.js +0 -81
  744. package/blockly-rc/tests/generators/functions.xml +0 -561
  745. package/blockly-rc/tests/generators/golden/generated.dart +0 -1604
  746. package/blockly-rc/tests/generators/golden/generated.js +0 -1552
  747. package/blockly-rc/tests/generators/golden/generated.lua +0 -1828
  748. package/blockly-rc/tests/generators/golden/generated.php +0 -1611
  749. package/blockly-rc/tests/generators/golden/generated.py +0 -1407
  750. package/blockly-rc/tests/generators/index.html +0 -405
  751. package/blockly-rc/tests/generators/lists.xml +0 -8675
  752. package/blockly-rc/tests/generators/logic.xml +0 -1019
  753. package/blockly-rc/tests/generators/loops1.xml +0 -345
  754. package/blockly-rc/tests/generators/loops2.xml +0 -891
  755. package/blockly-rc/tests/generators/loops3.xml +0 -735
  756. package/blockly-rc/tests/generators/math.xml +0 -2077
  757. package/blockly-rc/tests/generators/text.xml +0 -4651
  758. package/blockly-rc/tests/generators/unittest.js +0 -103
  759. package/blockly-rc/tests/generators/unittest_dart.js +0 -163
  760. package/blockly-rc/tests/generators/unittest_javascript.js +0 -167
  761. package/blockly-rc/tests/generators/unittest_lua.js +0 -165
  762. package/blockly-rc/tests/generators/unittest_php.js +0 -154
  763. package/blockly-rc/tests/generators/unittest_python.js +0 -138
  764. package/blockly-rc/tests/generators/variables.xml +0 -68
  765. package/blockly-rc/tests/generators/webdriver.js +0 -123
  766. package/blockly-rc/tests/media/200px.png +0 -0
  767. package/blockly-rc/tests/media/30px.png +0 -0
  768. package/blockly-rc/tests/media/50px.png +0 -0
  769. package/blockly-rc/tests/media/a.png +0 -0
  770. package/blockly-rc/tests/media/arrow.png +0 -0
  771. package/blockly-rc/tests/media/b.png +0 -0
  772. package/blockly-rc/tests/media/c.png +0 -0
  773. package/blockly-rc/tests/media/d.png +0 -0
  774. package/blockly-rc/tests/media/e.png +0 -0
  775. package/blockly-rc/tests/media/f.png +0 -0
  776. package/blockly-rc/tests/media/g.png +0 -0
  777. package/blockly-rc/tests/media/h.png +0 -0
  778. package/blockly-rc/tests/media/i.png +0 -0
  779. package/blockly-rc/tests/media/j.png +0 -0
  780. package/blockly-rc/tests/media/k.png +0 -0
  781. package/blockly-rc/tests/media/l.png +0 -0
  782. package/blockly-rc/tests/media/m.png +0 -0
  783. package/blockly-rc/tests/migration/renamings.schema.json +0 -59
  784. package/blockly-rc/tests/migration/validate-renamings.mjs +0 -60
  785. package/blockly-rc/tests/mocha/.eslintrc.json +0 -21
  786. package/blockly-rc/tests/mocha/.mocharc.js +0 -6
  787. package/blockly-rc/tests/mocha/astnode_test.js +0 -850
  788. package/blockly-rc/tests/mocha/block_json_test.js +0 -777
  789. package/blockly-rc/tests/mocha/block_test.js +0 -2743
  790. package/blockly-rc/tests/mocha/blocks/lists_test.js +0 -196
  791. package/blockly-rc/tests/mocha/blocks/logic_ternary_test.js +0 -320
  792. package/blockly-rc/tests/mocha/blocks/loops_test.js +0 -56
  793. package/blockly-rc/tests/mocha/blocks/procedures_test.js +0 -2495
  794. package/blockly-rc/tests/mocha/blocks/variables_test.js +0 -311
  795. package/blockly-rc/tests/mocha/clipboard_test.js +0 -136
  796. package/blockly-rc/tests/mocha/comment_deserialization_test.js +0 -122
  797. package/blockly-rc/tests/mocha/comment_test.js +0 -170
  798. package/blockly-rc/tests/mocha/comment_view_test.js +0 -188
  799. package/blockly-rc/tests/mocha/connection_checker_test.js +0 -666
  800. package/blockly-rc/tests/mocha/connection_db_test.js +0 -362
  801. package/blockly-rc/tests/mocha/connection_test.js +0 -3738
  802. package/blockly-rc/tests/mocha/contextmenu_items_test.js +0 -488
  803. package/blockly-rc/tests/mocha/contextmenu_test.js +0 -71
  804. package/blockly-rc/tests/mocha/cursor_test.js +0 -134
  805. package/blockly-rc/tests/mocha/dropdowndiv_test.js +0 -116
  806. package/blockly-rc/tests/mocha/event_block_change_test.js +0 -126
  807. package/blockly-rc/tests/mocha/event_block_create_test.js +0 -109
  808. package/blockly-rc/tests/mocha/event_block_delete_test.js +0 -55
  809. package/blockly-rc/tests/mocha/event_block_drag_test.js +0 -36
  810. package/blockly-rc/tests/mocha/event_block_field_intermediate_change_test.js +0 -67
  811. package/blockly-rc/tests/mocha/event_block_move_test.js +0 -39
  812. package/blockly-rc/tests/mocha/event_bubble_open_test.js +0 -42
  813. package/blockly-rc/tests/mocha/event_click_test.js +0 -40
  814. package/blockly-rc/tests/mocha/event_comment_change_test.js +0 -39
  815. package/blockly-rc/tests/mocha/event_comment_collapse_test.js +0 -34
  816. package/blockly-rc/tests/mocha/event_comment_create_test.js +0 -38
  817. package/blockly-rc/tests/mocha/event_comment_delete_test.js +0 -38
  818. package/blockly-rc/tests/mocha/event_comment_drag_test.js +0 -35
  819. package/blockly-rc/tests/mocha/event_comment_move_test.js +0 -40
  820. package/blockly-rc/tests/mocha/event_comment_resize_test.js +0 -38
  821. package/blockly-rc/tests/mocha/event_marker_move_test.js +0 -44
  822. package/blockly-rc/tests/mocha/event_selected_test.js +0 -41
  823. package/blockly-rc/tests/mocha/event_test.js +0 -1578
  824. package/blockly-rc/tests/mocha/event_theme_change_test.js +0 -36
  825. package/blockly-rc/tests/mocha/event_toolbox_item_select_test.js +0 -64
  826. package/blockly-rc/tests/mocha/event_trashcan_open_test.js +0 -36
  827. package/blockly-rc/tests/mocha/event_var_create_test.js +0 -54
  828. package/blockly-rc/tests/mocha/event_var_delete_test.js +0 -54
  829. package/blockly-rc/tests/mocha/event_var_rename_test.js +0 -39
  830. package/blockly-rc/tests/mocha/event_var_type_change_test.js +0 -43
  831. package/blockly-rc/tests/mocha/event_viewport_test.js +0 -39
  832. package/blockly-rc/tests/mocha/extensions_test.js +0 -613
  833. package/blockly-rc/tests/mocha/field_checkbox_test.js +0 -299
  834. package/blockly-rc/tests/mocha/field_colour_test.js +0 -395
  835. package/blockly-rc/tests/mocha/field_dropdown_test.js +0 -282
  836. package/blockly-rc/tests/mocha/field_image_test.js +0 -241
  837. package/blockly-rc/tests/mocha/field_label_serializable_test.js +0 -252
  838. package/blockly-rc/tests/mocha/field_label_test.js +0 -226
  839. package/blockly-rc/tests/mocha/field_number_test.js +0 -505
  840. package/blockly-rc/tests/mocha/field_registry_test.js +0 -116
  841. package/blockly-rc/tests/mocha/field_test.js +0 -822
  842. package/blockly-rc/tests/mocha/field_textinput_test.js +0 -297
  843. package/blockly-rc/tests/mocha/field_variable_test.js +0 -611
  844. package/blockly-rc/tests/mocha/flyout_test.js +0 -638
  845. package/blockly-rc/tests/mocha/generator_test.js +0 -233
  846. package/blockly-rc/tests/mocha/gesture_test.js +0 -97
  847. package/blockly-rc/tests/mocha/icon_test.js +0 -369
  848. package/blockly-rc/tests/mocha/index.html +0 -229
  849. package/blockly-rc/tests/mocha/input_test.js +0 -296
  850. package/blockly-rc/tests/mocha/insertion_marker_manager_test.js +0 -443
  851. package/blockly-rc/tests/mocha/insertion_marker_test.js +0 -432
  852. package/blockly-rc/tests/mocha/jso_deserialization_test.js +0 -849
  853. package/blockly-rc/tests/mocha/jso_serialization_test.js +0 -1067
  854. package/blockly-rc/tests/mocha/json_test.js +0 -315
  855. package/blockly-rc/tests/mocha/keydown_test.js +0 -364
  856. package/blockly-rc/tests/mocha/layering_test.js +0 -95
  857. package/blockly-rc/tests/mocha/metrics_test.js +0 -671
  858. package/blockly-rc/tests/mocha/mutator_test.js +0 -87
  859. package/blockly-rc/tests/mocha/names_test.js +0 -97
  860. package/blockly-rc/tests/mocha/old_workspace_comment_test.js +0 -256
  861. package/blockly-rc/tests/mocha/procedure_map_test.js +0 -57
  862. package/blockly-rc/tests/mocha/registry_test.js +0 -281
  863. package/blockly-rc/tests/mocha/render_management_test.js +0 -127
  864. package/blockly-rc/tests/mocha/serializer_test.js +0 -2104
  865. package/blockly-rc/tests/mocha/shortcut_registry_test.js +0 -450
  866. package/blockly-rc/tests/mocha/test_helpers/block_definitions.js +0 -204
  867. package/blockly-rc/tests/mocha/test_helpers/code_generation.js +0 -115
  868. package/blockly-rc/tests/mocha/test_helpers/common.js +0 -106
  869. package/blockly-rc/tests/mocha/test_helpers/events.js +0 -290
  870. package/blockly-rc/tests/mocha/test_helpers/fields.js +0 -310
  871. package/blockly-rc/tests/mocha/test_helpers/icon_mocks.js +0 -81
  872. package/blockly-rc/tests/mocha/test_helpers/procedures.js +0 -302
  873. package/blockly-rc/tests/mocha/test_helpers/serialization.js +0 -124
  874. package/blockly-rc/tests/mocha/test_helpers/setup_teardown.js +0 -209
  875. package/blockly-rc/tests/mocha/test_helpers/toolbox_definitions.js +0 -271
  876. package/blockly-rc/tests/mocha/test_helpers/user_input.js +0 -62
  877. package/blockly-rc/tests/mocha/test_helpers/variables.js +0 -23
  878. package/blockly-rc/tests/mocha/test_helpers/warnings.js +0 -83
  879. package/blockly-rc/tests/mocha/test_helpers/workspace.js +0 -1691
  880. package/blockly-rc/tests/mocha/theme_test.js +0 -307
  881. package/blockly-rc/tests/mocha/toolbox_test.js +0 -761
  882. package/blockly-rc/tests/mocha/tooltip_test.js +0 -276
  883. package/blockly-rc/tests/mocha/touch_test.js +0 -109
  884. package/blockly-rc/tests/mocha/trashcan_test.js +0 -375
  885. package/blockly-rc/tests/mocha/utils_test.js +0 -536
  886. package/blockly-rc/tests/mocha/variable_map_test.js +0 -509
  887. package/blockly-rc/tests/mocha/variable_model_test.js +0 -85
  888. package/blockly-rc/tests/mocha/webdriver.js +0 -96
  889. package/blockly-rc/tests/mocha/widget_div_test.js +0 -272
  890. package/blockly-rc/tests/mocha/workspace_comment_test.js +0 -171
  891. package/blockly-rc/tests/mocha/workspace_svg_test.js +0 -414
  892. package/blockly-rc/tests/mocha/workspace_test.js +0 -27
  893. package/blockly-rc/tests/mocha/xml_test.js +0 -951
  894. package/blockly-rc/tests/mocha/zoom_controls_test.js +0 -81
  895. package/blockly-rc/tests/multi_playground.html +0 -482
  896. package/blockly-rc/tests/node/.eslintrc.json +0 -12
  897. package/blockly-rc/tests/node/.mocharc.js +0 -6
  898. package/blockly-rc/tests/node/run_node_test.mjs +0 -72
  899. package/blockly-rc/tests/playground.html +0 -1280
  900. package/blockly-rc/tests/playgrounds/advanced_playground.html +0 -158
  901. package/blockly-rc/tests/playgrounds/iframe.html +0 -40
  902. package/blockly-rc/tests/playgrounds/screenshot.js +0 -123
  903. package/blockly-rc/tests/scripts/check_metadata.sh +0 -166
  904. package/blockly-rc/tests/scripts/compile_typings.sh +0 -32
  905. package/blockly-rc/tests/scripts/load.mjs +0 -140
  906. package/blockly-rc/tests/scripts/setup_linux_env.sh +0 -7
  907. package/blockly-rc/tests/scripts/update_metadata.sh +0 -46
  908. package/blockly-rc/tests/themes/test_themes.js +0 -62
  909. package/blockly-rc/tests/typescript/README.md +0 -4
  910. package/blockly-rc/tests/typescript/src/field/different_user_input.ts +0 -81
  911. package/blockly-rc/tests/typescript/src/generators/dart.ts +0 -24
  912. package/blockly-rc/tests/typescript/src/generators/javascript.ts +0 -28
  913. package/blockly-rc/tests/typescript/src/generators/lua.ts +0 -24
  914. package/blockly-rc/tests/typescript/src/generators/php.ts +0 -24
  915. package/blockly-rc/tests/typescript/src/generators/python.ts +0 -24
  916. package/blockly-rc/tests/typescript/src/generators.ts +0 -31
  917. package/blockly-rc/tests/typescript/src/msg.ts +0 -20
  918. package/blockly-rc/tests/typescript/tsconfig.json +0 -20
  919. package/blockly-rc/tests/xml/README.txt +0 -11
  920. package/blockly-rc/tests/xml/blockly.xsd +0 -178
  921. package/blockly-rc/tests/xml/invalid.xml +0 -6
  922. package/blockly-rc/tests/xml/toolbox.xml +0 -311
  923. package/blockly-rc/tests/xml/workspace.xml +0 -114
  924. package/blockly-rc/tsconfig.json +0 -37
  925. package/blockly-rc/tsdoc.json +0 -35
  926. package/blockly-rc/typings/README.md +0 -5
  927. package/blockly-rc/typings/blocks.d.ts +0 -17
  928. package/blockly-rc/typings/core.d.ts +0 -7
  929. package/blockly-rc/typings/dart.d.ts +0 -7
  930. package/blockly-rc/typings/index.d.ts +0 -10
  931. package/blockly-rc/typings/javascript.d.ts +0 -7
  932. package/blockly-rc/typings/lua.d.ts +0 -7
  933. package/blockly-rc/typings/msg/ab.d.ts +0 -8
  934. package/blockly-rc/typings/msg/ace.d.ts +0 -8
  935. package/blockly-rc/typings/msg/af.d.ts +0 -8
  936. package/blockly-rc/typings/msg/am.d.ts +0 -8
  937. package/blockly-rc/typings/msg/ar.d.ts +0 -8
  938. package/blockly-rc/typings/msg/ast.d.ts +0 -8
  939. package/blockly-rc/typings/msg/az.d.ts +0 -8
  940. package/blockly-rc/typings/msg/ba.d.ts +0 -8
  941. package/blockly-rc/typings/msg/bcc.d.ts +0 -8
  942. package/blockly-rc/typings/msg/be-tarask.d.ts +0 -8
  943. package/blockly-rc/typings/msg/be.d.ts +0 -8
  944. package/blockly-rc/typings/msg/bg.d.ts +0 -8
  945. package/blockly-rc/typings/msg/bn.d.ts +0 -8
  946. package/blockly-rc/typings/msg/br.d.ts +0 -8
  947. package/blockly-rc/typings/msg/bs.d.ts +0 -8
  948. package/blockly-rc/typings/msg/ca.d.ts +0 -8
  949. package/blockly-rc/typings/msg/cdo.d.ts +0 -8
  950. package/blockly-rc/typings/msg/ce.d.ts +0 -8
  951. package/blockly-rc/typings/msg/cs.d.ts +0 -8
  952. package/blockly-rc/typings/msg/da.d.ts +0 -8
  953. package/blockly-rc/typings/msg/de.d.ts +0 -8
  954. package/blockly-rc/typings/msg/diq.d.ts +0 -8
  955. package/blockly-rc/typings/msg/dtp.d.ts +0 -8
  956. package/blockly-rc/typings/msg/dty.d.ts +0 -8
  957. package/blockly-rc/typings/msg/ee.d.ts +0 -8
  958. package/blockly-rc/typings/msg/el.d.ts +0 -8
  959. package/blockly-rc/typings/msg/en-gb.d.ts +0 -8
  960. package/blockly-rc/typings/msg/en.d.ts +0 -8
  961. package/blockly-rc/typings/msg/eo.d.ts +0 -8
  962. package/blockly-rc/typings/msg/es.d.ts +0 -8
  963. package/blockly-rc/typings/msg/et.d.ts +0 -8
  964. package/blockly-rc/typings/msg/eu.d.ts +0 -8
  965. package/blockly-rc/typings/msg/fa.d.ts +0 -8
  966. package/blockly-rc/typings/msg/fi.d.ts +0 -8
  967. package/blockly-rc/typings/msg/fo.d.ts +0 -8
  968. package/blockly-rc/typings/msg/fr.d.ts +0 -8
  969. package/blockly-rc/typings/msg/frr.d.ts +0 -8
  970. package/blockly-rc/typings/msg/gl.d.ts +0 -8
  971. package/blockly-rc/typings/msg/gn.d.ts +0 -8
  972. package/blockly-rc/typings/msg/gor.d.ts +0 -8
  973. package/blockly-rc/typings/msg/ha.d.ts +0 -8
  974. package/blockly-rc/typings/msg/hak.d.ts +0 -8
  975. package/blockly-rc/typings/msg/he.d.ts +0 -8
  976. package/blockly-rc/typings/msg/hi.d.ts +0 -8
  977. package/blockly-rc/typings/msg/hr.d.ts +0 -8
  978. package/blockly-rc/typings/msg/hrx.d.ts +0 -8
  979. package/blockly-rc/typings/msg/hsb.d.ts +0 -8
  980. package/blockly-rc/typings/msg/hu.d.ts +0 -8
  981. package/blockly-rc/typings/msg/hy.d.ts +0 -8
  982. package/blockly-rc/typings/msg/ia.d.ts +0 -8
  983. package/blockly-rc/typings/msg/id.d.ts +0 -8
  984. package/blockly-rc/typings/msg/ig.d.ts +0 -8
  985. package/blockly-rc/typings/msg/inh.d.ts +0 -8
  986. package/blockly-rc/typings/msg/is.d.ts +0 -8
  987. package/blockly-rc/typings/msg/it.d.ts +0 -8
  988. package/blockly-rc/typings/msg/ja.d.ts +0 -8
  989. package/blockly-rc/typings/msg/ka.d.ts +0 -8
  990. package/blockly-rc/typings/msg/kab.d.ts +0 -8
  991. package/blockly-rc/typings/msg/kbd-cyrl.d.ts +0 -8
  992. package/blockly-rc/typings/msg/km.d.ts +0 -8
  993. package/blockly-rc/typings/msg/kn.d.ts +0 -8
  994. package/blockly-rc/typings/msg/ko.d.ts +0 -8
  995. package/blockly-rc/typings/msg/ksh.d.ts +0 -8
  996. package/blockly-rc/typings/msg/ku-latn.d.ts +0 -8
  997. package/blockly-rc/typings/msg/ky.d.ts +0 -8
  998. package/blockly-rc/typings/msg/la.d.ts +0 -8
  999. package/blockly-rc/typings/msg/lb.d.ts +0 -8
  1000. package/blockly-rc/typings/msg/lki.d.ts +0 -8
  1001. package/blockly-rc/typings/msg/lo.d.ts +0 -8
  1002. package/blockly-rc/typings/msg/lrc.d.ts +0 -8
  1003. package/blockly-rc/typings/msg/lt.d.ts +0 -8
  1004. package/blockly-rc/typings/msg/lv.d.ts +0 -8
  1005. package/blockly-rc/typings/msg/mg.d.ts +0 -8
  1006. package/blockly-rc/typings/msg/mk.d.ts +0 -8
  1007. package/blockly-rc/typings/msg/ml.d.ts +0 -8
  1008. package/blockly-rc/typings/msg/mnw.d.ts +0 -8
  1009. package/blockly-rc/typings/msg/ms.d.ts +0 -8
  1010. package/blockly-rc/typings/msg/msg.d.ts +0 -440
  1011. package/blockly-rc/typings/msg/my.d.ts +0 -8
  1012. package/blockly-rc/typings/msg/mzn.d.ts +0 -8
  1013. package/blockly-rc/typings/msg/nb.d.ts +0 -8
  1014. package/blockly-rc/typings/msg/ne.d.ts +0 -8
  1015. package/blockly-rc/typings/msg/nl.d.ts +0 -8
  1016. package/blockly-rc/typings/msg/oc.d.ts +0 -8
  1017. package/blockly-rc/typings/msg/olo.d.ts +0 -8
  1018. package/blockly-rc/typings/msg/pa.d.ts +0 -8
  1019. package/blockly-rc/typings/msg/pl.d.ts +0 -8
  1020. package/blockly-rc/typings/msg/pms.d.ts +0 -8
  1021. package/blockly-rc/typings/msg/ps.d.ts +0 -8
  1022. package/blockly-rc/typings/msg/pt-br.d.ts +0 -8
  1023. package/blockly-rc/typings/msg/pt.d.ts +0 -8
  1024. package/blockly-rc/typings/msg/ro.d.ts +0 -8
  1025. package/blockly-rc/typings/msg/ru.d.ts +0 -8
  1026. package/blockly-rc/typings/msg/sc.d.ts +0 -8
  1027. package/blockly-rc/typings/msg/sco.d.ts +0 -8
  1028. package/blockly-rc/typings/msg/sd.d.ts +0 -8
  1029. package/blockly-rc/typings/msg/shn.d.ts +0 -8
  1030. package/blockly-rc/typings/msg/si.d.ts +0 -8
  1031. package/blockly-rc/typings/msg/sk.d.ts +0 -8
  1032. package/blockly-rc/typings/msg/skr-arab.d.ts +0 -8
  1033. package/blockly-rc/typings/msg/sl.d.ts +0 -8
  1034. package/blockly-rc/typings/msg/smn.d.ts +0 -8
  1035. package/blockly-rc/typings/msg/sq.d.ts +0 -8
  1036. package/blockly-rc/typings/msg/sr-latn.d.ts +0 -8
  1037. package/blockly-rc/typings/msg/sr.d.ts +0 -8
  1038. package/blockly-rc/typings/msg/sv.d.ts +0 -8
  1039. package/blockly-rc/typings/msg/sw.d.ts +0 -8
  1040. package/blockly-rc/typings/msg/ta.d.ts +0 -8
  1041. package/blockly-rc/typings/msg/tcy.d.ts +0 -8
  1042. package/blockly-rc/typings/msg/tdd.d.ts +0 -8
  1043. package/blockly-rc/typings/msg/te.d.ts +0 -8
  1044. package/blockly-rc/typings/msg/th.d.ts +0 -8
  1045. package/blockly-rc/typings/msg/ti.d.ts +0 -8
  1046. package/blockly-rc/typings/msg/tl.d.ts +0 -8
  1047. package/blockly-rc/typings/msg/tlh.d.ts +0 -8
  1048. package/blockly-rc/typings/msg/tr.d.ts +0 -8
  1049. package/blockly-rc/typings/msg/ug-arab.d.ts +0 -8
  1050. package/blockly-rc/typings/msg/uk.d.ts +0 -8
  1051. package/blockly-rc/typings/msg/ur.d.ts +0 -8
  1052. package/blockly-rc/typings/msg/uz.d.ts +0 -8
  1053. package/blockly-rc/typings/msg/vi.d.ts +0 -8
  1054. package/blockly-rc/typings/msg/xmf.d.ts +0 -8
  1055. package/blockly-rc/typings/msg/yo.d.ts +0 -8
  1056. package/blockly-rc/typings/msg/zgh.d.ts +0 -8
  1057. package/blockly-rc/typings/msg/zh-hans.d.ts +0 -8
  1058. package/blockly-rc/typings/msg/zh-hant.d.ts +0 -8
  1059. package/blockly-rc/typings/php.d.ts +0 -7
  1060. package/blockly-rc/typings/python.d.ts +0 -7
  1061. package/blockly-rc/typings/templates/blockly-header.template +0 -11
  1062. package/blockly-rc/typings/templates/blockly-interfaces.template +0 -83
  1063. package/blockly-rc/typings/templates/msg.template +0 -15
  1064. package/blockly-rc/typings/tsconfig.json +0 -23
  1065. package/temp-use-blockly-v12-rc.sh +0 -26
@@ -1,2523 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2011 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- /**
8
- * The class representing one block.
9
- *
10
- * @class
11
- */
12
- // Former goog.module ID: Blockly.Block
13
-
14
- // Unused import preserved for side-effects. Remove if unneeded.
15
- import './events/events_block_change.js';
16
- // Unused import preserved for side-effects. Remove if unneeded.
17
- import './events/events_block_create.js';
18
- // Unused import preserved for side-effects. Remove if unneeded.
19
- import './events/events_block_delete.js';
20
-
21
- import {Blocks} from './blocks.js';
22
- import * as common from './common.js';
23
- import {Connection} from './connection.js';
24
- import {ConnectionType} from './connection_type.js';
25
- import * as constants from './constants.js';
26
- import {DuplicateIconType} from './icons/exceptions.js';
27
- import type {Abstract} from './events/events_abstract.js';
28
- import type {BlockChange} from './events/events_block_change.js';
29
- import type {BlockMove} from './events/events_block_move.js';
30
- import * as deprecation from './utils/deprecation.js';
31
- import * as eventUtils from './events/utils.js';
32
- import * as Extensions from './extensions.js';
33
- import type {Field} from './field.js';
34
- import * as fieldRegistry from './field_registry.js';
35
- import {Input} from './inputs/input.js';
36
- import {Align} from './inputs/align.js';
37
- import type {IASTNodeLocation} from './interfaces/i_ast_node_location.js';
38
- import {type IIcon} from './interfaces/i_icon.js';
39
- import {isCommentIcon} from './interfaces/i_comment_icon.js';
40
- import type {MutatorIcon} from './icons/mutator_icon.js';
41
- import * as Tooltip from './tooltip.js';
42
- import * as arrayUtils from './utils/array.js';
43
- import {Coordinate} from './utils/coordinate.js';
44
- import * as idGenerator from './utils/idgenerator.js';
45
- import * as parsing from './utils/parsing.js';
46
- import * as registry from './registry.js';
47
- import {Size} from './utils/size.js';
48
- import type {
49
- IVariableModel,
50
- IVariableState,
51
- } from './interfaces/i_variable_model.js';
52
- import type {Workspace} from './workspace.js';
53
- import {DummyInput} from './inputs/dummy_input.js';
54
- import {EndRowInput} from './inputs/end_row_input.js';
55
- import {ValueInput} from './inputs/value_input.js';
56
- import {StatementInput} from './inputs/statement_input.js';
57
- import {IconType} from './icons/icon_types.js';
58
-
59
- /**
60
- * Class for one block.
61
- * Not normally called directly, workspace.newBlock() is preferred.
62
- */
63
- export class Block implements IASTNodeLocation {
64
- /**
65
- * An optional callback method to use whenever the block's parent workspace
66
- * changes. This is usually only called from the constructor, the block type
67
- * initializer function, or an extension initializer function.
68
- */
69
- onchange?: ((p1: Abstract) => void) | null;
70
-
71
- /** The language-neutral ID given to the collapsed input. */
72
- static readonly COLLAPSED_INPUT_NAME: string = constants.COLLAPSED_INPUT_NAME;
73
-
74
- /** The language-neutral ID given to the collapsed field. */
75
- static readonly COLLAPSED_FIELD_NAME: string = constants.COLLAPSED_FIELD_NAME;
76
-
77
- /**
78
- * Optional text data that round-trips between blocks and XML.
79
- * Has no effect. May be used by 3rd parties for meta information.
80
- */
81
- data: string | null = null;
82
-
83
- /**
84
- * Has this block been disposed of?
85
- *
86
- * @internal
87
- */
88
- disposed = false;
89
-
90
- /**
91
- * Colour of the block as HSV hue value (0-360)
92
- * This may be null if the block colour was not set via a hue number.
93
- */
94
- private hue_: number | null = null;
95
-
96
- /** Colour of the block in '#RRGGBB' format. */
97
- protected colour_ = '#000000';
98
-
99
- /** Name of the block style. */
100
- protected styleName_ = '';
101
-
102
- /** An optional method called during initialization. */
103
- init?: () => void;
104
-
105
- /** An optional method called during disposal. */
106
- destroy?: () => void;
107
-
108
- /**
109
- * An optional serialization method for defining how to serialize the
110
- * mutation state to XML. This must be coupled with defining
111
- * `domToMutation`.
112
- */
113
- mutationToDom?: (...p1: AnyDuringMigration[]) => Element;
114
-
115
- /**
116
- * An optional deserialization method for defining how to deserialize the
117
- * mutation state from XML. This must be coupled with defining
118
- * `mutationToDom`.
119
- */
120
- domToMutation?: (p1: Element) => void;
121
-
122
- /**
123
- * An optional serialization method for defining how to serialize the
124
- * block's extra state (eg mutation state) to something JSON compatible.
125
- * This must be coupled with defining `loadExtraState`.
126
- *
127
- * @param doFullSerialization Whether or not to serialize the full state of
128
- * the extra state (rather than possibly saving a reference to some
129
- * state). This is used during copy-paste. See the
130
- * {@link https://developers.devsite.google.com/blockly/guides/create-custom-blocks/extensions#full_serialization_and_backing_data | block serialization docs}
131
- * for more information.
132
- */
133
- saveExtraState?: (doFullSerialization?: boolean) => AnyDuringMigration;
134
-
135
- /**
136
- * An optional serialization method for defining how to deserialize the
137
- * block's extra state (eg mutation state) from something JSON compatible.
138
- * This must be coupled with defining `saveExtraState`.
139
- */
140
- loadExtraState?: (p1: AnyDuringMigration) => void;
141
-
142
- /**
143
- * An optional property for suppressing adding STATEMENT_PREFIX and
144
- * STATEMENT_SUFFIX to generated code.
145
- */
146
- suppressPrefixSuffix: boolean | null = false;
147
-
148
- /**
149
- * An optional property for declaring developer variables. Return a list of
150
- * variable names for use by generators. Developer variables are never
151
- * shown to the user, but are declared as global variables in the generated
152
- * code.
153
- */
154
- getDeveloperVariables?: () => string[];
155
-
156
- /**
157
- * An optional function that reconfigures the block based on the contents of
158
- * the mutator dialog.
159
- */
160
- compose?: (p1: Block) => void;
161
-
162
- /**
163
- * An optional function that populates the mutator's dialog with
164
- * this block's components.
165
- */
166
- decompose?: (p1: Workspace) => Block;
167
- id: string;
168
- outputConnection: Connection | null = null;
169
- nextConnection: Connection | null = null;
170
- previousConnection: Connection | null = null;
171
- inputList: Input[] = [];
172
- inputsInline?: boolean;
173
- icons: IIcon[] = [];
174
- private disabledReasons = new Set<string>();
175
- tooltip: Tooltip.TipInfo = '';
176
- contextMenu = true;
177
-
178
- protected parentBlock_: this | null = null;
179
-
180
- protected childBlocks_: this[] = [];
181
-
182
- private deletable_ = true;
183
-
184
- private movable_ = true;
185
-
186
- private editable_ = true;
187
-
188
- private isShadow_ = false;
189
-
190
- protected collapsed_ = false;
191
- protected outputShape_: number | null = null;
192
-
193
- /**
194
- * Is the current block currently in the process of being disposed?
195
- */
196
- protected disposing = false;
197
-
198
- /**
199
- * Has this block been fully initialized? E.g. all fields initailized.
200
- *
201
- * @internal
202
- */
203
- initialized = false;
204
-
205
- private readonly xy_: Coordinate;
206
- isInFlyout: boolean;
207
- isInMutator: boolean;
208
- RTL: boolean;
209
-
210
- /** True if this block is an insertion marker. */
211
- protected isInsertionMarker_ = false;
212
-
213
- /** Name of the type of hat. */
214
- hat?: string;
215
-
216
- /** Is this block a BlockSVG? */
217
- readonly rendered: boolean = false;
218
-
219
- /**
220
- * String for block help, or function that returns a URL. Null for no help.
221
- */
222
- helpUrl: string | Function | null = null;
223
-
224
- /** A bound callback function to use when the parent workspace changes. */
225
- private onchangeWrapper_: ((p1: Abstract) => void) | null = null;
226
-
227
- /**
228
- * A count of statement inputs on the block.
229
- *
230
- * @internal
231
- */
232
- statementInputCount = 0;
233
- // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
234
- type!: string;
235
- // Record initial inline state.
236
- inputsInlineDefault?: boolean;
237
- workspace: Workspace;
238
-
239
- /**
240
- * @param workspace The block's workspace.
241
- * @param prototypeName Name of the language object containing type-specific
242
- * functions for this block.
243
- * @param opt_id Optional ID. Use this ID if provided, otherwise create a new
244
- * ID.
245
- * @throws When the prototypeName is not valid or not allowed.
246
- */
247
- constructor(workspace: Workspace, prototypeName: string, opt_id?: string) {
248
- this.workspace = workspace;
249
-
250
- this.id =
251
- opt_id && !workspace.getBlockById(opt_id) ? opt_id : idGenerator.genUid();
252
- workspace.setBlockById(this.id, this);
253
-
254
- /**
255
- * The block's position in workspace units. (0, 0) is at the workspace's
256
- * origin; scale does not change this value.
257
- */
258
- this.xy_ = new Coordinate(0, 0);
259
- this.isInFlyout = workspace.isFlyout;
260
- this.isInMutator = workspace.isMutator;
261
-
262
- this.RTL = workspace.RTL;
263
-
264
- // Copy the type-specific functions and data from the prototype.
265
- if (prototypeName) {
266
- this.type = prototypeName;
267
- const prototype = Blocks[prototypeName];
268
- if (!prototype || typeof prototype !== 'object') {
269
- throw TypeError('Invalid block definition for type: ' + prototypeName);
270
- }
271
- Object.assign(this, prototype);
272
- }
273
-
274
- workspace.addTopBlock(this);
275
- workspace.addTypedBlock(this);
276
-
277
- if (new.target === Block) {
278
- this.doInit_();
279
- }
280
- }
281
-
282
- /** Calls the init() function and handles associated event firing, etc. */
283
- protected doInit_() {
284
- // All events fired should be part of the same group.
285
- // Any events fired during init should not be undoable,
286
- // so that block creation is atomic.
287
- const existingGroup = eventUtils.getGroup();
288
- if (!existingGroup) {
289
- eventUtils.setGroup(true);
290
- }
291
- const initialUndoFlag = eventUtils.getRecordUndo();
292
-
293
- try {
294
- // Call an initialization function, if it exists.
295
- if (typeof this.init === 'function') {
296
- eventUtils.setRecordUndo(false);
297
- this.init();
298
- eventUtils.setRecordUndo(initialUndoFlag);
299
- }
300
-
301
- // Fire a create event.
302
- if (eventUtils.isEnabled()) {
303
- eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CREATE))(this));
304
- }
305
- } finally {
306
- eventUtils.setGroup(existingGroup);
307
- // In case init threw, recordUndo flag should still be reset.
308
- eventUtils.setRecordUndo(initialUndoFlag);
309
- }
310
- this.inputsInlineDefault = this.inputsInline;
311
-
312
- // Bind an onchange function, if it exists.
313
- if (typeof this.onchange === 'function') {
314
- this.setOnChange(this.onchange);
315
- }
316
- }
317
-
318
- /**
319
- * Dispose of this block.
320
- *
321
- * @param healStack If true, then try to heal any gap by connecting the next
322
- * statement with the previous statement. Otherwise, dispose of all
323
- * children of this block.
324
- */
325
- dispose(healStack = false) {
326
- this.disposing = true;
327
-
328
- // Dispose of this change listener before unplugging.
329
- // Technically not necessary due to the event firing delay.
330
- // But future-proofing.
331
- if (this.onchangeWrapper_) {
332
- this.workspace.removeChangeListener(this.onchangeWrapper_);
333
- }
334
-
335
- this.unplug(healStack);
336
- if (eventUtils.isEnabled()) {
337
- // Constructing the delete event is costly. Only perform if necessary.
338
- eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_DELETE))(this));
339
- }
340
- this.workspace.removeTopBlock(this);
341
- this.disposeInternal();
342
- }
343
-
344
- /**
345
- * Disposes of this block without doing things required by the top block.
346
- * E.g. does not fire events, unplug the block, etc.
347
- */
348
- protected disposeInternal() {
349
- this.disposing = true;
350
- if (this.onchangeWrapper_) {
351
- this.workspace.removeChangeListener(this.onchangeWrapper_);
352
- }
353
-
354
- this.workspace.removeTypedBlock(this);
355
- this.workspace.removeBlockById(this.id);
356
-
357
- if (typeof this.destroy === 'function') this.destroy();
358
-
359
- this.childBlocks_.forEach((c) => c.disposeInternal());
360
- this.inputList.forEach((i) => i.dispose());
361
- this.inputList.length = 0;
362
- this.getConnections_(true).forEach((c) => c.dispose());
363
- this.disposed = true;
364
- }
365
-
366
- /**
367
- * Returns true if the block is either in the process of being disposed, or
368
- * is disposed.
369
- *
370
- * @internal
371
- */
372
- isDeadOrDying(): boolean {
373
- return this.disposing || this.disposed;
374
- }
375
-
376
- /**
377
- * Call initModel on all fields on the block.
378
- * May be called more than once.
379
- * Either initModel or initSvg must be called after creating a block and
380
- * before the first interaction with it. Interactions include UI actions
381
- * (e.g. clicking and dragging) and firing events (e.g. create, delete, and
382
- * change).
383
- */
384
- initModel() {
385
- if (this.initialized) return;
386
- for (const input of this.inputList) {
387
- input.initModel();
388
- }
389
- this.initialized = true;
390
- }
391
-
392
- /**
393
- * Unplug this block from its superior block. If this block is a statement,
394
- * optionally reconnect the block underneath with the block on top.
395
- *
396
- * @param opt_healStack Disconnect child statement and reconnect stack.
397
- * Defaults to false.
398
- */
399
- unplug(opt_healStack?: boolean) {
400
- if (this.outputConnection) {
401
- this.unplugFromRow_(opt_healStack);
402
- }
403
- if (this.previousConnection) {
404
- this.unplugFromStack_(opt_healStack);
405
- }
406
- }
407
-
408
- /**
409
- * Unplug this block's output from an input on another block. Optionally
410
- * reconnect the block's parent to the only child block, if possible.
411
- *
412
- * @param opt_healStack Disconnect right-side block and connect to left-side
413
- * block. Defaults to false.
414
- */
415
- private unplugFromRow_(opt_healStack?: boolean) {
416
- let parentConnection = null;
417
- if (this.outputConnection?.isConnected()) {
418
- parentConnection = this.outputConnection.targetConnection;
419
- // Disconnect from any superior block.
420
- this.outputConnection.disconnect();
421
- }
422
-
423
- // Return early in obvious cases.
424
- if (!parentConnection || !opt_healStack) {
425
- return;
426
- }
427
-
428
- const thisConnection = this.getOnlyValueConnection_();
429
- if (
430
- !thisConnection ||
431
- !thisConnection.isConnected() ||
432
- thisConnection.targetBlock()!.isShadow()
433
- ) {
434
- // Too many or too few possible connections on this block, or there's
435
- // nothing on the other side of this connection.
436
- return;
437
- }
438
-
439
- const childConnection = thisConnection.targetConnection;
440
- // Disconnect the child block.
441
- childConnection?.disconnect();
442
- // Connect child to the parent if possible, otherwise bump away.
443
- if (
444
- this.workspace.connectionChecker.canConnect(
445
- childConnection,
446
- parentConnection,
447
- false,
448
- )
449
- ) {
450
- parentConnection.connect(childConnection!);
451
- } else {
452
- childConnection?.onFailedConnect(parentConnection);
453
- }
454
- }
455
-
456
- /**
457
- * Returns the connection on the value input that is connected to another
458
- * block. When an insertion marker is connected to a connection with a block
459
- * already attached, the connected block is attached to the insertion marker.
460
- * Since only one block can be displaced and attached to the insertion marker
461
- * this should only ever return one connection.
462
- *
463
- * @returns The connection on the value input, or null.
464
- */
465
- private getOnlyValueConnection_(): Connection | null {
466
- let connection = null;
467
- for (let i = 0; i < this.inputList.length; i++) {
468
- const thisConnection = this.inputList[i].connection;
469
- if (
470
- thisConnection &&
471
- thisConnection.type === ConnectionType.INPUT_VALUE &&
472
- thisConnection.targetConnection
473
- ) {
474
- if (connection) {
475
- return null; // More than one value input found.
476
- }
477
- connection = thisConnection;
478
- }
479
- }
480
- return connection;
481
- }
482
-
483
- /**
484
- * Unplug this statement block from its superior block. Optionally reconnect
485
- * the block underneath with the block on top.
486
- *
487
- * @param opt_healStack Disconnect child statement and reconnect stack.
488
- * Defaults to false.
489
- */
490
- private unplugFromStack_(opt_healStack?: boolean) {
491
- let previousTarget = null;
492
- if (this.previousConnection?.isConnected()) {
493
- // Remember the connection that any next statements need to connect to.
494
- previousTarget = this.previousConnection.targetConnection;
495
- // Detach this block from the parent's tree.
496
- this.previousConnection.disconnect();
497
- }
498
- const nextBlock = this.getNextBlock();
499
- if (opt_healStack && nextBlock && !nextBlock.isShadow()) {
500
- // Disconnect the next statement.
501
- const nextTarget = this.nextConnection?.targetConnection ?? null;
502
- nextTarget?.disconnect();
503
- if (
504
- previousTarget &&
505
- this.workspace.connectionChecker.canConnect(
506
- previousTarget,
507
- nextTarget,
508
- false,
509
- )
510
- ) {
511
- // Attach the next statement to the previous statement.
512
- previousTarget.connect(nextTarget!);
513
- }
514
- }
515
- }
516
-
517
- /**
518
- * Returns all connections originating from this block.
519
- *
520
- * @param _all If true, return all connections even hidden ones.
521
- * @returns Array of connections.
522
- * @internal
523
- */
524
- getConnections_(_all: boolean): Connection[] {
525
- const myConnections = [];
526
- if (this.outputConnection) {
527
- myConnections.push(this.outputConnection);
528
- }
529
- if (this.previousConnection) {
530
- myConnections.push(this.previousConnection);
531
- }
532
- if (this.nextConnection) {
533
- myConnections.push(this.nextConnection);
534
- }
535
- for (let i = 0, input; (input = this.inputList[i]); i++) {
536
- if (input.connection) {
537
- myConnections.push(input.connection);
538
- }
539
- }
540
- return myConnections;
541
- }
542
-
543
- /**
544
- * Walks down a stack of blocks and finds the last next connection on the
545
- * stack.
546
- *
547
- * @param ignoreShadows If true,the last connection on a non-shadow block will
548
- * be returned. If false, this will follow shadows to find the last
549
- * connection.
550
- * @returns The last next connection on the stack, or null.
551
- * @internal
552
- */
553
- lastConnectionInStack(ignoreShadows: boolean): Connection | null {
554
- let nextConnection = this.nextConnection;
555
- while (nextConnection) {
556
- const nextBlock = nextConnection.targetBlock();
557
- if (!nextBlock || (ignoreShadows && nextBlock.isShadow())) {
558
- return nextConnection;
559
- }
560
- nextConnection = nextBlock.nextConnection;
561
- }
562
- return null;
563
- }
564
-
565
- /**
566
- * Bump unconnected blocks out of alignment. Two blocks which aren't actually
567
- * connected should not coincidentally line up on screen.
568
- */
569
- bumpNeighbours() {}
570
-
571
- /**
572
- * Return the parent block or null if this block is at the top level. The
573
- * parent block is either the block connected to the previous connection (for
574
- * a statement block) or the block connected to the output connection (for a
575
- * value block).
576
- *
577
- * @returns The block (if any) that holds the current block.
578
- */
579
- getParent(): this | null {
580
- return this.parentBlock_;
581
- }
582
-
583
- /**
584
- * Return the input that connects to the specified block.
585
- *
586
- * @param block A block connected to an input on this block.
587
- * @returns The input (if any) that connects to the specified block.
588
- */
589
- getInputWithBlock(block: Block): Input | null {
590
- for (let i = 0, input; (input = this.inputList[i]); i++) {
591
- if (input.connection && input.connection.targetBlock() === block) {
592
- return input;
593
- }
594
- }
595
- return null;
596
- }
597
-
598
- /**
599
- * Return the parent block that surrounds the current block, or null if this
600
- * block has no surrounding block. A parent block might just be the previous
601
- * statement, whereas the surrounding block is an if statement, while loop,
602
- * etc.
603
- *
604
- * @returns The block (if any) that surrounds the current block.
605
- */
606
- getSurroundParent(): this | null {
607
- /* eslint-disable-next-line @typescript-eslint/no-this-alias */
608
- let block: this | null = this;
609
- let prevBlock;
610
- do {
611
- prevBlock = block;
612
- block = block.getParent();
613
- if (!block) {
614
- // Ran off the top.
615
- return null;
616
- }
617
- } while (block.getNextBlock() === prevBlock);
618
- // This block is an enclosing parent, not just a statement in a stack.
619
- return block;
620
- }
621
-
622
- /**
623
- * Return the next statement block directly connected to this block.
624
- *
625
- * @returns The next statement block or null.
626
- */
627
- getNextBlock(): Block | null {
628
- return this.nextConnection && this.nextConnection.targetBlock();
629
- }
630
-
631
- /**
632
- * Returns the block connected to the previous connection.
633
- *
634
- * @returns The previous statement block or null.
635
- */
636
- getPreviousBlock(): Block | null {
637
- return this.previousConnection && this.previousConnection.targetBlock();
638
- }
639
-
640
- /**
641
- * Return the top-most block in this block's tree.
642
- * This will return itself if this block is at the top level.
643
- *
644
- * @returns The root block.
645
- */
646
- getRootBlock(): this {
647
- let rootBlock: this;
648
- /* eslint-disable-next-line @typescript-eslint/no-this-alias */
649
- let block: this | null = this;
650
- do {
651
- rootBlock = block;
652
- block = rootBlock.parentBlock_;
653
- } while (block);
654
- return rootBlock;
655
- }
656
-
657
- /**
658
- * Walk up from the given block up through the stack of blocks to find
659
- * the top block of the sub stack. If we are nested in a statement input only
660
- * find the top-most nested block. Do not go all the way to the root block.
661
- *
662
- * @returns The top block in a stack.
663
- * @internal
664
- */
665
- getTopStackBlock(): this {
666
- /* eslint-disable-next-line @typescript-eslint/no-this-alias */
667
- let block = this;
668
- let previous;
669
- do {
670
- previous = block.getPreviousBlock();
671
- // AnyDuringMigration because: Type 'Block' is not assignable to type
672
- // 'this'.
673
- } while (
674
- previous &&
675
- previous.getNextBlock() === block &&
676
- (block = previous as AnyDuringMigration)
677
- );
678
- return block;
679
- }
680
-
681
- /**
682
- * Find all the blocks that are directly nested inside this one.
683
- * Includes value and statement inputs, as well as any following statement.
684
- * Excludes any connection on an output tab or any preceding statement.
685
- * Blocks are optionally sorted by position; top to bottom.
686
- *
687
- * @param ordered Sort the list if true.
688
- * @returns Array of blocks.
689
- */
690
- getChildren(ordered: boolean): Block[] {
691
- if (!ordered) {
692
- return this.childBlocks_;
693
- }
694
- const blocks = [];
695
- for (let i = 0, input; (input = this.inputList[i]); i++) {
696
- if (input.connection) {
697
- const child = input.connection.targetBlock();
698
- if (child) {
699
- blocks.push(child);
700
- }
701
- }
702
- }
703
- const next = this.getNextBlock();
704
- if (next) {
705
- blocks.push(next);
706
- }
707
- return blocks;
708
- }
709
-
710
- /**
711
- * Set parent of this block to be a new block or null.
712
- *
713
- * @param newParent New parent block.
714
- * @internal
715
- */
716
- setParent(newParent: this | null) {
717
- if (newParent === this.parentBlock_) {
718
- return;
719
- }
720
-
721
- // Check that block is connected to new parent if new parent is not null and
722
- // that block is not connected to superior one if new parent is null.
723
- const targetBlock =
724
- (this.previousConnection && this.previousConnection.targetBlock()) ||
725
- (this.outputConnection && this.outputConnection.targetBlock());
726
- const isConnected = !!targetBlock;
727
-
728
- if (isConnected && newParent && targetBlock !== newParent) {
729
- throw Error('Block connected to superior one that is not new parent.');
730
- } else if (!isConnected && newParent) {
731
- throw Error('Block not connected to new parent.');
732
- } else if (isConnected && !newParent) {
733
- throw Error(
734
- 'Cannot set parent to null while block is still connected to' +
735
- ' superior block.',
736
- );
737
- }
738
-
739
- // This block hasn't actually moved on-screen, so there's no need to
740
- // update
741
- // its connection locations.
742
- if (this.parentBlock_) {
743
- // Remove this block from the old parent's child list.
744
- arrayUtils.removeElem(this.parentBlock_.childBlocks_, this);
745
- } else {
746
- // New parent must be non-null so remove this block from the workspace's
747
- // list of top-most blocks.
748
- this.workspace.removeTopBlock(this);
749
- }
750
-
751
- this.parentBlock_ = newParent;
752
- if (newParent) {
753
- // Add this block to the new parent's child list.
754
- newParent.childBlocks_.push(this);
755
- } else {
756
- this.workspace.addTopBlock(this);
757
- }
758
- }
759
-
760
- /**
761
- * Find all the blocks that are directly or indirectly nested inside this one.
762
- * Includes this block in the list.
763
- * Includes value and statement inputs, as well as any following statements.
764
- * Excludes any connection on an output tab or any preceding statements.
765
- * Blocks are optionally sorted by position; top to bottom.
766
- *
767
- * @param ordered Sort the list if true.
768
- * @returns Flattened array of blocks.
769
- */
770
- getDescendants(ordered: boolean): this[] {
771
- const blocks = [this];
772
- const childBlocks = this.getChildren(ordered);
773
- for (let child, i = 0; (child = childBlocks[i]); i++) {
774
- // AnyDuringMigration because: Argument of type 'Block[]' is not
775
- // assignable to parameter of type 'this[]'.
776
- blocks.push(...(child.getDescendants(ordered) as AnyDuringMigration));
777
- }
778
- return blocks;
779
- }
780
-
781
- /**
782
- * Get whether this block is deletable or not.
783
- *
784
- * @returns True if deletable.
785
- */
786
- isDeletable(): boolean {
787
- return (
788
- this.deletable_ &&
789
- !this.isShadow_ &&
790
- !this.isDeadOrDying() &&
791
- !this.workspace.options.readOnly
792
- );
793
- }
794
-
795
- /**
796
- * Return whether this block's own deletable property is true or false.
797
- *
798
- * @returns True if the block's deletable property is true, false otherwise.
799
- */
800
- isOwnDeletable(): boolean {
801
- return this.deletable_;
802
- }
803
-
804
- /**
805
- * Set whether this block is deletable or not.
806
- *
807
- * @param deletable True if deletable.
808
- */
809
- setDeletable(deletable: boolean) {
810
- this.deletable_ = deletable;
811
- }
812
-
813
- /**
814
- * Get whether this block is movable or not.
815
- *
816
- * @returns True if movable.
817
- * @internal
818
- */
819
- isMovable(): boolean {
820
- return (
821
- this.movable_ &&
822
- !this.isShadow_ &&
823
- !this.isDeadOrDying() &&
824
- !this.workspace.options.readOnly
825
- );
826
- }
827
-
828
- /**
829
- * Return whether this block's own movable property is true or false.
830
- *
831
- * @returns True if the block's movable property is true, false otherwise.
832
- * @internal
833
- */
834
- isOwnMovable(): boolean {
835
- return this.movable_;
836
- }
837
-
838
- /**
839
- * Set whether this block is movable or not.
840
- *
841
- * @param movable True if movable.
842
- */
843
- setMovable(movable: boolean) {
844
- this.movable_ = movable;
845
- }
846
-
847
- /**
848
- * Get whether is block is duplicatable or not. If duplicating this block and
849
- * descendants will put this block over the workspace's capacity this block is
850
- * not duplicatable. If duplicating this block and descendants will put any
851
- * type over their maxInstances this block is not duplicatable.
852
- *
853
- * @returns True if duplicatable.
854
- */
855
- isDuplicatable(): boolean {
856
- if (!this.workspace.hasBlockLimits()) {
857
- return true;
858
- }
859
- return this.workspace.isCapacityAvailable(
860
- common.getBlockTypeCounts(this, true),
861
- );
862
- }
863
-
864
- /**
865
- * Get whether this block is a shadow block or not.
866
- *
867
- * @returns True if a shadow.
868
- */
869
- isShadow(): boolean {
870
- return this.isShadow_;
871
- }
872
-
873
- /**
874
- * Set whether this block is a shadow block or not.
875
- * This method is internal and should not be called by users of Blockly. To
876
- * create shadow blocks programmatically call connection.setShadowState
877
- *
878
- * @param shadow True if a shadow.
879
- * @internal
880
- */
881
- setShadow(shadow: boolean) {
882
- this.isShadow_ = shadow;
883
- }
884
-
885
- /**
886
- * Get whether this block is an insertion marker block or not.
887
- *
888
- * @returns True if an insertion marker.
889
- */
890
- isInsertionMarker(): boolean {
891
- return this.isInsertionMarker_;
892
- }
893
-
894
- /**
895
- * Set whether this block is an insertion marker block or not.
896
- * Once set this cannot be unset.
897
- *
898
- * @param insertionMarker True if an insertion marker.
899
- * @internal
900
- */
901
- setInsertionMarker(insertionMarker: boolean) {
902
- this.isInsertionMarker_ = insertionMarker;
903
- }
904
-
905
- /**
906
- * Get whether this block is editable or not.
907
- *
908
- * @returns True if editable.
909
- * @internal
910
- */
911
- isEditable(): boolean {
912
- return (
913
- this.editable_ &&
914
- !this.isDeadOrDying() &&
915
- !this.workspace.options.readOnly
916
- );
917
- }
918
-
919
- /**
920
- * Return whether this block's own editable property is true or false.
921
- *
922
- * @returns True if the block's editable property is true, false otherwise.
923
- */
924
- isOwnEditable(): boolean {
925
- return this.editable_;
926
- }
927
-
928
- /**
929
- * Set whether this block is editable or not.
930
- *
931
- * @param editable True if editable.
932
- */
933
- setEditable(editable: boolean) {
934
- this.editable_ = editable;
935
- for (let i = 0, input; (input = this.inputList[i]); i++) {
936
- for (let j = 0, field; (field = input.fieldRow[j]); j++) {
937
- field.updateEditable();
938
- }
939
- }
940
- }
941
-
942
- /**
943
- * Returns if this block has been disposed of / deleted.
944
- *
945
- * @returns True if this block has been disposed of / deleted.
946
- */
947
- isDisposed(): boolean {
948
- return this.disposed;
949
- }
950
-
951
- /**
952
- * @returns True if this block is a value block with a single editable field.
953
- * @internal
954
- */
955
- isSimpleReporter(): boolean {
956
- if (!this.outputConnection) return false;
957
-
958
- for (const input of this.inputList) {
959
- if (input.connection || input.fieldRow.length > 1) return false;
960
- }
961
- return true;
962
- }
963
-
964
- /**
965
- * Find the connection on this block that corresponds to the given connection
966
- * on the other block.
967
- * Used to match connections between a block and its insertion marker.
968
- *
969
- * @param otherBlock The other block to match against.
970
- * @param conn The other connection to match.
971
- * @returns The matching connection on this block, or null.
972
- * @internal
973
- */
974
- getMatchingConnection(
975
- otherBlock: Block,
976
- conn: Connection,
977
- ): Connection | null {
978
- const connections = this.getConnections_(true);
979
- const otherConnections = otherBlock.getConnections_(true);
980
- if (connections.length !== otherConnections.length) {
981
- throw Error('Connection lists did not match in length.');
982
- }
983
- for (let i = 0; i < otherConnections.length; i++) {
984
- if (otherConnections[i] === conn) {
985
- return connections[i];
986
- }
987
- }
988
- return null;
989
- }
990
-
991
- /**
992
- * Set the URL of this block's help page.
993
- *
994
- * @param url URL string for block help, or function that returns a URL. Null
995
- * for no help.
996
- */
997
- setHelpUrl(url: string | Function) {
998
- this.helpUrl = url;
999
- }
1000
-
1001
- /**
1002
- * Sets the tooltip for this block.
1003
- *
1004
- * @param newTip The text for the tooltip, a function that returns the text
1005
- * for the tooltip, or a parent object whose tooltip will be used. To not
1006
- * display a tooltip pass the empty string.
1007
- */
1008
- setTooltip(newTip: Tooltip.TipInfo) {
1009
- this.tooltip = newTip;
1010
- }
1011
-
1012
- /**
1013
- * Returns the tooltip text for this block.
1014
- *
1015
- * @returns The tooltip text for this block.
1016
- */
1017
- getTooltip(): string {
1018
- return Tooltip.getTooltipOfObject(this);
1019
- }
1020
-
1021
- /**
1022
- * Get the colour of a block.
1023
- *
1024
- * @returns #RRGGBB string.
1025
- */
1026
- getColour(): string {
1027
- return this.colour_;
1028
- }
1029
-
1030
- /**
1031
- * Get the name of the block style.
1032
- *
1033
- * @returns Name of the block style.
1034
- */
1035
- getStyleName(): string {
1036
- return this.styleName_;
1037
- }
1038
-
1039
- /**
1040
- * Get the HSV hue value of a block. Null if hue not set.
1041
- *
1042
- * @returns Hue value (0-360).
1043
- */
1044
- getHue(): number | null {
1045
- return this.hue_;
1046
- }
1047
-
1048
- /**
1049
- * Change the colour of a block.
1050
- *
1051
- * @param colour HSV hue value (0 to 360), #RRGGBB string, or a message
1052
- * reference string pointing to one of those two values.
1053
- */
1054
- setColour(colour: number | string) {
1055
- const parsed = parsing.parseBlockColour(colour);
1056
- this.hue_ = parsed.hue;
1057
- this.colour_ = parsed.hex;
1058
- }
1059
-
1060
- /**
1061
- * Set the style and colour values of a block.
1062
- *
1063
- * @param blockStyleName Name of the block style.
1064
- */
1065
- setStyle(blockStyleName: string) {
1066
- this.styleName_ = blockStyleName;
1067
- }
1068
-
1069
- /**
1070
- * Sets a callback function to use whenever the block's parent workspace
1071
- * changes, replacing any prior onchange handler. This is usually only called
1072
- * from the constructor, the block type initializer function, or an extension
1073
- * initializer function.
1074
- *
1075
- * @param onchangeFn The callback to call when the block's workspace changes.
1076
- * @throws {Error} if onchangeFn is not falsey and not a function.
1077
- */
1078
- setOnChange(onchangeFn: (p1: Abstract) => void) {
1079
- if (onchangeFn && typeof onchangeFn !== 'function') {
1080
- throw Error('onchange must be a function.');
1081
- }
1082
- if (this.onchangeWrapper_) {
1083
- this.workspace.removeChangeListener(this.onchangeWrapper_);
1084
- }
1085
- this.onchange = onchangeFn;
1086
- this.onchangeWrapper_ = onchangeFn.bind(this);
1087
- this.workspace.addChangeListener(this.onchangeWrapper_);
1088
- }
1089
-
1090
- /**
1091
- * Returns the named field from a block.
1092
- *
1093
- * @param name The name of the field.
1094
- * @returns Named field, or null if field does not exist.
1095
- */
1096
- getField(name: string): Field | null {
1097
- if (typeof name !== 'string') {
1098
- throw TypeError(
1099
- 'Block.prototype.getField expects a string ' +
1100
- 'with the field name but received ' +
1101
- (name === undefined ? 'nothing' : name + ' of type ' + typeof name) +
1102
- ' instead',
1103
- );
1104
- }
1105
- for (let i = 0, input; (input = this.inputList[i]); i++) {
1106
- for (let j = 0, field; (field = input.fieldRow[j]); j++) {
1107
- if (field.name === name) {
1108
- return field;
1109
- }
1110
- }
1111
- }
1112
- return null;
1113
- }
1114
-
1115
- /**
1116
- * Return all variables referenced by this block.
1117
- *
1118
- * @returns List of variable ids.
1119
- */
1120
- getVars(): string[] {
1121
- const vars: string[] = [];
1122
- for (let i = 0, input; (input = this.inputList[i]); i++) {
1123
- for (let j = 0, field; (field = input.fieldRow[j]); j++) {
1124
- if (field.referencesVariables()) {
1125
- // NOTE: This only applies to `FieldVariable`, a `Field<string>`
1126
- vars.push(field.getValue() as string);
1127
- }
1128
- }
1129
- }
1130
- return vars;
1131
- }
1132
-
1133
- /**
1134
- * Return all variables referenced by this block.
1135
- *
1136
- * @returns List of variable models.
1137
- * @internal
1138
- */
1139
- getVarModels(): IVariableModel<IVariableState>[] {
1140
- const vars = [];
1141
- for (let i = 0, input; (input = this.inputList[i]); i++) {
1142
- for (let j = 0, field; (field = input.fieldRow[j]); j++) {
1143
- if (field.referencesVariables()) {
1144
- const model = this.workspace.getVariableById(
1145
- field.getValue() as string,
1146
- );
1147
- // Check if the variable actually exists (and isn't just a potential
1148
- // variable).
1149
- if (model) {
1150
- vars.push(model);
1151
- }
1152
- }
1153
- }
1154
- }
1155
- return vars;
1156
- }
1157
-
1158
- /**
1159
- * Notification that a variable is renaming but keeping the same ID. If the
1160
- * variable is in use on this block, rerender to show the new name.
1161
- *
1162
- * @param variable The variable being renamed.
1163
- * @internal
1164
- */
1165
- updateVarName(variable: IVariableModel<IVariableState>) {
1166
- for (let i = 0, input; (input = this.inputList[i]); i++) {
1167
- for (let j = 0, field; (field = input.fieldRow[j]); j++) {
1168
- if (
1169
- field.referencesVariables() &&
1170
- variable.getId() === field.getValue()
1171
- ) {
1172
- field.refreshVariableName();
1173
- }
1174
- }
1175
- }
1176
- }
1177
-
1178
- /**
1179
- * Notification that a variable is renaming.
1180
- * If the ID matches one of this block's variables, rename it.
1181
- *
1182
- * @param oldId ID of variable to rename.
1183
- * @param newId ID of new variable. May be the same as oldId, but with an
1184
- * updated name.
1185
- */
1186
- renameVarById(oldId: string, newId: string) {
1187
- for (let i = 0, input; (input = this.inputList[i]); i++) {
1188
- for (let j = 0, field; (field = input.fieldRow[j]); j++) {
1189
- if (field.referencesVariables() && oldId === field.getValue()) {
1190
- field.setValue(newId);
1191
- }
1192
- }
1193
- }
1194
- }
1195
-
1196
- /**
1197
- * Returns the language-neutral value of the given field.
1198
- *
1199
- * @param name The name of the field.
1200
- * @returns Value of the field or null if field does not exist.
1201
- */
1202
- getFieldValue(name: string): AnyDuringMigration {
1203
- const field = this.getField(name);
1204
- if (field) {
1205
- return field.getValue();
1206
- }
1207
- return null;
1208
- }
1209
-
1210
- /**
1211
- * Sets the value of the given field for this block.
1212
- *
1213
- * @param newValue The value to set.
1214
- * @param name The name of the field to set the value of.
1215
- */
1216
- setFieldValue(newValue: AnyDuringMigration, name: string) {
1217
- const field = this.getField(name);
1218
- if (!field) {
1219
- throw Error('Field "' + name + '" not found.');
1220
- }
1221
- field.setValue(newValue);
1222
- }
1223
-
1224
- /**
1225
- * Set whether this block can chain onto the bottom of another block.
1226
- *
1227
- * @param newBoolean True if there can be a previous statement.
1228
- * @param opt_check Statement type or list of statement types. Null/undefined
1229
- * if any type could be connected.
1230
- */
1231
- setPreviousStatement(
1232
- newBoolean: boolean,
1233
- opt_check?: string | string[] | null,
1234
- ) {
1235
- if (newBoolean) {
1236
- if (opt_check === undefined) {
1237
- opt_check = null;
1238
- }
1239
- if (!this.previousConnection) {
1240
- this.previousConnection = this.makeConnection_(
1241
- ConnectionType.PREVIOUS_STATEMENT,
1242
- );
1243
- }
1244
- this.previousConnection.setCheck(opt_check);
1245
- } else {
1246
- if (this.previousConnection) {
1247
- if (this.previousConnection.isConnected()) {
1248
- throw Error(
1249
- 'Must disconnect previous statement before removing ' +
1250
- 'connection.',
1251
- );
1252
- }
1253
- this.previousConnection.dispose();
1254
- this.previousConnection = null;
1255
- }
1256
- }
1257
- }
1258
-
1259
- /**
1260
- * Set whether another block can chain onto the bottom of this block.
1261
- *
1262
- * @param newBoolean True if there can be a next statement.
1263
- * @param opt_check Statement type or list of statement types. Null/undefined
1264
- * if any type could be connected.
1265
- */
1266
- setNextStatement(newBoolean: boolean, opt_check?: string | string[] | null) {
1267
- if (newBoolean) {
1268
- if (opt_check === undefined) {
1269
- opt_check = null;
1270
- }
1271
- if (!this.nextConnection) {
1272
- this.nextConnection = this.makeConnection_(
1273
- ConnectionType.NEXT_STATEMENT,
1274
- );
1275
- }
1276
- this.nextConnection.setCheck(opt_check);
1277
- } else {
1278
- if (this.nextConnection) {
1279
- if (this.nextConnection.isConnected()) {
1280
- throw Error(
1281
- 'Must disconnect next statement before removing ' + 'connection.',
1282
- );
1283
- }
1284
- this.nextConnection.dispose();
1285
- this.nextConnection = null;
1286
- }
1287
- }
1288
- }
1289
-
1290
- /**
1291
- * Set whether this block returns a value.
1292
- *
1293
- * @param newBoolean True if there is an output.
1294
- * @param opt_check Returned type or list of returned types. Null or
1295
- * undefined if any type could be returned (e.g. variable get).
1296
- */
1297
- setOutput(newBoolean: boolean, opt_check?: string | string[] | null) {
1298
- if (newBoolean) {
1299
- if (opt_check === undefined) {
1300
- opt_check = null;
1301
- }
1302
- if (!this.outputConnection) {
1303
- this.outputConnection = this.makeConnection_(
1304
- ConnectionType.OUTPUT_VALUE,
1305
- );
1306
- }
1307
- this.outputConnection.setCheck(opt_check);
1308
- } else {
1309
- if (this.outputConnection) {
1310
- if (this.outputConnection.isConnected()) {
1311
- throw Error(
1312
- 'Must disconnect output value before removing connection.',
1313
- );
1314
- }
1315
- this.outputConnection.dispose();
1316
- this.outputConnection = null;
1317
- }
1318
- }
1319
- }
1320
-
1321
- /**
1322
- * Set whether value inputs are arranged horizontally or vertically.
1323
- *
1324
- * @param newBoolean True if inputs are horizontal.
1325
- */
1326
- setInputsInline(newBoolean: boolean) {
1327
- if (this.inputsInline !== newBoolean) {
1328
- eventUtils.fire(
1329
- new (eventUtils.get(eventUtils.BLOCK_CHANGE))(
1330
- this,
1331
- 'inline',
1332
- null,
1333
- this.inputsInline,
1334
- newBoolean,
1335
- ),
1336
- );
1337
- this.inputsInline = newBoolean;
1338
- }
1339
- }
1340
-
1341
- /**
1342
- * Get whether value inputs are arranged horizontally or vertically.
1343
- *
1344
- * @returns True if inputs are horizontal.
1345
- */
1346
- getInputsInline(): boolean {
1347
- if (this.inputsInline !== undefined) {
1348
- // Set explicitly.
1349
- return this.inputsInline;
1350
- }
1351
- // Not defined explicitly. Figure out what would look best.
1352
- for (let i = 1; i < this.inputList.length; i++) {
1353
- if (
1354
- this.inputList[i - 1] instanceof DummyInput &&
1355
- this.inputList[i] instanceof DummyInput
1356
- ) {
1357
- // Two dummy inputs in a row. Don't inline them.
1358
- return false;
1359
- }
1360
- }
1361
- for (let i = 1; i < this.inputList.length; i++) {
1362
- if (
1363
- this.inputList[i - 1] instanceof ValueInput &&
1364
- this.inputList[i] instanceof DummyInput
1365
- ) {
1366
- // Dummy input after a value input. Inline them.
1367
- return true;
1368
- }
1369
- }
1370
- for (let i = 0; i < this.inputList.length; i++) {
1371
- if (this.inputList[i] instanceof EndRowInput) {
1372
- // A row-end input is present. Inline value inputs.
1373
- return true;
1374
- }
1375
- }
1376
- return false;
1377
- }
1378
-
1379
- /**
1380
- * Set the block's output shape.
1381
- *
1382
- * @param outputShape Value representing an output shape.
1383
- */
1384
- setOutputShape(outputShape: number | null) {
1385
- this.outputShape_ = outputShape;
1386
- }
1387
-
1388
- /**
1389
- * Get the block's output shape.
1390
- *
1391
- * @returns Value representing output shape if one exists.
1392
- */
1393
- getOutputShape(): number | null {
1394
- return this.outputShape_;
1395
- }
1396
-
1397
- /**
1398
- * Get whether this block is enabled or not. A block is considered enabled
1399
- * if there aren't any reasons why it would be disabled. A block may still
1400
- * be disabled for other reasons even if the user attempts to manually
1401
- * enable it, such as when the block is in an invalid location.
1402
- *
1403
- * @returns True if enabled.
1404
- */
1405
- isEnabled(): boolean {
1406
- return this.disabledReasons.size === 0;
1407
- }
1408
-
1409
- /** @deprecated v11 - Get whether the block is manually disabled. */
1410
- private get disabled(): boolean {
1411
- deprecation.warn(
1412
- 'disabled',
1413
- 'v11',
1414
- 'v12',
1415
- 'the isEnabled or hasDisabledReason methods of Block',
1416
- );
1417
- return this.hasDisabledReason(constants.MANUALLY_DISABLED);
1418
- }
1419
-
1420
- /** @deprecated v11 - Set whether the block is manually disabled. */
1421
- private set disabled(value: boolean) {
1422
- deprecation.warn(
1423
- 'disabled',
1424
- 'v11',
1425
- 'v12',
1426
- 'the setDisabledReason method of Block',
1427
- );
1428
- this.setDisabledReason(value, constants.MANUALLY_DISABLED);
1429
- }
1430
-
1431
- /**
1432
- * @deprecated v11 - Set whether the block is manually enabled or disabled.
1433
- * The user can toggle whether a block is disabled from a context menu
1434
- * option. A block may still be disabled for other reasons even if the user
1435
- * attempts to manually enable it, such as when the block is in an invalid
1436
- * location. This method is deprecated and setDisabledReason should be used
1437
- * instead.
1438
- *
1439
- * @param enabled True if enabled.
1440
- */
1441
- setEnabled(enabled: boolean) {
1442
- deprecation.warn(
1443
- 'setEnabled',
1444
- 'v11',
1445
- 'v12',
1446
- 'the setDisabledReason method of Block',
1447
- );
1448
- this.setDisabledReason(!enabled, constants.MANUALLY_DISABLED);
1449
- }
1450
-
1451
- /**
1452
- * Add or remove a reason why the block might be disabled. If a block has
1453
- * any reasons to be disabled, then the block itself will be considered
1454
- * disabled. A block could be disabled for multiple independent reasons
1455
- * simultaneously, such as when the user manually disables it, or the block
1456
- * is invalid.
1457
- *
1458
- * @param disabled If true, then the block should be considered disabled for
1459
- * at least the provided reason, otherwise the block is no longer disabled
1460
- * for that reason.
1461
- * @param reason A language-neutral identifier for a reason why the block
1462
- * could be disabled. Call this method again with the same identifier to
1463
- * update whether the block is currently disabled for this reason.
1464
- */
1465
- setDisabledReason(disabled: boolean, reason: string): void {
1466
- if (this.disabledReasons.has(reason) !== disabled) {
1467
- if (disabled) {
1468
- this.disabledReasons.add(reason);
1469
- } else {
1470
- this.disabledReasons.delete(reason);
1471
- }
1472
- const blockChangeEvent = new (eventUtils.get(eventUtils.BLOCK_CHANGE))(
1473
- this,
1474
- 'disabled',
1475
- /* name= */ null,
1476
- /* oldValue= */ !disabled,
1477
- /* newValue= */ disabled,
1478
- ) as BlockChange;
1479
- blockChangeEvent.setDisabledReason(reason);
1480
- eventUtils.fire(blockChangeEvent);
1481
- }
1482
- }
1483
-
1484
- /**
1485
- * Get whether the block is disabled or not due to parents.
1486
- * The block's own disabled property is not considered.
1487
- *
1488
- * @returns True if disabled.
1489
- */
1490
- getInheritedDisabled(): boolean {
1491
- let ancestor = this.getSurroundParent();
1492
- while (ancestor) {
1493
- if (!ancestor.isEnabled()) {
1494
- return true;
1495
- }
1496
- ancestor = ancestor.getSurroundParent();
1497
- }
1498
- // Ran off the top.
1499
- return false;
1500
- }
1501
-
1502
- /**
1503
- * Get whether the block is currently disabled for the provided reason.
1504
- *
1505
- * @param reason A language-neutral identifier for a reason why the block
1506
- * could be disabled.
1507
- * @returns Whether the block is disabled for the provided reason.
1508
- */
1509
- hasDisabledReason(reason: string): boolean {
1510
- return this.disabledReasons.has(reason);
1511
- }
1512
-
1513
- /**
1514
- * Get a set of reasons why the block is currently disabled, if any. If the
1515
- * block is enabled, this set will be empty.
1516
- *
1517
- * @returns The set of reasons why the block is disabled, if any.
1518
- */
1519
- getDisabledReasons(): ReadonlySet<string> {
1520
- return this.disabledReasons;
1521
- }
1522
-
1523
- /**
1524
- * Get whether the block is collapsed or not.
1525
- *
1526
- * @returns True if collapsed.
1527
- */
1528
- isCollapsed(): boolean {
1529
- return this.collapsed_;
1530
- }
1531
-
1532
- /**
1533
- * Set whether the block is collapsed or not.
1534
- *
1535
- * @param collapsed True if collapsed.
1536
- */
1537
- setCollapsed(collapsed: boolean) {
1538
- if (this.collapsed_ !== collapsed) {
1539
- eventUtils.fire(
1540
- new (eventUtils.get(eventUtils.BLOCK_CHANGE))(
1541
- this,
1542
- 'collapsed',
1543
- null,
1544
- this.collapsed_,
1545
- collapsed,
1546
- ),
1547
- );
1548
- this.collapsed_ = collapsed;
1549
- }
1550
- }
1551
-
1552
- /**
1553
- * Create a human-readable text representation of this block and any children.
1554
- *
1555
- * @param opt_maxLength Truncate the string to this length.
1556
- * @param opt_emptyToken The placeholder string used to denote an empty input.
1557
- * If not specified, '?' is used.
1558
- * @returns Text of block.
1559
- */
1560
- toString(opt_maxLength?: number, opt_emptyToken?: string): string {
1561
- const tokens = this.toTokens(opt_emptyToken);
1562
-
1563
- // Run through our tokens array and simplify expression to remove
1564
- // parentheses around single field blocks.
1565
- // E.g. ['repeat', '(', '10', ')', 'times', 'do', '?']
1566
- for (let i = 2; i < tokens.length; i++) {
1567
- if (tokens[i - 2] === '(' && tokens[i] === ')') {
1568
- tokens[i - 2] = tokens[i - 1];
1569
- tokens.splice(i - 1, 2);
1570
- }
1571
- }
1572
-
1573
- // Join the text array, removing the spaces around added parentheses.
1574
- let prev = '';
1575
- let text: string = tokens.reduce((acc, curr) => {
1576
- const val = acc + (prev === '(' || curr === ')' ? '' : ' ') + curr;
1577
- prev = curr[curr.length - 1];
1578
- return val;
1579
- }, '');
1580
-
1581
- text = text.trim() || '???';
1582
- if (opt_maxLength) {
1583
- // TODO: Improve truncation so that text from this block is given
1584
- // priority. E.g. "1+2+3+4+5+6+7+8+9=0" should be "...6+7+8+9=0", not
1585
- // "1+2+3+4+5...". E.g. "1+2+3+4+5=6+7+8+9+0" should be "...4+5=6+7...".
1586
- if (text.length > opt_maxLength) {
1587
- text = text.substring(0, opt_maxLength - 3) + '...';
1588
- }
1589
- }
1590
- return text;
1591
- }
1592
-
1593
- /**
1594
- * Converts this block into string tokens.
1595
- *
1596
- * @param emptyToken The token to use in place of an empty input.
1597
- * Defaults to '?'.
1598
- * @returns The array of string tokens representing this block.
1599
- */
1600
- private toTokens(emptyToken = '?'): string[] {
1601
- const tokens = [];
1602
- /**
1603
- * Whether or not to add parentheses around an input.
1604
- *
1605
- * @param connection The connection.
1606
- * @returns True if we should add parentheses around the input.
1607
- */
1608
- function shouldAddParentheses(connection: Connection): boolean {
1609
- let checks = connection.getCheck();
1610
- if (!checks && connection.targetConnection) {
1611
- checks = connection.targetConnection.getCheck();
1612
- }
1613
- return (
1614
- !!checks && (checks.includes('Boolean') || checks.includes('Number'))
1615
- );
1616
- }
1617
-
1618
- for (const input of this.inputList) {
1619
- if (input.name == constants.COLLAPSED_INPUT_NAME) {
1620
- continue;
1621
- }
1622
- for (const field of input.fieldRow) {
1623
- tokens.push(field.getText());
1624
- }
1625
- if (input.connection) {
1626
- const child = input.connection.targetBlock();
1627
- if (child) {
1628
- const shouldAddParens = shouldAddParentheses(input.connection);
1629
- if (shouldAddParens) tokens.push('(');
1630
- tokens.push(...child.toTokens(emptyToken));
1631
- if (shouldAddParens) tokens.push(')');
1632
- } else {
1633
- tokens.push(emptyToken);
1634
- }
1635
- }
1636
- }
1637
- return tokens;
1638
- }
1639
-
1640
- /**
1641
- * Appends a value input row.
1642
- *
1643
- * @param name Language-neutral identifier which may used to find this input
1644
- * again. Should be unique to this block.
1645
- * @returns The input object created.
1646
- */
1647
- appendValueInput(name: string): Input {
1648
- return this.appendInput(new ValueInput(name, this));
1649
- }
1650
-
1651
- /**
1652
- * Appends a statement input row.
1653
- *
1654
- * @param name Language-neutral identifier which may used to find this input
1655
- * again. Should be unique to this block.
1656
- * @returns The input object created.
1657
- */
1658
- appendStatementInput(name: string): Input {
1659
- this.statementInputCount++;
1660
- return this.appendInput(new StatementInput(name, this));
1661
- }
1662
-
1663
- /**
1664
- * Appends a dummy input row.
1665
- *
1666
- * @param name Optional language-neutral identifier which may used to find
1667
- * this input again. Should be unique to this block.
1668
- * @returns The input object created.
1669
- */
1670
- appendDummyInput(name = ''): Input {
1671
- return this.appendInput(new DummyInput(name, this));
1672
- }
1673
-
1674
- /**
1675
- * Appends an input that ends the row.
1676
- *
1677
- * @param name Optional language-neutral identifier which may used to find
1678
- * this input again. Should be unique to this block.
1679
- * @returns The input object created.
1680
- */
1681
- appendEndRowInput(name = ''): Input {
1682
- return this.appendInput(new EndRowInput(name, this));
1683
- }
1684
-
1685
- /**
1686
- * Appends the given input row.
1687
- *
1688
- * Allows for custom inputs to be appended to the block.
1689
- */
1690
- appendInput(input: Input): Input {
1691
- this.inputList.push(input);
1692
- return input;
1693
- }
1694
-
1695
- /**
1696
- * Appends an input with the given input type and name to the block after
1697
- * constructing it from the registry.
1698
- *
1699
- * @param type The name the input is registered under in the registry.
1700
- * @param name The name the input will have within the block.
1701
- * @returns The constucted input, or null if there was no constructor
1702
- * associated with the type.
1703
- */
1704
- private appendInputFromRegistry(type: string, name: string): Input | null {
1705
- const inputConstructor = registry.getClass(
1706
- registry.Type.INPUT,
1707
- type,
1708
- false,
1709
- );
1710
- if (!inputConstructor) return null;
1711
- return this.appendInput(new inputConstructor(name, this));
1712
- }
1713
-
1714
- /**
1715
- * Initialize this block using a cross-platform, internationalization-friendly
1716
- * JSON description.
1717
- *
1718
- * @param json Structured data describing the block.
1719
- */
1720
- jsonInit(json: AnyDuringMigration) {
1721
- const warningPrefix = json['type'] ? 'Block "' + json['type'] + '": ' : '';
1722
-
1723
- // Validate inputs.
1724
- if (json['output'] && json['previousStatement']) {
1725
- throw Error(
1726
- warningPrefix + 'Must not have both an output and a previousStatement.',
1727
- );
1728
- }
1729
-
1730
- // Validate that each arg has a corresponding message
1731
- let n = 0;
1732
- while (json['args' + n]) {
1733
- if (json['message' + n] === undefined) {
1734
- throw Error(
1735
- warningPrefix +
1736
- `args${n} must have a corresponding message (message${n}).`,
1737
- );
1738
- }
1739
- n++;
1740
- }
1741
-
1742
- // Set basic properties of block.
1743
- // Makes styles backward compatible with old way of defining hat style.
1744
- if (json['style'] && json['style'].hat) {
1745
- this.hat = json['style'].hat;
1746
- // Must set to null so it doesn't error when checking for style and
1747
- // colour.
1748
- json['style'] = null;
1749
- }
1750
-
1751
- if (json['style'] && json['colour']) {
1752
- throw Error(warningPrefix + 'Must not have both a colour and a style.');
1753
- } else if (json['style']) {
1754
- this.jsonInitStyle_(json, warningPrefix);
1755
- } else {
1756
- this.jsonInitColour_(json, warningPrefix);
1757
- }
1758
-
1759
- // Interpolate the message blocks.
1760
- let i = 0;
1761
- while (json['message' + i] !== undefined) {
1762
- this.interpolate_(
1763
- json['message' + i],
1764
- json['args' + i] || [],
1765
- // Backwards compatibility: lastDummyAlign aliases implicitAlign.
1766
- json['implicitAlign' + i] || json['lastDummyAlign' + i],
1767
- warningPrefix,
1768
- );
1769
- i++;
1770
- }
1771
-
1772
- if (json['inputsInline'] !== undefined) {
1773
- eventUtils.disable();
1774
- this.setInputsInline(json['inputsInline']);
1775
- eventUtils.enable();
1776
- }
1777
-
1778
- // Set output and previous/next connections.
1779
- if (json['output'] !== undefined) {
1780
- this.setOutput(true, json['output']);
1781
- }
1782
- if (json['outputShape'] !== undefined) {
1783
- this.setOutputShape(json['outputShape']);
1784
- }
1785
- if (json['previousStatement'] !== undefined) {
1786
- this.setPreviousStatement(true, json['previousStatement']);
1787
- }
1788
- if (json['nextStatement'] !== undefined) {
1789
- this.setNextStatement(true, json['nextStatement']);
1790
- }
1791
- if (json['tooltip'] !== undefined) {
1792
- const rawValue = json['tooltip'];
1793
- const localizedText = parsing.replaceMessageReferences(rawValue);
1794
- this.setTooltip(localizedText);
1795
- }
1796
- if (json['enableContextMenu'] !== undefined) {
1797
- this.contextMenu = !!json['enableContextMenu'];
1798
- }
1799
- if (json['suppressPrefixSuffix'] !== undefined) {
1800
- this.suppressPrefixSuffix = !!json['suppressPrefixSuffix'];
1801
- }
1802
- if (json['helpUrl'] !== undefined) {
1803
- const rawValue = json['helpUrl'];
1804
- const localizedValue = parsing.replaceMessageReferences(rawValue);
1805
- this.setHelpUrl(localizedValue);
1806
- }
1807
- if (typeof json['extensions'] === 'string') {
1808
- console.warn(
1809
- warningPrefix +
1810
- "JSON attribute 'extensions' should be an array of" +
1811
- " strings. Found raw string in JSON for '" +
1812
- json['type'] +
1813
- "' block.",
1814
- );
1815
- json['extensions'] = [json['extensions']]; // Correct and continue.
1816
- }
1817
-
1818
- // Add the mutator to the block.
1819
- if (json['mutator'] !== undefined) {
1820
- Extensions.apply(json['mutator'], this, true);
1821
- }
1822
-
1823
- const extensionNames = json['extensions'];
1824
- if (Array.isArray(extensionNames)) {
1825
- for (let j = 0; j < extensionNames.length; j++) {
1826
- Extensions.apply(extensionNames[j], this, false);
1827
- }
1828
- }
1829
- }
1830
-
1831
- /**
1832
- * Initialize the colour of this block from the JSON description.
1833
- *
1834
- * @param json Structured data describing the block.
1835
- * @param warningPrefix Warning prefix string identifying block.
1836
- */
1837
- private jsonInitColour_(json: AnyDuringMigration, warningPrefix: string) {
1838
- if ('colour' in json) {
1839
- if (json['colour'] === undefined) {
1840
- console.warn(warningPrefix + 'Undefined colour value.');
1841
- } else {
1842
- const rawValue = json['colour'];
1843
- try {
1844
- this.setColour(rawValue);
1845
- } catch (e) {
1846
- console.warn(warningPrefix + 'Illegal colour value: ', rawValue);
1847
- }
1848
- }
1849
- }
1850
- }
1851
-
1852
- /**
1853
- * Initialize the style of this block from the JSON description.
1854
- *
1855
- * @param json Structured data describing the block.
1856
- * @param warningPrefix Warning prefix string identifying block.
1857
- */
1858
- private jsonInitStyle_(json: AnyDuringMigration, warningPrefix: string) {
1859
- const blockStyleName = json['style'];
1860
- try {
1861
- this.setStyle(blockStyleName);
1862
- } catch (styleError) {
1863
- console.warn(warningPrefix + 'Style does not exist: ', blockStyleName);
1864
- }
1865
- }
1866
-
1867
- /**
1868
- * Add key/values from mixinObj to this block object. By default, this method
1869
- * will check that the keys in mixinObj will not overwrite existing values in
1870
- * the block, including prototype values. This provides some insurance against
1871
- * mixin / extension incompatibilities with future block features. This check
1872
- * can be disabled by passing true as the second argument.
1873
- *
1874
- * @param mixinObj The key/values pairs to add to this block object.
1875
- * @param opt_disableCheck Option flag to disable overwrite checks.
1876
- */
1877
- mixin(mixinObj: AnyDuringMigration, opt_disableCheck?: boolean) {
1878
- if (
1879
- opt_disableCheck !== undefined &&
1880
- typeof opt_disableCheck !== 'boolean'
1881
- ) {
1882
- throw Error('opt_disableCheck must be a boolean if provided');
1883
- }
1884
- if (!opt_disableCheck) {
1885
- const overwrites = [];
1886
- for (const key in mixinObj) {
1887
- if ((this as AnyDuringMigration)[key] !== undefined) {
1888
- overwrites.push(key);
1889
- }
1890
- }
1891
- if (overwrites.length) {
1892
- throw Error(
1893
- 'Mixin will overwrite block members: ' + JSON.stringify(overwrites),
1894
- );
1895
- }
1896
- }
1897
- Object.assign(this, mixinObj);
1898
- }
1899
-
1900
- /**
1901
- * Interpolate a message description onto the block.
1902
- *
1903
- * @param message Text contains interpolation tokens (%1, %2, ...) that match
1904
- * with fields or inputs defined in the args array.
1905
- * @param args Array of arguments to be interpolated.
1906
- * @param implicitAlign If an implicit input is added at the end or in place
1907
- * of newline tokens, how should it be aligned?
1908
- * @param warningPrefix Warning prefix string identifying block.
1909
- */
1910
- private interpolate_(
1911
- message: string,
1912
- args: AnyDuringMigration[],
1913
- implicitAlign: string | undefined,
1914
- warningPrefix: string,
1915
- ) {
1916
- const tokens = parsing.tokenizeInterpolation(message);
1917
- this.validateTokens_(tokens, args.length);
1918
- const elements = this.interpolateArguments_(tokens, args, implicitAlign);
1919
-
1920
- // An array of [field, fieldName] tuples.
1921
- const fieldStack = [];
1922
- for (let i = 0, element; (element = elements[i]); i++) {
1923
- if (this.isInputKeyword_(element['type'])) {
1924
- const input = this.inputFromJson_(element, warningPrefix);
1925
- // Should never be null, but just in case.
1926
- if (input) {
1927
- for (let j = 0, tuple; (tuple = fieldStack[j]); j++) {
1928
- input.appendField(tuple[0], tuple[1]);
1929
- }
1930
- fieldStack.length = 0;
1931
- }
1932
- } else {
1933
- // All other types, including ones starting with 'input_' get routed
1934
- // here.
1935
- const field = this.fieldFromJson_(element);
1936
- if (field) {
1937
- fieldStack.push([field, element['name']]);
1938
- }
1939
- }
1940
- }
1941
- }
1942
-
1943
- /**
1944
- * Validates that the tokens are within the correct bounds, with no
1945
- * duplicates, and that all of the arguments are referred to. Throws errors if
1946
- * any of these things are not true.
1947
- *
1948
- * @param tokens An array of tokens to validate
1949
- * @param argsCount The number of args that need to be referred to.
1950
- */
1951
- private validateTokens_(tokens: Array<string | number>, argsCount: number) {
1952
- const visitedArgsHash = [];
1953
- let visitedArgsCount = 0;
1954
- for (let i = 0; i < tokens.length; i++) {
1955
- const token = tokens[i];
1956
- if (typeof token !== 'number') {
1957
- continue;
1958
- }
1959
- if (token < 1 || token > argsCount) {
1960
- throw Error(
1961
- 'Block "' +
1962
- this.type +
1963
- '": ' +
1964
- 'Message index %' +
1965
- token +
1966
- ' out of range.',
1967
- );
1968
- }
1969
- if (visitedArgsHash[token]) {
1970
- throw Error(
1971
- 'Block "' +
1972
- this.type +
1973
- '": ' +
1974
- 'Message index %' +
1975
- token +
1976
- ' duplicated.',
1977
- );
1978
- }
1979
- visitedArgsHash[token] = true;
1980
- visitedArgsCount++;
1981
- }
1982
- if (visitedArgsCount !== argsCount) {
1983
- throw Error(
1984
- 'Block "' +
1985
- this.type +
1986
- '": ' +
1987
- 'Message does not reference all ' +
1988
- argsCount +
1989
- ' arg(s).',
1990
- );
1991
- }
1992
- }
1993
-
1994
- /**
1995
- * Inserts args in place of numerical tokens. String args are converted to
1996
- * JSON that defines a label field. Newline characters are converted to
1997
- * end-row inputs, and if necessary an extra dummy input is added to the end
1998
- * of the elements.
1999
- *
2000
- * @param tokens The tokens to interpolate
2001
- * @param args The arguments to insert.
2002
- * @param implicitAlign The alignment to use for any implicitly added end-row
2003
- * or dummy inputs, if necessary.
2004
- * @returns The JSON definitions of field and inputs to add to the block.
2005
- */
2006
- private interpolateArguments_(
2007
- tokens: Array<string | number>,
2008
- args: Array<AnyDuringMigration | string>,
2009
- implicitAlign: string | undefined,
2010
- ): AnyDuringMigration[] {
2011
- const elements = [];
2012
- for (let i = 0; i < tokens.length; i++) {
2013
- let element = tokens[i];
2014
- if (typeof element === 'number') {
2015
- element = args[element - 1];
2016
- }
2017
- // Args can be strings, which is why this isn't elseif.
2018
- if (typeof element === 'string') {
2019
- if (element === '\n') {
2020
- // Convert newline tokens to end-row inputs.
2021
- const newlineInput = {'type': 'input_end_row'};
2022
- if (implicitAlign) {
2023
- (newlineInput as AnyDuringMigration)['align'] = implicitAlign;
2024
- }
2025
- element = newlineInput as AnyDuringMigration;
2026
- } else {
2027
- // AnyDuringMigration because: Type '{ text: string; type: string; }
2028
- // | null' is not assignable to type 'string | number'.
2029
- element = this.stringToFieldJson_(element) as AnyDuringMigration;
2030
- if (!element) {
2031
- continue;
2032
- }
2033
- }
2034
- }
2035
- elements.push(element);
2036
- }
2037
-
2038
- const length = elements.length;
2039
- if (
2040
- length &&
2041
- !this.isInputKeyword_(
2042
- (elements as AnyDuringMigration)[length - 1]['type'],
2043
- )
2044
- ) {
2045
- const dummyInput = {'type': 'input_dummy'};
2046
- if (implicitAlign) {
2047
- (dummyInput as AnyDuringMigration)['align'] = implicitAlign;
2048
- }
2049
- elements.push(dummyInput);
2050
- }
2051
-
2052
- return elements;
2053
- }
2054
-
2055
- /**
2056
- * Creates a field from the JSON definition of a field. If a field with the
2057
- * given type cannot be found, this attempts to create a different field using
2058
- * the 'alt' property of the JSON definition (if it exists).
2059
- *
2060
- * @param element The element to try to turn into a field.
2061
- * @returns The field defined by the JSON, or null if one couldn't be created.
2062
- */
2063
- private fieldFromJson_(element: {
2064
- alt?: string;
2065
- type: string;
2066
- text?: string;
2067
- }): Field | null {
2068
- const field = fieldRegistry.fromJson(element);
2069
- if (!field && element['alt']) {
2070
- if (typeof element['alt'] === 'string') {
2071
- const json = this.stringToFieldJson_(element['alt']);
2072
- return json ? this.fieldFromJson_(json) : null;
2073
- }
2074
- return this.fieldFromJson_(element['alt']);
2075
- }
2076
- return field;
2077
- }
2078
-
2079
- /**
2080
- * Creates an input from the JSON definition of an input. Sets the input's
2081
- * check and alignment if they are provided.
2082
- *
2083
- * @param element The JSON to turn into an input.
2084
- * @param warningPrefix The prefix to add to warnings to help the developer
2085
- * debug.
2086
- * @returns The input that has been created, or null if one could not be
2087
- * created for some reason (should never happen).
2088
- */
2089
- private inputFromJson_(
2090
- element: AnyDuringMigration,
2091
- warningPrefix: string,
2092
- ): Input | null {
2093
- const alignmentLookup = {
2094
- 'LEFT': Align.LEFT,
2095
- 'RIGHT': Align.RIGHT,
2096
- 'CENTRE': Align.CENTRE,
2097
- 'CENTER': Align.CENTRE,
2098
- };
2099
-
2100
- let input = null;
2101
- switch (element['type']) {
2102
- case 'input_value':
2103
- input = this.appendValueInput(element['name']);
2104
- break;
2105
- case 'input_statement':
2106
- input = this.appendStatementInput(element['name']);
2107
- break;
2108
- case 'input_dummy':
2109
- input = this.appendDummyInput(element['name']);
2110
- break;
2111
- case 'input_end_row':
2112
- input = this.appendEndRowInput(element['name']);
2113
- break;
2114
- default: {
2115
- input = this.appendInputFromRegistry(element['type'], element['name']);
2116
- break;
2117
- }
2118
- }
2119
- // Should never be hit because of interpolate_'s checks, but just in case.
2120
- if (!input) {
2121
- return null;
2122
- }
2123
-
2124
- if (element['check']) {
2125
- input.setCheck(element['check']);
2126
- }
2127
- if (element['align']) {
2128
- const alignment = (alignmentLookup as AnyDuringMigration)[
2129
- element['align'].toUpperCase()
2130
- ];
2131
- if (alignment === undefined) {
2132
- console.warn(warningPrefix + 'Illegal align value: ', element['align']);
2133
- } else {
2134
- input.setAlign(alignment);
2135
- }
2136
- }
2137
- return input;
2138
- }
2139
-
2140
- /**
2141
- * Returns true if the given string matches one of the input keywords.
2142
- *
2143
- * @param str The string to check.
2144
- * @returns True if the given string matches one of the input keywords, false
2145
- * otherwise.
2146
- */
2147
- private isInputKeyword_(str: string): boolean {
2148
- return (
2149
- str === 'input_value' ||
2150
- str === 'input_statement' ||
2151
- str === 'input_dummy' ||
2152
- str === 'input_end_row' ||
2153
- registry.hasItem(registry.Type.INPUT, str)
2154
- );
2155
- }
2156
-
2157
- /**
2158
- * Turns a string into the JSON definition of a label field. If the string
2159
- * becomes an empty string when trimmed, this returns null.
2160
- *
2161
- * @param str String to turn into the JSON definition of a label field.
2162
- * @returns The JSON definition or null.
2163
- */
2164
- private stringToFieldJson_(str: string): {text: string; type: string} | null {
2165
- str = str.trim();
2166
- if (str) {
2167
- return {
2168
- 'type': 'field_label',
2169
- 'text': str,
2170
- };
2171
- }
2172
- return null;
2173
- }
2174
-
2175
- /**
2176
- * Move a named input to a different location on this block.
2177
- *
2178
- * @param name The name of the input to move.
2179
- * @param refName Name of input that should be after the moved input, or null
2180
- * to be the input at the end.
2181
- */
2182
- moveInputBefore(name: string, refName: string | null) {
2183
- if (name === refName) {
2184
- return;
2185
- }
2186
- // Find both inputs.
2187
- let inputIndex = -1;
2188
- let refIndex = refName ? -1 : this.inputList.length;
2189
- for (let i = 0, input; (input = this.inputList[i]); i++) {
2190
- if (input.name === name) {
2191
- inputIndex = i;
2192
- if (refIndex !== -1) {
2193
- break;
2194
- }
2195
- } else if (refName && input.name === refName) {
2196
- refIndex = i;
2197
- if (inputIndex !== -1) {
2198
- break;
2199
- }
2200
- }
2201
- }
2202
- if (inputIndex === -1) {
2203
- throw Error('Named input "' + name + '" not found.');
2204
- }
2205
- if (refIndex === -1) {
2206
- throw Error('Reference input "' + refName + '" not found.');
2207
- }
2208
- this.moveNumberedInputBefore(inputIndex, refIndex);
2209
- }
2210
-
2211
- /**
2212
- * Move a numbered input to a different location on this block.
2213
- *
2214
- * @param inputIndex Index of the input to move.
2215
- * @param refIndex Index of input that should be after the moved input.
2216
- */
2217
- moveNumberedInputBefore(inputIndex: number, refIndex: number) {
2218
- // Validate arguments.
2219
- if (inputIndex === refIndex) {
2220
- throw Error("Can't move input to itself.");
2221
- }
2222
- if (inputIndex >= this.inputList.length) {
2223
- throw RangeError('Input index ' + inputIndex + ' out of bounds.');
2224
- }
2225
- if (refIndex > this.inputList.length) {
2226
- throw RangeError('Reference input ' + refIndex + ' out of bounds.');
2227
- }
2228
- // Remove input.
2229
- const input = this.inputList[inputIndex];
2230
- this.inputList.splice(inputIndex, 1);
2231
- if (inputIndex < refIndex) {
2232
- refIndex--;
2233
- }
2234
- // Reinsert input.
2235
- this.inputList.splice(refIndex, 0, input);
2236
- }
2237
-
2238
- /**
2239
- * Remove an input from this block.
2240
- *
2241
- * @param name The name of the input.
2242
- * @param opt_quiet True to prevent an error if input is not present.
2243
- * @returns True if operation succeeds, false if input is not present and
2244
- * opt_quiet is true.
2245
- * @throws {Error} if the input is not present and opt_quiet is not true.
2246
- */
2247
- removeInput(name: string, opt_quiet?: boolean): boolean {
2248
- for (let i = 0, input; (input = this.inputList[i]); i++) {
2249
- if (input.name === name) {
2250
- if (input instanceof StatementInput) this.statementInputCount--;
2251
- input.dispose();
2252
- this.inputList.splice(i, 1);
2253
- return true;
2254
- }
2255
- }
2256
- if (opt_quiet) {
2257
- return false;
2258
- }
2259
- throw Error('Input not found: ' + name);
2260
- }
2261
-
2262
- /**
2263
- * Fetches the named input object.
2264
- *
2265
- * @param name The name of the input.
2266
- * @returns The input object, or null if input does not exist.
2267
- */
2268
- getInput(name: string): Input | null {
2269
- for (let i = 0, input; (input = this.inputList[i]); i++) {
2270
- if (input.name === name) {
2271
- return input;
2272
- }
2273
- }
2274
- // This input does not exist.
2275
- return null;
2276
- }
2277
-
2278
- /**
2279
- * Fetches the block attached to the named input.
2280
- *
2281
- * @param name The name of the input.
2282
- * @returns The attached value block, or null if the input is either
2283
- * disconnected or if the input does not exist.
2284
- */
2285
- getInputTargetBlock(name: string): Block | null {
2286
- const input = this.getInput(name);
2287
- return input && input.connection && input.connection.targetBlock();
2288
- }
2289
-
2290
- /**
2291
- * Returns the comment on this block (or null if there is no comment).
2292
- *
2293
- * @returns Block's comment.
2294
- */
2295
- getCommentText(): string | null {
2296
- const comment = this.getIcon(IconType.COMMENT);
2297
- return comment?.getText() ?? null;
2298
- }
2299
-
2300
- /**
2301
- * Set this block's comment text.
2302
- *
2303
- * @param text The text, or null to delete.
2304
- */
2305
- setCommentText(text: string | null) {
2306
- const comment = this.getIcon(IconType.COMMENT);
2307
- const oldText = comment?.getText() ?? null;
2308
- if (oldText === text) return;
2309
- if (text !== null) {
2310
- let comment = this.getIcon(IconType.COMMENT);
2311
- if (!comment) {
2312
- const commentConstructor = registry.getClass(
2313
- registry.Type.ICON,
2314
- IconType.COMMENT.toString(),
2315
- false,
2316
- );
2317
- if (!commentConstructor) {
2318
- throw new Error(
2319
- 'No comment icon class is registered, so a comment cannot be set',
2320
- );
2321
- }
2322
- const icon = new commentConstructor(this);
2323
- if (!isCommentIcon(icon)) {
2324
- throw new Error(
2325
- 'The class registered as a comment icon does not conform to the ' +
2326
- 'ICommentIcon interface',
2327
- );
2328
- }
2329
- comment = this.addIcon(icon);
2330
- }
2331
- eventUtils.disable();
2332
- comment.setText(text);
2333
- eventUtils.enable();
2334
- } else {
2335
- this.removeIcon(IconType.COMMENT);
2336
- }
2337
-
2338
- eventUtils.fire(
2339
- new (eventUtils.get(eventUtils.BLOCK_CHANGE))(
2340
- this,
2341
- 'comment',
2342
- null,
2343
- oldText,
2344
- text,
2345
- ),
2346
- );
2347
- }
2348
-
2349
- /**
2350
- * Set this block's warning text.
2351
- *
2352
- * @param _text The text, or null to delete.
2353
- * @param _opt_id An optional ID for the warning text to be able to maintain
2354
- * multiple warnings.
2355
- */
2356
- setWarningText(_text: string | null, _opt_id?: string) {
2357
- // NOOP.
2358
- }
2359
-
2360
- /**
2361
- * Give this block a mutator dialog.
2362
- *
2363
- * @param _mutator A mutator dialog instance or null to remove.
2364
- */
2365
- setMutator(_mutator: MutatorIcon) {
2366
- // NOOP.
2367
- }
2368
-
2369
- /** Adds the given icon to the block. */
2370
- addIcon<T extends IIcon>(icon: T): T {
2371
- if (this.hasIcon(icon.getType())) throw new DuplicateIconType(icon);
2372
- this.icons.push(icon);
2373
- this.icons.sort((a, b) => a.getWeight() - b.getWeight());
2374
- return icon;
2375
- }
2376
-
2377
- /**
2378
- * Removes the icon whose getType matches the given type iconType from the
2379
- * block.
2380
- *
2381
- * @param type The type of the icon to remove from the block.
2382
- * @returns True if an icon with the given type was found, false otherwise.
2383
- */
2384
- removeIcon(type: IconType<IIcon>): boolean {
2385
- if (!this.hasIcon(type)) return false;
2386
- this.getIcon(type)?.dispose();
2387
- this.icons = this.icons.filter((icon) => !icon.getType().equals(type));
2388
- return true;
2389
- }
2390
-
2391
- /**
2392
- * @returns True if an icon with the given type exists on the block,
2393
- * false otherwise.
2394
- */
2395
- hasIcon(type: IconType<IIcon>): boolean {
2396
- return this.icons.some((icon) => icon.getType().equals(type));
2397
- }
2398
-
2399
- /**
2400
- * @param type The type of the icon to retrieve. Prefer passing an `IconType`
2401
- * for proper type checking when using typescript.
2402
- * @returns The icon with the given type if it exists on the block, undefined
2403
- * otherwise.
2404
- */
2405
- getIcon<T extends IIcon>(type: IconType<T> | string): T | undefined {
2406
- if (type instanceof IconType) {
2407
- return this.icons.find((icon) => icon.getType().equals(type)) as T;
2408
- } else {
2409
- return this.icons.find((icon) => icon.getType().toString() === type) as T;
2410
- }
2411
- }
2412
-
2413
- /** @returns An array of the icons attached to this block. */
2414
- getIcons(): IIcon[] {
2415
- return [...this.icons];
2416
- }
2417
-
2418
- /**
2419
- * Return the coordinates of the top-left corner of this block relative to the
2420
- * drawing surface's origin (0,0), in workspace units.
2421
- *
2422
- * @returns Object with .x and .y properties.
2423
- */
2424
- getRelativeToSurfaceXY(): Coordinate {
2425
- return this.xy_;
2426
- }
2427
-
2428
- /**
2429
- * Move a block by a relative offset.
2430
- *
2431
- * @param dx Horizontal offset, in workspace units.
2432
- * @param dy Vertical offset, in workspace units.
2433
- * @param reason Why is this move happening? 'drag', 'bump', 'snap', ...
2434
- */
2435
- moveBy(dx: number, dy: number, reason?: string[]) {
2436
- if (this.parentBlock_) {
2437
- throw Error('Block has parent');
2438
- }
2439
- const event = new (eventUtils.get(eventUtils.BLOCK_MOVE))(
2440
- this,
2441
- ) as BlockMove;
2442
- reason && event.setReason(reason);
2443
- this.xy_.translate(dx, dy);
2444
- event.recordNew();
2445
- eventUtils.fire(event);
2446
- }
2447
-
2448
- /**
2449
- * Create a connection of the specified type.
2450
- *
2451
- * @param type The type of the connection to create.
2452
- * @returns A new connection of the specified type.
2453
- * @internal
2454
- */
2455
- makeConnection_(type: ConnectionType): Connection {
2456
- return new Connection(this, type);
2457
- }
2458
-
2459
- /**
2460
- * Recursively checks whether all statement and value inputs are filled with
2461
- * blocks. Also checks all following statement blocks in this stack.
2462
- *
2463
- * @param opt_shadowBlocksAreFilled An optional argument controlling whether
2464
- * shadow blocks are counted as filled. Defaults to true.
2465
- * @returns True if all inputs are filled, false otherwise.
2466
- */
2467
- allInputsFilled(opt_shadowBlocksAreFilled?: boolean): boolean {
2468
- // Account for the shadow block filledness toggle.
2469
- if (opt_shadowBlocksAreFilled === undefined) {
2470
- opt_shadowBlocksAreFilled = true;
2471
- }
2472
- if (!opt_shadowBlocksAreFilled && this.isShadow()) {
2473
- return false;
2474
- }
2475
-
2476
- // Recursively check each input block of the current block.
2477
- for (let i = 0, input; (input = this.inputList[i]); i++) {
2478
- if (!input.connection) {
2479
- continue;
2480
- }
2481
- const target = input.connection.targetBlock();
2482
- if (!target || !target.allInputsFilled(opt_shadowBlocksAreFilled)) {
2483
- return false;
2484
- }
2485
- }
2486
-
2487
- // Recursively check the next block after the current block.
2488
- const next = this.getNextBlock();
2489
- if (next) {
2490
- return next.allInputsFilled(opt_shadowBlocksAreFilled);
2491
- }
2492
-
2493
- return true;
2494
- }
2495
-
2496
- /**
2497
- * This method returns a string describing this Block in developer terms (type
2498
- * name and ID; English only).
2499
- *
2500
- * Intended to on be used in console logs and errors. If you need a string
2501
- * that uses the user's native language (including block text, field values,
2502
- * and child blocks), use [toString()]{@link Block#toString}.
2503
- *
2504
- * @returns The description.
2505
- */
2506
- toDevString(): string {
2507
- let msg = this.type ? '"' + this.type + '" block' : 'Block';
2508
- if (this.id) {
2509
- msg += ' (id="' + this.id + '")';
2510
- }
2511
- return msg;
2512
- }
2513
- }
2514
-
2515
- export namespace Block {
2516
- export interface CommentModel {
2517
- text: string | null;
2518
- pinned: boolean;
2519
- size: Size;
2520
- }
2521
- }
2522
-
2523
- export type CommentModel = Block.CommentModel;