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
@@ -0,0 +1,2267 @@
1
+ /**
2
+ * @license
3
+ * Visual Blocks Editor
4
+ *
5
+ * Copyright 2014 Google Inc.
6
+ * https://developers.google.com/blockly/
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+
21
+ /**
22
+ * @fileoverview Object representing a workspace rendered as SVG.
23
+ * @author fraser@google.com (Neil Fraser)
24
+ */
25
+ 'use strict';
26
+
27
+ goog.provide('Blockly.WorkspaceSvg');
28
+
29
+ // TODO(scr): Fix circular dependencies
30
+ //goog.require('Blockly.BlockSvg');
31
+ goog.require('Blockly.Colours');
32
+ goog.require('Blockly.ConnectionDB');
33
+ goog.require('Blockly.constants');
34
+ goog.require('Blockly.DataCategory');
35
+ goog.require('Blockly.DropDownDiv');
36
+ goog.require('Blockly.Events.BlockCreate');
37
+ goog.require('Blockly.Gesture');
38
+ goog.require('Blockly.Grid');
39
+ goog.require('Blockly.Options');
40
+ goog.require('Blockly.scratchBlocksUtils');
41
+ goog.require('Blockly.ScrollbarPair');
42
+ goog.require('Blockly.Touch');
43
+ goog.require('Blockly.Trashcan');
44
+ //goog.require('Blockly.VerticalFlyout');
45
+ goog.require('Blockly.Workspace');
46
+ goog.require('Blockly.WorkspaceAudio');
47
+ goog.require('Blockly.WorkspaceComment');
48
+ goog.require('Blockly.WorkspaceCommentSvg');
49
+ goog.require('Blockly.WorkspaceCommentSvg.render');
50
+ goog.require('Blockly.WorkspaceDragSurfaceSvg');
51
+ goog.require('Blockly.Xml');
52
+ goog.require('Blockly.ZoomControls');
53
+
54
+ goog.require('goog.array');
55
+ goog.require('goog.dom');
56
+ goog.require('goog.math.Coordinate');
57
+ goog.require('goog.userAgent');
58
+ goog.require('goog.math.Rect');
59
+
60
+ /**
61
+ * Class for a workspace. This is an onscreen area with optional trashcan,
62
+ * scrollbars, bubbles, and dragging.
63
+ * @param {!Blockly.Options} options Dictionary of options.
64
+ * @param {Blockly.BlockDragSurfaceSvg=} opt_blockDragSurface Drag surface for
65
+ * blocks.
66
+ * @param {Blockly.WorkspaceDragSurfaceSvg=} opt_wsDragSurface Drag surface for
67
+ * the workspace.
68
+ * @extends {Blockly.Workspace}
69
+ * @constructor
70
+ */
71
+ Blockly.WorkspaceSvg = function(options, opt_blockDragSurface, opt_wsDragSurface) {
72
+ Blockly.WorkspaceSvg.superClass_.constructor.call(this, options);
73
+ this.getMetrics =
74
+ options.getMetrics || Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_;
75
+ this.setMetrics =
76
+ options.setMetrics || Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_;
77
+
78
+ Blockly.ConnectionDB.init(this);
79
+
80
+ if (opt_blockDragSurface) {
81
+ this.blockDragSurface_ = opt_blockDragSurface;
82
+ }
83
+
84
+ if (opt_wsDragSurface) {
85
+ this.workspaceDragSurface_ = opt_wsDragSurface;
86
+ }
87
+
88
+ this.useWorkspaceDragSurface_ =
89
+ this.workspaceDragSurface_ && Blockly.utils.is3dSupported();
90
+
91
+ /**
92
+ * List of currently highlighted blocks. Block highlighting is often used to
93
+ * visually mark blocks currently being executed.
94
+ * @type !Array.<!Blockly.BlockSvg>
95
+ * @private
96
+ */
97
+ this.highlightedBlocks_ = [];
98
+
99
+ /**
100
+ * Object in charge of loading, storing, and playing audio for a workspace.
101
+ * @type {Blockly.WorkspaceAudio}
102
+ * @private
103
+ */
104
+ this.audioManager_ = new Blockly.WorkspaceAudio(options.parentWorkspace);
105
+
106
+ /**
107
+ * This workspace's grid object or null.
108
+ * @type {Blockly.Grid}
109
+ * @private
110
+ */
111
+ this.grid_ = this.options.gridPattern ?
112
+ new Blockly.Grid(options.gridPattern, options.gridOptions) : null;
113
+
114
+ this.registerToolboxCategoryCallback(Blockly.VARIABLE_CATEGORY_NAME,
115
+ Blockly.DataCategory);
116
+ this.registerToolboxCategoryCallback(Blockly.PROCEDURE_CATEGORY_NAME,
117
+ Blockly.Procedures.flyoutCategory);
118
+ };
119
+ goog.inherits(Blockly.WorkspaceSvg, Blockly.Workspace);
120
+
121
+ /**
122
+ * A wrapper function called when a resize event occurs.
123
+ * You can pass the result to `unbindEvent_`.
124
+ * @type {Array.<!Array>}
125
+ */
126
+ Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_ = null;
127
+
128
+ /**
129
+ * The render status of an SVG workspace.
130
+ * Returns `false` for headless workspaces and true for instances of
131
+ * `Blockly.WorkspaceSvg`.
132
+ * @type {boolean}
133
+ */
134
+ Blockly.WorkspaceSvg.prototype.rendered = true;
135
+
136
+ /**
137
+ * Whether the workspace is visible. False if the workspace has been hidden
138
+ * by calling `setVisible(false)`.
139
+ * @type {boolean}
140
+ * @private
141
+ */
142
+ Blockly.WorkspaceSvg.prototype.isVisible_ = true;
143
+
144
+ /**
145
+ * Is this workspace the surface for a flyout?
146
+ * @type {boolean}
147
+ */
148
+ Blockly.WorkspaceSvg.prototype.isFlyout = false;
149
+
150
+ /**
151
+ * Is this workspace the surface for a mutator?
152
+ * @type {boolean}
153
+ * @package
154
+ */
155
+ Blockly.WorkspaceSvg.prototype.isMutator = false;
156
+
157
+ /**
158
+ * Whether this workspace has resizes enabled.
159
+ * Disable during batch operations for a performance improvement.
160
+ * @type {boolean}
161
+ * @private
162
+ */
163
+ Blockly.WorkspaceSvg.prototype.resizesEnabled_ = true;
164
+
165
+ /**
166
+ * Whether this workspace has toolbox/flyout refreshes enabled.
167
+ * Disable during batch operations for a performance improvement.
168
+ * @type {boolean}
169
+ * @private
170
+ */
171
+ Blockly.WorkspaceSvg.prototype.toolboxRefreshEnabled_ = true;
172
+
173
+ /**
174
+ * Current horizontal scrolling offset in pixel units.
175
+ * @type {number}
176
+ */
177
+ Blockly.WorkspaceSvg.prototype.scrollX = 0;
178
+
179
+ /**
180
+ * Current vertical scrolling offset in pixel units.
181
+ * @type {number}
182
+ */
183
+ Blockly.WorkspaceSvg.prototype.scrollY = 0;
184
+
185
+ /**
186
+ * Horizontal scroll value when scrolling started in pixel units.
187
+ * @type {number}
188
+ */
189
+ Blockly.WorkspaceSvg.prototype.startScrollX = 0;
190
+
191
+ /**
192
+ * Vertical scroll value when scrolling started in pixel units.
193
+ * @type {number}
194
+ */
195
+ Blockly.WorkspaceSvg.prototype.startScrollY = 0;
196
+
197
+ /**
198
+ * Distance from mouse to object being dragged.
199
+ * @type {goog.math.Coordinate}
200
+ * @private
201
+ */
202
+ Blockly.WorkspaceSvg.prototype.dragDeltaXY_ = null;
203
+
204
+ /**
205
+ * Current scale.
206
+ * @type {number}
207
+ */
208
+ Blockly.WorkspaceSvg.prototype.scale = 1;
209
+
210
+ /**
211
+ * The workspace's trashcan (if any).
212
+ * @type {Blockly.Trashcan}
213
+ */
214
+ Blockly.WorkspaceSvg.prototype.trashcan = null;
215
+
216
+ /**
217
+ * This workspace's scrollbars, if they exist.
218
+ * @type {Blockly.ScrollbarPair}
219
+ */
220
+ Blockly.WorkspaceSvg.prototype.scrollbar = null;
221
+
222
+ /**
223
+ * The current gesture in progress on this workspace, if any.
224
+ * @type {Blockly.Gesture}
225
+ * @private
226
+ */
227
+ Blockly.WorkspaceSvg.prototype.currentGesture_ = null;
228
+
229
+ /**
230
+ * This workspace's surface for dragging blocks, if it exists.
231
+ * @type {Blockly.BlockDragSurfaceSvg}
232
+ * @private
233
+ */
234
+ Blockly.WorkspaceSvg.prototype.blockDragSurface_ = null;
235
+
236
+ /**
237
+ * This workspace's drag surface, if it exists.
238
+ * @type {Blockly.WorkspaceDragSurfaceSvg}
239
+ * @private
240
+ */
241
+ Blockly.WorkspaceSvg.prototype.workspaceDragSurface_ = null;
242
+
243
+ /**
244
+ * Whether to move workspace to the drag surface when it is dragged.
245
+ * True if it should move, false if it should be translated directly.
246
+ * @type {boolean}
247
+ * @private
248
+ */
249
+ Blockly.WorkspaceSvg.prototype.useWorkspaceDragSurface_ = false;
250
+
251
+ /**
252
+ * Whether the drag surface is actively in use. When true, calls to
253
+ * translate will translate the drag surface instead of the translating the
254
+ * workspace directly.
255
+ * This is set to true in setupDragSurface and to false in resetDragSurface.
256
+ * @type {boolean}
257
+ * @private
258
+ */
259
+ Blockly.WorkspaceSvg.prototype.isDragSurfaceActive_ = false;
260
+
261
+ /**
262
+ * The first parent div with 'injectionDiv' in the name, or null if not set.
263
+ * Access this with getInjectionDiv.
264
+ * @type {!Element}
265
+ * @private
266
+ */
267
+ Blockly.WorkspaceSvg.prototype.injectionDiv_ = null;
268
+
269
+ /**
270
+ * Last known position of the page scroll.
271
+ * This is used to determine whether we have recalculated screen coordinate
272
+ * stuff since the page scrolled.
273
+ * @type {!goog.math.Coordinate}
274
+ * @private
275
+ */
276
+ Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_ = null;
277
+
278
+ /**
279
+ * Map from function names to callbacks, for deciding what to do when a button
280
+ * is clicked.
281
+ * @type {!Object.<string, function(!Blockly.FlyoutButton)>}
282
+ * @private
283
+ */
284
+ Blockly.WorkspaceSvg.prototype.flyoutButtonCallbacks_ = {};
285
+
286
+ /**
287
+ * Map from function names to callbacks, for deciding what to do when a custom
288
+ * toolbox category is opened.
289
+ * @type {!Object.<string, function(!Blockly.Workspace):!Array.<!Element>>}
290
+ * @private
291
+ */
292
+ Blockly.WorkspaceSvg.prototype.toolboxCategoryCallbacks_ = {};
293
+
294
+ /**
295
+ * Inverted screen CTM, for use in mouseToSvg.
296
+ * @type {SVGMatrix}
297
+ * @private
298
+ */
299
+ Blockly.WorkspaceSvg.prototype.inverseScreenCTM_ = null;
300
+
301
+ /**
302
+ * Inverted screen CTM is dirty.
303
+ * @type {Boolean}
304
+ * @private
305
+ */
306
+ Blockly.WorkspaceSvg.prototype.inverseScreenCTMDirty_ = true;
307
+
308
+ /**
309
+ * Getter for the inverted screen CTM.
310
+ * @return {SVGMatrix} The matrix to use in mouseToSvg
311
+ */
312
+ Blockly.WorkspaceSvg.prototype.getInverseScreenCTM = function() {
313
+
314
+ // Defer getting the screen CTM until we actually need it, this should
315
+ // avoid forced reflows from any calls to updateInverseScreenCTM.
316
+ if (this.inverseScreenCTMDirty_) {
317
+ var ctm = this.getParentSvg().getScreenCTM();
318
+ if (ctm) {
319
+ this.inverseScreenCTM_ = ctm.inverse();
320
+ this.inverseScreenCTMDirty_ = false;
321
+ }
322
+ }
323
+
324
+ return this.inverseScreenCTM_;
325
+ };
326
+
327
+ /**
328
+ * Getter for isVisible
329
+ * @return {boolean} Whether the workspace is visible. False if the workspace has been hidden
330
+ * by calling `setVisible(false)`.
331
+ */
332
+ Blockly.WorkspaceSvg.prototype.isVisible = function() {
333
+ return this.isVisible_;
334
+ };
335
+
336
+ /**
337
+ * Mark the inverse screen CTM as dirty.
338
+ */
339
+ Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM = function() {
340
+ this.inverseScreenCTMDirty_ = true;
341
+ };
342
+
343
+ /**
344
+ * Return the absolute coordinates of the top-left corner of this element,
345
+ * scales that after canvas SVG element, if it's a descendant.
346
+ * The origin (0,0) is the top-left corner of the Blockly SVG.
347
+ * @param {!Element} element Element to find the coordinates of.
348
+ * @return {!goog.math.Coordinate} Object with .x and .y properties.
349
+ * @private
350
+ */
351
+ Blockly.WorkspaceSvg.prototype.getSvgXY = function(element) {
352
+ var x = 0;
353
+ var y = 0;
354
+ var scale = 1;
355
+ if (goog.dom.contains(this.getCanvas(), element) ||
356
+ goog.dom.contains(this.getBubbleCanvas(), element)) {
357
+ // Before the SVG canvas, scale the coordinates.
358
+ scale = this.scale;
359
+ }
360
+ do {
361
+ // Loop through this block and every parent.
362
+ var xy = Blockly.utils.getRelativeXY(element);
363
+ if (element == this.getCanvas() ||
364
+ element == this.getBubbleCanvas()) {
365
+ // After the SVG canvas, don't scale the coordinates.
366
+ scale = 1;
367
+ }
368
+ x += xy.x * scale;
369
+ y += xy.y * scale;
370
+ element = element.parentNode;
371
+ } while (element && element != this.getParentSvg());
372
+ return new goog.math.Coordinate(x, y);
373
+ };
374
+
375
+ /**
376
+ * Return the position of the workspace origin relative to the injection div
377
+ * origin in pixels.
378
+ * The workspace origin is where a block would render at position (0, 0).
379
+ * It is not the upper left corner of the workspace SVG.
380
+ * @return {!goog.math.Coordinate} Offset in pixels.
381
+ * @package
382
+ */
383
+ Blockly.WorkspaceSvg.prototype.getOriginOffsetInPixels = function() {
384
+ return Blockly.utils.getInjectionDivXY_(this.svgBlockCanvas_);
385
+ };
386
+
387
+ /**
388
+ * Return the injection div that is a parent of this workspace.
389
+ * Walks the DOM the first time it's called, then returns a cached value.
390
+ * @return {!Element} The first parent div with 'injectionDiv' in the name.
391
+ * @package
392
+ */
393
+ Blockly.WorkspaceSvg.prototype.getInjectionDiv = function() {
394
+ // NB: it would be better to pass this in at createDom, but is more likely to
395
+ // break existing uses of Blockly.
396
+ if (!this.injectionDiv_) {
397
+ var element = this.svgGroup_;
398
+ while (element) {
399
+ var classes = element.getAttribute('class') || '';
400
+ if ((' ' + classes + ' ').indexOf(' injectionDiv ') != -1) {
401
+ this.injectionDiv_ = element;
402
+ break;
403
+ }
404
+ element = element.parentNode;
405
+ }
406
+ }
407
+ return this.injectionDiv_;
408
+ };
409
+
410
+ /**
411
+ * Save resize handler data so we can delete it later in dispose.
412
+ * @param {!Array.<!Array>} handler Data that can be passed to unbindEvent_.
413
+ */
414
+ Blockly.WorkspaceSvg.prototype.setResizeHandlerWrapper = function(handler) {
415
+ this.resizeHandlerWrapper_ = handler;
416
+ };
417
+
418
+ /**
419
+ * Create the workspace DOM elements.
420
+ * @param {string=} opt_backgroundClass Either 'blocklyMainBackground' or
421
+ * 'blocklyMutatorBackground'.
422
+ * @return {!Element} The workspace's SVG group.
423
+ */
424
+ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) {
425
+ /**
426
+ * <g class="blocklyWorkspace">
427
+ * <rect class="blocklyMainBackground" height="100%" width="100%"></rect>
428
+ * [Trashcan and/or flyout may go here]
429
+ * <g class="blocklyBlockCanvas"></g>
430
+ * <g class="blocklyBubbleCanvas"></g>
431
+ * </g>
432
+ * @type {SVGElement}
433
+ */
434
+ this.svgGroup_ = Blockly.utils.createSvgElement('g',
435
+ {'class': 'blocklyWorkspace'}, null);
436
+
437
+ // Note that a <g> alone does not receive mouse events--it must have a
438
+ // valid target inside it. If no background class is specified, as in the
439
+ // flyout, the workspace will not receive mouse events.
440
+ if (opt_backgroundClass) {
441
+ /** @type {SVGElement} */
442
+ this.svgBackground_ = Blockly.utils.createSvgElement('rect',
443
+ {'height': '100%', 'width': '100%', 'class': opt_backgroundClass},
444
+ this.svgGroup_);
445
+
446
+ if (opt_backgroundClass == 'blocklyMainBackground' && this.grid_) {
447
+ this.svgBackground_.style.fill =
448
+ 'url(#' + this.grid_.getPatternId() + ')';
449
+ }
450
+ }
451
+ /** @type {SVGElement} */
452
+ this.svgBlockCanvas_ = Blockly.utils.createSvgElement('g',
453
+ {'class': 'blocklyBlockCanvas'}, this.svgGroup_, this);
454
+ /** @type {SVGElement} */
455
+ this.svgBubbleCanvas_ = Blockly.utils.createSvgElement('g',
456
+ {'class': 'blocklyBubbleCanvas'}, this.svgGroup_, this);
457
+ var bottom = Blockly.Scrollbar.scrollbarThickness;
458
+ if (this.options.hasTrashcan) {
459
+ bottom = this.addTrashcan_(bottom);
460
+ }
461
+ if (this.options.zoomOptions && this.options.zoomOptions.controls) {
462
+ this.addZoomControls_(bottom);
463
+ }
464
+
465
+ if (!this.isFlyout) {
466
+ Blockly.bindEventWithChecks_(this.svgGroup_, 'mousedown', this,
467
+ this.onMouseDown_);
468
+ if (this.options.zoomOptions && this.options.zoomOptions.wheel) {
469
+ // Mouse-wheel.
470
+ Blockly.bindEventWithChecks_(this.svgGroup_, 'wheel', this,
471
+ this.onMouseWheel_);
472
+ }
473
+ }
474
+
475
+ // Determine if there needs to be a category tree, or a simple list of
476
+ // blocks. This cannot be changed later, since the UI is very different.
477
+ if (this.options.hasCategories) {
478
+ /**
479
+ * @type {Blockly.Toolbox}
480
+ * @private
481
+ */
482
+ this.toolbox_ = new Blockly.Toolbox(this);
483
+ }
484
+ if (this.grid_) {
485
+ this.grid_.update(this.scale);
486
+ }
487
+ this.recordCachedAreas();
488
+ return this.svgGroup_;
489
+ };
490
+
491
+ /**
492
+ * Dispose of this workspace.
493
+ * Unlink from all DOM elements to prevent memory leaks.
494
+ */
495
+ Blockly.WorkspaceSvg.prototype.dispose = function() {
496
+ // Stop rerendering.
497
+ this.rendered = false;
498
+ if (this.currentGesture_) {
499
+ this.currentGesture_.cancel();
500
+ }
501
+ Blockly.WorkspaceSvg.superClass_.dispose.call(this);
502
+ if (this.svgGroup_) {
503
+ goog.dom.removeNode(this.svgGroup_);
504
+ this.svgGroup_ = null;
505
+ }
506
+ this.svgBlockCanvas_ = null;
507
+ this.svgBubbleCanvas_ = null;
508
+ if (this.toolbox_) {
509
+ this.toolbox_.dispose();
510
+ this.toolbox_ = null;
511
+ }
512
+ if (this.flyout_) {
513
+ this.flyout_.dispose();
514
+ this.flyout_ = null;
515
+ }
516
+ if (this.trashcan) {
517
+ this.trashcan.dispose();
518
+ this.trashcan = null;
519
+ }
520
+ if (this.scrollbar) {
521
+ this.scrollbar.dispose();
522
+ this.scrollbar = null;
523
+ }
524
+ if (this.zoomControls_) {
525
+ this.zoomControls_.dispose();
526
+ this.zoomControls_ = null;
527
+ }
528
+
529
+ if (this.audioManager_) {
530
+ this.audioManager_.dispose();
531
+ this.audioManager_ = null;
532
+ }
533
+
534
+ if (this.grid_) {
535
+ this.grid_.dispose();
536
+ this.grid_ = null;
537
+ }
538
+
539
+ if (this.toolboxCategoryCallbacks_) {
540
+ this.toolboxCategoryCallbacks_ = null;
541
+ }
542
+ if (this.flyoutButtonCallbacks_) {
543
+ this.flyoutButtonCallbacks_ = null;
544
+ }
545
+ if (!this.options.parentWorkspace) {
546
+ // Top-most workspace. Dispose of the div that the
547
+ // SVG is injected into (i.e. injectionDiv).
548
+ goog.dom.removeNode(this.getParentSvg().parentNode);
549
+ }
550
+ if (this.resizeHandlerWrapper_) {
551
+ Blockly.unbindEvent_(this.resizeHandlerWrapper_);
552
+ this.resizeHandlerWrapper_ = null;
553
+ }
554
+ };
555
+
556
+ /**
557
+ * Obtain a newly created block.
558
+ * @param {?string} prototypeName Name of the language object containing
559
+ * type-specific functions for this block.
560
+ * @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
561
+ * create a new ID.
562
+ * @return {!Blockly.BlockSvg} The created block.
563
+ */
564
+ Blockly.WorkspaceSvg.prototype.newBlock = function(prototypeName, opt_id) {
565
+ return new Blockly.BlockSvg(this, prototypeName, opt_id);
566
+ };
567
+
568
+ /**
569
+ * Add a trashcan.
570
+ * @param {number} bottom Distance from workspace bottom to bottom of trashcan.
571
+ * @return {number} Distance from workspace bottom to the top of trashcan.
572
+ * @private
573
+ */
574
+ Blockly.WorkspaceSvg.prototype.addTrashcan_ = function(bottom) {
575
+ /** @type {Blockly.Trashcan} */
576
+ this.trashcan = new Blockly.Trashcan(this);
577
+ var svgTrashcan = this.trashcan.createDom();
578
+ this.svgGroup_.insertBefore(svgTrashcan, this.svgBlockCanvas_);
579
+ return this.trashcan.init(bottom);
580
+ };
581
+
582
+ /**
583
+ * Add zoom controls.
584
+ * @param {number} bottom Distance from workspace bottom to bottom of controls.
585
+ * @return {number} Distance from workspace bottom to the top of controls.
586
+ * @private
587
+ */
588
+ Blockly.WorkspaceSvg.prototype.addZoomControls_ = function(bottom) {
589
+ /** @type {Blockly.ZoomControls} */
590
+ this.zoomControls_ = new Blockly.ZoomControls(this);
591
+ var svgZoomControls = this.zoomControls_.createDom();
592
+ this.svgGroup_.appendChild(svgZoomControls);
593
+ return this.zoomControls_.init(bottom);
594
+ };
595
+
596
+ /**
597
+ * Add a flyout element in an element with the given tag name.
598
+ * @param {string} tagName What type of tag the flyout belongs in.
599
+ * @return {!Element} The element containing the flyout DOM.
600
+ * @private
601
+ */
602
+ Blockly.WorkspaceSvg.prototype.addFlyout_ = function(tagName) {
603
+ var workspaceOptions = {
604
+ disabledPatternId: this.options.disabledPatternId,
605
+ parentWorkspace: this,
606
+ RTL: this.RTL,
607
+ oneBasedIndex: this.options.oneBasedIndex,
608
+ horizontalLayout: this.horizontalLayout,
609
+ toolboxPosition: this.options.toolboxPosition,
610
+ stackGlowFilterId: this.options.stackGlowFilterId
611
+ };
612
+ if (this.horizontalLayout) {
613
+ this.flyout_ = new Blockly.HorizontalFlyout(workspaceOptions);
614
+ } else {
615
+ this.flyout_ = new Blockly.VerticalFlyout(workspaceOptions);
616
+ }
617
+ this.flyout_.autoClose = false;
618
+
619
+ // Return the element so that callers can place it in their desired
620
+ // spot in the DOM. For example, mutator flyouts do not go in the same place
621
+ // as main workspace flyouts.
622
+ return this.flyout_.createDom(tagName);
623
+ };
624
+
625
+ /**
626
+ * Getter for the flyout associated with this workspace. This flyout may be
627
+ * owned by either the toolbox or the workspace, depending on toolbox
628
+ * configuration. It will be null if there is no flyout.
629
+ * @return {Blockly.Flyout} The flyout on this workspace.
630
+ * @package
631
+ */
632
+ Blockly.WorkspaceSvg.prototype.getFlyout = function() {
633
+ if (this.flyout_) {
634
+ return this.flyout_;
635
+ }
636
+ if (this.toolbox_) {
637
+ return this.toolbox_.flyout_;
638
+ }
639
+ return null;
640
+ };
641
+
642
+ /**
643
+ * Getter for the toolbox associated with this workspace, if one exists.
644
+ * @return {Blockly.Toolbox} The toolbox on this workspace.
645
+ * @package
646
+ */
647
+ Blockly.WorkspaceSvg.prototype.getToolbox = function() {
648
+ return this.toolbox_;
649
+ };
650
+
651
+ /**
652
+ * Update items that use screen coordinate calculations
653
+ * because something has changed (e.g. scroll position, window size).
654
+ * @private
655
+ */
656
+ Blockly.WorkspaceSvg.prototype.updateScreenCalculations_ = function() {
657
+ this.updateInverseScreenCTM();
658
+ this.recordCachedAreas();
659
+ };
660
+
661
+ /**
662
+ * If enabled, resize the parts of the workspace that change when the workspace
663
+ * contents (e.g. block positions) change. This will also scroll the
664
+ * workspace contents if needed.
665
+ * @package
666
+ */
667
+ Blockly.WorkspaceSvg.prototype.resizeContents = function() {
668
+ if (!this.resizesEnabled_ || !this.rendered) {
669
+ return;
670
+ }
671
+ if (this.scrollbar) {
672
+ // TODO(picklesrus): Once rachel-fenichel's scrollbar refactoring
673
+ // is complete, call the method that only resizes scrollbar
674
+ // based on contents.
675
+ this.scrollbar.resize();
676
+ }
677
+ this.updateInverseScreenCTM();
678
+ };
679
+
680
+ /**
681
+ * Resize and reposition all of the workspace chrome (toolbox,
682
+ * trash, scrollbars etc.)
683
+ * This should be called when something changes that
684
+ * requires recalculating dimensions and positions of the
685
+ * trash, zoom, toolbox, etc. (e.g. window resize).
686
+ */
687
+ Blockly.WorkspaceSvg.prototype.resize = function() {
688
+ if (this.toolbox_) {
689
+ this.toolbox_.position();
690
+ }
691
+ if (this.flyout_) {
692
+ this.flyout_.position();
693
+ }
694
+ if (this.trashcan) {
695
+ this.trashcan.position();
696
+ }
697
+ if (this.zoomControls_) {
698
+ this.zoomControls_.position();
699
+ }
700
+ if (this.scrollbar) {
701
+ this.scrollbar.resize();
702
+ }
703
+ this.updateScreenCalculations_();
704
+ };
705
+
706
+ /**
707
+ * Resizes and repositions workspace chrome if the page has a new
708
+ * scroll position.
709
+ * @package
710
+ */
711
+ Blockly.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled
712
+ = function() {
713
+ /* eslint-disable indent */
714
+ var currScroll = goog.dom.getDocumentScroll();
715
+ if (!goog.math.Coordinate.equals(this.lastRecordedPageScroll_,
716
+ currScroll)) {
717
+ this.lastRecordedPageScroll_ = currScroll;
718
+ this.updateScreenCalculations_();
719
+ }
720
+ }; /* eslint-enable indent */
721
+
722
+ /**
723
+ * Get the SVG element that forms the drawing surface.
724
+ * @return {!Element} SVG element.
725
+ */
726
+ Blockly.WorkspaceSvg.prototype.getCanvas = function() {
727
+ return this.svgBlockCanvas_;
728
+ };
729
+
730
+ /**
731
+ * Get the SVG element that forms the bubble surface.
732
+ * @return {!SVGGElement} SVG element.
733
+ */
734
+ Blockly.WorkspaceSvg.prototype.getBubbleCanvas = function() {
735
+ return this.svgBubbleCanvas_;
736
+ };
737
+
738
+ /**
739
+ * Get the SVG element that contains this workspace.
740
+ * @return {!Element} SVG element.
741
+ */
742
+ Blockly.WorkspaceSvg.prototype.getParentSvg = function() {
743
+ if (this.cachedParentSvg_) {
744
+ return this.cachedParentSvg_;
745
+ }
746
+ var element = this.svgGroup_;
747
+ while (element) {
748
+ if (element.tagName == 'svg') {
749
+ this.cachedParentSvg_ = element;
750
+ return element;
751
+ }
752
+ element = element.parentNode;
753
+ }
754
+ return null;
755
+ };
756
+
757
+ /**
758
+ * Translate this workspace to new coordinates.
759
+ * @param {number} x Horizontal translation.
760
+ * @param {number} y Vertical translation.
761
+ */
762
+ Blockly.WorkspaceSvg.prototype.translate = function(x, y) {
763
+ if (this.useWorkspaceDragSurface_ && this.isDragSurfaceActive_) {
764
+ this.workspaceDragSurface_.translateSurface(x,y);
765
+ } else {
766
+ var translation = 'translate(' + x + ',' + y + ') ' +
767
+ 'scale(' + this.scale + ')';
768
+ this.svgBlockCanvas_.setAttribute('transform', translation);
769
+ this.svgBubbleCanvas_.setAttribute('transform', translation);
770
+ }
771
+ // Now update the block drag surface if we're using one.
772
+ if (this.blockDragSurface_) {
773
+ this.blockDragSurface_.translateAndScaleGroup(x, y, this.scale);
774
+ }
775
+ };
776
+
777
+ /**
778
+ * Called at the end of a workspace drag to take the contents
779
+ * out of the drag surface and put them back into the workspace SVG.
780
+ * Does nothing if the workspace drag surface is not enabled.
781
+ * @package
782
+ */
783
+ Blockly.WorkspaceSvg.prototype.resetDragSurface = function() {
784
+ // Don't do anything if we aren't using a drag surface.
785
+ if (!this.useWorkspaceDragSurface_) {
786
+ return;
787
+ }
788
+
789
+ this.isDragSurfaceActive_ = false;
790
+
791
+ var trans = this.workspaceDragSurface_.getSurfaceTranslation();
792
+ this.workspaceDragSurface_.clearAndHide(this.svgGroup_);
793
+ var translation = 'translate(' + trans.x + ',' + trans.y + ') ' +
794
+ 'scale(' + this.scale + ')';
795
+ this.svgBlockCanvas_.setAttribute('transform', translation);
796
+ this.svgBubbleCanvas_.setAttribute('transform', translation);
797
+ };
798
+
799
+ /**
800
+ * Called at the beginning of a workspace drag to move contents of
801
+ * the workspace to the drag surface.
802
+ * Does nothing if the drag surface is not enabled.
803
+ * @package
804
+ */
805
+ Blockly.WorkspaceSvg.prototype.setupDragSurface = function() {
806
+ // Don't do anything if we aren't using a drag surface.
807
+ if (!this.useWorkspaceDragSurface_) {
808
+ return;
809
+ }
810
+
811
+ // This can happen if the user starts a drag, mouses up outside of the
812
+ // document where the mouseup listener is registered (e.g. outside of an
813
+ // iframe) and then moves the mouse back in the workspace. On mobile and ff,
814
+ // we get the mouseup outside the frame. On chrome and safari desktop we do
815
+ // not.
816
+ if (this.isDragSurfaceActive_) {
817
+ return;
818
+ }
819
+
820
+ this.isDragSurfaceActive_ = true;
821
+
822
+ // Figure out where we want to put the canvas back. The order
823
+ // in the is important because things are layered.
824
+ var previousElement = this.svgBlockCanvas_.previousSibling;
825
+ var width = parseInt(this.getParentSvg().getAttribute('width'), 10);
826
+ var height = parseInt(this.getParentSvg().getAttribute('height'), 10);
827
+ var coord = Blockly.utils.getRelativeXY(this.svgBlockCanvas_);
828
+ this.workspaceDragSurface_.setContentsAndShow(this.svgBlockCanvas_,
829
+ this.svgBubbleCanvas_, previousElement, width, height, this.scale);
830
+ this.workspaceDragSurface_.translateSurface(coord.x, coord.y);
831
+ };
832
+
833
+ /**
834
+ * @return {?Blockly.BlockDragSurfaceSvg} This workspace's block drag surface,
835
+ * if one is in use.
836
+ * @package
837
+ */
838
+ Blockly.WorkspaceSvg.prototype.getBlockDragSurface = function() {
839
+ return this.blockDragSurface_;
840
+ };
841
+
842
+ /**
843
+ * Returns the horizontal offset of the workspace.
844
+ * Intended for LTR/RTL compatibility in XML.
845
+ * @return {number} Width.
846
+ */
847
+ Blockly.WorkspaceSvg.prototype.getWidth = function() {
848
+ var metrics = this.getMetrics();
849
+ return metrics ? metrics.viewWidth / this.scale : 0;
850
+ };
851
+
852
+ /**
853
+ * Toggles the visibility of the workspace.
854
+ * Currently only intended for main workspace.
855
+ * @param {boolean} isVisible True if workspace should be visible.
856
+ */
857
+ Blockly.WorkspaceSvg.prototype.setVisible = function(isVisible) {
858
+
859
+ // Tell the scrollbar whether its container is visible so it can
860
+ // tell when to hide itself.
861
+ if (this.scrollbar) {
862
+ this.scrollbar.setContainerVisible(isVisible);
863
+ }
864
+
865
+ // Tell the flyout whether its container is visible so it can
866
+ // tell when to hide itself.
867
+ if (this.getFlyout()) {
868
+ this.getFlyout().setContainerVisible(isVisible);
869
+ }
870
+
871
+ this.getParentSvg().style.display = isVisible ? 'block' : 'none';
872
+ if (this.toolbox_) {
873
+ // Currently does not support toolboxes in mutators.
874
+ this.toolbox_.HtmlDiv.style.display = isVisible ? 'block' : 'none';
875
+ }
876
+ if (isVisible) {
877
+ this.render();
878
+ // The window may have changed size while the workspace was hidden.
879
+ // Resize recalculates scrollbar position, delete areas, etc.
880
+ this.resize();
881
+ } else {
882
+ Blockly.hideChaff(true);
883
+ Blockly.DropDownDiv.hideWithoutAnimation();
884
+ }
885
+ this.isVisible_ = isVisible;
886
+ };
887
+
888
+ /**
889
+ * Render all blocks in workspace.
890
+ */
891
+ Blockly.WorkspaceSvg.prototype.render = function() {
892
+ // Generate list of all blocks.
893
+ var blocks = this.getAllBlocks();
894
+ // Render each block.
895
+ for (var i = blocks.length - 1; i >= 0; i--) {
896
+ blocks[i].render(false);
897
+ }
898
+ };
899
+
900
+ /**
901
+ * Was used back when block highlighting (for execution) and block selection
902
+ * (for editing) were the same thing.
903
+ * Any calls of this function can be deleted.
904
+ * @deprecated October 2016
905
+ */
906
+ Blockly.WorkspaceSvg.prototype.traceOn = function() {
907
+ console.warn('Deprecated call to traceOn, delete this.');
908
+ };
909
+
910
+ /**
911
+ * Highlight or unhighlight a block in the workspace. Block highlighting is
912
+ * often used to visually mark blocks currently being executed.
913
+ * @param {?string} id ID of block to highlight/unhighlight,
914
+ * or null for no block (used to unhighlight all blocks).
915
+ * @param {boolean=} opt_state If undefined, highlight specified block and
916
+ * automatically unhighlight all others. If true or false, manually
917
+ * highlight/unhighlight the specified block.
918
+ */
919
+ Blockly.WorkspaceSvg.prototype.highlightBlock = function(id, opt_state) {
920
+ if (opt_state === undefined) {
921
+ // Unhighlight all blocks.
922
+ for (var i = 0, block; block = this.highlightedBlocks_[i]; i++) {
923
+ block.setHighlighted(false);
924
+ }
925
+ this.highlightedBlocks_.length = 0;
926
+ }
927
+ // Highlight/unhighlight the specified block.
928
+ var block = id ? this.getBlockById(id) : null;
929
+ if (block) {
930
+ var state = (opt_state === undefined) || opt_state;
931
+ // Using Set here would be great, but at the cost of IE10 support.
932
+ if (!state) {
933
+ goog.array.remove(this.highlightedBlocks_, block);
934
+ } else if (this.highlightedBlocks_.indexOf(block) == -1) {
935
+ this.highlightedBlocks_.push(block);
936
+ }
937
+ block.setHighlighted(state);
938
+ }
939
+ };
940
+
941
+ /**
942
+ * Glow/unglow a block in the workspace.
943
+ * @param {?string} id ID of block to find.
944
+ * @param {boolean} isGlowingBlock Whether to glow the block.
945
+ */
946
+ Blockly.WorkspaceSvg.prototype.glowBlock = function(id, isGlowingBlock) {
947
+ var block = null;
948
+ if (id) {
949
+ block = this.getBlockById(id);
950
+ if (!block) {
951
+ throw 'Tried to glow block that does not exist.';
952
+ }
953
+ }
954
+ block.setGlowBlock(isGlowingBlock);
955
+ };
956
+
957
+ /**
958
+ * Glow/unglow a stack in the workspace.
959
+ * @param {?string} id ID of block which starts the stack.
960
+ * @param {boolean} isGlowingStack Whether to glow the stack.
961
+ */
962
+ Blockly.WorkspaceSvg.prototype.glowStack = function(id, isGlowingStack) {
963
+ var block = null;
964
+ if (id) {
965
+ block = this.getBlockById(id);
966
+ if (!block) {
967
+ throw 'Tried to glow stack on block that does not exist.';
968
+ }
969
+ }
970
+ block.setGlowStack(isGlowingStack);
971
+ };
972
+
973
+ /**
974
+ * Visually report a value associated with a block.
975
+ * In Scratch, appears as a pop-up next to the block when a reporter block is clicked.
976
+ * @param {?string} id ID of block to report associated value.
977
+ * @param {?string} value String value to visually report.
978
+ */
979
+ Blockly.WorkspaceSvg.prototype.reportValue = function(id, value) {
980
+ var block = this.getBlockById(id);
981
+ if (!block) {
982
+ throw 'Tried to report value on block that does not exist.';
983
+ }
984
+ Blockly.DropDownDiv.hideWithoutAnimation();
985
+ Blockly.DropDownDiv.clearContent();
986
+ var contentDiv = Blockly.DropDownDiv.getContentDiv();
987
+ var valueReportBox = goog.dom.createElement('div');
988
+ valueReportBox.setAttribute('class', 'valueReportBox');
989
+ valueReportBox.innerHTML = Blockly.scratchBlocksUtils.encodeEntities(value);
990
+ contentDiv.appendChild(valueReportBox);
991
+ Blockly.DropDownDiv.setColour(
992
+ Blockly.Colours.valueReportBackground,
993
+ Blockly.Colours.valueReportBorder
994
+ );
995
+ Blockly.DropDownDiv.showPositionedByBlock(this, block);
996
+ };
997
+
998
+ /**
999
+ * Paste the provided block onto the workspace.
1000
+ * @param {!Element} xmlBlock XML block element.
1001
+ */
1002
+ Blockly.WorkspaceSvg.prototype.paste = function(xmlBlock) {
1003
+ if (!this.rendered) {
1004
+ return;
1005
+ }
1006
+ if (this.currentGesture_) {
1007
+ this.currentGesture_.cancel(); // Dragging while pasting? No.
1008
+ }
1009
+ if (xmlBlock.tagName.toLowerCase() == 'comment') {
1010
+ this.pasteWorkspaceComment_(xmlBlock);
1011
+ } else {
1012
+ this.pasteBlock_(xmlBlock);
1013
+ }
1014
+ };
1015
+
1016
+ /**
1017
+ * Paste the provided block onto the workspace.
1018
+ * @param {!Element} xmlBlock XML block element.
1019
+ */
1020
+ Blockly.WorkspaceSvg.prototype.pasteBlock_ = function(xmlBlock) {
1021
+ Blockly.Events.disable();
1022
+ try {
1023
+ var block = Blockly.Xml.domToBlock(xmlBlock, this);
1024
+ // Scratch-specific: Give shadow dom new IDs to prevent duplicating on paste
1025
+ Blockly.scratchBlocksUtils.changeObscuredShadowIds(block);
1026
+ // Move the duplicate to original position.
1027
+ var blockX = parseInt(xmlBlock.getAttribute('x'), 10);
1028
+ var blockY = parseInt(xmlBlock.getAttribute('y'), 10);
1029
+ if (!isNaN(blockX) && !isNaN(blockY)) {
1030
+ if (this.RTL) {
1031
+ blockX = -blockX;
1032
+ }
1033
+ // Offset block until not clobbering another block and not in connection
1034
+ // distance with neighbouring blocks.
1035
+ do {
1036
+ var collide = false;
1037
+ var allBlocks = this.getAllBlocks();
1038
+ for (var i = 0, otherBlock; otherBlock = allBlocks[i]; i++) {
1039
+ var otherXY = otherBlock.getRelativeToSurfaceXY();
1040
+ if (Math.abs(blockX - otherXY.x) <= 1 &&
1041
+ Math.abs(blockY - otherXY.y) <= 1) {
1042
+ collide = true;
1043
+ break;
1044
+ }
1045
+ }
1046
+ if (!collide) {
1047
+ // Check for blocks in snap range to any of its connections.
1048
+ var connections = block.getConnections_(false);
1049
+ for (var i = 0, connection; connection = connections[i]; i++) {
1050
+ var neighbour = connection.closest(Blockly.SNAP_RADIUS,
1051
+ new goog.math.Coordinate(blockX, blockY));
1052
+ if (neighbour.connection) {
1053
+ collide = true;
1054
+ break;
1055
+ }
1056
+ }
1057
+ }
1058
+ if (collide) {
1059
+ if (this.RTL) {
1060
+ blockX -= Blockly.SNAP_RADIUS;
1061
+ } else {
1062
+ blockX += Blockly.SNAP_RADIUS;
1063
+ }
1064
+ blockY += Blockly.SNAP_RADIUS * 2;
1065
+ }
1066
+ } while (collide);
1067
+ block.moveBy(blockX, blockY);
1068
+ }
1069
+ } finally {
1070
+ Blockly.Events.enable();
1071
+ }
1072
+ if (Blockly.Events.isEnabled() && !block.isShadow()) {
1073
+ Blockly.Events.fire(new Blockly.Events.BlockCreate(block));
1074
+ }
1075
+ block.select();
1076
+ };
1077
+
1078
+ /**
1079
+ * Paste the provided comment onto the workspace.
1080
+ * @param {!Element} xmlComment XML workspace comment element.
1081
+ * @private
1082
+ */
1083
+ Blockly.WorkspaceSvg.prototype.pasteWorkspaceComment_ = function(xmlComment) {
1084
+ Blockly.Events.disable();
1085
+ try {
1086
+ var comment = Blockly.WorkspaceCommentSvg.fromXml(xmlComment, this);
1087
+ // Move the duplicate to original position.
1088
+ var commentX = parseInt(xmlComment.getAttribute('x'), 10);
1089
+ var commentY = parseInt(xmlComment.getAttribute('y'), 10);
1090
+ if (!isNaN(commentX) && !isNaN(commentY)) {
1091
+ if (this.RTL) {
1092
+ commentX = -commentX;
1093
+ }
1094
+ // Offset workspace comment.
1095
+ // TODO: (github.com/google/blockly/issues/1719) properly offset comment
1096
+ // such that it's not interfereing with any blocks
1097
+ commentX += 50;
1098
+ commentY += 50;
1099
+ comment.moveBy(commentX, commentY);
1100
+ }
1101
+ } finally {
1102
+ Blockly.Events.enable();
1103
+ }
1104
+ if (Blockly.Events.isEnabled()) {
1105
+ Blockly.WorkspaceComment.fireCreateEvent(comment);
1106
+ }
1107
+ comment.select();
1108
+ };
1109
+
1110
+ /**
1111
+ * Refresh the toolbox unless there's a drag in progress.
1112
+ * @private
1113
+ */
1114
+ Blockly.WorkspaceSvg.prototype.refreshToolboxSelection_ = function() {
1115
+ // Updating the toolbox can be expensive. Don't do it when when it is
1116
+ // disabled.
1117
+ if (this.toolbox_) {
1118
+ if (this.toolbox_.flyout_ && !this.currentGesture_ &&
1119
+ this.toolboxRefreshEnabled_) {
1120
+ this.toolbox_.refreshSelection();
1121
+ }
1122
+ } else {
1123
+ var thisTarget = this.targetWorkspace;
1124
+ if (thisTarget && thisTarget.toolbox_ && thisTarget.toolbox_.flyout_ &&
1125
+ !thisTarget.currentGesture_ && thisTarget.toolboxRefreshEnabled_) {
1126
+ thisTarget.toolbox_.refreshSelection();
1127
+ }
1128
+ }
1129
+ };
1130
+
1131
+ /**
1132
+ * Rename a variable by updating its name in the variable map. Update the
1133
+ * flyout to show the renamed variable immediately.
1134
+ * @param {string} id ID of the variable to rename.
1135
+ * @param {string} newName New variable name.
1136
+ * @package
1137
+ */
1138
+ Blockly.WorkspaceSvg.prototype.renameVariableById = function(id, newName) {
1139
+ Blockly.WorkspaceSvg.superClass_.renameVariableById.call(this, id, newName);
1140
+ this.refreshToolboxSelection_();
1141
+ };
1142
+
1143
+ /**
1144
+ * Delete a variable by the passed in ID. Update the flyout to show
1145
+ * immediately that the variable is deleted.
1146
+ * @param {string} id ID of variable to delete.
1147
+ * @package
1148
+ */
1149
+ Blockly.WorkspaceSvg.prototype.deleteVariableById = function(id) {
1150
+ Blockly.WorkspaceSvg.superClass_.deleteVariableById.call(this, id);
1151
+ this.refreshToolboxSelection_();
1152
+ };
1153
+
1154
+ /**
1155
+ * Create a new variable with the given name. Update the flyout to show the new
1156
+ * variable immediately.
1157
+ * @param {string} name The new variable's name.
1158
+ * @param {string=} opt_type The type of the variable like 'int' or 'string'.
1159
+ * Does not need to be unique. Field_variable can filter variables based on
1160
+ * their type. This will default to '' which is a specific type.
1161
+ * @param {string=} opt_id The unique ID of the variable. This will default to
1162
+ * a UUID.
1163
+ * @param {boolean=} opt_isLocal Whether the variable is locally scoped.
1164
+ * @param {boolean=} opt_isCloud Whether the variable is a cloud variable.
1165
+ * @return {?Blockly.VariableModel} The newly created variable.
1166
+ * @package
1167
+ */
1168
+ Blockly.WorkspaceSvg.prototype.createVariable = function(name, opt_type, opt_id,
1169
+ opt_isLocal, opt_isCloud) {
1170
+ var variableInMap = (this.getVariable(name, opt_type) != null);
1171
+ var newVar = Blockly.WorkspaceSvg.superClass_.createVariable.call(
1172
+ this, name, opt_type, opt_id, opt_isLocal, opt_isCloud);
1173
+ // For performance reasons, only refresh the the toolbox for new variables.
1174
+ // Variables that already exist should already be there.
1175
+ if (!variableInMap && (opt_type != Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE)) {
1176
+ this.refreshToolboxSelection_();
1177
+ }
1178
+ return newVar;
1179
+ };
1180
+
1181
+ /**
1182
+ * Update cached areas for this workspace.
1183
+ */
1184
+ Blockly.WorkspaceSvg.prototype.recordCachedAreas = function() {
1185
+ this.recordBlocksArea_();
1186
+ this.recordDeleteAreas_();
1187
+ };
1188
+
1189
+ /**
1190
+ * Make a list of all the delete areas for this workspace.
1191
+ * @private
1192
+ */
1193
+ Blockly.WorkspaceSvg.prototype.recordDeleteAreas_ = function() {
1194
+ if (this.trashcan) {
1195
+ this.deleteAreaTrash_ = this.trashcan.getClientRect();
1196
+ } else {
1197
+ this.deleteAreaTrash_ = null;
1198
+ }
1199
+ if (this.flyout_) {
1200
+ this.deleteAreaToolbox_ = this.flyout_.getClientRect();
1201
+ } else if (this.toolbox_) {
1202
+ this.deleteAreaToolbox_ = this.toolbox_.getClientRect();
1203
+ } else {
1204
+ this.deleteAreaToolbox_ = null;
1205
+ }
1206
+ };
1207
+
1208
+ /**
1209
+ * Record where all of blocks GUI is on the screen
1210
+ * @private
1211
+ */
1212
+ Blockly.WorkspaceSvg.prototype.recordBlocksArea_ = function() {
1213
+ var parentSvg = this.getParentSvg();
1214
+ if (parentSvg) {
1215
+ var bounds = parentSvg.getBoundingClientRect();
1216
+ this.blocksArea_ = new goog.math.Rect(bounds.left, bounds.top, bounds.width, bounds.height);
1217
+ } else {
1218
+ this.blocksArea_ = null;
1219
+ }
1220
+ };
1221
+
1222
+ /**
1223
+ * Is the mouse event over a delete area (toolbox or non-closing flyout)?
1224
+ * @param {!Event} e Mouse move event.
1225
+ * @return {?number} Null if not over a delete area, or an enum representing
1226
+ * which delete area the event is over.
1227
+ */
1228
+ Blockly.WorkspaceSvg.prototype.isDeleteArea = function(e) {
1229
+ var xy = new goog.math.Coordinate(e.clientX, e.clientY);
1230
+ if (this.deleteAreaTrash_ && this.deleteAreaTrash_.contains(xy)) {
1231
+ return Blockly.DELETE_AREA_TRASH;
1232
+ }
1233
+ if (this.deleteAreaToolbox_ && this.deleteAreaToolbox_.contains(xy)) {
1234
+ return Blockly.DELETE_AREA_TOOLBOX;
1235
+ }
1236
+ return Blockly.DELETE_AREA_NONE;
1237
+ };
1238
+
1239
+ /**
1240
+ * Is the mouse event inside the blocks UI?
1241
+ * @param {!Event} e Mouse move event.
1242
+ * @return {boolean} True if event is within the bounds of the blocks UI or delete area
1243
+ */
1244
+ Blockly.WorkspaceSvg.prototype.isInsideBlocksArea = function(e) {
1245
+ var xy = new goog.math.Coordinate(e.clientX, e.clientY);
1246
+ if (this.isDeleteArea(e) || (this.blocksArea_ && this.blocksArea_.contains(xy))) {
1247
+ return true;
1248
+ }
1249
+ return false;
1250
+ };
1251
+
1252
+ /**
1253
+ * Handle a mouse-down on SVG drawing surface.
1254
+ * @param {!Event} e Mouse down event.
1255
+ * @private
1256
+ */
1257
+ Blockly.WorkspaceSvg.prototype.onMouseDown_ = function(e) {
1258
+ var gesture = this.getGesture(e);
1259
+ if (gesture) {
1260
+ gesture.handleWsStart(e, this);
1261
+ }
1262
+ };
1263
+
1264
+ /**
1265
+ * Start tracking a drag of an object on this workspace.
1266
+ * @param {!Event} e Mouse down event.
1267
+ * @param {!goog.math.Coordinate} xy Starting location of object.
1268
+ */
1269
+ Blockly.WorkspaceSvg.prototype.startDrag = function(e, xy) {
1270
+ // Record the starting offset between the bubble's location and the mouse.
1271
+ var point = Blockly.utils.mouseToSvg(e, this.getParentSvg(),
1272
+ this.getInverseScreenCTM());
1273
+ // Fix scale of mouse event.
1274
+ point.x /= this.scale;
1275
+ point.y /= this.scale;
1276
+ this.dragDeltaXY_ = goog.math.Coordinate.difference(xy, point);
1277
+ };
1278
+
1279
+ /**
1280
+ * Track a drag of an object on this workspace.
1281
+ * @param {!Event} e Mouse move event.
1282
+ * @return {!goog.math.Coordinate} New location of object.
1283
+ */
1284
+ Blockly.WorkspaceSvg.prototype.moveDrag = function(e) {
1285
+ var point = Blockly.utils.mouseToSvg(e, this.getParentSvg(),
1286
+ this.getInverseScreenCTM());
1287
+ // Fix scale of mouse event.
1288
+ point.x /= this.scale;
1289
+ point.y /= this.scale;
1290
+ return goog.math.Coordinate.sum(this.dragDeltaXY_, point);
1291
+ };
1292
+
1293
+ /**
1294
+ * Is the user currently dragging a block or scrolling the flyout/workspace?
1295
+ * @return {boolean} True if currently dragging or scrolling.
1296
+ */
1297
+ Blockly.WorkspaceSvg.prototype.isDragging = function() {
1298
+ return this.currentGesture_ && this.currentGesture_.isDragging();
1299
+ };
1300
+
1301
+ /**
1302
+ * Is this workspace draggable and scrollable?
1303
+ * @return {boolean} True if this workspace may be dragged.
1304
+ */
1305
+ Blockly.WorkspaceSvg.prototype.isDraggable = function() {
1306
+ return !!this.scrollbar;
1307
+ };
1308
+
1309
+ /**
1310
+ * Handle a mouse-wheel on SVG drawing surface.
1311
+ * @param {!Event} e Mouse wheel event.
1312
+ * @private
1313
+ */
1314
+ Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) {
1315
+ // TODO: Remove gesture cancellation and compensate for coordinate skew during
1316
+ // zoom.
1317
+ if (this.currentGesture_) {
1318
+ this.currentGesture_.cancel();
1319
+ }
1320
+
1321
+ // Multiplier variable, so that non-pixel-deltaModes are supported.
1322
+ // See LLK/scratch-blocks#1190.
1323
+ var multiplier = e.deltaMode === 0x1 ? Blockly.LINE_SCROLL_MULTIPLIER : 1;
1324
+
1325
+ if (e.ctrlKey) {
1326
+ // The vertical scroll distance that corresponds to a click of a zoom button.
1327
+ var PIXELS_PER_ZOOM_STEP = 50;
1328
+ var delta = -e.deltaY / PIXELS_PER_ZOOM_STEP * multiplier;
1329
+ var position = Blockly.utils.mouseToSvg(e, this.getParentSvg(),
1330
+ this.getInverseScreenCTM());
1331
+ this.zoom(position.x, position.y, delta);
1332
+ } else {
1333
+ // This is a regular mouse wheel event - scroll the workspace
1334
+ // First hide the WidgetDiv without animation
1335
+ // (mouse scroll makes field out of place with div)
1336
+ Blockly.WidgetDiv.hide(true);
1337
+ Blockly.DropDownDiv.hideWithoutAnimation();
1338
+
1339
+ var x = this.scrollX - e.deltaX * multiplier;
1340
+ var y = this.scrollY - e.deltaY * multiplier;
1341
+
1342
+ if (e.shiftKey && e.deltaX === 0) {
1343
+ // Scroll horizontally (based on vertical scroll delta)
1344
+ // This is needed as for some browser/system combinations which do not
1345
+ // set deltaX. See #1662.
1346
+ x = this.scrollX - e.deltaY * multiplier;
1347
+ y = this.scrollY; // Don't scroll vertically
1348
+ }
1349
+
1350
+ this.startDragMetrics = this.getMetrics();
1351
+ this.scroll(x, y);
1352
+ }
1353
+ e.preventDefault();
1354
+ };
1355
+
1356
+ /**
1357
+ * Calculate the bounding box for the blocks on the workspace.
1358
+ * Coordinate system: workspace coordinates.
1359
+ *
1360
+ * @return {Object} Contains the position and size of the bounding box
1361
+ * containing the blocks on the workspace.
1362
+ */
1363
+ Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox = function() {
1364
+ var topBlocks = this.getTopBlocks(false);
1365
+ var topComments = this.getTopComments(false);
1366
+ var topElements = topBlocks.concat(topComments);
1367
+ // There are no blocks, return empty rectangle.
1368
+ if (!topElements.length) {
1369
+ return {x: 0, y: 0, width: 0, height: 0};
1370
+ }
1371
+
1372
+ // Initialize boundary using the first block.
1373
+ var boundary = topElements[0].getBoundingRectangle();
1374
+
1375
+ // Start at 1 since the 0th block was used for initialization
1376
+ for (var i = 1; i < topElements.length; i++) {
1377
+ var blockBoundary = topElements[i].getBoundingRectangle();
1378
+ if (blockBoundary.topLeft.x < boundary.topLeft.x) {
1379
+ boundary.topLeft.x = blockBoundary.topLeft.x;
1380
+ }
1381
+ if (blockBoundary.bottomRight.x > boundary.bottomRight.x) {
1382
+ boundary.bottomRight.x = blockBoundary.bottomRight.x;
1383
+ }
1384
+ if (blockBoundary.topLeft.y < boundary.topLeft.y) {
1385
+ boundary.topLeft.y = blockBoundary.topLeft.y;
1386
+ }
1387
+ if (blockBoundary.bottomRight.y > boundary.bottomRight.y) {
1388
+ boundary.bottomRight.y = blockBoundary.bottomRight.y;
1389
+ }
1390
+ }
1391
+ return {
1392
+ x: boundary.topLeft.x,
1393
+ y: boundary.topLeft.y,
1394
+ width: boundary.bottomRight.x - boundary.topLeft.x,
1395
+ height: boundary.bottomRight.y - boundary.topLeft.y
1396
+ };
1397
+ };
1398
+
1399
+ /**
1400
+ * Clean up the workspace by ordering all the blocks in a column.
1401
+ */
1402
+ Blockly.WorkspaceSvg.prototype.cleanUp = function() {
1403
+ this.setResizesEnabled(false);
1404
+ Blockly.Events.setGroup(true);
1405
+ var topBlocks = this.getTopBlocks(true);
1406
+ var cursorY = 0;
1407
+ for (var i = 0, block; block = topBlocks[i]; i++) {
1408
+ var xy = block.getRelativeToSurfaceXY();
1409
+ block.moveBy(-xy.x, cursorY - xy.y);
1410
+ block.snapToGrid();
1411
+ cursorY = block.getRelativeToSurfaceXY().y +
1412
+ block.getHeightWidth().height + Blockly.BlockSvg.MIN_BLOCK_Y;
1413
+ }
1414
+ Blockly.Events.setGroup(false);
1415
+ this.setResizesEnabled(true);
1416
+ };
1417
+
1418
+ /**
1419
+ * Show the context menu for the workspace.
1420
+ * @param {!Event} e Mouse event.
1421
+ * @private
1422
+ */
1423
+ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
1424
+ if (this.options.readOnly || this.isFlyout) {
1425
+ return;
1426
+ }
1427
+ var menuOptions = [];
1428
+ var topBlocks = this.getTopBlocks(true);
1429
+ var eventGroup = Blockly.utils.genUid();
1430
+ var ws = this;
1431
+
1432
+ // Options to undo/redo previous action.
1433
+ menuOptions.push(Blockly.ContextMenu.wsUndoOption(this));
1434
+ menuOptions.push(Blockly.ContextMenu.wsRedoOption(this));
1435
+
1436
+ // Option to clean up blocks.
1437
+ if (this.scrollbar) {
1438
+ menuOptions.push(
1439
+ Blockly.ContextMenu.wsCleanupOption(this,topBlocks.length));
1440
+ }
1441
+
1442
+ if (this.options.collapse) {
1443
+ var hasCollapsedBlocks = false;
1444
+ var hasExpandedBlocks = false;
1445
+ for (var i = 0; i < topBlocks.length; i++) {
1446
+ var block = topBlocks[i];
1447
+ while (block) {
1448
+ if (block.isCollapsed()) {
1449
+ hasCollapsedBlocks = true;
1450
+ } else {
1451
+ hasExpandedBlocks = true;
1452
+ }
1453
+ block = block.getNextBlock();
1454
+ }
1455
+ }
1456
+
1457
+ menuOptions.push(Blockly.ContextMenu.wsCollapseOption(hasExpandedBlocks,
1458
+ topBlocks));
1459
+
1460
+ menuOptions.push(Blockly.ContextMenu.wsExpandOption(hasCollapsedBlocks,
1461
+ topBlocks));
1462
+ }
1463
+
1464
+ // Option to add a workspace comment.
1465
+ if (this.options.comments) {
1466
+ menuOptions.push(Blockly.ContextMenu.workspaceCommentOption(ws, e));
1467
+ }
1468
+
1469
+ // Option to delete all blocks.
1470
+ // Count the number of blocks that are deletable.
1471
+ var deleteList = Blockly.WorkspaceSvg.buildDeleteList_(topBlocks);
1472
+ // Scratch-specific: don't count shadow blocks in delete count
1473
+ var deleteCount = 0;
1474
+ for (var i = 0; i < deleteList.length; i++) {
1475
+ if (!deleteList[i].isShadow()) {
1476
+ deleteCount++;
1477
+ }
1478
+ }
1479
+
1480
+ var DELAY = 10;
1481
+ function deleteNext() {
1482
+ Blockly.Events.setGroup(eventGroup);
1483
+ var block = deleteList.shift();
1484
+ if (block) {
1485
+ if (block.workspace) {
1486
+ block.dispose(false, true);
1487
+ setTimeout(deleteNext, DELAY);
1488
+ } else {
1489
+ deleteNext();
1490
+ }
1491
+ }
1492
+ Blockly.Events.setGroup(false);
1493
+ }
1494
+
1495
+ var deleteOption = {
1496
+ text: deleteCount == 1 ? Blockly.Msg.DELETE_BLOCK :
1497
+ Blockly.Msg.DELETE_X_BLOCKS.replace('%1', String(deleteCount)),
1498
+ enabled: deleteCount > 0,
1499
+ callback: function() {
1500
+ if (ws.currentGesture_) {
1501
+ ws.currentGesture_.cancel();
1502
+ }
1503
+ if (deleteCount < 2 ) {
1504
+ deleteNext();
1505
+ } else {
1506
+ Blockly.confirm(
1507
+ Blockly.Msg.DELETE_ALL_BLOCKS.replace('%1', String(deleteCount)),
1508
+ function(ok) {
1509
+ if (ok) {
1510
+ deleteNext();
1511
+ }
1512
+ });
1513
+ }
1514
+ }
1515
+ };
1516
+ menuOptions.push(deleteOption);
1517
+
1518
+ Blockly.ContextMenu.show(e, menuOptions, this.RTL);
1519
+ };
1520
+
1521
+ /**
1522
+ * Build a list of all deletable blocks that are reachable from the given
1523
+ * list of top blocks.
1524
+ * @param {!Array.<!Blockly.BlockSvg>} topBlocks The list of top blocks on the
1525
+ * workspace.
1526
+ * @return {!Array.<!Blockly.BlockSvg>} A list of deletable blocks on the
1527
+ * workspace.
1528
+ * @private
1529
+ */
1530
+ Blockly.WorkspaceSvg.buildDeleteList_ = function(topBlocks) {
1531
+ var deleteList = [];
1532
+ function addDeletableBlocks(block) {
1533
+ if (block.isDeletable()) {
1534
+ deleteList = deleteList.concat(block.getDescendants(false));
1535
+ } else {
1536
+ var children = block.getChildren();
1537
+ for (var i = 0; i < children.length; i++) {
1538
+ addDeletableBlocks(children[i]);
1539
+ }
1540
+ }
1541
+ }
1542
+ for (var i = 0; i < topBlocks.length; i++) {
1543
+ addDeletableBlocks(topBlocks[i]);
1544
+ }
1545
+ return deleteList;
1546
+ };
1547
+
1548
+ /**
1549
+ * Modify the block tree on the existing toolbox.
1550
+ * @param {Node|string} tree DOM tree of blocks, or text representation of same.
1551
+ */
1552
+ Blockly.WorkspaceSvg.prototype.updateToolbox = function(tree) {
1553
+ tree = Blockly.Options.parseToolboxTree(tree);
1554
+ if (!tree) {
1555
+ if (this.options.languageTree) {
1556
+ throw 'Can\'t nullify an existing toolbox.';
1557
+ }
1558
+ return; // No change (null to null).
1559
+ }
1560
+ if (!this.options.languageTree) {
1561
+ throw 'Existing toolbox is null. Can\'t create new toolbox.';
1562
+ }
1563
+ if (tree.getElementsByTagName('category').length) {
1564
+ if (!this.toolbox_) {
1565
+ throw 'Existing toolbox has no categories. Can\'t change mode.';
1566
+ }
1567
+ this.options.languageTree = tree;
1568
+ this.toolbox_.populate_(tree);
1569
+ this.toolbox_.position();
1570
+ } else {
1571
+ if (!this.flyout_) {
1572
+ throw 'Existing toolbox has categories. Can\'t change mode.';
1573
+ }
1574
+ this.options.languageTree = tree;
1575
+ this.flyout_.show(tree.childNodes);
1576
+ }
1577
+ };
1578
+
1579
+ /**
1580
+ * Mark this workspace as the currently focused main workspace.
1581
+ */
1582
+ Blockly.WorkspaceSvg.prototype.markFocused = function() {
1583
+ if (this.options.parentWorkspace) {
1584
+ this.options.parentWorkspace.markFocused();
1585
+ } else {
1586
+ Blockly.mainWorkspace = this;
1587
+ // We call e.preventDefault in many event handlers which means we
1588
+ // need to explicitly grab focus (e.g from a textarea) because
1589
+ // the browser will not do it for us. How to do this is browser dependant.
1590
+ this.setBrowserFocus();
1591
+ }
1592
+ };
1593
+
1594
+ /**
1595
+ * Set the workspace to have focus in the browser.
1596
+ * @private
1597
+ */
1598
+ Blockly.WorkspaceSvg.prototype.setBrowserFocus = function() {
1599
+ // Blur whatever was focused since explcitly grabbing focus below does not
1600
+ // work in Edge.
1601
+ if (document.activeElement) {
1602
+ document.activeElement.blur();
1603
+ }
1604
+ try {
1605
+ // Focus the workspace SVG - this is for Chrome and Firefox.
1606
+ this.getParentSvg().focus();
1607
+ } catch (e) {
1608
+ // IE and Edge do not support focus on SVG elements. When that fails
1609
+ // above, get the injectionDiv (the workspace's parent) and focus that
1610
+ // instead. This doesn't work in Chrome.
1611
+ try {
1612
+ // In IE11, use setActive (which is IE only) so the page doesn't scroll
1613
+ // to the workspace gaining focus.
1614
+ this.getParentSvg().parentNode.setActive();
1615
+ } catch (e) {
1616
+ // setActive support was discontinued in Edge so when that fails, call
1617
+ // focus instead.
1618
+ this.getParentSvg().parentNode.focus();
1619
+ }
1620
+ }
1621
+ };
1622
+
1623
+ /**
1624
+ * Zooming the blocks centered in (x, y) coordinate with zooming in or out.
1625
+ * @param {number} x X coordinate of center.
1626
+ * @param {number} y Y coordinate of center.
1627
+ * @param {number} amount Amount of zooming
1628
+ * (negative zooms out and positive zooms in).
1629
+ */
1630
+ Blockly.WorkspaceSvg.prototype.zoom = function(x, y, amount) {
1631
+ var speed = this.options.zoomOptions.scaleSpeed;
1632
+ var metrics = this.getMetrics();
1633
+ var center = this.getParentSvg().createSVGPoint();
1634
+ center.x = x;
1635
+ center.y = y;
1636
+ center = center.matrixTransform(this.getCanvas().getCTM().inverse());
1637
+ x = center.x;
1638
+ y = center.y;
1639
+ var canvas = this.getCanvas();
1640
+ // Scale factor.
1641
+ var scaleChange = Math.pow(speed, amount);
1642
+ // Clamp scale within valid range.
1643
+ var newScale = this.scale * scaleChange;
1644
+ if (newScale > this.options.zoomOptions.maxScale) {
1645
+ scaleChange = this.options.zoomOptions.maxScale / this.scale;
1646
+ } else if (newScale < this.options.zoomOptions.minScale) {
1647
+ scaleChange = this.options.zoomOptions.minScale / this.scale;
1648
+ }
1649
+ if (this.scale == newScale) {
1650
+ return; // No change in zoom.
1651
+ }
1652
+ if (this.scrollbar) {
1653
+ var matrix = canvas.getCTM()
1654
+ .translate(x * (1 - scaleChange), y * (1 - scaleChange))
1655
+ .scale(scaleChange);
1656
+ // newScale and matrix.a should be identical (within a rounding error).
1657
+ // ScrollX and scrollY are in pixels.
1658
+ this.scrollX = matrix.e - metrics.absoluteLeft;
1659
+ this.scrollY = matrix.f - metrics.absoluteTop;
1660
+ }
1661
+ this.setScale(newScale);
1662
+ // Hide the WidgetDiv without animation (zoom makes field out of place with div)
1663
+ Blockly.WidgetDiv.hide(true);
1664
+ Blockly.DropDownDiv.hideWithoutAnimation();
1665
+ };
1666
+
1667
+ /**
1668
+ * Zooming the blocks centered in the center of view with zooming in or out.
1669
+ * @param {number} type Type of zooming (-1 zooming out and 1 zooming in).
1670
+ */
1671
+ Blockly.WorkspaceSvg.prototype.zoomCenter = function(type) {
1672
+ var metrics = this.getMetrics();
1673
+ var x = metrics.viewWidth / 2;
1674
+ var y = metrics.viewHeight / 2;
1675
+ this.zoom(x, y, type);
1676
+ };
1677
+
1678
+ /**
1679
+ * Zoom the blocks to fit in the workspace if possible.
1680
+ */
1681
+ Blockly.WorkspaceSvg.prototype.zoomToFit = function() {
1682
+ var metrics = this.getMetrics();
1683
+ var blocksBox = this.getBlocksBoundingBox();
1684
+ var blocksWidth = blocksBox.width;
1685
+ var blocksHeight = blocksBox.height;
1686
+ if (!blocksWidth) {
1687
+ return; // Prevents zooming to infinity.
1688
+ }
1689
+ var workspaceWidth = metrics.viewWidth;
1690
+ var workspaceHeight = metrics.viewHeight;
1691
+ if (this.flyout_) {
1692
+ workspaceWidth -= this.flyout_.width_;
1693
+ }
1694
+ if (!this.scrollbar) {
1695
+ // Origin point of 0,0 is fixed, blocks will not scroll to center.
1696
+ blocksWidth += metrics.contentLeft;
1697
+ blocksHeight += metrics.contentTop;
1698
+ }
1699
+ var ratioX = workspaceWidth / blocksWidth;
1700
+ var ratioY = workspaceHeight / blocksHeight;
1701
+ this.setScale(Math.min(ratioX, ratioY));
1702
+ this.scrollCenter();
1703
+ };
1704
+
1705
+ /**
1706
+ * Center the workspace.
1707
+ */
1708
+ Blockly.WorkspaceSvg.prototype.scrollCenter = function() {
1709
+ if (!this.scrollbar) {
1710
+ // Can't center a non-scrolling workspace.
1711
+ console.warn('Tried to scroll a non-scrollable workspace.');
1712
+ return;
1713
+ }
1714
+ // Hide the WidgetDiv without animation (zoom makes field out of place with div)
1715
+ Blockly.WidgetDiv.hide(true);
1716
+ Blockly.DropDownDiv.hideWithoutAnimation();
1717
+ Blockly.hideChaff(false);
1718
+ var metrics = this.getMetrics();
1719
+ var x = (metrics.contentWidth - metrics.viewWidth) / 2;
1720
+ if (this.flyout_) {
1721
+ x -= this.flyout_.width_ / 2;
1722
+ }
1723
+ var y = (metrics.contentHeight - metrics.viewHeight) / 2;
1724
+ this.scrollbar.set(x, y);
1725
+ };
1726
+
1727
+ /**
1728
+ * Scroll the workspace to center on the given block.
1729
+ * @param {?string} id ID of block center on.
1730
+ * @public
1731
+ */
1732
+ Blockly.WorkspaceSvg.prototype.centerOnBlock = function(id) {
1733
+ if (!this.scrollbar) {
1734
+ console.warn('Tried to scroll a non-scrollable workspace.');
1735
+ return;
1736
+ }
1737
+
1738
+ var block = this.getBlockById(id);
1739
+ if (!block) {
1740
+ return;
1741
+ }
1742
+
1743
+ // XY is in workspace coordinates.
1744
+ var xy = block.getRelativeToSurfaceXY();
1745
+ // Height/width is in workspace units.
1746
+ var heightWidth = block.getHeightWidth();
1747
+
1748
+ // Find the enter of the block in workspace units.
1749
+ var blockCenterY = xy.y + heightWidth.height / 2;
1750
+
1751
+ // In RTL the block's position is the top right of the block, not top left.
1752
+ var multiplier = this.RTL ? -1 : 1;
1753
+ var blockCenterX = xy.x + (multiplier * heightWidth.width / 2);
1754
+
1755
+ // Workspace scale, used to convert from workspace coordinates to pixels.
1756
+ var scale = this.scale;
1757
+
1758
+ // Center in pixels. 0, 0 is at the workspace origin. These numbers may
1759
+ // be negative.
1760
+ var pixelX = blockCenterX * scale;
1761
+ var pixelY = blockCenterY * scale;
1762
+
1763
+ var metrics = this.getMetrics();
1764
+
1765
+ // Scrolling to here would put the block in the top-left corner of the
1766
+ // visible workspace.
1767
+ var scrollToBlockX = pixelX - metrics.contentLeft;
1768
+ var scrollToBlockY = pixelY - metrics.contentTop;
1769
+
1770
+ // viewHeight and viewWidth are in pixels.
1771
+ var halfViewWidth = metrics.viewWidth / 2;
1772
+ var halfViewHeight = metrics.viewHeight / 2;
1773
+
1774
+ // Put the block in the center of the visible workspace instead.
1775
+ var scrollToCenterX = scrollToBlockX - halfViewWidth;
1776
+ var scrollToCenterY = scrollToBlockY - halfViewHeight;
1777
+
1778
+ Blockly.hideChaff();
1779
+ this.scrollbar.set(scrollToCenterX, scrollToCenterY);
1780
+ };
1781
+
1782
+ /**
1783
+ * Set the workspace's zoom factor.
1784
+ * @param {number} newScale Zoom factor.
1785
+ */
1786
+ Blockly.WorkspaceSvg.prototype.setScale = function(newScale) {
1787
+ if (this.options.zoomOptions.maxScale &&
1788
+ newScale > this.options.zoomOptions.maxScale) {
1789
+ newScale = this.options.zoomOptions.maxScale;
1790
+ } else if (this.options.zoomOptions.minScale &&
1791
+ newScale < this.options.zoomOptions.minScale) {
1792
+ newScale = this.options.zoomOptions.minScale;
1793
+ }
1794
+ this.scale = newScale;
1795
+ if (this.grid_) {
1796
+ this.grid_.update(this.scale);
1797
+ }
1798
+ if (this.scrollbar) {
1799
+ this.scrollbar.resize();
1800
+ } else {
1801
+ this.translate(this.scrollX, this.scrollY);
1802
+ }
1803
+ Blockly.hideChaff(false);
1804
+ if (this.flyout_) {
1805
+ // No toolbox, resize flyout.
1806
+ this.flyout_.reflow();
1807
+ }
1808
+ };
1809
+
1810
+ /**
1811
+ * Scroll the workspace by a specified amount, keeping in the bounds.
1812
+ * Be sure to set this.startDragMetrics with cached metrics before calling.
1813
+ * @param {number} x Target X to scroll to
1814
+ * @param {number} y Target Y to scroll to
1815
+ */
1816
+ Blockly.WorkspaceSvg.prototype.scroll = function(x, y) {
1817
+ var metrics = this.startDragMetrics; // Cached values
1818
+ x = Math.min(x, -metrics.contentLeft);
1819
+ y = Math.min(y, -metrics.contentTop);
1820
+ x = Math.max(x, metrics.viewWidth - metrics.contentLeft -
1821
+ metrics.contentWidth);
1822
+ y = Math.max(y, metrics.viewHeight - metrics.contentTop -
1823
+ metrics.contentHeight);
1824
+ // When the workspace starts scrolling, hide the WidgetDiv without animation.
1825
+ // This is to prevent a dispoal animation from happening in the wrong location.
1826
+ Blockly.WidgetDiv.hide(true);
1827
+ Blockly.DropDownDiv.hideWithoutAnimation();
1828
+ // Move the scrollbars and the page will scroll automatically.
1829
+ this.scrollbar.set(-x - metrics.contentLeft, -y - metrics.contentTop);
1830
+ };
1831
+
1832
+ /**
1833
+ * Update the workspace's stack glow radius to be proportional to scale.
1834
+ * Ensures that stack glows always appear to be a fixed size.
1835
+ */
1836
+ Blockly.WorkspaceSvg.prototype.updateStackGlowScale_ = function() {
1837
+ // No such def in the flyout workspace.
1838
+ if (this.options.stackGlowBlur) {
1839
+ this.options.stackGlowBlur.setAttribute('stdDeviation',
1840
+ Blockly.Colours.stackGlowSize / this.scale);
1841
+ }
1842
+ };
1843
+
1844
+ /**
1845
+ * Get the dimensions of the given workspace component, in pixels.
1846
+ * @param {Blockly.Toolbox|Blockly.Flyout} elem The element to get the
1847
+ * dimensions of, or null. It should be a toolbox or flyout, and should
1848
+ * implement getWidth() and getHeight().
1849
+ * @return {!Object} An object containing width and height attributes, which
1850
+ * will both be zero if elem did not exist.
1851
+ * @private
1852
+ */
1853
+ Blockly.WorkspaceSvg.getDimensionsPx_ = function(elem) {
1854
+ var width = 0;
1855
+ var height = 0;
1856
+ if (elem) {
1857
+ width = elem.getWidth();
1858
+ height = elem.getHeight();
1859
+ }
1860
+ return {
1861
+ width: width,
1862
+ height: height
1863
+ };
1864
+ };
1865
+
1866
+ /**
1867
+ * Get the content dimensions of the given workspace, taking into account
1868
+ * whether or not it is scrollable and what size the workspace div is on screen.
1869
+ * @param {!Blockly.WorkspaceSvg} ws The workspace to measure.
1870
+ * @param {!Object} svgSize An object containing height and width attributes in
1871
+ * CSS pixels. Together they specify the size of the visible workspace, not
1872
+ * including areas covered up by the toolbox.
1873
+ * @return {!Object} The dimensions of the contents of the given workspace, as
1874
+ * an object containing at least
1875
+ * - height and width in pixels
1876
+ * - left and top in pixels relative to the workspace origin.
1877
+ * @private
1878
+ */
1879
+ Blockly.WorkspaceSvg.getContentDimensions_ = function(ws, svgSize) {
1880
+ if (ws.scrollbar) {
1881
+ return Blockly.WorkspaceSvg.getContentDimensionsBounded_(ws, svgSize);
1882
+ } else {
1883
+ return Blockly.WorkspaceSvg.getContentDimensionsExact_(ws);
1884
+ }
1885
+ };
1886
+
1887
+ /**
1888
+ * Get the bounding box for all workspace contents, in pixels.
1889
+ * @param {!Blockly.WorkspaceSvg} ws The workspace to inspect.
1890
+ * @return {!Object} The dimensions of the contents of the given workspace, as
1891
+ * an object containing
1892
+ * - height and width in pixels
1893
+ * - left, right, top and bottom in pixels relative to the workspace origin.
1894
+ * @private
1895
+ */
1896
+ Blockly.WorkspaceSvg.getContentDimensionsExact_ = function(ws) {
1897
+ // Block bounding box is in workspace coordinates.
1898
+ var blockBox = ws.getBlocksBoundingBox();
1899
+ var scale = ws.scale;
1900
+
1901
+ // Convert to pixels.
1902
+ var width = blockBox.width * scale;
1903
+ var height = blockBox.height * scale;
1904
+ var left = blockBox.x * scale;
1905
+ var top = blockBox.y * scale;
1906
+
1907
+ return {
1908
+ left: left,
1909
+ top: top,
1910
+ right: left + width,
1911
+ bottom: top + height,
1912
+ width: width,
1913
+ height: height
1914
+ };
1915
+ };
1916
+
1917
+ /**
1918
+ * Calculate the size of a scrollable workspace, which should include room for a
1919
+ * half screen border around the workspace contents.
1920
+ * @param {!Blockly.WorkspaceSvg} ws The workspace to measure.
1921
+ * @param {!Object} svgSize An object containing height and width attributes in
1922
+ * CSS pixels. Together they specify the size of the visible workspace, not
1923
+ * including areas covered up by the toolbox.
1924
+ * @return {!Object} The dimensions of the contents of the given workspace, as
1925
+ * an object containing
1926
+ * - height and width in pixels
1927
+ * - left and top in pixels relative to the workspace origin.
1928
+ * @private
1929
+ */
1930
+ Blockly.WorkspaceSvg.getContentDimensionsBounded_ = function(ws, svgSize) {
1931
+ var content = Blockly.WorkspaceSvg.getContentDimensionsExact_(ws);
1932
+
1933
+ // View height and width are both in pixels, and are the same as the SVG size.
1934
+ var viewWidth = svgSize.width;
1935
+ var viewHeight = svgSize.height;
1936
+ var halfWidth = viewWidth / 2;
1937
+ var halfHeight = viewHeight / 2;
1938
+
1939
+ // Add a border around the content that is at least half a screenful wide.
1940
+ // Ensure border is wide enough that blocks can scroll over entire screen.
1941
+ var left = Math.min(content.left - halfWidth, content.right - viewWidth);
1942
+ var right = Math.max(content.right + halfWidth, content.left + viewWidth);
1943
+
1944
+ var top = Math.min(content.top - halfHeight, content.bottom - viewHeight);
1945
+ var bottom = Math.max(content.bottom + halfHeight, content.top + viewHeight);
1946
+
1947
+ var dimensions = {
1948
+ left: left,
1949
+ top: top,
1950
+ height: bottom - top,
1951
+ width: right - left
1952
+ };
1953
+ return dimensions;
1954
+ };
1955
+
1956
+ /**
1957
+ * Return an object with all the metrics required to size scrollbars for a
1958
+ * top level workspace. The following properties are computed:
1959
+ * Coordinate system: pixel coordinates.
1960
+ * .viewHeight: Height of the visible rectangle,
1961
+ * .viewWidth: Width of the visible rectangle,
1962
+ * .contentHeight: Height of the contents,
1963
+ * .contentWidth: Width of the content,
1964
+ * .viewTop: Offset of top edge of visible rectangle from parent,
1965
+ * .viewLeft: Offset of left edge of visible rectangle from parent,
1966
+ * .contentTop: Offset of the top-most content from the y=0 coordinate,
1967
+ * .contentLeft: Offset of the left-most content from the x=0 coordinate.
1968
+ * .absoluteTop: Top-edge of view.
1969
+ * .absoluteLeft: Left-edge of view.
1970
+ * .toolboxWidth: Width of toolbox, if it exists. Otherwise zero.
1971
+ * .toolboxHeight: Height of toolbox, if it exists. Otherwise zero.
1972
+ * .flyoutWidth: Width of the flyout if it is always open. Otherwise zero.
1973
+ * .flyoutHeight: Height of flyout if it is always open. Otherwise zero.
1974
+ * .toolboxPosition: Top, bottom, left or right.
1975
+ * @return {!Object} Contains size and position metrics of a top level
1976
+ * workspace.
1977
+ * @private
1978
+ * @this Blockly.WorkspaceSvg
1979
+ */
1980
+ Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_ = function() {
1981
+
1982
+ var toolboxDimensions =
1983
+ Blockly.WorkspaceSvg.getDimensionsPx_(this.toolbox_);
1984
+ var flyoutDimensions =
1985
+ Blockly.WorkspaceSvg.getDimensionsPx_(this.flyout_);
1986
+
1987
+ // Contains height and width in CSS pixels.
1988
+ // svgSize is equivalent to the size of the injectionDiv at this point.
1989
+ var svgSize = Blockly.svgSize(this.getParentSvg());
1990
+ if (this.toolbox_) {
1991
+ if (this.toolboxPosition == Blockly.TOOLBOX_AT_TOP ||
1992
+ this.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM) {
1993
+ svgSize.height -= toolboxDimensions.height;
1994
+ } else if (this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT ||
1995
+ this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT) {
1996
+ svgSize.width -= toolboxDimensions.width;
1997
+ }
1998
+ }
1999
+
2000
+ // svgSize is now the space taken up by the Blockly workspace, not including
2001
+ // the toolbox.
2002
+ var contentDimensions =
2003
+ Blockly.WorkspaceSvg.getContentDimensions_(this, svgSize);
2004
+
2005
+ var absoluteLeft = 0;
2006
+ if (this.toolbox_ && this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT) {
2007
+ absoluteLeft = toolboxDimensions.width;
2008
+ }
2009
+ var absoluteTop = 0;
2010
+ if (this.toolbox_ && this.toolboxPosition == Blockly.TOOLBOX_AT_TOP) {
2011
+ absoluteTop = toolboxDimensions.height;
2012
+ }
2013
+
2014
+ var metrics = {
2015
+ contentHeight: contentDimensions.height,
2016
+ contentWidth: contentDimensions.width,
2017
+ contentTop: contentDimensions.top,
2018
+ contentLeft: contentDimensions.left,
2019
+
2020
+ viewHeight: svgSize.height,
2021
+ viewWidth: svgSize.width,
2022
+ viewTop: -this.scrollY, // Must be in pixels, somehow.
2023
+ viewLeft: -this.scrollX, // Must be in pixels, somehow.
2024
+
2025
+ absoluteTop: absoluteTop,
2026
+ absoluteLeft: absoluteLeft,
2027
+
2028
+ toolboxWidth: toolboxDimensions.width,
2029
+ toolboxHeight: toolboxDimensions.height,
2030
+
2031
+ flyoutWidth: flyoutDimensions.width,
2032
+ flyoutHeight: flyoutDimensions.height,
2033
+
2034
+ toolboxPosition: this.toolboxPosition
2035
+ };
2036
+ return metrics;
2037
+ };
2038
+
2039
+ /**
2040
+ * Sets the X/Y translations of a top level workspace to match the scrollbars.
2041
+ * @param {!Object} xyRatio Contains an x and/or y property which is a float
2042
+ * between 0 and 1 specifying the degree of scrolling.
2043
+ * @private
2044
+ * @this Blockly.WorkspaceSvg
2045
+ */
2046
+ Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_ = function(xyRatio) {
2047
+ if (!this.scrollbar) {
2048
+ throw 'Attempt to set top level workspace scroll without scrollbars.';
2049
+ }
2050
+ var metrics = this.getMetrics();
2051
+ if (goog.isNumber(xyRatio.x)) {
2052
+ this.scrollX = -metrics.contentWidth * xyRatio.x - metrics.contentLeft;
2053
+ }
2054
+ if (goog.isNumber(xyRatio.y)) {
2055
+ this.scrollY = -metrics.contentHeight * xyRatio.y - metrics.contentTop;
2056
+ }
2057
+ var x = this.scrollX + metrics.absoluteLeft;
2058
+ var y = this.scrollY + metrics.absoluteTop;
2059
+ this.translate(x, y);
2060
+ if (this.grid_) {
2061
+ this.grid_.moveTo(x, y);
2062
+ }
2063
+ };
2064
+
2065
+ /**
2066
+ * Update whether this workspace has resizes enabled.
2067
+ * If enabled, workspace will resize when appropriate.
2068
+ * If disabled, workspace will not resize until re-enabled.
2069
+ * Use to avoid resizing during a batch operation, for performance.
2070
+ * @param {boolean} enabled Whether resizes should be enabled.
2071
+ */
2072
+ Blockly.WorkspaceSvg.prototype.setResizesEnabled = function(enabled) {
2073
+ var reenabled = (!this.resizesEnabled_ && enabled);
2074
+ this.resizesEnabled_ = enabled;
2075
+ if (reenabled) {
2076
+ // Newly enabled. Trigger a resize.
2077
+ this.resizeContents();
2078
+ }
2079
+ };
2080
+
2081
+ /**
2082
+ * Update whether this workspace has toolbox refreshes enabled.
2083
+ * If enabled, the toolbox will refresh when appropriate.
2084
+ * If disabled, workspace will not refresh until re-enabled.
2085
+ * Use to avoid refreshing during a batch operation, for performance.
2086
+ * @param {boolean} enabled Whether refreshes should be enabled.
2087
+ */
2088
+ Blockly.WorkspaceSvg.prototype.setToolboxRefreshEnabled = function(enabled) {
2089
+ var reenabled = (!this.toolboxRefreshEnabled_ && enabled);
2090
+ this.toolboxRefreshEnabled_ = enabled;
2091
+ if (reenabled) {
2092
+ // Newly enabled. Trigger a refresh.
2093
+ this.refreshToolboxSelection_();
2094
+ }
2095
+ };
2096
+
2097
+
2098
+ /**
2099
+ * Dispose of all blocks in workspace, with an optimization to prevent resizes.
2100
+ */
2101
+ Blockly.WorkspaceSvg.prototype.clear = function() {
2102
+ this.setResizesEnabled(false);
2103
+ Blockly.WorkspaceSvg.superClass_.clear.call(this);
2104
+ this.setResizesEnabled(true);
2105
+ };
2106
+
2107
+ /**
2108
+ * Register a callback function associated with a given key, for clicks on
2109
+ * buttons and labels in the flyout.
2110
+ * For instance, a button specified by the XML
2111
+ * <button text="create variable" callbackKey="CREATE_VARIABLE"></button>
2112
+ * should be matched by a call to
2113
+ * registerButtonCallback("CREATE_VARIABLE", yourCallbackFunction).
2114
+ * @param {string} key The name to use to look up this function.
2115
+ * @param {function(!Blockly.FlyoutButton)} func The function to call when the
2116
+ * given button is clicked.
2117
+ */
2118
+ Blockly.WorkspaceSvg.prototype.registerButtonCallback = function(key, func) {
2119
+ goog.asserts.assert(goog.isFunction(func),
2120
+ 'Button callbacks must be functions.');
2121
+ this.flyoutButtonCallbacks_[key] = func;
2122
+ };
2123
+
2124
+ /**
2125
+ * Get the callback function associated with a given key, for clicks on buttons
2126
+ * and labels in the flyout.
2127
+ * @param {string} key The name to use to look up the function.
2128
+ * @return {?function(!Blockly.FlyoutButton)} The function corresponding to the
2129
+ * given key for this workspace; null if no callback is registered.
2130
+ */
2131
+ Blockly.WorkspaceSvg.prototype.getButtonCallback = function(key) {
2132
+ var result = this.flyoutButtonCallbacks_[key];
2133
+ return result ? result : null;
2134
+ };
2135
+
2136
+ /**
2137
+ * Remove a callback for a click on a button in the flyout.
2138
+ * @param {string} key The name associated with the callback function.
2139
+ */
2140
+ Blockly.WorkspaceSvg.prototype.removeButtonCallback = function(key) {
2141
+ this.flyoutButtonCallbacks_[key] = null;
2142
+ };
2143
+
2144
+ /**
2145
+ * Register a callback function associated with a given key, for populating
2146
+ * custom toolbox categories in this workspace. See the variable and procedure
2147
+ * categories as an example.
2148
+ * @param {string} key The name to use to look up this function.
2149
+ * @param {function(!Blockly.Workspace):!Array.<!Element>} func The function to
2150
+ * call when the given toolbox category is opened.
2151
+ */
2152
+ Blockly.WorkspaceSvg.prototype.registerToolboxCategoryCallback = function(key,
2153
+ func) {
2154
+ goog.asserts.assert(goog.isFunction(func),
2155
+ 'Toolbox category callbacks must be functions.');
2156
+ this.toolboxCategoryCallbacks_[key] = func;
2157
+ };
2158
+
2159
+ /**
2160
+ * Get the callback function associated with a given key, for populating
2161
+ * custom toolbox categories in this workspace.
2162
+ * @param {string} key The name to use to look up the function.
2163
+ * @return {?function(!Blockly.Workspace):!Array.<!Element>} The function
2164
+ * corresponding to the given key for this workspace, or null if no function
2165
+ * is registered.
2166
+ */
2167
+ Blockly.WorkspaceSvg.prototype.getToolboxCategoryCallback = function(key) {
2168
+ var result = this.toolboxCategoryCallbacks_[key];
2169
+ return result ? result : null;
2170
+ };
2171
+
2172
+ /**
2173
+ * Remove a callback for a click on a custom category's name in the toolbox.
2174
+ * @param {string} key The name associated with the callback function.
2175
+ */
2176
+ Blockly.WorkspaceSvg.prototype.removeToolboxCategoryCallback = function(key) {
2177
+ this.toolboxCategoryCallbacks_[key] = null;
2178
+ };
2179
+
2180
+ /**
2181
+ * Look up the gesture that is tracking this touch stream on this workspace.
2182
+ * May create a new gesture.
2183
+ * @param {!Event} e Mouse event or touch event
2184
+ * @return {Blockly.Gesture} The gesture that is tracking this touch stream,
2185
+ * or null if no valid gesture exists.
2186
+ * @package
2187
+ */
2188
+ Blockly.WorkspaceSvg.prototype.getGesture = function(e) {
2189
+ var isStart = (e.type == 'mousedown' || e.type == 'touchstart');
2190
+
2191
+ var gesture = this.currentGesture_;
2192
+ if (gesture) {
2193
+ if (isStart && gesture.hasStarted()) {
2194
+ // That's funny. We must have missed a mouse up.
2195
+ // Cancel it, rather than try to retrieve all of the state we need.
2196
+ gesture.cancel();
2197
+ return null;
2198
+ }
2199
+ return gesture;
2200
+ }
2201
+
2202
+ // No gesture existed on this workspace, but this looks like the start of a
2203
+ // new gesture.
2204
+ if (isStart) {
2205
+ this.currentGesture_ = new Blockly.Gesture(e, this);
2206
+ return this.currentGesture_;
2207
+ }
2208
+ // No gesture existed and this event couldn't be the start of a new gesture.
2209
+ return null;
2210
+ };
2211
+
2212
+ /**
2213
+ * Clear the reference to the current gesture.
2214
+ * @package
2215
+ */
2216
+ Blockly.WorkspaceSvg.prototype.clearGesture = function() {
2217
+ this.currentGesture_ = null;
2218
+ };
2219
+
2220
+ /**
2221
+ * Cancel the current gesture, if one exists.
2222
+ * @package
2223
+ */
2224
+ Blockly.WorkspaceSvg.prototype.cancelCurrentGesture = function() {
2225
+ if (this.currentGesture_) {
2226
+ this.currentGesture_.cancel();
2227
+ }
2228
+ };
2229
+
2230
+ /**
2231
+ * Don't even think about using this function before talking to rachel-fenichel.
2232
+ *
2233
+ * Force a drag to start without clicking and dragging the block itself. Used
2234
+ * to attach duplicated blocks to the mouse pointer.
2235
+ * @param {!Object} fakeEvent An object with the properties needed to start a
2236
+ * drag, including clientX and clientY.
2237
+ * @param {!Blockly.BlockSvg} block The block to start dragging.
2238
+ * @package
2239
+ */
2240
+ Blockly.WorkspaceSvg.prototype.startDragWithFakeEvent = function(fakeEvent,
2241
+ block) {
2242
+ Blockly.Touch.clearTouchIdentifier();
2243
+ Blockly.Touch.checkTouchIdentifier(fakeEvent);
2244
+ var gesture = block.workspace.getGesture(fakeEvent);
2245
+ gesture.forceStartBlockDrag(fakeEvent, block);
2246
+ };
2247
+
2248
+ /**
2249
+ * Get the audio manager for this workspace.
2250
+ * @return {Blockly.WorkspaceAudio} The audio manager for this workspace.
2251
+ */
2252
+ Blockly.WorkspaceSvg.prototype.getAudioManager = function() {
2253
+ return this.audioManager_;
2254
+ };
2255
+
2256
+ /**
2257
+ * Get the grid object for this workspace, or null if there is none.
2258
+ * @return {Blockly.Grid} The grid object for this workspace.
2259
+ * @package
2260
+ */
2261
+ Blockly.WorkspaceSvg.prototype.getGrid = function() {
2262
+ return this.grid_;
2263
+ };
2264
+
2265
+ // Export symbols that would otherwise be renamed by Closure compiler.
2266
+ Blockly.WorkspaceSvg.prototype['setVisible'] =
2267
+ Blockly.WorkspaceSvg.prototype.setVisible;