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,95 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Components for the variable model.
9
+ * @author marisaleung@google.com (Marisa Leung)
10
+ */
11
+ 'use strict';
12
+
13
+ goog.provide('Blockly.VariableModel');
14
+
15
+ goog.require('Blockly.Events');
16
+ goog.require('Blockly.Events.VarCreate');
17
+ goog.require('Blockly.utils');
18
+
19
+
20
+ /**
21
+ * Class for a variable model.
22
+ * Holds information for the variable including name, ID, and type.
23
+ * @param {!Blockly.Workspace} workspace The variable's workspace.
24
+ * @param {string} name The name of the variable. This must be unique across
25
+ * variables and procedures.
26
+ * @param {string=} opt_type The type of the variable like 'int' or 'string'.
27
+ * Does not need to be unique. Field_variable can filter variables based on
28
+ * their type. This will default to '' which is a specific type.
29
+ * @param {string=} opt_id The unique ID of the variable. This will default to
30
+ * a UUID.
31
+ * @see {Blockly.FieldVariable}
32
+ * @constructor
33
+ */
34
+ Blockly.VariableModel = function(workspace, name, opt_type, opt_id) {
35
+ /**
36
+ * The workspace the variable is in.
37
+ * @type {!Blockly.Workspace}
38
+ */
39
+ this.workspace = workspace;
40
+
41
+ /**
42
+ * The name of the variable, typically defined by the user. It must be
43
+ * unique across all names used for procedures and variables. It may be
44
+ * changed by the user.
45
+ * @type {string}
46
+ */
47
+ this.name = name;
48
+
49
+ /**
50
+ * The type of the variable, such as 'int' or 'sound_effect'. This may be
51
+ * used to build a list of variables of a specific type. By default this is
52
+ * the empty string '', which is a specific type.
53
+ * @see {Blockly.FieldVariable}
54
+ * @type {string}
55
+ */
56
+ this.type = opt_type || '';
57
+
58
+ /**
59
+ * A unique id for the variable. This should be defined at creation and
60
+ * not change, even if the name changes. In most cases this should be a
61
+ * UUID.
62
+ * @type {string}
63
+ * @private
64
+ */
65
+ this.id_ = opt_id || Blockly.utils.genUid();
66
+
67
+ Blockly.Events.fire(new Blockly.Events.VarCreate(this));
68
+ };
69
+
70
+ /**
71
+ * @return {string} The ID for the variable.
72
+ */
73
+ Blockly.VariableModel.prototype.getId = function() {
74
+ return this.id_;
75
+ };
76
+
77
+ /**
78
+ * A custom compare function for the VariableModel objects.
79
+ * @param {Blockly.VariableModel} var1 First variable to compare.
80
+ * @param {Blockly.VariableModel} var2 Second variable to compare.
81
+ * @return {number} -1 if name of var1 is less than name of var2, 0 if equal,
82
+ * and 1 if greater.
83
+ * @package
84
+ */
85
+ Blockly.VariableModel.compareByName = function(var1, var2) {
86
+ var name1 = var1.name.toLowerCase();
87
+ var name2 = var2.name.toLowerCase();
88
+ if (name1 < name2) {
89
+ return -1;
90
+ } else if (name1 == name2) {
91
+ return 0;
92
+ } else {
93
+ return 1;
94
+ }
95
+ };
@@ -0,0 +1,571 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2012 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Utility functions for handling variables.
9
+ * @author fraser@google.com (Neil Fraser)
10
+ */
11
+ 'use strict';
12
+
13
+ /**
14
+ * @name Blockly.Variables
15
+ * @namespace
16
+ */
17
+ goog.provide('Blockly.Variables');
18
+
19
+ goog.require('Blockly.Blocks');
20
+ goog.require('Blockly.Msg');
21
+ goog.require('Blockly.utils');
22
+ goog.require('Blockly.utils.xml');
23
+ goog.require('Blockly.VariableModel');
24
+ goog.require('Blockly.Xml');
25
+
26
+
27
+ /**
28
+ * Constant to separate variable names from procedures and generated functions
29
+ * when running generators.
30
+ * @deprecated Use Blockly.VARIABLE_CATEGORY_NAME
31
+ */
32
+ Blockly.Variables.NAME_TYPE = Blockly.VARIABLE_CATEGORY_NAME;
33
+
34
+ /**
35
+ * Find all user-created variables that are in use in the workspace.
36
+ * For use by generators.
37
+ * To get a list of all variables on a workspace, including unused variables,
38
+ * call Workspace.getAllVariables.
39
+ * @param {!Blockly.Workspace} ws The workspace to search for variables.
40
+ * @return {!Array.<!Blockly.VariableModel>} Array of variable models.
41
+ */
42
+ Blockly.Variables.allUsedVarModels = function(ws) {
43
+ var blocks = ws.getAllBlocks(false);
44
+ var variableHash = Object.create(null);
45
+ // Iterate through every block and add each variable to the hash.
46
+ for (var i = 0; i < blocks.length; i++) {
47
+ var blockVariables = blocks[i].getVarModels();
48
+ if (blockVariables) {
49
+ for (var j = 0; j < blockVariables.length; j++) {
50
+ var variable = blockVariables[j];
51
+ var id = variable.getId();
52
+ if (id) {
53
+ variableHash[id] = variable;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ // Flatten the hash into a list.
59
+ var variableList = [];
60
+ for (var id in variableHash) {
61
+ variableList.push(variableHash[id]);
62
+ }
63
+ return variableList;
64
+ };
65
+
66
+ /**
67
+ * @private
68
+ * @type {Object<string,boolean>}
69
+ */
70
+ Blockly.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_ = {};
71
+
72
+ /**
73
+ * Find all developer variables used by blocks in the workspace.
74
+ * Developer variables are never shown to the user, but are declared as global
75
+ * variables in the generated code.
76
+ * To declare developer variables, define the getDeveloperVariables function on
77
+ * your block and return a list of variable names.
78
+ * For use by generators.
79
+ * @param {!Blockly.Workspace} workspace The workspace to search.
80
+ * @return {!Array.<string>} A list of non-duplicated variable names.
81
+ */
82
+ Blockly.Variables.allDeveloperVariables = function(workspace) {
83
+ var blocks = workspace.getAllBlocks(false);
84
+ var variableHash = Object.create(null);
85
+ for (var i = 0, block; (block = blocks[i]); i++) {
86
+ var getDeveloperVariables = block.getDeveloperVariables;
87
+ if (!getDeveloperVariables && block.getDeveloperVars) {
88
+ // August 2018: getDeveloperVars() was deprecated and renamed
89
+ // getDeveloperVariables().
90
+ getDeveloperVariables = block.getDeveloperVars;
91
+ if (!Blockly.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_[
92
+ block.type]) {
93
+ console.warn('Function getDeveloperVars() deprecated. Use ' +
94
+ 'getDeveloperVariables() (block type \'' + block.type + '\')');
95
+ Blockly.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_[
96
+ block.type] = true;
97
+ }
98
+ }
99
+ if (getDeveloperVariables) {
100
+ var devVars = getDeveloperVariables();
101
+ for (var j = 0; j < devVars.length; j++) {
102
+ variableHash[devVars[j]] = true;
103
+ }
104
+ }
105
+ }
106
+
107
+ // Flatten the hash into a list.
108
+ return Object.keys(variableHash);
109
+ };
110
+
111
+ /**
112
+ * Construct the elements (blocks and button) required by the flyout for the
113
+ * variable category.
114
+ * @param {!Blockly.Workspace} workspace The workspace containing variables.
115
+ * @return {!Array.<!Element>} Array of XML elements.
116
+ */
117
+ Blockly.Variables.flyoutCategory = function(workspace) {
118
+ var xmlList = [];
119
+ var button = document.createElement('button');
120
+ button.setAttribute('text', '%{BKY_NEW_VARIABLE}');
121
+ button.setAttribute('callbackKey', 'CREATE_VARIABLE');
122
+
123
+ workspace.registerButtonCallback('CREATE_VARIABLE', function(button) {
124
+ Blockly.Variables.createVariableButtonHandler(button.getTargetWorkspace());
125
+ });
126
+
127
+ xmlList.push(button);
128
+
129
+ var blockList = Blockly.Variables.flyoutCategoryBlocks(workspace);
130
+ xmlList = xmlList.concat(blockList);
131
+ return xmlList;
132
+ };
133
+
134
+ /**
135
+ * Construct the blocks required by the flyout for the variable category.
136
+ * @param {!Blockly.Workspace} workspace The workspace containing variables.
137
+ * @return {!Array.<!Element>} Array of XML block elements.
138
+ */
139
+ Blockly.Variables.flyoutCategoryBlocks = function(workspace) {
140
+ var variableModelList = workspace.getVariablesOfType('');
141
+
142
+ var xmlList = [];
143
+ if (variableModelList.length > 0) {
144
+ // New variables are added to the end of the variableModelList.
145
+ var mostRecentVariable = variableModelList[variableModelList.length - 1];
146
+ if (Blockly.Blocks['variables_set']) {
147
+ var block = Blockly.utils.xml.createElement('block');
148
+ block.setAttribute('type', 'variables_set');
149
+ block.setAttribute('gap', Blockly.Blocks['math_change'] ? 8 : 24);
150
+ block.appendChild(
151
+ Blockly.Variables.generateVariableFieldDom(mostRecentVariable));
152
+ xmlList.push(block);
153
+ }
154
+ if (Blockly.Blocks['math_change']) {
155
+ var block = Blockly.utils.xml.createElement('block');
156
+ block.setAttribute('type', 'math_change');
157
+ block.setAttribute('gap', Blockly.Blocks['variables_get'] ? 20 : 8);
158
+ block.appendChild(
159
+ Blockly.Variables.generateVariableFieldDom(mostRecentVariable));
160
+ var value = Blockly.Xml.textToDom(
161
+ '<value name="DELTA">' +
162
+ '<shadow type="math_number">' +
163
+ '<field name="NUM">1</field>' +
164
+ '</shadow>' +
165
+ '</value>');
166
+ block.appendChild(value);
167
+ xmlList.push(block);
168
+ }
169
+
170
+ if (Blockly.Blocks['variables_get']) {
171
+ variableModelList.sort(Blockly.VariableModel.compareByName);
172
+ for (var i = 0, variable; (variable = variableModelList[i]); i++) {
173
+ var block = Blockly.utils.xml.createElement('block');
174
+ block.setAttribute('type', 'variables_get');
175
+ block.setAttribute('gap', 8);
176
+ block.appendChild(Blockly.Variables.generateVariableFieldDom(variable));
177
+ xmlList.push(block);
178
+ }
179
+ }
180
+ }
181
+ return xmlList;
182
+ };
183
+
184
+ Blockly.Variables.VAR_LETTER_OPTIONS = 'ijkmnopqrstuvwxyzabcdefgh'; // No 'l'.
185
+
186
+ /**
187
+ * Return a new variable name that is not yet being used. This will try to
188
+ * generate single letter variable names in the range 'i' to 'z' to start with.
189
+ * If no unique name is located it will try 'i' to 'z', 'a' to 'h',
190
+ * then 'i2' to 'z2' etc. Skip 'l'.
191
+ * @param {!Blockly.Workspace} workspace The workspace to be unique in.
192
+ * @return {string} New variable name.
193
+ */
194
+ Blockly.Variables.generateUniqueName = function(workspace) {
195
+ return Blockly.Variables.generateUniqueNameFromOptions(
196
+ Blockly.Variables.VAR_LETTER_OPTIONS.charAt(0),
197
+ workspace.getAllVariableNames()
198
+ );
199
+ };
200
+
201
+ /**
202
+ * Returns a unique name that is not present in the usedNames array. This
203
+ * will try to generate single letter names in the range a -> z (skip l). It
204
+ * will start with the character passed to startChar.
205
+ * @param {string} startChar The character to start the search at.
206
+ * @param {!Array.<string>} usedNames A list of all of the used names.
207
+ * @return {string} A unique name that is not present in the usedNames array.
208
+ */
209
+ Blockly.Variables.generateUniqueNameFromOptions = function(startChar, usedNames) {
210
+ if (!usedNames.length) {
211
+ return startChar;
212
+ }
213
+
214
+ var letters = Blockly.Variables.VAR_LETTER_OPTIONS;
215
+ var suffix = '';
216
+ var letterIndex = letters.indexOf(startChar);
217
+ var potName = startChar;
218
+
219
+ // eslint-disable-next-line no-constant-condition
220
+ while (true) {
221
+ var inUse = false;
222
+ for (var i = 0; i < usedNames.length; i++) {
223
+ if (usedNames[i].toLowerCase() == potName) {
224
+ inUse = true;
225
+ break;
226
+ }
227
+ }
228
+ if (!inUse) {
229
+ return potName;
230
+ }
231
+
232
+ letterIndex++;
233
+ if (letterIndex == letters.length) {
234
+ // Reached the end of the character sequence so back to 'i'.
235
+ letterIndex = 0;
236
+ suffix = Number(suffix) + 1;
237
+ }
238
+ potName = letters.charAt(letterIndex) + suffix;
239
+ }
240
+ };
241
+
242
+ /**
243
+ * Handles "Create Variable" button in the default variables toolbox category.
244
+ * It will prompt the user for a variable name, including re-prompts if a name
245
+ * is already in use among the workspace's variables.
246
+ *
247
+ * Custom button handlers can delegate to this function, allowing variables
248
+ * types and after-creation processing. More complex customization (e.g.,
249
+ * prompting for variable type) is beyond the scope of this function.
250
+ *
251
+ * @param {!Blockly.Workspace} workspace The workspace on which to create the
252
+ * variable.
253
+ * @param {function(?string=)=} opt_callback A callback. It will be passed an
254
+ * acceptable new variable name, or null if change is to be aborted (cancel
255
+ * button), or undefined if an existing variable was chosen.
256
+ * @param {string=} opt_type The type of the variable like 'int', 'string', or
257
+ * ''. This will default to '', which is a specific type.
258
+ */
259
+ Blockly.Variables.createVariableButtonHandler = function(
260
+ workspace, opt_callback, opt_type) {
261
+ var type = opt_type || '';
262
+ // This function needs to be named so it can be called recursively.
263
+ var promptAndCheckWithAlert = function(defaultName) {
264
+ Blockly.Variables.promptName(Blockly.Msg['NEW_VARIABLE_TITLE'], defaultName,
265
+ function(text) {
266
+ if (text) {
267
+ var existing =
268
+ Blockly.Variables.nameUsedWithAnyType(text, workspace);
269
+ if (existing) {
270
+ if (existing.type == type) {
271
+ var msg = Blockly.Msg['VARIABLE_ALREADY_EXISTS'].replace(
272
+ '%1', existing.name);
273
+ } else {
274
+ var msg =
275
+ Blockly.Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE'];
276
+ msg = msg.replace('%1', existing.name).replace('%2', existing.type);
277
+ }
278
+ Blockly.alert(msg,
279
+ function() {
280
+ promptAndCheckWithAlert(text); // Recurse
281
+ });
282
+ } else {
283
+ // No conflict
284
+ workspace.createVariable(text, type);
285
+ if (opt_callback) {
286
+ opt_callback(text);
287
+ }
288
+ }
289
+ } else {
290
+ // User canceled prompt.
291
+ if (opt_callback) {
292
+ opt_callback(null);
293
+ }
294
+ }
295
+ });
296
+ };
297
+ promptAndCheckWithAlert('');
298
+ };
299
+
300
+ /**
301
+ * Original name of Blockly.Variables.createVariableButtonHandler(..).
302
+ * @deprecated Use Blockly.Variables.createVariableButtonHandler(..).
303
+ *
304
+ * @param {!Blockly.Workspace} workspace The workspace on which to create the
305
+ * variable.
306
+ * @param {function(?string=)=} opt_callback A callback. It will be passed an
307
+ * acceptable new variable name, or null if change is to be aborted (cancel
308
+ * button), or undefined if an existing variable was chosen.
309
+ * @param {string=} opt_type The type of the variable like 'int', 'string', or
310
+ * ''. This will default to '', which is a specific type.
311
+ */
312
+ Blockly.Variables.createVariable =
313
+ Blockly.Variables.createVariableButtonHandler;
314
+
315
+ /**
316
+ * Opens a prompt that allows the user to enter a new name for a variable.
317
+ * Triggers a rename if the new name is valid. Or re-prompts if there is a
318
+ * collision.
319
+ * @param {!Blockly.Workspace} workspace The workspace on which to rename the
320
+ * variable.
321
+ * @param {Blockly.VariableModel} variable Variable to rename.
322
+ * @param {function(?string=)=} opt_callback A callback. It will
323
+ * be passed an acceptable new variable name, or null if change is to be
324
+ * aborted (cancel button), or undefined if an existing variable was chosen.
325
+ */
326
+ Blockly.Variables.renameVariable = function(workspace, variable,
327
+ opt_callback) {
328
+ // This function needs to be named so it can be called recursively.
329
+ var promptAndCheckWithAlert = function(defaultName) {
330
+ var promptText =
331
+ Blockly.Msg['RENAME_VARIABLE_TITLE'].replace('%1', variable.name);
332
+ Blockly.Variables.promptName(promptText, defaultName,
333
+ function(newName) {
334
+ if (newName) {
335
+ var existing = Blockly.Variables.nameUsedWithOtherType_(newName,
336
+ variable.type, workspace);
337
+ if (existing) {
338
+ var msg = Blockly.Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE']
339
+ .replace('%1', existing.name)
340
+ .replace('%2', existing.type);
341
+ Blockly.alert(msg,
342
+ function() {
343
+ promptAndCheckWithAlert(newName); // Recurse
344
+ });
345
+ } else {
346
+ workspace.renameVariableById(variable.getId(), newName);
347
+ if (opt_callback) {
348
+ opt_callback(newName);
349
+ }
350
+ }
351
+ } else {
352
+ // User canceled prompt.
353
+ if (opt_callback) {
354
+ opt_callback(null);
355
+ }
356
+ }
357
+ });
358
+ };
359
+ promptAndCheckWithAlert('');
360
+ };
361
+
362
+ /**
363
+ * Prompt the user for a new variable name.
364
+ * @param {string} promptText The string of the prompt.
365
+ * @param {string} defaultText The default value to show in the prompt's field.
366
+ * @param {function(?string)} callback A callback. It will return the new
367
+ * variable name, or null if the user picked something illegal.
368
+ */
369
+ Blockly.Variables.promptName = function(promptText, defaultText, callback) {
370
+ Blockly.prompt(promptText, defaultText, function(newVar) {
371
+ // Merge runs of whitespace. Strip leading and trailing whitespace.
372
+ // Beyond this, all names are legal.
373
+ if (newVar) {
374
+ newVar = newVar.replace(/[\s\xa0]+/g, ' ').trim();
375
+ if (newVar == Blockly.Msg['RENAME_VARIABLE'] ||
376
+ newVar == Blockly.Msg['NEW_VARIABLE']) {
377
+ // Ok, not ALL names are legal...
378
+ newVar = null;
379
+ }
380
+ }
381
+ callback(newVar);
382
+ });
383
+ };
384
+
385
+ /**
386
+ * Check whether there exists a variable with the given name but a different
387
+ * type.
388
+ * @param {string} name The name to search for.
389
+ * @param {string} type The type to exclude from the search.
390
+ * @param {!Blockly.Workspace} workspace The workspace to search for the
391
+ * variable.
392
+ * @return {Blockly.VariableModel} The variable with the given name and a
393
+ * different type, or null if none was found.
394
+ * @private
395
+ */
396
+ Blockly.Variables.nameUsedWithOtherType_ = function(name, type, workspace) {
397
+ var allVariables = workspace.getVariableMap().getAllVariables();
398
+
399
+ name = name.toLowerCase();
400
+ for (var i = 0, variable; (variable = allVariables[i]); i++) {
401
+ if (variable.name.toLowerCase() == name && variable.type != type) {
402
+ return variable;
403
+ }
404
+ }
405
+ return null;
406
+ };
407
+
408
+ /**
409
+ * Check whether there exists a variable with the given name of any type.
410
+ * @param {string} name The name to search for.
411
+ * @param {!Blockly.Workspace} workspace The workspace to search for the
412
+ * variable.
413
+ * @return {Blockly.VariableModel} The variable with the given name,
414
+ * or null if none was found.
415
+ */
416
+ Blockly.Variables.nameUsedWithAnyType = function(name, workspace) {
417
+ var allVariables = workspace.getVariableMap().getAllVariables();
418
+
419
+ name = name.toLowerCase();
420
+ for (var i = 0, variable; (variable = allVariables[i]); i++) {
421
+ if (variable.name.toLowerCase() == name) {
422
+ return variable;
423
+ }
424
+ }
425
+ return null;
426
+ };
427
+
428
+ /**
429
+ * Generate DOM objects representing a variable field.
430
+ * @param {!Blockly.VariableModel} variableModel The variable model to
431
+ * represent.
432
+ * @return {Element} The generated DOM.
433
+ * @public
434
+ */
435
+ Blockly.Variables.generateVariableFieldDom = function(variableModel) {
436
+ /* Generates the following XML:
437
+ * <field name="VAR" id="goKTKmYJ8DhVHpruv" variabletype="int">foo</field>
438
+ */
439
+ var field = Blockly.utils.xml.createElement('field');
440
+ field.setAttribute('name', 'VAR');
441
+ field.setAttribute('id', variableModel.getId());
442
+ field.setAttribute('variabletype', variableModel.type);
443
+ var name = Blockly.utils.xml.createTextNode(variableModel.name);
444
+ field.appendChild(name);
445
+ return field;
446
+ };
447
+
448
+ /**
449
+ * Helper function to look up or create a variable on the given workspace.
450
+ * If no variable exists, creates and returns it.
451
+ * @param {!Blockly.Workspace} workspace The workspace to search for the
452
+ * variable. It may be a flyout workspace or main workspace.
453
+ * @param {?string} id The ID to use to look up or create the variable, or null.
454
+ * @param {string=} opt_name The string to use to look up or create the
455
+ * variable.
456
+ * @param {string=} opt_type The type to use to look up or create the variable.
457
+ * @return {!Blockly.VariableModel} The variable corresponding to the given ID
458
+ * or name + type combination.
459
+ */
460
+ Blockly.Variables.getOrCreateVariablePackage = function(workspace, id, opt_name,
461
+ opt_type) {
462
+ var variable = Blockly.Variables.getVariable(workspace, id, opt_name,
463
+ opt_type);
464
+ if (!variable) {
465
+ variable = Blockly.Variables.createVariable_(workspace, id, opt_name,
466
+ opt_type);
467
+ }
468
+ return variable;
469
+ };
470
+
471
+ /**
472
+ * Look up a variable on the given workspace.
473
+ * Always looks in the main workspace before looking in the flyout workspace.
474
+ * Always prefers lookup by ID to lookup by name + type.
475
+ * @param {!Blockly.Workspace} workspace The workspace to search for the
476
+ * variable. It may be a flyout workspace or main workspace.
477
+ * @param {?string} id The ID to use to look up the variable, or null.
478
+ * @param {string=} opt_name The string to use to look up the variable.
479
+ * Only used if lookup by ID fails.
480
+ * @param {string=} opt_type The type to use to look up the variable.
481
+ * Only used if lookup by ID fails.
482
+ * @return {Blockly.VariableModel} The variable corresponding to the given ID
483
+ * or name + type combination, or null if not found.
484
+ * @public
485
+ */
486
+ Blockly.Variables.getVariable = function(workspace, id, opt_name, opt_type) {
487
+ var potentialVariableMap = workspace.getPotentialVariableMap();
488
+ var variable = null;
489
+ // Try to just get the variable, by ID if possible.
490
+ if (id) {
491
+ // Look in the real variable map before checking the potential variable map.
492
+ variable = workspace.getVariableById(id);
493
+ if (!variable && potentialVariableMap) {
494
+ variable = potentialVariableMap.getVariableById(id);
495
+ }
496
+ if (variable) {
497
+ return variable;
498
+ }
499
+ }
500
+ // If there was no ID, or there was an ID but it didn't match any variables,
501
+ // look up by name and type.
502
+ if (opt_name) {
503
+ if (opt_type == undefined) {
504
+ throw Error('Tried to look up a variable by name without a type');
505
+ }
506
+ // Otherwise look up by name and type.
507
+ variable = workspace.getVariable(opt_name, opt_type);
508
+ if (!variable && potentialVariableMap) {
509
+ variable = potentialVariableMap.getVariable(opt_name, opt_type);
510
+ }
511
+ }
512
+ return variable;
513
+ };
514
+
515
+ /**
516
+ * Helper function to create a variable on the given workspace.
517
+ * @param {!Blockly.Workspace} workspace The workspace in which to create the
518
+ * variable. It may be a flyout workspace or main workspace.
519
+ * @param {?string} id The ID to use to create the variable, or null.
520
+ * @param {string=} opt_name The string to use to create the variable.
521
+ * @param {string=} opt_type The type to use to create the variable.
522
+ * @return {!Blockly.VariableModel} The variable corresponding to the given ID
523
+ * or name + type combination.
524
+ * @private
525
+ */
526
+ Blockly.Variables.createVariable_ = function(workspace, id, opt_name,
527
+ opt_type) {
528
+ var potentialVariableMap = workspace.getPotentialVariableMap();
529
+ // Variables without names get uniquely named for this workspace.
530
+ if (!opt_name) {
531
+ var ws = workspace.isFlyout ? workspace.targetWorkspace : workspace;
532
+ opt_name = Blockly.Variables.generateUniqueName(ws);
533
+ }
534
+
535
+ // Create a potential variable if in the flyout.
536
+ var variable = null;
537
+ if (potentialVariableMap) {
538
+ variable = potentialVariableMap.createVariable(opt_name, opt_type, id);
539
+ } else { // In the main workspace, create a real variable.
540
+ variable = workspace.createVariable(opt_name, opt_type, id);
541
+ }
542
+ return variable;
543
+ };
544
+
545
+ /**
546
+ * Helper function to get the list of variables that have been added to the
547
+ * workspace after adding a new block, using the given list of variables that
548
+ * were in the workspace before the new block was added.
549
+ * @param {!Blockly.Workspace} workspace The workspace to inspect.
550
+ * @param {!Array.<!Blockly.VariableModel>} originalVariables The array of
551
+ * variables that existed in the workspace before adding the new block.
552
+ * @return {!Array.<!Blockly.VariableModel>} The new array of variables that
553
+ * were freshly added to the workspace after creating the new block,
554
+ * or [] if no new variables were added to the workspace.
555
+ * @package
556
+ */
557
+ Blockly.Variables.getAddedVariables = function(workspace, originalVariables) {
558
+ var allCurrentVariables = workspace.getAllVariables();
559
+ var addedVariables = [];
560
+ if (originalVariables.length != allCurrentVariables.length) {
561
+ for (var i = 0; i < allCurrentVariables.length; i++) {
562
+ var variable = allCurrentVariables[i];
563
+ // For any variable that is present in allCurrentVariables but not
564
+ // present in originalVariables, add the variable to addedVariables.
565
+ if (originalVariables.indexOf(variable) == -1) {
566
+ addedVariables.push(variable);
567
+ }
568
+ }
569
+ }
570
+ return addedVariables;
571
+ };