scratch-blocks 1.2.0-beta.1 → 1.2.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 (1297) hide show
  1. package/.husky/commit-msg +3 -0
  2. package/blockly_compressed_horizontal.js +2255 -0
  3. package/blockly_compressed_vertical.js +2283 -0
  4. package/blockly_uncompressed_horizontal.js +1210 -0
  5. package/blockly_uncompressed_vertical.js +1210 -0
  6. package/blocks_common/colour.js +61 -0
  7. package/blocks_common/math.js +159 -0
  8. package/blocks_common/matrix.js +54 -0
  9. package/blocks_common/note.js +58 -0
  10. package/blocks_common/text.js +57 -0
  11. package/blocks_compressed.js +36 -0
  12. package/blocks_compressed_horizontal.js +67 -0
  13. package/blocks_compressed_vertical.js +208 -0
  14. package/blocks_horizontal/control.js +212 -0
  15. package/blocks_horizontal/default_toolbox.js +139 -0
  16. package/blocks_horizontal/event.js +190 -0
  17. package/blocks_horizontal/wedo.js +325 -0
  18. package/blocks_vertical/control.js +532 -0
  19. package/blocks_vertical/data.js +666 -0
  20. package/blocks_vertical/default_toolbox.js +564 -0
  21. package/blocks_vertical/event.js +329 -0
  22. package/blocks_vertical/extensions.js +294 -0
  23. package/blocks_vertical/looks.js +591 -0
  24. package/blocks_vertical/motion.js +587 -0
  25. package/blocks_vertical/operators.js +470 -0
  26. package/blocks_vertical/procedures.js +973 -0
  27. package/blocks_vertical/sensing.js +554 -0
  28. package/blocks_vertical/sound.js +246 -0
  29. package/blocks_vertical/vertical_extensions.js +266 -0
  30. package/build/gen_blocks.js +1 -0
  31. package/build/test_expect.js +1 -0
  32. package/build/test_input.js +1 -0
  33. package/build.py +636 -0
  34. package/cleanup.sh +101 -0
  35. package/core/block.js +1837 -0
  36. package/core/block_animations.js +107 -0
  37. package/core/block_drag_surface.js +299 -0
  38. package/core/block_dragger.js +421 -0
  39. package/core/block_events.js +531 -0
  40. package/core/block_render_svg_horizontal.js +890 -0
  41. package/core/block_render_svg_vertical.js +1732 -0
  42. package/core/block_svg.js +1316 -0
  43. package/core/blockly.js +622 -0
  44. package/core/blocks.js +37 -0
  45. package/core/bubble.js +664 -0
  46. package/core/bubble_dragger.js +285 -0
  47. package/core/colours.js +160 -0
  48. package/core/comment.js +293 -0
  49. package/core/comment_events.js +539 -0
  50. package/core/connection.js +766 -0
  51. package/core/connection_db.js +300 -0
  52. package/core/constants.js +387 -0
  53. package/core/contextmenu.js +519 -0
  54. package/core/css.js +1351 -0
  55. package/core/data_category.js +490 -0
  56. package/core/dragged_connection_manager.js +260 -0
  57. package/core/dropdowndiv.js +408 -0
  58. package/core/events.js +429 -0
  59. package/core/events_abstract.js +113 -0
  60. package/core/extensions.js +450 -0
  61. package/core/field.js +807 -0
  62. package/core/field_angle.js +398 -0
  63. package/core/field_checkbox.js +133 -0
  64. package/core/field_colour.js +253 -0
  65. package/core/field_colour_slider.js +387 -0
  66. package/core/field_date.js +353 -0
  67. package/core/field_dropdown.js +483 -0
  68. package/core/field_iconmenu.js +309 -0
  69. package/core/field_image.js +193 -0
  70. package/core/field_label.js +136 -0
  71. package/core/field_label_serializable.js +125 -0
  72. package/core/field_matrix.js +566 -0
  73. package/core/field_note.js +850 -0
  74. package/core/field_number.js +366 -0
  75. package/core/field_numberdropdown.js +77 -0
  76. package/core/field_textdropdown.js +164 -0
  77. package/core/field_textinput.js +675 -0
  78. package/core/field_textinput_removable.js +105 -0
  79. package/core/field_variable.js +385 -0
  80. package/core/field_variable_getter.js +185 -0
  81. package/core/field_vertical_separator.js +161 -0
  82. package/core/flyout_base.js +923 -0
  83. package/core/flyout_button.js +322 -0
  84. package/core/flyout_dragger.js +83 -0
  85. package/core/flyout_extension_category_header.js +159 -0
  86. package/core/flyout_horizontal.js +475 -0
  87. package/core/flyout_vertical.js +770 -0
  88. package/core/generator.js +426 -0
  89. package/core/gesture.js +1011 -0
  90. package/core/grid.js +227 -0
  91. package/core/icon.js +205 -0
  92. package/core/inject.js +491 -0
  93. package/core/input.js +285 -0
  94. package/core/insertion_marker_manager.js +678 -0
  95. package/core/msg.js +62 -0
  96. package/core/mutator.js +426 -0
  97. package/core/names.js +198 -0
  98. package/core/options.js +244 -0
  99. package/core/procedures.js +577 -0
  100. package/core/rendered_connection.js +417 -0
  101. package/core/scratch_block_comment.js +653 -0
  102. package/core/scratch_blocks_utils.js +244 -0
  103. package/core/scratch_bubble.js +696 -0
  104. package/core/scratch_events.js +131 -0
  105. package/core/scratch_msgs.js +85 -0
  106. package/core/scrollbar.js +875 -0
  107. package/core/toolbox.js +801 -0
  108. package/core/tooltip.js +337 -0
  109. package/core/touch.js +226 -0
  110. package/core/trashcan.js +343 -0
  111. package/core/ui_events.js +91 -0
  112. package/core/ui_menu_utils.js +68 -0
  113. package/core/utils.js +948 -0
  114. package/core/variable_events.js +259 -0
  115. package/core/variable_map.js +415 -0
  116. package/core/variable_model.js +116 -0
  117. package/core/variables.js +674 -0
  118. package/core/warning.js +199 -0
  119. package/core/widgetdiv.js +344 -0
  120. package/core/workspace.js +673 -0
  121. package/core/workspace_audio.js +170 -0
  122. package/core/workspace_comment.js +432 -0
  123. package/core/workspace_comment_render_svg.js +723 -0
  124. package/core/workspace_comment_svg.js +611 -0
  125. package/core/workspace_drag_surface_svg.js +195 -0
  126. package/core/workspace_dragger.js +132 -0
  127. package/core/workspace_svg.js +2267 -0
  128. package/core/xml.js +919 -0
  129. package/core/zoom_controls.js +301 -0
  130. package/dist/horizontal.js +222 -0
  131. package/dist/vertical.js +222 -0
  132. package/dist/web/horizontal.js +232 -0
  133. package/dist/web/vertical.js +232 -0
  134. package/local_build.sh +70 -0
  135. package/msg/js/en.js +1 -0
  136. package/msg/json/en.json +1 -0
  137. package/msg/messages.js +1 -0
  138. package/msg/scratch_msgs.js +281 -221
  139. package/package.json +40 -25
  140. package/pull_from_blockly.sh +151 -0
  141. package/release.config.js +0 -8
  142. package/shim/blockly_compressed_horizontal-blocks_compressed.js +1 -0
  143. package/shim/blockly_compressed_horizontal.Blockly.js +1 -0
  144. package/shim/blockly_compressed_horizontal.goog.js +1 -0
  145. package/shim/blockly_compressed_horizontal.js +1 -0
  146. package/shim/blockly_compressed_vertical-blocks_compressed.js +1 -0
  147. package/shim/blockly_compressed_vertical.Blockly.js +1 -0
  148. package/shim/blockly_compressed_vertical.goog.js +1 -0
  149. package/shim/blockly_compressed_vertical.js +1 -0
  150. package/shim/blocks_compressed_horizontal-blockly_compressed_horizontal-messages.js +1 -0
  151. package/shim/blocks_compressed_horizontal.js +1 -0
  152. package/shim/blocks_compressed_vertical-blockly_compressed_vertical-messages.js +1 -0
  153. package/shim/blocks_compressed_vertical.js +1 -0
  154. package/shim/gh-pages.js +1 -0
  155. package/shim/horizontal.js +1 -0
  156. package/shim/index.js +17 -0
  157. package/shim/vertical.js +1 -0
  158. package/CHANGELOG.md +0 -1104
  159. package/TODO.md +0 -16
  160. package/blockly-rc/.eslintignore +0 -28
  161. package/blockly-rc/.eslintrc.js +0 -187
  162. package/blockly-rc/.gitattributes +0 -1
  163. package/blockly-rc/.github/CODEOWNERS +0 -1
  164. package/blockly-rc/.github/CONTRIBUTING.md +0 -46
  165. package/blockly-rc/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -58
  166. package/blockly-rc/.github/ISSUE_TEMPLATE/config.yml +0 -7
  167. package/blockly-rc/.github/ISSUE_TEMPLATE/documentation.yaml +0 -38
  168. package/blockly-rc/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -39
  169. package/blockly-rc/.github/PULL_REQUEST_TEMPLATE.md +0 -42
  170. package/blockly-rc/.github/dependabot.yml +0 -27
  171. package/blockly-rc/.github/release.yml +0 -32
  172. package/blockly-rc/.github/workflows/appengine_deploy.yml +0 -54
  173. package/blockly-rc/.github/workflows/assign_reviewers.yml +0 -41
  174. package/blockly-rc/.github/workflows/browser_test.yml +0 -55
  175. package/blockly-rc/.github/workflows/build.yml +0 -86
  176. package/blockly-rc/.github/workflows/conventional-label.yml +0 -17
  177. package/blockly-rc/.github/workflows/develop_freeze.yml +0 -26
  178. package/blockly-rc/.github/workflows/tag_module_cleanup.yml +0 -37
  179. package/blockly-rc/.github/workflows/welcome_new_contributors.yml +0 -36
  180. package/blockly-rc/.prettierignore +0 -30
  181. package/blockly-rc/.prettierrc.js +0 -13
  182. package/blockly-rc/CHANGELOG.md +0 -77
  183. package/blockly-rc/LICENSE +0 -202
  184. package/blockly-rc/README.md +0 -80
  185. package/blockly-rc/_config.yml +0 -1
  186. package/blockly-rc/api-extractor.json +0 -385
  187. package/blockly-rc/appengine/.gcloudignore +0 -20
  188. package/blockly-rc/appengine/README.txt +0 -42
  189. package/blockly-rc/appengine/add_timestamps.py +0 -69
  190. package/blockly-rc/appengine/app.yaml +0 -104
  191. package/blockly-rc/appengine/apple-touch-icon.png +0 -0
  192. package/blockly-rc/appengine/blockly_compressed.js +0 -11
  193. package/blockly-rc/appengine/expiration.py +0 -52
  194. package/blockly-rc/appengine/favicon.ico +0 -0
  195. package/blockly-rc/appengine/index.yaml +0 -11
  196. package/blockly-rc/appengine/main.py +0 -39
  197. package/blockly-rc/appengine/redirect.html +0 -107
  198. package/blockly-rc/appengine/requirements.txt +0 -1
  199. package/blockly-rc/appengine/robots.txt +0 -2
  200. package/blockly-rc/appengine/storage.js +0 -190
  201. package/blockly-rc/appengine/storage.py +0 -125
  202. package/blockly-rc/blocks/blocks.ts +0 -44
  203. package/blockly-rc/blocks/lists.ts +0 -1085
  204. package/blockly-rc/blocks/logic.ts +0 -712
  205. package/blockly-rc/blocks/loops.ts +0 -408
  206. package/blockly-rc/blocks/math.ts +0 -591
  207. package/blockly-rc/blocks/procedures.ts +0 -1364
  208. package/blockly-rc/blocks/text.ts +0 -1007
  209. package/blockly-rc/blocks/variables.ts +0 -183
  210. package/blockly-rc/blocks/variables_dynamic.ts +0 -194
  211. package/blockly-rc/core/any_aliases.ts +0 -8
  212. package/blockly-rc/core/block.ts +0 -2523
  213. package/blockly-rc/core/block_animations.ts +0 -225
  214. package/blockly-rc/core/block_flyout_inflater.ts +0 -262
  215. package/blockly-rc/core/block_svg.ts +0 -1768
  216. package/blockly-rc/core/blockly.ts +0 -605
  217. package/blockly-rc/core/blockly_options.ts +0 -71
  218. package/blockly-rc/core/blocks.ts +0 -18
  219. package/blockly-rc/core/browser_events.ts +0 -244
  220. package/blockly-rc/core/bubbles/bubble.ts +0 -658
  221. package/blockly-rc/core/bubbles/mini_workspace_bubble.ts +0 -280
  222. package/blockly-rc/core/bubbles/text_bubble.ts +0 -103
  223. package/blockly-rc/core/bubbles/textinput_bubble.ts +0 -344
  224. package/blockly-rc/core/bubbles.ts +0 -12
  225. package/blockly-rc/core/bump_objects.ts +0 -192
  226. package/blockly-rc/core/button_flyout_inflater.ts +0 -63
  227. package/blockly-rc/core/clipboard/block_paster.ts +0 -142
  228. package/blockly-rc/core/clipboard/registry.ts +0 -31
  229. package/blockly-rc/core/clipboard/workspace_comment_paster.ts +0 -94
  230. package/blockly-rc/core/clipboard.ts +0 -113
  231. package/blockly-rc/core/comments/comment_view.ts +0 -899
  232. package/blockly-rc/core/comments/rendered_workspace_comment.ts +0 -297
  233. package/blockly-rc/core/comments/workspace_comment.ts +0 -237
  234. package/blockly-rc/core/comments.ts +0 -9
  235. package/blockly-rc/core/common.ts +0 -305
  236. package/blockly-rc/core/component_manager.ts +0 -235
  237. package/blockly-rc/core/config.ts +0 -65
  238. package/blockly-rc/core/connection.ts +0 -793
  239. package/blockly-rc/core/connection_checker.ts +0 -348
  240. package/blockly-rc/core/connection_db.ts +0 -297
  241. package/blockly-rc/core/connection_type.ts +0 -21
  242. package/blockly-rc/core/constants.ts +0 -23
  243. package/blockly-rc/core/contextmenu.ts +0 -268
  244. package/blockly-rc/core/contextmenu_items.ts +0 -700
  245. package/blockly-rc/core/contextmenu_registry.ts +0 -194
  246. package/blockly-rc/core/css.ts +0 -481
  247. package/blockly-rc/core/delete_area.ts +0 -77
  248. package/blockly-rc/core/dialog.ts +0 -121
  249. package/blockly-rc/core/drag_target.ts +0 -97
  250. package/blockly-rc/core/dragging/block_drag_strategy.ts +0 -454
  251. package/blockly-rc/core/dragging/bubble_drag_strategy.ts +0 -52
  252. package/blockly-rc/core/dragging/comment_drag_strategy.ts +0 -91
  253. package/blockly-rc/core/dragging/dragger.ts +0 -163
  254. package/blockly-rc/core/dragging.ts +0 -12
  255. package/blockly-rc/core/dropdowndiv.ts +0 -768
  256. package/blockly-rc/core/events/events.ts +0 -163
  257. package/blockly-rc/core/events/events_abstract.ts +0 -130
  258. package/blockly-rc/core/events/events_block_base.ts +0 -88
  259. package/blockly-rc/core/events/events_block_change.ts +0 -259
  260. package/blockly-rc/core/events/events_block_create.ts +0 -185
  261. package/blockly-rc/core/events/events_block_delete.ts +0 -182
  262. package/blockly-rc/core/events/events_block_drag.ts +0 -116
  263. package/blockly-rc/core/events/events_block_field_intermediate_change.ts +0 -167
  264. package/blockly-rc/core/events/events_block_move.ts +0 -307
  265. package/blockly-rc/core/events/events_bubble_open.ts +0 -120
  266. package/blockly-rc/core/events/events_click.ts +0 -110
  267. package/blockly-rc/core/events/events_comment_base.ts +0 -126
  268. package/blockly-rc/core/events/events_comment_change.ts +0 -161
  269. package/blockly-rc/core/events/events_comment_collapse.ts +0 -103
  270. package/blockly-rc/core/events/events_comment_create.ts +0 -118
  271. package/blockly-rc/core/events/events_comment_delete.ts +0 -117
  272. package/blockly-rc/core/events/events_comment_drag.ts +0 -99
  273. package/blockly-rc/core/events/events_comment_move.ts +0 -207
  274. package/blockly-rc/core/events/events_comment_resize.ts +0 -174
  275. package/blockly-rc/core/events/events_marker_move.ts +0 -134
  276. package/blockly-rc/core/events/events_selected.ts +0 -98
  277. package/blockly-rc/core/events/events_theme_change.ts +0 -84
  278. package/blockly-rc/core/events/events_toolbox_item_select.ts +0 -96
  279. package/blockly-rc/core/events/events_trashcan_open.ts +0 -88
  280. package/blockly-rc/core/events/events_ui_base.ts +0 -47
  281. package/blockly-rc/core/events/events_var_base.ts +0 -89
  282. package/blockly-rc/core/events/events_var_create.ts +0 -129
  283. package/blockly-rc/core/events/events_var_delete.ts +0 -124
  284. package/blockly-rc/core/events/events_var_rename.ts +0 -133
  285. package/blockly-rc/core/events/events_var_type_change.ts +0 -122
  286. package/blockly-rc/core/events/events_viewport.ts +0 -149
  287. package/blockly-rc/core/events/utils.ts +0 -595
  288. package/blockly-rc/core/events/workspace_events.ts +0 -46
  289. package/blockly-rc/core/extensions.ts +0 -491
  290. package/blockly-rc/core/field.ts +0 -1471
  291. package/blockly-rc/core/field_checkbox.ts +0 -271
  292. package/blockly-rc/core/field_dropdown.ts +0 -857
  293. package/blockly-rc/core/field_image.ts +0 -297
  294. package/blockly-rc/core/field_input.ts +0 -755
  295. package/blockly-rc/core/field_label.ts +0 -150
  296. package/blockly-rc/core/field_label_serializable.ts +0 -73
  297. package/blockly-rc/core/field_number.ts +0 -381
  298. package/blockly-rc/core/field_registry.ts +0 -115
  299. package/blockly-rc/core/field_textinput.ts +0 -117
  300. package/blockly-rc/core/field_variable.ts +0 -651
  301. package/blockly-rc/core/flyout_base.ts +0 -968
  302. package/blockly-rc/core/flyout_button.ts +0 -416
  303. package/blockly-rc/core/flyout_horizontal.ts +0 -374
  304. package/blockly-rc/core/flyout_metrics_manager.ts +0 -90
  305. package/blockly-rc/core/flyout_separator.ts +0 -61
  306. package/blockly-rc/core/flyout_vertical.ts +0 -353
  307. package/blockly-rc/core/generator.ts +0 -611
  308. package/blockly-rc/core/gesture.ts +0 -1191
  309. package/blockly-rc/core/grid.ts +0 -252
  310. package/blockly-rc/core/icons/comment_icon.ts +0 -435
  311. package/blockly-rc/core/icons/exceptions.ts +0 -23
  312. package/blockly-rc/core/icons/icon.ts +0 -147
  313. package/blockly-rc/core/icons/icon_types.ts +0 -32
  314. package/blockly-rc/core/icons/mutator_icon.ts +0 -354
  315. package/blockly-rc/core/icons/registry.ts +0 -33
  316. package/blockly-rc/core/icons/warning_icon.ts +0 -219
  317. package/blockly-rc/core/icons.ts +0 -24
  318. package/blockly-rc/core/inject.ts +0 -428
  319. package/blockly-rc/core/inputs/align.ts +0 -14
  320. package/blockly-rc/core/inputs/dummy_input.ts +0 -26
  321. package/blockly-rc/core/inputs/end_row_input.ts +0 -31
  322. package/blockly-rc/core/inputs/input.ts +0 -318
  323. package/blockly-rc/core/inputs/input_types.ts +0 -27
  324. package/blockly-rc/core/inputs/statement_input.ts +0 -34
  325. package/blockly-rc/core/inputs/value_input.ts +0 -30
  326. package/blockly-rc/core/inputs.ts +0 -23
  327. package/blockly-rc/core/insertion_marker_manager.ts +0 -742
  328. package/blockly-rc/core/insertion_marker_previewer.ts +0 -254
  329. package/blockly-rc/core/interfaces/i_ast_node_location.ts +0 -12
  330. package/blockly-rc/core/interfaces/i_ast_node_location_svg.ts +0 -28
  331. package/blockly-rc/core/interfaces/i_ast_node_location_with_block.ts +0 -22
  332. package/blockly-rc/core/interfaces/i_autohideable.ts +0 -22
  333. package/blockly-rc/core/interfaces/i_bounded_element.ts +0 -30
  334. package/blockly-rc/core/interfaces/i_bubble.ts +0 -63
  335. package/blockly-rc/core/interfaces/i_collapsible_toolbox_item.ts +0 -33
  336. package/blockly-rc/core/interfaces/i_comment_icon.ts +0 -47
  337. package/blockly-rc/core/interfaces/i_component.ts +0 -19
  338. package/blockly-rc/core/interfaces/i_connection_checker.ts +0 -100
  339. package/blockly-rc/core/interfaces/i_connection_previewer.ts +0 -50
  340. package/blockly-rc/core/interfaces/i_contextmenu.ts +0 -16
  341. package/blockly-rc/core/interfaces/i_copyable.ts +0 -31
  342. package/blockly-rc/core/interfaces/i_deletable.ts +0 -34
  343. package/blockly-rc/core/interfaces/i_delete_area.ts +0 -28
  344. package/blockly-rc/core/interfaces/i_drag_target.ts +0 -69
  345. package/blockly-rc/core/interfaces/i_draggable.ts +0 -72
  346. package/blockly-rc/core/interfaces/i_dragger.ts +0 -35
  347. package/blockly-rc/core/interfaces/i_flyout.ts +0 -189
  348. package/blockly-rc/core/interfaces/i_flyout_inflater.ts +0 -41
  349. package/blockly-rc/core/interfaces/i_has_bubble.ts +0 -20
  350. package/blockly-rc/core/interfaces/i_icon.ts +0 -114
  351. package/blockly-rc/core/interfaces/i_keyboard_accessible.ts +0 -21
  352. package/blockly-rc/core/interfaces/i_legacy_procedure_blocks.ts +0 -50
  353. package/blockly-rc/core/interfaces/i_metrics_manager.ts +0 -149
  354. package/blockly-rc/core/interfaces/i_movable.ts +0 -19
  355. package/blockly-rc/core/interfaces/i_observable.ts +0 -24
  356. package/blockly-rc/core/interfaces/i_parameter_model.ts +0 -51
  357. package/blockly-rc/core/interfaces/i_paster.ts +0 -25
  358. package/blockly-rc/core/interfaces/i_positionable.ts +0 -33
  359. package/blockly-rc/core/interfaces/i_procedure_block.ts +0 -27
  360. package/blockly-rc/core/interfaces/i_procedure_map.ts +0 -18
  361. package/blockly-rc/core/interfaces/i_procedure_model.ts +0 -71
  362. package/blockly-rc/core/interfaces/i_registrable.ts +0 -12
  363. package/blockly-rc/core/interfaces/i_rendered_element.ts +0 -22
  364. package/blockly-rc/core/interfaces/i_selectable.ts +0 -34
  365. package/blockly-rc/core/interfaces/i_selectable_toolbox_item.ts +0 -63
  366. package/blockly-rc/core/interfaces/i_serializable.ts +0 -28
  367. package/blockly-rc/core/interfaces/i_serializer.ts +0 -55
  368. package/blockly-rc/core/interfaces/i_styleable.ts +0 -26
  369. package/blockly-rc/core/interfaces/i_toolbox.ts +0 -112
  370. package/blockly-rc/core/interfaces/i_toolbox_item.ts +0 -81
  371. package/blockly-rc/core/interfaces/i_variable_backed_parameter_model.ts +0 -23
  372. package/blockly-rc/core/interfaces/i_variable_map.ts +0 -65
  373. package/blockly-rc/core/interfaces/i_variable_model.ts +0 -57
  374. package/blockly-rc/core/internal_constants.ts +0 -47
  375. package/blockly-rc/core/keyboard_nav/ast_node.ts +0 -884
  376. package/blockly-rc/core/keyboard_nav/basic_cursor.ts +0 -223
  377. package/blockly-rc/core/keyboard_nav/cursor.ts +0 -138
  378. package/blockly-rc/core/keyboard_nav/marker.ts +0 -113
  379. package/blockly-rc/core/keyboard_nav/tab_navigate_cursor.ts +0 -46
  380. package/blockly-rc/core/label_flyout_inflater.ts +0 -59
  381. package/blockly-rc/core/layer_manager.ts +0 -186
  382. package/blockly-rc/core/layers.ts +0 -17
  383. package/blockly-rc/core/main.ts +0 -31
  384. package/blockly-rc/core/marker_manager.ts +0 -189
  385. package/blockly-rc/core/menu.ts +0 -463
  386. package/blockly-rc/core/menuitem.ts +0 -221
  387. package/blockly-rc/core/metrics_manager.ts +0 -486
  388. package/blockly-rc/core/msg.ts +0 -27
  389. package/blockly-rc/core/names.ts +0 -275
  390. package/blockly-rc/core/observable_procedure_map.ts +0 -66
  391. package/blockly-rc/core/options.ts +0 -377
  392. package/blockly-rc/core/positionable_helpers.ts +0 -186
  393. package/blockly-rc/core/procedures.ts +0 -510
  394. package/blockly-rc/core/registry.ts +0 -400
  395. package/blockly-rc/core/render_management.ts +0 -193
  396. package/blockly-rc/core/rendered_connection.ts +0 -571
  397. package/blockly-rc/core/renderers/common/block_rendering.ts +0 -120
  398. package/blockly-rc/core/renderers/common/constants.ts +0 -1198
  399. package/blockly-rc/core/renderers/common/drawer.ts +0 -518
  400. package/blockly-rc/core/renderers/common/i_path_object.ts +0 -137
  401. package/blockly-rc/core/renderers/common/info.ts +0 -767
  402. package/blockly-rc/core/renderers/common/marker_svg.ts +0 -765
  403. package/blockly-rc/core/renderers/common/path_object.ts +0 -324
  404. package/blockly-rc/core/renderers/common/renderer.ts +0 -281
  405. package/blockly-rc/core/renderers/geras/constants.ts +0 -46
  406. package/blockly-rc/core/renderers/geras/drawer.ts +0 -167
  407. package/blockly-rc/core/renderers/geras/geras.ts +0 -31
  408. package/blockly-rc/core/renderers/geras/highlight_constants.ts +0 -342
  409. package/blockly-rc/core/renderers/geras/highlighter.ts +0 -313
  410. package/blockly-rc/core/renderers/geras/info.ts +0 -478
  411. package/blockly-rc/core/renderers/geras/measurables/inline_input.ts +0 -37
  412. package/blockly-rc/core/renderers/geras/measurables/statement_input.ts +0 -36
  413. package/blockly-rc/core/renderers/geras/path_object.ts +0 -135
  414. package/blockly-rc/core/renderers/geras/renderer.ts +0 -124
  415. package/blockly-rc/core/renderers/measurables/base.ts +0 -41
  416. package/blockly-rc/core/renderers/measurables/bottom_row.ts +0 -104
  417. package/blockly-rc/core/renderers/measurables/connection.ts +0 -43
  418. package/blockly-rc/core/renderers/measurables/external_value_input.ts +0 -53
  419. package/blockly-rc/core/renderers/measurables/field.ts +0 -50
  420. package/blockly-rc/core/renderers/measurables/hat.ts +0 -33
  421. package/blockly-rc/core/renderers/measurables/icon.ts +0 -42
  422. package/blockly-rc/core/renderers/measurables/in_row_spacer.ts +0 -29
  423. package/blockly-rc/core/renderers/measurables/inline_input.ts +0 -63
  424. package/blockly-rc/core/renderers/measurables/input_connection.ts +0 -57
  425. package/blockly-rc/core/renderers/measurables/input_row.ts +0 -67
  426. package/blockly-rc/core/renderers/measurables/jagged_edge.ts +0 -28
  427. package/blockly-rc/core/renderers/measurables/next_connection.ts +0 -34
  428. package/blockly-rc/core/renderers/measurables/output_connection.ts +0 -43
  429. package/blockly-rc/core/renderers/measurables/previous_connection.ts +0 -34
  430. package/blockly-rc/core/renderers/measurables/round_corner.ts +0 -34
  431. package/blockly-rc/core/renderers/measurables/row.ts +0 -191
  432. package/blockly-rc/core/renderers/measurables/spacer_row.ts +0 -44
  433. package/blockly-rc/core/renderers/measurables/square_corner.ts +0 -32
  434. package/blockly-rc/core/renderers/measurables/statement_input.ts +0 -41
  435. package/blockly-rc/core/renderers/measurables/top_row.ts +0 -110
  436. package/blockly-rc/core/renderers/measurables/types.ts +0 -319
  437. package/blockly-rc/core/renderers/thrasos/info.ts +0 -328
  438. package/blockly-rc/core/renderers/thrasos/renderer.ts +0 -40
  439. package/blockly-rc/core/renderers/thrasos/thrasos.ts +0 -14
  440. package/blockly-rc/core/renderers/zelos/constants.ts +0 -877
  441. package/blockly-rc/core/renderers/zelos/drawer.ts +0 -274
  442. package/blockly-rc/core/renderers/zelos/info.ts +0 -652
  443. package/blockly-rc/core/renderers/zelos/marker_svg.ts +0 -145
  444. package/blockly-rc/core/renderers/zelos/measurables/bottom_row.ts +0 -44
  445. package/blockly-rc/core/renderers/zelos/measurables/inputs.ts +0 -41
  446. package/blockly-rc/core/renderers/zelos/measurables/row_elements.ts +0 -29
  447. package/blockly-rc/core/renderers/zelos/measurables/top_row.ts +0 -50
  448. package/blockly-rc/core/renderers/zelos/path_object.ts +0 -209
  449. package/blockly-rc/core/renderers/zelos/renderer.ts +0 -143
  450. package/blockly-rc/core/renderers/zelos/zelos.ts +0 -33
  451. package/blockly-rc/core/scrollbar.ts +0 -898
  452. package/blockly-rc/core/scrollbar_pair.ts +0 -349
  453. package/blockly-rc/core/separator_flyout_inflater.ts +0 -69
  454. package/blockly-rc/core/serialization/blocks.ts +0 -868
  455. package/blockly-rc/core/serialization/exceptions.ts +0 -112
  456. package/blockly-rc/core/serialization/priorities.ts +0 -25
  457. package/blockly-rc/core/serialization/procedures.ts +0 -158
  458. package/blockly-rc/core/serialization/registry.ts +0 -30
  459. package/blockly-rc/core/serialization/variables.ts +0 -68
  460. package/blockly-rc/core/serialization/workspace_comments.ts +0 -143
  461. package/blockly-rc/core/serialization/workspaces.ts +0 -94
  462. package/blockly-rc/core/serialization.ts +0 -32
  463. package/blockly-rc/core/shortcut_items.ts +0 -338
  464. package/blockly-rc/core/shortcut_registry.ts +0 -368
  465. package/blockly-rc/core/sprites.ts +0 -15
  466. package/blockly-rc/core/theme/classic.ts +0 -40
  467. package/blockly-rc/core/theme/themes.ts +0 -12
  468. package/blockly-rc/core/theme/zelos.ts +0 -80
  469. package/blockly-rc/core/theme.ts +0 -232
  470. package/blockly-rc/core/theme_manager.ts +0 -192
  471. package/blockly-rc/core/toolbox/category.ts +0 -739
  472. package/blockly-rc/core/toolbox/collapsible_category.ts +0 -288
  473. package/blockly-rc/core/toolbox/separator.ts +0 -105
  474. package/blockly-rc/core/toolbox/toolbox.ts +0 -1134
  475. package/blockly-rc/core/toolbox/toolbox_item.ts +0 -152
  476. package/blockly-rc/core/tooltip.ts +0 -466
  477. package/blockly-rc/core/touch.ts +0 -155
  478. package/blockly-rc/core/trashcan.ts +0 -748
  479. package/blockly-rc/core/utils/aria.ts +0 -144
  480. package/blockly-rc/core/utils/array.ts +0 -24
  481. package/blockly-rc/core/utils/colour.ts +0 -265
  482. package/blockly-rc/core/utils/coordinate.ts +0 -129
  483. package/blockly-rc/core/utils/deprecation.ts +0 -47
  484. package/blockly-rc/core/utils/dom.ts +0 -356
  485. package/blockly-rc/core/utils/idgenerator.ts +0 -70
  486. package/blockly-rc/core/utils/keycodes.ts +0 -154
  487. package/blockly-rc/core/utils/math.ts +0 -50
  488. package/blockly-rc/core/utils/metrics.ts +0 -86
  489. package/blockly-rc/core/utils/object.ts +0 -28
  490. package/blockly-rc/core/utils/parsing.ts +0 -287
  491. package/blockly-rc/core/utils/rect.ts +0 -69
  492. package/blockly-rc/core/utils/size.ts +0 -62
  493. package/blockly-rc/core/utils/string.ts +0 -289
  494. package/blockly-rc/core/utils/style.ts +0 -219
  495. package/blockly-rc/core/utils/svg.ts +0 -84
  496. package/blockly-rc/core/utils/svg_math.ts +0 -208
  497. package/blockly-rc/core/utils/svg_paths.ts +0 -133
  498. package/blockly-rc/core/utils/toolbox.ts +0 -419
  499. package/blockly-rc/core/utils/useragent.ts +0 -86
  500. package/blockly-rc/core/utils/xml.ts +0 -165
  501. package/blockly-rc/core/utils.ts +0 -59
  502. package/blockly-rc/core/variable_map.ts +0 -437
  503. package/blockly-rc/core/variable_model.ts +0 -149
  504. package/blockly-rc/core/variables.ts +0 -773
  505. package/blockly-rc/core/variables_dynamic.ts +0 -142
  506. package/blockly-rc/core/widgetdiv.ts +0 -319
  507. package/blockly-rc/core/workspace.ts +0 -957
  508. package/blockly-rc/core/workspace_audio.ts +0 -171
  509. package/blockly-rc/core/workspace_dragger.ts +0 -97
  510. package/blockly-rc/core/workspace_svg.ts +0 -2519
  511. package/blockly-rc/core/xml.ts +0 -1133
  512. package/blockly-rc/core/zoom_controls.ts +0 -492
  513. package/blockly-rc/demos/blockfactory/analytics.js +0 -195
  514. package/blockly-rc/demos/blockfactory/app_controller.js +0 -726
  515. package/blockly-rc/demos/blockfactory/block_definition_extractor.js +0 -742
  516. package/blockly-rc/demos/blockfactory/block_exporter_controller.js +0 -311
  517. package/blockly-rc/demos/blockfactory/block_exporter_tools.js +0 -212
  518. package/blockly-rc/demos/blockfactory/block_exporter_view.js +0 -101
  519. package/blockly-rc/demos/blockfactory/block_library_controller.js +0 -325
  520. package/blockly-rc/demos/blockfactory/block_library_storage.js +0 -149
  521. package/blockly-rc/demos/blockfactory/block_library_view.js +0 -178
  522. package/blockly-rc/demos/blockfactory/block_option.js +0 -151
  523. package/blockly-rc/demos/blockfactory/blocks.js +0 -916
  524. package/blockly-rc/demos/blockfactory/cp.css +0 -46
  525. package/blockly-rc/demos/blockfactory/cp.js +0 -179
  526. package/blockly-rc/demos/blockfactory/factory.css +0 -586
  527. package/blockly-rc/demos/blockfactory/factory.js +0 -337
  528. package/blockly-rc/demos/blockfactory/factory_utils.js +0 -1036
  529. package/blockly-rc/demos/blockfactory/icon.png +0 -0
  530. package/blockly-rc/demos/blockfactory/index.html +0 -767
  531. package/blockly-rc/demos/blockfactory/link.png +0 -0
  532. package/blockly-rc/demos/blockfactory/standard_categories.js +0 -384
  533. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_controller.js +0 -1332
  534. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_generator.js +0 -224
  535. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_init.js +0 -541
  536. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_model.js +0 -548
  537. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_view.js +0 -424
  538. package/blockly-rc/demos/code/code.js +0 -626
  539. package/blockly-rc/demos/code/icon.png +0 -0
  540. package/blockly-rc/demos/code/icons.png +0 -0
  541. package/blockly-rc/demos/code/index.html +0 -359
  542. package/blockly-rc/demos/code/msg/ar.js +0 -24
  543. package/blockly-rc/demos/code/msg/be-tarask.js +0 -24
  544. package/blockly-rc/demos/code/msg/br.js +0 -24
  545. package/blockly-rc/demos/code/msg/ca.js +0 -24
  546. package/blockly-rc/demos/code/msg/cs.js +0 -24
  547. package/blockly-rc/demos/code/msg/da.js +0 -24
  548. package/blockly-rc/demos/code/msg/de.js +0 -24
  549. package/blockly-rc/demos/code/msg/el.js +0 -24
  550. package/blockly-rc/demos/code/msg/en.js +0 -24
  551. package/blockly-rc/demos/code/msg/es.js +0 -24
  552. package/blockly-rc/demos/code/msg/et.js +0 -24
  553. package/blockly-rc/demos/code/msg/fa.js +0 -24
  554. package/blockly-rc/demos/code/msg/fr.js +0 -24
  555. package/blockly-rc/demos/code/msg/he.js +0 -24
  556. package/blockly-rc/demos/code/msg/hr.js +0 -24
  557. package/blockly-rc/demos/code/msg/hrx.js +0 -24
  558. package/blockly-rc/demos/code/msg/hu.js +0 -24
  559. package/blockly-rc/demos/code/msg/ia.js +0 -24
  560. package/blockly-rc/demos/code/msg/is.js +0 -24
  561. package/blockly-rc/demos/code/msg/it.js +0 -24
  562. package/blockly-rc/demos/code/msg/ja.js +0 -24
  563. package/blockly-rc/demos/code/msg/kab.js +0 -24
  564. package/blockly-rc/demos/code/msg/ko.js +0 -24
  565. package/blockly-rc/demos/code/msg/mk.js +0 -24
  566. package/blockly-rc/demos/code/msg/ms.js +0 -24
  567. package/blockly-rc/demos/code/msg/nb.js +0 -24
  568. package/blockly-rc/demos/code/msg/nl.js +0 -24
  569. package/blockly-rc/demos/code/msg/oc.js +0 -24
  570. package/blockly-rc/demos/code/msg/pl.js +0 -24
  571. package/blockly-rc/demos/code/msg/pms.js +0 -24
  572. package/blockly-rc/demos/code/msg/pt-br.js +0 -24
  573. package/blockly-rc/demos/code/msg/ro.js +0 -24
  574. package/blockly-rc/demos/code/msg/ru.js +0 -24
  575. package/blockly-rc/demos/code/msg/sc.js +0 -24
  576. package/blockly-rc/demos/code/msg/sk.js +0 -24
  577. package/blockly-rc/demos/code/msg/sr.js +0 -24
  578. package/blockly-rc/demos/code/msg/sv.js +0 -24
  579. package/blockly-rc/demos/code/msg/ta.js +0 -24
  580. package/blockly-rc/demos/code/msg/th.js +0 -24
  581. package/blockly-rc/demos/code/msg/tlh.js +0 -24
  582. package/blockly-rc/demos/code/msg/tr.js +0 -24
  583. package/blockly-rc/demos/code/msg/uk.js +0 -24
  584. package/blockly-rc/demos/code/msg/vi.js +0 -24
  585. package/blockly-rc/demos/code/msg/zh-hans.js +0 -24
  586. package/blockly-rc/demos/code/msg/zh-hant.js +0 -24
  587. package/blockly-rc/demos/code/style.css +0 -184
  588. package/blockly-rc/demos/index.html +0 -68
  589. package/blockly-rc/demos/minimap/icon.png +0 -0
  590. package/blockly-rc/demos/minimap/index.html +0 -91
  591. package/blockly-rc/demos/minimap/minimap.js +0 -302
  592. package/blockly-rc/demos/mobile/README.md +0 -53
  593. package/blockly-rc/demos/mobile/android/README.md +0 -45
  594. package/blockly-rc/demos/mobile/android/app/build.gradle +0 -64
  595. package/blockly-rc/demos/mobile/android/app/proguard-rules.pro +0 -21
  596. package/blockly-rc/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java +0 -26
  597. package/blockly-rc/demos/mobile/android/app/src/main/AndroidManifest.xml +0 -21
  598. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java +0 -40
  599. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java +0 -150
  600. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java +0 -32
  601. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java +0 -18
  602. package/blockly-rc/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -74
  603. package/blockly-rc/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -34
  604. package/blockly-rc/demos/mobile/android/app/src/main/res/layout/activity_main.xml +0 -17
  605. package/blockly-rc/demos/mobile/android/app/src/main/res/layout/js_prompt.xml +0 -37
  606. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  607. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  608. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  609. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  610. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  611. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  612. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  613. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  614. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  615. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  616. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  617. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  618. package/blockly-rc/demos/mobile/android/app/src/main/res/values/colors.xml +0 -6
  619. package/blockly-rc/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml +0 -7
  620. package/blockly-rc/demos/mobile/android/app/src/main/res/values/strings.xml +0 -3
  621. package/blockly-rc/demos/mobile/android/app/src/main/res/values/styles.xml +0 -11
  622. package/blockly-rc/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java +0 -17
  623. package/blockly-rc/demos/mobile/android/build.gradle +0 -27
  624. package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  625. package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  626. package/blockly-rc/demos/mobile/android/gradle.properties +0 -13
  627. package/blockly-rc/demos/mobile/android/gradlew +0 -172
  628. package/blockly-rc/demos/mobile/android/gradlew.bat +0 -84
  629. package/blockly-rc/demos/mobile/android/settings.gradle +0 -1
  630. package/blockly-rc/demos/mobile/html/index.html +0 -31
  631. package/blockly-rc/demos/mobile/html/ln_resources.sh +0 -22
  632. package/blockly-rc/demos/mobile/html/toolbox_standard.js +0 -333
  633. package/blockly-rc/demos/mobile/ios/Blockly WebView/AppDelegate.swift +0 -46
  634. package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
  635. package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json +0 -6
  636. package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard +0 -25
  637. package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard +0 -44
  638. package/blockly-rc/demos/mobile/ios/Blockly WebView/Info.plist +0 -45
  639. package/blockly-rc/demos/mobile/ios/Blockly WebView/ViewController.swift +0 -110
  640. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj +0 -390
  641. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  642. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  643. package/blockly-rc/demos/mobile/ios/cp_resources.sh +0 -21
  644. package/blockly-rc/demos/storage/icon.png +0 -0
  645. package/blockly-rc/demos/storage/index.html +0 -104
  646. package/blockly-rc/generators/dart/dart_generator.ts +0 -321
  647. package/blockly-rc/generators/dart/lists.ts +0 -525
  648. package/blockly-rc/generators/dart/logic.ts +0 -155
  649. package/blockly-rc/generators/dart/loops.ts +0 -217
  650. package/blockly-rc/generators/dart/math.ts +0 -559
  651. package/blockly-rc/generators/dart/procedures.ts +0 -138
  652. package/blockly-rc/generators/dart/text.ts +0 -405
  653. package/blockly-rc/generators/dart/variables.ts +0 -32
  654. package/blockly-rc/generators/dart/variables_dynamic.ts +0 -17
  655. package/blockly-rc/generators/dart.ts +0 -50
  656. package/blockly-rc/generators/javascript/javascript_generator.ts +0 -346
  657. package/blockly-rc/generators/javascript/lists.ts +0 -465
  658. package/blockly-rc/generators/javascript/logic.ts +0 -153
  659. package/blockly-rc/generators/javascript/loops.ts +0 -245
  660. package/blockly-rc/generators/javascript/math.ts +0 -450
  661. package/blockly-rc/generators/javascript/procedures.ts +0 -142
  662. package/blockly-rc/generators/javascript/text.ts +0 -418
  663. package/blockly-rc/generators/javascript/variables.ts +0 -32
  664. package/blockly-rc/generators/javascript/variables_dynamic.ts +0 -17
  665. package/blockly-rc/generators/javascript.ts +0 -46
  666. package/blockly-rc/generators/lua/lists.ts +0 -445
  667. package/blockly-rc/generators/lua/logic.ts +0 -142
  668. package/blockly-rc/generators/lua/loops.ts +0 -192
  669. package/blockly-rc/generators/lua/lua_generator.ts +0 -225
  670. package/blockly-rc/generators/lua/math.ts +0 -473
  671. package/blockly-rc/generators/lua/procedures.ts +0 -144
  672. package/blockly-rc/generators/lua/text.ts +0 -380
  673. package/blockly-rc/generators/lua/variables.ts +0 -31
  674. package/blockly-rc/generators/lua/variables_dynamic.ts +0 -17
  675. package/blockly-rc/generators/lua.ts +0 -44
  676. package/blockly-rc/generators/php/lists.ts +0 -585
  677. package/blockly-rc/generators/php/logic.ts +0 -155
  678. package/blockly-rc/generators/php/loops.ts +0 -218
  679. package/blockly-rc/generators/php/math.ts +0 -408
  680. package/blockly-rc/generators/php/php_generator.ts +0 -320
  681. package/blockly-rc/generators/php/procedures.ts +0 -159
  682. package/blockly-rc/generators/php/text.ts +0 -315
  683. package/blockly-rc/generators/php/variables.ts +0 -32
  684. package/blockly-rc/generators/php/variables_dynamic.ts +0 -17
  685. package/blockly-rc/generators/php.ts +0 -46
  686. package/blockly-rc/generators/python/lists.ts +0 -398
  687. package/blockly-rc/generators/python/logic.ts +0 -148
  688. package/blockly-rc/generators/python/loops.ts +0 -251
  689. package/blockly-rc/generators/python/math.ts +0 -434
  690. package/blockly-rc/generators/python/procedures.ts +0 -159
  691. package/blockly-rc/generators/python/python_generator.ts +0 -355
  692. package/blockly-rc/generators/python/text.ts +0 -338
  693. package/blockly-rc/generators/python/variables.ts +0 -31
  694. package/blockly-rc/generators/python/variables_dynamic.ts +0 -17
  695. package/blockly-rc/generators/python.ts +0 -51
  696. package/blockly-rc/gulpfile.js +0 -54
  697. package/blockly-rc/jsconfig.json +0 -7
  698. package/blockly-rc/media/1x1.gif +0 -0
  699. package/blockly-rc/media/click.mp3 +0 -0
  700. package/blockly-rc/media/click.ogg +0 -0
  701. package/blockly-rc/media/click.wav +0 -0
  702. package/blockly-rc/media/delete-icon.svg +0 -1
  703. package/blockly-rc/media/delete.mp3 +0 -0
  704. package/blockly-rc/media/delete.ogg +0 -0
  705. package/blockly-rc/media/delete.wav +0 -0
  706. package/blockly-rc/media/disconnect.mp3 +0 -0
  707. package/blockly-rc/media/disconnect.ogg +0 -0
  708. package/blockly-rc/media/disconnect.wav +0 -0
  709. package/blockly-rc/media/dropdown-arrow.svg +0 -1
  710. package/blockly-rc/media/foldout-icon.svg +0 -1
  711. package/blockly-rc/media/handclosed.cur +0 -0
  712. package/blockly-rc/media/handdelete.cur +0 -0
  713. package/blockly-rc/media/handopen.cur +0 -0
  714. package/blockly-rc/media/pilcrow.png +0 -0
  715. package/blockly-rc/media/quote0.png +0 -0
  716. package/blockly-rc/media/quote1.png +0 -0
  717. package/blockly-rc/media/resize-handle.svg +0 -3
  718. package/blockly-rc/media/sprites.png +0 -0
  719. package/blockly-rc/media/sprites.svg +0 -74
  720. package/blockly-rc/msg/json/README.md +0 -33
  721. package/blockly-rc/msg/json/ab.json +0 -222
  722. package/blockly-rc/msg/json/ace.json +0 -7
  723. package/blockly-rc/msg/json/af.json +0 -34
  724. package/blockly-rc/msg/json/am.json +0 -30
  725. package/blockly-rc/msg/json/ar.json +0 -355
  726. package/blockly-rc/msg/json/ast.json +0 -10
  727. package/blockly-rc/msg/json/az.json +0 -332
  728. package/blockly-rc/msg/json/ba.json +0 -211
  729. package/blockly-rc/msg/json/bcc.json +0 -290
  730. package/blockly-rc/msg/json/be-tarask.json +0 -334
  731. package/blockly-rc/msg/json/be.json +0 -324
  732. package/blockly-rc/msg/json/bg.json +0 -345
  733. package/blockly-rc/msg/json/bn.json +0 -189
  734. package/blockly-rc/msg/json/br.json +0 -334
  735. package/blockly-rc/msg/json/bs.json +0 -166
  736. package/blockly-rc/msg/json/ca.json +0 -341
  737. package/blockly-rc/msg/json/cdo.json +0 -6
  738. package/blockly-rc/msg/json/ce.json +0 -326
  739. package/blockly-rc/msg/json/constants.json +0 -12
  740. package/blockly-rc/msg/json/cs.json +0 -343
  741. package/blockly-rc/msg/json/da.json +0 -346
  742. package/blockly-rc/msg/json/de.json +0 -369
  743. package/blockly-rc/msg/json/diq.json +0 -258
  744. package/blockly-rc/msg/json/dtp.json +0 -198
  745. package/blockly-rc/msg/json/dty.json +0 -97
  746. package/blockly-rc/msg/json/ee.json +0 -160
  747. package/blockly-rc/msg/json/el.json +0 -356
  748. package/blockly-rc/msg/json/en-gb.json +0 -199
  749. package/blockly-rc/msg/json/en.json +0 -400
  750. package/blockly-rc/msg/json/eo.json +0 -337
  751. package/blockly-rc/msg/json/es.json +0 -358
  752. package/blockly-rc/msg/json/et.json +0 -326
  753. package/blockly-rc/msg/json/eu.json +0 -219
  754. package/blockly-rc/msg/json/fa.json +0 -341
  755. package/blockly-rc/msg/json/fi.json +0 -350
  756. package/blockly-rc/msg/json/fo.json +0 -46
  757. package/blockly-rc/msg/json/fr.json +0 -373
  758. package/blockly-rc/msg/json/frr.json +0 -6
  759. package/blockly-rc/msg/json/gl.json +0 -338
  760. package/blockly-rc/msg/json/gn.json +0 -54
  761. package/blockly-rc/msg/json/gor.json +0 -87
  762. package/blockly-rc/msg/json/ha.json +0 -313
  763. package/blockly-rc/msg/json/hak.json +0 -17
  764. package/blockly-rc/msg/json/he.json +0 -354
  765. package/blockly-rc/msg/json/hi.json +0 -318
  766. package/blockly-rc/msg/json/hr.json +0 -327
  767. package/blockly-rc/msg/json/hrx.json +0 -287
  768. package/blockly-rc/msg/json/hsb.json +0 -128
  769. package/blockly-rc/msg/json/hu.json +0 -349
  770. package/blockly-rc/msg/json/hy.json +0 -337
  771. package/blockly-rc/msg/json/ia.json +0 -337
  772. package/blockly-rc/msg/json/id.json +0 -335
  773. package/blockly-rc/msg/json/ig.json +0 -323
  774. package/blockly-rc/msg/json/inh.json +0 -80
  775. package/blockly-rc/msg/json/is.json +0 -331
  776. package/blockly-rc/msg/json/it.json +0 -346
  777. package/blockly-rc/msg/json/ja.json +0 -361
  778. package/blockly-rc/msg/json/ka.json +0 -14
  779. package/blockly-rc/msg/json/kab.json +0 -323
  780. package/blockly-rc/msg/json/kbd-cyrl.json +0 -84
  781. package/blockly-rc/msg/json/km.json +0 -29
  782. package/blockly-rc/msg/json/kn.json +0 -332
  783. package/blockly-rc/msg/json/ko.json +0 -372
  784. package/blockly-rc/msg/json/ksh.json +0 -43
  785. package/blockly-rc/msg/json/ku-latn.json +0 -41
  786. package/blockly-rc/msg/json/ky.json +0 -71
  787. package/blockly-rc/msg/json/la.json +0 -6
  788. package/blockly-rc/msg/json/lb.json +0 -156
  789. package/blockly-rc/msg/json/lki.json +0 -282
  790. package/blockly-rc/msg/json/lo.json +0 -92
  791. package/blockly-rc/msg/json/lrc.json +0 -123
  792. package/blockly-rc/msg/json/lt.json +0 -321
  793. package/blockly-rc/msg/json/lv.json +0 -324
  794. package/blockly-rc/msg/json/mg.json +0 -58
  795. package/blockly-rc/msg/json/mk.json +0 -178
  796. package/blockly-rc/msg/json/ml.json +0 -35
  797. package/blockly-rc/msg/json/mnw.json +0 -90
  798. package/blockly-rc/msg/json/ms.json +0 -300
  799. package/blockly-rc/msg/json/my.json +0 -57
  800. package/blockly-rc/msg/json/mzn.json +0 -6
  801. package/blockly-rc/msg/json/nb.json +0 -330
  802. package/blockly-rc/msg/json/ne.json +0 -247
  803. package/blockly-rc/msg/json/nl.json +0 -357
  804. package/blockly-rc/msg/json/oc.json +0 -194
  805. package/blockly-rc/msg/json/olo.json +0 -37
  806. package/blockly-rc/msg/json/pa.json +0 -69
  807. package/blockly-rc/msg/json/pl.json +0 -357
  808. package/blockly-rc/msg/json/pms.json +0 -324
  809. package/blockly-rc/msg/json/ps.json +0 -50
  810. package/blockly-rc/msg/json/pt-br.json +0 -369
  811. package/blockly-rc/msg/json/pt.json +0 -358
  812. package/blockly-rc/msg/json/qqq.json +0 -406
  813. package/blockly-rc/msg/json/ro.json +0 -333
  814. package/blockly-rc/msg/json/ru.json +0 -363
  815. package/blockly-rc/msg/json/sc.json +0 -283
  816. package/blockly-rc/msg/json/sco.json +0 -11
  817. package/blockly-rc/msg/json/sd.json +0 -158
  818. package/blockly-rc/msg/json/shn.json +0 -109
  819. package/blockly-rc/msg/json/si.json +0 -16
  820. package/blockly-rc/msg/json/sk.json +0 -332
  821. package/blockly-rc/msg/json/skr-arab.json +0 -117
  822. package/blockly-rc/msg/json/sl.json +0 -355
  823. package/blockly-rc/msg/json/smn.json +0 -133
  824. package/blockly-rc/msg/json/sq.json +0 -343
  825. package/blockly-rc/msg/json/sr-latn.json +0 -324
  826. package/blockly-rc/msg/json/sr.json +0 -348
  827. package/blockly-rc/msg/json/sv.json +0 -347
  828. package/blockly-rc/msg/json/sw.json +0 -12
  829. package/blockly-rc/msg/json/synonyms.json +0 -22
  830. package/blockly-rc/msg/json/ta.json +0 -306
  831. package/blockly-rc/msg/json/tcy.json +0 -316
  832. package/blockly-rc/msg/json/tdd.json +0 -109
  833. package/blockly-rc/msg/json/te.json +0 -101
  834. package/blockly-rc/msg/json/th.json +0 -333
  835. package/blockly-rc/msg/json/ti.json +0 -50
  836. package/blockly-rc/msg/json/tl.json +0 -129
  837. package/blockly-rc/msg/json/tlh.json +0 -179
  838. package/blockly-rc/msg/json/tr.json +0 -369
  839. package/blockly-rc/msg/json/ug-arab.json +0 -132
  840. package/blockly-rc/msg/json/uk.json +0 -345
  841. package/blockly-rc/msg/json/ur.json +0 -117
  842. package/blockly-rc/msg/json/uz.json +0 -36
  843. package/blockly-rc/msg/json/vi.json +0 -345
  844. package/blockly-rc/msg/json/xmf.json +0 -96
  845. package/blockly-rc/msg/json/yo.json +0 -316
  846. package/blockly-rc/msg/json/zgh.json +0 -83
  847. package/blockly-rc/msg/json/zh-hans.json +0 -372
  848. package/blockly-rc/msg/json/zh-hant.json +0 -362
  849. package/blockly-rc/msg/messages.js +0 -1616
  850. package/blockly-rc/package-lock.json +0 -12324
  851. package/blockly-rc/package.json +0 -149
  852. package/blockly-rc/patches/@microsoft+api-documenter+7.22.4.patch +0 -81
  853. package/blockly-rc/scripts/goog_module/convert-file.sh +0 -406
  854. package/blockly-rc/scripts/gulpfiles/appengine_tasks.js +0 -195
  855. package/blockly-rc/scripts/gulpfiles/build_tasks.js +0 -752
  856. package/blockly-rc/scripts/gulpfiles/config.js +0 -41
  857. package/blockly-rc/scripts/gulpfiles/docs_tasks.js +0 -147
  858. package/blockly-rc/scripts/gulpfiles/git_tasks.js +0 -181
  859. package/blockly-rc/scripts/gulpfiles/helper_tasks.js +0 -19
  860. package/blockly-rc/scripts/gulpfiles/package_tasks.js +0 -262
  861. package/blockly-rc/scripts/gulpfiles/release_tasks.js +0 -183
  862. package/blockly-rc/scripts/gulpfiles/test_tasks.js +0 -405
  863. package/blockly-rc/scripts/helpers.js +0 -74
  864. package/blockly-rc/scripts/i18n/common.py +0 -233
  865. package/blockly-rc/scripts/i18n/create_messages.py +0 -167
  866. package/blockly-rc/scripts/i18n/dedup_json.py +0 -72
  867. package/blockly-rc/scripts/i18n/js_to_json.py +0 -135
  868. package/blockly-rc/scripts/i18n/tests.py +0 -46
  869. package/blockly-rc/scripts/migration/cjs2esm +0 -162
  870. package/blockly-rc/scripts/migration/js2ts +0 -168
  871. package/blockly-rc/scripts/migration/renamings.json5 +0 -1599
  872. package/blockly-rc/scripts/package/README.md +0 -93
  873. package/blockly-rc/scripts/package/core-node.js +0 -31
  874. package/blockly-rc/scripts/package/index.js +0 -23
  875. package/blockly-rc/scripts/package/templates/umd-msg.template +0 -16
  876. package/blockly-rc/scripts/package/templates/umd.template +0 -13
  877. package/blockly-rc/scripts/themes/blockStyles_example.json +0 -11
  878. package/blockly-rc/scripts/themes/create_blockStyles.py +0 -181
  879. package/blockly-rc/scripts/tsick.js +0 -86
  880. package/blockly-rc/tests/.eslintrc.json +0 -10
  881. package/blockly-rc/tests/browser/.eslintrc.json +0 -29
  882. package/blockly-rc/tests/browser/.mocharc.js +0 -6
  883. package/blockly-rc/tests/browser/test/basic_block_factory_test.mjs +0 -44
  884. package/blockly-rc/tests/browser/test/basic_block_test.mjs +0 -39
  885. package/blockly-rc/tests/browser/test/basic_playground_test.mjs +0 -198
  886. package/blockly-rc/tests/browser/test/block_undo_test.mjs +0 -50
  887. package/blockly-rc/tests/browser/test/delete_blocks_test.mjs +0 -211
  888. package/blockly-rc/tests/browser/test/extensive_test.mjs +0 -195
  889. package/blockly-rc/tests/browser/test/field_edits_test.mjs +0 -61
  890. package/blockly-rc/tests/browser/test/hooks.mjs +0 -23
  891. package/blockly-rc/tests/browser/test/mutator_test.mjs +0 -88
  892. package/blockly-rc/tests/browser/test/procedure_test.mjs +0 -109
  893. package/blockly-rc/tests/browser/test/test_setup.mjs +0 -589
  894. package/blockly-rc/tests/browser/test/toolbox_drag_test.mjs +0 -207
  895. package/blockly-rc/tests/browser/test/workspace_comment_test.mjs +0 -224
  896. package/blockly-rc/tests/compile/index.html +0 -43
  897. package/blockly-rc/tests/compile/main.js +0 -53
  898. package/blockly-rc/tests/compile/test_blocks.js +0 -47
  899. package/blockly-rc/tests/compile/webdriver.js +0 -81
  900. package/blockly-rc/tests/generators/functions.xml +0 -561
  901. package/blockly-rc/tests/generators/golden/generated.dart +0 -1604
  902. package/blockly-rc/tests/generators/golden/generated.js +0 -1552
  903. package/blockly-rc/tests/generators/golden/generated.lua +0 -1828
  904. package/blockly-rc/tests/generators/golden/generated.php +0 -1611
  905. package/blockly-rc/tests/generators/golden/generated.py +0 -1407
  906. package/blockly-rc/tests/generators/index.html +0 -405
  907. package/blockly-rc/tests/generators/lists.xml +0 -8675
  908. package/blockly-rc/tests/generators/logic.xml +0 -1019
  909. package/blockly-rc/tests/generators/loops1.xml +0 -345
  910. package/blockly-rc/tests/generators/loops2.xml +0 -891
  911. package/blockly-rc/tests/generators/loops3.xml +0 -735
  912. package/blockly-rc/tests/generators/math.xml +0 -2077
  913. package/blockly-rc/tests/generators/text.xml +0 -4651
  914. package/blockly-rc/tests/generators/unittest.js +0 -103
  915. package/blockly-rc/tests/generators/unittest_dart.js +0 -163
  916. package/blockly-rc/tests/generators/unittest_javascript.js +0 -167
  917. package/blockly-rc/tests/generators/unittest_lua.js +0 -165
  918. package/blockly-rc/tests/generators/unittest_php.js +0 -154
  919. package/blockly-rc/tests/generators/unittest_python.js +0 -138
  920. package/blockly-rc/tests/generators/variables.xml +0 -68
  921. package/blockly-rc/tests/generators/webdriver.js +0 -123
  922. package/blockly-rc/tests/media/200px.png +0 -0
  923. package/blockly-rc/tests/media/30px.png +0 -0
  924. package/blockly-rc/tests/media/50px.png +0 -0
  925. package/blockly-rc/tests/media/a.png +0 -0
  926. package/blockly-rc/tests/media/arrow.png +0 -0
  927. package/blockly-rc/tests/media/b.png +0 -0
  928. package/blockly-rc/tests/media/c.png +0 -0
  929. package/blockly-rc/tests/media/d.png +0 -0
  930. package/blockly-rc/tests/media/e.png +0 -0
  931. package/blockly-rc/tests/media/f.png +0 -0
  932. package/blockly-rc/tests/media/g.png +0 -0
  933. package/blockly-rc/tests/media/h.png +0 -0
  934. package/blockly-rc/tests/media/i.png +0 -0
  935. package/blockly-rc/tests/media/j.png +0 -0
  936. package/blockly-rc/tests/media/k.png +0 -0
  937. package/blockly-rc/tests/media/l.png +0 -0
  938. package/blockly-rc/tests/media/m.png +0 -0
  939. package/blockly-rc/tests/migration/renamings.schema.json +0 -59
  940. package/blockly-rc/tests/migration/validate-renamings.mjs +0 -60
  941. package/blockly-rc/tests/mocha/.eslintrc.json +0 -21
  942. package/blockly-rc/tests/mocha/.mocharc.js +0 -6
  943. package/blockly-rc/tests/mocha/astnode_test.js +0 -850
  944. package/blockly-rc/tests/mocha/block_json_test.js +0 -777
  945. package/blockly-rc/tests/mocha/block_test.js +0 -2743
  946. package/blockly-rc/tests/mocha/blocks/lists_test.js +0 -196
  947. package/blockly-rc/tests/mocha/blocks/logic_ternary_test.js +0 -320
  948. package/blockly-rc/tests/mocha/blocks/loops_test.js +0 -56
  949. package/blockly-rc/tests/mocha/blocks/procedures_test.js +0 -2495
  950. package/blockly-rc/tests/mocha/blocks/variables_test.js +0 -311
  951. package/blockly-rc/tests/mocha/clipboard_test.js +0 -136
  952. package/blockly-rc/tests/mocha/comment_deserialization_test.js +0 -122
  953. package/blockly-rc/tests/mocha/comment_test.js +0 -170
  954. package/blockly-rc/tests/mocha/comment_view_test.js +0 -188
  955. package/blockly-rc/tests/mocha/connection_checker_test.js +0 -666
  956. package/blockly-rc/tests/mocha/connection_db_test.js +0 -362
  957. package/blockly-rc/tests/mocha/connection_test.js +0 -3738
  958. package/blockly-rc/tests/mocha/contextmenu_items_test.js +0 -488
  959. package/blockly-rc/tests/mocha/contextmenu_test.js +0 -71
  960. package/blockly-rc/tests/mocha/cursor_test.js +0 -134
  961. package/blockly-rc/tests/mocha/dropdowndiv_test.js +0 -116
  962. package/blockly-rc/tests/mocha/event_block_change_test.js +0 -126
  963. package/blockly-rc/tests/mocha/event_block_create_test.js +0 -109
  964. package/blockly-rc/tests/mocha/event_block_delete_test.js +0 -55
  965. package/blockly-rc/tests/mocha/event_block_drag_test.js +0 -36
  966. package/blockly-rc/tests/mocha/event_block_field_intermediate_change_test.js +0 -67
  967. package/blockly-rc/tests/mocha/event_block_move_test.js +0 -39
  968. package/blockly-rc/tests/mocha/event_bubble_open_test.js +0 -42
  969. package/blockly-rc/tests/mocha/event_click_test.js +0 -40
  970. package/blockly-rc/tests/mocha/event_comment_change_test.js +0 -39
  971. package/blockly-rc/tests/mocha/event_comment_collapse_test.js +0 -34
  972. package/blockly-rc/tests/mocha/event_comment_create_test.js +0 -38
  973. package/blockly-rc/tests/mocha/event_comment_delete_test.js +0 -38
  974. package/blockly-rc/tests/mocha/event_comment_drag_test.js +0 -35
  975. package/blockly-rc/tests/mocha/event_comment_move_test.js +0 -40
  976. package/blockly-rc/tests/mocha/event_comment_resize_test.js +0 -38
  977. package/blockly-rc/tests/mocha/event_marker_move_test.js +0 -44
  978. package/blockly-rc/tests/mocha/event_selected_test.js +0 -41
  979. package/blockly-rc/tests/mocha/event_test.js +0 -1578
  980. package/blockly-rc/tests/mocha/event_theme_change_test.js +0 -36
  981. package/blockly-rc/tests/mocha/event_toolbox_item_select_test.js +0 -64
  982. package/blockly-rc/tests/mocha/event_trashcan_open_test.js +0 -36
  983. package/blockly-rc/tests/mocha/event_var_create_test.js +0 -54
  984. package/blockly-rc/tests/mocha/event_var_delete_test.js +0 -54
  985. package/blockly-rc/tests/mocha/event_var_rename_test.js +0 -39
  986. package/blockly-rc/tests/mocha/event_var_type_change_test.js +0 -43
  987. package/blockly-rc/tests/mocha/event_viewport_test.js +0 -39
  988. package/blockly-rc/tests/mocha/extensions_test.js +0 -613
  989. package/blockly-rc/tests/mocha/field_checkbox_test.js +0 -299
  990. package/blockly-rc/tests/mocha/field_colour_test.js +0 -395
  991. package/blockly-rc/tests/mocha/field_dropdown_test.js +0 -282
  992. package/blockly-rc/tests/mocha/field_image_test.js +0 -241
  993. package/blockly-rc/tests/mocha/field_label_serializable_test.js +0 -252
  994. package/blockly-rc/tests/mocha/field_label_test.js +0 -226
  995. package/blockly-rc/tests/mocha/field_number_test.js +0 -505
  996. package/blockly-rc/tests/mocha/field_registry_test.js +0 -116
  997. package/blockly-rc/tests/mocha/field_test.js +0 -822
  998. package/blockly-rc/tests/mocha/field_textinput_test.js +0 -297
  999. package/blockly-rc/tests/mocha/field_variable_test.js +0 -611
  1000. package/blockly-rc/tests/mocha/flyout_test.js +0 -638
  1001. package/blockly-rc/tests/mocha/generator_test.js +0 -233
  1002. package/blockly-rc/tests/mocha/gesture_test.js +0 -97
  1003. package/blockly-rc/tests/mocha/icon_test.js +0 -369
  1004. package/blockly-rc/tests/mocha/index.html +0 -229
  1005. package/blockly-rc/tests/mocha/input_test.js +0 -296
  1006. package/blockly-rc/tests/mocha/insertion_marker_manager_test.js +0 -443
  1007. package/blockly-rc/tests/mocha/insertion_marker_test.js +0 -432
  1008. package/blockly-rc/tests/mocha/jso_deserialization_test.js +0 -849
  1009. package/blockly-rc/tests/mocha/jso_serialization_test.js +0 -1067
  1010. package/blockly-rc/tests/mocha/json_test.js +0 -315
  1011. package/blockly-rc/tests/mocha/keydown_test.js +0 -364
  1012. package/blockly-rc/tests/mocha/layering_test.js +0 -95
  1013. package/blockly-rc/tests/mocha/metrics_test.js +0 -671
  1014. package/blockly-rc/tests/mocha/mutator_test.js +0 -87
  1015. package/blockly-rc/tests/mocha/names_test.js +0 -97
  1016. package/blockly-rc/tests/mocha/old_workspace_comment_test.js +0 -256
  1017. package/blockly-rc/tests/mocha/procedure_map_test.js +0 -57
  1018. package/blockly-rc/tests/mocha/registry_test.js +0 -281
  1019. package/blockly-rc/tests/mocha/render_management_test.js +0 -127
  1020. package/blockly-rc/tests/mocha/serializer_test.js +0 -2104
  1021. package/blockly-rc/tests/mocha/shortcut_registry_test.js +0 -450
  1022. package/blockly-rc/tests/mocha/test_helpers/block_definitions.js +0 -204
  1023. package/blockly-rc/tests/mocha/test_helpers/code_generation.js +0 -115
  1024. package/blockly-rc/tests/mocha/test_helpers/common.js +0 -106
  1025. package/blockly-rc/tests/mocha/test_helpers/events.js +0 -290
  1026. package/blockly-rc/tests/mocha/test_helpers/fields.js +0 -310
  1027. package/blockly-rc/tests/mocha/test_helpers/icon_mocks.js +0 -81
  1028. package/blockly-rc/tests/mocha/test_helpers/procedures.js +0 -302
  1029. package/blockly-rc/tests/mocha/test_helpers/serialization.js +0 -124
  1030. package/blockly-rc/tests/mocha/test_helpers/setup_teardown.js +0 -209
  1031. package/blockly-rc/tests/mocha/test_helpers/toolbox_definitions.js +0 -271
  1032. package/blockly-rc/tests/mocha/test_helpers/user_input.js +0 -62
  1033. package/blockly-rc/tests/mocha/test_helpers/variables.js +0 -23
  1034. package/blockly-rc/tests/mocha/test_helpers/warnings.js +0 -83
  1035. package/blockly-rc/tests/mocha/test_helpers/workspace.js +0 -1691
  1036. package/blockly-rc/tests/mocha/theme_test.js +0 -307
  1037. package/blockly-rc/tests/mocha/toolbox_test.js +0 -761
  1038. package/blockly-rc/tests/mocha/tooltip_test.js +0 -276
  1039. package/blockly-rc/tests/mocha/touch_test.js +0 -109
  1040. package/blockly-rc/tests/mocha/trashcan_test.js +0 -375
  1041. package/blockly-rc/tests/mocha/utils_test.js +0 -536
  1042. package/blockly-rc/tests/mocha/variable_map_test.js +0 -509
  1043. package/blockly-rc/tests/mocha/variable_model_test.js +0 -85
  1044. package/blockly-rc/tests/mocha/webdriver.js +0 -96
  1045. package/blockly-rc/tests/mocha/widget_div_test.js +0 -272
  1046. package/blockly-rc/tests/mocha/workspace_comment_test.js +0 -171
  1047. package/blockly-rc/tests/mocha/workspace_svg_test.js +0 -414
  1048. package/blockly-rc/tests/mocha/workspace_test.js +0 -27
  1049. package/blockly-rc/tests/mocha/xml_test.js +0 -951
  1050. package/blockly-rc/tests/mocha/zoom_controls_test.js +0 -81
  1051. package/blockly-rc/tests/multi_playground.html +0 -482
  1052. package/blockly-rc/tests/node/.eslintrc.json +0 -12
  1053. package/blockly-rc/tests/node/.mocharc.js +0 -6
  1054. package/blockly-rc/tests/node/run_node_test.mjs +0 -72
  1055. package/blockly-rc/tests/playground.html +0 -1280
  1056. package/blockly-rc/tests/playgrounds/advanced_playground.html +0 -158
  1057. package/blockly-rc/tests/playgrounds/iframe.html +0 -40
  1058. package/blockly-rc/tests/playgrounds/screenshot.js +0 -123
  1059. package/blockly-rc/tests/scripts/check_metadata.sh +0 -166
  1060. package/blockly-rc/tests/scripts/compile_typings.sh +0 -32
  1061. package/blockly-rc/tests/scripts/load.mjs +0 -140
  1062. package/blockly-rc/tests/scripts/setup_linux_env.sh +0 -7
  1063. package/blockly-rc/tests/scripts/update_metadata.sh +0 -46
  1064. package/blockly-rc/tests/themes/test_themes.js +0 -62
  1065. package/blockly-rc/tests/typescript/README.md +0 -4
  1066. package/blockly-rc/tests/typescript/src/field/different_user_input.ts +0 -81
  1067. package/blockly-rc/tests/typescript/src/generators/dart.ts +0 -24
  1068. package/blockly-rc/tests/typescript/src/generators/javascript.ts +0 -28
  1069. package/blockly-rc/tests/typescript/src/generators/lua.ts +0 -24
  1070. package/blockly-rc/tests/typescript/src/generators/php.ts +0 -24
  1071. package/blockly-rc/tests/typescript/src/generators/python.ts +0 -24
  1072. package/blockly-rc/tests/typescript/src/generators.ts +0 -31
  1073. package/blockly-rc/tests/typescript/src/msg.ts +0 -20
  1074. package/blockly-rc/tests/typescript/tsconfig.json +0 -20
  1075. package/blockly-rc/tests/xml/README.txt +0 -11
  1076. package/blockly-rc/tests/xml/blockly.xsd +0 -178
  1077. package/blockly-rc/tests/xml/invalid.xml +0 -6
  1078. package/blockly-rc/tests/xml/toolbox.xml +0 -311
  1079. package/blockly-rc/tests/xml/workspace.xml +0 -114
  1080. package/blockly-rc/tsconfig.json +0 -37
  1081. package/blockly-rc/tsdoc.json +0 -35
  1082. package/blockly-rc/typings/README.md +0 -5
  1083. package/blockly-rc/typings/blocks.d.ts +0 -17
  1084. package/blockly-rc/typings/core.d.ts +0 -7
  1085. package/blockly-rc/typings/dart.d.ts +0 -7
  1086. package/blockly-rc/typings/index.d.ts +0 -10
  1087. package/blockly-rc/typings/javascript.d.ts +0 -7
  1088. package/blockly-rc/typings/lua.d.ts +0 -7
  1089. package/blockly-rc/typings/msg/ab.d.ts +0 -8
  1090. package/blockly-rc/typings/msg/ace.d.ts +0 -8
  1091. package/blockly-rc/typings/msg/af.d.ts +0 -8
  1092. package/blockly-rc/typings/msg/am.d.ts +0 -8
  1093. package/blockly-rc/typings/msg/ar.d.ts +0 -8
  1094. package/blockly-rc/typings/msg/ast.d.ts +0 -8
  1095. package/blockly-rc/typings/msg/az.d.ts +0 -8
  1096. package/blockly-rc/typings/msg/ba.d.ts +0 -8
  1097. package/blockly-rc/typings/msg/bcc.d.ts +0 -8
  1098. package/blockly-rc/typings/msg/be-tarask.d.ts +0 -8
  1099. package/blockly-rc/typings/msg/be.d.ts +0 -8
  1100. package/blockly-rc/typings/msg/bg.d.ts +0 -8
  1101. package/blockly-rc/typings/msg/bn.d.ts +0 -8
  1102. package/blockly-rc/typings/msg/br.d.ts +0 -8
  1103. package/blockly-rc/typings/msg/bs.d.ts +0 -8
  1104. package/blockly-rc/typings/msg/ca.d.ts +0 -8
  1105. package/blockly-rc/typings/msg/cdo.d.ts +0 -8
  1106. package/blockly-rc/typings/msg/ce.d.ts +0 -8
  1107. package/blockly-rc/typings/msg/cs.d.ts +0 -8
  1108. package/blockly-rc/typings/msg/da.d.ts +0 -8
  1109. package/blockly-rc/typings/msg/de.d.ts +0 -8
  1110. package/blockly-rc/typings/msg/diq.d.ts +0 -8
  1111. package/blockly-rc/typings/msg/dtp.d.ts +0 -8
  1112. package/blockly-rc/typings/msg/dty.d.ts +0 -8
  1113. package/blockly-rc/typings/msg/ee.d.ts +0 -8
  1114. package/blockly-rc/typings/msg/el.d.ts +0 -8
  1115. package/blockly-rc/typings/msg/en-gb.d.ts +0 -8
  1116. package/blockly-rc/typings/msg/en.d.ts +0 -8
  1117. package/blockly-rc/typings/msg/eo.d.ts +0 -8
  1118. package/blockly-rc/typings/msg/es.d.ts +0 -8
  1119. package/blockly-rc/typings/msg/et.d.ts +0 -8
  1120. package/blockly-rc/typings/msg/eu.d.ts +0 -8
  1121. package/blockly-rc/typings/msg/fa.d.ts +0 -8
  1122. package/blockly-rc/typings/msg/fi.d.ts +0 -8
  1123. package/blockly-rc/typings/msg/fo.d.ts +0 -8
  1124. package/blockly-rc/typings/msg/fr.d.ts +0 -8
  1125. package/blockly-rc/typings/msg/frr.d.ts +0 -8
  1126. package/blockly-rc/typings/msg/gl.d.ts +0 -8
  1127. package/blockly-rc/typings/msg/gn.d.ts +0 -8
  1128. package/blockly-rc/typings/msg/gor.d.ts +0 -8
  1129. package/blockly-rc/typings/msg/ha.d.ts +0 -8
  1130. package/blockly-rc/typings/msg/hak.d.ts +0 -8
  1131. package/blockly-rc/typings/msg/he.d.ts +0 -8
  1132. package/blockly-rc/typings/msg/hi.d.ts +0 -8
  1133. package/blockly-rc/typings/msg/hr.d.ts +0 -8
  1134. package/blockly-rc/typings/msg/hrx.d.ts +0 -8
  1135. package/blockly-rc/typings/msg/hsb.d.ts +0 -8
  1136. package/blockly-rc/typings/msg/hu.d.ts +0 -8
  1137. package/blockly-rc/typings/msg/hy.d.ts +0 -8
  1138. package/blockly-rc/typings/msg/ia.d.ts +0 -8
  1139. package/blockly-rc/typings/msg/id.d.ts +0 -8
  1140. package/blockly-rc/typings/msg/ig.d.ts +0 -8
  1141. package/blockly-rc/typings/msg/inh.d.ts +0 -8
  1142. package/blockly-rc/typings/msg/is.d.ts +0 -8
  1143. package/blockly-rc/typings/msg/it.d.ts +0 -8
  1144. package/blockly-rc/typings/msg/ja.d.ts +0 -8
  1145. package/blockly-rc/typings/msg/ka.d.ts +0 -8
  1146. package/blockly-rc/typings/msg/kab.d.ts +0 -8
  1147. package/blockly-rc/typings/msg/kbd-cyrl.d.ts +0 -8
  1148. package/blockly-rc/typings/msg/km.d.ts +0 -8
  1149. package/blockly-rc/typings/msg/kn.d.ts +0 -8
  1150. package/blockly-rc/typings/msg/ko.d.ts +0 -8
  1151. package/blockly-rc/typings/msg/ksh.d.ts +0 -8
  1152. package/blockly-rc/typings/msg/ku-latn.d.ts +0 -8
  1153. package/blockly-rc/typings/msg/ky.d.ts +0 -8
  1154. package/blockly-rc/typings/msg/la.d.ts +0 -8
  1155. package/blockly-rc/typings/msg/lb.d.ts +0 -8
  1156. package/blockly-rc/typings/msg/lki.d.ts +0 -8
  1157. package/blockly-rc/typings/msg/lo.d.ts +0 -8
  1158. package/blockly-rc/typings/msg/lrc.d.ts +0 -8
  1159. package/blockly-rc/typings/msg/lt.d.ts +0 -8
  1160. package/blockly-rc/typings/msg/lv.d.ts +0 -8
  1161. package/blockly-rc/typings/msg/mg.d.ts +0 -8
  1162. package/blockly-rc/typings/msg/mk.d.ts +0 -8
  1163. package/blockly-rc/typings/msg/ml.d.ts +0 -8
  1164. package/blockly-rc/typings/msg/mnw.d.ts +0 -8
  1165. package/blockly-rc/typings/msg/ms.d.ts +0 -8
  1166. package/blockly-rc/typings/msg/msg.d.ts +0 -440
  1167. package/blockly-rc/typings/msg/my.d.ts +0 -8
  1168. package/blockly-rc/typings/msg/mzn.d.ts +0 -8
  1169. package/blockly-rc/typings/msg/nb.d.ts +0 -8
  1170. package/blockly-rc/typings/msg/ne.d.ts +0 -8
  1171. package/blockly-rc/typings/msg/nl.d.ts +0 -8
  1172. package/blockly-rc/typings/msg/oc.d.ts +0 -8
  1173. package/blockly-rc/typings/msg/olo.d.ts +0 -8
  1174. package/blockly-rc/typings/msg/pa.d.ts +0 -8
  1175. package/blockly-rc/typings/msg/pl.d.ts +0 -8
  1176. package/blockly-rc/typings/msg/pms.d.ts +0 -8
  1177. package/blockly-rc/typings/msg/ps.d.ts +0 -8
  1178. package/blockly-rc/typings/msg/pt-br.d.ts +0 -8
  1179. package/blockly-rc/typings/msg/pt.d.ts +0 -8
  1180. package/blockly-rc/typings/msg/ro.d.ts +0 -8
  1181. package/blockly-rc/typings/msg/ru.d.ts +0 -8
  1182. package/blockly-rc/typings/msg/sc.d.ts +0 -8
  1183. package/blockly-rc/typings/msg/sco.d.ts +0 -8
  1184. package/blockly-rc/typings/msg/sd.d.ts +0 -8
  1185. package/blockly-rc/typings/msg/shn.d.ts +0 -8
  1186. package/blockly-rc/typings/msg/si.d.ts +0 -8
  1187. package/blockly-rc/typings/msg/sk.d.ts +0 -8
  1188. package/blockly-rc/typings/msg/skr-arab.d.ts +0 -8
  1189. package/blockly-rc/typings/msg/sl.d.ts +0 -8
  1190. package/blockly-rc/typings/msg/smn.d.ts +0 -8
  1191. package/blockly-rc/typings/msg/sq.d.ts +0 -8
  1192. package/blockly-rc/typings/msg/sr-latn.d.ts +0 -8
  1193. package/blockly-rc/typings/msg/sr.d.ts +0 -8
  1194. package/blockly-rc/typings/msg/sv.d.ts +0 -8
  1195. package/blockly-rc/typings/msg/sw.d.ts +0 -8
  1196. package/blockly-rc/typings/msg/ta.d.ts +0 -8
  1197. package/blockly-rc/typings/msg/tcy.d.ts +0 -8
  1198. package/blockly-rc/typings/msg/tdd.d.ts +0 -8
  1199. package/blockly-rc/typings/msg/te.d.ts +0 -8
  1200. package/blockly-rc/typings/msg/th.d.ts +0 -8
  1201. package/blockly-rc/typings/msg/ti.d.ts +0 -8
  1202. package/blockly-rc/typings/msg/tl.d.ts +0 -8
  1203. package/blockly-rc/typings/msg/tlh.d.ts +0 -8
  1204. package/blockly-rc/typings/msg/tr.d.ts +0 -8
  1205. package/blockly-rc/typings/msg/ug-arab.d.ts +0 -8
  1206. package/blockly-rc/typings/msg/uk.d.ts +0 -8
  1207. package/blockly-rc/typings/msg/ur.d.ts +0 -8
  1208. package/blockly-rc/typings/msg/uz.d.ts +0 -8
  1209. package/blockly-rc/typings/msg/vi.d.ts +0 -8
  1210. package/blockly-rc/typings/msg/xmf.d.ts +0 -8
  1211. package/blockly-rc/typings/msg/yo.d.ts +0 -8
  1212. package/blockly-rc/typings/msg/zgh.d.ts +0 -8
  1213. package/blockly-rc/typings/msg/zh-hans.d.ts +0 -8
  1214. package/blockly-rc/typings/msg/zh-hant.d.ts +0 -8
  1215. package/blockly-rc/typings/php.d.ts +0 -7
  1216. package/blockly-rc/typings/python.d.ts +0 -7
  1217. package/blockly-rc/typings/templates/blockly-header.template +0 -11
  1218. package/blockly-rc/typings/templates/blockly-interfaces.template +0 -83
  1219. package/blockly-rc/typings/templates/msg.template +0 -15
  1220. package/blockly-rc/typings/tsconfig.json +0 -23
  1221. package/continuous-toolbox.d.ts +0 -1
  1222. package/dist/main.js +0 -2
  1223. package/dist/main.js.LICENSE.txt +0 -163
  1224. package/media/delete-icon.svg +0 -10
  1225. package/media/resize-handle.svg +0 -3
  1226. package/src/block_reporting.js +0 -31
  1227. package/src/blocks/colour.js +0 -56
  1228. package/src/blocks/control.js +0 -492
  1229. package/src/blocks/data.js +0 -690
  1230. package/src/blocks/event.js +0 -305
  1231. package/src/blocks/looks.js +0 -537
  1232. package/src/blocks/math.js +0 -137
  1233. package/src/blocks/matrix.js +0 -47
  1234. package/src/blocks/motion.js +0 -513
  1235. package/src/blocks/note.js +0 -48
  1236. package/src/blocks/operators.js +0 -463
  1237. package/src/blocks/procedures.js +0 -1009
  1238. package/src/blocks/sensing.js +0 -441
  1239. package/src/blocks/sound.js +0 -205
  1240. package/src/blocks/text.js +0 -45
  1241. package/src/blocks/vertical_extensions.js +0 -309
  1242. package/src/categories.js +0 -15
  1243. package/src/checkable_continuous_flyout.js +0 -138
  1244. package/src/checkbox_bubble.js +0 -282
  1245. package/src/colours.js +0 -77
  1246. package/src/constants.js +0 -63
  1247. package/src/context_menu_items.js +0 -150
  1248. package/src/css.js +0 -1197
  1249. package/src/data_category.js +0 -556
  1250. package/src/events/events_block_comment_base.js +0 -35
  1251. package/src/events/events_block_comment_change.js +0 -43
  1252. package/src/events/events_block_comment_collapse.js +0 -43
  1253. package/src/events/events_block_comment_create.js +0 -52
  1254. package/src/events/events_block_comment_delete.js +0 -27
  1255. package/src/events/events_block_comment_move.js +0 -54
  1256. package/src/events/events_block_comment_resize.js +0 -52
  1257. package/src/events/events_block_drag_end.js +0 -33
  1258. package/src/events/events_block_drag_outside.js +0 -30
  1259. package/src/events/events_scratch_variable_create.js +0 -67
  1260. package/src/fields/field_angle.js +0 -433
  1261. package/src/fields/field_colour_slider.js +0 -388
  1262. package/src/fields/field_dropdown.js +0 -42
  1263. package/src/fields/field_matrix.js +0 -634
  1264. package/src/fields/field_note.js +0 -937
  1265. package/src/fields/field_number.js +0 -380
  1266. package/src/fields/field_textinput_removable.js +0 -107
  1267. package/src/fields/field_variable.js +0 -171
  1268. package/src/fields/field_variable_getter.js +0 -109
  1269. package/src/fields/field_vertical_separator.js +0 -139
  1270. package/src/flyout_checkbox_icon.js +0 -88
  1271. package/src/glows.js +0 -98
  1272. package/src/index.ts +0 -137
  1273. package/src/procedures.js +0 -425
  1274. package/src/recyclable_block_flyout_inflater.js +0 -194
  1275. package/src/renderer/bowler_hat.js +0 -17
  1276. package/src/renderer/constants.js +0 -45
  1277. package/src/renderer/drawer.js +0 -51
  1278. package/src/renderer/path_object.js +0 -35
  1279. package/src/renderer/render_info.js +0 -98
  1280. package/src/renderer/renderer.js +0 -74
  1281. package/src/scratch_block_paster.js +0 -46
  1282. package/src/scratch_blocks_utils.js +0 -148
  1283. package/src/scratch_comment_bubble.js +0 -169
  1284. package/src/scratch_comment_icon.js +0 -195
  1285. package/src/scratch_connection_checker.js +0 -29
  1286. package/src/scratch_continuous_category.js +0 -80
  1287. package/src/scratch_continuous_toolbox.js +0 -78
  1288. package/src/scratch_dragger.js +0 -142
  1289. package/src/scratch_variable_map.js +0 -25
  1290. package/src/scratch_variable_model.js +0 -24
  1291. package/src/shadows.js +0 -61
  1292. package/src/status_indicator_label.js +0 -186
  1293. package/src/status_indicator_label_flyout_inflater.js +0 -42
  1294. package/src/variables.js +0 -355
  1295. package/temp-use-blockly-v12-rc.sh +0 -26
  1296. package/tsconfig.json +0 -13
  1297. /package/media/{foldout-icon.svg → comment-arrow-down.svg} +0 -0
