nodeskini 1.0.0 → 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 +4 -3
@@ -0,0 +1,1162 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2012 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Field. Used for editable titles, variables, etc.
9
+ * This is an abstract class that defines the UI on the block. Actual
10
+ * instances would be Blockly.FieldTextInput, Blockly.FieldDropdown, etc.
11
+ * @author fraser@google.com (Neil Fraser)
12
+ */
13
+ 'use strict';
14
+
15
+ goog.provide('Blockly.Field');
16
+
17
+ goog.require('Blockly.Events');
18
+ goog.require('Blockly.Events.BlockChange');
19
+ goog.require('Blockly.Gesture');
20
+ goog.require('Blockly.Tooltip');
21
+ goog.require('Blockly.utils');
22
+ goog.require('Blockly.utils.deprecation');
23
+ goog.require('Blockly.utils.dom');
24
+ goog.require('Blockly.utils.Rect');
25
+ goog.require('Blockly.utils.Size');
26
+ goog.require('Blockly.utils.style');
27
+ goog.require('Blockly.utils.Svg');
28
+ goog.require('Blockly.utils.userAgent');
29
+
30
+ goog.requireType('Blockly.blockRendering.ConstantProvider');
31
+ goog.requireType('Blockly.IASTNodeLocationSvg');
32
+ goog.requireType('Blockly.IASTNodeLocationWithBlock');
33
+ goog.requireType('Blockly.IBlocklyActionable');
34
+ goog.requireType('Blockly.IRegistrable');
35
+
36
+
37
+ /**
38
+ * Abstract class for an editable field.
39
+ * @param {*} value The initial value of the field.
40
+ * @param {?Function=} opt_validator A function that is called to validate
41
+ * changes to the field's value. Takes in a value & returns a validated
42
+ * value, or null to abort the change.
43
+ * @param {Object=} opt_config A map of options used to configure the field. See
44
+ * the individual field's documentation for a list of properties this
45
+ * parameter supports.
46
+ * @constructor
47
+ * @implements {Blockly.IASTNodeLocationSvg}
48
+ * @implements {Blockly.IASTNodeLocationWithBlock}
49
+ * @implements {Blockly.IBlocklyActionable}
50
+ * @implements {Blockly.IRegistrable}
51
+ */
52
+ Blockly.Field = function(value, opt_validator, opt_config) {
53
+ /**
54
+ * A generic value possessed by the field.
55
+ * Should generally be non-null, only null when the field is created.
56
+ * @type {*}
57
+ * @protected
58
+ */
59
+ this.value_ = this.DEFAULT_VALUE;
60
+
61
+ /**
62
+ * Validation function called when user edits an editable field.
63
+ * @type {Function}
64
+ * @protected
65
+ */
66
+ this.validator_ = null;
67
+
68
+ /**
69
+ * Used to cache the field's tooltip value if setTooltip is called when the
70
+ * field is not yet initialized. Is *not* guaranteed to be accurate.
71
+ * @type {?Blockly.Tooltip.TipInfo}
72
+ * @private
73
+ */
74
+ this.tooltip_ = null;
75
+
76
+ /**
77
+ * The size of the area rendered by the field.
78
+ * @type {!Blockly.utils.Size}
79
+ * @protected
80
+ */
81
+ this.size_ = new Blockly.utils.Size(0, 0);
82
+
83
+ /**
84
+ * Holds the cursors svg element when the cursor is attached to the field.
85
+ * This is null if there is no cursor on the field.
86
+ * @type {SVGElement}
87
+ * @private
88
+ */
89
+ this.cursorSvg_ = null;
90
+
91
+ /**
92
+ * Holds the markers svg element when the marker is attached to the field.
93
+ * This is null if there is no marker on the field.
94
+ * @type {SVGElement}
95
+ * @private
96
+ */
97
+ this.markerSvg_ = null;
98
+
99
+ /**
100
+ * The rendered field's SVG group element.
101
+ * @type {SVGGElement}
102
+ * @protected
103
+ */
104
+ this.fieldGroup_ = null;
105
+
106
+ /**
107
+ * The rendered field's SVG border element.
108
+ * @type {SVGRectElement}
109
+ * @protected
110
+ */
111
+ this.borderRect_ = null;
112
+
113
+ /**
114
+ * The rendered field's SVG text element.
115
+ * @type {SVGTextElement}
116
+ * @protected
117
+ */
118
+ this.textElement_ = null;
119
+
120
+ /**
121
+ * The rendered field's text content element.
122
+ * @type {Text}
123
+ * @protected
124
+ */
125
+ this.textContent_ = null;
126
+
127
+ /**
128
+ * Mouse down event listener data.
129
+ * @type {?Blockly.EventData}
130
+ * @private
131
+ */
132
+ this.mouseDownWrapper_ = null;
133
+
134
+ /**
135
+ * Constants associated with the source block's renderer.
136
+ * @type {Blockly.blockRendering.ConstantProvider}
137
+ * @protected
138
+ */
139
+ this.constants_ = null;
140
+
141
+ opt_config && this.configure_(opt_config);
142
+ this.setValue(value);
143
+ opt_validator && this.setValidator(opt_validator);
144
+ };
145
+
146
+ /**
147
+ * The default value for this field.
148
+ * @type {*}
149
+ * @protected
150
+ */
151
+ Blockly.Field.prototype.DEFAULT_VALUE = null;
152
+
153
+ /**
154
+ * Name of field. Unique within each block.
155
+ * Static labels are usually unnamed.
156
+ * @type {string|undefined}
157
+ */
158
+ Blockly.Field.prototype.name = undefined;
159
+
160
+ /**
161
+ * Has this field been disposed of?
162
+ * @type {boolean}
163
+ * @package
164
+ */
165
+ Blockly.Field.prototype.disposed = false;
166
+
167
+ /**
168
+ * Maximum characters of text to display before adding an ellipsis.
169
+ * @type {number}
170
+ */
171
+ Blockly.Field.prototype.maxDisplayLength = 50;
172
+
173
+ /**
174
+ * Block this field is attached to. Starts as null, then set in init.
175
+ * @type {Blockly.Block}
176
+ * @protected
177
+ */
178
+ Blockly.Field.prototype.sourceBlock_ = null;
179
+
180
+ /**
181
+ * Does this block need to be re-rendered?
182
+ * @type {boolean}
183
+ * @protected
184
+ */
185
+ Blockly.Field.prototype.isDirty_ = true;
186
+
187
+ /**
188
+ * Is the field visible, or hidden due to the block being collapsed?
189
+ * @type {boolean}
190
+ * @protected
191
+ */
192
+ Blockly.Field.prototype.visible_ = true;
193
+
194
+ /**
195
+ * The element the click handler is bound to.
196
+ * @type {Element}
197
+ * @protected
198
+ */
199
+ Blockly.Field.prototype.clickTarget_ = null;
200
+
201
+ /**
202
+ * A developer hook to override the returned text of this field.
203
+ * Override if the text representation of the value of this field
204
+ * is not just a string cast of its value.
205
+ * Return null to resort to a string cast.
206
+ * @return {?string} Current text. Return null to resort to a string cast.
207
+ * @protected
208
+ */
209
+ Blockly.Field.prototype.getText_;
210
+
211
+ /**
212
+ * An optional method that can be defined to show an editor when the field is
213
+ * clicked. Blockly will automatically set the field as clickable if this
214
+ * method is defined.
215
+ * @param {Event=} opt_e Optional mouse event that triggered the field to open,
216
+ * or undefined if triggered programmatically.
217
+ * @return {void}
218
+ * @protected
219
+ */
220
+ Blockly.Field.prototype.showEditor_;
221
+
222
+ /**
223
+ * Non-breaking space.
224
+ * @const
225
+ */
226
+ Blockly.Field.NBSP = '\u00A0';
227
+
228
+ /**
229
+ * Editable fields usually show some sort of UI indicating they are editable.
230
+ * They will also be saved by the XML renderer.
231
+ * @type {boolean}
232
+ */
233
+ Blockly.Field.prototype.EDITABLE = true;
234
+
235
+ /**
236
+ * Serializable fields are saved by the XML renderer, non-serializable fields
237
+ * are not. Editable fields should also be serializable. This is not the
238
+ * case by default so that SERIALIZABLE is backwards compatible.
239
+ * @type {boolean}
240
+ */
241
+ Blockly.Field.prototype.SERIALIZABLE = false;
242
+
243
+ /**
244
+ * Process the configuration map passed to the field.
245
+ * @param {!Object} config A map of options used to configure the field. See
246
+ * the individual field's documentation for a list of properties this
247
+ * parameter supports.
248
+ * @protected
249
+ */
250
+ Blockly.Field.prototype.configure_ = function(config) {
251
+ var tooltip = config['tooltip'];
252
+ if (typeof tooltip == 'string') {
253
+ tooltip = Blockly.utils.replaceMessageReferences(
254
+ config['tooltip']);
255
+ }
256
+ tooltip && this.setTooltip(tooltip);
257
+
258
+ // TODO (#2884): Possibly add CSS class config option.
259
+ // TODO (#2885): Possibly add cursor config option.
260
+ };
261
+
262
+ /**
263
+ * Attach this field to a block.
264
+ * @param {!Blockly.Block} block The block containing this field.
265
+ */
266
+ Blockly.Field.prototype.setSourceBlock = function(block) {
267
+ if (this.sourceBlock_) {
268
+ throw Error('Field already bound to a block.');
269
+ }
270
+ this.sourceBlock_ = block;
271
+ };
272
+
273
+ /**
274
+ * Get the renderer constant provider.
275
+ * @return {?Blockly.blockRendering.ConstantProvider} The renderer constant
276
+ * provider.
277
+ */
278
+ Blockly.Field.prototype.getConstants = function() {
279
+ if (!this.constants_ && this.sourceBlock_ && this.sourceBlock_.workspace &&
280
+ this.sourceBlock_.workspace.rendered) {
281
+ this.constants_ = this.sourceBlock_.workspace.getRenderer().getConstants();
282
+ }
283
+ return this.constants_;
284
+ };
285
+
286
+ /**
287
+ * Get the block this field is attached to.
288
+ * @return {Blockly.Block} The block containing this field.
289
+ */
290
+ Blockly.Field.prototype.getSourceBlock = function() {
291
+ return this.sourceBlock_;
292
+ };
293
+
294
+ /**
295
+ * Initialize everything to render this field. Override
296
+ * methods initModel and initView rather than this method.
297
+ * @package
298
+ */
299
+ Blockly.Field.prototype.init = function() {
300
+ if (this.fieldGroup_) {
301
+ // Field has already been initialized once.
302
+ return;
303
+ }
304
+ this.fieldGroup_ = Blockly.utils.dom.createSvgElement(
305
+ Blockly.utils.Svg.G, {}, null);
306
+ if (!this.isVisible()) {
307
+ this.fieldGroup_.style.display = 'none';
308
+ }
309
+ var sourceBlockSvg = /** @type {!Blockly.BlockSvg} **/ (this.sourceBlock_);
310
+ sourceBlockSvg.getSvgRoot().appendChild(this.fieldGroup_);
311
+ this.initView();
312
+ this.updateEditable();
313
+ this.setTooltip(this.tooltip_);
314
+ this.bindEvents_();
315
+ this.initModel();
316
+ };
317
+
318
+ /**
319
+ * Create the block UI for this field.
320
+ * @package
321
+ */
322
+ Blockly.Field.prototype.initView = function() {
323
+ this.createBorderRect_();
324
+ this.createTextElement_();
325
+ };
326
+
327
+ /**
328
+ * Initializes the model of the field after it has been installed on a block.
329
+ * No-op by default.
330
+ * @package
331
+ */
332
+ Blockly.Field.prototype.initModel = function() {
333
+ };
334
+
335
+ /**
336
+ * Create a field border rect element. Not to be overridden by subclasses.
337
+ * Instead modify the result of the function inside initView, or create a
338
+ * separate function to call.
339
+ * @protected
340
+ */
341
+ Blockly.Field.prototype.createBorderRect_ = function() {
342
+ this.borderRect_ = Blockly.utils.dom.createSvgElement(
343
+ Blockly.utils.Svg.RECT, {
344
+ 'rx': this.getConstants().FIELD_BORDER_RECT_RADIUS,
345
+ 'ry': this.getConstants().FIELD_BORDER_RECT_RADIUS,
346
+ 'x': 0,
347
+ 'y': 0,
348
+ 'height': this.size_.height,
349
+ 'width': this.size_.width,
350
+ 'class': 'blocklyFieldRect'
351
+ }, this.fieldGroup_);
352
+ };
353
+
354
+ /**
355
+ * Create a field text element. Not to be overridden by subclasses. Instead
356
+ * modify the result of the function inside initView, or create a separate
357
+ * function to call.
358
+ * @protected
359
+ */
360
+ Blockly.Field.prototype.createTextElement_ = function() {
361
+ this.textElement_ = Blockly.utils.dom.createSvgElement(
362
+ Blockly.utils.Svg.TEXT, {
363
+ 'class': 'blocklyText',
364
+ }, this.fieldGroup_);
365
+ if (this.getConstants().FIELD_TEXT_BASELINE_CENTER) {
366
+ this.textElement_.setAttribute('dominant-baseline', 'central');
367
+ }
368
+ this.textContent_ = document.createTextNode('');
369
+ this.textElement_.appendChild(this.textContent_);
370
+ };
371
+
372
+ /**
373
+ * Bind events to the field. Can be overridden by subclasses if they need to do
374
+ * custom input handling.
375
+ * @protected
376
+ */
377
+ Blockly.Field.prototype.bindEvents_ = function() {
378
+ Blockly.Tooltip.bindMouseEvents(this.getClickTarget_());
379
+ this.mouseDownWrapper_ =
380
+ Blockly.bindEventWithChecks_(
381
+ this.getClickTarget_(), 'mousedown', this, this.onMouseDown_);
382
+ };
383
+
384
+ /**
385
+ * Sets the field's value based on the given XML element. Should only be
386
+ * called by Blockly.Xml.
387
+ * @param {!Element} fieldElement The element containing info about the
388
+ * field's state.
389
+ * @package
390
+ */
391
+ Blockly.Field.prototype.fromXml = function(fieldElement) {
392
+ this.setValue(fieldElement.textContent);
393
+ };
394
+
395
+ /**
396
+ * Serializes this field's value to XML. Should only be called by Blockly.Xml.
397
+ * @param {!Element} fieldElement The element to populate with info about the
398
+ * field's state.
399
+ * @return {!Element} The element containing info about the field's state.
400
+ * @package
401
+ */
402
+ Blockly.Field.prototype.toXml = function(fieldElement) {
403
+ fieldElement.textContent = this.getValue();
404
+ return fieldElement;
405
+ };
406
+
407
+ /**
408
+ * Dispose of all DOM objects and events belonging to this editable field.
409
+ * @package
410
+ */
411
+ Blockly.Field.prototype.dispose = function() {
412
+ Blockly.DropDownDiv.hideIfOwner(this);
413
+ Blockly.WidgetDiv.hideIfOwner(this);
414
+ Blockly.Tooltip.unbindMouseEvents(this.getClickTarget_());
415
+
416
+ if (this.mouseDownWrapper_) {
417
+ Blockly.unbindEvent_(this.mouseDownWrapper_);
418
+ }
419
+
420
+ Blockly.utils.dom.removeNode(this.fieldGroup_);
421
+
422
+ this.disposed = true;
423
+ };
424
+
425
+ /**
426
+ * Add or remove the UI indicating if this field is editable or not.
427
+ */
428
+ Blockly.Field.prototype.updateEditable = function() {
429
+ var group = this.fieldGroup_;
430
+ if (!this.EDITABLE || !group) {
431
+ return;
432
+ }
433
+ if (this.sourceBlock_.isEditable()) {
434
+ Blockly.utils.dom.addClass(group, 'blocklyEditableText');
435
+ Blockly.utils.dom.removeClass(group, 'blocklyNonEditableText');
436
+ group.style.cursor = this.CURSOR;
437
+ } else {
438
+ Blockly.utils.dom.addClass(group, 'blocklyNonEditableText');
439
+ Blockly.utils.dom.removeClass(group, 'blocklyEditableText');
440
+ group.style.cursor = '';
441
+ }
442
+ };
443
+
444
+ /**
445
+ * Check whether this field defines the showEditor_ function.
446
+ * @return {boolean} Whether this field is clickable.
447
+ */
448
+ Blockly.Field.prototype.isClickable = function() {
449
+ return !!this.sourceBlock_ && this.sourceBlock_.isEditable() &&
450
+ !!this.showEditor_ && (typeof this.showEditor_ === 'function');
451
+ };
452
+
453
+ /**
454
+ * Check whether this field is currently editable. Some fields are never
455
+ * EDITABLE (e.g. text labels). Other fields may be EDITABLE but may exist on
456
+ * non-editable blocks.
457
+ * @return {boolean} Whether this field is editable and on an editable block
458
+ */
459
+ Blockly.Field.prototype.isCurrentlyEditable = function() {
460
+ return this.EDITABLE && !!this.sourceBlock_ && this.sourceBlock_.isEditable();
461
+ };
462
+
463
+ /**
464
+ * Check whether this field should be serialized by the XML renderer.
465
+ * Handles the logic for backwards compatibility and incongruous states.
466
+ * @return {boolean} Whether this field should be serialized or not.
467
+ */
468
+ Blockly.Field.prototype.isSerializable = function() {
469
+ var isSerializable = false;
470
+ if (this.name) {
471
+ if (this.SERIALIZABLE) {
472
+ isSerializable = true;
473
+ } else if (this.EDITABLE) {
474
+ console.warn('Detected an editable field that was not serializable.' +
475
+ ' Please define SERIALIZABLE property as true on all editable custom' +
476
+ ' fields. Proceeding with serialization.');
477
+ isSerializable = true;
478
+ }
479
+ }
480
+ return isSerializable;
481
+ };
482
+
483
+ /**
484
+ * Gets whether this editable field is visible or not.
485
+ * @return {boolean} True if visible.
486
+ */
487
+ Blockly.Field.prototype.isVisible = function() {
488
+ return this.visible_;
489
+ };
490
+
491
+ /**
492
+ * Sets whether this editable field is visible or not. Should only be called
493
+ * by input.setVisible.
494
+ * @param {boolean} visible True if visible.
495
+ * @package
496
+ */
497
+ Blockly.Field.prototype.setVisible = function(visible) {
498
+ if (this.visible_ == visible) {
499
+ return;
500
+ }
501
+ this.visible_ = visible;
502
+ var root = this.getSvgRoot();
503
+ if (root) {
504
+ root.style.display = visible ? 'block' : 'none';
505
+ }
506
+ };
507
+
508
+ /**
509
+ * Sets a new validation function for editable fields, or clears a previously
510
+ * set validator.
511
+ *
512
+ * The validator function takes in the new field value, and returns
513
+ * validated value. The validated value could be the input value, a modified
514
+ * version of the input value, or null to abort the change.
515
+ *
516
+ * If the function does not return anything (or returns undefined) the new
517
+ * value is accepted as valid. This is to allow for fields using the
518
+ * validated function as a field-level change event notification.
519
+ *
520
+ * @param {Function} handler The validator function
521
+ * or null to clear a previous validator.
522
+ */
523
+ Blockly.Field.prototype.setValidator = function(handler) {
524
+ this.validator_ = handler;
525
+ };
526
+
527
+ /**
528
+ * Gets the validation function for editable fields, or null if not set.
529
+ * @return {Function} Validation function, or null.
530
+ */
531
+ Blockly.Field.prototype.getValidator = function() {
532
+ return this.validator_;
533
+ };
534
+
535
+ /**
536
+ * Validates a change. Does nothing. Subclasses may override this.
537
+ * @param {string} text The user's text.
538
+ * @return {string} No change needed.
539
+ * @deprecated May 2019. Override doClassValidation and other relevant 'do'
540
+ * functions instead.
541
+ */
542
+ Blockly.Field.prototype.classValidator = function(text) {
543
+ Blockly.utils.deprecation.warn(
544
+ 'Field.prototype.classValidator',
545
+ 'May 2019',
546
+ 'December 2020',
547
+ 'Blockly.Field.prototype.doClassValidation_');
548
+ return text;
549
+ };
550
+
551
+ /**
552
+ * Calls the validation function for this field, as well as all the validation
553
+ * function for the field's class and its parents.
554
+ * @param {string} text Proposed text.
555
+ * @return {?string} Revised text, or null if invalid.
556
+ * @deprecated May 2019. setValue now contains all relevant logic.
557
+ */
558
+ Blockly.Field.prototype.callValidator = function(text) {
559
+ Blockly.utils.deprecation.warn(
560
+ 'Field.prototype.callValidator',
561
+ 'May 2019',
562
+ 'December 2020');
563
+ var classResult = this.classValidator(text);
564
+ if (classResult === null) {
565
+ // Class validator rejects value. Game over.
566
+ return null;
567
+ } else if (classResult !== undefined) {
568
+ text = classResult;
569
+ }
570
+ var userValidator = this.getValidator();
571
+ if (userValidator) {
572
+ var userResult = userValidator.call(this, text);
573
+ if (userResult === null) {
574
+ // User validator rejects value. Game over.
575
+ return null;
576
+ } else if (userResult !== undefined) {
577
+ text = userResult;
578
+ }
579
+ }
580
+ return text;
581
+ };
582
+
583
+ /**
584
+ * Gets the group element for this editable field.
585
+ * Used for measuring the size and for positioning.
586
+ * @return {!SVGGElement} The group element.
587
+ */
588
+ Blockly.Field.prototype.getSvgRoot = function() {
589
+ return /** @type {!SVGGElement} */ (this.fieldGroup_);
590
+ };
591
+
592
+ /**
593
+ * Updates the field to match the colour/style of the block. Should only be
594
+ * called by BlockSvg.applyColour().
595
+ * @package
596
+ */
597
+ Blockly.Field.prototype.applyColour = function() {
598
+ // Non-abstract sub-classes may wish to implement this. See FieldDropdown.
599
+ };
600
+
601
+ /**
602
+ * Used by getSize() to move/resize any DOM elements, and get the new size.
603
+ *
604
+ * All rendering that has an effect on the size/shape of the block should be
605
+ * done here, and should be triggered by getSize().
606
+ * @protected
607
+ */
608
+ Blockly.Field.prototype.render_ = function() {
609
+ if (this.textContent_) {
610
+ this.textContent_.nodeValue = this.getDisplayText_();
611
+ }
612
+ this.updateSize_();
613
+ };
614
+
615
+ /**
616
+ * Show an editor when the field is clicked only if the field is clickable.
617
+ * @param {Event=} opt_e Optional mouse event that triggered the field to open,
618
+ * or undefined if triggered programmatically.
619
+ * @package
620
+ */
621
+ Blockly.Field.prototype.showEditor = function(opt_e) {
622
+ if (this.isClickable()) {
623
+ this.showEditor_(opt_e);
624
+ }
625
+ };
626
+
627
+ /**
628
+ * Updates the width of the field. Redirects to updateSize_().
629
+ * @deprecated May 2019 Use Blockly.Field.updateSize_() to force an update
630
+ * to the size of the field, or Blockly.utils.dom.getTextWidth() to
631
+ * check the size of the field.
632
+ */
633
+ Blockly.Field.prototype.updateWidth = function() {
634
+
635
+ Blockly.utils.deprecation.warn(
636
+ 'Field.prototype.updateWidth',
637
+ 'May 2019',
638
+ 'December 2020',
639
+ 'Blockly.Field.prototype.updateSize_ or Blockly.utils.dom.getTextWidth');
640
+ this.updateSize_();
641
+ };
642
+
643
+ /**
644
+ * Updates the size of the field based on the text.
645
+ * @param {number=} opt_margin margin to use when positioning the text element.
646
+ * @protected
647
+ */
648
+ Blockly.Field.prototype.updateSize_ = function(opt_margin) {
649
+ var constants = this.getConstants();
650
+ var xOffset = opt_margin != undefined ? opt_margin :
651
+ (this.borderRect_ ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0);
652
+ var totalWidth = xOffset * 2;
653
+ var totalHeight = constants.FIELD_TEXT_HEIGHT;
654
+
655
+ var contentWidth = 0;
656
+ if (this.textElement_) {
657
+ contentWidth = Blockly.utils.dom.getFastTextWidth(this.textElement_,
658
+ constants.FIELD_TEXT_FONTSIZE,
659
+ constants.FIELD_TEXT_FONTWEIGHT,
660
+ constants.FIELD_TEXT_FONTFAMILY);
661
+ totalWidth += contentWidth;
662
+ }
663
+ if (this.borderRect_) {
664
+ totalHeight = Math.max(totalHeight, constants.FIELD_BORDER_RECT_HEIGHT);
665
+ }
666
+
667
+ this.size_.height = totalHeight;
668
+ this.size_.width = totalWidth;
669
+
670
+ this.positionTextElement_(xOffset, contentWidth);
671
+ this.positionBorderRect_();
672
+ };
673
+
674
+ /**
675
+ * Position a field's text element after a size change. This handles both LTR
676
+ * and RTL positioning.
677
+ * @param {number} xOffset x offset to use when positioning the text element.
678
+ * @param {number} contentWidth The content width.
679
+ * @protected
680
+ */
681
+ Blockly.Field.prototype.positionTextElement_ = function(xOffset, contentWidth) {
682
+ if (!this.textElement_) {
683
+ return;
684
+ }
685
+ var constants = this.getConstants();
686
+ var halfHeight = this.size_.height / 2;
687
+
688
+ this.textElement_.setAttribute('x', this.sourceBlock_.RTL ?
689
+ this.size_.width - contentWidth - xOffset : xOffset);
690
+ this.textElement_.setAttribute('y', constants.FIELD_TEXT_BASELINE_CENTER ?
691
+ halfHeight : halfHeight - constants.FIELD_TEXT_HEIGHT / 2 +
692
+ constants.FIELD_TEXT_BASELINE);
693
+ };
694
+
695
+ /**
696
+ * Position a field's border rect after a size change.
697
+ * @protected
698
+ */
699
+ Blockly.Field.prototype.positionBorderRect_ = function() {
700
+ if (!this.borderRect_) {
701
+ return;
702
+ }
703
+ this.borderRect_.setAttribute('width', this.size_.width);
704
+ this.borderRect_.setAttribute('height', this.size_.height);
705
+ this.borderRect_.setAttribute('rx',
706
+ this.getConstants().FIELD_BORDER_RECT_RADIUS);
707
+ this.borderRect_.setAttribute('ry',
708
+ this.getConstants().FIELD_BORDER_RECT_RADIUS);
709
+ };
710
+
711
+
712
+ /**
713
+ * Returns the height and width of the field.
714
+ *
715
+ * This should *in general* be the only place render_ gets called from.
716
+ * @return {!Blockly.utils.Size} Height and width.
717
+ */
718
+ Blockly.Field.prototype.getSize = function() {
719
+ if (!this.isVisible()) {
720
+ return new Blockly.utils.Size(0, 0);
721
+ }
722
+
723
+ if (this.isDirty_) {
724
+ this.render_();
725
+ this.isDirty_ = false;
726
+ } else if (this.visible_ && this.size_.width == 0) {
727
+ // If the field is not visible the width will be 0 as well, one of the
728
+ // problems with the old system.
729
+ console.warn('Deprecated use of setting size_.width to 0 to rerender a' +
730
+ ' field. Set field.isDirty_ to true instead.');
731
+ this.render_();
732
+ }
733
+ return this.size_;
734
+ };
735
+
736
+ /**
737
+ * Returns the bounding box of the rendered field, accounting for workspace
738
+ * scaling.
739
+ * @return {!Blockly.utils.Rect} An object with top, bottom, left, and right in
740
+ * pixels relative to the top left corner of the page (window coordinates).
741
+ * @package
742
+ */
743
+ Blockly.Field.prototype.getScaledBBox = function() {
744
+ if (!this.borderRect_) {
745
+ // Browsers are inconsistent in what they return for a bounding box.
746
+ // - Webkit / Blink: fill-box / object bounding box
747
+ // - Gecko / Triden / EdgeHTML: stroke-box
748
+ var bBox = this.sourceBlock_.getHeightWidth();
749
+ var scale = this.sourceBlock_.workspace.scale;
750
+ var xy = this.getAbsoluteXY_();
751
+ var scaledWidth = bBox.width * scale;
752
+ var scaledHeight = bBox.height * scale;
753
+
754
+ if (Blockly.utils.userAgent.GECKO) {
755
+ xy.x += 1.5 * scale;
756
+ xy.y += 1.5 * scale;
757
+ scaledWidth += 1 * scale;
758
+ scaledHeight += 1 * scale;
759
+ } else {
760
+ if (!Blockly.utils.userAgent.EDGE && !Blockly.utils.userAgent.IE) {
761
+ xy.x -= 0.5 * scale;
762
+ xy.y -= 0.5 * scale;
763
+ }
764
+ scaledWidth += 1 * scale;
765
+ scaledHeight += 1 * scale;
766
+ }
767
+ } else {
768
+ var bBox = this.borderRect_.getBoundingClientRect();
769
+ var xy = Blockly.utils.style.getPageOffset(this.borderRect_);
770
+ var scaledWidth = bBox.width;
771
+ var scaledHeight = bBox.height;
772
+ }
773
+ return new Blockly.utils.Rect(
774
+ xy.y,
775
+ xy.y + scaledHeight,
776
+ xy.x,
777
+ xy.x + scaledWidth
778
+ );
779
+ };
780
+
781
+ /**
782
+ * Get the text from this field to display on the block. May differ from
783
+ * ``getText`` due to ellipsis, and other formatting.
784
+ * @return {string} Text to display.
785
+ * @protected
786
+ */
787
+ Blockly.Field.prototype.getDisplayText_ = function() {
788
+ var text = this.getText();
789
+ if (!text) {
790
+ // Prevent the field from disappearing if empty.
791
+ return Blockly.Field.NBSP;
792
+ }
793
+ if (text.length > this.maxDisplayLength) {
794
+ // Truncate displayed string and add an ellipsis ('...').
795
+ text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
796
+ }
797
+ // Replace whitespace with non-breaking spaces so the text doesn't collapse.
798
+ text = text.replace(/\s/g, Blockly.Field.NBSP);
799
+ if (this.sourceBlock_ && this.sourceBlock_.RTL) {
800
+ // The SVG is LTR, force text to be RTL.
801
+ text += '\u200F';
802
+ }
803
+ return text;
804
+ };
805
+
806
+ /**
807
+ * Get the text from this field.
808
+ * @return {string} Current text.
809
+ */
810
+ Blockly.Field.prototype.getText = function() {
811
+ if (this.getText_) {
812
+ var text = this.getText_.call(this);
813
+ if (text !== null) {
814
+ return String(text);
815
+ }
816
+ }
817
+ return String(this.getValue());
818
+ };
819
+
820
+ /**
821
+ * Set the text in this field. Trigger a rerender of the source block.
822
+ * @param {*} _newText New text.
823
+ * @deprecated 2019 setText should not be used directly. Use setValue instead.
824
+ */
825
+ Blockly.Field.prototype.setText = function(_newText) {
826
+ Blockly.utils.deprecation.warn(
827
+ 'Field.prototype.setText',
828
+ 'May 2019',
829
+ 'December 2020',
830
+ 'Blockly.Field.prototype.setValue');
831
+ throw Error('setText method is deprecated');
832
+ };
833
+
834
+ /**
835
+ * Force a rerender of the block that this field is installed on, which will
836
+ * rerender this field and adjust for any sizing changes.
837
+ * Other fields on the same block will not rerender, because their sizes have
838
+ * already been recorded.
839
+ * @package
840
+ */
841
+ Blockly.Field.prototype.markDirty = function() {
842
+ this.isDirty_ = true;
843
+ this.constants_ = null;
844
+ };
845
+
846
+ /**
847
+ * Force a rerender of the block that this field is installed on, which will
848
+ * rerender this field and adjust for any sizing changes.
849
+ * Other fields on the same block will not rerender, because their sizes have
850
+ * already been recorded.
851
+ * @package
852
+ */
853
+ Blockly.Field.prototype.forceRerender = function() {
854
+ this.isDirty_ = true;
855
+ if (this.sourceBlock_ && this.sourceBlock_.rendered) {
856
+ this.sourceBlock_.render();
857
+ this.sourceBlock_.bumpNeighbours();
858
+ this.updateMarkers_();
859
+ }
860
+ };
861
+
862
+ /**
863
+ * Used to change the value of the field. Handles validation and events.
864
+ * Subclasses should override doClassValidation_ and doValueUpdate_ rather
865
+ * than this method.
866
+ * @param {*} newValue New value.
867
+ */
868
+ Blockly.Field.prototype.setValue = function(newValue) {
869
+ var doLogging = false;
870
+ if (newValue === null) {
871
+ doLogging && console.log('null, return');
872
+ // Not a valid value to check.
873
+ return;
874
+ }
875
+
876
+ var validatedValue = this.doClassValidation_(newValue);
877
+ // Class validators might accidentally forget to return, we'll ignore that.
878
+ newValue = this.processValidation_(newValue, validatedValue);
879
+ if (newValue instanceof Error) {
880
+ doLogging && console.log('invalid class validation, return');
881
+ return;
882
+ }
883
+
884
+ var localValidator = this.getValidator();
885
+ if (localValidator) {
886
+ validatedValue = localValidator.call(this, newValue);
887
+ // Local validators might accidentally forget to return, we'll ignore that.
888
+ newValue = this.processValidation_(newValue, validatedValue);
889
+ if (newValue instanceof Error) {
890
+ doLogging && console.log('invalid local validation, return');
891
+ return;
892
+ }
893
+ }
894
+ var source = this.sourceBlock_;
895
+ if (source && source.disposed) {
896
+ doLogging && console.log('source disposed, return');
897
+ return;
898
+ }
899
+ var oldValue = this.getValue();
900
+ if (oldValue === newValue) {
901
+ doLogging && console.log('same, return');
902
+ return;
903
+ }
904
+
905
+ if (source && Blockly.Events.isEnabled()) {
906
+ Blockly.Events.fire(new Blockly.Events.BlockChange(
907
+ source, 'field', this.name || null, oldValue, newValue));
908
+ }
909
+ this.doValueUpdate_(newValue);
910
+ if (this.isDirty_) {
911
+ this.forceRerender();
912
+ }
913
+ doLogging && console.log(this.value_);
914
+ };
915
+
916
+ /**
917
+ * Process the result of validation.
918
+ * @param {*} newValue New value.
919
+ * @param {*} validatedValue Validated value.
920
+ * @return {*} New value, or an Error object.
921
+ * @private
922
+ */
923
+ Blockly.Field.prototype.processValidation_ = function(newValue,
924
+ validatedValue) {
925
+ if (validatedValue === null) {
926
+ this.doValueInvalid_(newValue);
927
+ if (this.isDirty_) {
928
+ this.forceRerender();
929
+ }
930
+ return Error();
931
+ }
932
+ if (validatedValue !== undefined) {
933
+ newValue = validatedValue;
934
+ }
935
+ return newValue;
936
+ };
937
+
938
+ /**
939
+ * Get the current value of the field.
940
+ * @return {*} Current value.
941
+ */
942
+ Blockly.Field.prototype.getValue = function() {
943
+ return this.value_;
944
+ };
945
+
946
+ /**
947
+ * Used to validate a value. Returns input by default. Can be overridden by
948
+ * subclasses, see FieldDropdown.
949
+ * @param {*=} opt_newValue The value to be validated.
950
+ * @return {*} The validated value, same as input by default.
951
+ * @protected
952
+ * @suppress {deprecated} Suppress deprecated this.classValidator call.
953
+ */
954
+ Blockly.Field.prototype.doClassValidation_ = function(opt_newValue) {
955
+ if (opt_newValue === null || opt_newValue === undefined) {
956
+ return null;
957
+ }
958
+ // For backwards compatibility.
959
+ opt_newValue = this.classValidator(/** @type {string} */ (opt_newValue));
960
+ return opt_newValue;
961
+ };
962
+
963
+ /**
964
+ * Used to update the value of a field. Can be overridden by subclasses to do
965
+ * custom storage of values/updating of external things.
966
+ * @param {*} newValue The value to be saved.
967
+ * @protected
968
+ */
969
+ Blockly.Field.prototype.doValueUpdate_ = function(newValue) {
970
+ this.value_ = newValue;
971
+ this.isDirty_ = true;
972
+ };
973
+
974
+ /**
975
+ * Used to notify the field an invalid value was input. Can be overridden by
976
+ * subclasses, see FieldTextInput.
977
+ * No-op by default.
978
+ * @param {*} _invalidValue The input value that was determined to be invalid.
979
+ * @protected
980
+ */
981
+ Blockly.Field.prototype.doValueInvalid_ = function(_invalidValue) {
982
+ // NOP
983
+ };
984
+
985
+ /**
986
+ * Handle a mouse down event on a field.
987
+ * @param {!Event} e Mouse down event.
988
+ * @protected
989
+ */
990
+ Blockly.Field.prototype.onMouseDown_ = function(e) {
991
+ if (!this.sourceBlock_ || !this.sourceBlock_.workspace) {
992
+ return;
993
+ }
994
+ var gesture = this.sourceBlock_.workspace.getGesture(e);
995
+ if (gesture) {
996
+ gesture.setStartField(this);
997
+ }
998
+ };
999
+
1000
+ /**
1001
+ * Sets the tooltip for this field.
1002
+ * @param {?Blockly.Tooltip.TipInfo} newTip The
1003
+ * text for the tooltip, a function that returns the text for the tooltip, a
1004
+ * parent object whose tooltip will be used, or null to display the tooltip
1005
+ * of the parent block. To not display a tooltip pass the empty string.
1006
+ */
1007
+ Blockly.Field.prototype.setTooltip = function(newTip) {
1008
+ if (!newTip && newTip !== '') { // If null or undefined.
1009
+ newTip = this.sourceBlock_;
1010
+ }
1011
+ var clickTarget = this.getClickTarget_();
1012
+ if (clickTarget) {
1013
+ clickTarget.tooltip = newTip;
1014
+ } else {
1015
+ // Field has not been initialized yet.
1016
+ this.tooltip_ = newTip;
1017
+ }
1018
+ };
1019
+
1020
+ /**
1021
+ * Returns the tooltip text for this field.
1022
+ * @returns {string} The tooltip text for this field.
1023
+ */
1024
+ Blockly.Field.prototype.getTooltip = function() {
1025
+ var clickTarget = this.getClickTarget_();
1026
+ if (clickTarget) {
1027
+ return Blockly.Tooltip.getTooltipOfObject(clickTarget);
1028
+ }
1029
+ // Field has not been initialized yet. Return stashed this.tooltip_ value.
1030
+ return Blockly.Tooltip.getTooltipOfObject({tooltip: this.tooltip_});
1031
+ };
1032
+
1033
+ /**
1034
+ * The element to bind the click handler to. If not set explicitly, defaults
1035
+ * to the SVG root of the field. When this element is
1036
+ * clicked on an editable field, the editor will open.
1037
+ * @return {!Element} Element to bind click handler to.
1038
+ * @protected
1039
+ */
1040
+ Blockly.Field.prototype.getClickTarget_ = function() {
1041
+ return this.clickTarget_ || this.getSvgRoot();
1042
+ };
1043
+
1044
+ /**
1045
+ * Return the absolute coordinates of the top-left corner of this field.
1046
+ * The origin (0,0) is the top-left corner of the page body.
1047
+ * @return {!Blockly.utils.Coordinate} Object with .x and .y properties.
1048
+ * @protected
1049
+ */
1050
+ Blockly.Field.prototype.getAbsoluteXY_ = function() {
1051
+ return Blockly.utils.style.getPageOffset(
1052
+ /** @type {!SVGRectElement} */ (this.getClickTarget_()));
1053
+ };
1054
+
1055
+ /**
1056
+ * Whether this field references any Blockly variables. If true it may need to
1057
+ * be handled differently during serialization and deserialization. Subclasses
1058
+ * may override this.
1059
+ * @return {boolean} True if this field has any variable references.
1060
+ * @package
1061
+ */
1062
+ Blockly.Field.prototype.referencesVariables = function() {
1063
+ return false;
1064
+ };
1065
+
1066
+ /**
1067
+ * Search through the list of inputs and their fields in order to find the
1068
+ * parent input of a field.
1069
+ * @return {Blockly.Input} The input that the field belongs to.
1070
+ * @package
1071
+ */
1072
+ Blockly.Field.prototype.getParentInput = function() {
1073
+ var parentInput = null;
1074
+ var block = this.sourceBlock_;
1075
+ var inputs = block.inputList;
1076
+
1077
+ for (var idx = 0; idx < block.inputList.length; idx++) {
1078
+ var input = inputs[idx];
1079
+ var fieldRows = input.fieldRow;
1080
+ for (var j = 0; j < fieldRows.length; j++) {
1081
+ if (fieldRows[j] === this) {
1082
+ parentInput = input;
1083
+ break;
1084
+ }
1085
+ }
1086
+ }
1087
+ return parentInput;
1088
+ };
1089
+
1090
+ /**
1091
+ * Returns whether or not we should flip the field in RTL.
1092
+ * @return {boolean} True if we should flip in RTL.
1093
+ */
1094
+ Blockly.Field.prototype.getFlipRtl = function() {
1095
+ return false;
1096
+ };
1097
+
1098
+ /**
1099
+ * Returns whether or not the field is tab navigable.
1100
+ * @return {boolean} True if the field is tab navigable.
1101
+ */
1102
+ Blockly.Field.prototype.isTabNavigable = function() {
1103
+ return false;
1104
+ };
1105
+
1106
+ /**
1107
+ * Handles the given action.
1108
+ * This is only triggered when keyboard accessibility mode is enabled.
1109
+ * @param {!Blockly.Action} _action The action to be handled.
1110
+ * @return {boolean} True if the field handled the action, false otherwise.
1111
+ * @package
1112
+ */
1113
+ Blockly.Field.prototype.onBlocklyAction = function(_action) {
1114
+ return false;
1115
+ };
1116
+
1117
+ /**
1118
+ * Add the cursor svg to this fields svg group.
1119
+ * @param {SVGElement} cursorSvg The svg root of the cursor to be added to the
1120
+ * field group.
1121
+ * @package
1122
+ */
1123
+ Blockly.Field.prototype.setCursorSvg = function(cursorSvg) {
1124
+ if (!cursorSvg) {
1125
+ this.cursorSvg_ = null;
1126
+ return;
1127
+ }
1128
+
1129
+ this.fieldGroup_.appendChild(cursorSvg);
1130
+ this.cursorSvg_ = cursorSvg;
1131
+ };
1132
+
1133
+ /**
1134
+ * Add the marker svg to this fields svg group.
1135
+ * @param {SVGElement} markerSvg The svg root of the marker to be added to the
1136
+ * field group.
1137
+ * @package
1138
+ */
1139
+ Blockly.Field.prototype.setMarkerSvg = function(markerSvg) {
1140
+ if (!markerSvg) {
1141
+ this.markerSvg_ = null;
1142
+ return;
1143
+ }
1144
+
1145
+ this.fieldGroup_.appendChild(markerSvg);
1146
+ this.markerSvg_ = markerSvg;
1147
+ };
1148
+
1149
+ /**
1150
+ * Redraw any attached marker or cursor svgs if needed.
1151
+ * @protected
1152
+ */
1153
+ Blockly.Field.prototype.updateMarkers_ = function() {
1154
+ var workspace =
1155
+ /** @type {!Blockly.WorkspaceSvg} */ (this.sourceBlock_.workspace);
1156
+ if (workspace.keyboardAccessibilityMode && this.cursorSvg_) {
1157
+ workspace.getCursor().draw();
1158
+ }
1159
+ if (workspace.keyboardAccessibilityMode && this.markerSvg_) {
1160
+ workspace.getMarker(Blockly.navigation.MARKER_NAME).draw();
1161
+ }
1162
+ };