nodeskini 1.0.1 → 1.0.3

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 (534) hide show
  1. package/blocklySkini/archive/blocklyControleur.js +87 -0
  2. package/blocklySkini/archive/blocklySkini.js +84 -0
  3. package/blocklySkini/archive/blocklyhop.js +75 -0
  4. package/blocklySkini/archive/clientControleurBlocly.js +170 -0
  5. package/blocklySkini/archive/index.html +76 -0
  6. package/blocklySkini/archive/testHHsuspend.txt +89 -0
  7. package/blocklySkini/archive/testHHtrap.txt +262 -0
  8. package/blocklySkini/archive/testOrchestration.txt +177 -0
  9. package/blocklySkini/archive/testOrchestration.xml +447 -0
  10. package/blocklySkini/archive/testOrchestration2.xml +456 -0
  11. package/blocklySkini/blockly/README.md +77 -0
  12. package/blocklySkini/blockly/blockly.d.ts +21480 -0
  13. package/blocklySkini/blockly/blockly.js +25 -0
  14. package/blocklySkini/blockly/blockly.min.js +2188 -0
  15. package/blocklySkini/blockly/blockly_compressed.js +1455 -0
  16. package/blocklySkini/blockly/blockly_compressed.js.map +1 -0
  17. package/blocklySkini/blockly/blocks/colour.js +122 -0
  18. package/blocklySkini/blockly/blocks/lists.js +862 -0
  19. package/blocklySkini/blockly/blocks/logic.js +635 -0
  20. package/blocklySkini/blockly/blocks/loops.js +357 -0
  21. package/blocklySkini/blockly/blocks/math.js +566 -0
  22. package/blocklySkini/blockly/blocks/procedures.js +1072 -0
  23. package/blocklySkini/blockly/blocks/text.js +923 -0
  24. package/blocklySkini/blockly/blocks/variables.js +163 -0
  25. package/blocklySkini/blockly/blocks/variables_dynamic.js +180 -0
  26. package/blocklySkini/blockly/blocks.d.ts +15 -0
  27. package/blocklySkini/blockly/blocks.js +27 -0
  28. package/blocklySkini/blockly/blocks_compressed.js +182 -0
  29. package/blocklySkini/blockly/blocks_compressed.js.map +1 -0
  30. package/blocklySkini/blockly/browser.js +36 -0
  31. package/blocklySkini/blockly/core/block.js +2010 -0
  32. package/blocklySkini/blockly/core/block_animations.js +203 -0
  33. package/blocklySkini/blockly/core/block_drag_surface.js +212 -0
  34. package/blocklySkini/blockly/core/block_dragger.js +378 -0
  35. package/blocklySkini/blockly/core/block_events.js +548 -0
  36. package/blocklySkini/blockly/core/block_svg.js +1763 -0
  37. package/blocklySkini/blockly/core/blockly.js +674 -0
  38. package/blocklySkini/blockly/core/blocks.js +23 -0
  39. package/blocklySkini/blockly/core/bubble.js +880 -0
  40. package/blocklySkini/blockly/core/bubble_dragger.js +274 -0
  41. package/blocklySkini/blockly/core/comment.js +439 -0
  42. package/blocklySkini/blockly/core/components/component.js +554 -0
  43. package/blocklySkini/blockly/core/components/tree/basenode.js +895 -0
  44. package/blocklySkini/blockly/core/components/tree/treecontrol.js +332 -0
  45. package/blocklySkini/blockly/core/components/tree/treenode.js +172 -0
  46. package/blocklySkini/blockly/core/connection.js +682 -0
  47. package/blocklySkini/blockly/core/connection_checker.js +285 -0
  48. package/blocklySkini/blockly/core/connection_db.js +295 -0
  49. package/blocklySkini/blockly/core/constants.js +277 -0
  50. package/blocklySkini/blockly/core/contextmenu.js +307 -0
  51. package/blocklySkini/blockly/core/contextmenu_items.js +534 -0
  52. package/blocklySkini/blockly/core/contextmenu_registry.js +165 -0
  53. package/blocklySkini/blockly/core/css.js +549 -0
  54. package/blocklySkini/blockly/core/dropdowndiv.js +776 -0
  55. package/blocklySkini/blockly/core/events.js +387 -0
  56. package/blocklySkini/blockly/core/events_abstract.js +106 -0
  57. package/blocklySkini/blockly/core/extensions.js +450 -0
  58. package/blocklySkini/blockly/core/field.js +1162 -0
  59. package/blocklySkini/blockly/core/field_angle.js +562 -0
  60. package/blocklySkini/blockly/core/field_checkbox.js +220 -0
  61. package/blocklySkini/blockly/core/field_colour.js +664 -0
  62. package/blocklySkini/blockly/core/field_dropdown.js +760 -0
  63. package/blocklySkini/blockly/core/field_image.js +286 -0
  64. package/blocklySkini/blockly/core/field_label.js +130 -0
  65. package/blocklySkini/blockly/core/field_label_serializable.js +69 -0
  66. package/blocklySkini/blockly/core/field_multilineinput.js +299 -0
  67. package/blocklySkini/blockly/core/field_number.js +317 -0
  68. package/blocklySkini/blockly/core/field_registry.js +66 -0
  69. package/blocklySkini/blockly/core/field_textinput.js +616 -0
  70. package/blocklySkini/blockly/core/field_variable.js +463 -0
  71. package/blocklySkini/blockly/core/flyout_base.js +1071 -0
  72. package/blocklySkini/blockly/core/flyout_button.js +325 -0
  73. package/blocklySkini/blockly/core/flyout_dragger.js +76 -0
  74. package/blocklySkini/blockly/core/flyout_horizontal.js +388 -0
  75. package/blocklySkini/blockly/core/flyout_vertical.js +397 -0
  76. package/blocklySkini/blockly/core/generator.js +482 -0
  77. package/blocklySkini/blockly/core/gesture.js +993 -0
  78. package/blocklySkini/blockly/core/grid.js +222 -0
  79. package/blocklySkini/blockly/core/icon.js +206 -0
  80. package/blocklySkini/blockly/core/inject.js +487 -0
  81. package/blocklySkini/blockly/core/input.js +296 -0
  82. package/blocklySkini/blockly/core/insertion_marker_manager.js +700 -0
  83. package/blocklySkini/blockly/core/interfaces/i_accessibility.js +72 -0
  84. package/blocklySkini/blockly/core/interfaces/i_bounded_element.js +31 -0
  85. package/blocklySkini/blockly/core/interfaces/i_bubble.js +83 -0
  86. package/blocklySkini/blockly/core/interfaces/i_connection_checker.js +94 -0
  87. package/blocklySkini/blockly/core/interfaces/i_contextmenu.js +26 -0
  88. package/blocklySkini/blockly/core/interfaces/i_copyable.js +40 -0
  89. package/blocklySkini/blockly/core/interfaces/i_deletable.js +27 -0
  90. package/blocklySkini/blockly/core/interfaces/i_deletearea.js +28 -0
  91. package/blocklySkini/blockly/core/interfaces/i_flyout.js +178 -0
  92. package/blocklySkini/blockly/core/interfaces/i_movable.js +27 -0
  93. package/blocklySkini/blockly/core/interfaces/i_registrable.js +22 -0
  94. package/blocklySkini/blockly/core/interfaces/i_registrable_field.js +31 -0
  95. package/blocklySkini/blockly/core/interfaces/i_selectable.js +43 -0
  96. package/blocklySkini/blockly/core/interfaces/i_styleable.js +33 -0
  97. package/blocklySkini/blockly/core/interfaces/i_toolbox.js +131 -0
  98. package/blocklySkini/blockly/core/interfaces/i_toolbox_item.js +148 -0
  99. package/blocklySkini/blockly/core/keyboard_nav/action.js +26 -0
  100. package/blocklySkini/blockly/core/keyboard_nav/ast_node.js +684 -0
  101. package/blocklySkini/blockly/core/keyboard_nav/basic_cursor.js +208 -0
  102. package/blocklySkini/blockly/core/keyboard_nav/cursor.js +170 -0
  103. package/blocklySkini/blockly/core/keyboard_nav/flyout_cursor.js +106 -0
  104. package/blocklySkini/blockly/core/keyboard_nav/key_map.js +190 -0
  105. package/blocklySkini/blockly/core/keyboard_nav/marker.js +120 -0
  106. package/blocklySkini/blockly/core/keyboard_nav/navigation.js +1084 -0
  107. package/blocklySkini/blockly/core/keyboard_nav/tab_navigate_cursor.js +48 -0
  108. package/blocklySkini/blockly/core/marker_manager.js +183 -0
  109. package/blocklySkini/blockly/core/menu.js +465 -0
  110. package/blocklySkini/blockly/core/menuitem.js +280 -0
  111. package/blocklySkini/blockly/core/msg.js +31 -0
  112. package/blocklySkini/blockly/core/mutator.js +555 -0
  113. package/blocklySkini/blockly/core/names.js +186 -0
  114. package/blocklySkini/blockly/core/options.js +365 -0
  115. package/blocklySkini/blockly/core/procedures.js +404 -0
  116. package/blocklySkini/blockly/core/registry.js +265 -0
  117. package/blocklySkini/blockly/core/rendered_connection.js +565 -0
  118. package/blocklySkini/blockly/core/renderers/common/block_rendering.js +81 -0
  119. package/blocklySkini/blockly/core/renderers/common/constants.js +1256 -0
  120. package/blocklySkini/blockly/core/renderers/common/debugger.js +431 -0
  121. package/blocklySkini/blockly/core/renderers/common/drawer.js +468 -0
  122. package/blocklySkini/blockly/core/renderers/common/i_path_object.js +151 -0
  123. package/blocklySkini/blockly/core/renderers/common/info.js +775 -0
  124. package/blocklySkini/blockly/core/renderers/common/marker_svg.js +687 -0
  125. package/blocklySkini/blockly/core/renderers/common/path_object.js +279 -0
  126. package/blocklySkini/blockly/core/renderers/common/renderer.js +301 -0
  127. package/blocklySkini/blockly/core/renderers/geras/constants.js +64 -0
  128. package/blocklySkini/blockly/core/renderers/geras/drawer.js +205 -0
  129. package/blocklySkini/blockly/core/renderers/geras/highlight_constants.js +311 -0
  130. package/blocklySkini/blockly/core/renderers/geras/highlighter.js +256 -0
  131. package/blocklySkini/blockly/core/renderers/geras/info.js +483 -0
  132. package/blocklySkini/blockly/core/renderers/geras/measurables/inputs.js +67 -0
  133. package/blocklySkini/blockly/core/renderers/geras/path_object.js +177 -0
  134. package/blocklySkini/blockly/core/renderers/geras/renderer.js +138 -0
  135. package/blocklySkini/blockly/core/renderers/measurables/base.js +44 -0
  136. package/blocklySkini/blockly/core/renderers/measurables/connections.js +114 -0
  137. package/blocklySkini/blockly/core/renderers/measurables/inputs.js +160 -0
  138. package/blocklySkini/blockly/core/renderers/measurables/row_elements.js +185 -0
  139. package/blocklySkini/blockly/core/renderers/measurables/rows.js +532 -0
  140. package/blocklySkini/blockly/core/renderers/measurables/types.js +349 -0
  141. package/blocklySkini/blockly/core/renderers/minimalist/constants.js +29 -0
  142. package/blocklySkini/blockly/core/renderers/minimalist/drawer.js +32 -0
  143. package/blocklySkini/blockly/core/renderers/minimalist/info.js +45 -0
  144. package/blocklySkini/blockly/core/renderers/minimalist/renderer.js +70 -0
  145. package/blocklySkini/blockly/core/renderers/thrasos/info.js +338 -0
  146. package/blocklySkini/blockly/core/renderers/thrasos/renderer.js +45 -0
  147. package/blocklySkini/blockly/core/renderers/zelos/constants.js +1002 -0
  148. package/blocklySkini/blockly/core/renderers/zelos/drawer.js +233 -0
  149. package/blocklySkini/blockly/core/renderers/zelos/info.js +587 -0
  150. package/blocklySkini/blockly/core/renderers/zelos/marker_svg.js +148 -0
  151. package/blocklySkini/blockly/core/renderers/zelos/measurables/inputs.js +47 -0
  152. package/blocklySkini/blockly/core/renderers/zelos/measurables/row_elements.js +37 -0
  153. package/blocklySkini/blockly/core/renderers/zelos/measurables/rows.js +108 -0
  154. package/blocklySkini/blockly/core/renderers/zelos/path_object.js +244 -0
  155. package/blocklySkini/blockly/core/renderers/zelos/renderer.js +130 -0
  156. package/blocklySkini/blockly/core/requires.js +84 -0
  157. package/blocklySkini/blockly/core/scrollbar.js +880 -0
  158. package/blocklySkini/blockly/core/theme/classic.js +87 -0
  159. package/blocklySkini/blockly/core/theme/dark.js +33 -0
  160. package/blocklySkini/blockly/core/theme/deuteranopia.js +104 -0
  161. package/blocklySkini/blockly/core/theme/highcontrast.js +119 -0
  162. package/blocklySkini/blockly/core/theme/modern.js +108 -0
  163. package/blocklySkini/blockly/core/theme/tritanopia.js +103 -0
  164. package/blocklySkini/blockly/core/theme/zelos.js +106 -0
  165. package/blocklySkini/blockly/core/theme.js +236 -0
  166. package/blocklySkini/blockly/core/theme_manager.js +197 -0
  167. package/blocklySkini/blockly/core/toolbox/category.js +690 -0
  168. package/blocklySkini/blockly/core/toolbox/collapsible_category.js +294 -0
  169. package/blocklySkini/blockly/core/toolbox/separator.js +123 -0
  170. package/blocklySkini/blockly/core/toolbox/toolbox.js +984 -0
  171. package/blocklySkini/blockly/core/toolbox/toolbox_item.js +145 -0
  172. package/blocklySkini/blockly/core/toolbox.js +943 -0
  173. package/blocklySkini/blockly/core/tooltip.js +387 -0
  174. package/blocklySkini/blockly/core/touch.js +255 -0
  175. package/blocklySkini/blockly/core/touch_gesture.js +325 -0
  176. package/blocklySkini/blockly/core/trashcan.js +661 -0
  177. package/blocklySkini/blockly/core/ui_events.js +85 -0
  178. package/blocklySkini/blockly/core/utils/aria.js +167 -0
  179. package/blocklySkini/blockly/core/utils/colour.js +208 -0
  180. package/blocklySkini/blockly/core/utils/coordinate.js +125 -0
  181. package/blocklySkini/blockly/core/utils/deprecation.js +34 -0
  182. package/blocklySkini/blockly/core/utils/dom.js +391 -0
  183. package/blocklySkini/blockly/core/utils/global.js +37 -0
  184. package/blocklySkini/blockly/core/utils/idgenerator.js +33 -0
  185. package/blocklySkini/blockly/core/utils/keycodes.js +164 -0
  186. package/blocklySkini/blockly/core/utils/math.js +56 -0
  187. package/blocklySkini/blockly/core/utils/metrics.js +124 -0
  188. package/blocklySkini/blockly/core/utils/object.js +73 -0
  189. package/blocklySkini/blockly/core/utils/rect.js +54 -0
  190. package/blocklySkini/blockly/core/utils/size.js +58 -0
  191. package/blocklySkini/blockly/core/utils/string.js +284 -0
  192. package/blocklySkini/blockly/core/utils/style.js +281 -0
  193. package/blocklySkini/blockly/core/utils/svg.js +181 -0
  194. package/blocklySkini/blockly/core/utils/svg_paths.js +142 -0
  195. package/blocklySkini/blockly/core/utils/toolbox.js +401 -0
  196. package/blocklySkini/blockly/core/utils/useragent.js +110 -0
  197. package/blocklySkini/blockly/core/utils/xml.js +79 -0
  198. package/blocklySkini/blockly/core/utils.js +652 -0
  199. package/blocklySkini/blockly/core/variable_events.js +248 -0
  200. package/blocklySkini/blockly/core/variable_map.js +414 -0
  201. package/blocklySkini/blockly/core/variable_model.js +95 -0
  202. package/blocklySkini/blockly/core/variables.js +571 -0
  203. package/blocklySkini/blockly/core/variables_dynamic.js +100 -0
  204. package/blocklySkini/blockly/core/warning.js +200 -0
  205. package/blocklySkini/blockly/core/widgetdiv.js +241 -0
  206. package/blocklySkini/blockly/core/workspace.js +786 -0
  207. package/blocklySkini/blockly/core/workspace_audio.js +153 -0
  208. package/blocklySkini/blockly/core/workspace_comment.js +373 -0
  209. package/blocklySkini/blockly/core/workspace_comment_render_svg.js +461 -0
  210. package/blocklySkini/blockly/core/workspace_comment_svg.js +701 -0
  211. package/blocklySkini/blockly/core/workspace_drag_surface_svg.js +176 -0
  212. package/blocklySkini/blockly/core/workspace_dragger.js +85 -0
  213. package/blocklySkini/blockly/core/workspace_events.js +93 -0
  214. package/blocklySkini/blockly/core/workspace_svg.js +2661 -0
  215. package/blocklySkini/blockly/core/ws_comment_events.js +417 -0
  216. package/blocklySkini/blockly/core/xml.js +827 -0
  217. package/blocklySkini/blockly/core/zoom_controls.js +449 -0
  218. package/blocklySkini/blockly/core-browser.js +34 -0
  219. package/blocklySkini/blockly/core.d.ts +15 -0
  220. package/blocklySkini/blockly/core.js +38 -0
  221. package/blocklySkini/blockly/dart.d.ts +15 -0
  222. package/blocklySkini/blockly/dart.js +27 -0
  223. package/blocklySkini/blockly/dart_compressed.js +114 -0
  224. package/blocklySkini/blockly/dart_compressed.js.map +1 -0
  225. package/blocklySkini/blockly/generators/dart/colour.js +114 -0
  226. package/blocklySkini/blockly/generators/dart/lists.js +447 -0
  227. package/blocklySkini/blockly/generators/dart/logic.js +127 -0
  228. package/blocklySkini/blockly/generators/dart/loops.js +169 -0
  229. package/blocklySkini/blockly/generators/dart/math.js +485 -0
  230. package/blocklySkini/blockly/generators/dart/procedures.js +111 -0
  231. package/blocklySkini/blockly/generators/dart/text.js +339 -0
  232. package/blocklySkini/blockly/generators/dart/variables.js +32 -0
  233. package/blocklySkini/blockly/generators/dart/variables_dynamic.js +21 -0
  234. package/blocklySkini/blockly/generators/dart.js +290 -0
  235. package/blocklySkini/blockly/generators/javascript/colour.js +89 -0
  236. package/blocklySkini/blockly/generators/javascript/lists.js +388 -0
  237. package/blocklySkini/blockly/generators/javascript/logic.js +129 -0
  238. package/blocklySkini/blockly/generators/javascript/loops.js +184 -0
  239. package/blocklySkini/blockly/generators/javascript/math.js +409 -0
  240. package/blocklySkini/blockly/generators/javascript/procedures.js +113 -0
  241. package/blocklySkini/blockly/generators/javascript/text.js +367 -0
  242. package/blocklySkini/blockly/generators/javascript/variables.js +32 -0
  243. package/blocklySkini/blockly/generators/javascript/variables_dynamic.js +23 -0
  244. package/blocklySkini/blockly/generators/javascript.js +317 -0
  245. package/blocklySkini/blockly/generators/lua/colour.js +76 -0
  246. package/blocklySkini/blockly/generators/lua/lists.js +368 -0
  247. package/blocklySkini/blockly/generators/lua/logic.js +127 -0
  248. package/blocklySkini/blockly/generators/lua/loops.js +173 -0
  249. package/blocklySkini/blockly/generators/lua/math.js +423 -0
  250. package/blocklySkini/blockly/generators/lua/procedures.js +113 -0
  251. package/blocklySkini/blockly/generators/lua/text.js +353 -0
  252. package/blocklySkini/blockly/generators/lua/variables.js +32 -0
  253. package/blocklySkini/blockly/generators/lua/variables_dynamic.js +21 -0
  254. package/blocklySkini/blockly/generators/lua.js +198 -0
  255. package/blocklySkini/blockly/generators/php/colour.js +91 -0
  256. package/blocklySkini/blockly/generators/php/lists.js +498 -0
  257. package/blocklySkini/blockly/generators/php/logic.js +128 -0
  258. package/blocklySkini/blockly/generators/php/loops.js +170 -0
  259. package/blocklySkini/blockly/generators/php/math.js +370 -0
  260. package/blocklySkini/blockly/generators/php/procedures.js +132 -0
  261. package/blocklySkini/blockly/generators/php/text.js +271 -0
  262. package/blocklySkini/blockly/generators/php/variables.js +32 -0
  263. package/blocklySkini/blockly/generators/php/variables_dynamic.js +21 -0
  264. package/blocklySkini/blockly/generators/php.js +318 -0
  265. package/blocklySkini/blockly/generators/python/colour.js +72 -0
  266. package/blocklySkini/blockly/generators/python/lists.js +349 -0
  267. package/blocklySkini/blockly/generators/python/logic.js +127 -0
  268. package/blocklySkini/blockly/generators/python/loops.js +214 -0
  269. package/blocklySkini/blockly/generators/python/math.js +385 -0
  270. package/blocklySkini/blockly/generators/python/procedures.js +134 -0
  271. package/blocklySkini/blockly/generators/python/text.js +293 -0
  272. package/blocklySkini/blockly/generators/python/variables.js +32 -0
  273. package/blocklySkini/blockly/generators/python/variables_dynamic.js +21 -0
  274. package/blocklySkini/blockly/generators/python.js +322 -0
  275. package/blocklySkini/blockly/index.d.ts +22 -0
  276. package/blocklySkini/blockly/index.js +24 -0
  277. package/blocklySkini/blockly/javascript.d.ts +15 -0
  278. package/blocklySkini/blockly/javascript.js +27 -0
  279. package/blocklySkini/blockly/javascript_compressed.js +115 -0
  280. package/blocklySkini/blockly/javascript_compressed.js.map +1 -0
  281. package/blocklySkini/blockly/lua.d.ts +15 -0
  282. package/blocklySkini/blockly/lua.js +27 -0
  283. package/blocklySkini/blockly/lua_compressed.js +94 -0
  284. package/blocklySkini/blockly/lua_compressed.js.map +1 -0
  285. package/blocklySkini/blockly/media/1x1.gif +0 -0
  286. package/blocklySkini/blockly/media/click.mp3 +0 -0
  287. package/blocklySkini/blockly/media/click.ogg +0 -0
  288. package/blocklySkini/blockly/media/click.wav +0 -0
  289. package/blocklySkini/blockly/media/delete.mp3 +0 -0
  290. package/blocklySkini/blockly/media/delete.ogg +0 -0
  291. package/blocklySkini/blockly/media/delete.wav +0 -0
  292. package/blocklySkini/blockly/media/disconnect.mp3 +0 -0
  293. package/blocklySkini/blockly/media/disconnect.ogg +0 -0
  294. package/blocklySkini/blockly/media/disconnect.wav +0 -0
  295. package/blocklySkini/blockly/media/dropdown-arrow.svg +1 -0
  296. package/blocklySkini/blockly/media/handclosed.cur +0 -0
  297. package/blocklySkini/blockly/media/handdelete.cur +0 -0
  298. package/blocklySkini/blockly/media/handopen.cur +0 -0
  299. package/blocklySkini/blockly/media/pilcrow.png +0 -0
  300. package/blocklySkini/blockly/media/quote0.png +0 -0
  301. package/blocklySkini/blockly/media/quote1.png +0 -0
  302. package/blocklySkini/blockly/media/sprites.png +0 -0
  303. package/blocklySkini/blockly/media/sprites.svg +74 -0
  304. package/blocklySkini/blockly/msg/ab.d.ts +16 -0
  305. package/blocklySkini/blockly/msg/ab.js +447 -0
  306. package/blocklySkini/blockly/msg/ar.d.ts +16 -0
  307. package/blocklySkini/blockly/msg/ar.js +447 -0
  308. package/blocklySkini/blockly/msg/az.d.ts +16 -0
  309. package/blocklySkini/blockly/msg/az.js +447 -0
  310. package/blocklySkini/blockly/msg/ba.d.ts +16 -0
  311. package/blocklySkini/blockly/msg/ba.js +447 -0
  312. package/blocklySkini/blockly/msg/bcc.d.ts +16 -0
  313. package/blocklySkini/blockly/msg/bcc.js +447 -0
  314. package/blocklySkini/blockly/msg/be-tarask.d.ts +16 -0
  315. package/blocklySkini/blockly/msg/be-tarask.js +447 -0
  316. package/blocklySkini/blockly/msg/be.d.ts +16 -0
  317. package/blocklySkini/blockly/msg/be.js +447 -0
  318. package/blocklySkini/blockly/msg/bg.d.ts +16 -0
  319. package/blocklySkini/blockly/msg/bg.js +447 -0
  320. package/blocklySkini/blockly/msg/bn.d.ts +16 -0
  321. package/blocklySkini/blockly/msg/bn.js +447 -0
  322. package/blocklySkini/blockly/msg/br.d.ts +16 -0
  323. package/blocklySkini/blockly/msg/br.js +447 -0
  324. package/blocklySkini/blockly/msg/ca.d.ts +16 -0
  325. package/blocklySkini/blockly/msg/ca.js +447 -0
  326. package/blocklySkini/blockly/msg/constants.d.ts +16 -0
  327. package/blocklySkini/blockly/msg/cs.d.ts +16 -0
  328. package/blocklySkini/blockly/msg/cs.js +447 -0
  329. package/blocklySkini/blockly/msg/da.d.ts +16 -0
  330. package/blocklySkini/blockly/msg/da.js +447 -0
  331. package/blocklySkini/blockly/msg/de.d.ts +16 -0
  332. package/blocklySkini/blockly/msg/de.js +447 -0
  333. package/blocklySkini/blockly/msg/diq.d.ts +16 -0
  334. package/blocklySkini/blockly/msg/diq.js +447 -0
  335. package/blocklySkini/blockly/msg/dty.d.ts +16 -0
  336. package/blocklySkini/blockly/msg/dty.js +447 -0
  337. package/blocklySkini/blockly/msg/ee.d.ts +16 -0
  338. package/blocklySkini/blockly/msg/ee.js +447 -0
  339. package/blocklySkini/blockly/msg/el.d.ts +16 -0
  340. package/blocklySkini/blockly/msg/el.js +447 -0
  341. package/blocklySkini/blockly/msg/en-gb.d.ts +16 -0
  342. package/blocklySkini/blockly/msg/en-gb.js +447 -0
  343. package/blocklySkini/blockly/msg/en.d.ts +16 -0
  344. package/blocklySkini/blockly/msg/en.js +447 -0
  345. package/blocklySkini/blockly/msg/eo.d.ts +16 -0
  346. package/blocklySkini/blockly/msg/eo.js +447 -0
  347. package/blocklySkini/blockly/msg/es.d.ts +16 -0
  348. package/blocklySkini/blockly/msg/es.js +447 -0
  349. package/blocklySkini/blockly/msg/et.d.ts +16 -0
  350. package/blocklySkini/blockly/msg/et.js +447 -0
  351. package/blocklySkini/blockly/msg/eu.d.ts +16 -0
  352. package/blocklySkini/blockly/msg/eu.js +447 -0
  353. package/blocklySkini/blockly/msg/fa.d.ts +16 -0
  354. package/blocklySkini/blockly/msg/fa.js +447 -0
  355. package/blocklySkini/blockly/msg/fi.d.ts +16 -0
  356. package/blocklySkini/blockly/msg/fi.js +447 -0
  357. package/blocklySkini/blockly/msg/fr.d.ts +16 -0
  358. package/blocklySkini/blockly/msg/fr.js +447 -0
  359. package/blocklySkini/blockly/msg/gl.d.ts +16 -0
  360. package/blocklySkini/blockly/msg/gl.js +447 -0
  361. package/blocklySkini/blockly/msg/gor.d.ts +16 -0
  362. package/blocklySkini/blockly/msg/gor.js +447 -0
  363. package/blocklySkini/blockly/msg/ha.d.ts +16 -0
  364. package/blocklySkini/blockly/msg/ha.js +447 -0
  365. package/blocklySkini/blockly/msg/he.d.ts +16 -0
  366. package/blocklySkini/blockly/msg/he.js +447 -0
  367. package/blocklySkini/blockly/msg/hi.d.ts +16 -0
  368. package/blocklySkini/blockly/msg/hi.js +447 -0
  369. package/blocklySkini/blockly/msg/hrx.d.ts +16 -0
  370. package/blocklySkini/blockly/msg/hrx.js +447 -0
  371. package/blocklySkini/blockly/msg/hu.d.ts +16 -0
  372. package/blocklySkini/blockly/msg/hu.js +447 -0
  373. package/blocklySkini/blockly/msg/hy.d.ts +16 -0
  374. package/blocklySkini/blockly/msg/hy.js +447 -0
  375. package/blocklySkini/blockly/msg/ia.d.ts +16 -0
  376. package/blocklySkini/blockly/msg/ia.js +447 -0
  377. package/blocklySkini/blockly/msg/id.d.ts +16 -0
  378. package/blocklySkini/blockly/msg/id.js +447 -0
  379. package/blocklySkini/blockly/msg/ig.d.ts +16 -0
  380. package/blocklySkini/blockly/msg/ig.js +447 -0
  381. package/blocklySkini/blockly/msg/is.d.ts +16 -0
  382. package/blocklySkini/blockly/msg/is.js +447 -0
  383. package/blocklySkini/blockly/msg/it.d.ts +16 -0
  384. package/blocklySkini/blockly/msg/it.js +447 -0
  385. package/blocklySkini/blockly/msg/ja.d.ts +16 -0
  386. package/blocklySkini/blockly/msg/ja.js +447 -0
  387. package/blocklySkini/blockly/msg/kab.d.ts +16 -0
  388. package/blocklySkini/blockly/msg/kab.js +447 -0
  389. package/blocklySkini/blockly/msg/kn.d.ts +16 -0
  390. package/blocklySkini/blockly/msg/kn.js +447 -0
  391. package/blocklySkini/blockly/msg/ko.d.ts +16 -0
  392. package/blocklySkini/blockly/msg/ko.js +447 -0
  393. package/blocklySkini/blockly/msg/lb.d.ts +16 -0
  394. package/blocklySkini/blockly/msg/lb.js +447 -0
  395. package/blocklySkini/blockly/msg/lki.d.ts +16 -0
  396. package/blocklySkini/blockly/msg/lki.js +447 -0
  397. package/blocklySkini/blockly/msg/lo.d.ts +16 -0
  398. package/blocklySkini/blockly/msg/lo.js +447 -0
  399. package/blocklySkini/blockly/msg/lrc.d.ts +16 -0
  400. package/blocklySkini/blockly/msg/lrc.js +447 -0
  401. package/blocklySkini/blockly/msg/lt.d.ts +16 -0
  402. package/blocklySkini/blockly/msg/lt.js +447 -0
  403. package/blocklySkini/blockly/msg/lv.d.ts +16 -0
  404. package/blocklySkini/blockly/msg/lv.js +447 -0
  405. package/blocklySkini/blockly/msg/mk.d.ts +16 -0
  406. package/blocklySkini/blockly/msg/mk.js +447 -0
  407. package/blocklySkini/blockly/msg/mnw.d.ts +16 -0
  408. package/blocklySkini/blockly/msg/mnw.js +447 -0
  409. package/blocklySkini/blockly/msg/ms.d.ts +16 -0
  410. package/blocklySkini/blockly/msg/ms.js +447 -0
  411. package/blocklySkini/blockly/msg/msg.d.ts +444 -0
  412. package/blocklySkini/blockly/msg/nb.d.ts +16 -0
  413. package/blocklySkini/blockly/msg/nb.js +447 -0
  414. package/blocklySkini/blockly/msg/nl.d.ts +16 -0
  415. package/blocklySkini/blockly/msg/nl.js +447 -0
  416. package/blocklySkini/blockly/msg/oc.d.ts +16 -0
  417. package/blocklySkini/blockly/msg/oc.js +447 -0
  418. package/blocklySkini/blockly/msg/pl.d.ts +16 -0
  419. package/blocklySkini/blockly/msg/pl.js +447 -0
  420. package/blocklySkini/blockly/msg/pms.d.ts +16 -0
  421. package/blocklySkini/blockly/msg/pms.js +447 -0
  422. package/blocklySkini/blockly/msg/pt-br.d.ts +16 -0
  423. package/blocklySkini/blockly/msg/pt-br.js +447 -0
  424. package/blocklySkini/blockly/msg/pt.d.ts +16 -0
  425. package/blocklySkini/blockly/msg/pt.js +447 -0
  426. package/blocklySkini/blockly/msg/qqq.d.ts +16 -0
  427. package/blocklySkini/blockly/msg/ro.d.ts +16 -0
  428. package/blocklySkini/blockly/msg/ro.js +447 -0
  429. package/blocklySkini/blockly/msg/ru.d.ts +16 -0
  430. package/blocklySkini/blockly/msg/ru.js +447 -0
  431. package/blocklySkini/blockly/msg/sc.d.ts +16 -0
  432. package/blocklySkini/blockly/msg/sc.js +447 -0
  433. package/blocklySkini/blockly/msg/sd.d.ts +16 -0
  434. package/blocklySkini/blockly/msg/sd.js +447 -0
  435. package/blocklySkini/blockly/msg/shn.d.ts +16 -0
  436. package/blocklySkini/blockly/msg/shn.js +447 -0
  437. package/blocklySkini/blockly/msg/sk.d.ts +16 -0
  438. package/blocklySkini/blockly/msg/sk.js +447 -0
  439. package/blocklySkini/blockly/msg/skr-arab.d.ts +16 -0
  440. package/blocklySkini/blockly/msg/skr-arab.js +447 -0
  441. package/blocklySkini/blockly/msg/sl.d.ts +16 -0
  442. package/blocklySkini/blockly/msg/sl.js +447 -0
  443. package/blocklySkini/blockly/msg/sq.d.ts +16 -0
  444. package/blocklySkini/blockly/msg/sq.js +447 -0
  445. package/blocklySkini/blockly/msg/sr-latn.d.ts +16 -0
  446. package/blocklySkini/blockly/msg/sr-latn.js +447 -0
  447. package/blocklySkini/blockly/msg/sr.d.ts +16 -0
  448. package/blocklySkini/blockly/msg/sr.js +447 -0
  449. package/blocklySkini/blockly/msg/sv.d.ts +16 -0
  450. package/blocklySkini/blockly/msg/sv.js +447 -0
  451. package/blocklySkini/blockly/msg/synonyms.d.ts +16 -0
  452. package/blocklySkini/blockly/msg/ta.d.ts +16 -0
  453. package/blocklySkini/blockly/msg/ta.js +447 -0
  454. package/blocklySkini/blockly/msg/tcy.d.ts +16 -0
  455. package/blocklySkini/blockly/msg/tcy.js +447 -0
  456. package/blocklySkini/blockly/msg/te.d.ts +16 -0
  457. package/blocklySkini/blockly/msg/te.js +447 -0
  458. package/blocklySkini/blockly/msg/th.d.ts +16 -0
  459. package/blocklySkini/blockly/msg/th.js +447 -0
  460. package/blocklySkini/blockly/msg/tl.d.ts +16 -0
  461. package/blocklySkini/blockly/msg/tl.js +447 -0
  462. package/blocklySkini/blockly/msg/tlh.d.ts +16 -0
  463. package/blocklySkini/blockly/msg/tlh.js +447 -0
  464. package/blocklySkini/blockly/msg/tr.d.ts +16 -0
  465. package/blocklySkini/blockly/msg/tr.js +447 -0
  466. package/blocklySkini/blockly/msg/ug-arab.d.ts +16 -0
  467. package/blocklySkini/blockly/msg/ug-arab.js +447 -0
  468. package/blocklySkini/blockly/msg/uk.d.ts +16 -0
  469. package/blocklySkini/blockly/msg/uk.js +447 -0
  470. package/blocklySkini/blockly/msg/ur.d.ts +16 -0
  471. package/blocklySkini/blockly/msg/ur.js +447 -0
  472. package/blocklySkini/blockly/msg/vi.d.ts +16 -0
  473. package/blocklySkini/blockly/msg/vi.js +447 -0
  474. package/blocklySkini/blockly/msg/xmf.d.ts +16 -0
  475. package/blocklySkini/blockly/msg/xmf.js +447 -0
  476. package/blocklySkini/blockly/msg/yo.d.ts +16 -0
  477. package/blocklySkini/blockly/msg/yo.js +447 -0
  478. package/blocklySkini/blockly/msg/zh-hans.d.ts +16 -0
  479. package/blocklySkini/blockly/msg/zh-hans.js +447 -0
  480. package/blocklySkini/blockly/msg/zh-hant.d.ts +16 -0
  481. package/blocklySkini/blockly/msg/zh-hant.js +447 -0
  482. package/blocklySkini/blockly/node.js +35 -0
  483. package/blocklySkini/blockly/package.json +84 -0
  484. package/blocklySkini/blockly/php.d.ts +15 -0
  485. package/blocklySkini/blockly/php.js +27 -0
  486. package/blocklySkini/blockly/php_compressed.js +103 -0
  487. package/blocklySkini/blockly/php_compressed.js.map +1 -0
  488. package/blocklySkini/blockly/python.d.ts +15 -0
  489. package/blocklySkini/blockly/python.js +27 -0
  490. package/blocklySkini/blockly/python_compressed.js +98 -0
  491. package/blocklySkini/blockly/python_compressed.js.map +1 -0
  492. package/blocklySkini/blocklySkini.html +81 -0
  493. package/blocklySkini/orchestrations/.xml +1 -0
  494. package/blocklySkini/orchestrations/BluesSkini-1.xml +231 -0
  495. package/blocklySkini/orchestrations/BluesSkini-2.xml +741 -0
  496. package/blocklySkini/orchestrations/BluesSkini-3.xml +731 -0
  497. package/blocklySkini/orchestrations/BluesSkini-4.xml +695 -0
  498. package/blocklySkini/orchestrations/BluesSkini-5.xml +731 -0
  499. package/blocklySkini/orchestrations/BluesSkini.xml +704 -0
  500. package/blocklySkini/orchestrations/FunkBitwig-1.xml +778 -0
  501. package/blocklySkini/orchestrations/FunkBitwig-2.xml +471 -0
  502. package/blocklySkini/orchestrations/JouerLeBonInstrument1-1.xml +784 -0
  503. package/blocklySkini/orchestrations/MajeurMineur-1.xml +638 -0
  504. package/blocklySkini/orchestrations/Opus5-3 - Copie.xml +1041 -0
  505. package/blocklySkini/orchestrations/Opus5-3.xml +1128 -0
  506. package/blocklySkini/orchestrations/Quatuor1-1.xml +357 -0
  507. package/blocklySkini/orchestrations/TechnoBitwig-1.xml +221 -0
  508. package/blocklySkini/orchestrations/TestBlockly.xml +497 -0
  509. package/blocklySkini/orchestrations/TestBlockly1.xml +500 -0
  510. package/blocklySkini/orchestrations/TestBlockly2.xml +792 -0
  511. package/blocklySkini/orchestrations/TestBlockly3-1.xml +1182 -0
  512. package/blocklySkini/orchestrations/TestBlockly3.xml +1251 -0
  513. package/blocklySkini/orchestrations/TestFunction.xml +143 -0
  514. package/blocklySkini/orchestrations/TestIf.xml +80 -0
  515. package/blocklySkini/orchestrations/TestLoop.xml +127 -0
  516. package/blocklySkini/orchestrations/TestOrchestration2.xml +460 -0
  517. package/blocklySkini/orchestrations/TestPrint.xml +70 -0
  518. package/blocklySkini/orchestrations/TestSubMod.xml +81 -0
  519. package/blocklySkini/orchestrations/Testlogic.xml +113 -0
  520. package/blocklySkini/orchestrations/TrouveLaPercu-1.xml +813 -0
  521. package/blocklySkini/orchestrations/TrouveLaPercu-2.xml +813 -0
  522. package/blocklySkini/orchestrations/bar.xml +496 -0
  523. package/blocklySkini/orchestrations/bar2.xml +496 -0
  524. package/blocklySkini/orchestrations/foo.xml +500 -0
  525. package/blocklySkini/orchestrations/opus5Blockly - Copie.xml +496 -0
  526. package/blocklySkini/orchestrations/opus5Blockly-3.xml +868 -0
  527. package/blocklySkini/orchestrations/opus5Blockly.xml +496 -0
  528. package/blocklySkini/orchestrations/testOrchestration3.xml +483 -0
  529. package/blocklySkini/orchestrations/testOrchestration4.xml +487 -0
  530. package/blocklySkini/scripts/hiphop_blocks.js +6104 -0
  531. package/blocklySkini/scripts/main2.js +801 -0
  532. package/blocklySkini/styles/index.css +320 -0
  533. package/blocklySkini/styles/material.css +11552 -0
  534. package/package.json +5 -5