@@ -1,2519 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2014 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- /**
8
- * Object representing a workspace rendered as SVG.
9
- *
10
- * @class
11
- */
12
- // Former goog.module ID: Blockly.WorkspaceSvg
13
-
14
- // Unused import preserved for side-effects. Remove if unneeded.
15
- import './events/events_block_create.js';
16
- // Unused import preserved for side-effects. Remove if unneeded.
17
- import './events/events_theme_change.js';
18
- // Unused import preserved for side-effects. Remove if unneeded.
19
- import './events/events_viewport.js';
20
-
21
- import type {Block} from './block.js';
22
- import type {BlockSvg} from './block_svg.js';
23
- import type {BlocklyOptions} from './blockly_options.js';
24
- import * as browserEvents from './browser_events.js';
25
- import * as common from './common.js';
26
- import {ComponentManager} from './component_manager.js';
27
- import {ConnectionDB} from './connection_db.js';
28
- import * as ContextMenu from './contextmenu.js';
29
- import {ContextMenuRegistry} from './contextmenu_registry.js';
30
- import * as dropDownDiv from './dropdowndiv.js';
31
- import * as eventUtils from './events/utils.js';
32
- import {Flyout} from './flyout_base.js';
33
- import type {FlyoutButton} from './flyout_button.js';
34
- import {Gesture} from './gesture.js';
35
- import {Grid} from './grid.js';
36
- import type {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';
37
- import type {IBoundedElement} from './interfaces/i_bounded_element.js';
38
- import type {IDragTarget} from './interfaces/i_drag_target.js';
39
- import type {IFlyout} from './interfaces/i_flyout.js';
40
- import type {IMetricsManager} from './interfaces/i_metrics_manager.js';
41
- import type {IToolbox} from './interfaces/i_toolbox.js';
42
- import type {Cursor} from './keyboard_nav/cursor.js';
43
- import type {Marker} from './keyboard_nav/marker.js';
44
- import {MarkerManager} from './marker_manager.js';
45
- import {Options} from './options.js';
46
- import * as Procedures from './procedures.js';
47
- import * as registry from './registry.js';
48
- import * as blockRendering from './renderers/common/block_rendering.js';
49
- import type {Renderer} from './renderers/common/renderer.js';
50
- import type {ScrollbarPair} from './scrollbar_pair.js';
51
- import type {Theme} from './theme.js';
52
- import {Classic} from './theme/classic.js';
53
- import {ThemeManager} from './theme_manager.js';
54
- import * as Tooltip from './tooltip.js';
55
- import type {Trashcan} from './trashcan.js';
56
- import * as arrayUtils from './utils/array.js';
57
- import {Coordinate} from './utils/coordinate.js';
58
- import * as dom from './utils/dom.js';
59
- import type {Metrics} from './utils/metrics.js';
60
- import {Rect} from './utils/rect.js';
61
- import {Size} from './utils/size.js';
62
- import {Svg} from './utils/svg.js';
63
- import * as svgMath from './utils/svg_math.js';
64
- import * as toolbox from './utils/toolbox.js';
65
- import * as userAgent from './utils/useragent.js';
66
- import type {
67
- IVariableModel,
68
- IVariableState,
69
- } from './interfaces/i_variable_model.js';
70
- import * as Variables from './variables.js';
71
- import * as VariablesDynamic from './variables_dynamic.js';
72
- import * as WidgetDiv from './widgetdiv.js';
73
- import {Workspace} from './workspace.js';
74
- import {WorkspaceAudio} from './workspace_audio.js';
75
- import {WorkspaceComment} from './comments/workspace_comment.js';
76
- import {ZoomControls} from './zoom_controls.js';
77
- import {ContextMenuOption} from './contextmenu_registry.js';
78
- import * as renderManagement from './render_management.js';
79
- import {LayerManager} from './layer_manager.js';
80
- import {RenderedWorkspaceComment} from './comments/rendered_workspace_comment.js';
81
-
82
- /** Margin around the top/bottom/left/right after a zoomToFit call. */
83
- const ZOOM_TO_FIT_MARGIN = 20;
84
-
85
- /**
86
- * Class for a workspace. This is an onscreen area with optional trashcan,
87
- * scrollbars, bubbles, and dragging.
88
- */
89
- export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
90
- /**
91
- * A wrapper function called when a resize event occurs.
92
- * You can pass the result to `eventHandling.unbind`.
93
- */
94
- private resizeHandlerWrapper: browserEvents.Data | null = null;
95
-
96
- /**
97
- * The render status of an SVG workspace.
98
- * Returns `false` for headless workspaces and true for instances of
99
- * `WorkspaceSvg`.
100
- */
101
- override rendered = true;
102
-
103
- /**
104
- * Whether the workspace is visible. False if the workspace has been hidden
105
- * by calling `setVisible(false)`.
106
- */
107
- private isVisible_ = true;
108
-
109
- /**
110
- * Whether this workspace has resizes enabled.
111
- * Disable during batch operations for a performance improvement.
112
- */
113
- private resizesEnabled = true;
114
-
115
- /**
116
- * Current horizontal scrolling offset in pixel units, relative to the
117
- * workspace origin.
118
- *
119
- * It is useful to think about a view, and a canvas moving beneath that
120
- * view. As the canvas moves right, this value becomes more positive, and
121
- * the view is now "seeing" the left side of the canvas. As the canvas moves
122
- * left, this value becomes more negative, and the view is now "seeing" the
123
- * right side of the canvas.
124
- *
125
- * The confusing thing about this value is that it does not, and must not
126
- * include the absoluteLeft offset. This is because it is used to calculate
127
- * the viewLeft value.
128
- *
129
- * The viewLeft is relative to the workspace origin (although in pixel
130
- * units). The workspace origin is the top-left corner of the workspace (at
131
- * least when it is enabled). It is shifted from the top-left of the
132
- * blocklyDiv so as not to be beneath the toolbox.
133
- *
134
- * When the workspace is enabled the viewLeft and workspace origin are at
135
- * the same X location. As the canvas slides towards the right beneath the
136
- * view this value (scrollX) becomes more positive, and the viewLeft becomes
137
- * more negative relative to the workspace origin (imagine the workspace
138
- * origin as a dot on the canvas sliding to the right as the canvas moves).
139
- *
140
- * So if the scrollX were to include the absoluteLeft this would in a way
141
- * "unshift" the workspace origin. This means that the viewLeft would be
142
- * representing the left edge of the blocklyDiv, rather than the left edge
143
- * of the workspace.
144
- */
145
- scrollX = 0;
146
-
147
- /**
148
- * Current vertical scrolling offset in pixel units, relative to the
149
- * workspace origin.
150
- *
151
- * It is useful to think about a view, and a canvas moving beneath that
152
- * view. As the canvas moves down, this value becomes more positive, and the
153
- * view is now "seeing" the upper part of the canvas. As the canvas moves
154
- * up, this value becomes more negative, and the view is "seeing" the lower
155
- * part of the canvas.
156
- *
157
- * This confusing thing about this value is that it does not, and must not
158
- * include the absoluteTop offset. This is because it is used to calculate
159
- * the viewTop value.
160
- *
161
- * The viewTop is relative to the workspace origin (although in pixel
162
- * units). The workspace origin is the top-left corner of the workspace (at
163
- * least when it is enabled). It is shifted from the top-left of the
164
- * blocklyDiv so as not to be beneath the toolbox.
165
- *
166
- * When the workspace is enabled the viewTop and workspace origin are at the
167
- * same Y location. As the canvas slides towards the bottom this value
168
- * (scrollY) becomes more positive, and the viewTop becomes more negative
169
- * relative to the workspace origin (image in the workspace origin as a dot
170
- * on the canvas sliding downwards as the canvas moves).
171
- *
172
- * So if the scrollY were to include the absoluteTop this would in a way
173
- * "unshift" the workspace origin. This means that the viewTop would be
174
- * representing the top edge of the blocklyDiv, rather than the top edge of
175
- * the workspace.
176
- */
177
- scrollY = 0;
178
-
179
- /** Horizontal scroll value when scrolling started in pixel units. */
180
- startScrollX = 0;
181
-
182
- /** Vertical scroll value when scrolling started in pixel units. */
183
- startScrollY = 0;
184
-
185
- /** Distance from mouse to object being dragged. */
186
- private dragDeltaXY: Coordinate | null = null;
187
-
188
- /** Current scale. */
189
- scale = 1;
190
-
191
- /** Cached scale value. Used to detect changes in viewport. */
192
- private oldScale = 1;
193
-
194
- /** Cached viewport top value. Used to detect changes in viewport. */
195
- private oldTop = 0;
196
-
197
- /** Cached viewport left value. Used to detect changes in viewport. */
198
- private oldLeft = 0;
199
-
200
- /** The workspace's trashcan (if any). */
201
- trashcan: Trashcan | null = null;
202
-
203
- /** This workspace's scrollbars, if they exist. */
204
- scrollbar: ScrollbarPair | null = null;
205
-
206
- /**
207
- * Fixed flyout providing blocks which may be dragged into this workspace.
208
- */
209
- private flyout: IFlyout | null = null;
210
-
211
- /**
212
- * Category-based toolbox providing blocks which may be dragged into this
213
- * workspace.
214
- */
215
- private toolbox_: IToolbox | null = null;
216
-
217
- /**
218
- * The current gesture in progress on this workspace, if any.
219
- *
220
- * @internal
221
- */
222
- currentGesture_: Gesture | null = null;
223
-
224
- /**
225
- * The first parent div with 'injectionDiv' in the name, or null if not set.
226
- * Access this with getInjectionDiv.
227
- */
228
- private injectionDiv: Element | null = null;
229
-
230
- /**
231
- * Last known position of the page scroll.
232
- * This is used to determine whether we have recalculated screen coordinate
233
- * stuff since the page scrolled.
234
- */
235
- private lastRecordedPageScroll: Coordinate | null = null;
236
-
237
- /**
238
- * Developers may define this function to add custom menu options to the
239
- * workspace's context menu or edit the workspace-created set of menu
240
- * options.
241
- *
242
- * @param options List of menu options to add to.
243
- * @param e The right-click event that triggered the context menu.
244
- */
245
- configureContextMenu:
246
- | ((menuOptions: ContextMenuOption[], e: Event) => void)
247
- | null = null;
248
-
249
- /**
250
- * A dummy wheel event listener used as a workaround for a Safari scrolling issue.
251
- * Set in createDom and used for removal in dispose to ensure proper cleanup.
252
- */
253
- private dummyWheelListener: (() => void) | null = null;
254
-
255
- /**
256
- * In a flyout, the target workspace where blocks should be placed after a
257
- * drag. Otherwise null.
258
- *
259
- * @internal
260
- */
261
- targetWorkspace: WorkspaceSvg | null = null;
262
-
263
- /** Inverted screen CTM, for use in mouseToSvg. */
264
- private inverseScreenCTM: SVGMatrix | null = null;
265
-
266
- /** Inverted screen CTM is dirty, recalculate it. */
267
- private inverseScreenCTMDirty = true;
268
- private metricsManager: IMetricsManager;
269
- /** @internal */
270
- getMetrics: () => Metrics;
271
- /** @internal */
272
- setMetrics: (p1: {x?: number; y?: number}) => void;
273
- private readonly componentManager: ComponentManager;
274
-
275
- /**
276
- * List of currently highlighted blocks. Block highlighting is often used
277
- * to visually mark blocks currently being executed.
278
- */
279
- private readonly highlightedBlocks: BlockSvg[] = [];
280
- private audioManager: WorkspaceAudio;
281
- private grid: Grid | null;
282
- private markerManager: MarkerManager;
283
-
284
- /**
285
- * Map from function names to callbacks, for deciding what to do when a
286
- * custom toolbox category is opened.
287
- */
288
- private toolboxCategoryCallbacks = new Map<
289
- string,
290
- (p1: WorkspaceSvg) => toolbox.FlyoutDefinition
291
- >();
292
-
293
- /**
294
- * Map from function names to callbacks, for deciding what to do when a
295
- * button is clicked.
296
- */
297
- private flyoutButtonCallbacks = new Map<string, (p1: FlyoutButton) => void>();
298
- protected themeManager_: ThemeManager;
299
- private readonly renderer: Renderer;
300
-
301
- /** Cached parent SVG. */
302
- private cachedParentSvg: SVGElement | null = null;
303
-
304
- /** True if keyboard accessibility mode is on, false otherwise. */
305
- keyboardAccessibilityMode = false;
306
-
307
- /** The list of top-level bounded elements on the workspace. */
308
- private topBoundedElements: IBoundedElement[] = [];
309
-
310
- /** The recorded drag targets. */
311
- private dragTargetAreas: Array<{component: IDragTarget; clientRect: Rect}> =
312
- [];
313
- private readonly cachedParentSvgSize: Size;
314
- private layerManager: LayerManager | null = null;
315
- // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
316
- svgGroup_!: SVGElement;
317
- // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
318
- svgBackground_!: SVGElement;
319
- // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
320
- svgBlockCanvas_!: SVGElement;
321
- // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
322
- svgBubbleCanvas_!: SVGElement;
323
- zoomControls_: ZoomControls | null = null;
324
-
325
- /**
326
- * @param options Dictionary of options.
327
- */
328
- constructor(options: Options) {
329
- super(options);
330
-
331
- const MetricsManagerClass = registry.getClassFromOptions(
332
- registry.Type.METRICS_MANAGER,
333
- options,
334
- true,
335
- );
336
- /** Object in charge of calculating metrics for the workspace. */
337
- this.metricsManager = new MetricsManagerClass!(this);
338
-
339
- /** Method to get all the metrics that have to do with a workspace. */
340
- this.getMetrics =
341
- options.getMetrics ||
342
- this.metricsManager.getMetrics.bind(this.metricsManager);
343
-
344
- /** Translates the workspace. */
345
- this.setMetrics =
346
- options.setMetrics || WorkspaceSvg.setTopLevelWorkspaceMetrics_;
347
-
348
- this.componentManager = new ComponentManager();
349
-
350
- this.connectionDBList = ConnectionDB.init(this.connectionChecker);
351
-
352
- /**
353
- * Object in charge of loading, storing, and playing audio for a workspace.
354
- */
355
- this.audioManager = new WorkspaceAudio(
356
- options.parentWorkspace as WorkspaceSvg,
357
- );
358
-
359
- /** This workspace's grid object or null. */
360
- this.grid = this.options.gridPattern
361
- ? new Grid(this.options.gridPattern, options.gridOptions)
362
- : null;
363
-
364
- /** Manager in charge of markers and cursors. */
365
- this.markerManager = new MarkerManager(this);
366
-
367
- if (Variables && Variables.flyoutCategory) {
368
- this.registerToolboxCategoryCallback(
369
- Variables.CATEGORY_NAME,
370
- Variables.flyoutCategory,
371
- );
372
- }
373
-
374
- if (VariablesDynamic && VariablesDynamic.flyoutCategory) {
375
- this.registerToolboxCategoryCallback(
376
- VariablesDynamic.CATEGORY_NAME,
377
- VariablesDynamic.flyoutCategory,
378
- );
379
- }
380
-
381
- if (Procedures && Procedures.flyoutCategory) {
382
- this.registerToolboxCategoryCallback(
383
- Procedures.CATEGORY_NAME,
384
- Procedures.flyoutCategory,
385
- );
386
- this.addChangeListener(Procedures.mutatorOpenListener);
387
- }
388
-
389
- /** Object in charge of storing and updating the workspace theme. */
390
- this.themeManager_ = this.options.parentWorkspace
391
- ? this.options.parentWorkspace.getThemeManager()
392
- : new ThemeManager(this, this.options.theme || Classic);
393
- this.themeManager_.subscribeWorkspace(this);
394
-
395
- /** The block renderer used for rendering blocks on this workspace. */
396
- this.renderer = blockRendering.init(
397
- this.options.renderer || 'geras',
398
- this.getTheme(),
399
- this.options.rendererOverrides ?? undefined,
400
- );
401
-
402
- /**
403
- * The cached size of the parent svg element.
404
- * Used to compute svg metrics.
405
- */
406
- this.cachedParentSvgSize = new Size(0, 0);
407
- }
408
-
409
- /**
410
- * Get the marker manager for this workspace.
411
- *
412
- * @returns The marker manager.
413
- */
414
- getMarkerManager(): MarkerManager {
415
- return this.markerManager;
416
- }
417
-
418
- /**
419
- * Gets the metrics manager for this workspace.
420
- *
421
- * @returns The metrics manager.
422
- */
423
- getMetricsManager(): IMetricsManager {
424
- return this.metricsManager;
425
- }
426
-
427
- /**
428
- * Sets the metrics manager for the workspace.
429
- *
430
- * @param metricsManager The metrics manager.
431
- * @internal
432
- */
433
- setMetricsManager(metricsManager: IMetricsManager) {
434
- this.metricsManager = metricsManager;
435
- this.getMetrics = this.metricsManager.getMetrics.bind(this.metricsManager);
436
- }
437
-
438
- /**
439
- * Gets the component manager for this workspace.
440
- *
441
- * @returns The component manager.
442
- */
443
- getComponentManager(): ComponentManager {
444
- return this.componentManager;
445
- }
446
-
447
- /**
448
- * Add the cursor SVG to this workspaces SVG group.
449
- *
450
- * @param cursorSvg The SVG root of the cursor to be added to the workspace
451
- * SVG group.
452
- * @internal
453
- */
454
- setCursorSvg(cursorSvg: SVGElement) {
455
- this.markerManager.setCursorSvg(cursorSvg);
456
- }
457
-
458
- /**
459
- * Add the marker SVG to this workspaces SVG group.
460
- *
461
- * @param markerSvg The SVG root of the marker to be added to the workspace
462
- * SVG group.
463
- * @internal
464
- */
465
- setMarkerSvg(markerSvg: SVGElement) {
466
- this.markerManager.setMarkerSvg(markerSvg);
467
- }
468
-
469
- /**
470
- * Get the marker with the given ID.
471
- *
472
- * @param id The ID of the marker.
473
- * @returns The marker with the given ID or null if no marker with the given
474
- * ID exists.
475
- * @internal
476
- */
477
- getMarker(id: string): Marker | null {
478
- if (this.markerManager) {
479
- return this.markerManager.getMarker(id);
480
- }
481
- return null;
482
- }
483
-
484
- /**
485
- * The cursor for this workspace.
486
- *
487
- * @returns The cursor for the workspace.
488
- */
489
- getCursor(): Cursor | null {
490
- if (this.markerManager) {
491
- return this.markerManager.getCursor();
492
- }
493
- return null;
494
- }
495
-
496
- /**
497
- * Get the block renderer attached to this workspace.
498
- *
499
- * @returns The renderer attached to this workspace.
500
- */
501
- getRenderer(): Renderer {
502
- return this.renderer;
503
- }
504
-
505
- /**
506
- * Get the theme manager for this workspace.
507
- *
508
- * @returns The theme manager for this workspace.
509
- * @internal
510
- */
511
- getThemeManager(): ThemeManager {
512
- return this.themeManager_;
513
- }
514
-
515
- /**
516
- * Get the workspace theme object.
517
- *
518
- * @returns The workspace theme object.
519
- */
520
- getTheme(): Theme {
521
- return this.themeManager_.getTheme();
522
- }
523
-
524
- /**
525
- * Set the workspace theme object.
526
- * If no theme is passed, default to the `Classic` theme.
527
- *
528
- * @param theme The workspace theme object.
529
- */
530
- setTheme(theme: Theme) {
531
- if (!theme) {
532
- theme = Classic as Theme;
533
- }
534
- this.themeManager_.setTheme(theme);
535
- }
536
-
537
- /**
538
- * Refresh all blocks on the workspace after a theme update.
539
- */
540
- refreshTheme() {
541
- if (this.svgGroup_) {
542
- this.renderer.refreshDom(this.svgGroup_, this.getTheme());
543
- }
544
-
545
- // Update all blocks in workspace that have a style name.
546
- this.updateBlockStyles_(
547
- this.getAllBlocks(false).filter(function (block) {
548
- return !!block.getStyleName();
549
- }),
550
- );
551
-
552
- // Update current toolbox selection.
553
- this.refreshToolboxSelection();
554
- if (this.toolbox_) {
555
- this.toolbox_.refreshTheme();
556
- }
557
-
558
- // Re-render if workspace is visible
559
- if (this.isVisible()) {
560
- this.setVisible(true);
561
- }
562
-
563
- const event = new (eventUtils.get(eventUtils.THEME_CHANGE))(
564
- this.getTheme().name,
565
- this.id,
566
- );
567
- eventUtils.fire(event);
568
- }
569
-
570
- /**
571
- * Updates all the blocks with new style.
572
- *
573
- * @param blocks List of blocks to update the style on.
574
- */
575
- private updateBlockStyles_(blocks: Block[]) {
576
- for (let i = 0, block; (block = blocks[i]); i++) {
577
- const blockStyleName = block.getStyleName();
578
- if (blockStyleName) {
579
- const blockSvg = block as BlockSvg;
580
- blockSvg.setStyle(blockStyleName);
581
- }
582
- }
583
- }
584
-
585
- /**
586
- * Getter for the inverted screen CTM.
587
- *
588
- * @returns The matrix to use in mouseToSvg
589
- */
590
- getInverseScreenCTM(): SVGMatrix | null {
591
- // Defer getting the screen CTM until we actually need it, this should
592
- // avoid forced reflows from any calls to updateInverseScreenCTM.
593
- if (this.inverseScreenCTMDirty) {
594
- const ctm = this.getParentSvg().getScreenCTM();
595
- if (ctm) {
596
- this.inverseScreenCTM = ctm.inverse();
597
- this.inverseScreenCTMDirty = false;
598
- }
599
- }
600
-
601
- return this.inverseScreenCTM;
602
- }
603
-
604
- /** Mark the inverse screen CTM as dirty. */
605
- updateInverseScreenCTM() {
606
- this.inverseScreenCTMDirty = true;
607
- }
608
-
609
- /**
610
- * Getter for isVisible
611
- *
612
- * @returns Whether the workspace is visible.
613
- * False if the workspace has been hidden by calling `setVisible(false)`.
614
- */
615
- isVisible(): boolean {
616
- return this.isVisible_;
617
- }
618
-
619
- /**
620
- * Return the absolute coordinates of the top-left corner of this element,
621
- * scales that after canvas SVG element, if it's a descendant.
622
- * The origin (0,0) is the top-left corner of the Blockly SVG.
623
- *
624
- * @param element SVG element to find the coordinates of.
625
- * @returns Object with .x and .y properties.
626
- * @internal
627
- */
628
- getSvgXY(element: SVGElement): Coordinate {
629
- let x = 0;
630
- let y = 0;
631
- let scale = 1;
632
- if (
633
- this.getCanvas().contains(element) ||
634
- this.getBubbleCanvas().contains(element)
635
- ) {
636
- // Before the SVG canvas, scale the coordinates.
637
- scale = this.scale;
638
- }
639
- do {
640
- // Loop through this block and every parent.
641
- const xy = svgMath.getRelativeXY(element);
642
- if (element === this.getCanvas() || element === this.getBubbleCanvas()) {
643
- // After the SVG canvas, don't scale the coordinates.
644
- scale = 1;
645
- }
646
- x += xy.x * scale;
647
- y += xy.y * scale;
648
- element = element.parentNode as SVGElement;
649
- } while (
650
- element &&
651
- element !== this.getParentSvg() &&
652
- element !== this.getInjectionDiv()
653
- );
654
- return new Coordinate(x, y);
655
- }
656
-
657
- /**
658
- * Gets the size of the workspace's parent SVG element.
659
- *
660
- * @returns The cached width and height of the workspace's parent SVG element.
661
- * @internal
662
- */
663
- getCachedParentSvgSize(): Size {
664
- const size = this.cachedParentSvgSize;
665
- return new Size(size.width, size.height);
666
- }
667
-
668
- /**
669
- * Return the position of the workspace origin relative to the injection div
670
- * origin in pixels.
671
- * The workspace origin is where a block would render at position (0, 0).
672
- * It is not the upper left corner of the workspace SVG.
673
- *
674
- * @returns Offset in pixels.
675
- * @internal
676
- */
677
- getOriginOffsetInPixels(): Coordinate {
678
- return svgMath.getInjectionDivXY(this.getCanvas());
679
- }
680
-
681
- /**
682
- * Return the injection div that is a parent of this workspace.
683
- * Walks the DOM the first time it's called, then returns a cached value.
684
- * Note: We assume this is only called after the workspace has been injected
685
- * into the DOM.
686
- *
687
- * @returns The first parent div with 'injectionDiv' in the name.
688
- * @internal
689
- */
690
- getInjectionDiv(): Element {
691
- // NB: it would be better to pass this in at createDom, but is more likely
692
- // to break existing uses of Blockly.
693
- if (!this.injectionDiv) {
694
- let element: Element = this.svgGroup_;
695
- while (element) {
696
- const classes = element.getAttribute('class') || '';
697
- if ((' ' + classes + ' ').includes(' injectionDiv ')) {
698
- this.injectionDiv = element;
699
- break;
700
- }
701
- element = element.parentNode as Element;
702
- }
703
- }
704
- return this.injectionDiv!;
705
- }
706
-
707
- /**
708
- * Returns the SVG group for the workspace.
709
- *
710
- * @returns The SVG group for the workspace.
711
- */
712
- getSvgGroup(): Element {
713
- return this.svgGroup_;
714
- }
715
-
716
- /**
717
- * Get the SVG block canvas for the workspace.
718
- *
719
- * @returns The SVG group for the workspace.
720
- * @internal
721
- */
722
- getBlockCanvas(): SVGElement | null {
723
- return this.getCanvas();
724
- }
725
-
726
- /**
727
- * Save resize handler data so we can delete it later in dispose.
728
- *
729
- * @param handler Data that can be passed to eventHandling.unbind.
730
- */
731
- setResizeHandlerWrapper(handler: browserEvents.Data) {
732
- this.resizeHandlerWrapper = handler;
733
- }
734
-
735
- /**
736
- * Create the workspace DOM elements.
737
- *
738
- * @param opt_backgroundClass Either 'blocklyMainBackground' or
739
- * 'blocklyMutatorBackground'.
740
- * @returns The workspace's SVG group.
741
- */
742
- createDom(opt_backgroundClass?: string, injectionDiv?: Element): Element {
743
- if (!this.injectionDiv) {
744
- this.injectionDiv = injectionDiv ?? null;
745
- }
746
-
747
- /**
748
- * <g class="blocklyWorkspace">
749
- * <rect class="blocklyMainBackground" height="100%" width="100%"></rect>
750
- * [Trashcan and/or flyout may go here]
751
- * <g class="blocklyBlockCanvas"></g>
752
- * <g class="blocklyBubbleCanvas"></g>
753
- * </g>
754
- */
755
- this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': 'blocklyWorkspace'});
756
-
757
- // Note that a <g> alone does not receive mouse events--it must have a
758
- // valid target inside it. If no background class is specified, as in the
759
- // flyout, the workspace will not receive mouse events.
760
- if (opt_backgroundClass) {
761
- this.svgBackground_ = dom.createSvgElement(
762
- Svg.RECT,
763
- {'height': '100%', 'width': '100%', 'class': opt_backgroundClass},
764
- this.svgGroup_,
765
- );
766
-
767
- if (opt_backgroundClass === 'blocklyMainBackground' && this.grid) {
768
- this.svgBackground_.style.fill =
769
- 'url(#' + this.grid.getPatternId() + ')';
770
- } else {
771
- this.themeManager_.subscribe(
772
- this.svgBackground_,
773
- 'workspaceBackgroundColour',
774
- 'fill',
775
- );
776
- }
777
- }
778
-
779
- this.layerManager = new LayerManager(this);
780
- // Assign the canvases for backwards compatibility.
781
- this.svgBlockCanvas_ = this.layerManager.getBlockLayer();
782
- this.svgBubbleCanvas_ = this.layerManager.getBubbleLayer();
783
-
784
- if (!this.isFlyout) {
785
- browserEvents.conditionalBind(
786
- this.svgGroup_,
787
- 'pointerdown',
788
- this,
789
- this.onMouseDown_,
790
- false,
791
- );
792
- // This no-op works around https://bugs.webkit.org/show_bug.cgi?id=226683,
793
- // which otherwise prevents zoom/scroll events from being observed in
794
- // Safari. Once that bug is fixed it should be removed.
795
- this.dummyWheelListener = () => {};
796
- document.body.addEventListener('wheel', this.dummyWheelListener);
797
- browserEvents.conditionalBind(
798
- this.svgGroup_,
799
- 'wheel',
800
- this,
801
- this.onMouseWheel_,
802
- );
803
- }
804
-
805
- // Determine if there needs to be a category tree, or a simple list of
806
- // blocks. This cannot be changed later, since the UI is very different.
807
- if (this.options.hasCategories) {
808
- const ToolboxClass = registry.getClassFromOptions(
809
- registry.Type.TOOLBOX,
810
- this.options,
811
- true,
812
- );
813
- this.toolbox_ = new ToolboxClass!(this);
814
- }
815
- if (this.grid) {
816
- this.grid.update(this.scale);
817
- }
818
- this.recordDragTargets();
819
- const CursorClass = registry.getClassFromOptions(
820
- registry.Type.CURSOR,
821
- this.options,
822
- );
823
-
824
- CursorClass && this.markerManager.setCursor(new CursorClass());
825
-
826
- this.renderer.createDom(this.svgGroup_, this.getTheme());
827
- return this.svgGroup_;
828
- }
829
-
830
- /**
831
- * Dispose of this workspace.
832
- * Unlink from all DOM elements to prevent memory leaks.
833
- */
834
- override dispose() {
835
- // Stop rerendering.
836
- this.rendered = false;
837
- if (this.currentGesture_) {
838
- this.currentGesture_.cancel();
839
- }
840
- if (this.svgGroup_) {
841
- dom.removeNode(this.svgGroup_);
842
- }
843
- if (this.toolbox_) {
844
- this.toolbox_.dispose();
845
- this.toolbox_ = null;
846
- }
847
- if (this.flyout) {
848
- this.flyout.dispose();
849
- this.flyout = null;
850
- }
851
- if (this.trashcan) {
852
- this.trashcan.dispose();
853
- this.trashcan = null;
854
- }
855
- if (this.scrollbar) {
856
- this.scrollbar.dispose();
857
- this.scrollbar = null;
858
- }
859
- if (this.zoomControls_) {
860
- this.zoomControls_.dispose();
861
- }
862
-
863
- if (this.audioManager) {
864
- this.audioManager.dispose();
865
- }
866
-
867
- if (this.grid) {
868
- this.grid = null;
869
- }
870
-
871
- this.renderer.dispose();
872
-
873
- if (this.markerManager) {
874
- this.markerManager.dispose();
875
- }
876
-
877
- super.dispose();
878
-
879
- // Dispose of theme manager after all blocks and mutators are disposed of.
880
- if (this.themeManager_) {
881
- this.themeManager_.unsubscribeWorkspace(this);
882
- this.themeManager_.unsubscribe(this.svgBackground_);
883
- if (!this.options.parentWorkspace) {
884
- this.themeManager_.dispose();
885
- }
886
- }
887
-
888
- this.connectionDBList.length = 0;
889
-
890
- this.toolboxCategoryCallbacks.clear();
891
- this.flyoutButtonCallbacks.clear();
892
-
893
- if (!this.options.parentWorkspace) {
894
- // Top-most workspace. Dispose of the div that the
895
- // SVG is injected into (i.e. injectionDiv).
896
- const parentSvg = this.getParentSvg();
897
- if (parentSvg && parentSvg.parentNode) {
898
- dom.removeNode(parentSvg.parentNode);
899
- }
900
- }
901
- if (this.resizeHandlerWrapper) {
902
- browserEvents.unbind(this.resizeHandlerWrapper);
903
- this.resizeHandlerWrapper = null;
904
- }
905
-
906
- // Remove the dummy wheel listener
907
- if (this.dummyWheelListener) {
908
- document.body.removeEventListener('wheel', this.dummyWheelListener);
909
- this.dummyWheelListener = null;
910
- }
911
- }
912
-
913
- /**
914
- * Add a trashcan.
915
- *
916
- * @internal
917
- */
918
- addTrashcan() {
919
- this.trashcan = WorkspaceSvg.newTrashcan(this);
920
- const svgTrashcan = this.trashcan.createDom();
921
- this.svgGroup_.insertBefore(svgTrashcan, this.getCanvas());
922
- }
923
-
924
- /**
925
- * @param _workspace
926
- * @internal
927
- */
928
- static newTrashcan(_workspace: WorkspaceSvg): Trashcan {
929
- throw new Error(
930
- 'The implementation of newTrashcan should be ' +
931
- 'monkey-patched in by blockly.ts',
932
- );
933
- }
934
-
935
- /**
936
- * Add zoom controls.
937
- *
938
- * @internal
939
- */
940
- addZoomControls() {
941
- this.zoomControls_ = new ZoomControls(this);
942
- const svgZoomControls = this.zoomControls_.createDom();
943
- this.svgGroup_.appendChild(svgZoomControls);
944
- }
945
-
946
- /**
947
- * Add a flyout element in an element with the given tag name.
948
- *
949
- * @param tagName What type of tag the flyout belongs in.
950
- * @returns The element containing the flyout DOM.
951
- * @internal
952
- */
953
- addFlyout(tagName: string | Svg<SVGSVGElement> | Svg<SVGGElement>): Element {
954
- const workspaceOptions = new Options({
955
- 'parentWorkspace': this,
956
- 'rtl': this.RTL,
957
- 'oneBasedIndex': this.options.oneBasedIndex,
958
- 'horizontalLayout': this.horizontalLayout,
959
- 'renderer': this.options.renderer,
960
- 'rendererOverrides': this.options.rendererOverrides,
961
- 'move': {
962
- 'scrollbars': true,
963
- },
964
- } as BlocklyOptions);
965
- workspaceOptions.toolboxPosition = this.options.toolboxPosition;
966
- if (this.horizontalLayout) {
967
- const HorizontalFlyout = registry.getClassFromOptions(
968
- registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,
969
- this.options,
970
- true,
971
- );
972
- this.flyout = new HorizontalFlyout!(workspaceOptions);
973
- } else {
974
- const VerticalFlyout = registry.getClassFromOptions(
975
- registry.Type.FLYOUTS_VERTICAL_TOOLBOX,
976
- this.options,
977
- true,
978
- );
979
- this.flyout = new VerticalFlyout!(workspaceOptions);
980
- }
981
- this.flyout.autoClose = false;
982
- this.flyout.getWorkspace().setVisible(true);
983
-
984
- // Return the element so that callers can place it in their desired
985
- // spot in the DOM. For example, mutator flyouts do not go in the same
986
- // place as main workspace flyouts.
987
- return this.flyout.createDom(tagName);
988
- }
989
-
990
- /**
991
- * Getter for the flyout associated with this workspace. This flyout may be
992
- * owned by either the toolbox or the workspace, depending on toolbox
993
- * configuration. It will be null if there is no flyout.
994
- *
995
- * @param opt_own Whether to only return the workspace's own flyout.
996
- * @returns The flyout on this workspace.
997
- */
998
- getFlyout(opt_own?: boolean): IFlyout | null {
999
- if (this.flyout || opt_own) {
1000
- return this.flyout;
1001
- }
1002
- if (this.toolbox_) {
1003
- return this.toolbox_.getFlyout();
1004
- }
1005
- return null;
1006
- }
1007
-
1008
- /**
1009
- * Getter for the toolbox associated with this workspace, if one exists.
1010
- *
1011
- * @returns The toolbox on this workspace.
1012
- */
1013
- getToolbox(): IToolbox | null {
1014
- return this.toolbox_;
1015
- }
1016
-
1017
- /**
1018
- * Update items that use screen coordinate calculations
1019
- * because something has changed (e.g. scroll position, window size).
1020
- */
1021
- private updateScreenCalculations_() {
1022
- this.updateInverseScreenCTM();
1023
- this.recordDragTargets();
1024
- }
1025
-
1026
- /**
1027
- * If enabled, resize the parts of the workspace that change when the
1028
- * workspace contents (e.g. block positions) change. This will also scroll
1029
- * the workspace contents if needed.
1030
- *
1031
- * @internal
1032
- */
1033
- resizeContents() {
1034
- if (!this.resizesEnabled || !this.rendered) {
1035
- return;
1036
- }
1037
- if (this.scrollbar) {
1038
- this.scrollbar.resize();
1039
- }
1040
- this.updateInverseScreenCTM();
1041
- }
1042
-
1043
- /**
1044
- * Resize and reposition all of the workspace chrome (toolbox,
1045
- * trash, scrollbars etc.)
1046
- * This should be called when something changes that
1047
- * requires recalculating dimensions and positions of the
1048
- * trash, zoom, toolbox, etc. (e.g. window resize).
1049
- */
1050
- resize() {
1051
- if (this.toolbox_) {
1052
- this.toolbox_.position();
1053
- } else if (this.flyout) {
1054
- this.flyout.position();
1055
- }
1056
-
1057
- const positionables = this.componentManager.getComponents(
1058
- ComponentManager.Capability.POSITIONABLE,
1059
- true,
1060
- );
1061
- const metrics = this.getMetricsManager().getUiMetrics();
1062
- const savedPositions = [];
1063
- for (let i = 0, positionable; (positionable = positionables[i]); i++) {
1064
- positionable.position(metrics, savedPositions);
1065
- const boundingRect = positionable.getBoundingRectangle();
1066
- if (boundingRect) {
1067
- savedPositions.push(boundingRect);
1068
- }
1069
- }
1070
-
1071
- if (this.scrollbar) {
1072
- this.scrollbar.resize();
1073
- }
1074
- this.updateScreenCalculations_();
1075
- }
1076
-
1077
- /**
1078
- * Resizes and repositions workspace chrome if the page has a new
1079
- * scroll position.
1080
- *
1081
- * @internal
1082
- */
1083
- updateScreenCalculationsIfScrolled() {
1084
- /* eslint-disable indent */
1085
- const currScroll = svgMath.getDocumentScroll();
1086
- if (!Coordinate.equals(this.lastRecordedPageScroll, currScroll)) {
1087
- this.lastRecordedPageScroll = currScroll;
1088
- this.updateScreenCalculations_();
1089
- }
1090
- }
1091
- /* eslint-enable indent */
1092
-
1093
- /**
1094
- * @returns The layer manager for this workspace.
1095
- */
1096
- getLayerManager(): LayerManager | null {
1097
- return this.layerManager;
1098
- }
1099
-
1100
- /**
1101
- * Get the SVG element that forms the drawing surface.
1102
- *
1103
- * @returns SVG group element.
1104
- */
1105
- getCanvas(): SVGGElement {
1106
- return this.layerManager!.getBlockLayer();
1107
- }
1108
-
1109
- /**
1110
- * Caches the width and height of the workspace's parent SVG element for use
1111
- * with getSvgMetrics.
1112
- *
1113
- * @param width The width of the parent SVG element.
1114
- * @param height The height of the parent SVG element
1115
- * @internal
1116
- */
1117
- setCachedParentSvgSize(width: number | null, height: number | null) {
1118
- const svg = this.getParentSvg();
1119
- if (width != null) {
1120
- this.cachedParentSvgSize.width = width;
1121
- // This is set to support the public (but deprecated) Blockly.svgSize
1122
- // method.
1123
- svg.setAttribute('data-cached-width', `${width}`);
1124
- }
1125
- if (height != null) {
1126
- this.cachedParentSvgSize.height = height;
1127
- // This is set to support the public (but deprecated) Blockly.svgSize
1128
- // method.
1129
- svg.setAttribute('data-cached-height', `${height}`);
1130
- }
1131
- }
1132
-
1133
- /**
1134
- * Get the SVG element that forms the bubble surface.
1135
- *
1136
- * @returns SVG group element.
1137
- */
1138
- getBubbleCanvas(): SVGGElement {
1139
- return this.layerManager!.getBubbleLayer();
1140
- }
1141
-
1142
- /**
1143
- * Get the SVG element that contains this workspace.
1144
- * Note: We assume this is only called after the workspace has been injected
1145
- * into the DOM.
1146
- *
1147
- * @returns SVG element.
1148
- */
1149
- getParentSvg(): SVGSVGElement {
1150
- if (!this.cachedParentSvg) {
1151
- let element = this.svgGroup_;
1152
- while (element) {
1153
- if (element.tagName === 'svg') {
1154
- this.cachedParentSvg = element;
1155
- break;
1156
- }
1157
- element = element.parentNode as SVGSVGElement;
1158
- }
1159
- }
1160
- return this.cachedParentSvg as SVGSVGElement;
1161
- }
1162
-
1163
- /**
1164
- * Fires a viewport event if events are enabled and there is a change in
1165
- * viewport values.
1166
- *
1167
- * @internal
1168
- */
1169
- maybeFireViewportChangeEvent() {
1170
- if (!eventUtils.isEnabled()) {
1171
- return;
1172
- }
1173
- const scale = this.scale;
1174
- const top = -this.scrollY;
1175
- const left = -this.scrollX;
1176
- if (
1177
- scale === this.oldScale &&
1178
- Math.abs(top - this.oldTop) < 1 &&
1179
- Math.abs(left - this.oldLeft) < 1
1180
- ) {
1181
- // Ignore sub-pixel changes in top and left. Due to #4192 there are a lot
1182
- // of negligible changes in viewport top/left.
1183
- return;
1184
- }
1185
- const event = new (eventUtils.get(eventUtils.VIEWPORT_CHANGE))(
1186
- top,
1187
- left,
1188
- scale,
1189
- this.id,
1190
- this.oldScale,
1191
- );
1192
- this.oldScale = scale;
1193
- this.oldTop = top;
1194
- this.oldLeft = left;
1195
- eventUtils.fire(event);
1196
- }
1197
-
1198
- /**
1199
- * Translate this workspace to new coordinates.
1200
- *
1201
- * @param x Horizontal translation, in pixel units relative to the top left of
1202
- * the Blockly div.
1203
- * @param y Vertical translation, in pixel units relative to the top left of
1204
- * the Blockly div.
1205
- */
1206
- translate(x: number, y: number) {
1207
- this.layerManager?.translateLayers(new Coordinate(x, y), this.scale);
1208
- this.grid?.moveTo(x, y);
1209
- this.maybeFireViewportChangeEvent();
1210
- }
1211
-
1212
- /**
1213
- * Returns the horizontal offset of the workspace.
1214
- * Intended for LTR/RTL compatibility in XML.
1215
- *
1216
- * @returns Width.
1217
- */
1218
- override getWidth(): number {
1219
- const metrics = this.getMetrics();
1220
- return metrics ? metrics.viewWidth / this.scale : 0;
1221
- }
1222
-
1223
- /**
1224
- * Toggles the visibility of the workspace.
1225
- * Currently only intended for main workspace.
1226
- *
1227
- * @param isVisible True if workspace should be visible.
1228
- */
1229
- setVisible(isVisible: boolean) {
1230
- this.isVisible_ = isVisible;
1231
- if (!this.svgGroup_) {
1232
- return;
1233
- }
1234
-
1235
- // Tell the scrollbar whether its container is visible so it can
1236
- // tell when to hide itself.
1237
- if (this.scrollbar) {
1238
- this.scrollbar.setContainerVisible(isVisible);
1239
- }
1240
-
1241
- // Tell the flyout whether its container is visible so it can
1242
- // tell when to hide itself.
1243
- if (this.getFlyout()) {
1244
- this.getFlyout()!.setContainerVisible(isVisible);
1245
- }
1246
-
1247
- this.getParentSvg().style.display = isVisible ? 'block' : 'none';
1248
- if (this.toolbox_) {
1249
- // Currently does not support toolboxes in mutators.
1250
- this.toolbox_.setVisible(isVisible);
1251
- }
1252
- if (!isVisible) {
1253
- this.hideChaff(true);
1254
- }
1255
- }
1256
-
1257
- /**
1258
- * Render all blocks in workspace.
1259
- */
1260
- render() {
1261
- // Generate list of all blocks.
1262
- const blocks = this.getAllBlocks(false);
1263
- // Render each block.
1264
- for (let i = blocks.length - 1; i >= 0; i--) {
1265
- blocks[i].queueRender();
1266
- }
1267
-
1268
- this.getTopBlocks()
1269
- .flatMap((block) => block.getDescendants(false))
1270
- .filter((block) => block.isInsertionMarker())
1271
- .forEach((block) => block.queueRender());
1272
-
1273
- renderManagement
1274
- .finishQueuedRenders()
1275
- .then(() => void this.markerManager.updateMarkers());
1276
- }
1277
-
1278
- /**
1279
- * Highlight or unhighlight a block in the workspace. Block highlighting is
1280
- * often used to visually mark blocks currently being executed.
1281
- *
1282
- * @param id ID of block to highlight/unhighlight, or null for no block (used
1283
- * to unhighlight all blocks).
1284
- * @param opt_state If undefined, highlight specified block and automatically
1285
- * unhighlight all others. If true or false, manually
1286
- * highlight/unhighlight the specified block.
1287
- */
1288
- highlightBlock(id: string | null, opt_state?: boolean) {
1289
- if (opt_state === undefined) {
1290
- // Unhighlight all blocks.
1291
- for (let i = 0, block; (block = this.highlightedBlocks[i]); i++) {
1292
- block.setHighlighted(false);
1293
- }
1294
- this.highlightedBlocks.length = 0;
1295
- }
1296
- // Highlight/unhighlight the specified block.
1297
- const block = id ? this.getBlockById(id) : null;
1298
- if (block) {
1299
- const state = opt_state === undefined || opt_state;
1300
- // Using Set here would be great, but at the cost of IE10 support.
1301
- if (!state) {
1302
- arrayUtils.removeElem(this.highlightedBlocks, block);
1303
- } else if (!this.highlightedBlocks.includes(block)) {
1304
- this.highlightedBlocks.push(block);
1305
- }
1306
- block.setHighlighted(state);
1307
- }
1308
- }
1309
-
1310
- /**
1311
- * Refresh the toolbox unless there's a drag in progress.
1312
- *
1313
- * @internal
1314
- */
1315
- refreshToolboxSelection() {
1316
- const ws = this.isFlyout ? this.targetWorkspace : this;
1317
- if (ws && !ws.currentGesture_ && ws.toolbox_ && ws.toolbox_.getFlyout()) {
1318
- ws.toolbox_.refreshSelection();
1319
- }
1320
- }
1321
-
1322
- /**
1323
- * Rename a variable by updating its name in the variable map. Update the
1324
- * flyout to show the renamed variable immediately.
1325
- *
1326
- * @param id ID of the variable to rename.
1327
- * @param newName New variable name.
1328
- */
1329
- override renameVariableById(id: string, newName: string) {
1330
- super.renameVariableById(id, newName);
1331
- this.refreshToolboxSelection();
1332
- }
1333
-
1334
- /**
1335
- * Delete a variable by the passed in ID. Update the flyout to show
1336
- * immediately that the variable is deleted.
1337
- *
1338
- * @param id ID of variable to delete.
1339
- */
1340
- override deleteVariableById(id: string) {
1341
- super.deleteVariableById(id);
1342
- this.refreshToolboxSelection();
1343
- }
1344
-
1345
- /**
1346
- * Create a new variable with the given name. Update the flyout to show the
1347
- * new variable immediately.
1348
- *
1349
- * @param name The new variable's name.
1350
- * @param opt_type The type of the variable like 'int' or 'string'.
1351
- * Does not need to be unique. Field_variable can filter variables based
1352
- * on their type. This will default to '' which is a specific type.
1353
- * @param opt_id The unique ID of the variable. This will default to a UUID.
1354
- * @returns The newly created variable.
1355
- */
1356
- override createVariable(
1357
- name: string,
1358
- opt_type?: string | null,
1359
- opt_id?: string | null,
1360
- ): IVariableModel<IVariableState> {
1361
- const newVar = super.createVariable(name, opt_type, opt_id);
1362
- this.refreshToolboxSelection();
1363
- return newVar;
1364
- }
1365
-
1366
- /** Make a list of all the delete areas for this workspace. */
1367
- recordDragTargets() {
1368
- const dragTargets = this.componentManager.getComponents(
1369
- ComponentManager.Capability.DRAG_TARGET,
1370
- true,
1371
- );
1372
-
1373
- this.dragTargetAreas = [];
1374
- for (let i = 0, targetArea; (targetArea = dragTargets[i]); i++) {
1375
- const rect = targetArea.getClientRect();
1376
- if (rect) {
1377
- this.dragTargetAreas.push({
1378
- component: targetArea,
1379
- clientRect: rect,
1380
- });
1381
- }
1382
- }
1383
- }
1384
- /* eslint-disable jsdoc/require-returns-check */
1385
- /* eslint-disable @typescript-eslint/no-unused-vars */
1386
- /**
1387
- * Obtain a newly created block.
1388
- *
1389
- * @param prototypeName Name of the language object containing type-specific
1390
- * functions for this block.
1391
- * @param opt_id Optional ID. Use this ID if provided, otherwise create a new
1392
- * ID.
1393
- * @returns The created block.
1394
- */
1395
- override newBlock(prototypeName: string, opt_id?: string): BlockSvg {
1396
- throw new Error(
1397
- 'The implementation of newBlock should be ' +
1398
- 'monkey-patched in by blockly.ts',
1399
- );
1400
- }
1401
-
1402
- /**
1403
- * Obtain a newly created comment.
1404
- *
1405
- * @param id Optional ID. Use this ID if provided, otherwise create a new
1406
- * ID.
1407
- * @returns The created comment.
1408
- */
1409
- newComment(id?: string): WorkspaceComment {
1410
- throw new Error(
1411
- 'The implementation of newComment should be ' +
1412
- 'monkey-patched in by blockly.ts',
1413
- );
1414
- }
1415
- /* eslint-enable */
1416
-
1417
- /**
1418
- * Returns the drag target the pointer event is over.
1419
- *
1420
- * @param e Pointer move event.
1421
- * @returns Null if not over a drag target, or the drag target the event is
1422
- * over.
1423
- */
1424
- getDragTarget(e: PointerEvent): IDragTarget | null {
1425
- for (let i = 0, targetArea; (targetArea = this.dragTargetAreas[i]); i++) {
1426
- if (targetArea.clientRect.contains(e.clientX, e.clientY)) {
1427
- return targetArea.component;
1428
- }
1429
- }
1430
- return null;
1431
- }
1432
-
1433
- /**
1434
- * Handle a pointerdown on SVG drawing surface.
1435
- *
1436
- * @param e Pointer down event.
1437
- */
1438
- private onMouseDown_(e: PointerEvent) {
1439
- const gesture = this.getGesture(e);
1440
- if (gesture) {
1441
- gesture.handleWsStart(e, this);
1442
- }
1443
- }
1444
-
1445
- /**
1446
- * Start tracking a drag of an object on this workspace.
1447
- *
1448
- * @param e Pointer down event.
1449
- * @param xy Starting location of object.
1450
- */
1451
- startDrag(e: PointerEvent, xy: Coordinate) {
1452
- // Record the starting offset between the bubble's location and the mouse.
1453
- const point = browserEvents.mouseToSvg(
1454
- e,
1455
- this.getParentSvg(),
1456
- this.getInverseScreenCTM(),
1457
- );
1458
- // Fix scale of mouse event.
1459
- point.x /= this.scale;
1460
- point.y /= this.scale;
1461
- this.dragDeltaXY = Coordinate.difference(xy, point);
1462
- }
1463
-
1464
- /**
1465
- * Track a drag of an object on this workspace.
1466
- *
1467
- * @param e Pointer move event.
1468
- * @returns New location of object.
1469
- */
1470
- moveDrag(e: PointerEvent): Coordinate {
1471
- const point = browserEvents.mouseToSvg(
1472
- e,
1473
- this.getParentSvg(),
1474
- this.getInverseScreenCTM(),
1475
- );
1476
- // Fix scale of mouse event.
1477
- point.x /= this.scale;
1478
- point.y /= this.scale;
1479
- return Coordinate.sum(this.dragDeltaXY!, point);
1480
- }
1481
-
1482
- /**
1483
- * Is the user currently dragging a block or scrolling the flyout/workspace?
1484
- *
1485
- * @returns True if currently dragging or scrolling.
1486
- */
1487
- isDragging(): boolean {
1488
- return this.currentGesture_ !== null && this.currentGesture_.isDragging();
1489
- }
1490
-
1491
- /**
1492
- * Is this workspace draggable?
1493
- *
1494
- * @returns True if this workspace may be dragged.
1495
- */
1496
- isDraggable(): boolean {
1497
- return this.options.moveOptions && this.options.moveOptions.drag;
1498
- }
1499
-
1500
- /**
1501
- * Is this workspace movable?
1502
- *
1503
- * This means the user can reposition the X Y coordinates of the workspace
1504
- * through input. This can be through scrollbars, scroll wheel, dragging, or
1505
- * through zooming with the scroll wheel or pinch (since the zoom is centered
1506
- * on the mouse position). This does not include zooming with the zoom
1507
- * controls since the X Y coordinates are decided programmatically.
1508
- *
1509
- * @returns True if the workspace is movable, false otherwise.
1510
- */
1511
- isMovable(): boolean {
1512
- return (
1513
- (this.options.moveOptions && !!this.options.moveOptions.scrollbars) ||
1514
- (this.options.moveOptions && this.options.moveOptions.wheel) ||
1515
- (this.options.moveOptions && this.options.moveOptions.drag) ||
1516
- (this.options.zoomOptions && this.options.zoomOptions.wheel) ||
1517
- (this.options.zoomOptions && this.options.zoomOptions.pinch)
1518
- );
1519
- }
1520
-
1521
- /**
1522
- * Is this workspace movable horizontally?
1523
- *
1524
- * @returns True if the workspace is movable horizontally, false otherwise.
1525
- */
1526
- isMovableHorizontally(): boolean {
1527
- const hasScrollbars = !!this.scrollbar;
1528
- return (
1529
- this.isMovable() &&
1530
- (!hasScrollbars ||
1531
- (hasScrollbars && this.scrollbar!.canScrollHorizontally()))
1532
- );
1533
- }
1534
-
1535
- /**
1536
- * Is this workspace movable vertically?
1537
- *
1538
- * @returns True if the workspace is movable vertically, false otherwise.
1539
- */
1540
- isMovableVertically(): boolean {
1541
- const hasScrollbars = !!this.scrollbar;
1542
- return (
1543
- this.isMovable() &&
1544
- (!hasScrollbars ||
1545
- (hasScrollbars && this.scrollbar!.canScrollVertically()))
1546
- );
1547
- }
1548
-
1549
- /**
1550
- * Handle a mouse-wheel on SVG drawing surface.
1551
- *
1552
- * @param e Mouse wheel event.
1553
- */
1554
- private onMouseWheel_(e: WheelEvent) {
1555
- // Don't scroll or zoom anything if drag is in progress.
1556
- if (Gesture.inProgress()) {
1557
- e.preventDefault();
1558
- e.stopPropagation();
1559
- return;
1560
- }
1561
- const canWheelZoom =
1562
- this.options.zoomOptions && this.options.zoomOptions.wheel;
1563
- const canWheelMove =
1564
- this.options.moveOptions && this.options.moveOptions.wheel;
1565
- if (!canWheelZoom && !canWheelMove) {
1566
- return;
1567
- }
1568
-
1569
- const scrollDelta = browserEvents.getScrollDeltaPixels(e);
1570
-
1571
- // Zoom should also be enabled by the command key on Mac devices,
1572
- // but not super on Unix.
1573
- let commandKey;
1574
- if (userAgent.MAC) {
1575
- commandKey = e.metaKey;
1576
- }
1577
-
1578
- if (canWheelZoom && (e.ctrlKey || commandKey || !canWheelMove)) {
1579
- // Zoom.
1580
- // The vertical scroll distance that corresponds to a click of a zoom
1581
- // button.
1582
- const PIXELS_PER_ZOOM_STEP = 50;
1583
- const delta = -scrollDelta.y / PIXELS_PER_ZOOM_STEP;
1584
- const position = browserEvents.mouseToSvg(
1585
- e,
1586
- this.getParentSvg(),
1587
- this.getInverseScreenCTM(),
1588
- );
1589
- this.zoom(position.x, position.y, delta);
1590
- } else {
1591
- // Scroll.
1592
- let x = this.scrollX - scrollDelta.x;
1593
- let y = this.scrollY - scrollDelta.y;
1594
-
1595
- if (e.shiftKey && !scrollDelta.x) {
1596
- // Scroll horizontally (based on vertical scroll delta).
1597
- // This is needed as for some browser/system combinations which do not
1598
- // set deltaX.
1599
- x = this.scrollX - scrollDelta.y;
1600
- y = this.scrollY; // Don't scroll vertically.
1601
- }
1602
- this.scroll(x, y);
1603
- }
1604
- e.preventDefault();
1605
- }
1606
-
1607
- /**
1608
- * Calculate the bounding box for the blocks on the workspace.
1609
- * Coordinate system: workspace coordinates.
1610
- *
1611
- * @returns Contains the position and size of the bounding box containing the
1612
- * blocks on the workspace.
1613
- */
1614
- getBlocksBoundingBox(): Rect {
1615
- const topElements = this.getTopBoundedElements();
1616
- // There are no blocks, return empty rectangle.
1617
- if (!topElements.length) {
1618
- return new Rect(0, 0, 0, 0);
1619
- }
1620
-
1621
- // Initialize boundary using the first block.
1622
- const boundary = topElements[0].getBoundingRectangle();
1623
-
1624
- // Start at 1 since the 0th block was used for initialization.
1625
- for (let i = 1; i < topElements.length; i++) {
1626
- const topElement = topElements[i];
1627
- if (
1628
- (topElement as any).isInsertionMarker &&
1629
- (topElement as any).isInsertionMarker()
1630
- ) {
1631
- continue;
1632
- }
1633
- const blockBoundary = topElement.getBoundingRectangle();
1634
- if (blockBoundary.top < boundary.top) {
1635
- boundary.top = blockBoundary.top;
1636
- }
1637
- if (blockBoundary.bottom > boundary.bottom) {
1638
- boundary.bottom = blockBoundary.bottom;
1639
- }
1640
- if (blockBoundary.left < boundary.left) {
1641
- boundary.left = blockBoundary.left;
1642
- }
1643
- if (blockBoundary.right > boundary.right) {
1644
- boundary.right = blockBoundary.right;
1645
- }
1646
- }
1647
- return boundary;
1648
- }
1649
-
1650
- /** Clean up the workspace by ordering all the blocks in a column. */
1651
- cleanUp() {
1652
- this.setResizesEnabled(false);
1653
- eventUtils.setGroup(true);
1654
- const topBlocks = this.getTopBlocks(true);
1655
- let cursorY = 0;
1656
- for (let i = 0, block; (block = topBlocks[i]); i++) {
1657
- if (!block.isMovable()) {
1658
- continue;
1659
- }
1660
- const xy = block.getRelativeToSurfaceXY();
1661
- block.moveBy(-xy.x, cursorY - xy.y, ['cleanup']);
1662
- block.snapToGrid();
1663
- cursorY =
1664
- block.getRelativeToSurfaceXY().y +
1665
- block.getHeightWidth().height +
1666
- this.renderer.getConstants().MIN_BLOCK_HEIGHT;
1667
- }
1668
- eventUtils.setGroup(false);
1669
- this.setResizesEnabled(true);
1670
- }
1671
-
1672
- /**
1673
- * Show the context menu for the workspace.
1674
- *
1675
- * @param e Mouse event.
1676
- * @internal
1677
- */
1678
- showContextMenu(e: PointerEvent) {
1679
- if (this.options.readOnly || this.isFlyout) {
1680
- return;
1681
- }
1682
- const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions(
1683
- ContextMenuRegistry.ScopeType.WORKSPACE,
1684
- {workspace: this},
1685
- );
1686
-
1687
- // Allow the developer to add or modify menuOptions.
1688
- if (this.configureContextMenu) {
1689
- this.configureContextMenu(menuOptions, e);
1690
- }
1691
-
1692
- ContextMenu.show(e, menuOptions, this.RTL, this);
1693
- }
1694
-
1695
- /**
1696
- * Modify the block tree on the existing toolbox.
1697
- *
1698
- * @param toolboxDef DOM tree of toolbox contents, string of toolbox contents,
1699
- * or JSON representing toolbox definition.
1700
- */
1701
- updateToolbox(toolboxDef: toolbox.ToolboxDefinition | null) {
1702
- const parsedToolboxDef = toolbox.convertToolboxDefToJson(toolboxDef);
1703
-
1704
- if (!parsedToolboxDef) {
1705
- if (this.options.languageTree) {
1706
- throw Error("Can't nullify an existing toolbox.");
1707
- }
1708
- return; // No change (null to null).
1709
- }
1710
- if (!this.options.languageTree) {
1711
- throw Error("Existing toolbox is null. Can't create new toolbox.");
1712
- }
1713
-
1714
- if (toolbox.hasCategories(parsedToolboxDef)) {
1715
- if (!this.toolbox_) {
1716
- throw Error("Existing toolbox has no categories. Can't change mode.");
1717
- }
1718
- this.options.languageTree = parsedToolboxDef;
1719
- this.toolbox_.render(parsedToolboxDef);
1720
- } else {
1721
- if (!this.flyout) {
1722
- throw Error("Existing toolbox has categories. Can't change mode.");
1723
- }
1724
- this.options.languageTree = parsedToolboxDef;
1725
- this.flyout.show(parsedToolboxDef);
1726
- }
1727
- }
1728
-
1729
- /** Mark this workspace as the currently focused main workspace. */
1730
- markFocused() {
1731
- if (this.options.parentWorkspace) {
1732
- this.options.parentWorkspace.markFocused();
1733
- } else {
1734
- common.setMainWorkspace(this);
1735
- // We call e.preventDefault in many event handlers which means we
1736
- // need to explicitly grab focus (e.g from a textarea) because
1737
- // the browser will not do it for us.
1738
- this.getParentSvg().focus({preventScroll: true});
1739
- }
1740
- }
1741
-
1742
- /**
1743
- * Zooms the workspace in or out relative to/centered on the given (x, y)
1744
- * coordinate.
1745
- *
1746
- * @param x X coordinate of center, in pixel units relative to the top-left
1747
- * corner of the parentSVG.
1748
- * @param y Y coordinate of center, in pixel units relative to the top-left
1749
- * corner of the parentSVG.
1750
- * @param amount Amount of zooming. The formula for the new scale is newScale
1751
- * = currentScale * (scaleSpeed^amount). scaleSpeed is set in the
1752
- * workspace options. Negative amount values zoom out, and positive amount
1753
- * values zoom in.
1754
- */
1755
- zoom(x: number, y: number, amount: number) {
1756
- // Scale factor.
1757
- const speed = this.options.zoomOptions.scaleSpeed;
1758
- let scaleChange = Math.pow(speed, amount);
1759
- const newScale = this.scale * scaleChange;
1760
- if (this.scale === newScale) {
1761
- return; // No change in zoom.
1762
- }
1763
-
1764
- // Clamp scale within valid range.
1765
- if (newScale > this.options.zoomOptions.maxScale) {
1766
- scaleChange = this.options.zoomOptions.maxScale / this.scale;
1767
- } else if (newScale < this.options.zoomOptions.minScale) {
1768
- scaleChange = this.options.zoomOptions.minScale / this.scale;
1769
- }
1770
-
1771
- // Transform the x/y coordinates from the parentSVG's space into the
1772
- // canvas' space, so that they are in workspace units relative to the top
1773
- // left of the visible portion of the workspace.
1774
- let matrix = this.getCanvas().getCTM();
1775
- let center = this.getParentSvg().createSVGPoint();
1776
- center.x = x;
1777
- center.y = y;
1778
- center = center.matrixTransform(matrix!.inverse());
1779
- x = center.x;
1780
- y = center.y;
1781
-
1782
- // Find the new scrollX/scrollY so that the center remains in the same
1783
- // position (relative to the center) after we zoom.
1784
- // newScale and matrix.a should be identical (within a rounding error).
1785
- matrix = matrix!
1786
- .translate(x * (1 - scaleChange), y * (1 - scaleChange))
1787
- .scale(scaleChange);
1788
- // scrollX and scrollY are in pixels.
1789
- // The scrollX and scrollY still need to have absoluteLeft and absoluteTop
1790
- // subtracted from them, but we'll leave that for setScale so that they're
1791
- // correctly updated for the new flyout size if we have a simple toolbox.
1792
- this.scrollX = matrix.e;
1793
- this.scrollY = matrix.f;
1794
- this.setScale(newScale);
1795
- }
1796
-
1797
- /**
1798
- * Zooming the blocks centered in the center of view with zooming in or out.
1799
- *
1800
- * @param type Type of zooming (-1 zooming out and 1 zooming in).
1801
- */
1802
- zoomCenter(type: number) {
1803
- const metrics = this.getMetrics();
1804
- let x;
1805
- let y;
1806
- if (this.flyout) {
1807
- // If you want blocks in the center of the view (visible portion of the
1808
- // workspace) to stay centered when the size of the view decreases (i.e.
1809
- // when the size of the flyout increases) you need the center of the
1810
- // *blockly div* to stay in the same pixel-position.
1811
- // Note: This only works because of how scrollCenter positions blocks.
1812
- x = metrics.svgWidth ? metrics.svgWidth / 2 : 0;
1813
- y = metrics.svgHeight ? metrics.svgHeight / 2 : 0;
1814
- } else {
1815
- x = metrics.viewWidth / 2 + metrics.absoluteLeft;
1816
- y = metrics.viewHeight / 2 + metrics.absoluteTop;
1817
- }
1818
- this.zoom(x, y, type);
1819
- }
1820
-
1821
- /** Zoom the blocks to fit in the workspace if possible. */
1822
- zoomToFit() {
1823
- if (!this.isMovable()) {
1824
- console.warn(
1825
- 'Tried to move a non-movable workspace. This could result' +
1826
- ' in blocks becoming inaccessible.',
1827
- );
1828
- return;
1829
- }
1830
-
1831
- const metrics = this.getMetrics();
1832
- let workspaceWidth = metrics.viewWidth;
1833
- let workspaceHeight = metrics.viewHeight;
1834
- const blocksBox = this.getBlocksBoundingBox();
1835
- const doubleMargin = ZOOM_TO_FIT_MARGIN * 2;
1836
- let blocksWidth = blocksBox.right - blocksBox.left + doubleMargin;
1837
- let blocksHeight = blocksBox.bottom - blocksBox.top + doubleMargin;
1838
- if (!blocksWidth) {
1839
- return; // Prevents zooming to infinity.
1840
- }
1841
- if (this.flyout) {
1842
- // We have to add the flyout size to both the workspace size and the
1843
- // block size because the blocks we want to resize include the blocks in
1844
- // the flyout, and the area we want to fit them includes the portion of
1845
- // the workspace that is behind the flyout.
1846
- if (this.horizontalLayout) {
1847
- workspaceHeight += this.flyout.getHeight();
1848
- // Convert from pixels to workspace coordinates.
1849
- blocksHeight += this.flyout.getHeight() / this.scale;
1850
- } else {
1851
- workspaceWidth += this.flyout.getWidth();
1852
- // Convert from pixels to workspace coordinates.
1853
- blocksWidth += this.flyout.getWidth() / this.scale;
1854
- }
1855
- }
1856
-
1857
- // Scale Units: (pixels / workspaceUnit)
1858
- const ratioX = workspaceWidth / blocksWidth;
1859
- const ratioY = workspaceHeight / blocksHeight;
1860
- eventUtils.disable();
1861
- try {
1862
- this.setScale(Math.min(ratioX, ratioY));
1863
- this.scrollCenter();
1864
- } finally {
1865
- eventUtils.enable();
1866
- }
1867
- this.maybeFireViewportChangeEvent();
1868
- }
1869
-
1870
- /**
1871
- * Add a transition class to the block and bubble canvas, to animate any
1872
- * transform changes.
1873
- *
1874
- * @internal
1875
- */
1876
- beginCanvasTransition() {
1877
- dom.addClass(this.getCanvas(), 'blocklyCanvasTransitioning');
1878
- dom.addClass(this.getBubbleCanvas(), 'blocklyCanvasTransitioning');
1879
- }
1880
-
1881
- /**
1882
- * Remove transition class from the block and bubble canvas.
1883
- *
1884
- * @internal
1885
- */
1886
- endCanvasTransition() {
1887
- dom.removeClass(this.getCanvas(), 'blocklyCanvasTransitioning');
1888
- dom.removeClass(this.getBubbleCanvas(), 'blocklyCanvasTransitioning');
1889
- }
1890
-
1891
- /** Center the workspace. */
1892
- scrollCenter() {
1893
- if (!this.isMovable()) {
1894
- console.warn(
1895
- 'Tried to move a non-movable workspace. This could result' +
1896
- ' in blocks becoming inaccessible.',
1897
- );
1898
- return;
1899
- }
1900
-
1901
- const metrics = this.getMetrics();
1902
- let x = (metrics.scrollWidth - metrics.viewWidth) / 2;
1903
- let y = (metrics.scrollHeight - metrics.viewHeight) / 2;
1904
-
1905
- // Convert from workspace directions to canvas directions.
1906
- x = -x - metrics.scrollLeft;
1907
- y = -y - metrics.scrollTop;
1908
- this.scroll(x, y);
1909
- }
1910
-
1911
- /**
1912
- * Scroll the workspace to center on the given block. If the block has other
1913
- * blocks stacked below it, the workspace will be centered on the stack,
1914
- * unless blockOnly is true.
1915
- *
1916
- * @param id ID of block center on.
1917
- * @param blockOnly True to center only on the block itself, not its stack.
1918
- */
1919
- centerOnBlock(id: string | null, blockOnly?: boolean) {
1920
- if (!this.isMovable()) {
1921
- console.warn(
1922
- 'Tried to move a non-movable workspace. This could result' +
1923
- ' in blocks becoming inaccessible.',
1924
- );
1925
- return;
1926
- }
1927
-
1928
- const block = id ? this.getBlockById(id) : null;
1929
- if (!block) {
1930
- return;
1931
- }
1932
-
1933
- // XY is in workspace coordinates.
1934
- const xy = block.getRelativeToSurfaceXY();
1935
- // Height/width is in workspace units.
1936
- const heightWidth = blockOnly
1937
- ? {height: block.height, width: block.width}
1938
- : block.getHeightWidth();
1939
-
1940
- // Find the enter of the block in workspace units.
1941
- const blockCenterY = xy.y + heightWidth.height / 2;
1942
-
1943
- // In RTL the block's position is the top right of the block, not top left.
1944
- const multiplier = this.RTL ? -1 : 1;
1945
- const blockCenterX = xy.x + (multiplier * heightWidth.width) / 2;
1946
-
1947
- // Workspace scale, used to convert from workspace coordinates to pixels.
1948
- const scale = this.scale;
1949
-
1950
- // Center of block in pixels, relative to workspace origin (center 0,0).
1951
- // Scrolling to here would put the block in the top-left corner of the
1952
- // visible workspace.
1953
- const pixelX = blockCenterX * scale;
1954
- const pixelY = blockCenterY * scale;
1955
-
1956
- const metrics = this.getMetrics();
1957
-
1958
- // viewHeight and viewWidth are in pixels.
1959
- const halfViewWidth = metrics.viewWidth / 2;
1960
- const halfViewHeight = metrics.viewHeight / 2;
1961
-
1962
- // Put the block in the center of the visible workspace instead.
1963
- const scrollToCenterX = pixelX - halfViewWidth;
1964
- const scrollToCenterY = pixelY - halfViewHeight;
1965
-
1966
- // Convert from workspace directions to canvas directions.
1967
- const x = -scrollToCenterX;
1968
- const y = -scrollToCenterY;
1969
-
1970
- this.scroll(x, y);
1971
- }
1972
-
1973
- /**
1974
- * Set the workspace's zoom factor.
1975
- *
1976
- * @param newScale Zoom factor. Units: (pixels / workspaceUnit).
1977
- */
1978
- setScale(newScale: number) {
1979
- if (
1980
- this.options.zoomOptions.maxScale &&
1981
- newScale > this.options.zoomOptions.maxScale
1982
- ) {
1983
- newScale = this.options.zoomOptions.maxScale;
1984
- } else if (
1985
- this.options.zoomOptions.minScale &&
1986
- newScale < this.options.zoomOptions.minScale
1987
- ) {
1988
- newScale = this.options.zoomOptions.minScale;
1989
- }
1990
- this.scale = newScale;
1991
-
1992
- this.hideChaff(false);
1993
- // Get the flyout, if any, whether our own or owned by the toolbox.
1994
- const flyout = this.getFlyout(false);
1995
- if (flyout && flyout.isVisible()) {
1996
- flyout.reflow();
1997
- this.recordDragTargets();
1998
- }
1999
- if (this.grid) {
2000
- this.grid.update(this.scale);
2001
- }
2002
-
2003
- // We call scroll instead of scrollbar.resize() so that we can center the
2004
- // zoom correctly without scrollbars, but scroll does not resize the
2005
- // scrollbars so we have to call resizeView/resizeContent as well.
2006
- const metrics = this.getMetrics();
2007
-
2008
- this.scrollX -= metrics.absoluteLeft;
2009
- this.scrollY -= metrics.absoluteTop;
2010
- // The scroll values and the view values are additive inverses of
2011
- // each other, so when we subtract from one we have to add to the other.
2012
- metrics.viewLeft += metrics.absoluteLeft;
2013
- metrics.viewTop += metrics.absoluteTop;
2014
-
2015
- this.scroll(this.scrollX, this.scrollY);
2016
- if (this.scrollbar) {
2017
- if (this.flyout) {
2018
- this.scrollbar.resizeView(metrics);
2019
- } else {
2020
- this.scrollbar.resizeContent(metrics);
2021
- }
2022
- }
2023
- }
2024
-
2025
- /**
2026
- * Get the workspace's zoom factor.
2027
- *
2028
- * @returns The workspace zoom factor. Units: (pixels / workspaceUnit).
2029
- */
2030
- getScale(): number {
2031
- return this.scale;
2032
- }
2033
-
2034
- /**
2035
- * Returns the absolute scale of the workspace.
2036
- *
2037
- * Workspace scaling is multiplicative; if a workspace B (e.g. a mutator editor)
2038
- * with scale Y is nested within a root workspace A with scale X, workspace B's
2039
- * effective scale is X * Y, because, as a child of A, it is already transformed
2040
- * by A's scaling factor, and then further transforms itself by its own scaling
2041
- * factor. Normally this Just Works, but for global elements (e.g. field
2042
- * editors) that are visually associated with a particular workspace but live at
2043
- * the top level of the DOM rather than being a child of their associated
2044
- * workspace, the absolute/effective scale may be needed to render
2045
- * appropriately.
2046
- *
2047
- * @returns The absolute/effective scale of the given workspace.
2048
- */
2049
- getAbsoluteScale() {
2050
- // Returns a workspace's own scale, without regard to multiplicative scaling.
2051
- const getLocalScale = (workspace: WorkspaceSvg): number => {
2052
- // Workspaces in flyouts may have a distinct scale; use this if relevant.
2053
- if (workspace.isFlyout) {
2054
- const flyout = workspace.targetWorkspace?.getFlyout();
2055
- if (flyout instanceof Flyout) {
2056
- return flyout.getFlyoutScale();
2057
- }
2058
- }
2059
-
2060
- return workspace.getScale();
2061
- };
2062
-
2063
- const computeScale = (workspace: WorkspaceSvg, scale: number): number => {
2064
- // If the workspace has no parent, or it does have a parent but is not
2065
- // actually a child of its parent workspace in the DOM (this is the case for
2066
- // flyouts in the main workspace), we're done; just return the scale so far
2067
- // multiplied by the workspace's own scale.
2068
- if (
2069
- !workspace.options.parentWorkspace ||
2070
- !workspace.options.parentWorkspace
2071
- .getSvgGroup()
2072
- .contains(workspace.getSvgGroup())
2073
- ) {
2074
- return scale * getLocalScale(workspace);
2075
- }
2076
-
2077
- // If there is a parent workspace, and this workspace is a child of it in
2078
- // the DOM, scales are multiplicative, so recurse up the workspace
2079
- // hierarchy.
2080
- return computeScale(
2081
- workspace.options.parentWorkspace,
2082
- scale * getLocalScale(workspace),
2083
- );
2084
- };
2085
-
2086
- return computeScale(this, 1);
2087
- }
2088
-
2089
- /**
2090
- * Scroll the workspace to a specified offset (in pixels), keeping in the
2091
- * workspace bounds. See comment on workspaceSvg.scrollX for more detail on
2092
- * the meaning of these values.
2093
- *
2094
- * @param x Target X to scroll to.
2095
- * @param y Target Y to scroll to.
2096
- */
2097
- scroll(x: number, y: number) {
2098
- this.hideChaff(/* opt_onlyClosePopups= */ true);
2099
-
2100
- // Keep scrolling within the bounds of the content.
2101
- const metrics = this.getMetrics();
2102
- // Canvas coordinates (aka scroll coordinates) have inverse directionality
2103
- // to workspace coordinates so we have to inverse them.
2104
- x = Math.min(x, -metrics.scrollLeft);
2105
- y = Math.min(y, -metrics.scrollTop);
2106
- const maxXDisplacement = Math.max(
2107
- 0,
2108
- metrics.scrollWidth - metrics.viewWidth,
2109
- );
2110
- const maxXScroll = metrics.scrollLeft + maxXDisplacement;
2111
- const maxYDisplacement = Math.max(
2112
- 0,
2113
- metrics.scrollHeight - metrics.viewHeight,
2114
- );
2115
- const maxYScroll = metrics.scrollTop + maxYDisplacement;
2116
- x = Math.max(x, -maxXScroll);
2117
- y = Math.max(y, -maxYScroll);
2118
- this.scrollX = x;
2119
- this.scrollY = y;
2120
-
2121
- if (this.scrollbar) {
2122
- // The content position (displacement from the content's top-left to the
2123
- // origin) plus the scroll position (displacement from the view's top-left
2124
- // to the origin) gives us the distance from the view's top-left to the
2125
- // content's top-left. Then we negate this so we get the displacement from
2126
- // the content's top-left to the view's top-left, matching the
2127
- // directionality of the scrollbars.
2128
- this.scrollbar.set(
2129
- -(x + metrics.scrollLeft),
2130
- -(y + metrics.scrollTop),
2131
- false,
2132
- );
2133
- }
2134
- // We have to shift the translation so that when the canvas is at 0, 0 the
2135
- // workspace origin is not underneath the toolbox.
2136
- x += metrics.absoluteLeft;
2137
- y += metrics.absoluteTop;
2138
- this.translate(x, y);
2139
- }
2140
-
2141
- /**
2142
- * Find the block on this workspace with the specified ID.
2143
- *
2144
- * @param id ID of block to find.
2145
- * @returns The sought after block, or null if not found.
2146
- */
2147
- override getBlockById(id: string): BlockSvg | null {
2148
- return super.getBlockById(id) as BlockSvg;
2149
- }
2150
-
2151
- /**
2152
- * Find all blocks in workspace. Blocks are optionally sorted
2153
- * by position; top to bottom (with slight LTR or RTL bias).
2154
- *
2155
- * @param ordered Sort the list if true.
2156
- * @returns Array of blocks.
2157
- */
2158
- override getAllBlocks(ordered = false): BlockSvg[] {
2159
- return super.getAllBlocks(ordered) as BlockSvg[];
2160
- }
2161
-
2162
- /**
2163
- * Finds the top-level blocks and returns them. Blocks are optionally sorted
2164
- * by position; top to bottom (with slight LTR or RTL bias).
2165
- *
2166
- * @param ordered Sort the list if true.
2167
- * @returns The top-level block objects.
2168
- */
2169
- override getTopBlocks(ordered = false): BlockSvg[] {
2170
- return super.getTopBlocks(ordered) as BlockSvg[];
2171
- }
2172
-
2173
- /**
2174
- * Adds a block to the list of top blocks.
2175
- *
2176
- * @param block Block to add.
2177
- */
2178
- override addTopBlock(block: Block) {
2179
- this.addTopBoundedElement(block as BlockSvg);
2180
- super.addTopBlock(block);
2181
- }
2182
-
2183
- /**
2184
- * Removes a block from the list of top blocks.
2185
- *
2186
- * @param block Block to remove.
2187
- */
2188
- override removeTopBlock(block: Block) {
2189
- this.removeTopBoundedElement(block as BlockSvg);
2190
- super.removeTopBlock(block);
2191
- }
2192
-
2193
- /**
2194
- * Adds a comment to the list of top comments.
2195
- *
2196
- * @param comment comment to add.
2197
- */
2198
- override addTopComment(comment: WorkspaceComment) {
2199
- this.addTopBoundedElement(comment as RenderedWorkspaceComment);
2200
- super.addTopComment(comment);
2201
- }
2202
-
2203
- /**
2204
- * Removes a comment from the list of top comments.
2205
- *
2206
- * @param comment comment to remove.
2207
- */
2208
- override removeTopComment(comment: WorkspaceComment) {
2209
- this.removeTopBoundedElement(comment as RenderedWorkspaceComment);
2210
- super.removeTopComment(comment);
2211
- }
2212
-
2213
- override getRootWorkspace(): WorkspaceSvg | null {
2214
- return super.getRootWorkspace() as WorkspaceSvg | null;
2215
- }
2216
-
2217
- /**
2218
- * Adds a bounded element to the list of top bounded elements.
2219
- *
2220
- * @param element Bounded element to add.
2221
- */
2222
- addTopBoundedElement(element: IBoundedElement) {
2223
- this.topBoundedElements.push(element);
2224
- }
2225
-
2226
- /**
2227
- * Removes a bounded element from the list of top bounded elements.
2228
- *
2229
- * @param element Bounded element to remove.
2230
- */
2231
- removeTopBoundedElement(element: IBoundedElement) {
2232
- arrayUtils.removeElem(this.topBoundedElements, element);
2233
- }
2234
-
2235
- /**
2236
- * Finds the top-level bounded elements and returns them.
2237
- *
2238
- * @returns The top-level bounded elements.
2239
- */
2240
- getTopBoundedElements(): IBoundedElement[] {
2241
- return new Array<IBoundedElement>().concat(this.topBoundedElements);
2242
- }
2243
-
2244
- /**
2245
- * Update whether this workspace has resizes enabled.
2246
- * If enabled, workspace will resize when appropriate.
2247
- * If disabled, workspace will not resize until re-enabled.
2248
- * Use to avoid resizing during a batch operation, for performance.
2249
- *
2250
- * @param enabled Whether resizes should be enabled.
2251
- */
2252
- setResizesEnabled(enabled: boolean) {
2253
- const reenabled = !this.resizesEnabled && enabled;
2254
- this.resizesEnabled = enabled;
2255
- if (reenabled) {
2256
- // Newly enabled. Trigger a resize.
2257
- this.resizeContents();
2258
- }
2259
- }
2260
-
2261
- /**
2262
- * Dispose of all blocks in workspace, with an optimization to prevent
2263
- * resizes.
2264
- */
2265
- override clear() {
2266
- this.setResizesEnabled(false);
2267
- super.clear();
2268
- this.topBoundedElements = [];
2269
- this.setResizesEnabled(true);
2270
- }
2271
-
2272
- /**
2273
- * Register a callback function associated with a given key, for clicks on
2274
- * buttons and labels in the flyout.
2275
- * For instance, a button specified by the XML
2276
- * <button text="create variable" callbackKey="CREATE_VARIABLE"></button>
2277
- * should be matched by a call to
2278
- * registerButtonCallback("CREATE_VARIABLE", yourCallbackFunction).
2279
- *
2280
- * @param key The name to use to look up this function.
2281
- * @param func The function to call when the given button is clicked.
2282
- */
2283
- registerButtonCallback(key: string, func: (p1: FlyoutButton) => void) {
2284
- if (typeof func !== 'function') {
2285
- throw TypeError('Button callbacks must be functions.');
2286
- }
2287
- this.flyoutButtonCallbacks.set(key, func);
2288
- }
2289
-
2290
- /**
2291
- * Get the callback function associated with a given key, for clicks on
2292
- * buttons and labels in the flyout.
2293
- *
2294
- * @param key The name to use to look up the function.
2295
- * @returns The function corresponding to the given key for this workspace;
2296
- * null if no callback is registered.
2297
- */
2298
- getButtonCallback(key: string): ((p1: FlyoutButton) => void) | null {
2299
- return this.flyoutButtonCallbacks.get(key) ?? null;
2300
- }
2301
-
2302
- /**
2303
- * Remove a callback for a click on a button in the flyout.
2304
- *
2305
- * @param key The name associated with the callback function.
2306
- */
2307
- removeButtonCallback(key: string) {
2308
- this.flyoutButtonCallbacks.delete(key);
2309
- }
2310
-
2311
- /**
2312
- * Register a callback function associated with a given key, for populating
2313
- * custom toolbox categories in this workspace. See the variable and
2314
- * procedure categories as an example.
2315
- *
2316
- * @param key The name to use to look up this function.
2317
- * @param func The function to call when the given toolbox category is opened.
2318
- */
2319
- registerToolboxCategoryCallback(
2320
- key: string,
2321
- func: (p1: WorkspaceSvg) => toolbox.FlyoutDefinition,
2322
- ) {
2323
- if (typeof func !== 'function') {
2324
- throw TypeError('Toolbox category callbacks must be functions.');
2325
- }
2326
- this.toolboxCategoryCallbacks.set(key, func);
2327
- }
2328
-
2329
- /**
2330
- * Get the callback function associated with a given key, for populating
2331
- * custom toolbox categories in this workspace.
2332
- *
2333
- * @param key The name to use to look up the function.
2334
- * @returns The function corresponding to the given key for this workspace, or
2335
- * null if no function is registered.
2336
- */
2337
- getToolboxCategoryCallback(
2338
- key: string,
2339
- ): ((p1: WorkspaceSvg) => toolbox.FlyoutDefinition) | null {
2340
- return this.toolboxCategoryCallbacks.get(key) || null;
2341
- }
2342
-
2343
- /**
2344
- * Remove a callback for a click on a custom category's name in the toolbox.
2345
- *
2346
- * @param key The name associated with the callback function.
2347
- */
2348
- removeToolboxCategoryCallback(key: string) {
2349
- this.toolboxCategoryCallbacks.delete(key);
2350
- }
2351
-
2352
- /**
2353
- * Look up the gesture that is tracking this touch stream on this workspace.
2354
- * May create a new gesture.
2355
- *
2356
- * @param e Pointer event.
2357
- * @returns The gesture that is tracking this touch stream, or null if no
2358
- * valid gesture exists.
2359
- * @internal
2360
- */
2361
- getGesture(e: PointerEvent): Gesture | null {
2362
- const isStart = e.type === 'pointerdown';
2363
-
2364
- const gesture = this.currentGesture_;
2365
- if (gesture) {
2366
- if (isStart && gesture.hasStarted()) {
2367
- console.warn('Tried to start the same gesture twice.');
2368
- // That's funny. We must have missed a mouse up.
2369
- // Cancel it, rather than try to retrieve all of the state we need.
2370
- gesture.cancel();
2371
- return null;
2372
- }
2373
- return gesture;
2374
- }
2375
-
2376
- // No gesture existed on this workspace, but this looks like the start of a
2377
- // new gesture.
2378
- if (isStart) {
2379
- this.currentGesture_ = new Gesture(e, this);
2380
- return this.currentGesture_;
2381
- }
2382
- // No gesture existed and this event couldn't be the start of a new gesture.
2383
- return null;
2384
- }
2385
-
2386
- /**
2387
- * Clear the reference to the current gesture.
2388
- *
2389
- * @internal
2390
- */
2391
- clearGesture() {
2392
- this.currentGesture_ = null;
2393
- }
2394
-
2395
- /**
2396
- * Cancel the current gesture, if one exists.
2397
- *
2398
- * @internal
2399
- */
2400
- cancelCurrentGesture() {
2401
- if (this.currentGesture_) {
2402
- this.currentGesture_.cancel();
2403
- }
2404
- }
2405
-
2406
- /**
2407
- * Get the audio manager for this workspace.
2408
- *
2409
- * @returns The audio manager for this workspace.
2410
- */
2411
- getAudioManager(): WorkspaceAudio {
2412
- return this.audioManager;
2413
- }
2414
-
2415
- /**
2416
- * Get the grid object for this workspace, or null if there is none.
2417
- *
2418
- * @returns The grid object for this workspace.
2419
- */
2420
- getGrid(): Grid | null {
2421
- return this.grid;
2422
- }
2423
-
2424
- /**
2425
- * Close tooltips, context menus, dropdown selections, etc.
2426
- *
2427
- * @param onlyClosePopups Whether only popups should be closed. Defaults to
2428
- * false.
2429
- */
2430
- hideChaff(onlyClosePopups = false) {
2431
- Tooltip.hide();
2432
- WidgetDiv.hideIfOwnerIsInWorkspace(this);
2433
- dropDownDiv.hideWithoutAnimation();
2434
-
2435
- this.hideComponents(onlyClosePopups);
2436
- }
2437
-
2438
- /**
2439
- * Hide any autohideable components (like flyout, trashcan, and any
2440
- * user-registered components).
2441
- *
2442
- * @param onlyClosePopups Whether only popups should be closed. Defaults to
2443
- * false.
2444
- */
2445
- hideComponents(onlyClosePopups = false) {
2446
- const autoHideables = this.getComponentManager().getComponents(
2447
- ComponentManager.Capability.AUTOHIDEABLE,
2448
- true,
2449
- );
2450
- autoHideables.forEach((autoHideable) =>
2451
- autoHideable.autoHide(onlyClosePopups),
2452
- );
2453
- }
2454
-
2455
- /**
2456
- * Sets the X/Y translations of a top level workspace.
2457
- *
2458
- * @param xyRatio Contains an x and/or y property which is a float between 0
2459
- * and 1 specifying the degree of scrolling.
2460
- */
2461
- private static setTopLevelWorkspaceMetrics_(
2462
- this: WorkspaceSvg,
2463
- xyRatio: {x?: number; y?: number},
2464
- ) {
2465
- const metrics = this.getMetrics();
2466
-
2467
- if (typeof xyRatio.x === 'number') {
2468
- this.scrollX = -(
2469
- metrics.scrollLeft +
2470
- (metrics.scrollWidth - metrics.viewWidth) * xyRatio.x
2471
- );
2472
- }
2473
- if (typeof xyRatio.y === 'number') {
2474
- this.scrollY = -(
2475
- metrics.scrollTop +
2476
- (metrics.scrollHeight - metrics.viewHeight) * xyRatio.y
2477
- );
2478
- }
2479
- // We have to shift the translation so that when the canvas is at 0, 0 the
2480
- // workspace origin is not underneath the toolbox.
2481
- const x = this.scrollX + metrics.absoluteLeft;
2482
- const y = this.scrollY + metrics.absoluteTop;
2483
- // We could call scroll here, but that has extra checks we don't need to do.
2484
- this.translate(x, y);
2485
- }
2486
-
2487
- /**
2488
- * Adds a CSS class to the workspace.
2489
- *
2490
- * @param className Name of class to add.
2491
- */
2492
- addClass(className: string) {
2493
- if (this.injectionDiv) {
2494
- dom.addClass(this.injectionDiv, className);
2495
- }
2496
- }
2497
-
2498
- /**
2499
- * Removes a CSS class from the workspace.
2500
- *
2501
- * @param className Name of class to remove.
2502
- */
2503
- removeClass(className: string) {
2504
- if (this.injectionDiv) {
2505
- dom.removeClass(this.injectionDiv, className);
2506
- }
2507
- }
2508
- }
2509
-
2510
- /**
2511
- * Size the workspace when the contents change. This also updates
2512
- * scrollbars accordingly.
2513
- *
2514
- * @param workspace The workspace to resize.
2515
- * @internal
2516
- */
2517
- export function resizeSvgContents(workspace: WorkspaceSvg) {
2518
- workspace.resizeContents();
2519
- }