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
package/core/block.js ADDED
@@ -0,0 +1,1837 @@
1
+ /**
2
+ * @license
3
+ * Visual Blocks Editor
4
+ *
5
+ * Copyright 2011 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 The class representing one block.
23
+ * @author fraser@google.com (Neil Fraser)
24
+ */
25
+ 'use strict';
26
+
27
+ goog.provide('Blockly.Block');
28
+
29
+ goog.require('Blockly.Blocks');
30
+ goog.require('Blockly.Colours');
31
+ goog.require('Blockly.Comment');
32
+ goog.require('Blockly.ScratchBlockComment');
33
+ goog.require('Blockly.Connection');
34
+ goog.require('Blockly.Events.BlockChange');
35
+ goog.require('Blockly.Events.BlockCreate');
36
+ goog.require('Blockly.Events.BlockDelete');
37
+ goog.require('Blockly.Events.BlockMove');
38
+ goog.require('Blockly.Extensions');
39
+ goog.require('Blockly.FieldLabelSerializable');
40
+ goog.require('Blockly.FieldVariableGetter');
41
+ goog.require('Blockly.Input');
42
+ goog.require('Blockly.Mutator');
43
+ goog.require('Blockly.Warning');
44
+ goog.require('Blockly.Workspace');
45
+ goog.require('Blockly.Xml');
46
+ goog.require('goog.array');
47
+ goog.require('goog.asserts');
48
+ goog.require('goog.math.Coordinate');
49
+ goog.require('goog.string');
50
+
51
+
52
+ /**
53
+ * Class for one block.
54
+ * Not normally called directly, workspace.newBlock() is preferred.
55
+ * @param {!Blockly.Workspace} workspace The block's workspace.
56
+ * @param {?string} prototypeName Name of the language object containing
57
+ * type-specific functions for this block.
58
+ * @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
59
+ * create a new ID. If the ID conflicts with an in-use ID, a new one will
60
+ * be generated.
61
+ * @constructor
62
+ */
63
+ Blockly.Block = function(workspace, prototypeName, opt_id) {
64
+ var flyoutWorkspace = workspace && workspace.getFlyout && workspace.getFlyout() ?
65
+ workspace.getFlyout().getWorkspace() : null;
66
+ /** @type {string} */
67
+ this.id = (opt_id && !workspace.getBlockById(opt_id) &&
68
+ (!flyoutWorkspace || !flyoutWorkspace.getBlockById(opt_id))) ?
69
+ opt_id : Blockly.utils.genUid();
70
+ workspace.blockDB_[this.id] = this;
71
+ /** @type {Blockly.Connection} */
72
+ this.outputConnection = null;
73
+ /** @type {Blockly.Connection} */
74
+ this.nextConnection = null;
75
+ /** @type {Blockly.Connection} */
76
+ this.previousConnection = null;
77
+ /** @type {!Array.<!Blockly.Input>} */
78
+ this.inputList = [];
79
+ /** @type {boolean|undefined} */
80
+ this.inputsInline = true;
81
+ /** @type {boolean} */
82
+ this.disabled = false;
83
+ /** @type {string|!Function} */
84
+ this.tooltip = '';
85
+ /** @type {boolean} */
86
+ this.contextMenu = true;
87
+
88
+ /**
89
+ * @type {Blockly.Block}
90
+ * @protected
91
+ */
92
+ this.parentBlock_ = null;
93
+
94
+ /**
95
+ * @type {!Array.<!Blockly.Block>}
96
+ * @protected
97
+ */
98
+ this.childBlocks_ = [];
99
+
100
+ /**
101
+ * @type {boolean}
102
+ * @private
103
+ */
104
+ this.deletable_ = true;
105
+
106
+ /**
107
+ * @type {boolean}
108
+ * @private
109
+ */
110
+ this.movable_ = true;
111
+
112
+ /**
113
+ * @type {boolean}
114
+ * @private
115
+ */
116
+ this.editable_ = true;
117
+
118
+ /**
119
+ * @type {boolean}
120
+ * @private
121
+ */
122
+ this.isShadow_ = false;
123
+
124
+ /**
125
+ * @type {boolean}
126
+ * @protected
127
+ */
128
+ this.collapsed_ = false;
129
+
130
+ /**
131
+ * @type {boolean}
132
+ * @private
133
+ */
134
+ this.checkboxInFlyout_ = false;
135
+
136
+ /** @type {string|Blockly.Comment} */
137
+ this.comment = null;
138
+
139
+ /**
140
+ * @type {?number}
141
+ * @private
142
+ */
143
+ this.outputShape_ = null;
144
+
145
+ /**
146
+ * @type {?string}
147
+ * @private
148
+ */
149
+ this.category_ = null;
150
+
151
+ /**
152
+ * The block's position in workspace units. (0, 0) is at the workspace's
153
+ * origin; scale does not change this value.
154
+ * @type {!goog.math.Coordinate}
155
+ * @private
156
+ */
157
+ this.xy_ = new goog.math.Coordinate(0, 0);
158
+
159
+ /** @type {!Blockly.Workspace} */
160
+ this.workspace = workspace;
161
+ /** @type {boolean} */
162
+ this.isInFlyout = workspace.isFlyout;
163
+ /** @type {boolean} */
164
+ this.isInMutator = workspace.isMutator;
165
+
166
+ /** @type {boolean} */
167
+ this.RTL = workspace.RTL;
168
+
169
+ /** @type {boolean} */
170
+ this.isInsertionMarker_ = false;
171
+
172
+ // Copy the type-specific functions and data from the prototype.
173
+ if (prototypeName) {
174
+ /** @type {string} */
175
+ this.type = prototypeName;
176
+ var prototype = Blockly.Blocks[prototypeName];
177
+ goog.asserts.assertObject(prototype,
178
+ 'Error: Unknown block type "%s".', prototypeName);
179
+ goog.mixin(this, prototype);
180
+ }
181
+
182
+ workspace.addTopBlock(this);
183
+
184
+ // Call an initialization function, if it exists.
185
+ if (goog.isFunction(this.init)) {
186
+ this.init();
187
+ }
188
+ // Record initial inline state.
189
+ /** @type {boolean|undefined} */
190
+ this.inputsInlineDefault = this.inputsInline;
191
+
192
+ // Fire a create event.
193
+ if (Blockly.Events.isEnabled()) {
194
+ var existingGroup = Blockly.Events.getGroup();
195
+ if (!existingGroup) {
196
+ Blockly.Events.setGroup(true);
197
+ }
198
+ try {
199
+ Blockly.Events.fire(new Blockly.Events.BlockCreate(this));
200
+ } finally {
201
+ if (!existingGroup) {
202
+ Blockly.Events.setGroup(false);
203
+ }
204
+ }
205
+
206
+ }
207
+ // Bind an onchange function, if it exists.
208
+ if (goog.isFunction(this.onchange)) {
209
+ this.setOnChange(this.onchange);
210
+ }
211
+ };
212
+
213
+ /**
214
+ * Optional text data that round-trips beween blocks and XML.
215
+ * Has no effect. May be used by 3rd parties for meta information.
216
+ * @type {?string}
217
+ */
218
+ Blockly.Block.prototype.data = null;
219
+
220
+ /**
221
+ * Colour of the block in '#RRGGBB' format.
222
+ * @type {string}
223
+ * @private
224
+ */
225
+ Blockly.Block.prototype.colour_ = '#FF0000';
226
+
227
+ /**
228
+ * Secondary colour of the block in '#RRGGBB' format.
229
+ * @type {string}
230
+ * @private
231
+ */
232
+ Blockly.Block.prototype.colourSecondary_ = '#FF0000';
233
+
234
+ /**
235
+ * Tertiary colour of the block in '#RRGGBB' format.
236
+ * @type {string}
237
+ * @private
238
+ */
239
+ Blockly.Block.prototype.colourTertiary_ = '#FF0000';
240
+
241
+ /**
242
+ * Quaternary colour of the block in '#RRGGBB' format.
243
+ * @type {string}
244
+ * @private
245
+ */
246
+ Blockly.Block.prototype.colourQuaternary = '#FF0000';
247
+
248
+ /**
249
+ * Fill colour used to override default shadow colour behaviour.
250
+ * @type {string}
251
+ * @private
252
+ */
253
+ Blockly.Block.prototype.shadowColour_ = null;
254
+
255
+ /**
256
+ * Dispose of this block.
257
+ * @param {boolean} healStack If true, then try to heal any gap by connecting
258
+ * the next statement with the previous statement. Otherwise, dispose of
259
+ * all children of this block.
260
+ */
261
+ Blockly.Block.prototype.dispose = function(healStack) {
262
+ if (!this.workspace) {
263
+ // Already deleted.
264
+ return;
265
+ }
266
+ // Terminate onchange event calls.
267
+ if (this.onchangeWrapper_) {
268
+ this.workspace.removeChangeListener(this.onchangeWrapper_);
269
+ }
270
+ this.unplug(healStack);
271
+ if (Blockly.Events.isEnabled()) {
272
+ Blockly.Events.fire(new Blockly.Events.BlockDelete(this));
273
+ }
274
+ Blockly.Events.disable();
275
+
276
+ try {
277
+ // This block is now at the top of the workspace.
278
+ // Remove this block from the workspace's list of top-most blocks.
279
+ if (this.workspace) {
280
+ this.workspace.removeTopBlock(this);
281
+ // Remove from block database.
282
+ delete this.workspace.blockDB_[this.id];
283
+ this.workspace = null;
284
+ }
285
+
286
+ // Just deleting this block from the DOM would result in a memory leak as
287
+ // well as corruption of the connection database. Therefore we must
288
+ // methodically step through the blocks and carefully disassemble them.
289
+
290
+ if (Blockly.selected == this) {
291
+ Blockly.selected = null;
292
+ }
293
+
294
+ // First, dispose of all my children.
295
+ for (var i = this.childBlocks_.length - 1; i >= 0; i--) {
296
+ this.childBlocks_[i].dispose(false);
297
+ }
298
+ // Then dispose of myself.
299
+ // Dispose of all inputs and their fields.
300
+ for (var i = 0, input; input = this.inputList[i]; i++) {
301
+ input.dispose();
302
+ }
303
+ this.inputList.length = 0;
304
+ // Dispose of any remaining connections (next/previous/output).
305
+ var connections = this.getConnections_(true);
306
+ for (var i = 0; i < connections.length; i++) {
307
+ var connection = connections[i];
308
+ if (connection.isConnected()) {
309
+ connection.disconnect();
310
+ }
311
+ connections[i].dispose();
312
+ }
313
+ } finally {
314
+ Blockly.Events.enable();
315
+ }
316
+ };
317
+
318
+ /**
319
+ * Call initModel on all fields on the block.
320
+ * May be called more than once.
321
+ * Either initModel or initSvg must be called after creating a block and before
322
+ * the first interaction with it. Interactions include UI actions
323
+ * (e.g. clicking and dragging) and firing events (e.g. create, delete, and
324
+ * change).
325
+ * @public
326
+ */
327
+ Blockly.Block.prototype.initModel = function() {
328
+ for (var i = 0, input; input = this.inputList[i]; i++) {
329
+ for (var j = 0, field; field = input.fieldRow[j]; j++) {
330
+ if (field.initModel) {
331
+ field.initModel();
332
+ }
333
+ }
334
+ }
335
+ };
336
+
337
+ /**
338
+ * Unplug this block from its superior block. If this block is a statement,
339
+ * optionally reconnect the block underneath with the block on top.
340
+ * @param {boolean=} opt_healStack Disconnect child statement and reconnect
341
+ * stack. Defaults to false.
342
+ */
343
+ Blockly.Block.prototype.unplug = function(opt_healStack) {
344
+ if (this.outputConnection) {
345
+ if (this.outputConnection.isConnected()) {
346
+ // Disconnect from any superior block.
347
+ this.outputConnection.disconnect();
348
+ }
349
+ } else {
350
+ if (this.previousConnection) {
351
+ var previousTarget = null;
352
+ if (this.previousConnection.isConnected()) {
353
+ // Remember the connection that any next statements need to connect to.
354
+ previousTarget = this.previousConnection.targetConnection;
355
+ // Detach this block from the parent's tree.
356
+ this.previousConnection.disconnect();
357
+ }
358
+ }
359
+ var nextBlock = this.getNextBlock();
360
+ if (opt_healStack && nextBlock) {
361
+ // Disconnect the next statement.
362
+ var nextTarget = this.nextConnection.targetConnection;
363
+ nextTarget.disconnect();
364
+ if (previousTarget && previousTarget.checkType_(nextTarget)) {
365
+ // Attach the next statement to the previous statement.
366
+ previousTarget.connect(nextTarget);
367
+ }
368
+ }
369
+ }
370
+ };
371
+
372
+ /**
373
+ * Returns all connections originating from this block.
374
+ * @return {!Array.<!Blockly.Connection>} Array of connections.
375
+ * @private
376
+ */
377
+ Blockly.Block.prototype.getConnections_ = function() {
378
+ var myConnections = [];
379
+ if (this.outputConnection) {
380
+ myConnections.push(this.outputConnection);
381
+ }
382
+ if (this.previousConnection) {
383
+ myConnections.push(this.previousConnection);
384
+ }
385
+ if (this.nextConnection) {
386
+ myConnections.push(this.nextConnection);
387
+ }
388
+ for (var i = 0, input; input = this.inputList[i]; i++) {
389
+ if (input.connection) {
390
+ myConnections.push(input.connection);
391
+ }
392
+ }
393
+ return myConnections;
394
+ };
395
+
396
+ /**
397
+ * Walks down a stack of blocks and finds the last next connection on the stack.
398
+ * @return {Blockly.Connection} The last next connection on the stack, or null.
399
+ * @package
400
+ */
401
+ Blockly.Block.prototype.lastConnectionInStack = function() {
402
+ var nextConnection = this.nextConnection;
403
+ while (nextConnection) {
404
+ var nextBlock = nextConnection.targetBlock();
405
+ if (!nextBlock) {
406
+ // Found a next connection with nothing on the other side.
407
+ return nextConnection;
408
+ }
409
+ nextConnection = nextBlock.nextConnection;
410
+ }
411
+ // Ran out of next connections.
412
+ return null;
413
+ };
414
+
415
+ /**
416
+ * Bump unconnected blocks out of alignment. Two blocks which aren't actually
417
+ * connected should not coincidentally line up on screen.
418
+ * @protected
419
+ */
420
+ Blockly.Block.prototype.bumpNeighbours_ = function() {
421
+ console.warn('Not expected to reach this bumpNeighbours_ function. The ' +
422
+ 'BlockSvg function for bumpNeighbours_ was expected to be called instead.');
423
+ };
424
+
425
+ /**
426
+ * Return the parent block or null if this block is at the top level.
427
+ * @return {Blockly.Block} The block that holds the current block.
428
+ */
429
+ Blockly.Block.prototype.getParent = function() {
430
+ // Look at the DOM to see if we are nested in another block.
431
+ return this.parentBlock_;
432
+ };
433
+
434
+ /**
435
+ * Return the input that connects to the specified block.
436
+ * @param {!Blockly.Block} block A block connected to an input on this block.
437
+ * @return {Blockly.Input} The input that connects to the specified block.
438
+ */
439
+ Blockly.Block.prototype.getInputWithBlock = function(block) {
440
+ for (var i = 0, input; input = this.inputList[i]; i++) {
441
+ if (input.connection && input.connection.targetBlock() == block) {
442
+ return input;
443
+ }
444
+ }
445
+ return null;
446
+ };
447
+
448
+ /**
449
+ * Return the input that contains the specified connection
450
+ * @param {!Blockly.Connection} conn A connection on this block.
451
+ * @return {Blockly.Input} The input that contains the specified connection.
452
+ */
453
+ Blockly.Block.prototype.getInputWithConnection = function(conn) {
454
+ for (var i = 0, input; input = this.inputList[i]; i++) {
455
+ if (input.connection == conn) {
456
+ return input;
457
+ }
458
+ }
459
+ return null;
460
+ };
461
+
462
+ /**
463
+ * Return the parent block that surrounds the current block, or null if this
464
+ * block has no surrounding block. A parent block might just be the previous
465
+ * statement, whereas the surrounding block is an if statement, while loop, etc.
466
+ * @return {Blockly.Block} The block that surrounds the current block.
467
+ */
468
+ Blockly.Block.prototype.getSurroundParent = function() {
469
+ var block = this;
470
+ do {
471
+ var prevBlock = block;
472
+ block = block.getParent();
473
+ if (!block) {
474
+ // Ran off the top.
475
+ return null;
476
+ }
477
+ } while (block.getNextBlock() == prevBlock);
478
+ // This block is an enclosing parent, not just a statement in a stack.
479
+ return block;
480
+ };
481
+
482
+ /**
483
+ * Return the next statement block directly connected to this block.
484
+ * @return {Blockly.Block} The next statement block or null.
485
+ */
486
+ Blockly.Block.prototype.getNextBlock = function() {
487
+ return this.nextConnection && this.nextConnection.targetBlock();
488
+ };
489
+
490
+ /**
491
+ * Return the previous statement block directly connected to this block.
492
+ * @return {Blockly.Block} The previous statement block or null.
493
+ */
494
+ Blockly.Block.prototype.getPreviousBlock = function() {
495
+ return this.previousConnection && this.previousConnection.targetBlock();
496
+ };
497
+
498
+ /**
499
+ * Return the connection on the first statement input on this block, or null if
500
+ * there are none.
501
+ * @return {Blockly.Connection} The first statement connection or null.
502
+ */
503
+ Blockly.Block.prototype.getFirstStatementConnection = function() {
504
+ for (var i = 0, input; input = this.inputList[i]; i++) {
505
+ if (input.connection && input.connection.type == Blockly.NEXT_STATEMENT) {
506
+ return input.connection;
507
+ }
508
+ }
509
+ return null;
510
+ };
511
+
512
+ /**
513
+ * Return the top-most block in this block's tree.
514
+ * This will return itself if this block is at the top level.
515
+ * @return {!Blockly.Block} The root block.
516
+ */
517
+ Blockly.Block.prototype.getRootBlock = function() {
518
+ var rootBlock;
519
+ var block = this;
520
+ do {
521
+ rootBlock = block;
522
+ block = rootBlock.parentBlock_;
523
+ } while (block);
524
+ return rootBlock;
525
+ };
526
+
527
+ /**
528
+ * Find all the blocks that are directly nested inside this one.
529
+ * Includes value and statement inputs, as well as any following statement.
530
+ * Excludes any connection on an output tab or any preceding statement.
531
+ * Blocks are optionally sorted by position; top to bottom.
532
+ * @param {boolean} ordered Sort the list if true.
533
+ * @return {!Array.<!Blockly.Block>} Array of blocks.
534
+ */
535
+ Blockly.Block.prototype.getChildren = function(ordered) {
536
+ if (!ordered) {
537
+ return this.childBlocks_;
538
+ }
539
+ var blocks = [];
540
+ for (var i = 0, input; input = this.inputList[i]; i++) {
541
+ if (input.connection) {
542
+ var child = input.connection.targetBlock();
543
+ if (child) {
544
+ blocks.push(child);
545
+ }
546
+ }
547
+ }
548
+ var next = this.getNextBlock();
549
+ if (next) {
550
+ blocks.push(next);
551
+ }
552
+ return blocks;
553
+ };
554
+
555
+ /**
556
+ * Set parent of this block to be a new block or null.
557
+ * @param {Blockly.Block} newParent New parent block.
558
+ */
559
+ Blockly.Block.prototype.setParent = function(newParent) {
560
+ if (newParent == this.parentBlock_) {
561
+ return;
562
+ }
563
+ if (this.parentBlock_) {
564
+ // Remove this block from the old parent's child list.
565
+ goog.array.remove(this.parentBlock_.childBlocks_, this);
566
+
567
+ // Disconnect from superior blocks.
568
+ if (this.previousConnection && this.previousConnection.isConnected()) {
569
+ throw 'Still connected to previous block.';
570
+ }
571
+ if (this.outputConnection && this.outputConnection.isConnected()) {
572
+ throw 'Still connected to parent block.';
573
+ }
574
+ this.parentBlock_ = null;
575
+ // This block hasn't actually moved on-screen, so there's no need to update
576
+ // its connection locations.
577
+ } else {
578
+ // Remove this block from the workspace's list of top-most blocks.
579
+ this.workspace.removeTopBlock(this);
580
+ }
581
+
582
+ this.parentBlock_ = newParent;
583
+ if (newParent) {
584
+ // Add this block to the new parent's child list.
585
+ newParent.childBlocks_.push(this);
586
+ } else {
587
+ this.workspace.addTopBlock(this);
588
+ }
589
+ };
590
+
591
+ /**
592
+ * Find all the blocks that are directly or indirectly nested inside this one.
593
+ * Includes this block in the list.
594
+ * Includes value and statement inputs, as well as any following statements.
595
+ * Excludes any connection on an output tab or any preceding statements.
596
+ * Blocks are optionally sorted by position, top to bottom.
597
+ * @param {boolean} ordered Sort the list if true.
598
+ * @param {boolean=} opt_ignoreShadows If set, don't include shadow blocks.
599
+ * @return {!Array.<!Blockly.Block>} Flattened array of blocks.
600
+ */
601
+ Blockly.Block.prototype.getDescendants = function(ordered, opt_ignoreShadows) {
602
+ var blocks = [this];
603
+ var childBlocks = this.getChildren(ordered);
604
+ for (var child, i = 0; child = childBlocks[i]; i++) {
605
+ if (!opt_ignoreShadows || !child.isShadow_) {
606
+ blocks.push.apply(
607
+ blocks, child.getDescendants(ordered, opt_ignoreShadows));
608
+ }
609
+ }
610
+ return blocks;
611
+ };
612
+
613
+ /**
614
+ * Get whether this block is deletable or not.
615
+ * @return {boolean} True if deletable.
616
+ */
617
+ Blockly.Block.prototype.isDeletable = function() {
618
+ return this.deletable_ && !this.isShadow_ &&
619
+ !(this.workspace && this.workspace.options.readOnly);
620
+ };
621
+
622
+ /**
623
+ * Set whether this block is deletable or not.
624
+ * @param {boolean} deletable True if deletable.
625
+ */
626
+ Blockly.Block.prototype.setDeletable = function(deletable) {
627
+ this.deletable_ = deletable;
628
+ };
629
+
630
+ /**
631
+ * Get whether this block is movable or not.
632
+ * @return {boolean} True if movable.
633
+ */
634
+ Blockly.Block.prototype.isMovable = function() {
635
+ return this.movable_ && !this.isShadow_ &&
636
+ !(this.workspace && this.workspace.options.readOnly);
637
+ };
638
+
639
+ /**
640
+ * Set whether this block is movable or not.
641
+ * @param {boolean} movable True if movable.
642
+ */
643
+ Blockly.Block.prototype.setMovable = function(movable) {
644
+ this.movable_ = movable;
645
+ };
646
+
647
+ /**
648
+ * Get whether this block is a shadow block or not.
649
+ * @return {boolean} True if a shadow.
650
+ */
651
+ Blockly.Block.prototype.isShadow = function() {
652
+ return this.isShadow_;
653
+ };
654
+
655
+ /**
656
+ * Set whether this block is a shadow block or not.
657
+ * @param {boolean} shadow True if a shadow.
658
+ */
659
+ Blockly.Block.prototype.setShadow = function(shadow) {
660
+ this.isShadow_ = shadow;
661
+ };
662
+
663
+ /**
664
+ * Get whether this block is an insertion marker block or not.
665
+ * @return {boolean} True if an insertion marker.
666
+ */
667
+ Blockly.Block.prototype.isInsertionMarker = function() {
668
+ return this.isInsertionMarker_;
669
+ };
670
+
671
+ /**
672
+ * Set whether this block is an insertion marker block or not.
673
+ * @param {boolean} insertionMarker True if an insertion marker.
674
+ */
675
+ Blockly.Block.prototype.setInsertionMarker = function(insertionMarker) {
676
+ if (this.isInsertionMarker_ == insertionMarker) {
677
+ return; // No change.
678
+ }
679
+ this.isInsertionMarker_ = insertionMarker;
680
+ // TODO: handle removing insertion marker status.
681
+ if (this.isInsertionMarker_) {
682
+ this.setColour(Blockly.Colours.insertionMarker);
683
+ this.setOpacity(Blockly.Colours.insertionMarkerOpacity);
684
+ Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
685
+ 'blocklyInsertionMarker');
686
+ }
687
+ };
688
+
689
+ /**
690
+ * Get whether this block is editable or not.
691
+ * @return {boolean} True if editable.
692
+ */
693
+ Blockly.Block.prototype.isEditable = function() {
694
+ return this.editable_ && !(this.workspace && this.workspace.options.readOnly);
695
+ };
696
+
697
+ /**
698
+ * Set whether this block is editable or not.
699
+ * @param {boolean} editable True if editable.
700
+ */
701
+ Blockly.Block.prototype.setEditable = function(editable) {
702
+ this.editable_ = editable;
703
+ for (var i = 0, input; input = this.inputList[i]; i++) {
704
+ for (var j = 0, field; field = input.fieldRow[j]; j++) {
705
+ field.updateEditable();
706
+ }
707
+ }
708
+ };
709
+
710
+ /**
711
+ * Set whether the connections are hidden (not tracked in a database) or not.
712
+ * Recursively walk down all child blocks (except collapsed blocks).
713
+ * @param {boolean} hidden True if connections are hidden.
714
+ */
715
+ Blockly.Block.prototype.setConnectionsHidden = function(hidden) {
716
+ if (!hidden && this.isCollapsed()) {
717
+ if (this.outputConnection) {
718
+ this.outputConnection.setHidden(hidden);
719
+ }
720
+ if (this.previousConnection) {
721
+ this.previousConnection.setHidden(hidden);
722
+ }
723
+ if (this.nextConnection) {
724
+ this.nextConnection.setHidden(hidden);
725
+ var child = this.nextConnection.targetBlock();
726
+ if (child) {
727
+ child.setConnectionsHidden(hidden);
728
+ }
729
+ }
730
+ } else {
731
+ var myConnections = this.getConnections_(true);
732
+ for (var i = 0, connection; connection = myConnections[i]; i++) {
733
+ connection.setHidden(hidden);
734
+ if (connection.isSuperior()) {
735
+ var child = connection.targetBlock();
736
+ if (child) {
737
+ child.setConnectionsHidden(hidden);
738
+ }
739
+ }
740
+ }
741
+ }
742
+ };
743
+
744
+ /**
745
+ * Find the connection on this block that corresponds to the given connection
746
+ * on the other block.
747
+ * Used to match connections between a block and its insertion marker.
748
+ * @param {!Blockly.Block} otherBlock The other block to match against.
749
+ * @param {!Blockly.Connection} conn The other connection to match.
750
+ * @return {Blockly.Connection} the matching connection on this block, or null.
751
+ */
752
+ Blockly.Block.prototype.getMatchingConnection = function(otherBlock, conn) {
753
+ var connections = this.getConnections_(true);
754
+ var otherConnections = otherBlock.getConnections_(true);
755
+ if (connections.length != otherConnections.length) {
756
+ throw "Connection lists did not match in length.";
757
+ }
758
+ for (var i = 0; i < otherConnections.length; i++) {
759
+ if (otherConnections[i] == conn) {
760
+ return connections[i];
761
+ }
762
+ }
763
+ return null;
764
+ };
765
+
766
+ /**
767
+ * Set the URL of this block's help page.
768
+ * @param {string|Function} url URL string for block help, or function that
769
+ * returns a URL. Null for no help.
770
+ */
771
+ Blockly.Block.prototype.setHelpUrl = function(url) {
772
+ this.helpUrl = url;
773
+ };
774
+
775
+ /**
776
+ * Change the tooltip text for a block.
777
+ * @param {string|!Function} newTip Text for tooltip or a parent element to
778
+ * link to for its tooltip. May be a function that returns a string.
779
+ */
780
+ Blockly.Block.prototype.setTooltip = function(newTip) {
781
+ this.tooltip = newTip;
782
+ };
783
+
784
+ /**
785
+ * Get the colour of a block.
786
+ * @return {string} #RRGGBB string.
787
+ */
788
+ Blockly.Block.prototype.getColour = function() {
789
+ return this.colour_;
790
+ };
791
+
792
+ /**
793
+ * Get the secondary colour of a block.
794
+ * @return {string} #RRGGBB string.
795
+ */
796
+ Blockly.Block.prototype.getColourSecondary = function() {
797
+ return this.colourSecondary_;
798
+ };
799
+
800
+ /**
801
+ * Get the tertiary colour of a block.
802
+ * @return {string} #RRGGBB string.
803
+ */
804
+ Blockly.Block.prototype.getColourTertiary = function() {
805
+ return this.colourTertiary_;
806
+ };
807
+
808
+ /**
809
+ * Get the quaternary colour of a block.
810
+ * @return {string} #RRGGBB string.
811
+ */
812
+ Blockly.Block.prototype.getColourQuaternary = function() {
813
+ return this.colourQuaternary_;
814
+ };
815
+
816
+ /**
817
+ * Get the shadow colour of a block.
818
+ * @return {string} #RRGGBB string.
819
+ */
820
+ Blockly.Block.prototype.getShadowColour = function() {
821
+ return this.shadowColour_;
822
+ };
823
+
824
+ /**
825
+ * Set the shadow colour of a block.
826
+ * @param {number|string} colour HSV hue value, or #RRGGBB string.
827
+ */
828
+ Blockly.Block.prototype.setShadowColour = function(colour) {
829
+ this.shadowColour_ = this.makeColour_(colour);
830
+ if (this.rendered) {
831
+ this.updateColour();
832
+ }
833
+ };
834
+
835
+ /**
836
+ * Clear the shadow colour of a block.
837
+ */
838
+ Blockly.Block.prototype.clearShadowColour = function() {
839
+ this.shadowColour_ = null;
840
+ if (this.rendered) {
841
+ this.updateColour();
842
+ }
843
+ };
844
+
845
+ /**
846
+ * Create an #RRGGBB string colour from a colour HSV hue value or #RRGGBB string.
847
+ * @param {number|string} colour HSV hue value, or #RRGGBB string.
848
+ * @return {string} #RRGGBB string.
849
+ * @private
850
+ */
851
+ Blockly.Block.prototype.makeColour_ = function(colour) {
852
+ var hue = Number(colour);
853
+ if (!isNaN(hue)) {
854
+ return Blockly.hueToRgb(hue);
855
+ } else if (goog.isString(colour) && colour.match(/^#[0-9a-fA-F]{6}$/)) {
856
+ return colour;
857
+ } else {
858
+ throw 'Invalid colour: ' + colour;
859
+ }
860
+ };
861
+
862
+ /**
863
+ * Change the colour of a block, and optional secondary/teriarty colours.
864
+ * @param {number|string} colour HSV hue value, or #RRGGBB string.
865
+ * @param {number|string} colourSecondary HSV hue value, or #RRGGBB string.
866
+ * @param {number|string} colourTertiary HSV hue value, or #RRGGBB string.
867
+ * @param {number|string} colourQuaternary HSV hue value, or #RRGGBB string.
868
+ */
869
+ Blockly.Block.prototype.setColour = function(colour, colourSecondary, colourTertiary,
870
+ colourQuaternary) {
871
+ this.colour_ = this.makeColour_(colour);
872
+ if (colourSecondary !== undefined) {
873
+ this.colourSecondary_ = this.makeColour_(colourSecondary);
874
+ } else {
875
+ this.colourSecondary_ = goog.color.rgbArrayToHex(
876
+ goog.color.darken(goog.color.hexToRgb(this.colour_), 0.1));
877
+ }
878
+ if (colourTertiary !== undefined) {
879
+ this.colourTertiary_ = this.makeColour_(colourTertiary);
880
+ } else {
881
+ this.colourTertiary_ = goog.color.rgbArrayToHex(
882
+ goog.color.darken(goog.color.hexToRgb(this.colour_), 0.2));
883
+ }
884
+ if (colourQuaternary !== undefined) {
885
+ this.colourQuaternary_ = this.makeColour_(colourQuaternary);
886
+ } else {
887
+ this.colourQuaternary_ = this.colourTertiary_;
888
+ }
889
+ if (this.rendered) {
890
+ this.updateColour();
891
+ }
892
+ };
893
+
894
+ /**
895
+ * Sets a callback function to use whenever the block's parent workspace
896
+ * changes, replacing any prior onchange handler. This is usually only called
897
+ * from the constructor, the block type initializer function, or an extension
898
+ * initializer function.
899
+ * @param {function(Blockly.Events.Abstract)} onchangeFn The callback to call
900
+ * when the block's workspace changes.
901
+ * @throws {Error} if onchangeFn is not falsey or a function.
902
+ */
903
+ Blockly.Block.prototype.setOnChange = function(onchangeFn) {
904
+ if (onchangeFn && !goog.isFunction(onchangeFn)) {
905
+ throw new Error("onchange must be a function.");
906
+ }
907
+ if (this.onchangeWrapper_) {
908
+ this.workspace.removeChangeListener(this.onchangeWrapper_);
909
+ }
910
+ this.onchange = onchangeFn;
911
+ if (this.onchange) {
912
+ this.onchangeWrapper_ = onchangeFn.bind(this);
913
+ this.workspace.addChangeListener(this.onchangeWrapper_);
914
+ }
915
+ };
916
+
917
+ /**
918
+ * Returns the named field from a block.
919
+ * @param {string} name The name of the field.
920
+ * @return {Blockly.Field} Named field, or null if field does not exist.
921
+ */
922
+ Blockly.Block.prototype.getField = function(name) {
923
+ for (var i = 0, input; input = this.inputList[i]; i++) {
924
+ for (var j = 0, field; field = input.fieldRow[j]; j++) {
925
+ if (field.name === name) {
926
+ return field;
927
+ }
928
+ }
929
+ }
930
+ return null;
931
+ };
932
+
933
+ /**
934
+ * Return all variables referenced by this block.
935
+ * @return {!Array.<string>} List of variable names.
936
+ * @package
937
+ */
938
+ Blockly.Block.prototype.getVars = function() {
939
+ var vars = [];
940
+ for (var i = 0, input; input = this.inputList[i]; i++) {
941
+ for (var j = 0, field; field = input.fieldRow[j]; j++) {
942
+ if (field.referencesVariables()) {
943
+ vars.push(field.getValue());
944
+ }
945
+ }
946
+ }
947
+ return vars;
948
+ };
949
+
950
+ /**
951
+ * Return all variables referenced by this block.
952
+ * @return {!Array.<!Blockly.VariableModel>} List of variable models.
953
+ * @package
954
+ */
955
+ Blockly.Block.prototype.getVarModels = function() {
956
+ var vars = [];
957
+ for (var i = 0, input; input = this.inputList[i]; i++) {
958
+ for (var j = 0, field; field = input.fieldRow[j]; j++) {
959
+ if (field.referencesVariables()) {
960
+ var model = this.workspace.getVariableById(field.getValue());
961
+ // Check if the variable actually exists (and isn't just a potential
962
+ // variable).
963
+ if (model) {
964
+ vars.push(model);
965
+ }
966
+ }
967
+ }
968
+ }
969
+ return vars;
970
+ };
971
+
972
+ /**
973
+ * Notification that a variable is renaming but keeping the same ID. If the
974
+ * variable is in use on this block, rerender to show the new name.
975
+ * @param {!Blockly.VariableModel} variable The variable being renamed.
976
+ * @package
977
+ */
978
+ Blockly.Block.prototype.updateVarName = function(variable) {
979
+ for (var i = 0, input; input = this.inputList[i]; i++) {
980
+ for (var j = 0, field; field = input.fieldRow[j]; j++) {
981
+ if (field.referencesVariables() &&
982
+ variable.getId() == field.getValue()) {
983
+ field.setText(variable.name);
984
+ }
985
+ }
986
+ }
987
+ };
988
+
989
+ /**
990
+ * Notification that a variable is renaming.
991
+ * If the ID matches one of this block's variables, rename it.
992
+ * @param {string} oldId ID of variable to rename.
993
+ * @param {string} newId ID of new variable. May be the same as oldId, but with
994
+ * an updated name.
995
+ */
996
+ Blockly.Block.prototype.renameVarById = function(oldId, newId) {
997
+ for (var i = 0, input; input = this.inputList[i]; i++) {
998
+ for (var j = 0, field; field = input.fieldRow[j]; j++) {
999
+ if (field.referencesVariables() &&
1000
+ oldId == field.getValue()) {
1001
+ field.setValue(newId);
1002
+ }
1003
+ }
1004
+ }
1005
+ };
1006
+
1007
+ /**
1008
+ * Returns the language-neutral value from the field of a block.
1009
+ * @param {string} name The name of the field.
1010
+ * @return {?string} Value from the field or null if field does not exist.
1011
+ */
1012
+ Blockly.Block.prototype.getFieldValue = function(name) {
1013
+ var field = this.getField(name);
1014
+ if (field) {
1015
+ return field.getValue();
1016
+ }
1017
+ return null;
1018
+ };
1019
+
1020
+ /**
1021
+ * Change the field value for a block (e.g. 'CHOOSE' or 'REMOVE').
1022
+ * @param {string} newValue Value to be the new field.
1023
+ * @param {string} name The name of the field.
1024
+ */
1025
+ Blockly.Block.prototype.setFieldValue = function(newValue, name) {
1026
+ var field = this.getField(name);
1027
+ goog.asserts.assertObject(field, 'Field "%s" not found.', name);
1028
+ field.setValue(newValue);
1029
+ };
1030
+
1031
+ /**
1032
+ * Set whether this block can chain onto the bottom of another block.
1033
+ * @param {boolean} newBoolean True if there can be a previous statement.
1034
+ * @param {(string|Array.<string>|null)=} opt_check Statement type or
1035
+ * list of statement types. Null/undefined if any type could be connected.
1036
+ */
1037
+ Blockly.Block.prototype.setPreviousStatement = function(newBoolean, opt_check) {
1038
+ if (newBoolean) {
1039
+ if (opt_check === undefined) {
1040
+ opt_check = null;
1041
+ }
1042
+ if (!this.previousConnection) {
1043
+ goog.asserts.assert(!this.outputConnection,
1044
+ 'Remove output connection prior to adding previous connection.');
1045
+ this.previousConnection =
1046
+ this.makeConnection_(Blockly.PREVIOUS_STATEMENT);
1047
+ }
1048
+ this.previousConnection.setCheck(opt_check);
1049
+ } else {
1050
+ if (this.previousConnection) {
1051
+ goog.asserts.assert(!this.previousConnection.isConnected(),
1052
+ 'Must disconnect previous statement before removing connection.');
1053
+ this.previousConnection.dispose();
1054
+ this.previousConnection = null;
1055
+ }
1056
+ }
1057
+ };
1058
+
1059
+ /**
1060
+ * Set whether another block can chain onto the bottom of this block.
1061
+ * @param {boolean} newBoolean True if there can be a next statement.
1062
+ * @param {(string|Array.<string>|null)=} opt_check Statement type or
1063
+ * list of statement types. Null/undefined if any type could be connected.
1064
+ */
1065
+ Blockly.Block.prototype.setNextStatement = function(newBoolean, opt_check) {
1066
+ if (newBoolean) {
1067
+ if (opt_check === undefined) {
1068
+ opt_check = null;
1069
+ }
1070
+ if (!this.nextConnection) {
1071
+ this.nextConnection = this.makeConnection_(Blockly.NEXT_STATEMENT);
1072
+ }
1073
+ this.nextConnection.setCheck(opt_check);
1074
+ } else {
1075
+ if (this.nextConnection) {
1076
+ goog.asserts.assert(!this.nextConnection.isConnected(),
1077
+ 'Must disconnect next statement before removing connection.');
1078
+ this.nextConnection.dispose();
1079
+ this.nextConnection = null;
1080
+ }
1081
+ }
1082
+ };
1083
+
1084
+ /**
1085
+ * Set whether this block returns a value.
1086
+ * @param {boolean} newBoolean True if there is an output.
1087
+ * @param {(string|Array.<string>|null)=} opt_check Returned type or list
1088
+ * of returned types. Null or undefined if any type could be returned
1089
+ * (e.g. variable get).
1090
+ */
1091
+ Blockly.Block.prototype.setOutput = function(newBoolean, opt_check) {
1092
+ if (newBoolean) {
1093
+ if (opt_check === undefined) {
1094
+ opt_check = null;
1095
+ }
1096
+ if (!this.outputConnection) {
1097
+ goog.asserts.assert(!this.previousConnection,
1098
+ 'Remove previous connection prior to adding output connection.');
1099
+ this.outputConnection = this.makeConnection_(Blockly.OUTPUT_VALUE);
1100
+ }
1101
+ this.outputConnection.setCheck(opt_check);
1102
+ } else {
1103
+ if (this.outputConnection) {
1104
+ goog.asserts.assert(!this.outputConnection.isConnected(),
1105
+ 'Must disconnect output value before removing connection.');
1106
+ this.outputConnection.dispose();
1107
+ this.outputConnection = null;
1108
+ }
1109
+ }
1110
+ };
1111
+
1112
+ /**
1113
+ * Set whether value inputs are arranged horizontally or vertically.
1114
+ * @param {boolean} newBoolean True if inputs are horizontal.
1115
+ */
1116
+ Blockly.Block.prototype.setInputsInline = function(newBoolean) {
1117
+ if (this.inputsInline != newBoolean) {
1118
+ Blockly.Events.fire(new Blockly.Events.BlockChange(
1119
+ this, 'inline', null, this.inputsInline, newBoolean));
1120
+ this.inputsInline = newBoolean;
1121
+ }
1122
+ };
1123
+
1124
+ /**
1125
+ * Get whether value inputs are arranged horizontally or vertically.
1126
+ * @return {boolean} True if inputs are horizontal.
1127
+ */
1128
+ Blockly.Block.prototype.getInputsInline = function() {
1129
+ if (this.inputsInline != undefined) {
1130
+ // Set explicitly.
1131
+ return this.inputsInline;
1132
+ }
1133
+ // Not defined explicitly. Figure out what would look best.
1134
+ for (var i = 1; i < this.inputList.length; i++) {
1135
+ if (this.inputList[i - 1].type == Blockly.DUMMY_INPUT &&
1136
+ this.inputList[i].type == Blockly.DUMMY_INPUT) {
1137
+ // Two dummy inputs in a row. Don't inline them.
1138
+ return false;
1139
+ }
1140
+ }
1141
+ for (var i = 1; i < this.inputList.length; i++) {
1142
+ if (this.inputList[i - 1].type == Blockly.INPUT_VALUE &&
1143
+ this.inputList[i].type == Blockly.DUMMY_INPUT) {
1144
+ // Dummy input after a value input. Inline them.
1145
+ return true;
1146
+ }
1147
+ }
1148
+ return false;
1149
+ };
1150
+
1151
+ /**
1152
+ * Set whether the block is disabled or not.
1153
+ * @param {boolean} disabled True if disabled.
1154
+ */
1155
+ Blockly.Block.prototype.setDisabled = function(disabled) {
1156
+ if (this.disabled != disabled) {
1157
+ Blockly.Events.fire(new Blockly.Events.BlockChange(
1158
+ this, 'disabled', null, this.disabled, disabled));
1159
+ this.disabled = disabled;
1160
+ }
1161
+ };
1162
+
1163
+ /**
1164
+ * Get whether the block is disabled or not due to parents.
1165
+ * The block's own disabled property is not considered.
1166
+ * @return {boolean} True if disabled.
1167
+ */
1168
+ Blockly.Block.prototype.getInheritedDisabled = function() {
1169
+ var ancestor = this.getSurroundParent();
1170
+ while (ancestor) {
1171
+ if (ancestor.disabled) {
1172
+ return true;
1173
+ }
1174
+ ancestor = ancestor.getSurroundParent();
1175
+ }
1176
+ // Ran off the top.
1177
+ return false;
1178
+ };
1179
+
1180
+ /**
1181
+ * Get whether the block is collapsed or not.
1182
+ * @return {boolean} True if collapsed.
1183
+ */
1184
+ Blockly.Block.prototype.isCollapsed = function() {
1185
+ return this.collapsed_;
1186
+ };
1187
+
1188
+ /**
1189
+ * Set whether the block is collapsed or not.
1190
+ * @param {boolean} collapsed True if collapsed.
1191
+ */
1192
+ Blockly.Block.prototype.setCollapsed = function(collapsed) {
1193
+ if (this.collapsed_ != collapsed) {
1194
+ Blockly.Events.fire(new Blockly.Events.BlockChange(
1195
+ this, 'collapsed', null, this.collapsed_, collapsed));
1196
+ this.collapsed_ = collapsed;
1197
+ }
1198
+ };
1199
+
1200
+ /**
1201
+ * Create a human-readable text representation of this block and any children.
1202
+ * @param {number=} opt_maxLength Truncate the string to this length.
1203
+ * @param {string=} opt_emptyToken The placeholder string used to denote an
1204
+ * empty field. If not specified, '?' is used.
1205
+ * @return {string} Text of block.
1206
+ */
1207
+ Blockly.Block.prototype.toString = function(opt_maxLength, opt_emptyToken) {
1208
+ var text = [];
1209
+ var emptyFieldPlaceholder = opt_emptyToken || '?';
1210
+ if (this.collapsed_) {
1211
+ text.push(this.getInput('_TEMP_COLLAPSED_INPUT').fieldRow[0].text_);
1212
+ } else {
1213
+ for (var i = 0, input; input = this.inputList[i]; i++) {
1214
+ for (var j = 0, field; field = input.fieldRow[j]; j++) {
1215
+ if (field instanceof Blockly.FieldDropdown && !field.getValue()) {
1216
+ text.push(emptyFieldPlaceholder);
1217
+ } else {
1218
+ text.push(field.getText());
1219
+ }
1220
+ }
1221
+ if (input.connection) {
1222
+ var child = input.connection.targetBlock();
1223
+ if (child) {
1224
+ text.push(child.toString(undefined, opt_emptyToken));
1225
+ } else {
1226
+ text.push(emptyFieldPlaceholder);
1227
+ }
1228
+ }
1229
+ }
1230
+ }
1231
+ text = goog.string.trim(text.join(' ')) || '???';
1232
+ if (opt_maxLength) {
1233
+ // TODO: Improve truncation so that text from this block is given priority.
1234
+ // E.g. "1+2+3+4+5+6+7+8+9=0" should be "...6+7+8+9=0", not "1+2+3+4+5...".
1235
+ // E.g. "1+2+3+4+5=6+7+8+9+0" should be "...4+5=6+7...".
1236
+ text = goog.string.truncate(text, opt_maxLength);
1237
+ }
1238
+ return text;
1239
+ };
1240
+
1241
+ /**
1242
+ * Shortcut for appending a value input row.
1243
+ * @param {string} name Language-neutral identifier which may used to find this
1244
+ * input again. Should be unique to this block.
1245
+ * @return {!Blockly.Input} The input object created.
1246
+ */
1247
+ Blockly.Block.prototype.appendValueInput = function(name) {
1248
+ return this.appendInput_(Blockly.INPUT_VALUE, name);
1249
+ };
1250
+
1251
+ /**
1252
+ * Shortcut for appending a statement input row.
1253
+ * @param {string} name Language-neutral identifier which may used to find this
1254
+ * input again. Should be unique to this block.
1255
+ * @return {!Blockly.Input} The input object created.
1256
+ */
1257
+ Blockly.Block.prototype.appendStatementInput = function(name) {
1258
+ return this.appendInput_(Blockly.NEXT_STATEMENT, name);
1259
+ };
1260
+
1261
+ /**
1262
+ * Shortcut for appending a dummy input row.
1263
+ * @param {string=} opt_name Language-neutral identifier which may used to find
1264
+ * this input again. Should be unique to this block.
1265
+ * @return {!Blockly.Input} The input object created.
1266
+ */
1267
+ Blockly.Block.prototype.appendDummyInput = function(opt_name) {
1268
+ return this.appendInput_(Blockly.DUMMY_INPUT, opt_name || '');
1269
+ };
1270
+
1271
+ /**
1272
+ * Initialize this block using a cross-platform, internationalization-friendly
1273
+ * JSON description.
1274
+ * @param {!Object} json Structured data describing the block.
1275
+ */
1276
+ Blockly.Block.prototype.jsonInit = function(json) {
1277
+ var warningPrefix = json['type'] ? 'Block "' + json['type'] + '": ' : '';
1278
+
1279
+ // Validate inputs.
1280
+ goog.asserts.assert(
1281
+ json['output'] == undefined || json['previousStatement'] == undefined,
1282
+ warningPrefix + 'Must not have both an output and a previousStatement.');
1283
+
1284
+ // Set basic properties of block.
1285
+ if (json['colour'] !== undefined) {
1286
+ this.setColourFromJson_(json);
1287
+ }
1288
+
1289
+ // Interpolate the message blocks.
1290
+ var i = 0;
1291
+ while (json['message' + i] !== undefined) {
1292
+ this.interpolate_(json['message' + i], json['args' + i] || [],
1293
+ json['lastDummyAlign' + i]);
1294
+ i++;
1295
+ }
1296
+
1297
+ if (json['inputsInline'] !== undefined) {
1298
+ this.setInputsInline(json['inputsInline']);
1299
+ }
1300
+ // Set output and previous/next connections.
1301
+ if (json['output'] !== undefined) {
1302
+ this.setOutput(true, json['output']);
1303
+ }
1304
+ if (json['previousStatement'] !== undefined) {
1305
+ this.setPreviousStatement(true, json['previousStatement']);
1306
+ }
1307
+ if (json['nextStatement'] !== undefined) {
1308
+ this.setNextStatement(true, json['nextStatement']);
1309
+ }
1310
+ if (json['tooltip'] !== undefined) {
1311
+ var rawValue = json['tooltip'];
1312
+ var localizedText = Blockly.utils.replaceMessageReferences(rawValue);
1313
+ this.setTooltip(localizedText);
1314
+ }
1315
+ if (json['enableContextMenu'] !== undefined) {
1316
+ var rawValue = json['enableContextMenu'];
1317
+ this.contextMenu = !!rawValue;
1318
+ }
1319
+ if (json['helpUrl'] !== undefined) {
1320
+ var rawValue = json['helpUrl'];
1321
+ var localizedValue = Blockly.utils.replaceMessageReferences(rawValue);
1322
+ this.setHelpUrl(localizedValue);
1323
+ }
1324
+ if (goog.isString(json['extensions'])) {
1325
+ console.warn('JSON attribute \'extensions\' should be an array of ' +
1326
+ 'strings. Found raw string in JSON for \'' + json['type'] + '\' block.');
1327
+ json['extensions'] = [json['extensions']]; // Correct and continue.
1328
+ }
1329
+
1330
+ // Add the mutator to the block
1331
+ if (json['mutator'] !== undefined) {
1332
+ Blockly.Extensions.apply(json['mutator'], this, true);
1333
+ }
1334
+
1335
+ if (Array.isArray(json['extensions'])) {
1336
+ var extensionNames = json['extensions'];
1337
+ for (var i = 0; i < extensionNames.length; ++i) {
1338
+ var extensionName = extensionNames[i];
1339
+ Blockly.Extensions.apply(extensionName, this, false);
1340
+ }
1341
+ }
1342
+ if (json['outputShape'] !== undefined) {
1343
+ this.setOutputShape(json['outputShape']);
1344
+ }
1345
+ if (json['checkboxInFlyout'] !== undefined) {
1346
+ this.setCheckboxInFlyout(json['checkboxInFlyout']);
1347
+ }
1348
+ if (json['category'] !== undefined) {
1349
+ this.setCategory(json['category']);
1350
+ }
1351
+ };
1352
+
1353
+ /**
1354
+ * Add key/values from mixinObj to this block object. By default, this method
1355
+ * will check that the keys in mixinObj will not overwrite existing values in
1356
+ * the block, including prototype values. This provides some insurance against
1357
+ * mixin / extension incompatibilities with future block features. This check
1358
+ * can be disabled by passing true as the second argument.
1359
+ * @param {!Object} mixinObj The key/values pairs to add to this block object.
1360
+ * @param {boolean=} opt_disableCheck Option flag to disable overwrite checks.
1361
+ */
1362
+ Blockly.Block.prototype.mixin = function(mixinObj, opt_disableCheck) {
1363
+ if (goog.isDef(opt_disableCheck) && !goog.isBoolean(opt_disableCheck)) {
1364
+ throw new Error("opt_disableCheck must be a boolean if provided");
1365
+ }
1366
+ if (!opt_disableCheck) {
1367
+ var overwrites = [];
1368
+ for (var key in mixinObj) {
1369
+ if (this[key] !== undefined) {
1370
+ overwrites.push(key);
1371
+ }
1372
+ }
1373
+ if (overwrites.length) {
1374
+ throw new Error('Mixin will overwrite block members: ' +
1375
+ JSON.stringify(overwrites));
1376
+ }
1377
+ }
1378
+ goog.mixin(this, mixinObj);
1379
+ };
1380
+
1381
+ /**
1382
+ * Set the colour of the block from strings or string table references.
1383
+ * @param {string|?} primary Primary colour, which may be a string that contains
1384
+ * string table references.
1385
+ * @param {string|?} secondary Secondary colour, which may be a string that
1386
+ * contains string table references.
1387
+ * @param {string|?} tertiary Tertiary colour, which may be a string that
1388
+ * contains string table references.
1389
+ * @param {string|?} quaternary Quaternary colour, which may be a string that
1390
+ * contains string table references.
1391
+ * @private
1392
+ */
1393
+ Blockly.Block.prototype.setColourFromRawValues_ = function(primary, secondary,
1394
+ tertiary, quaternary) {
1395
+ primary = goog.isString(primary) ?
1396
+ Blockly.utils.replaceMessageReferences(primary) : primary;
1397
+ secondary = goog.isString(secondary) ?
1398
+ Blockly.utils.replaceMessageReferences(secondary) : secondary;
1399
+ tertiary = goog.isString(tertiary) ?
1400
+ Blockly.utils.replaceMessageReferences(tertiary) : tertiary;
1401
+ quaternary = goog.isString(quaternary) ?
1402
+ Blockly.utils.replaceMessageReferences(quaternary) : quaternary;
1403
+
1404
+ this.setColour(primary, secondary, tertiary, quaternary);
1405
+ };
1406
+
1407
+ /**
1408
+ * Set the colour of the block from JSON, replacing message references as
1409
+ * needed.
1410
+ * @param {!Object} json Structured data describing the block.
1411
+ * @private
1412
+ */
1413
+ Blockly.Block.prototype.setColourFromJson_ = function(json) {
1414
+ this.setColourFromRawValues_(json['colour'], json['colourSecondary'],
1415
+ json['colourTertiary'], json['colourQuaternary']);
1416
+ };
1417
+
1418
+ /**
1419
+ * Interpolate a message description onto the block.
1420
+ * @param {string} message Text contains interpolation tokens (%1, %2, ...)
1421
+ * that match with fields or inputs defined in the args array.
1422
+ * @param {!Array} args Array of arguments to be interpolated.
1423
+ * @param {string=} lastDummyAlign If a dummy input is added at the end,
1424
+ * how should it be aligned?
1425
+ * @private
1426
+ */
1427
+ Blockly.Block.prototype.interpolate_ = function(message, args, lastDummyAlign) {
1428
+ var tokens = Blockly.utils.tokenizeInterpolation(message);
1429
+ // Interpolate the arguments. Build a list of elements.
1430
+ var indexDup = [];
1431
+ var indexCount = 0;
1432
+ var elements = [];
1433
+ for (var i = 0; i < tokens.length; i++) {
1434
+ var token = tokens[i];
1435
+ if (typeof token == 'number') {
1436
+ if (token <= 0 || token > args.length) {
1437
+ throw new Error('Block "' + this.type + '": ' +
1438
+ 'Message index %' + token + ' out of range.');
1439
+ }
1440
+ if (indexDup[token]) {
1441
+ throw new Error('Block "' + this.type + '": ' +
1442
+ 'Message index %' + token + ' duplicated.');
1443
+ }
1444
+ indexDup[token] = true;
1445
+ indexCount++;
1446
+ elements.push(args[token - 1]);
1447
+ } else {
1448
+ token = token.trim();
1449
+ if (token) {
1450
+ elements.push(token);
1451
+ }
1452
+ }
1453
+ }
1454
+ if (indexCount != args.length) {
1455
+ throw new Error('Block "' + this.type + '": ' +
1456
+ 'Message does not reference all ' + args.length + ' arg(s).');
1457
+ }
1458
+ // Add last dummy input if needed.
1459
+ if (elements.length && (typeof elements[elements.length - 1] == 'string' ||
1460
+ goog.string.startsWith(
1461
+ elements[elements.length - 1]['type'], 'field_'))) {
1462
+ var dummyInput = {type: 'input_dummy'};
1463
+ if (lastDummyAlign) {
1464
+ dummyInput['align'] = lastDummyAlign;
1465
+ }
1466
+ elements.push(dummyInput);
1467
+ }
1468
+ // Lookup of alignment constants.
1469
+ var alignmentLookup = {
1470
+ 'LEFT': Blockly.ALIGN_LEFT,
1471
+ 'RIGHT': Blockly.ALIGN_RIGHT,
1472
+ 'CENTRE': Blockly.ALIGN_CENTRE
1473
+ };
1474
+ // Populate block with inputs and fields.
1475
+ var fieldStack = [];
1476
+ for (var i = 0; i < elements.length; i++) {
1477
+ var element = elements[i];
1478
+ if (typeof element == 'string') {
1479
+ fieldStack.push([element, undefined]);
1480
+ } else {
1481
+ var field = null;
1482
+ var input = null;
1483
+ do {
1484
+ var altRepeat = false;
1485
+ if (typeof element == 'string') {
1486
+ field = new Blockly.FieldLabel(element);
1487
+ } else {
1488
+ switch (element['type']) {
1489
+ case 'input_value':
1490
+ input = this.appendValueInput(element['name']);
1491
+ break;
1492
+ case 'input_statement':
1493
+ input = this.appendStatementInput(element['name']);
1494
+ break;
1495
+ case 'input_dummy':
1496
+ input = this.appendDummyInput(element['name']);
1497
+ break;
1498
+ default:
1499
+ field = Blockly.Field.fromJson(element);
1500
+
1501
+ // Unknown field.
1502
+ if (!field) {
1503
+ if (element['alt']) {
1504
+ element = element['alt'];
1505
+ altRepeat = true;
1506
+ } else {
1507
+ console.warn('Blockly could not create a field of type ' +
1508
+ element['type'] +
1509
+ '. You may need to register your custom field. See ' +
1510
+ 'github.com/google/blockly/issues/1584');
1511
+ }
1512
+ }
1513
+ }
1514
+ }
1515
+ } while (altRepeat);
1516
+ if (field) {
1517
+ fieldStack.push([field, element['name']]);
1518
+ } else if (input) {
1519
+ if (element['check']) {
1520
+ input.setCheck(element['check']);
1521
+ }
1522
+ if (element['align']) {
1523
+ input.setAlign(alignmentLookup[element['align']]);
1524
+ }
1525
+ for (var j = 0; j < fieldStack.length; j++) {
1526
+ input.appendField(fieldStack[j][0], fieldStack[j][1]);
1527
+ }
1528
+ fieldStack.length = 0;
1529
+ }
1530
+ }
1531
+ }
1532
+ };
1533
+
1534
+ /**
1535
+ * Add a value input, statement input or local variable to this block.
1536
+ * @param {number} type Either Blockly.INPUT_VALUE or Blockly.NEXT_STATEMENT or
1537
+ * Blockly.DUMMY_INPUT.
1538
+ * @param {string} name Language-neutral identifier which may used to find this
1539
+ * input again. Should be unique to this block.
1540
+ * @return {!Blockly.Input} The input object created.
1541
+ * @protected
1542
+ */
1543
+ Blockly.Block.prototype.appendInput_ = function(type, name) {
1544
+ var connection = null;
1545
+ if (type == Blockly.INPUT_VALUE || type == Blockly.NEXT_STATEMENT) {
1546
+ connection = this.makeConnection_(type);
1547
+ }
1548
+ var input = new Blockly.Input(type, name, this, connection);
1549
+ // Append input to list.
1550
+ this.inputList.push(input);
1551
+ return input;
1552
+ };
1553
+
1554
+ /**
1555
+ * Move a named input to a different location on this block.
1556
+ * @param {string} name The name of the input to move.
1557
+ * @param {?string} refName Name of input that should be after the moved input,
1558
+ * or null to be the input at the end.
1559
+ */
1560
+ Blockly.Block.prototype.moveInputBefore = function(name, refName) {
1561
+ if (name == refName) {
1562
+ return;
1563
+ }
1564
+ // Find both inputs.
1565
+ var inputIndex = -1;
1566
+ var refIndex = refName ? -1 : this.inputList.length;
1567
+ for (var i = 0, input; input = this.inputList[i]; i++) {
1568
+ if (input.name == name) {
1569
+ inputIndex = i;
1570
+ if (refIndex != -1) {
1571
+ break;
1572
+ }
1573
+ } else if (refName && input.name == refName) {
1574
+ refIndex = i;
1575
+ if (inputIndex != -1) {
1576
+ break;
1577
+ }
1578
+ }
1579
+ }
1580
+ goog.asserts.assert(inputIndex != -1, 'Named input "%s" not found.', name);
1581
+ goog.asserts.assert(
1582
+ refIndex != -1, 'Reference input "%s" not found.', refName);
1583
+ this.moveNumberedInputBefore(inputIndex, refIndex);
1584
+ };
1585
+
1586
+ /**
1587
+ * Move a numbered input to a different location on this block.
1588
+ * @param {number} inputIndex Index of the input to move.
1589
+ * @param {number} refIndex Index of input that should be after the moved input.
1590
+ */
1591
+ Blockly.Block.prototype.moveNumberedInputBefore = function(
1592
+ inputIndex, refIndex) {
1593
+ // Validate arguments.
1594
+ goog.asserts.assert(inputIndex != refIndex, 'Can\'t move input to itself.');
1595
+ goog.asserts.assert(inputIndex < this.inputList.length,
1596
+ 'Input index ' + inputIndex + ' out of bounds.');
1597
+ goog.asserts.assert(refIndex <= this.inputList.length,
1598
+ 'Reference input ' + refIndex + ' out of bounds.');
1599
+ // Remove input.
1600
+ var input = this.inputList[inputIndex];
1601
+ this.inputList.splice(inputIndex, 1);
1602
+ if (inputIndex < refIndex) {
1603
+ refIndex--;
1604
+ }
1605
+ // Reinsert input.
1606
+ this.inputList.splice(refIndex, 0, input);
1607
+ };
1608
+
1609
+ /**
1610
+ * Remove an input from this block.
1611
+ * @param {string} name The name of the input.
1612
+ * @param {boolean=} opt_quiet True to prevent error if input is not present.
1613
+ * @throws {goog.asserts.AssertionError} if the input is not present and
1614
+ * opt_quiet is not true.
1615
+ */
1616
+ Blockly.Block.prototype.removeInput = function(name, opt_quiet) {
1617
+ for (var i = 0, input; input = this.inputList[i]; i++) {
1618
+ if (input.name == name) {
1619
+ if (input.connection && input.connection.isConnected()) {
1620
+ input.connection.setShadowDom(null);
1621
+ var block = input.connection.targetBlock();
1622
+ if (block.isShadow()) {
1623
+ // Destroy any attached shadow block.
1624
+ block.dispose();
1625
+ } else {
1626
+ // Disconnect any attached normal block.
1627
+ block.unplug();
1628
+ }
1629
+ }
1630
+ input.dispose();
1631
+ this.inputList.splice(i, 1);
1632
+ return;
1633
+ }
1634
+ }
1635
+ if (!opt_quiet) {
1636
+ goog.asserts.fail('Input "%s" not found.', name);
1637
+ }
1638
+ };
1639
+
1640
+ /**
1641
+ * Fetches the named input object.
1642
+ * @param {string} name The name of the input.
1643
+ * @return {Blockly.Input} The input object, or null if input does not exist.
1644
+ */
1645
+ Blockly.Block.prototype.getInput = function(name) {
1646
+ for (var i = 0, input; input = this.inputList[i]; i++) {
1647
+ if (input.name == name) {
1648
+ return input;
1649
+ }
1650
+ }
1651
+ // This input does not exist.
1652
+ return null;
1653
+ };
1654
+
1655
+ /**
1656
+ * Fetches the block attached to the named input.
1657
+ * @param {string} name The name of the input.
1658
+ * @return {Blockly.Block} The attached value block, or null if the input is
1659
+ * either disconnected or if the input does not exist.
1660
+ */
1661
+ Blockly.Block.prototype.getInputTargetBlock = function(name) {
1662
+ var input = this.getInput(name);
1663
+ return input && input.connection && input.connection.targetBlock();
1664
+ };
1665
+
1666
+ /**
1667
+ * Returns the comment on this block (or '' if none).
1668
+ * @return {string} Block's comment.
1669
+ */
1670
+ Blockly.Block.prototype.getCommentText = function() {
1671
+ return this.comment || '';
1672
+ };
1673
+
1674
+ /**
1675
+ * Set this block's comment text.
1676
+ * @param {?string} text The text, or null to delete.
1677
+ */
1678
+ Blockly.Block.prototype.setCommentText = function(text) {
1679
+ if (this.comment != text) {
1680
+ Blockly.Events.fire(new Blockly.Events.BlockChange(
1681
+ this, 'comment', null, this.comment, text || ''));
1682
+ this.comment = text;
1683
+ }
1684
+ };
1685
+
1686
+ /**
1687
+ * Set this block's output shape.
1688
+ * e.g., null, OUTPUT_SHAPE_HEXAGONAL, OUTPUT_SHAPE_ROUND, OUTPUT_SHAPE_SQUARE.
1689
+ * @param {?number} outputShape Value representing output shape
1690
+ * (see constants.js).
1691
+ */
1692
+ Blockly.Block.prototype.setOutputShape = function(outputShape) {
1693
+ this.outputShape_ = outputShape;
1694
+ };
1695
+
1696
+ /**
1697
+ * Get this block's output shape.
1698
+ * @return {?number} Value representing output shape (see constants.js).
1699
+ */
1700
+ Blockly.Block.prototype.getOutputShape = function() {
1701
+ return this.outputShape_;
1702
+ };
1703
+
1704
+ /**
1705
+ * Set this block's category (for styling purposes)
1706
+ * @param {?string} category The block's category (see constants.js).
1707
+ */
1708
+ Blockly.Block.prototype.setCategory = function(category) {
1709
+ this.category_ = category;
1710
+ };
1711
+
1712
+ /**
1713
+ * Get this block's category (for styling purposes)
1714
+ * @return {?string} category The block's category (see constants.js).
1715
+ */
1716
+ Blockly.Block.prototype.getCategory = function() {
1717
+ return this.category_;
1718
+ };
1719
+
1720
+ /**
1721
+ * Set whether this block has a checkbox next to it in the flyout.
1722
+ * @param {boolean} hasCheckbox True if this block should have a checkbox.
1723
+ */
1724
+ Blockly.Block.prototype.setCheckboxInFlyout = function(hasCheckbox) {
1725
+ this.checkboxInFlyout_ = hasCheckbox;
1726
+ };
1727
+
1728
+ /**
1729
+ * Get whether this block has a checkbox next to it in the flyout.
1730
+ * @return {boolean} True if this block should have a checkbox.
1731
+ */
1732
+ Blockly.Block.prototype.hasCheckboxInFlyout = function() {
1733
+ return this.checkboxInFlyout_;
1734
+ };
1735
+
1736
+ /**
1737
+ * Set this block's warning text.
1738
+ * @param {?string} text The text, or null to delete.
1739
+ * @abstract
1740
+ */
1741
+ Blockly.Block.prototype.setWarningText = function(/* text */) {
1742
+ // NOP.
1743
+ };
1744
+
1745
+ /**
1746
+ * Give this block a mutator dialog.
1747
+ * @param {Blockly.Mutator} mutator A mutator dialog instance or null to remove.
1748
+ * @abstract
1749
+ */
1750
+ Blockly.Block.prototype.setMutator = function(/* mutator */) {
1751
+ // NOP.
1752
+ };
1753
+
1754
+ /**
1755
+ * Return the coordinates of the top-left corner of this block relative to the
1756
+ * drawing surface's origin (0,0), in workspace units.
1757
+ * @return {!goog.math.Coordinate} Object with .x and .y properties.
1758
+ */
1759
+ Blockly.Block.prototype.getRelativeToSurfaceXY = function() {
1760
+ return this.xy_;
1761
+ };
1762
+
1763
+ /**
1764
+ * Move a block by a relative offset.
1765
+ * @param {number} dx Horizontal offset, in workspace units.
1766
+ * @param {number} dy Vertical offset, in workspace units.
1767
+ */
1768
+ Blockly.Block.prototype.moveBy = function(dx, dy) {
1769
+ goog.asserts.assert(!this.parentBlock_, 'Block has parent.');
1770
+ var event = new Blockly.Events.BlockMove(this);
1771
+ this.xy_.translate(dx, dy);
1772
+ event.recordNew();
1773
+ Blockly.Events.fire(event);
1774
+ };
1775
+
1776
+ /**
1777
+ * Create a connection of the specified type.
1778
+ * @param {number} type The type of the connection to create.
1779
+ * @return {!Blockly.Connection} A new connection of the specified type.
1780
+ * @private
1781
+ */
1782
+ Blockly.Block.prototype.makeConnection_ = function(type) {
1783
+ return new Blockly.Connection(this, type);
1784
+ };
1785
+
1786
+ /**
1787
+ * Recursively checks whether all statement and value inputs are filled with
1788
+ * blocks. Also checks all following statement blocks in this stack.
1789
+ * @param {boolean=} opt_shadowBlocksAreFilled An optional argument controlling
1790
+ * whether shadow blocks are counted as filled. Defaults to true.
1791
+ * @return {boolean} True if all inputs are filled, false otherwise.
1792
+ */
1793
+ Blockly.Block.prototype.allInputsFilled = function(opt_shadowBlocksAreFilled) {
1794
+ // Account for the shadow block filledness toggle.
1795
+ if (opt_shadowBlocksAreFilled === undefined) {
1796
+ opt_shadowBlocksAreFilled = true;
1797
+ }
1798
+ if (!opt_shadowBlocksAreFilled && this.isShadow()) {
1799
+ return false;
1800
+ }
1801
+
1802
+ // Recursively check each input block of the current block.
1803
+ for (var i = 0, input; input = this.inputList[i]; i++) {
1804
+ if (!input.connection) {
1805
+ continue;
1806
+ }
1807
+ var target = input.connection.targetBlock();
1808
+ if (!target || !target.allInputsFilled(opt_shadowBlocksAreFilled)) {
1809
+ return false;
1810
+ }
1811
+ }
1812
+
1813
+ // Recursively check the next block after the current block.
1814
+ var next = this.getNextBlock();
1815
+ if (next) {
1816
+ return next.allInputsFilled(opt_shadowBlocksAreFilled);
1817
+ }
1818
+
1819
+ return true;
1820
+ };
1821
+
1822
+ /**
1823
+ * This method returns a string describing this Block in developer terms (type
1824
+ * name and ID; English only).
1825
+ *
1826
+ * Intended to on be used in console logs and errors. If you need a string that
1827
+ * uses the user's native language (including block text, field values, and
1828
+ * child blocks), use [toString()]{@link Blockly.Block#toString}.
1829
+ * @return {string} The description.
1830
+ */
1831
+ Blockly.Block.prototype.toDevString = function() {
1832
+ var msg = this.type ? '"' + this.type + '" block' : 'Block';
1833
+ if (this.id) {
1834
+ msg += ' (id="' + this.id + '")';
1835
+ }
1836
+ return msg;
1837
+ };