@@ -0,0 +1,1084 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview The class in charge of handling actions related to keyboard
9
+ * navigation.
10
+ * @author aschmiedt@google.com (Abby Schmiedt)
11
+ */
12
+ 'use strict';
13
+
14
+ goog.provide('Blockly.navigation');
15
+
16
+ goog.require('Blockly.Action');
17
+ goog.require('Blockly.ASTNode');
18
+ goog.require('Blockly.utils.Coordinate');
19
+ goog.require('Blockly.user.keyMap');
20
+
21
+
22
+ /**
23
+ * A function to call to give feedback to the user about logs, warnings, and
24
+ * errors. You can override this to customize feedback (e.g. warning sounds,
25
+ * reading out the warning text, etc).
26
+ * Null by default.
27
+ * The first argument is one of 'log', 'warn', and 'error'.
28
+ * The second argument is the message.
29
+ * @type {?function(string, string)}
30
+ * @public
31
+ */
32
+ Blockly.navigation.loggingCallback = null;
33
+
34
+ /**
35
+ * State indicating focus is currently on the flyout.
36
+ * @type {number}
37
+ * @const
38
+ */
39
+ Blockly.navigation.STATE_FLYOUT = 1;
40
+
41
+ /**
42
+ * State indicating focus is currently on the workspace.
43
+ * @type {number}
44
+ * @const
45
+ */
46
+ Blockly.navigation.STATE_WS = 2;
47
+
48
+ /**
49
+ * State indicating focus is currently on the toolbox.
50
+ * @type {number}
51
+ * @const
52
+ */
53
+ Blockly.navigation.STATE_TOOLBOX = 3;
54
+
55
+ /**
56
+ * The distance to move the cursor on the workspace.
57
+ * @type {number}
58
+ * @const
59
+ */
60
+ Blockly.navigation.WS_MOVE_DISTANCE = 40;
61
+
62
+ /**
63
+ * The current state the user is in.
64
+ * Initialized to workspace state since a user enters navigation mode by shift
65
+ * clicking on a block or workspace.
66
+ * @type {number}
67
+ * @private
68
+ */
69
+ Blockly.navigation.currentState_ = Blockly.navigation.STATE_WS;
70
+
71
+ /**
72
+ * Object holding default action names.
73
+ * @enum {string}
74
+ */
75
+ Blockly.navigation.actionNames = {
76
+ PREVIOUS: 'previous',
77
+ NEXT: 'next',
78
+ IN: 'in',
79
+ OUT: 'out',
80
+ INSERT: 'insert',
81
+ MARK: 'mark',
82
+ DISCONNECT: 'disconnect',
83
+ TOOLBOX: 'toolbox',
84
+ EXIT: 'exit',
85
+ TOGGLE_KEYBOARD_NAV: 'toggle_keyboard_nav',
86
+ MOVE_WS_CURSOR_UP: 'move workspace cursor up',
87
+ MOVE_WS_CURSOR_DOWN: 'move workspace cursor down',
88
+ MOVE_WS_CURSOR_LEFT: 'move workspace cursor left',
89
+ MOVE_WS_CURSOR_RIGHT: 'move workspace cursor right'
90
+ };
91
+
92
+ /**
93
+ * The name of the marker reserved for internal use.
94
+ * @type {string}
95
+ * @const
96
+ */
97
+ Blockly.navigation.MARKER_NAME = 'local_marker_1';
98
+
99
+ /** ****** */
100
+ /** Focus */
101
+ /** ****** */
102
+
103
+ /**
104
+ * Get the local marker.
105
+ * @return {Blockly.Marker} The local marker for the main workspace.
106
+ */
107
+ Blockly.navigation.getMarker = function() {
108
+ return Blockly.navigation.getNavigationWorkspace()
109
+ .getMarker(Blockly.navigation.MARKER_NAME);
110
+ };
111
+
112
+ /**
113
+ * Get the workspace that is being navigated.
114
+ * @return {!Blockly.WorkspaceSvg} The workspace being navigated.
115
+ */
116
+ Blockly.navigation.getNavigationWorkspace = function() {
117
+ return /** @type {!Blockly.WorkspaceSvg} */ (Blockly.getMainWorkspace());
118
+ };
119
+
120
+ /**
121
+ * If a toolbox exists, set the navigation state to toolbox and select the first
122
+ * category in the toolbox.
123
+ * @private
124
+ */
125
+ Blockly.navigation.focusToolbox_ = function() {
126
+ var toolbox = Blockly.navigation.getNavigationWorkspace().getToolbox();
127
+ if (toolbox) {
128
+ Blockly.navigation.currentState_ = Blockly.navigation.STATE_TOOLBOX;
129
+ Blockly.navigation.resetFlyout_(false /* shouldHide */);
130
+
131
+ if (!Blockly.navigation.getMarker().getCurNode()) {
132
+ Blockly.navigation.markAtCursor_();
133
+ }
134
+ if (!toolbox.getSelectedItem()) {
135
+ toolbox.selectItemByPosition(0);
136
+ }
137
+ }
138
+ };
139
+
140
+ /**
141
+ * Change focus to the flyout.
142
+ * @private
143
+ */
144
+ Blockly.navigation.focusFlyout_ = function() {
145
+ var topBlock = null;
146
+ Blockly.navigation.currentState_ = Blockly.navigation.STATE_FLYOUT;
147
+ var workspace = Blockly.navigation.getNavigationWorkspace();
148
+ var toolbox = workspace.getToolbox();
149
+ var flyout = toolbox ? toolbox.getFlyout() : workspace.getFlyout();
150
+
151
+ if (!Blockly.navigation.getMarker().getCurNode()) {
152
+ Blockly.navigation.markAtCursor_();
153
+ }
154
+
155
+ if (flyout && flyout.getWorkspace()) {
156
+ var topBlocks = flyout.getWorkspace().getTopBlocks(true);
157
+ if (topBlocks.length > 0) {
158
+ topBlock = topBlocks[0];
159
+ var astNode = Blockly.ASTNode.createStackNode(topBlock);
160
+ Blockly.navigation.getFlyoutCursor_().setCurNode(astNode);
161
+ }
162
+ }
163
+ };
164
+
165
+ /**
166
+ * Finds where the cursor should go on the workspace. This is either the top
167
+ * block or a set position on the workspace.
168
+ * @private
169
+ */
170
+ Blockly.navigation.focusWorkspace_ = function() {
171
+ Blockly.hideChaff();
172
+ var workspace = Blockly.navigation.getNavigationWorkspace();
173
+ var cursor = workspace.getCursor();
174
+ var reset = !!workspace.getToolbox();
175
+ var topBlocks = workspace.getTopBlocks(true);
176
+
177
+ Blockly.navigation.resetFlyout_(reset);
178
+ Blockly.navigation.currentState_ = Blockly.navigation.STATE_WS;
179
+ if (topBlocks.length > 0) {
180
+ cursor.setCurNode(Blockly.ASTNode.createTopNode(topBlocks[0]));
181
+ } else {
182
+ // TODO: Find the center of the visible workspace.
183
+ var wsCoord = new Blockly.utils.Coordinate(100, 100);
184
+ var wsNode = Blockly.ASTNode.createWorkspaceNode(workspace, wsCoord);
185
+ cursor.setCurNode(wsNode);
186
+ }
187
+ };
188
+
189
+ /** ****************** */
190
+ /** Flyout Navigation */
191
+ /** ****************** */
192
+
193
+ /**
194
+ * Get the cursor from the flyouts workspace.
195
+ * @return {Blockly.FlyoutCursor} The flyouts cursor or null if no flyout exists.
196
+ * @private
197
+ */
198
+ Blockly.navigation.getFlyoutCursor_ = function() {
199
+ var workspace = Blockly.navigation.getNavigationWorkspace();
200
+ var cursor = null;
201
+ if (workspace.rendered) {
202
+ var toolbox = workspace.getToolbox();
203
+ var flyout = toolbox ? toolbox.getFlyout() : workspace.getFlyout();
204
+ cursor = flyout ? flyout.getWorkspace().getCursor() : null;
205
+ }
206
+ return /** @type {Blockly.FlyoutCursor} */ (cursor);
207
+ };
208
+
209
+ /**
210
+ * If there is a marked connection try connecting the block from the flyout to
211
+ * that connection. If no connection has been marked then inserting will place
212
+ * it on the workspace.
213
+ */
214
+ Blockly.navigation.insertFromFlyout = function() {
215
+ var workspace = Blockly.navigation.getNavigationWorkspace();
216
+ var flyout = workspace.getFlyout();
217
+ if (!flyout || !flyout.isVisible()) {
218
+ Blockly.navigation.warn_('Trying to insert from the flyout when the flyout does not ' +
219
+ ' exist or is not visible');
220
+ return;
221
+ }
222
+
223
+ var curBlock = /** @type {!Blockly.BlockSvg} */ (
224
+ Blockly.navigation.getFlyoutCursor_().getCurNode().getLocation());
225
+ if (!curBlock.isEnabled()) {
226
+ Blockly.navigation.warn_('Can\'t insert a disabled block.');
227
+ return;
228
+ }
229
+
230
+ var newBlock = flyout.createBlock(curBlock);
231
+ // Render to get the sizing right.
232
+ newBlock.render();
233
+ // Connections are not tracked when the block is first created. Normally
234
+ // there's enough time for them to become tracked in the user's mouse
235
+ // movements, but not here.
236
+ newBlock.setConnectionTracking(true);
237
+ workspace.getCursor().setCurNode(
238
+ Blockly.ASTNode.createBlockNode(newBlock));
239
+ if (!Blockly.navigation.modify_()) {
240
+ Blockly.navigation.warn_('Something went wrong while inserting a block from the flyout.');
241
+ }
242
+
243
+ Blockly.navigation.focusWorkspace_();
244
+ workspace.getCursor().setCurNode(Blockly.ASTNode.createTopNode(newBlock));
245
+ Blockly.navigation.removeMark_();
246
+ };
247
+
248
+ /**
249
+ * Reset flyout information, and optionally close the flyout.
250
+ * @param {boolean} shouldHide True if the flyout should be hidden.
251
+ * @private
252
+ */
253
+ Blockly.navigation.resetFlyout_ = function(shouldHide) {
254
+ if (Blockly.navigation.getFlyoutCursor_()) {
255
+ Blockly.navigation.getFlyoutCursor_().hide();
256
+ if (shouldHide) {
257
+ Blockly.navigation.getNavigationWorkspace().getFlyout().hide();
258
+ }
259
+ }
260
+ };
261
+
262
+ /** **************** */
263
+ /** Modify Workspace */
264
+ /** **************** */
265
+
266
+ /**
267
+ * Warns the user if the cursor or marker is on a type that can not be connected.
268
+ * @return {boolean} True if the marker and cursor are valid types, false
269
+ * otherwise.
270
+ * @private
271
+ */
272
+ Blockly.navigation.modifyWarn_ = function() {
273
+ var markerNode = Blockly.navigation.getMarker().getCurNode();
274
+ var cursorNode = Blockly.navigation.getNavigationWorkspace()
275
+ .getCursor().getCurNode();
276
+
277
+ if (!markerNode) {
278
+ Blockly.navigation.warn_('Cannot insert with no marked node.');
279
+ return false;
280
+ }
281
+
282
+ if (!cursorNode) {
283
+ Blockly.navigation.warn_('Cannot insert with no cursor node.');
284
+ return false;
285
+ }
286
+ var markerType = markerNode.getType();
287
+ var cursorType = cursorNode.getType();
288
+
289
+ // Check the marker for invalid types.
290
+ if (markerType == Blockly.ASTNode.types.FIELD) {
291
+ Blockly.navigation.warn_('Should not have been able to mark a field.');
292
+ return false;
293
+ } else if (markerType == Blockly.ASTNode.types.BLOCK) {
294
+ Blockly.navigation.warn_('Should not have been able to mark a block.');
295
+ return false;
296
+ } else if (markerType == Blockly.ASTNode.types.STACK) {
297
+ Blockly.navigation.warn_('Should not have been able to mark a stack.');
298
+ return false;
299
+ }
300
+
301
+ // Check the cursor for invalid types.
302
+ if (cursorType == Blockly.ASTNode.types.FIELD) {
303
+ Blockly.navigation.warn_('Cannot attach a field to anything else.');
304
+ return false;
305
+ } else if (cursorType == Blockly.ASTNode.types.WORKSPACE) {
306
+ Blockly.navigation.warn_('Cannot attach a workspace to anything else.');
307
+ return false;
308
+ }
309
+ return true;
310
+ };
311
+
312
+ /**
313
+ * Disconnect the block from its parent and move to the position of the
314
+ * workspace node.
315
+ * @param {Blockly.BlockSvg} block The block to be moved to the workspace.
316
+ * @param {!Blockly.ASTNode} wsNode The workspace node holding the position the
317
+ * block will be moved to.
318
+ * @return {boolean} True if the block can be moved to the workspace,
319
+ * false otherwise.
320
+ * @private
321
+ */
322
+ Blockly.navigation.moveBlockToWorkspace_ = function(block, wsNode) {
323
+ if (!block) {
324
+ return false;
325
+ }
326
+ if (block.isShadow()) {
327
+ Blockly.navigation.warn_('Cannot move a shadow block to the workspace.');
328
+ return false;
329
+ }
330
+ if (block.getParent()) {
331
+ block.unplug(false);
332
+ }
333
+ block.moveTo(wsNode.getWsCoordinate());
334
+ return true;
335
+ };
336
+
337
+ /**
338
+ * Handle the modifier key (currently I for Insert).
339
+ * Tries to connect the current marker and cursor location. Warns the user if
340
+ * the two locations can not be connected.
341
+ * @return {boolean} True if the key was handled; false if something went wrong.
342
+ * @private
343
+ */
344
+ Blockly.navigation.modify_ = function() {
345
+ var markerNode = Blockly.navigation.getMarker().getCurNode();
346
+ var cursorNode = Blockly.navigation.getNavigationWorkspace()
347
+ .getCursor().getCurNode();
348
+ if (!Blockly.navigation.modifyWarn_()) {
349
+ return false;
350
+ }
351
+
352
+ var markerType = markerNode.getType();
353
+ var cursorType = cursorNode.getType();
354
+
355
+ var cursorLoc = cursorNode.getLocation();
356
+ var markerLoc = markerNode.getLocation();
357
+
358
+ if (markerNode.isConnection() && cursorNode.isConnection()) {
359
+ cursorLoc = /** @type {!Blockly.RenderedConnection} */ (cursorLoc);
360
+ markerLoc = /** @type {!Blockly.RenderedConnection} */ (markerLoc);
361
+ return Blockly.navigation.connect_(cursorLoc, markerLoc);
362
+ } else if (markerNode.isConnection() &&
363
+ (cursorType == Blockly.ASTNode.types.BLOCK ||
364
+ cursorType == Blockly.ASTNode.types.STACK)) {
365
+ cursorLoc = /** @type {!Blockly.BlockSvg} */ (cursorLoc);
366
+ markerLoc = /** @type {!Blockly.RenderedConnection} */ (markerLoc);
367
+ return Blockly.navigation.insertBlock(cursorLoc, markerLoc);
368
+ } else if (markerType == Blockly.ASTNode.types.WORKSPACE) {
369
+ var block = cursorNode ? cursorNode.getSourceBlock() : null;
370
+ return Blockly.navigation.moveBlockToWorkspace_(
371
+ /** @type {Blockly.BlockSvg} */ (block), markerNode);
372
+ }
373
+ Blockly.navigation.warn_('Unexpected state in Blockly.navigation.modify_.');
374
+ return false;
375
+ };
376
+
377
+ /**
378
+ * If one of the connections source blocks is a child of the other, disconnect
379
+ * the child.
380
+ * @param {!Blockly.RenderedConnection} movingConnection The connection that is
381
+ * being moved.
382
+ * @param {!Blockly.RenderedConnection} destConnection The connection to be
383
+ * moved to.
384
+ * @private
385
+ */
386
+ Blockly.navigation.disconnectChild_ = function(movingConnection, destConnection) {
387
+ var movingBlock = movingConnection.getSourceBlock();
388
+ var destBlock = destConnection.getSourceBlock();
389
+
390
+ if (movingBlock.getRootBlock() == destBlock.getRootBlock()) {
391
+ if (movingBlock.getDescendants(false).indexOf(destBlock) > -1) {
392
+ Blockly.navigation.getInferiorConnection_(destConnection).disconnect();
393
+ } else {
394
+ Blockly.navigation.getInferiorConnection_(movingConnection).disconnect();
395
+ }
396
+ }
397
+ };
398
+
399
+ /**
400
+ * If the two blocks are compatible move the moving connection to the target
401
+ * connection and connect them.
402
+ * @param {Blockly.RenderedConnection} movingConnection The connection that is
403
+ * being moved.
404
+ * @param {Blockly.RenderedConnection} destConnection The connection to be moved
405
+ * to.
406
+ * @return {boolean} True if the connections were connected, false otherwise.
407
+ * @private
408
+ */
409
+ Blockly.navigation.moveAndConnect_ = function(movingConnection, destConnection) {
410
+ if (!movingConnection || !destConnection) {
411
+ return false;
412
+ }
413
+ var movingBlock = movingConnection.getSourceBlock();
414
+
415
+ var checker = movingConnection.getConnectionChecker();
416
+
417
+ if (checker.canConnect(movingConnection, destConnection, false)) {
418
+ Blockly.navigation.disconnectChild_(movingConnection, destConnection);
419
+
420
+ if (!destConnection.isSuperior()) {
421
+ var rootBlock = movingBlock.getRootBlock();
422
+ rootBlock.positionNearConnection(movingConnection, destConnection);
423
+ }
424
+ destConnection.connect(movingConnection);
425
+ return true;
426
+ }
427
+ return false;
428
+ };
429
+
430
+ /**
431
+ * If the given connection is superior find the inferior connection on the
432
+ * source block.
433
+ * @param {Blockly.RenderedConnection} connection The connection trying to be
434
+ * connected.
435
+ * @return {Blockly.RenderedConnection} The inferior connection or null if none
436
+ * exists.
437
+ * @private
438
+ */
439
+ Blockly.navigation.getInferiorConnection_ = function(connection) {
440
+ var block = connection.getSourceBlock();
441
+ if (!connection.isSuperior()) {
442
+ return connection;
443
+ } else if (block.previousConnection) {
444
+ return block.previousConnection;
445
+ } else if (block.outputConnection) {
446
+ return block.outputConnection;
447
+ } else {
448
+ return null;
449
+ }
450
+ };
451
+
452
+ /**
453
+ * If the given connection is inferior tries to find a superior connection to
454
+ * connect to.
455
+ * @param {Blockly.RenderedConnection} connection The connection trying to be
456
+ * connected.
457
+ * @return {Blockly.RenderedConnection} The superior connection or null if none
458
+ * exists.
459
+ * @private
460
+ */
461
+ Blockly.navigation.getSuperiorConnection_ = function(connection) {
462
+ if (connection.isSuperior()) {
463
+ return connection;
464
+ } else if (connection.targetConnection) {
465
+ return connection.targetConnection;
466
+ }
467
+ return null;
468
+ };
469
+
470
+ /**
471
+ * Tries to connect the given connections.
472
+ *
473
+ * If the given connections are not compatible try finding compatible connections
474
+ * on the source blocks of the given connections.
475
+ *
476
+ * @param {Blockly.RenderedConnection} movingConnection The connection that is
477
+ * being moved.
478
+ * @param {Blockly.RenderedConnection} destConnection The connection to be moved
479
+ * to.
480
+ * @return {boolean} True if the two connections or their target connections
481
+ * were connected, false otherwise.
482
+ * @private
483
+ */
484
+ Blockly.navigation.connect_ = function(movingConnection, destConnection) {
485
+ if (!movingConnection || !destConnection) {
486
+ return false;
487
+ }
488
+
489
+ var movingInferior = Blockly.navigation.getInferiorConnection_(movingConnection);
490
+ var destSuperior = Blockly.navigation.getSuperiorConnection_(destConnection);
491
+
492
+ var movingSuperior = Blockly.navigation.getSuperiorConnection_(movingConnection);
493
+ var destInferior = Blockly.navigation.getInferiorConnection_(destConnection);
494
+
495
+ if (movingInferior && destSuperior &&
496
+ Blockly.navigation.moveAndConnect_(movingInferior, destSuperior)) {
497
+ return true;
498
+ // Try swapping the inferior and superior connections on the blocks.
499
+ } else if (movingSuperior && destInferior &&
500
+ Blockly.navigation.moveAndConnect_(movingSuperior, destInferior)) {
501
+ return true;
502
+ } else if (Blockly.navigation.moveAndConnect_(movingConnection, destConnection)){
503
+ return true;
504
+ } else {
505
+ var checker = movingConnection.getConnectionChecker();
506
+ var reason = checker.canConnectWithReason(
507
+ movingConnection, destConnection, false);
508
+ Blockly.navigation.warn_('Connection failed with error: ' +
509
+ checker.getErrorMessage(reason, movingConnection, destConnection));
510
+ return false;
511
+ }
512
+ };
513
+
514
+ /**
515
+ * Tries to connect the given block to the destination connection, making an
516
+ * intelligent guess about which connection to use to on the moving block.
517
+ * @param {!Blockly.BlockSvg} block The block to move.
518
+ * @param {!Blockly.RenderedConnection} destConnection The connection to connect
519
+ * to.
520
+ * @return {boolean} Whether the connection was successful.
521
+ */
522
+ Blockly.navigation.insertBlock = function(block, destConnection) {
523
+ switch (destConnection.type) {
524
+ case Blockly.PREVIOUS_STATEMENT:
525
+ if (Blockly.navigation.connect_(block.nextConnection, destConnection)) {
526
+ return true;
527
+ }
528
+ break;
529
+ case Blockly.NEXT_STATEMENT:
530
+ if (Blockly.navigation.connect_(block.previousConnection, destConnection)) {
531
+ return true;
532
+ }
533
+ break;
534
+ case Blockly.INPUT_VALUE:
535
+ if (Blockly.navigation.connect_(block.outputConnection, destConnection)) {
536
+ return true;
537
+ }
538
+ break;
539
+ case Blockly.OUTPUT_VALUE:
540
+ for (var i = 0; i < block.inputList.length; i++) {
541
+ var inputConnection = /** @type {Blockly.RenderedConnection} */ (
542
+ block.inputList[i].connection);
543
+ if (inputConnection && inputConnection.type === Blockly.INPUT_VALUE &&
544
+ Blockly.navigation.connect_(inputConnection, destConnection)) {
545
+ return true;
546
+ }
547
+ }
548
+ // If there are no input values pass the output and destination connections
549
+ // to connect_ to find a way to connect the two.
550
+ if (block.outputConnection &&
551
+ Blockly.navigation.connect_(block.outputConnection, destConnection)) {
552
+ return true;
553
+ }
554
+ break;
555
+ }
556
+ Blockly.navigation.warn_('This block can not be inserted at the marked location.');
557
+ return false;
558
+ };
559
+
560
+ /**
561
+ * Disconnect the connection that the cursor is pointing to, and bump blocks.
562
+ * This is a no-op if the connection cannot be broken or if the cursor is not
563
+ * pointing to a connection.
564
+ * @private
565
+ */
566
+ Blockly.navigation.disconnectBlocks_ = function() {
567
+ var workspace = Blockly.navigation.getNavigationWorkspace();
568
+ var curNode = workspace.getCursor().getCurNode();
569
+ if (!curNode.isConnection()) {
570
+ Blockly.navigation.log_('Cannot disconnect blocks when the cursor is not on a connection');
571
+ return;
572
+ }
573
+ var curConnection =
574
+ /** @type {!Blockly.RenderedConnection} */ (curNode.getLocation());
575
+ if (!curConnection.isConnected()) {
576
+ Blockly.navigation.log_('Cannot disconnect unconnected connection');
577
+ return;
578
+ }
579
+ var superiorConnection =
580
+ curConnection.isSuperior() ? curConnection : curConnection.targetConnection;
581
+
582
+ var inferiorConnection =
583
+ curConnection.isSuperior() ? curConnection.targetConnection : curConnection;
584
+
585
+ if (inferiorConnection.getSourceBlock().isShadow()) {
586
+ Blockly.navigation.log_('Cannot disconnect a shadow block');
587
+ return;
588
+ }
589
+ superiorConnection.disconnect();
590
+ inferiorConnection.bumpAwayFrom(superiorConnection);
591
+
592
+ var rootBlock = superiorConnection.getSourceBlock().getRootBlock();
593
+ rootBlock.bringToFront();
594
+
595
+ var connectionNode = Blockly.ASTNode.createConnectionNode(superiorConnection);
596
+ workspace.getCursor().setCurNode(connectionNode);
597
+ };
598
+
599
+ /** ***************** */
600
+ /** Helper Functions */
601
+ /** ***************** */
602
+
603
+ /**
604
+ * Move the marker to the cursor's current location.
605
+ * @private
606
+ */
607
+ Blockly.navigation.markAtCursor_ = function() {
608
+ Blockly.navigation.getMarker().setCurNode(
609
+ Blockly.navigation.getNavigationWorkspace().getCursor().getCurNode());
610
+ };
611
+
612
+ /**
613
+ * Remove the marker from its current location and hide it.
614
+ * @private
615
+ */
616
+ Blockly.navigation.removeMark_ = function() {
617
+ var marker = Blockly.navigation.getMarker();
618
+ marker.setCurNode(null);
619
+ marker.hide();
620
+ };
621
+
622
+ /**
623
+ * Set the current navigation state.
624
+ * @param {number} newState The new navigation state.
625
+ * @package
626
+ */
627
+ Blockly.navigation.setState = function(newState) {
628
+ Blockly.navigation.currentState_ = newState;
629
+ };
630
+
631
+ /**
632
+ * Before a block is deleted move the cursor to the appropriate position.
633
+ * @param {!Blockly.BlockSvg} deletedBlock The block that is being deleted.
634
+ */
635
+ Blockly.navigation.moveCursorOnBlockDelete = function(deletedBlock) {
636
+ var workspace = Blockly.navigation.getNavigationWorkspace();
637
+ if (!workspace) {
638
+ return;
639
+ }
640
+ var cursor = workspace.getCursor();
641
+ if (cursor) {
642
+ var curNode = cursor.getCurNode();
643
+ var block = curNode ? curNode.getSourceBlock() : null;
644
+
645
+ if (block === deletedBlock) {
646
+ // If the block has a parent move the cursor to their connection point.
647
+ if (block.getParent()) {
648
+ var topConnection = block.previousConnection || block.outputConnection;
649
+ if (topConnection) {
650
+ cursor.setCurNode(
651
+ Blockly.ASTNode.createConnectionNode(topConnection.targetConnection));
652
+ }
653
+ } else {
654
+ // If the block is by itself move the cursor to the workspace.
655
+ cursor.setCurNode(Blockly.ASTNode.createWorkspaceNode(block.workspace,
656
+ block.getRelativeToSurfaceXY()));
657
+ }
658
+ // If the cursor is on a block whose parent is being deleted, move the
659
+ // cursor to the workspace.
660
+ } else if (block && deletedBlock.getChildren(false).indexOf(block) > -1) {
661
+ cursor.setCurNode(Blockly.ASTNode.createWorkspaceNode(block.workspace,
662
+ block.getRelativeToSurfaceXY()));
663
+ }
664
+ }
665
+ };
666
+
667
+ /**
668
+ * When a block that the cursor is on is mutated move the cursor to the block
669
+ * level.
670
+ * @param {!Blockly.BlockSvg} mutatedBlock The block that is being mutated.
671
+ * @package
672
+ */
673
+ Blockly.navigation.moveCursorOnBlockMutation = function(mutatedBlock) {
674
+ var cursor = Blockly.navigation.getNavigationWorkspace().getCursor();
675
+ if (cursor) {
676
+ var curNode = cursor.getCurNode();
677
+ var block = curNode ? curNode.getSourceBlock() : null;
678
+
679
+ if (block === mutatedBlock) {
680
+ cursor.setCurNode(Blockly.ASTNode.createBlockNode(block));
681
+ }
682
+ }
683
+ };
684
+
685
+ /**
686
+ * Enable accessibility mode.
687
+ */
688
+ Blockly.navigation.enableKeyboardAccessibility = function() {
689
+ var workspace = Blockly.navigation.getNavigationWorkspace();
690
+ if (!workspace.keyboardAccessibilityMode) {
691
+ workspace.keyboardAccessibilityMode = true;
692
+ Blockly.navigation.focusWorkspace_();
693
+ }
694
+ };
695
+
696
+ /**
697
+ * Disable accessibility mode.
698
+ */
699
+ Blockly.navigation.disableKeyboardAccessibility = function() {
700
+ var workspace = Blockly.navigation.getNavigationWorkspace();
701
+ if (workspace.keyboardAccessibilityMode) {
702
+ workspace.keyboardAccessibilityMode = false;
703
+ workspace.getCursor().hide();
704
+ Blockly.navigation.getMarker().hide();
705
+ if (Blockly.navigation.getFlyoutCursor_()) {
706
+ Blockly.navigation.getFlyoutCursor_().hide();
707
+ }
708
+ }
709
+ };
710
+
711
+ /**
712
+ * Navigation log handler. If loggingCallback is defined, use it.
713
+ * Otherwise just log to the console.
714
+ * @param {string} msg The message to log.
715
+ * @private
716
+ */
717
+ Blockly.navigation.log_ = function(msg) {
718
+ if (Blockly.navigation.loggingCallback) {
719
+ Blockly.navigation.loggingCallback('log', msg);
720
+ } else {
721
+ console.log(msg);
722
+ }
723
+ };
724
+
725
+ /**
726
+ * Navigation warning handler. If loggingCallback is defined, use it.
727
+ * Otherwise call Blockly.navigation.warn_.
728
+ * @param {string} msg The warning message.
729
+ * @private
730
+ */
731
+ Blockly.navigation.warn_ = function(msg) {
732
+ if (Blockly.navigation.loggingCallback) {
733
+ Blockly.navigation.loggingCallback('warn', msg);
734
+ } else {
735
+ console.warn(msg);
736
+ }
737
+ };
738
+
739
+ /**
740
+ * Navigation error handler. If loggingCallback is defined, use it.
741
+ * Otherwise call console.error.
742
+ * @param {string} msg The error message.
743
+ * @private
744
+ */
745
+ Blockly.navigation.error_ = function(msg) {
746
+ if (Blockly.navigation.loggingCallback) {
747
+ Blockly.navigation.loggingCallback('error', msg);
748
+ } else {
749
+ console.error(msg);
750
+ }
751
+ };
752
+
753
+ /** ***************** */
754
+ /** Handle Key Press */
755
+ /** ***************** */
756
+
757
+ /**
758
+ * Handler for all the keyboard navigation events.
759
+ * @param {!KeyboardEvent} e The keyboard event.
760
+ * @return {boolean} True if the key was handled false otherwise.
761
+ */
762
+ Blockly.navigation.onKeyPress = function(e) {
763
+ var key = Blockly.user.keyMap.serializeKeyEvent(e);
764
+ var action = Blockly.user.keyMap.getActionByKeyCode(key);
765
+
766
+ if (action) {
767
+ return Blockly.navigation.onBlocklyAction(action);
768
+ }
769
+ return false;
770
+ };
771
+
772
+ /**
773
+ * Decides which actions to handle depending on keyboard navigation and readonly
774
+ * states.
775
+ * @param {!Blockly.Action} action The current action.
776
+ * @return {boolean} True if the action has been handled, false otherwise.
777
+ */
778
+ Blockly.navigation.onBlocklyAction = function(action) {
779
+ var workspace = Blockly.navigation.getNavigationWorkspace();
780
+ var readOnly = workspace.options.readOnly;
781
+ var actionHandled = false;
782
+
783
+ if (workspace.keyboardAccessibilityMode) {
784
+ if (!readOnly) {
785
+ actionHandled = Blockly.navigation.handleActions_(action);
786
+ // If in readonly mode only handle valid actions.
787
+ } else if (Blockly.navigation.READONLY_ACTION_LIST.indexOf(action) > -1) {
788
+ actionHandled = Blockly.navigation.handleActions_(action);
789
+ }
790
+ // If not in accessibility mode only handle turning on keyboard navigation.
791
+ } else if (action.name === Blockly.navigation.actionNames.TOGGLE_KEYBOARD_NAV) {
792
+ Blockly.navigation.enableKeyboardAccessibility();
793
+ actionHandled = true;
794
+ }
795
+ return actionHandled;
796
+ };
797
+
798
+ /**
799
+ * Handles the action or dispatches to the appropriate action handler.
800
+ * @param {!Blockly.Action} action The action to handle.
801
+ * @return {boolean} True if the action has been handled, false otherwise.
802
+ * @private
803
+ */
804
+ Blockly.navigation.handleActions_ = function(action) {
805
+ if (action.name == Blockly.navigation.actionNames.TOOLBOX ||
806
+ Blockly.navigation.currentState_ == Blockly.navigation.STATE_TOOLBOX) {
807
+ return Blockly.navigation.toolboxOnAction_(action);
808
+ } else if (action.name == Blockly.navigation.actionNames.TOGGLE_KEYBOARD_NAV) {
809
+ Blockly.navigation.disableKeyboardAccessibility();
810
+ return true;
811
+ } if (Blockly.navigation.currentState_ == Blockly.navigation.STATE_WS) {
812
+ return Blockly.navigation.workspaceOnAction_(action);
813
+ } else if (Blockly.navigation.currentState_ == Blockly.navigation.STATE_FLYOUT) {
814
+ return Blockly.navigation.flyoutOnAction_(action);
815
+ }
816
+ return false;
817
+ };
818
+
819
+ /**
820
+ * Handles the given action for the flyout.
821
+ * @param {!Blockly.Action} action The action to handle.
822
+ * @return {boolean} True if the action has been handled, false otherwise.
823
+ * @private
824
+ */
825
+ Blockly.navigation.flyoutOnAction_ = function(action) {
826
+ var workspace = Blockly.navigation.getNavigationWorkspace();
827
+ var toolbox = workspace.getToolbox();
828
+ var flyout = toolbox ? toolbox.getFlyout() : workspace.getFlyout();
829
+
830
+ if (flyout && flyout.onBlocklyAction(action)) {
831
+ return true;
832
+ }
833
+
834
+ switch (action.name) {
835
+ case Blockly.navigation.actionNames.OUT:
836
+ Blockly.navigation.focusToolbox_();
837
+ return true;
838
+ case Blockly.navigation.actionNames.MARK:
839
+ Blockly.navigation.insertFromFlyout();
840
+ return true;
841
+ case Blockly.navigation.actionNames.EXIT:
842
+ Blockly.navigation.focusWorkspace_();
843
+ return true;
844
+ default:
845
+ return false;
846
+ }
847
+ };
848
+
849
+ /**
850
+ * Handles the given action for the toolbox.
851
+ * @param {!Blockly.Action} action The action to handle.
852
+ * @return {boolean} True if the action has been handled, false otherwise.
853
+ * @private
854
+ */
855
+ Blockly.navigation.toolboxOnAction_ = function(action) {
856
+ var workspace = Blockly.navigation.getNavigationWorkspace();
857
+ var toolbox = workspace.getToolbox();
858
+ var handled = toolbox && typeof toolbox.onBlocklyAction == 'function' ?
859
+ toolbox.onBlocklyAction(action) : false;
860
+
861
+ if (handled) {
862
+ return true;
863
+ }
864
+
865
+ if (action.name === Blockly.navigation.actionNames.TOOLBOX) {
866
+ if (!workspace.getToolbox()) {
867
+ Blockly.navigation.focusFlyout_();
868
+ } else {
869
+ Blockly.navigation.focusToolbox_();
870
+ }
871
+ return true;
872
+ } else if (action.name === Blockly.navigation.actionNames.IN) {
873
+ Blockly.navigation.focusFlyout_();
874
+ return true;
875
+ } else if (action.name === Blockly.navigation.actionNames.EXIT) {
876
+ Blockly.navigation.focusWorkspace_();
877
+ return true;
878
+ }
879
+ return false;
880
+ };
881
+
882
+ /**
883
+ * Move the workspace cursor in the given direction.
884
+ * @param {number} xDirection -1 to move cursor left. 1 to move cursor right.
885
+ * @param {number} yDirection -1 to move cursor up. 1 to move cursor down.
886
+ * @return {boolean} True if the current node is a workspace, false otherwise.
887
+ * @private
888
+ */
889
+ Blockly.navigation.moveWSCursor_ = function(xDirection, yDirection) {
890
+ var workspace = Blockly.navigation.getNavigationWorkspace();
891
+ var cursor = workspace.getCursor();
892
+ var curNode = workspace.getCursor().getCurNode();
893
+
894
+ if (curNode.getType() !== Blockly.ASTNode.types.WORKSPACE) {
895
+ return false;
896
+ }
897
+
898
+ var wsCoord = curNode.getWsCoordinate();
899
+ var newX = xDirection * Blockly.navigation.WS_MOVE_DISTANCE + wsCoord.x;
900
+ var newY = yDirection * Blockly.navigation.WS_MOVE_DISTANCE + wsCoord.y;
901
+
902
+ cursor.setCurNode(Blockly.ASTNode.createWorkspaceNode(
903
+ workspace, new Blockly.utils.Coordinate(newX, newY)));
904
+ return true;
905
+ };
906
+
907
+ /**
908
+ * Handles the given action for the workspace.
909
+ * @param {!Blockly.Action} action The action to handle.
910
+ * @return {boolean} True if the action has been handled, false otherwise.
911
+ * @private
912
+ */
913
+ Blockly.navigation.workspaceOnAction_ = function(action) {
914
+ var workspace = Blockly.navigation.getNavigationWorkspace();
915
+ if (workspace.getCursor().onBlocklyAction(action)) {
916
+ return true;
917
+ }
918
+ switch (action.name) {
919
+ case Blockly.navigation.actionNames.INSERT:
920
+ Blockly.navigation.modify_();
921
+ return true;
922
+ case Blockly.navigation.actionNames.MARK:
923
+ Blockly.navigation.handleEnterForWS_();
924
+ return true;
925
+ case Blockly.navigation.actionNames.DISCONNECT:
926
+ Blockly.navigation.disconnectBlocks_();
927
+ return true;
928
+ case Blockly.navigation.actionNames.MOVE_WS_CURSOR_UP:
929
+ return Blockly.navigation.moveWSCursor_(0, -1);
930
+ case Blockly.navigation.actionNames.MOVE_WS_CURSOR_DOWN:
931
+ return Blockly.navigation.moveWSCursor_(0, 1);
932
+ case Blockly.navigation.actionNames.MOVE_WS_CURSOR_LEFT:
933
+ return Blockly.navigation.moveWSCursor_(-1, 0);
934
+ case Blockly.navigation.actionNames.MOVE_WS_CURSOR_RIGHT:
935
+ return Blockly.navigation.moveWSCursor_(1, 0);
936
+ default:
937
+ return false;
938
+ }
939
+ };
940
+
941
+ /**
942
+ * Handles hitting the enter key on the workspace.
943
+ * @private
944
+ */
945
+ Blockly.navigation.handleEnterForWS_ = function() {
946
+ var cursor = Blockly.navigation.getNavigationWorkspace().getCursor();
947
+ var curNode = cursor.getCurNode();
948
+ var nodeType = curNode.getType();
949
+ if (nodeType == Blockly.ASTNode.types.FIELD) {
950
+ (/** @type {!Blockly.Field} */(curNode.getLocation())).showEditor();
951
+ } else if (curNode.isConnection() ||
952
+ nodeType == Blockly.ASTNode.types.WORKSPACE) {
953
+ Blockly.navigation.markAtCursor_();
954
+ } else if (nodeType == Blockly.ASTNode.types.BLOCK) {
955
+ Blockly.navigation.warn_('Cannot mark a block.');
956
+ } else if (nodeType == Blockly.ASTNode.types.STACK) {
957
+ Blockly.navigation.warn_('Cannot mark a stack.');
958
+ }
959
+ };
960
+
961
+ /** ******************* */
962
+ /** Navigation Actions */
963
+ /** ******************* */
964
+
965
+ /**
966
+ * The previous action.
967
+ * @type {!Blockly.Action}
968
+ */
969
+ Blockly.navigation.ACTION_PREVIOUS = new Blockly.Action(
970
+ Blockly.navigation.actionNames.PREVIOUS, 'Go to the previous location.');
971
+
972
+ /**
973
+ * The out action.
974
+ * @type {!Blockly.Action}
975
+ */
976
+ Blockly.navigation.ACTION_OUT = new Blockly.Action(
977
+ Blockly.navigation.actionNames.OUT,
978
+ 'Go to the parent of the current location.');
979
+
980
+ /**
981
+ * The next action.
982
+ * @type {!Blockly.Action}
983
+ */
984
+ Blockly.navigation.ACTION_NEXT = new Blockly.Action(
985
+ Blockly.navigation.actionNames.NEXT, 'Go to the next location.');
986
+
987
+ /**
988
+ * The in action.
989
+ * @type {!Blockly.Action}
990
+ */
991
+ Blockly.navigation.ACTION_IN = new Blockly.Action(
992
+ Blockly.navigation.actionNames.IN,
993
+ 'Go to the first child of the current location.');
994
+
995
+ /**
996
+ * The action to try to insert a block.
997
+ * @type {!Blockly.Action}
998
+ */
999
+ Blockly.navigation.ACTION_INSERT = new Blockly.Action(
1000
+ Blockly.navigation.actionNames.INSERT,
1001
+ 'Connect the current location to the marked location.');
1002
+
1003
+ /**
1004
+ * The action to mark a certain location.
1005
+ * @type {!Blockly.Action}
1006
+ */
1007
+ Blockly.navigation.ACTION_MARK = new Blockly.Action(
1008
+ Blockly.navigation.actionNames.MARK, 'Mark the current location.');
1009
+
1010
+ /**
1011
+ * The action to disconnect a block.
1012
+ * @type {!Blockly.Action}
1013
+ */
1014
+ Blockly.navigation.ACTION_DISCONNECT = new Blockly.Action(
1015
+ Blockly.navigation.actionNames.DISCONNECT,
1016
+ 'Disconnect the block at the current location from its parent.');
1017
+
1018
+ /**
1019
+ * The action to open the toolbox.
1020
+ * @type {!Blockly.Action}
1021
+ */
1022
+ Blockly.navigation.ACTION_TOOLBOX = new Blockly.Action(
1023
+ Blockly.navigation.actionNames.TOOLBOX, 'Open the toolbox.');
1024
+
1025
+ /**
1026
+ * The action to exit the toolbox or flyout.
1027
+ * @type {!Blockly.Action}
1028
+ */
1029
+ Blockly.navigation.ACTION_EXIT = new Blockly.Action(
1030
+ Blockly.navigation.actionNames.EXIT,
1031
+ 'Close the current modal, such as a toolbox or field editor.');
1032
+
1033
+ /**
1034
+ * The action to toggle keyboard navigation mode on and off.
1035
+ * @type {!Blockly.Action}
1036
+ */
1037
+ Blockly.navigation.ACTION_TOGGLE_KEYBOARD_NAV = new Blockly.Action(
1038
+ Blockly.navigation.actionNames.TOGGLE_KEYBOARD_NAV,
1039
+ 'Turns on and off keyboard navigation.');
1040
+
1041
+ /**
1042
+ * The action to move the cursor to the left on a workspace.
1043
+ * @type {!Blockly.Action}
1044
+ */
1045
+ Blockly.navigation.ACTION_MOVE_WS_CURSOR_LEFT = new Blockly.Action(
1046
+ Blockly.navigation.actionNames.MOVE_WS_CURSOR_LEFT,
1047
+ 'Move the workspace cursor to the lefts.');
1048
+
1049
+ /**
1050
+ * The action to move the cursor to the right on a workspace.
1051
+ * @type {!Blockly.Action}
1052
+ */
1053
+ Blockly.navigation.ACTION_MOVE_WS_CURSOR_RIGHT = new Blockly.Action(
1054
+ Blockly.navigation.actionNames.MOVE_WS_CURSOR_RIGHT,
1055
+ 'Move the workspace cursor to the right.');
1056
+
1057
+ /**
1058
+ * The action to move the cursor up on a workspace.
1059
+ * @type {!Blockly.Action}
1060
+ */
1061
+ Blockly.navigation.ACTION_MOVE_WS_CURSOR_UP = new Blockly.Action(
1062
+ Blockly.navigation.actionNames.MOVE_WS_CURSOR_UP,
1063
+ 'Move the workspace cursor up.');
1064
+
1065
+ /**
1066
+ * The action to move the cursor down on a workspace.
1067
+ * @type {!Blockly.Action}
1068
+ */
1069
+ Blockly.navigation.ACTION_MOVE_WS_CURSOR_DOWN = new Blockly.Action(
1070
+ Blockly.navigation.actionNames.MOVE_WS_CURSOR_DOWN,
1071
+ 'Move the workspace cursor down.');
1072
+
1073
+
1074
+ /**
1075
+ * List of actions that can be performed in read only mode.
1076
+ * @type {!Array.<!Blockly.Action>}
1077
+ */
1078
+ Blockly.navigation.READONLY_ACTION_LIST = [
1079
+ Blockly.navigation.ACTION_PREVIOUS,
1080
+ Blockly.navigation.ACTION_OUT,
1081
+ Blockly.navigation.ACTION_IN,
1082
+ Blockly.navigation.ACTION_NEXT,
1083
+ Blockly.navigation.ACTION_TOGGLE_KEYBOARD_NAV
1084
+ ];