nodeskini 1.0.1 → 1.0.2

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 +3 -3
@@ -0,0 +1,1071 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2011 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Flyout tray containing blocks which may be created.
9
+ * @author fraser@google.com (Neil Fraser)
10
+ */
11
+ 'use strict';
12
+
13
+ goog.provide('Blockly.Flyout');
14
+
15
+ goog.require('Blockly.Block');
16
+ goog.require('Blockly.blockRendering');
17
+ goog.require('Blockly.Events');
18
+ goog.require('Blockly.Events.BlockCreate');
19
+ goog.require('Blockly.Events.VarCreate');
20
+ goog.require('Blockly.FlyoutCursor');
21
+ goog.require('Blockly.Gesture');
22
+ goog.require('Blockly.Marker');
23
+ goog.require('Blockly.Scrollbar');
24
+ goog.require('Blockly.Tooltip');
25
+ goog.require('Blockly.Touch');
26
+ goog.require('Blockly.utils');
27
+ goog.require('Blockly.utils.Coordinate');
28
+ goog.require('Blockly.utils.dom');
29
+ goog.require('Blockly.utils.Svg');
30
+ goog.require('Blockly.utils.toolbox');
31
+ goog.require('Blockly.WorkspaceSvg');
32
+ goog.require('Blockly.Xml');
33
+
34
+ goog.requireType('Blockly.IBlocklyActionable');
35
+ goog.requireType('Blockly.IDeleteArea');
36
+ goog.requireType('Blockly.IFlyout');
37
+ goog.requireType('Blockly.utils.Metrics');
38
+
39
+
40
+ /**
41
+ * Class for a flyout.
42
+ * @param {!Blockly.Options} workspaceOptions Dictionary of options for the
43
+ * workspace.
44
+ * @constructor
45
+ * @abstract
46
+ * @implements {Blockly.IBlocklyActionable}
47
+ * @implements {Blockly.IDeleteArea}
48
+ * @implements {Blockly.IFlyout}
49
+ */
50
+ Blockly.Flyout = function(workspaceOptions) {
51
+ workspaceOptions.getMetrics =
52
+ /** @type {function():!Blockly.utils.Metrics} */ (
53
+ this.getMetrics_.bind(this));
54
+ workspaceOptions.setMetrics = this.setMetrics_.bind(this);
55
+
56
+ /**
57
+ * @type {!Blockly.WorkspaceSvg}
58
+ * @protected
59
+ */
60
+ this.workspace_ = new Blockly.WorkspaceSvg(workspaceOptions);
61
+ this.workspace_.isFlyout = true;
62
+ // Keep the workspace visibility consistent with the flyout's visibility.
63
+ this.workspace_.setVisible(this.isVisible_);
64
+
65
+ /**
66
+ * Is RTL vs LTR.
67
+ * @type {boolean}
68
+ */
69
+ this.RTL = !!workspaceOptions.RTL;
70
+
71
+ /**
72
+ * Whether the flyout should be laid out horizontally or not.
73
+ * @type {boolean}
74
+ * @package
75
+ */
76
+ this.horizontalLayout = false;
77
+
78
+ /**
79
+ * Position of the toolbox and flyout relative to the workspace.
80
+ * @type {number}
81
+ * @protected
82
+ */
83
+ this.toolboxPosition_ = workspaceOptions.toolboxPosition;
84
+
85
+ /**
86
+ * Opaque data that can be passed to Blockly.unbindEvent_.
87
+ * @type {!Array.<!Array>}
88
+ * @private
89
+ */
90
+ this.eventWrappers_ = [];
91
+
92
+ /**
93
+ * List of background mats that lurk behind each block to catch clicks
94
+ * landing in the blocks' lakes and bays.
95
+ * @type {!Array.<!SVGElement>}
96
+ * @private
97
+ */
98
+ this.mats_ = [];
99
+
100
+ /**
101
+ * List of visible buttons.
102
+ * @type {!Array.<!Blockly.FlyoutButton>}
103
+ * @protected
104
+ */
105
+ this.buttons_ = [];
106
+
107
+ /**
108
+ * List of event listeners.
109
+ * @type {!Array.<!Array>}
110
+ * @private
111
+ */
112
+ this.listeners_ = [];
113
+
114
+ /**
115
+ * List of blocks that should always be disabled.
116
+ * @type {!Array.<!Blockly.Block>}
117
+ * @private
118
+ */
119
+ this.permanentlyDisabled_ = [];
120
+
121
+ /**
122
+ * Width of output tab.
123
+ * @type {number}
124
+ * @protected
125
+ * @const
126
+ */
127
+ this.tabWidth_ = this.workspace_.getRenderer().getConstants().TAB_WIDTH;
128
+
129
+ /**
130
+ * The target workspace
131
+ * @type {?Blockly.WorkspaceSvg}
132
+ * @package
133
+ */
134
+ this.targetWorkspace = null;
135
+ };
136
+
137
+ /**
138
+ * Does the flyout automatically close when a block is created?
139
+ * @type {boolean}
140
+ */
141
+ Blockly.Flyout.prototype.autoClose = true;
142
+
143
+ /**
144
+ * Whether the flyout is visible.
145
+ * @type {boolean}
146
+ * @private
147
+ */
148
+ Blockly.Flyout.prototype.isVisible_ = false;
149
+
150
+ /**
151
+ * Whether the workspace containing this flyout is visible.
152
+ * @type {boolean}
153
+ * @private
154
+ */
155
+ Blockly.Flyout.prototype.containerVisible_ = true;
156
+
157
+ /**
158
+ * Corner radius of the flyout background.
159
+ * @type {number}
160
+ * @const
161
+ */
162
+ Blockly.Flyout.prototype.CORNER_RADIUS = 8;
163
+
164
+ /**
165
+ * Margin around the edges of the blocks in the flyout.
166
+ * @type {number}
167
+ * @const
168
+ */
169
+ Blockly.Flyout.prototype.MARGIN = Blockly.Flyout.prototype.CORNER_RADIUS;
170
+
171
+ // TODO: Move GAP_X and GAP_Y to their appropriate files.
172
+
173
+ /**
174
+ * Gap between items in horizontal flyouts. Can be overridden with the "sep"
175
+ * element.
176
+ * @const {number}
177
+ */
178
+ Blockly.Flyout.prototype.GAP_X = Blockly.Flyout.prototype.MARGIN * 3;
179
+
180
+ /**
181
+ * Gap between items in vertical flyouts. Can be overridden with the "sep"
182
+ * element.
183
+ * @const {number}
184
+ */
185
+ Blockly.Flyout.prototype.GAP_Y = Blockly.Flyout.prototype.MARGIN * 3;
186
+
187
+ /**
188
+ * Top/bottom padding between scrollbar and edge of flyout background.
189
+ * @type {number}
190
+ * @const
191
+ */
192
+ Blockly.Flyout.prototype.SCROLLBAR_PADDING = 2;
193
+
194
+ /**
195
+ * Width of flyout.
196
+ * @type {number}
197
+ * @protected
198
+ */
199
+ Blockly.Flyout.prototype.width_ = 0;
200
+
201
+ /**
202
+ * Height of flyout.
203
+ * @type {number}
204
+ * @protected
205
+ */
206
+ Blockly.Flyout.prototype.height_ = 0;
207
+
208
+ /**
209
+ * Range of a drag angle from a flyout considered "dragging toward workspace".
210
+ * Drags that are within the bounds of this many degrees from the orthogonal
211
+ * line to the flyout edge are considered to be "drags toward the workspace".
212
+ * Example:
213
+ * Flyout Edge Workspace
214
+ * [block] / <-within this angle, drags "toward workspace" |
215
+ * [block] ---- orthogonal to flyout boundary ---- |
216
+ * [block] \ |
217
+ * The angle is given in degrees from the orthogonal.
218
+ *
219
+ * This is used to know when to create a new block and when to scroll the
220
+ * flyout. Setting it to 360 means that all drags create a new block.
221
+ * @type {number}
222
+ * @protected
223
+ */
224
+ Blockly.Flyout.prototype.dragAngleRange_ = 70;
225
+
226
+ /**
227
+ * Creates the flyout's DOM. Only needs to be called once. The flyout can
228
+ * either exist as its own svg element or be a g element nested inside a
229
+ * separate svg element.
230
+ * @param {string|
231
+ * !Blockly.utils.Svg<!SVGSVGElement>|
232
+ * !Blockly.utils.Svg<!SVGGElement>} tagName The type of tag to
233
+ * put the flyout in. This should be <svg> or <g>.
234
+ * @return {!SVGElement} The flyout's SVG group.
235
+ */
236
+ Blockly.Flyout.prototype.createDom = function(tagName) {
237
+ /*
238
+ <svg | g>
239
+ <path class="blocklyFlyoutBackground"/>
240
+ <g class="blocklyFlyout"></g>
241
+ </ svg | g>
242
+ */
243
+ // Setting style to display:none to start. The toolbox and flyout
244
+ // hide/show code will set up proper visibility and size later.
245
+ this.svgGroup_ = Blockly.utils.dom.createSvgElement(tagName,
246
+ {'class': 'blocklyFlyout', 'style': 'display: none'}, null);
247
+ this.svgBackground_ = Blockly.utils.dom.createSvgElement(
248
+ Blockly.utils.Svg.PATH,
249
+ {'class': 'blocklyFlyoutBackground'}, this.svgGroup_);
250
+ this.svgGroup_.appendChild(this.workspace_.createDom());
251
+ this.workspace_.getThemeManager().subscribe(
252
+ this.svgBackground_, 'flyoutBackgroundColour', 'fill');
253
+ this.workspace_.getThemeManager().subscribe(
254
+ this.svgBackground_, 'flyoutOpacity', 'fill-opacity');
255
+ this.workspace_.getMarkerManager().setCursor(new Blockly.FlyoutCursor());
256
+ return this.svgGroup_;
257
+ };
258
+
259
+ /**
260
+ * Initializes the flyout.
261
+ * @param {!Blockly.WorkspaceSvg} targetWorkspace The workspace in which to
262
+ * create new blocks.
263
+ */
264
+ Blockly.Flyout.prototype.init = function(targetWorkspace) {
265
+ this.targetWorkspace = targetWorkspace;
266
+ this.workspace_.targetWorkspace = targetWorkspace;
267
+
268
+ /**
269
+ * @type {!Blockly.Scrollbar}
270
+ * @package
271
+ */
272
+ this.scrollbar = new Blockly.Scrollbar(this.workspace_,
273
+ this.horizontalLayout, false, 'blocklyFlyoutScrollbar');
274
+
275
+ this.hide();
276
+
277
+ Array.prototype.push.apply(this.eventWrappers_,
278
+ Blockly.bindEventWithChecks_(this.svgGroup_, 'wheel', this, this.wheel_));
279
+ if (!this.autoClose) {
280
+ this.filterWrapper_ = this.filterForCapacity_.bind(this);
281
+ this.targetWorkspace.addChangeListener(this.filterWrapper_);
282
+ }
283
+
284
+ // Dragging the flyout up and down.
285
+ Array.prototype.push.apply(this.eventWrappers_,
286
+ Blockly.bindEventWithChecks_(
287
+ this.svgBackground_, 'mousedown', this, this.onMouseDown_));
288
+
289
+ // A flyout connected to a workspace doesn't have its own current gesture.
290
+ this.workspace_.getGesture =
291
+ this.targetWorkspace.getGesture.bind(this.targetWorkspace);
292
+
293
+ // Get variables from the main workspace rather than the target workspace.
294
+ this.workspace_.setVariableMap(this.targetWorkspace.getVariableMap());
295
+
296
+ this.workspace_.createPotentialVariableMap();
297
+ };
298
+
299
+ /**
300
+ * Dispose of this flyout.
301
+ * Unlink from all DOM elements to prevent memory leaks.
302
+ * @suppress {checkTypes}
303
+ */
304
+ Blockly.Flyout.prototype.dispose = function() {
305
+ this.hide();
306
+ Blockly.unbindEvent_(this.eventWrappers_);
307
+ if (this.filterWrapper_) {
308
+ this.targetWorkspace.removeChangeListener(this.filterWrapper_);
309
+ this.filterWrapper_ = null;
310
+ }
311
+ if (this.scrollbar) {
312
+ this.scrollbar.dispose();
313
+ this.scrollbar = null;
314
+ }
315
+ if (this.workspace_) {
316
+ this.workspace_.getThemeManager().unsubscribe(this.svgBackground_);
317
+ this.workspace_.targetWorkspace = null;
318
+ this.workspace_.dispose();
319
+ this.workspace_ = null;
320
+ }
321
+ if (this.svgGroup_) {
322
+ Blockly.utils.dom.removeNode(this.svgGroup_);
323
+ this.svgGroup_ = null;
324
+ }
325
+ this.svgBackground_ = null;
326
+ this.targetWorkspace = null;
327
+ };
328
+
329
+ /**
330
+ * Get the width of the flyout.
331
+ * @return {number} The width of the flyout.
332
+ */
333
+ Blockly.Flyout.prototype.getWidth = function() {
334
+ return this.width_;
335
+ };
336
+
337
+ /**
338
+ * Get the height of the flyout.
339
+ * @return {number} The width of the flyout.
340
+ */
341
+ Blockly.Flyout.prototype.getHeight = function() {
342
+ return this.height_;
343
+ };
344
+
345
+ /**
346
+ * Get the workspace inside the flyout.
347
+ * @return {!Blockly.WorkspaceSvg} The workspace inside the flyout.
348
+ * @package
349
+ */
350
+ Blockly.Flyout.prototype.getWorkspace = function() {
351
+ return this.workspace_;
352
+ };
353
+
354
+ /**
355
+ * Is the flyout visible?
356
+ * @return {boolean} True if visible.
357
+ */
358
+ Blockly.Flyout.prototype.isVisible = function() {
359
+ return this.isVisible_;
360
+ };
361
+
362
+ /**
363
+ * Set whether the flyout is visible. A value of true does not necessarily mean
364
+ * that the flyout is shown. It could be hidden because its container is hidden.
365
+ * @param {boolean} visible True if visible.
366
+ */
367
+ Blockly.Flyout.prototype.setVisible = function(visible) {
368
+ var visibilityChanged = (visible != this.isVisible());
369
+
370
+ this.isVisible_ = visible;
371
+ if (visibilityChanged) {
372
+ this.updateDisplay_();
373
+ }
374
+ };
375
+
376
+ /**
377
+ * Set whether this flyout's container is visible.
378
+ * @param {boolean} visible Whether the container is visible.
379
+ */
380
+ Blockly.Flyout.prototype.setContainerVisible = function(visible) {
381
+ var visibilityChanged = (visible != this.containerVisible_);
382
+ this.containerVisible_ = visible;
383
+ if (visibilityChanged) {
384
+ this.updateDisplay_();
385
+ }
386
+ };
387
+
388
+ /**
389
+ * Update the display property of the flyout based whether it thinks it should
390
+ * be visible and whether its containing workspace is visible.
391
+ * @private
392
+ */
393
+ Blockly.Flyout.prototype.updateDisplay_ = function() {
394
+ var show = true;
395
+ if (!this.containerVisible_) {
396
+ show = false;
397
+ } else {
398
+ show = this.isVisible();
399
+ }
400
+ this.svgGroup_.style.display = show ? 'block' : 'none';
401
+ // Update the scrollbar's visibility too since it should mimic the
402
+ // flyout's visibility.
403
+ this.scrollbar.setContainerVisible(show);
404
+ };
405
+
406
+ /**
407
+ * Update the view based on coordinates calculated in position().
408
+ * @param {number} width The computed width of the flyout's SVG group
409
+ * @param {number} height The computed height of the flyout's SVG group.
410
+ * @param {number} x The computed x origin of the flyout's SVG group.
411
+ * @param {number} y The computed y origin of the flyout's SVG group.
412
+ * @protected
413
+ */
414
+ Blockly.Flyout.prototype.positionAt_ = function(width, height, x, y) {
415
+ this.svgGroup_.setAttribute("width", width);
416
+ this.svgGroup_.setAttribute("height", height);
417
+ if (this.svgGroup_.tagName == 'svg') {
418
+ var transform = 'translate(' + x + 'px,' + y + 'px)';
419
+ Blockly.utils.dom.setCssTransform(this.svgGroup_, transform);
420
+ } else {
421
+ // IE and Edge don't support CSS transforms on SVG elements so
422
+ // it's important to set the transform on the SVG element itself
423
+ var transform = 'translate(' + x + ',' + y + ')';
424
+ this.svgGroup_.setAttribute("transform", transform);
425
+ }
426
+
427
+ // Update the scrollbar (if one exists).
428
+ if (this.scrollbar) {
429
+ // Set the scrollbars origin to be the top left of the flyout.
430
+ this.scrollbar.setOrigin(x, y);
431
+ this.scrollbar.resize();
432
+ // Set the position again so that if the metrics were the same (and the
433
+ // resize failed) our position is still updated.
434
+ this.scrollbar.setPosition(
435
+ this.scrollbar.position.x, this.scrollbar.position.y);
436
+ }
437
+ };
438
+
439
+ /**
440
+ * Hide and empty the flyout.
441
+ */
442
+ Blockly.Flyout.prototype.hide = function() {
443
+ if (!this.isVisible()) {
444
+ return;
445
+ }
446
+ this.setVisible(false);
447
+ // Delete all the event listeners.
448
+ for (var i = 0, listen; (listen = this.listeners_[i]); i++) {
449
+ Blockly.unbindEvent_(listen);
450
+ }
451
+ this.listeners_.length = 0;
452
+ if (this.reflowWrapper_) {
453
+ this.workspace_.removeChangeListener(this.reflowWrapper_);
454
+ this.reflowWrapper_ = null;
455
+ }
456
+ // Do NOT delete the blocks here. Wait until Flyout.show.
457
+ // https://neil.fraser.name/news/2014/08/09/
458
+ };
459
+
460
+ /**
461
+ * Show and populate the flyout.
462
+ * @param {!Blockly.utils.toolbox.FlyoutDefinition|string} flyoutDef Contents to display
463
+ * in the flyout. This is either an array of Nodes, a NodeList, a
464
+ * toolbox definition, or a string with the name of the dynamic category.
465
+ */
466
+ Blockly.Flyout.prototype.show = function(flyoutDef) {
467
+ this.workspace_.setResizesEnabled(false);
468
+ this.hide();
469
+ this.clearOldBlocks_();
470
+
471
+ // Handle dynamic categories, represented by a name instead of a list.
472
+ if (typeof flyoutDef == 'string') {
473
+ flyoutDef = this.getDynamicCategoryContents_(flyoutDef);
474
+ }
475
+ this.setVisible(true);
476
+
477
+ // Parse the Array, Node or NodeList into a a list of flyout items.
478
+ var parsedContent = Blockly.utils.toolbox.convertFlyoutDefToJsonArray(flyoutDef);
479
+ var flyoutInfo =
480
+ /** @type {{contents:!Array.<!Object>, gaps:!Array.<number>}} */ (
481
+ this.createFlyoutInfo_(parsedContent));
482
+
483
+ this.layout_(flyoutInfo.contents, flyoutInfo.gaps);
484
+
485
+ // IE 11 is an incompetent browser that fails to fire mouseout events.
486
+ // When the mouse is over the background, deselect all blocks.
487
+ var deselectAll = function() {
488
+ var topBlocks = this.workspace_.getTopBlocks(false);
489
+ for (var i = 0, block; (block = topBlocks[i]); i++) {
490
+ block.removeSelect();
491
+ }
492
+ };
493
+
494
+ this.listeners_.push(Blockly.bindEventWithChecks_(this.svgBackground_,
495
+ 'mouseover', this, deselectAll));
496
+
497
+ if (this.horizontalLayout) {
498
+ this.height_ = 0;
499
+ } else {
500
+ this.width_ = 0;
501
+ }
502
+ this.workspace_.setResizesEnabled(true);
503
+ this.reflow();
504
+
505
+ this.filterForCapacity_();
506
+
507
+ // Correctly position the flyout's scrollbar when it opens.
508
+ this.position();
509
+
510
+ this.reflowWrapper_ = this.reflow.bind(this);
511
+ this.workspace_.addChangeListener(this.reflowWrapper_);
512
+ };
513
+
514
+ /**
515
+ * Create the contents array and gaps array necessary to create the layout for
516
+ * the flyout.
517
+ * @param {!Blockly.utils.toolbox.FlyoutItemInfoArray} parsedContent The array
518
+ * of objects to show in the flyout.
519
+ * @return {{contents:Array.<Object>, gaps:Array.<number>}} The list of contents
520
+ * and gaps needed to lay out the flyout.
521
+ * @private
522
+ */
523
+ Blockly.Flyout.prototype.createFlyoutInfo_ = function(parsedContent) {
524
+ var contents = [];
525
+ var gaps = [];
526
+ this.permanentlyDisabled_.length = 0;
527
+ var defaultGap = this.horizontalLayout ? this.GAP_X : this.GAP_Y;
528
+ for (var i = 0, contentInfo; (contentInfo = parsedContent[i]); i++) {
529
+
530
+ if (contentInfo['custom']) {
531
+ var customInfo = /** @type {!Blockly.utils.toolbox.DynamicCategoryInfo} */ (contentInfo);
532
+ var categoryName = customInfo['custom'];
533
+ var flyoutDef = this.getDynamicCategoryContents_(categoryName);
534
+ var parsedDynamicContent = /** @type {!Blockly.utils.toolbox.FlyoutItemInfoArray} */
535
+ (Blockly.utils.toolbox.convertFlyoutDefToJsonArray(flyoutDef));
536
+ parsedContent.splice.apply(parsedContent, [i, 1].concat(parsedDynamicContent));
537
+ contentInfo = parsedContent[i];
538
+ }
539
+
540
+ switch (contentInfo['kind'].toUpperCase()) {
541
+ case 'BLOCK':
542
+ var blockInfo = /** @type {!Blockly.utils.toolbox.BlockInfo} */ (contentInfo);
543
+ var blockXml = this.getBlockXml_(blockInfo);
544
+ var block = this.createBlock_(blockXml);
545
+ // This is a deprecated method for adding gap to a block.
546
+ // <block type="math_arithmetic" gap="8"></block>
547
+ var gap = parseInt(blockInfo['gap'] || blockXml.getAttribute('gap'), 10);
548
+ gaps.push(isNaN(gap) ? defaultGap : gap);
549
+ contents.push({type: 'block', block: block});
550
+ break;
551
+ case 'SEP':
552
+ var sepInfo = /** @type {!Blockly.utils.toolbox.SeparatorInfo} */ (contentInfo);
553
+ this.addSeparatorGap_(sepInfo, gaps, defaultGap);
554
+ break;
555
+ case 'LABEL':
556
+ var labelInfo = /** @type {!Blockly.utils.toolbox.LabelInfo} */ (contentInfo);
557
+ // A label is a button with different styling.
558
+ var label = this.createButton_(labelInfo, /** isLabel */ true);
559
+ contents.push({type: 'button', button: label});
560
+ gaps.push(defaultGap);
561
+ break;
562
+ case 'BUTTON':
563
+ var buttonInfo = /** @type {!Blockly.utils.toolbox.ButtonInfo} */ (contentInfo);
564
+ var button = this.createButton_(buttonInfo, /** isLabel */ false);
565
+ contents.push({type: 'button', button: button});
566
+ gaps.push(defaultGap);
567
+ break;
568
+ }
569
+ }
570
+ return {contents: contents, gaps: gaps};
571
+ };
572
+
573
+ /**
574
+ * Gets the flyout definition for the dynamic category.
575
+ * @param {string} categoryName The name of the dynamic category.
576
+ * @return {!Array.<!Element>} The array of flyout items.
577
+ * @private
578
+ */
579
+ Blockly.Flyout.prototype.getDynamicCategoryContents_ = function(categoryName) {
580
+ // Look up the correct category generation function and call that to get a
581
+ // valid XML list.
582
+ var fnToApply = this.workspace_.targetWorkspace.getToolboxCategoryCallback(
583
+ categoryName);
584
+ if (typeof fnToApply != 'function') {
585
+ throw TypeError('Couldn\'t find a callback function when opening' +
586
+ ' a toolbox category.');
587
+ }
588
+ var flyoutDef = fnToApply(this.workspace_.targetWorkspace);
589
+ if (!Array.isArray(flyoutDef)) {
590
+ throw new TypeError('Result of toolbox category callback must be an array.');
591
+ }
592
+ return flyoutDef;
593
+ };
594
+
595
+ /**
596
+ * Creates a flyout button or a flyout label.
597
+ * @param {!Blockly.utils.toolbox.ButtonOrLabelInfo} btnInfo
598
+ * The object holding information about a button or a label.
599
+ * @param {boolean} isLabel True if the button is a label, false otherwise.
600
+ * @return {!Blockly.FlyoutButton} The object used to display the button in the
601
+ * flyout.
602
+ * @private
603
+ */
604
+ Blockly.Flyout.prototype.createButton_ = function(btnInfo, isLabel) {
605
+ if (!Blockly.FlyoutButton) {
606
+ throw Error('Missing require for Blockly.FlyoutButton');
607
+ }
608
+ var curButton = new Blockly.FlyoutButton(this.workspace_,
609
+ /** @type {!Blockly.WorkspaceSvg} */ (this.targetWorkspace), btnInfo,
610
+ isLabel);
611
+ return curButton;
612
+ };
613
+
614
+ /**
615
+ * Create a block from the xml and permanently disable any blocks that were
616
+ * defined as disabled.
617
+ * @param {!Element} blockXml The xml of the block.
618
+ * @return {!Blockly.BlockSvg} The block created from the blockXml.
619
+ * @private
620
+ */
621
+ Blockly.Flyout.prototype.createBlock_ = function(blockXml) {
622
+ var curBlock = /** @type {!Blockly.BlockSvg} */ (
623
+ Blockly.Xml.domToBlock(blockXml, this.workspace_));
624
+ if (!curBlock.isEnabled()) {
625
+ // Record blocks that were initially disabled.
626
+ // Do not enable these blocks as a result of capacity filtering.
627
+ this.permanentlyDisabled_.push(curBlock);
628
+ }
629
+ return curBlock;
630
+ };
631
+
632
+ /**
633
+ * Get the xml from the block info object.
634
+ * @param {!Blockly.utils.toolbox.BlockInfo} blockInfo The object holding
635
+ * information about a block.
636
+ * @return {!Element} The xml for the block.
637
+ * @throws {Error} if the xml is not a valid block definition.
638
+ * @private
639
+ */
640
+ Blockly.Flyout.prototype.getBlockXml_ = function(blockInfo) {
641
+ var blockElement = null;
642
+ var blockXml = blockInfo['blockxml'];
643
+
644
+ if (blockXml && typeof blockXml != 'string') {
645
+ blockElement = blockXml;
646
+ } else if (blockXml && typeof blockXml == 'string') {
647
+ blockElement = Blockly.Xml.textToDom(blockXml);
648
+ blockInfo['blockxml'] = blockElement;
649
+ } else if (blockInfo['type']) {
650
+ blockElement = Blockly.utils.xml.createElement('xml');
651
+ blockElement.setAttribute('type', blockInfo['type']);
652
+ blockElement.setAttribute('disabled', blockInfo['disabled']);
653
+ blockInfo['blockxml'] = blockElement;
654
+ }
655
+
656
+ if (!blockElement) {
657
+ throw Error('Error: Invalid block definition. Block definition must have blockxml or type.');
658
+ }
659
+ return blockElement;
660
+ };
661
+
662
+ /**
663
+ * Add the necessary gap in the flyout for a separator.
664
+ * @param {!Blockly.utils.toolbox.SeparatorInfo} sepInfo The object holding
665
+ * information about a separator.
666
+ * @param {!Array.<number>} gaps The list gaps between items in the flyout.
667
+ * @param {number} defaultGap The default gap between the button and next element.
668
+ * @private
669
+ */
670
+ Blockly.Flyout.prototype.addSeparatorGap_ = function(sepInfo, gaps, defaultGap) {
671
+ // Change the gap between two toolbox elements.
672
+ // <sep gap="36"></sep>
673
+ // The default gap is 24, can be set larger or smaller.
674
+ // This overwrites the gap attribute on the previous element.
675
+ var newGap = parseInt(sepInfo['gap'], 10);
676
+ // Ignore gaps before the first block.
677
+ if (!isNaN(newGap) && gaps.length > 0) {
678
+ gaps[gaps.length - 1] = newGap;
679
+ } else {
680
+ gaps.push(defaultGap);
681
+ }
682
+ };
683
+
684
+ /**
685
+ * Delete blocks, mats and buttons from a previous showing of the flyout.
686
+ * @private
687
+ */
688
+ Blockly.Flyout.prototype.clearOldBlocks_ = function() {
689
+ // Delete any blocks from a previous showing.
690
+ var oldBlocks = this.workspace_.getTopBlocks(false);
691
+ for (var i = 0, block; (block = oldBlocks[i]); i++) {
692
+ if (block.workspace == this.workspace_) {
693
+ block.dispose(false, false);
694
+ }
695
+ }
696
+ // Delete any mats from a previous showing.
697
+ for (var j = 0; j < this.mats_.length; j++) {
698
+ var rect = this.mats_[j];
699
+ if (rect) {
700
+ Blockly.Tooltip.unbindMouseEvents(rect);
701
+ Blockly.utils.dom.removeNode(rect);
702
+ }
703
+ }
704
+ this.mats_.length = 0;
705
+ // Delete any buttons from a previous showing.
706
+ for (var i = 0, button; (button = this.buttons_[i]); i++) {
707
+ button.dispose();
708
+ }
709
+ this.buttons_.length = 0;
710
+
711
+ // Clear potential variables from the previous showing.
712
+ this.workspace_.getPotentialVariableMap().clear();
713
+ };
714
+
715
+ /**
716
+ * Add listeners to a block that has been added to the flyout.
717
+ * @param {!SVGElement} root The root node of the SVG group the block is in.
718
+ * @param {!Blockly.BlockSvg} block The block to add listeners for.
719
+ * @param {!SVGElement} rect The invisible rectangle under the block that acts
720
+ * as a mat for that block.
721
+ * @protected
722
+ */
723
+ Blockly.Flyout.prototype.addBlockListeners_ = function(root, block, rect) {
724
+ this.listeners_.push(Blockly.bindEventWithChecks_(root, 'mousedown', null,
725
+ this.blockMouseDown_(block)));
726
+ this.listeners_.push(Blockly.bindEventWithChecks_(rect, 'mousedown', null,
727
+ this.blockMouseDown_(block)));
728
+ this.listeners_.push(Blockly.bindEvent_(root, 'mouseenter', block,
729
+ block.addSelect));
730
+ this.listeners_.push(Blockly.bindEvent_(root, 'mouseleave', block,
731
+ block.removeSelect));
732
+ this.listeners_.push(Blockly.bindEvent_(rect, 'mouseenter', block,
733
+ block.addSelect));
734
+ this.listeners_.push(Blockly.bindEvent_(rect, 'mouseleave', block,
735
+ block.removeSelect));
736
+ };
737
+
738
+ /**
739
+ * Handle a mouse-down on an SVG block in a non-closing flyout.
740
+ * @param {!Blockly.BlockSvg} block The flyout block to copy.
741
+ * @return {!Function} Function to call when block is clicked.
742
+ * @private
743
+ */
744
+ Blockly.Flyout.prototype.blockMouseDown_ = function(block) {
745
+ var flyout = this;
746
+ return function(e) {
747
+ var gesture = flyout.targetWorkspace.getGesture(e);
748
+ if (gesture) {
749
+ gesture.setStartBlock(block);
750
+ gesture.handleFlyoutStart(e, flyout);
751
+ }
752
+ };
753
+ };
754
+
755
+ /**
756
+ * Mouse down on the flyout background. Start a vertical scroll drag.
757
+ * @param {!Event} e Mouse down event.
758
+ * @private
759
+ */
760
+ Blockly.Flyout.prototype.onMouseDown_ = function(e) {
761
+ var gesture = this.targetWorkspace.getGesture(e);
762
+ if (gesture) {
763
+ gesture.handleFlyoutStart(e, this);
764
+ }
765
+ };
766
+
767
+ /**
768
+ * Does this flyout allow you to create a new instance of the given block?
769
+ * Used for deciding if a block can be "dragged out of" the flyout.
770
+ * @param {!Blockly.BlockSvg} block The block to copy from the flyout.
771
+ * @return {boolean} True if you can create a new instance of the block, false
772
+ * otherwise.
773
+ * @package
774
+ */
775
+ Blockly.Flyout.prototype.isBlockCreatable_ = function(block) {
776
+ return block.isEnabled();
777
+ };
778
+
779
+ /**
780
+ * Create a copy of this block on the workspace.
781
+ * @param {!Blockly.BlockSvg} originalBlock The block to copy from the flyout.
782
+ * @return {!Blockly.BlockSvg} The newly created block.
783
+ * @throws {Error} if something went wrong with deserialization.
784
+ * @package
785
+ */
786
+ Blockly.Flyout.prototype.createBlock = function(originalBlock) {
787
+ var newBlock = null;
788
+ Blockly.Events.disable();
789
+ var variablesBeforeCreation = this.targetWorkspace.getAllVariables();
790
+ this.targetWorkspace.setResizesEnabled(false);
791
+ try {
792
+ newBlock = this.placeNewBlock_(originalBlock);
793
+ } finally {
794
+ Blockly.Events.enable();
795
+ }
796
+
797
+ // Close the flyout.
798
+ Blockly.hideChaff();
799
+
800
+ var newVariables = Blockly.Variables.getAddedVariables(this.targetWorkspace,
801
+ variablesBeforeCreation);
802
+
803
+ if (Blockly.Events.isEnabled()) {
804
+ Blockly.Events.setGroup(true);
805
+ // Fire a VarCreate event for each (if any) new variable created.
806
+ for (var i = 0; i < newVariables.length; i++) {
807
+ var thisVariable = newVariables[i];
808
+ Blockly.Events.fire(new Blockly.Events.VarCreate(thisVariable));
809
+ }
810
+
811
+ // Block events come after var events, in case they refer to newly created
812
+ // variables.
813
+ Blockly.Events.fire(new Blockly.Events.Create(newBlock));
814
+ }
815
+ if (this.autoClose) {
816
+ this.hide();
817
+ } else {
818
+ this.filterForCapacity_();
819
+ }
820
+ return newBlock;
821
+ };
822
+
823
+ /**
824
+ * Initialize the given button: move it to the correct location,
825
+ * add listeners, etc.
826
+ * @param {!Blockly.FlyoutButton} button The button to initialize and place.
827
+ * @param {number} x The x position of the cursor during this layout pass.
828
+ * @param {number} y The y position of the cursor during this layout pass.
829
+ * @protected
830
+ */
831
+ Blockly.Flyout.prototype.initFlyoutButton_ = function(button, x, y) {
832
+ var buttonSvg = button.createDom();
833
+ button.moveTo(x, y);
834
+ button.show();
835
+ // Clicking on a flyout button or label is a lot like clicking on the
836
+ // flyout background.
837
+ this.listeners_.push(
838
+ Blockly.bindEventWithChecks_(
839
+ buttonSvg, 'mousedown', this, this.onMouseDown_));
840
+
841
+ this.buttons_.push(button);
842
+ };
843
+
844
+ /**
845
+ * Create and place a rectangle corresponding to the given block.
846
+ * @param {!Blockly.BlockSvg} block The block to associate the rect to.
847
+ * @param {number} x The x position of the cursor during this layout pass.
848
+ * @param {number} y The y position of the cursor during this layout pass.
849
+ * @param {!{height: number, width: number}} blockHW The height and width of the
850
+ * block.
851
+ * @param {number} index The index into the mats list where this rect should be
852
+ * placed.
853
+ * @return {!SVGElement} Newly created SVG element for the rectangle behind the
854
+ * block.
855
+ * @protected
856
+ */
857
+ Blockly.Flyout.prototype.createRect_ = function(block, x, y, blockHW, index) {
858
+ // Create an invisible rectangle under the block to act as a button. Just
859
+ // using the block as a button is poor, since blocks have holes in them.
860
+ var rect = Blockly.utils.dom.createSvgElement(
861
+ Blockly.utils.Svg.RECT,
862
+ {
863
+ 'fill-opacity': 0,
864
+ 'x': x,
865
+ 'y': y,
866
+ 'height': blockHW.height,
867
+ 'width': blockHW.width
868
+ }, null);
869
+ rect.tooltip = block;
870
+ Blockly.Tooltip.bindMouseEvents(rect);
871
+ // Add the rectangles under the blocks, so that the blocks' tooltips work.
872
+ this.workspace_.getCanvas().insertBefore(rect, block.getSvgRoot());
873
+
874
+ block.flyoutRect_ = rect;
875
+ this.mats_[index] = rect;
876
+ return rect;
877
+ };
878
+
879
+ /**
880
+ * Move a rectangle to sit exactly behind a block, taking into account tabs,
881
+ * hats, and any other protrusions we invent.
882
+ * @param {!SVGElement} rect The rectangle to move directly behind the block.
883
+ * @param {!Blockly.BlockSvg} block The block the rectangle should be behind.
884
+ * @protected
885
+ */
886
+ Blockly.Flyout.prototype.moveRectToBlock_ = function(rect, block) {
887
+ var blockHW = block.getHeightWidth();
888
+ rect.setAttribute('width', blockHW.width);
889
+ rect.setAttribute('height', blockHW.height);
890
+
891
+ var blockXY = block.getRelativeToSurfaceXY();
892
+ rect.setAttribute('y', blockXY.y);
893
+ rect.setAttribute('x', this.RTL ? blockXY.x - blockHW.width : blockXY.x);
894
+ };
895
+
896
+ /**
897
+ * Filter the blocks on the flyout to disable the ones that are above the
898
+ * capacity limit. For instance, if the user may only place two more blocks on
899
+ * the workspace, an "a + b" block that has two shadow blocks would be disabled.
900
+ * @private
901
+ */
902
+ Blockly.Flyout.prototype.filterForCapacity_ = function() {
903
+ var blocks = this.workspace_.getTopBlocks(false);
904
+ for (var i = 0, block; (block = blocks[i]); i++) {
905
+ if (this.permanentlyDisabled_.indexOf(block) == -1) {
906
+ var enable = this.targetWorkspace
907
+ .isCapacityAvailable(Blockly.utils.getBlockTypeCounts(block));
908
+ while (block) {
909
+ block.setEnabled(enable);
910
+ block = block.getNextBlock();
911
+ }
912
+ }
913
+ }
914
+ };
915
+
916
+ /**
917
+ * Reflow blocks and their mats.
918
+ */
919
+ Blockly.Flyout.prototype.reflow = function() {
920
+ if (this.reflowWrapper_) {
921
+ this.workspace_.removeChangeListener(this.reflowWrapper_);
922
+ }
923
+ this.reflowInternal_();
924
+ if (this.reflowWrapper_) {
925
+ this.workspace_.addChangeListener(this.reflowWrapper_);
926
+ }
927
+ };
928
+
929
+ /**
930
+ * @return {boolean} True if this flyout may be scrolled with a scrollbar or by
931
+ * dragging.
932
+ * @package
933
+ */
934
+ Blockly.Flyout.prototype.isScrollable = function() {
935
+ return this.scrollbar ? this.scrollbar.isVisible() : false;
936
+ };
937
+
938
+ /**
939
+ * Copy a block from the flyout to the workspace and position it correctly.
940
+ * @param {!Blockly.BlockSvg} oldBlock The flyout block to copy.
941
+ * @return {!Blockly.BlockSvg} The new block in the main workspace.
942
+ * @private
943
+ */
944
+ Blockly.Flyout.prototype.placeNewBlock_ = function(oldBlock) {
945
+ var targetWorkspace = this.targetWorkspace;
946
+ var svgRootOld = oldBlock.getSvgRoot();
947
+ if (!svgRootOld) {
948
+ throw Error('oldBlock is not rendered.');
949
+ }
950
+
951
+ // Create the new block by cloning the block in the flyout (via XML).
952
+ // This cast assumes that the oldBlock can not be an insertion marker.
953
+ var xml = /** @type {!Element} */ (Blockly.Xml.blockToDom(oldBlock, true));
954
+ // The target workspace would normally resize during domToBlock, which will
955
+ // lead to weird jumps. Save it for terminateDrag.
956
+ targetWorkspace.setResizesEnabled(false);
957
+
958
+ // Using domToBlock instead of domToWorkspace means that the new block will be
959
+ // placed at position (0, 0) in main workspace units.
960
+ var block = /** @type {!Blockly.BlockSvg} */
961
+ (Blockly.Xml.domToBlock(xml, targetWorkspace));
962
+ var svgRootNew = block.getSvgRoot();
963
+ if (!svgRootNew) {
964
+ throw Error('block is not rendered.');
965
+ }
966
+
967
+ // The offset in pixels between the main workspace's origin and the upper left
968
+ // corner of the injection div.
969
+ var mainOffsetPixels = targetWorkspace.getOriginOffsetInPixels();
970
+
971
+ // The offset in pixels between the flyout workspace's origin and the upper
972
+ // left corner of the injection div.
973
+ var flyoutOffsetPixels = this.workspace_.getOriginOffsetInPixels();
974
+
975
+ // The position of the old block in flyout workspace coordinates.
976
+ var oldBlockPos = oldBlock.getRelativeToSurfaceXY();
977
+ // The position of the old block in pixels relative to the flyout
978
+ // workspace's origin.
979
+ oldBlockPos.scale(this.workspace_.scale);
980
+
981
+ // The position of the old block in pixels relative to the upper left corner
982
+ // of the injection div.
983
+ var oldBlockOffsetPixels = Blockly.utils.Coordinate.sum(flyoutOffsetPixels,
984
+ oldBlockPos);
985
+
986
+ // The position of the old block in pixels relative to the origin of the
987
+ // main workspace.
988
+ var finalOffset = Blockly.utils.Coordinate.difference(oldBlockOffsetPixels,
989
+ mainOffsetPixels);
990
+ // The position of the old block in main workspace coordinates.
991
+ finalOffset.scale(1 / targetWorkspace.scale);
992
+
993
+ block.moveBy(finalOffset.x, finalOffset.y);
994
+ return block;
995
+ };
996
+
997
+ /**
998
+ * Handles the given action.
999
+ * This is only triggered when keyboard accessibility mode is enabled.
1000
+ * @param {!Blockly.Action} action The action to be handled.
1001
+ * @return {boolean} True if the flyout handled the action, false otherwise.
1002
+ * @package
1003
+ */
1004
+ Blockly.Flyout.prototype.onBlocklyAction = function(action) {
1005
+ var cursor = this.workspace_.getCursor();
1006
+ return cursor.onBlocklyAction(action);
1007
+ };
1008
+
1009
+ /**
1010
+ * Return the deletion rectangle for this flyout in viewport coordinates.
1011
+ * @return {Blockly.utils.Rect} Rectangle in which to delete.
1012
+ */
1013
+ Blockly.Flyout.prototype.getClientRect;
1014
+
1015
+ /**
1016
+ * Position the flyout.
1017
+ * @return {void}
1018
+ */
1019
+ Blockly.Flyout.prototype.position;
1020
+
1021
+ /**
1022
+ * Determine if a drag delta is toward the workspace, based on the position
1023
+ * and orientation of the flyout. This is used in determineDragIntention_ to
1024
+ * determine if a new block should be created or if the flyout should scroll.
1025
+ * @param {!Blockly.utils.Coordinate} currentDragDeltaXY How far the pointer has
1026
+ * moved from the position at mouse down, in pixel units.
1027
+ * @return {boolean} True if the drag is toward the workspace.
1028
+ * @package
1029
+ */
1030
+ Blockly.Flyout.prototype.isDragTowardWorkspace;
1031
+
1032
+ /**
1033
+ * Return an object with all the metrics required to size scrollbars for the
1034
+ * flyout.
1035
+ * @return {Blockly.utils.Metrics} Contains size and position metrics of the
1036
+ * flyout.
1037
+ * @protected
1038
+ */
1039
+ Blockly.Flyout.prototype.getMetrics_;
1040
+
1041
+ /**
1042
+ * Sets the translation of the flyout to match the scrollbars.
1043
+ * @param {!{x:number,y:number}} xyRatio Contains a y property which is a float
1044
+ * between 0 and 1 specifying the degree of scrolling and a
1045
+ * similar x property.
1046
+ * @protected
1047
+ */
1048
+ Blockly.Flyout.prototype.setMetrics_;
1049
+
1050
+ /**
1051
+ * Lay out the blocks in the flyout.
1052
+ * @param {!Array.<!Object>} contents The blocks and buttons to lay out.
1053
+ * @param {!Array.<number>} gaps The visible gaps between blocks.
1054
+ * @protected
1055
+ */
1056
+ Blockly.Flyout.prototype.layout_;
1057
+
1058
+ /**
1059
+ * Scroll the flyout.
1060
+ * @param {!Event} e Mouse wheel scroll event.
1061
+ * @protected
1062
+ */
1063
+ Blockly.Flyout.prototype.wheel_;
1064
+
1065
+ /**
1066
+ * Compute height of flyout. Position mat under each block.
1067
+ * For RTL: Lay out the blocks right-aligned.
1068
+ * @return {void}
1069
+ * @protected
1070
+ */
1071
+ Blockly.Flyout.prototype.reflowInternal_;