blockly 8.0.4 → 8.0.5-beta.0

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 (858) hide show
  1. package/blockly.min.js +2421 -2688
  2. package/blockly_compressed.js +1499 -1994
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks/blocks.js +3 -2
  5. package/blocks/colour.js +3 -1
  6. package/blocks/lists.js +94 -22
  7. package/blocks/logic.js +14 -6
  8. package/blocks/loops.js +5 -3
  9. package/blocks/math.js +3 -1
  10. package/blocks/procedures.js +3 -1
  11. package/blocks/text.js +14 -6
  12. package/blocks/variables.js +3 -1
  13. package/blocks/variables_dynamic.js +3 -1
  14. package/blocks.d.ts +0 -2
  15. package/blocks_compressed.js +189 -171
  16. package/blocks_compressed.js.map +1 -1
  17. package/closure/goog/base.d.ts +1 -0
  18. package/closure/goog/base_minimal.d.ts +18 -0
  19. package/closure/goog/goog.d.ts +25 -0
  20. package/core/any_aliases.d.ts +1 -0
  21. package/core/any_aliases.ts +1 -0
  22. package/core/block.d.ts +779 -0
  23. package/core/{block.js → block.ts} +610 -719
  24. package/core/block_animations.d.ts +33 -0
  25. package/core/{block_animations.js → block_animations.ts} +75 -79
  26. package/core/block_drag_surface.d.ts +111 -0
  27. package/core/{block_drag_surface.js → block_drag_surface.ts} +85 -117
  28. package/core/block_dragger.d.ts +143 -0
  29. package/core/{block_dragger.js → block_dragger.ts} +139 -176
  30. package/core/block_svg.d.ts +588 -0
  31. package/core/{block_svg.js → block_svg.ts} +494 -630
  32. package/core/blockly.d.ts +562 -0
  33. package/core/blockly.js +1 -1
  34. package/core/blockly.ts +749 -0
  35. package/core/blockly_options.d.ts +69 -0
  36. package/core/blockly_options.ts +81 -0
  37. package/core/blocks.d.ts +17 -0
  38. package/core/{blocks.js → blocks.ts} +4 -8
  39. package/core/browser_events.d.ts +85 -0
  40. package/core/{browser_events.js → browser_events.ts} +98 -93
  41. package/core/bubble.d.ts +279 -0
  42. package/core/{bubble.js → bubble.ts} +277 -370
  43. package/core/bubble_dragger.d.ts +73 -0
  44. package/core/bubble_dragger.ts +229 -0
  45. package/core/bump_objects.d.ts +34 -0
  46. package/core/{bump_objects.js → bump_objects.ts} +54 -52
  47. package/core/clipboard.d.ts +42 -0
  48. package/core/clipboard.ts +91 -0
  49. package/core/comment.d.ts +113 -0
  50. package/core/{comment.js → comment.ts} +135 -185
  51. package/core/common.d.ts +129 -0
  52. package/core/{common.js → common.ts} +105 -82
  53. package/core/component_manager.d.ts +91 -0
  54. package/core/component_manager.ts +211 -0
  55. package/core/config.d.ts +23 -0
  56. package/core/{config.js → config.ts} +12 -19
  57. package/core/connection.d.ts +232 -0
  58. package/core/{connection.js → connection.ts} +187 -237
  59. package/core/connection_checker.d.ts +78 -0
  60. package/core/{connection_checker.js → connection_checker.ts} +66 -77
  61. package/core/connection_db.d.ts +91 -0
  62. package/core/{connection_db.js → connection_db.ts} +62 -87
  63. package/core/connection_type.d.ts +15 -0
  64. package/core/{connection_type.js → connection_type.ts} +8 -12
  65. package/core/constants.d.ts +15 -0
  66. package/core/{constants.js → constants.ts} +4 -8
  67. package/core/contextmenu.d.ts +80 -0
  68. package/core/{contextmenu.js → contextmenu.ts} +118 -153
  69. package/core/contextmenu_items.d.ts +77 -0
  70. package/core/contextmenu_items.ts +576 -0
  71. package/core/contextmenu_registry.d.ts +105 -0
  72. package/core/contextmenu_registry.ts +179 -0
  73. package/core/css.d.ts +24 -0
  74. package/core/{css.js → css.ts} +16 -24
  75. package/core/delete_area.d.ts +47 -0
  76. package/core/delete_area.ts +82 -0
  77. package/core/dialog.d.ts +61 -0
  78. package/core/dialog.ts +127 -0
  79. package/core/drag_target.d.ts +63 -0
  80. package/core/drag_target.ts +94 -0
  81. package/core/dropdowndiv.d.ts +155 -0
  82. package/core/{dropdowndiv.js → dropdowndiv.ts} +262 -333
  83. package/core/events/events.d.ts +102 -0
  84. package/core/events/events.ts +123 -0
  85. package/core/events/events_abstract.d.ts +51 -0
  86. package/core/events/events_abstract.ts +112 -0
  87. package/core/events/events_block_base.d.ts +31 -0
  88. package/core/events/events_block_base.ts +65 -0
  89. package/core/events/events_block_change.d.ts +55 -0
  90. package/core/events/{events_block_change.js → events_block_change.ts} +45 -48
  91. package/core/events/events_block_create.d.ts +35 -0
  92. package/core/events/{events_block_create.js → events_block_create.ts} +30 -35
  93. package/core/events/events_block_delete.d.ts +36 -0
  94. package/core/events/{events_block_delete.js → events_block_delete.ts} +34 -39
  95. package/core/events/events_block_drag.d.ts +36 -0
  96. package/core/events/events_block_drag.ts +82 -0
  97. package/core/events/events_block_move.d.ts +51 -0
  98. package/core/events/{events_block_move.js → events_block_move.ts} +54 -50
  99. package/core/events/events_bubble_open.d.ts +35 -0
  100. package/core/events/events_bubble_open.ts +82 -0
  101. package/core/events/events_click.d.ts +36 -0
  102. package/core/events/{events_click.js → events_click.ts} +27 -30
  103. package/core/events/events_comment_base.d.ts +39 -0
  104. package/core/events/events_comment_base.ts +107 -0
  105. package/core/events/events_comment_change.d.ts +43 -0
  106. package/core/events/{events_comment_change.js → events_comment_change.ts} +31 -28
  107. package/core/events/events_comment_create.d.ts +35 -0
  108. package/core/events/{events_comment_create.js → events_comment_create.ts} +24 -26
  109. package/core/events/events_comment_delete.d.ts +35 -0
  110. package/core/events/{events_comment_delete.js → events_comment_delete.ts} +20 -24
  111. package/core/events/events_comment_move.d.ts +55 -0
  112. package/core/events/{events_comment_move.js → events_comment_move.ts} +39 -42
  113. package/core/events/events_marker_move.d.ts +40 -0
  114. package/core/events/events_marker_move.ts +99 -0
  115. package/core/events/events_selected.d.ts +34 -0
  116. package/core/events/events_selected.ts +78 -0
  117. package/core/events/events_theme_change.d.ts +30 -0
  118. package/core/events/{events_theme_change.js → events_theme_change.ts} +19 -24
  119. package/core/events/events_toolbox_item_select.d.ts +34 -0
  120. package/core/events/events_toolbox_item_select.ts +79 -0
  121. package/core/events/events_trashcan_open.d.ts +31 -0
  122. package/core/events/events_trashcan_open.ts +68 -0
  123. package/core/events/events_ui.d.ts +37 -0
  124. package/core/events/{events_ui.js → events_ui.ts} +27 -26
  125. package/core/events/events_ui_base.d.ts +26 -0
  126. package/core/events/{events_ui_base.js → events_ui_base.ts} +17 -26
  127. package/core/events/events_var_base.d.ts +31 -0
  128. package/core/events/events_var_base.ts +65 -0
  129. package/core/events/events_var_create.d.ts +35 -0
  130. package/core/events/{events_var_create.js → events_var_create.ts} +24 -25
  131. package/core/events/events_var_delete.d.ts +35 -0
  132. package/core/events/{events_var_delete.js → events_var_delete.ts} +24 -25
  133. package/core/events/events_var_rename.d.ts +36 -0
  134. package/core/events/{events_var_rename.js → events_var_rename.ts} +25 -26
  135. package/core/events/events_viewport.d.ts +39 -0
  136. package/core/events/events_viewport.ts +100 -0
  137. package/core/events/utils.d.ts +272 -0
  138. package/core/events/{utils.js → utils.ts} +148 -219
  139. package/core/events/workspace_events.d.ts +36 -0
  140. package/core/events/workspace_events.ts +86 -0
  141. package/core/extensions.d.ts +107 -0
  142. package/core/{extensions.js → extensions.ts} +153 -172
  143. package/core/field.d.ts +534 -0
  144. package/core/{field.js → field.ts} +413 -489
  145. package/core/field_angle.d.ts +176 -0
  146. package/core/field_angle.ts +563 -0
  147. package/core/field_checkbox.d.ts +124 -0
  148. package/core/field_checkbox.ts +243 -0
  149. package/core/field_colour.d.ts +200 -0
  150. package/core/field_colour.ts +632 -0
  151. package/core/field_dropdown.d.ts +222 -0
  152. package/core/{field_dropdown.js → field_dropdown.ts} +277 -299
  153. package/core/field_image.d.ts +134 -0
  154. package/core/field_image.ts +282 -0
  155. package/core/field_label.d.ts +71 -0
  156. package/core/field_label.ts +152 -0
  157. package/core/field_label_serializable.d.ts +42 -0
  158. package/core/field_label_serializable.ts +76 -0
  159. package/core/field_multilineinput.d.ts +146 -0
  160. package/core/{field_multilineinput.js → field_multilineinput.ts} +166 -163
  161. package/core/field_number.d.ts +156 -0
  162. package/core/{field_number.js → field_number.ts} +110 -123
  163. package/core/field_registry.d.ts +45 -0
  164. package/core/{field_registry.js → field_registry.ts} +37 -30
  165. package/core/field_textinput.d.ts +219 -0
  166. package/core/field_textinput.ts +591 -0
  167. package/core/field_variable.d.ts +217 -0
  168. package/core/{field_variable.js → field_variable.ts} +174 -187
  169. package/core/flyout_base.d.ts +459 -0
  170. package/core/{flyout_base.js → flyout_base.ts} +429 -518
  171. package/core/flyout_button.d.ts +81 -0
  172. package/core/flyout_button.ts +292 -0
  173. package/core/flyout_horizontal.d.ts +82 -0
  174. package/core/{flyout_horizontal.js → flyout_horizontal.ts} +97 -107
  175. package/core/flyout_metrics_manager.d.ts +40 -0
  176. package/core/{flyout_metrics_manager.js → flyout_metrics_manager.ts} +22 -34
  177. package/core/flyout_vertical.d.ts +83 -0
  178. package/core/{flyout_vertical.js → flyout_vertical.ts} +106 -117
  179. package/core/generator.d.ts +205 -0
  180. package/core/{generator.js → generator.ts} +168 -193
  181. package/core/gesture.d.ts +357 -0
  182. package/core/{gesture.js → gesture.ts} +289 -369
  183. package/core/grid.d.ts +83 -0
  184. package/core/grid.ts +192 -0
  185. package/core/icon.d.ts +78 -0
  186. package/core/icon.ts +189 -0
  187. package/core/inject.d.ts +15 -0
  188. package/core/{inject.js → inject.ts} +101 -100
  189. package/core/input.d.ts +128 -0
  190. package/core/input.ts +309 -0
  191. package/core/input_types.d.ts +14 -0
  192. package/core/{input_types.js → input_types.ts} +8 -12
  193. package/core/insertion_marker_manager.d.ts +212 -0
  194. package/core/{insertion_marker_manager.js → insertion_marker_manager.ts} +234 -236
  195. package/core/interfaces/i_ast_node_location.d.ts +11 -0
  196. package/core/interfaces/{i_ast_node_location.js → i_ast_node_location.ts} +4 -7
  197. package/core/interfaces/i_ast_node_location_svg.d.ts +22 -0
  198. package/core/interfaces/i_ast_node_location_svg.ts +37 -0
  199. package/core/interfaces/i_ast_node_location_with_block.d.ts +18 -0
  200. package/core/interfaces/i_ast_node_location_with_block.ts +38 -0
  201. package/core/interfaces/i_autohideable.d.ts +18 -0
  202. package/core/interfaces/i_autohideable.ts +34 -0
  203. package/core/interfaces/i_block_dragger.d.ts +43 -0
  204. package/core/interfaces/i_block_dragger.ts +67 -0
  205. package/core/interfaces/i_bounded_element.d.ts +24 -0
  206. package/core/interfaces/i_bounded_element.ts +42 -0
  207. package/core/interfaces/i_bubble.d.ts +59 -0
  208. package/core/interfaces/i_bubble.ts +88 -0
  209. package/core/interfaces/i_collapsible_toolbox_item.d.ts +26 -0
  210. package/core/interfaces/i_collapsible_toolbox_item.ts +47 -0
  211. package/core/interfaces/i_component.d.ts +17 -0
  212. package/core/interfaces/{i_component.js → i_component.ts} +9 -14
  213. package/core/interfaces/i_connection_checker.d.ts +69 -0
  214. package/core/interfaces/i_connection_checker.ts +102 -0
  215. package/core/interfaces/i_contextmenu.d.ts +13 -0
  216. package/core/interfaces/i_contextmenu.ts +26 -0
  217. package/core/interfaces/i_copyable.d.ts +24 -0
  218. package/core/interfaces/i_copyable.ts +40 -0
  219. package/core/interfaces/i_deletable.d.ts +16 -0
  220. package/core/interfaces/{i_deletable.js → i_deletable.ts} +9 -13
  221. package/core/interfaces/i_delete_area.d.ts +25 -0
  222. package/core/interfaces/i_delete_area.ts +46 -0
  223. package/core/interfaces/i_drag_target.d.ts +53 -0
  224. package/core/interfaces/i_drag_target.ts +84 -0
  225. package/core/interfaces/i_draggable.d.ts +12 -0
  226. package/core/interfaces/{i_draggable.js → i_draggable.ts} +4 -10
  227. package/core/interfaces/i_flyout.d.ts +134 -0
  228. package/core/interfaces/i_flyout.ts +186 -0
  229. package/core/interfaces/i_keyboard_accessible.d.ts +18 -0
  230. package/core/interfaces/i_keyboard_accessible.ts +35 -0
  231. package/core/interfaces/i_metrics_manager.d.ts +117 -0
  232. package/core/interfaces/i_metrics_manager.ts +151 -0
  233. package/core/interfaces/i_movable.d.ts +16 -0
  234. package/core/interfaces/{i_movable.js → i_movable.ts} +9 -13
  235. package/core/interfaces/i_positionable.d.ts +27 -0
  236. package/core/interfaces/i_positionable.ts +50 -0
  237. package/core/interfaces/i_registrable.d.ts +11 -0
  238. package/core/interfaces/{i_registrable.js → i_registrable.ts} +3 -7
  239. package/core/interfaces/i_registrable_field.d.ts +17 -0
  240. package/core/interfaces/{i_registrable_field.js → i_registrable_field.ts} +8 -16
  241. package/core/interfaces/i_selectable.d.ts +18 -0
  242. package/core/interfaces/i_selectable.ts +34 -0
  243. package/core/interfaces/i_selectable_toolbox_item.d.ts +42 -0
  244. package/core/interfaces/i_selectable_toolbox_item.ts +64 -0
  245. package/core/interfaces/i_serializer.d.ts +42 -0
  246. package/core/interfaces/i_serializer.ts +65 -0
  247. package/core/interfaces/i_styleable.d.ts +21 -0
  248. package/core/interfaces/i_styleable.ts +35 -0
  249. package/core/interfaces/i_toolbox.d.ts +85 -0
  250. package/core/interfaces/i_toolbox.ts +127 -0
  251. package/core/interfaces/i_toolbox_item.d.ts +62 -0
  252. package/core/interfaces/i_toolbox_item.ts +84 -0
  253. package/core/internal_constants.d.ts +40 -0
  254. package/core/{internal_constants.js → internal_constants.ts} +13 -18
  255. package/core/keyboard_nav/ast_node.d.ts +239 -0
  256. package/core/keyboard_nav/{ast_node.js → ast_node.ts} +207 -231
  257. package/core/keyboard_nav/basic_cursor.d.ts +88 -0
  258. package/core/keyboard_nav/{basic_cursor.js → basic_cursor.ts} +55 -66
  259. package/core/keyboard_nav/cursor.d.ts +41 -0
  260. package/core/keyboard_nav/{cursor.js → cursor.ts} +25 -35
  261. package/core/keyboard_nav/marker.d.ts +58 -0
  262. package/core/keyboard_nav/{marker.js → marker.ts} +36 -55
  263. package/core/keyboard_nav/tab_navigate_cursor.d.ts +19 -0
  264. package/core/keyboard_nav/{tab_navigate_cursor.js → tab_navigate_cursor.ts} +11 -15
  265. package/core/main.d.ts +11 -0
  266. package/core/main.js +303 -0
  267. package/core/marker_manager.d.ts +85 -0
  268. package/core/marker_manager.ts +181 -0
  269. package/core/menu.d.ts +149 -0
  270. package/core/{menu.js → menu.ts} +141 -174
  271. package/core/menuitem.d.ts +118 -0
  272. package/core/menuitem.ts +240 -0
  273. package/core/metrics_manager.d.ts +201 -0
  274. package/core/{metrics_manager.js → metrics_manager.ts} +117 -156
  275. package/core/msg.d.ts +9 -0
  276. package/core/{msg.js → msg.ts} +4 -8
  277. package/core/mutator.d.ts +128 -0
  278. package/core/{mutator.js → mutator.ts} +196 -211
  279. package/core/names.d.ts +124 -0
  280. package/core/names.ts +267 -0
  281. package/core/options.d.ts +137 -0
  282. package/core/{options.js → options.ts} +147 -173
  283. package/core/positionable_helpers.d.ts +88 -0
  284. package/core/{positionable_helpers.js → positionable_helpers.ts} +63 -70
  285. package/core/procedures.d.ts +108 -0
  286. package/core/{procedures.js → procedures.ts} +143 -152
  287. package/core/registry.d.ts +137 -0
  288. package/core/registry.ts +339 -0
  289. package/core/rendered_connection.d.ts +191 -0
  290. package/core/{rendered_connection.js → rendered_connection.ts} +164 -184
  291. package/core/renderers/common/block_rendering.d.ts +114 -0
  292. package/core/renderers/common/block_rendering.ts +164 -0
  293. package/core/renderers/common/constants.d.ts +458 -0
  294. package/core/renderers/common/constants.ts +1124 -0
  295. package/core/renderers/common/debug.d.ts +28 -0
  296. package/core/renderers/common/{debug.js → debug.ts} +14 -20
  297. package/core/renderers/common/debugger.d.ts +120 -0
  298. package/core/renderers/common/{debugger.js → debugger.ts} +100 -124
  299. package/core/renderers/common/drawer.d.ts +132 -0
  300. package/core/renderers/common/{drawer.js → drawer.ts} +112 -137
  301. package/core/renderers/common/i_path_object.d.ts +117 -0
  302. package/core/renderers/common/i_path_object.ts +161 -0
  303. package/core/renderers/common/info.d.ts +194 -0
  304. package/core/renderers/common/{info.js → info.ts} +165 -222
  305. package/core/renderers/common/marker_svg.d.ts +220 -0
  306. package/core/renderers/common/marker_svg.ts +680 -0
  307. package/core/renderers/common/path_object.d.ts +146 -0
  308. package/core/renderers/common/path_object.ts +272 -0
  309. package/core/renderers/common/renderer.d.ts +157 -0
  310. package/core/renderers/common/renderer.ts +271 -0
  311. package/core/renderers/geras/constants.d.ts +23 -0
  312. package/core/renderers/geras/constants.ts +61 -0
  313. package/core/renderers/geras/drawer.d.ts +43 -0
  314. package/core/renderers/geras/{drawer.js → drawer.ts} +40 -84
  315. package/core/renderers/geras/geras.d.ts +11 -0
  316. package/core/renderers/geras/geras.ts +37 -0
  317. package/core/renderers/geras/highlight_constants.d.ts +108 -0
  318. package/core/renderers/geras/{highlight_constants.js → highlight_constants.ts} +107 -69
  319. package/core/renderers/geras/highlighter.d.ts +98 -0
  320. package/core/renderers/geras/{highlighter.js → highlighter.ts} +81 -86
  321. package/core/renderers/geras/info.d.ts +45 -0
  322. package/core/renderers/geras/{info.js → info.ts} +61 -99
  323. package/core/renderers/geras/measurables/inline_input.d.ts +23 -0
  324. package/core/renderers/geras/measurables/inline_input.ts +51 -0
  325. package/core/renderers/geras/measurables/statement_input.d.ts +23 -0
  326. package/core/renderers/geras/measurables/statement_input.ts +50 -0
  327. package/core/renderers/geras/path_object.d.ts +47 -0
  328. package/core/renderers/geras/{path_object.js → path_object.ts} +46 -74
  329. package/core/renderers/geras/renderer.d.ts +69 -0
  330. package/core/renderers/geras/renderer.ts +126 -0
  331. package/core/renderers/measurables/base.d.ts +27 -0
  332. package/core/renderers/measurables/base.ts +53 -0
  333. package/core/renderers/measurables/bottom_row.d.ts +61 -0
  334. package/core/renderers/measurables/bottom_row.ts +120 -0
  335. package/core/renderers/measurables/connection.d.ts +25 -0
  336. package/core/renderers/measurables/connection.ts +52 -0
  337. package/core/renderers/measurables/external_value_input.d.ts +27 -0
  338. package/core/renderers/measurables/external_value_input.ts +65 -0
  339. package/core/renderers/measurables/field.d.ts +30 -0
  340. package/core/renderers/measurables/field.ts +63 -0
  341. package/core/renderers/measurables/hat.d.ts +21 -0
  342. package/core/renderers/measurables/{hat.js → hat.ts} +12 -14
  343. package/core/renderers/measurables/icon.d.ts +26 -0
  344. package/core/renderers/measurables/{icon.js → icon.ts} +14 -18
  345. package/core/renderers/measurables/in_row_spacer.d.ts +21 -0
  346. package/core/renderers/measurables/in_row_spacer.ts +44 -0
  347. package/core/renderers/measurables/inline_input.d.ts +24 -0
  348. package/core/renderers/measurables/{inline_input.js → inline_input.ts} +22 -26
  349. package/core/renderers/measurables/input_connection.d.ts +29 -0
  350. package/core/renderers/measurables/input_connection.ts +66 -0
  351. package/core/renderers/measurables/input_row.d.ts +30 -0
  352. package/core/renderers/measurables/{input_row.js → input_row.ts} +24 -31
  353. package/core/renderers/measurables/jagged_edge.d.ts +20 -0
  354. package/core/renderers/measurables/{jagged_edge.js → jagged_edge.ts} +10 -13
  355. package/core/renderers/measurables/next_connection.d.ts +23 -0
  356. package/core/renderers/measurables/next_connection.ts +47 -0
  357. package/core/renderers/measurables/output_connection.d.ts +26 -0
  358. package/core/renderers/measurables/output_connection.ts +56 -0
  359. package/core/renderers/measurables/previous_connection.d.ts +23 -0
  360. package/core/renderers/measurables/previous_connection.ts +47 -0
  361. package/core/renderers/measurables/round_corner.d.ts +21 -0
  362. package/core/renderers/measurables/round_corner.ts +49 -0
  363. package/core/renderers/measurables/row.d.ts +141 -0
  364. package/core/renderers/measurables/row.ts +225 -0
  365. package/core/renderers/measurables/spacer_row.d.ts +29 -0
  366. package/core/renderers/measurables/spacer_row.ts +55 -0
  367. package/core/renderers/measurables/square_corner.d.ts +21 -0
  368. package/core/renderers/measurables/square_corner.ts +47 -0
  369. package/core/renderers/measurables/statement_input.d.ts +22 -0
  370. package/core/renderers/measurables/{statement_input.js → statement_input.ts} +14 -18
  371. package/core/renderers/measurables/top_row.d.ts +56 -0
  372. package/core/renderers/measurables/top_row.ts +122 -0
  373. package/core/renderers/measurables/types.d.ts +235 -0
  374. package/core/renderers/measurables/types.ts +332 -0
  375. package/core/renderers/minimalist/constants.d.ts +14 -0
  376. package/core/renderers/minimalist/{constants.js → constants.ts} +5 -10
  377. package/core/renderers/minimalist/drawer.d.ts +21 -0
  378. package/core/renderers/minimalist/drawer.ts +38 -0
  379. package/core/renderers/minimalist/info.d.ts +30 -0
  380. package/core/renderers/minimalist/info.ts +52 -0
  381. package/core/renderers/minimalist/minimalist.d.ts +6 -0
  382. package/core/renderers/minimalist/minimalist.ts +22 -0
  383. package/core/renderers/minimalist/renderer.d.ts +41 -0
  384. package/core/renderers/minimalist/renderer.ts +71 -0
  385. package/core/renderers/thrasos/info.d.ts +40 -0
  386. package/core/renderers/thrasos/{info.js → info.ts} +66 -67
  387. package/core/renderers/thrasos/renderer.d.ts +25 -0
  388. package/core/renderers/thrasos/renderer.ts +48 -0
  389. package/core/renderers/thrasos/thrasos.d.ts +4 -0
  390. package/core/renderers/thrasos/thrasos.ts +20 -0
  391. package/core/renderers/zelos/constants.d.ts +186 -0
  392. package/core/renderers/zelos/{constants.js → constants.ts} +294 -441
  393. package/core/renderers/zelos/drawer.d.ts +47 -0
  394. package/core/renderers/zelos/{drawer.js → drawer.ts} +73 -95
  395. package/core/renderers/zelos/info.d.ts +88 -0
  396. package/core/renderers/zelos/{info.js → info.ts} +111 -142
  397. package/core/renderers/zelos/marker_svg.d.ts +46 -0
  398. package/core/renderers/zelos/marker_svg.ts +151 -0
  399. package/core/renderers/zelos/measurables/bottom_row.d.ts +27 -0
  400. package/core/renderers/zelos/measurables/bottom_row.ts +53 -0
  401. package/core/renderers/zelos/measurables/inputs.d.ts +23 -0
  402. package/core/renderers/zelos/measurables/{inputs.js → inputs.ts} +14 -15
  403. package/core/renderers/zelos/measurables/row_elements.d.ts +21 -0
  404. package/core/renderers/zelos/measurables/row_elements.ts +45 -0
  405. package/core/renderers/zelos/measurables/top_row.d.ts +29 -0
  406. package/core/renderers/zelos/measurables/{top_row.js → top_row.ts} +14 -27
  407. package/core/renderers/zelos/path_object.d.ts +77 -0
  408. package/core/renderers/zelos/path_object.ts +215 -0
  409. package/core/renderers/zelos/renderer.d.ts +74 -0
  410. package/core/renderers/zelos/renderer.ts +142 -0
  411. package/core/renderers/zelos/zelos.d.ts +12 -0
  412. package/core/renderers/zelos/zelos.ts +39 -0
  413. package/core/scrollbar.d.ts +277 -0
  414. package/core/{scrollbar.js → scrollbar.ts} +307 -328
  415. package/core/scrollbar_pair.d.ts +105 -0
  416. package/core/{scrollbar_pair.js → scrollbar_pair.ts} +71 -79
  417. package/core/serialization/blocks.d.ts +98 -0
  418. package/core/serialization/{blocks.js → blocks.ts} +229 -228
  419. package/core/serialization/exceptions.d.ts +73 -0
  420. package/core/serialization/exceptions.ts +98 -0
  421. package/core/serialization/priorities.d.ts +15 -0
  422. package/core/serialization/{priorities.js → priorities.ts} +4 -10
  423. package/core/serialization/registry.d.ts +20 -0
  424. package/core/serialization/{registry.js → registry.ts} +11 -13
  425. package/core/serialization/variables.d.ts +14 -0
  426. package/core/serialization/{variables.js → variables.ts} +30 -32
  427. package/core/serialization/workspaces.d.ts +28 -0
  428. package/core/serialization/{workspaces.js → workspaces.ts} +30 -27
  429. package/core/shortcut_items.d.ts +61 -0
  430. package/core/{shortcut_items.js → shortcut_items.ts} +121 -157
  431. package/core/shortcut_registry.d.ts +151 -0
  432. package/core/shortcut_registry.ts +355 -0
  433. package/core/sprites.d.ts +19 -0
  434. package/core/{sprites.js → sprites.ts} +4 -6
  435. package/core/theme/classic.d.ts +12 -0
  436. package/core/theme/{classic.js → classic.ts} +5 -7
  437. package/core/theme/themes.d.ts +8 -0
  438. package/core/theme/themes.ts +22 -0
  439. package/core/theme/zelos.d.ts +11 -0
  440. package/core/theme/{zelos.js → zelos.ts} +4 -7
  441. package/core/theme.d.ts +142 -0
  442. package/core/theme.ts +221 -0
  443. package/core/theme_manager.d.ts +81 -0
  444. package/core/theme_manager.ts +186 -0
  445. package/core/toolbox/category.d.ts +239 -0
  446. package/core/toolbox/category.ts +679 -0
  447. package/core/toolbox/collapsible_category.d.ts +91 -0
  448. package/core/toolbox/collapsible_category.ts +273 -0
  449. package/core/toolbox/separator.d.ts +39 -0
  450. package/core/toolbox/separator.ts +105 -0
  451. package/core/toolbox/toolbox.d.ts +352 -0
  452. package/core/toolbox/{toolbox.js → toolbox.ts} +316 -432
  453. package/core/toolbox/toolbox_item.d.ts +85 -0
  454. package/core/toolbox/toolbox_item.ts +147 -0
  455. package/core/tooltip.d.ts +126 -0
  456. package/core/{tooltip.js → tooltip.ts} +136 -214
  457. package/core/touch.d.ts +121 -0
  458. package/core/touch.ts +306 -0
  459. package/core/touch_gesture.d.ts +115 -0
  460. package/core/{touch_gesture.js → touch_gesture.ts} +87 -125
  461. package/core/trashcan.d.ts +195 -0
  462. package/core/{trashcan.js → trashcan.ts} +226 -312
  463. package/core/utils/aria.d.ts +67 -0
  464. package/core/utils/{aria.js → aria.ts} +47 -61
  465. package/core/utils/array.d.ts +14 -0
  466. package/core/utils/{array.js → array.ts} +10 -12
  467. package/core/utils/colour.d.ts +103 -0
  468. package/core/utils/{colour.js → colour.ts} +60 -72
  469. package/core/utils/coordinate.d.ts +72 -0
  470. package/core/utils/coordinate.ts +124 -0
  471. package/core/utils/deprecation.d.ts +17 -0
  472. package/core/utils/{deprecation.js → deprecation.ts} +11 -11
  473. package/core/utils/dom.d.ts +165 -0
  474. package/core/utils/{dom.js → dom.ts} +125 -147
  475. package/core/utils/idgenerator.d.ts +25 -0
  476. package/core/utils/{idgenerator.js → idgenerator.ts} +15 -18
  477. package/core/utils/keycodes.d.ts +137 -0
  478. package/core/utils/keycodes.ts +169 -0
  479. package/core/utils/math.d.ts +30 -0
  480. package/core/utils/{math.js → math.ts} +17 -19
  481. package/core/utils/metrics.d.ts +64 -0
  482. package/core/utils/metrics.ts +97 -0
  483. package/core/utils/object.d.ts +35 -0
  484. package/core/utils/{object.js → object.ts} +30 -26
  485. package/core/utils/parsing.d.ts +50 -0
  486. package/core/utils/{parsing.js → parsing.ts} +50 -50
  487. package/core/utils/rect.d.ts +38 -0
  488. package/core/utils/{rect.js → rect.ts} +18 -31
  489. package/core/utils/sentinel.d.ts +11 -0
  490. package/core/utils/{sentinel.js → sentinel.ts} +3 -5
  491. package/core/utils/size.d.ts +27 -0
  492. package/core/utils/{size.js → size.ts} +12 -26
  493. package/core/utils/string.d.ts +55 -0
  494. package/core/utils/{string.js → string.ts} +64 -61
  495. package/core/utils/style.d.ts +127 -0
  496. package/core/utils/{style.js → style.ts} +102 -92
  497. package/core/utils/svg.d.ts +68 -0
  498. package/core/utils/svg.ts +88 -0
  499. package/core/utils/svg_math.d.ts +70 -0
  500. package/core/utils/{svg_math.js → svg_math.ts} +72 -71
  501. package/core/utils/svg_paths.d.ts +101 -0
  502. package/core/utils/{svg_paths.js → svg_paths.ts} +56 -65
  503. package/core/utils/toolbox.d.ts +193 -0
  504. package/core/utils/toolbox.ts +433 -0
  505. package/core/utils/useragent.d.ts +33 -0
  506. package/core/utils/useragent.ts +135 -0
  507. package/core/utils/xml.d.ts +52 -0
  508. package/core/utils/{xml.js → xml.ts} +26 -36
  509. package/core/utils.d.ts +217 -0
  510. package/core/utils.ts +428 -0
  511. package/core/variable_map.d.ts +141 -0
  512. package/core/{variable_map.js → variable_map.ts} +131 -149
  513. package/core/variable_model.d.ts +40 -0
  514. package/core/variable_model.ts +82 -0
  515. package/core/variables.d.ts +181 -0
  516. package/core/{variables.js → variables.ts} +206 -188
  517. package/core/variables_dynamic.d.ts +38 -0
  518. package/core/{variables_dynamic.js → variables_dynamic.ts} +47 -43
  519. package/core/warning.d.ts +50 -0
  520. package/core/{warning.js → warning.ts} +52 -66
  521. package/core/widgetdiv.d.ts +69 -0
  522. package/core/widgetdiv.ts +257 -0
  523. package/core/workspace.d.ts +386 -0
  524. package/core/workspace.ts +801 -0
  525. package/core/workspace_audio.d.ts +47 -0
  526. package/core/{workspace_audio.js → workspace_audio.ts} +47 -60
  527. package/core/workspace_comment.d.ts +170 -0
  528. package/core/workspace_comment.ts +398 -0
  529. package/core/workspace_comment_svg.d.ts +329 -0
  530. package/core/{workspace_comment_svg.js → workspace_comment_svg.ts} +347 -444
  531. package/core/workspace_drag_surface_svg.d.ts +68 -0
  532. package/core/{workspace_drag_surface_svg.js → workspace_drag_surface_svg.ts} +75 -82
  533. package/core/workspace_dragger.d.ts +48 -0
  534. package/core/workspace_dragger.ts +104 -0
  535. package/core/workspace_svg.d.ts +920 -0
  536. package/core/{workspace_svg.js → workspace_svg.ts} +855 -935
  537. package/core/xml.d.ts +117 -0
  538. package/core/{xml.js → xml.ts} +306 -326
  539. package/core/zoom_controls.d.ts +130 -0
  540. package/core/{zoom_controls.js → zoom_controls.ts} +185 -251
  541. package/core.d.ts +1 -3
  542. package/core.js +1 -2
  543. package/dart.d.ts +0 -3
  544. package/dart_compressed.js +387 -99
  545. package/dart_compressed.js.map +1 -1
  546. package/generators/dart/all.js +2 -0
  547. package/generators/dart/colour.js +1 -1
  548. package/generators/dart/lists.js +1 -1
  549. package/generators/dart/logic.js +1 -1
  550. package/generators/dart/loops.js +1 -1
  551. package/generators/dart/math.js +1 -1
  552. package/generators/dart/procedures.js +1 -1
  553. package/generators/dart/text.js +1 -1
  554. package/generators/dart/variables.js +1 -1
  555. package/generators/dart/variables_dynamic.js +1 -1
  556. package/generators/dart.js +1 -2
  557. package/generators/javascript/all.js +2 -0
  558. package/generators/javascript/colour.js +1 -1
  559. package/generators/javascript/lists.js +1 -1
  560. package/generators/javascript/logic.js +1 -1
  561. package/generators/javascript/loops.js +1 -1
  562. package/generators/javascript/math.js +4 -4
  563. package/generators/javascript/procedures.js +1 -1
  564. package/generators/javascript/text.js +2 -2
  565. package/generators/javascript/variables.js +1 -1
  566. package/generators/javascript/variables_dynamic.js +1 -1
  567. package/generators/javascript.js +1 -3
  568. package/generators/lua/all.js +2 -0
  569. package/generators/lua/colour.js +1 -1
  570. package/generators/lua/lists.js +1 -1
  571. package/generators/lua/logic.js +1 -1
  572. package/generators/lua/loops.js +1 -1
  573. package/generators/lua/math.js +1 -1
  574. package/generators/lua/procedures.js +1 -1
  575. package/generators/lua/text.js +1 -1
  576. package/generators/lua/variables.js +1 -1
  577. package/generators/lua/variables_dynamic.js +1 -1
  578. package/generators/lua.js +1 -2
  579. package/generators/php/all.js +2 -0
  580. package/generators/php/colour.js +1 -1
  581. package/generators/php/lists.js +1 -2
  582. package/generators/php/logic.js +1 -1
  583. package/generators/php/loops.js +1 -1
  584. package/generators/php/math.js +1 -1
  585. package/generators/php/procedures.js +1 -1
  586. package/generators/php/text.js +1 -1
  587. package/generators/php/variables.js +1 -1
  588. package/generators/php/variables_dynamic.js +1 -1
  589. package/generators/php.js +1 -2
  590. package/generators/python/all.js +2 -0
  591. package/generators/python/colour.js +3 -3
  592. package/generators/python/lists.js +1 -1
  593. package/generators/python/logic.js +1 -1
  594. package/generators/python/loops.js +4 -7
  595. package/generators/python/math.js +1 -1
  596. package/generators/python/procedures.js +1 -1
  597. package/generators/python/text.js +1 -1
  598. package/generators/python/variables.js +1 -1
  599. package/generators/python/variables_dynamic.js +1 -1
  600. package/generators/python.js +1 -2
  601. package/index.d.ts +2 -8
  602. package/javascript.d.ts +0 -3
  603. package/javascript_compressed.js +314 -104
  604. package/javascript_compressed.js.map +1 -1
  605. package/lua.d.ts +0 -3
  606. package/lua_compressed.js +399 -81
  607. package/lua_compressed.js.map +1 -1
  608. package/msg/ab.js +420 -420
  609. package/msg/ace.js +420 -420
  610. package/msg/af.js +420 -420
  611. package/msg/am.js +420 -420
  612. package/msg/ar.js +420 -420
  613. package/msg/ast.js +420 -420
  614. package/msg/az.js +420 -420
  615. package/msg/ba.js +420 -420
  616. package/msg/bcc.js +420 -420
  617. package/msg/be-tarask.js +420 -420
  618. package/msg/be.js +420 -420
  619. package/msg/bg.js +420 -420
  620. package/msg/bn.js +420 -420
  621. package/msg/br.js +420 -420
  622. package/msg/bs.js +420 -420
  623. package/msg/ca.js +420 -420
  624. package/msg/cdo.js +420 -420
  625. package/msg/cs.js +420 -420
  626. package/msg/da.js +420 -420
  627. package/msg/de.js +420 -420
  628. package/msg/diq.js +420 -420
  629. package/msg/dty.js +420 -420
  630. package/msg/ee.js +420 -420
  631. package/msg/el.js +420 -420
  632. package/msg/en-gb.js +420 -420
  633. package/msg/en.js +420 -420
  634. package/msg/eo.js +420 -420
  635. package/msg/es.js +420 -420
  636. package/msg/et.js +420 -420
  637. package/msg/eu.js +420 -420
  638. package/msg/fa.js +420 -420
  639. package/msg/fi.js +420 -420
  640. package/msg/fo.js +420 -420
  641. package/msg/fr.js +420 -420
  642. package/msg/frr.js +420 -420
  643. package/msg/gl.js +420 -420
  644. package/msg/gn.js +420 -420
  645. package/msg/gor.js +420 -420
  646. package/msg/ha.js +420 -420
  647. package/msg/hak.js +420 -420
  648. package/msg/he.js +420 -420
  649. package/msg/hi.js +420 -420
  650. package/msg/hr.js +420 -420
  651. package/msg/hrx.js +420 -420
  652. package/msg/hu.js +420 -420
  653. package/msg/hy.js +420 -420
  654. package/msg/ia.js +420 -420
  655. package/msg/id.js +420 -420
  656. package/msg/ig.js +420 -420
  657. package/msg/inh.js +420 -420
  658. package/msg/is.js +420 -420
  659. package/msg/it.js +420 -420
  660. package/msg/ja.js +420 -420
  661. package/msg/ka.js +420 -420
  662. package/msg/kab.js +420 -420
  663. package/msg/kbd-cyrl.js +420 -420
  664. package/msg/km.js +420 -420
  665. package/msg/kn.js +420 -420
  666. package/msg/ko.js +420 -420
  667. package/msg/ksh.js +420 -420
  668. package/msg/ku-latn.js +420 -420
  669. package/msg/ky.js +420 -420
  670. package/msg/la.js +420 -420
  671. package/msg/lb.js +420 -420
  672. package/msg/lki.js +420 -420
  673. package/msg/lo.js +420 -420
  674. package/msg/lrc.js +420 -420
  675. package/msg/lt.js +420 -420
  676. package/msg/lv.js +420 -420
  677. package/msg/mg.js +420 -420
  678. package/msg/mk.js +420 -420
  679. package/msg/ml.js +420 -420
  680. package/msg/mnw.js +420 -420
  681. package/msg/ms.js +420 -420
  682. package/msg/my.js +420 -420
  683. package/msg/mzn.js +420 -420
  684. package/msg/nb.js +420 -420
  685. package/msg/ne.js +420 -420
  686. package/msg/nl.js +420 -420
  687. package/msg/oc.js +420 -420
  688. package/msg/olo.js +420 -420
  689. package/msg/pa.js +420 -420
  690. package/msg/pl.js +420 -420
  691. package/msg/pms.js +420 -420
  692. package/msg/ps.js +420 -420
  693. package/msg/pt-br.js +420 -420
  694. package/msg/pt.js +420 -420
  695. package/msg/ro.js +420 -420
  696. package/msg/ru.js +420 -420
  697. package/msg/sc.js +420 -420
  698. package/msg/sco.js +420 -420
  699. package/msg/sd.js +420 -420
  700. package/msg/shn.js +420 -420
  701. package/msg/si.js +420 -420
  702. package/msg/sk.js +420 -420
  703. package/msg/skr-arab.js +420 -420
  704. package/msg/sl.js +420 -420
  705. package/msg/smn.js +420 -420
  706. package/msg/sq.js +420 -420
  707. package/msg/sr-latn.js +420 -420
  708. package/msg/sr.js +420 -420
  709. package/msg/sv.js +420 -420
  710. package/msg/sw.js +420 -420
  711. package/msg/ta.js +420 -420
  712. package/msg/tcy.js +420 -420
  713. package/msg/te.js +420 -420
  714. package/msg/th.js +420 -420
  715. package/msg/ti.js +420 -420
  716. package/msg/tl.js +420 -420
  717. package/msg/tlh.js +420 -420
  718. package/msg/tr.js +420 -420
  719. package/msg/ug-arab.js +420 -420
  720. package/msg/uk.js +420 -420
  721. package/msg/ur.js +420 -420
  722. package/msg/uz.js +420 -420
  723. package/msg/vi.js +420 -420
  724. package/msg/xmf.js +420 -420
  725. package/msg/yo.js +420 -420
  726. package/msg/yue.js +420 -420
  727. package/msg/zgh.js +420 -420
  728. package/msg/zh-hans.js +420 -420
  729. package/msg/zh-hant.js +420 -420
  730. package/package.json +5 -5
  731. package/php.d.ts +0 -3
  732. package/php_compressed.js +322 -93
  733. package/php_compressed.js.map +1 -1
  734. package/python.d.ts +0 -3
  735. package/python_compressed.js +237 -90
  736. package/python_compressed.js.map +1 -1
  737. package/blockly.d.ts +0 -26127
  738. package/core/blockly_options.js +0 -28
  739. package/core/bubble_dragger.js +0 -298
  740. package/core/clipboard.js +0 -80
  741. package/core/component_manager.js +0 -263
  742. package/core/contextmenu_items.js +0 -651
  743. package/core/contextmenu_registry.js +0 -178
  744. package/core/delete_area.js +0 -87
  745. package/core/dialog.js +0 -107
  746. package/core/drag_target.js +0 -98
  747. package/core/events/events.js +0 -147
  748. package/core/events/events_abstract.js +0 -133
  749. package/core/events/events_block_base.js +0 -70
  750. package/core/events/events_block_drag.js +0 -89
  751. package/core/events/events_bubble_open.js +0 -90
  752. package/core/events/events_comment_base.js +0 -121
  753. package/core/events/events_marker_move.js +0 -110
  754. package/core/events/events_selected.js +0 -83
  755. package/core/events/events_toolbox_item_select.js +0 -84
  756. package/core/events/events_trashcan_open.js +0 -73
  757. package/core/events/events_var_base.js +0 -70
  758. package/core/events/events_viewport.js +0 -107
  759. package/core/events/workspace_events.js +0 -93
  760. package/core/field_angle.js +0 -591
  761. package/core/field_checkbox.js +0 -255
  762. package/core/field_colour.js +0 -717
  763. package/core/field_image.js +0 -304
  764. package/core/field_label.js +0 -149
  765. package/core/field_label_serializable.js +0 -80
  766. package/core/field_textinput.js +0 -619
  767. package/core/flyout_button.js +0 -356
  768. package/core/grid.js +0 -226
  769. package/core/icon.js +0 -225
  770. package/core/input.js +0 -335
  771. package/core/interfaces/i_ast_node_location_svg.js +0 -45
  772. package/core/interfaces/i_ast_node_location_with_block.js +0 -41
  773. package/core/interfaces/i_autohideable.js +0 -40
  774. package/core/interfaces/i_block_dragger.js +0 -66
  775. package/core/interfaces/i_bounded_element.js +0 -45
  776. package/core/interfaces/i_bubble.js +0 -95
  777. package/core/interfaces/i_collapsible_toolbox_item.js +0 -53
  778. package/core/interfaces/i_connection_checker.js +0 -104
  779. package/core/interfaces/i_contextmenu.js +0 -32
  780. package/core/interfaces/i_copyable.js +0 -49
  781. package/core/interfaces/i_delete_area.js +0 -50
  782. package/core/interfaces/i_drag_target.js +0 -88
  783. package/core/interfaces/i_flyout.js +0 -201
  784. package/core/interfaces/i_keyboard_accessible.js +0 -38
  785. package/core/interfaces/i_metrics_manager.js +0 -154
  786. package/core/interfaces/i_positionable.js +0 -51
  787. package/core/interfaces/i_selectable.js +0 -51
  788. package/core/interfaces/i_selectable_toolbox_item.js +0 -73
  789. package/core/interfaces/i_serializer.js +0 -77
  790. package/core/interfaces/i_styleable.js +0 -39
  791. package/core/interfaces/i_toolbox.js +0 -142
  792. package/core/interfaces/i_toolbox_item.js +0 -85
  793. package/core/marker_manager.js +0 -213
  794. package/core/menuitem.js +0 -292
  795. package/core/names.js +0 -293
  796. package/core/registry.js +0 -384
  797. package/core/renderers/common/block_rendering.js +0 -170
  798. package/core/renderers/common/constants.js +0 -1250
  799. package/core/renderers/common/i_path_object.js +0 -162
  800. package/core/renderers/common/marker_svg.js +0 -721
  801. package/core/renderers/common/path_object.js +0 -283
  802. package/core/renderers/common/renderer.js +0 -305
  803. package/core/renderers/geras/constants.js +0 -73
  804. package/core/renderers/geras/geras.js +0 -36
  805. package/core/renderers/geras/measurables/inline_input.js +0 -58
  806. package/core/renderers/geras/measurables/statement_input.js +0 -57
  807. package/core/renderers/geras/renderer.js +0 -149
  808. package/core/renderers/measurables/base.js +0 -64
  809. package/core/renderers/measurables/bottom_row.js +0 -138
  810. package/core/renderers/measurables/connection.js +0 -56
  811. package/core/renderers/measurables/external_value_input.js +0 -70
  812. package/core/renderers/measurables/field.js +0 -71
  813. package/core/renderers/measurables/in_row_spacer.js +0 -47
  814. package/core/renderers/measurables/input_connection.js +0 -75
  815. package/core/renderers/measurables/next_connection.js +0 -50
  816. package/core/renderers/measurables/output_connection.js +0 -61
  817. package/core/renderers/measurables/previous_connection.js +0 -50
  818. package/core/renderers/measurables/round_corner.js +0 -52
  819. package/core/renderers/measurables/row.js +0 -247
  820. package/core/renderers/measurables/spacer_row.js +0 -69
  821. package/core/renderers/measurables/square_corner.js +0 -50
  822. package/core/renderers/measurables/top_row.js +0 -143
  823. package/core/renderers/measurables/types.js +0 -353
  824. package/core/renderers/minimalist/drawer.js +0 -42
  825. package/core/renderers/minimalist/info.js +0 -54
  826. package/core/renderers/minimalist/minimalist.js +0 -26
  827. package/core/renderers/minimalist/renderer.js +0 -80
  828. package/core/renderers/thrasos/renderer.js +0 -53
  829. package/core/renderers/thrasos/thrasos.js +0 -22
  830. package/core/renderers/zelos/marker_svg.js +0 -179
  831. package/core/renderers/zelos/measurables/bottom_row.js +0 -66
  832. package/core/renderers/zelos/measurables/row_elements.js +0 -46
  833. package/core/renderers/zelos/path_object.js +0 -247
  834. package/core/renderers/zelos/renderer.js +0 -147
  835. package/core/renderers/zelos/zelos.js +0 -38
  836. package/core/serialization/exceptions.js +0 -144
  837. package/core/shortcut_registry.js +0 -366
  838. package/core/theme/themes.js +0 -23
  839. package/core/theme.js +0 -228
  840. package/core/theme_manager.js +0 -211
  841. package/core/toolbox/category.js +0 -751
  842. package/core/toolbox/collapsible_category.js +0 -311
  843. package/core/toolbox/separator.js +0 -133
  844. package/core/toolbox/toolbox_item.js +0 -173
  845. package/core/touch.js +0 -285
  846. package/core/utils/coordinate.js +0 -138
  847. package/core/utils/global.js +0 -41
  848. package/core/utils/keycodes.js +0 -172
  849. package/core/utils/metrics.js +0 -154
  850. package/core/utils/svg.js +0 -186
  851. package/core/utils/toolbox.js +0 -459
  852. package/core/utils/useragent.js +0 -197
  853. package/core/utils.js +0 -383
  854. package/core/variable_model.js +0 -96
  855. package/core/widgetdiv.js +0 -290
  856. package/core/workspace.js +0 -836
  857. package/core/workspace_comment.js +0 -400
  858. package/core/workspace_dragger.js +0 -115
@@ -1,1250 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- /**
8
- * @fileoverview An object that provides constants for rendering blocks.
9
- */
10
- 'use strict';
11
-
12
- /**
13
- * An object that provides constants for rendering blocks.
14
- * @class
15
- */
16
- goog.module('Blockly.blockRendering.ConstantProvider');
17
-
18
- const colour = goog.require('Blockly.utils.colour');
19
- const dom = goog.require('Blockly.utils.dom');
20
- const object = goog.require('Blockly.utils.object');
21
- const svgPaths = goog.require('Blockly.utils.svgPaths');
22
- const userAgent = goog.require('Blockly.utils.userAgent');
23
- const parsing = goog.require('Blockly.utils.parsing');
24
- const {ConnectionType} = goog.require('Blockly.ConnectionType');
25
- /* eslint-disable-next-line no-unused-vars */
26
- const {RenderedConnection} = goog.requireType('Blockly.RenderedConnection');
27
- const {Svg} = goog.require('Blockly.utils.Svg');
28
- /* eslint-disable-next-line no-unused-vars */
29
- const {Theme} = goog.requireType('Blockly.Theme');
30
-
31
-
32
- /**
33
- * An object that provides constants for rendering blocks.
34
- * @alias Blockly.blockRendering.ConstantProvider
35
- */
36
- class ConstantProvider {
37
- /**
38
- * @package
39
- */
40
- constructor() {
41
- /**
42
- * The size of an empty spacer.
43
- * @type {number}
44
- */
45
- this.NO_PADDING = 0;
46
-
47
- /**
48
- * The size of small padding.
49
- * @type {number}
50
- */
51
- this.SMALL_PADDING = 3;
52
-
53
- /**
54
- * The size of medium padding.
55
- * @type {number}
56
- */
57
- this.MEDIUM_PADDING = 5;
58
-
59
- /**
60
- * The size of medium-large padding.
61
- * @type {number}
62
- */
63
- this.MEDIUM_LARGE_PADDING = 8;
64
-
65
- /**
66
- * The size of large padding.
67
- * @type {number}
68
- */
69
- this.LARGE_PADDING = 10;
70
-
71
- /**
72
- * Offset from the top of the row for placing fields on inline input rows
73
- * and statement input rows.
74
- * Matches existing rendering (in 2019).
75
- * @type {number}
76
- */
77
- this.TALL_INPUT_FIELD_OFFSET_Y = this.MEDIUM_PADDING;
78
-
79
- /**
80
- * The height of the puzzle tab used for input and output connections.
81
- * @type {number}
82
- */
83
- this.TAB_HEIGHT = 15;
84
-
85
- /**
86
- * The offset from the top of the block at which a puzzle tab is positioned.
87
- * @type {number}
88
- */
89
- this.TAB_OFFSET_FROM_TOP = 5;
90
-
91
- /**
92
- * Vertical overlap of the puzzle tab, used to make it look more like a
93
- * puzzle piece.
94
- * @type {number}
95
- */
96
- this.TAB_VERTICAL_OVERLAP = 2.5;
97
-
98
- /**
99
- * The width of the puzzle tab used for input and output connections.
100
- * @type {number}
101
- */
102
- this.TAB_WIDTH = 8;
103
-
104
- /**
105
- * The width of the notch used for previous and next connections.
106
- * @type {number}
107
- */
108
- this.NOTCH_WIDTH = 15;
109
-
110
- /**
111
- * The height of the notch used for previous and next connections.
112
- * @type {number}
113
- */
114
- this.NOTCH_HEIGHT = 4;
115
-
116
- /**
117
- * The minimum width of the block.
118
- * @type {number}
119
- */
120
- this.MIN_BLOCK_WIDTH = 12;
121
-
122
- this.EMPTY_BLOCK_SPACER_HEIGHT = 16;
123
-
124
- /**
125
- * The minimum height of a dummy input row.
126
- * @type {number}
127
- */
128
- this.DUMMY_INPUT_MIN_HEIGHT = this.TAB_HEIGHT;
129
-
130
- /**
131
- * The minimum height of a dummy input row in a shadow block.
132
- * @type {number}
133
- */
134
- this.DUMMY_INPUT_SHADOW_MIN_HEIGHT = this.TAB_HEIGHT;
135
-
136
- /**
137
- * Rounded corner radius.
138
- * @type {number}
139
- */
140
- this.CORNER_RADIUS = 8;
141
-
142
- /**
143
- * Offset from the left side of a block or the inside of a statement input
144
- * to the left side of the notch.
145
- * @type {number}
146
- */
147
- this.NOTCH_OFFSET_LEFT = 15;
148
-
149
- /**
150
- * Additional offset added to the statement input's width to account for the
151
- * notch.
152
- * @type {number}
153
- */
154
- this.STATEMENT_INPUT_NOTCH_OFFSET = this.NOTCH_OFFSET_LEFT;
155
-
156
- this.STATEMENT_BOTTOM_SPACER = 0;
157
- this.STATEMENT_INPUT_PADDING_LEFT = 20;
158
-
159
- /**
160
- * Vertical padding between consecutive statement inputs.
161
- * @type {number}
162
- */
163
- this.BETWEEN_STATEMENT_PADDING_Y = 4;
164
-
165
- /**
166
- * The top row's minimum height.
167
- * @type {number}
168
- */
169
- this.TOP_ROW_MIN_HEIGHT = this.MEDIUM_PADDING;
170
-
171
- /**
172
- * The top row's minimum height if it precedes a statement.
173
- * @type {number}
174
- */
175
- this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT = this.LARGE_PADDING;
176
-
177
- /**
178
- * The bottom row's minimum height.
179
- * @type {number}
180
- */
181
- this.BOTTOM_ROW_MIN_HEIGHT = this.MEDIUM_PADDING;
182
-
183
- /**
184
- * The bottom row's minimum height if it follows a statement input.
185
- * @type {number}
186
- */
187
- this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT = this.LARGE_PADDING;
188
-
189
- /**
190
- * Whether to add a 'hat' on top of all blocks with no previous or output
191
- * connections. Can be overridden by 'hat' property on Theme.BlockStyle.
192
- * @type {boolean}
193
- */
194
- this.ADD_START_HATS = false;
195
-
196
- /**
197
- * Height of the top hat.
198
- * @type {number}
199
- */
200
- this.START_HAT_HEIGHT = 15;
201
-
202
- /**
203
- * Width of the top hat.
204
- * @type {number}
205
- */
206
- this.START_HAT_WIDTH = 100;
207
-
208
- this.SPACER_DEFAULT_HEIGHT = 15;
209
-
210
- this.MIN_BLOCK_HEIGHT = 24;
211
-
212
- this.EMPTY_INLINE_INPUT_PADDING = 14.5;
213
-
214
- /**
215
- * The height of an empty inline input.
216
- * @type {number}
217
- */
218
- this.EMPTY_INLINE_INPUT_HEIGHT = this.TAB_HEIGHT + 11;
219
-
220
- this.EXTERNAL_VALUE_INPUT_PADDING = 2;
221
-
222
- /**
223
- * The height of an empty statement input. Note that in the old rendering
224
- * this varies slightly depending on whether the block has external or
225
- * inline inputs. In the new rendering this is consistent. It seems
226
- * unlikely that the old behaviour was intentional.
227
- * @type {number}
228
- */
229
- this.EMPTY_STATEMENT_INPUT_HEIGHT = this.MIN_BLOCK_HEIGHT;
230
-
231
- this.START_POINT = svgPaths.moveBy(0, 0);
232
-
233
- /**
234
- * Height of SVG path for jagged teeth at the end of collapsed blocks.
235
- * @type {number}
236
- */
237
- this.JAGGED_TEETH_HEIGHT = 12;
238
-
239
- /**
240
- * Width of SVG path for jagged teeth at the end of collapsed blocks.
241
- * @type {number}
242
- */
243
- this.JAGGED_TEETH_WIDTH = 6;
244
-
245
- /**
246
- * Point size of text.
247
- * @type {number}
248
- */
249
- this.FIELD_TEXT_FONTSIZE = 11;
250
-
251
- /**
252
- * Text font weight.
253
- * @type {string}
254
- */
255
- this.FIELD_TEXT_FONTWEIGHT = 'normal';
256
-
257
- /**
258
- * Text font family.
259
- * @type {string}
260
- */
261
- this.FIELD_TEXT_FONTFAMILY = 'sans-serif';
262
-
263
- /**
264
- * Height of text. This constant is dynamically set in
265
- * ``setFontConstants_`` to be the height of the text based on the font
266
- * used.
267
- * @type {number}
268
- */
269
- this.FIELD_TEXT_HEIGHT = -1; // Dynamically set.
270
-
271
- /**
272
- * Text baseline. This constant is dynamically set in ``setFontConstants_``
273
- * to be the baseline of the text based on the font used.
274
- * @type {number}
275
- */
276
- this.FIELD_TEXT_BASELINE = -1; // Dynamically set.
277
-
278
- /**
279
- * A field's border rect corner radius.
280
- * @type {number}
281
- */
282
- this.FIELD_BORDER_RECT_RADIUS = 4;
283
-
284
- /**
285
- * A field's border rect default height.
286
- * @type {number}
287
- */
288
- this.FIELD_BORDER_RECT_HEIGHT = 16;
289
-
290
- /**
291
- * A field's border rect X padding.
292
- * @type {number}
293
- */
294
- this.FIELD_BORDER_RECT_X_PADDING = 5;
295
-
296
- /**
297
- * A field's border rect Y padding.
298
- * @type {number}
299
- */
300
- this.FIELD_BORDER_RECT_Y_PADDING = 3;
301
-
302
- /**
303
- * The backing colour of a field's border rect.
304
- * @type {string}
305
- * @package
306
- */
307
- this.FIELD_BORDER_RECT_COLOUR = '#fff';
308
-
309
- /**
310
- * A field's text element's dominant baseline.
311
- * @type {boolean}
312
- */
313
- this.FIELD_TEXT_BASELINE_CENTER = !userAgent.IE && !userAgent.EDGE;
314
-
315
- /**
316
- * A dropdown field's border rect height.
317
- * @type {number}
318
- */
319
- this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT = this.FIELD_BORDER_RECT_HEIGHT;
320
-
321
- /**
322
- * Whether or not a dropdown field should add a border rect when in a shadow
323
- * block.
324
- * @type {boolean}
325
- */
326
- this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW = false;
327
-
328
- /**
329
- * Whether or not a dropdown field's div should be coloured to match the
330
- * block colours.
331
- * @type {boolean}
332
- */
333
- this.FIELD_DROPDOWN_COLOURED_DIV = false;
334
-
335
- /**
336
- * Whether or not a dropdown field uses a text or SVG arrow.
337
- * @type {boolean}
338
- */
339
- this.FIELD_DROPDOWN_SVG_ARROW = false;
340
-
341
- /**
342
- * A dropdown field's SVG arrow padding.
343
- * @type {number}
344
- */
345
- this.FIELD_DROPDOWN_SVG_ARROW_PADDING = this.FIELD_BORDER_RECT_X_PADDING;
346
-
347
- /**
348
- * A dropdown field's SVG arrow size.
349
- * @type {number}
350
- */
351
- this.FIELD_DROPDOWN_SVG_ARROW_SIZE = 12;
352
-
353
- /**
354
- * A dropdown field's SVG arrow datauri.
355
- * @type {string}
356
- */
357
- this.FIELD_DROPDOWN_SVG_ARROW_DATAURI =
358
- 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllci' +
359
- 'AxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaG' +
360
- 'VpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLW' +
361
- 'Fycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuND' +
362
- 'EsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTD' +
363
- 'AuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNz' +
364
- 'FDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMC' +
365
- 'wxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNz' +
366
- 'lhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYz' +
367
- 'AuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMz' +
368
- 'dBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=';
369
-
370
- /**
371
- * Whether or not to show a box shadow around the widget div. This is only a
372
- * feature of full block fields.
373
- * @type {boolean}
374
- */
375
- this.FIELD_TEXTINPUT_BOX_SHADOW = false;
376
-
377
- /**
378
- * Whether or not the colour field should display its colour value on the
379
- * entire block.
380
- * @type {boolean}
381
- */
382
- this.FIELD_COLOUR_FULL_BLOCK = false;
383
-
384
- /**
385
- * A colour field's default width.
386
- * @type {number}
387
- */
388
- this.FIELD_COLOUR_DEFAULT_WIDTH = 26;
389
-
390
- /**
391
- * A colour field's default height.
392
- * @type {number}
393
- */
394
- this.FIELD_COLOUR_DEFAULT_HEIGHT = this.FIELD_BORDER_RECT_HEIGHT;
395
-
396
- /**
397
- * A checkbox field's X offset.
398
- * @type {number}
399
- */
400
- this.FIELD_CHECKBOX_X_OFFSET = this.FIELD_BORDER_RECT_X_PADDING - 3;
401
-
402
- /**
403
- * A random identifier used to ensure a unique ID is used for each
404
- * filter/pattern for the case of multiple Blockly instances on a page.
405
- * @type {string}
406
- * @package
407
- */
408
- this.randomIdentifier = String(Math.random()).substring(2);
409
-
410
- /**
411
- * The defs tag that contains all filters and patterns for this Blockly
412
- * instance.
413
- * @type {?SVGElement}
414
- * @private
415
- */
416
- this.defs_ = null;
417
-
418
- /**
419
- * The ID of the emboss filter, or the empty string if no filter is set.
420
- * @type {string}
421
- * @package
422
- */
423
- this.embossFilterId = '';
424
-
425
- /**
426
- * The <filter> element to use for highlighting, or null if not set.
427
- * @type {SVGElement}
428
- * @private
429
- */
430
- this.embossFilter_ = null;
431
-
432
- /**
433
- * The ID of the disabled pattern, or the empty string if no pattern is set.
434
- * @type {string}
435
- * @package
436
- */
437
- this.disabledPatternId = '';
438
-
439
- /**
440
- * The <pattern> element to use for disabled blocks, or null if not set.
441
- * @type {SVGElement}
442
- * @private
443
- */
444
- this.disabledPattern_ = null;
445
-
446
- /**
447
- * The ID of the debug filter, or the empty string if no pattern is set.
448
- * @type {string}
449
- * @package
450
- */
451
- this.debugFilterId = '';
452
-
453
- /**
454
- * The <filter> element to use for a debug highlight, or null if not set.
455
- * @type {SVGElement}
456
- * @private
457
- */
458
- this.debugFilter_ = null;
459
-
460
- /**
461
- * The <style> element to use for injecting renderer specific CSS.
462
- * @type {HTMLStyleElement}
463
- * @private
464
- */
465
- this.cssNode_ = null;
466
-
467
- /**
468
- * Cursor colour.
469
- * @type {string}
470
- * @package
471
- */
472
- this.CURSOR_COLOUR = '#cc0a0a';
473
-
474
- /**
475
- * Immovable marker colour.
476
- * @type {string}
477
- * @package
478
- */
479
- this.MARKER_COLOUR = '#4286f4';
480
-
481
- /**
482
- * Width of the horizontal cursor.
483
- * @type {number}
484
- * @package
485
- */
486
- this.CURSOR_WS_WIDTH = 100;
487
-
488
- /**
489
- * Height of the horizontal cursor.
490
- * @type {number}
491
- * @package
492
- */
493
- this.WS_CURSOR_HEIGHT = 5;
494
-
495
- /**
496
- * Padding around a stack.
497
- * @type {number}
498
- * @package
499
- */
500
- this.CURSOR_STACK_PADDING = 10;
501
-
502
- /**
503
- * Padding around a block.
504
- * @type {number}
505
- * @package
506
- */
507
- this.CURSOR_BLOCK_PADDING = 2;
508
-
509
- /**
510
- * Stroke of the cursor.
511
- * @type {number}
512
- * @package
513
- */
514
- this.CURSOR_STROKE_WIDTH = 4;
515
-
516
- /**
517
- * Whether text input and colour fields fill up the entire source block.
518
- * @type {boolean}
519
- * @package
520
- */
521
- this.FULL_BLOCK_FIELDS = false;
522
-
523
- /**
524
- * The main colour of insertion markers, in hex. The block is rendered a
525
- * transparent grey by changing the fill opacity in CSS.
526
- * @type {string}
527
- * @package
528
- */
529
- this.INSERTION_MARKER_COLOUR = '#000000';
530
-
531
- /**
532
- * The insertion marker opacity.
533
- * @type {number}
534
- * @package
535
- */
536
- this.INSERTION_MARKER_OPACITY = 0.2;
537
-
538
- /**
539
- * Enum for connection shapes.
540
- * @enum {number}
541
- */
542
- this.SHAPES = {PUZZLE: 1, NOTCH: 2};
543
- }
544
-
545
- /**
546
- * Initialize shape objects based on the constants set in the constructor.
547
- * @package
548
- */
549
- init() {
550
- /**
551
- * An object containing sizing and path information about collapsed block
552
- * indicators.
553
- * @type {!Object}
554
- */
555
- this.JAGGED_TEETH = this.makeJaggedTeeth();
556
-
557
- /**
558
- * An object containing sizing and path information about notches.
559
- * @type {!Object}
560
- */
561
- this.NOTCH = this.makeNotch();
562
-
563
- /**
564
- * An object containing sizing and path information about start hats
565
- * @type {!Object}
566
- */
567
- this.START_HAT = this.makeStartHat();
568
-
569
- /**
570
- * An object containing sizing and path information about puzzle tabs.
571
- * @type {!Object}
572
- */
573
- this.PUZZLE_TAB = this.makePuzzleTab();
574
-
575
- /**
576
- * An object containing sizing and path information about inside corners
577
- * @type {!Object}
578
- */
579
- this.INSIDE_CORNERS = this.makeInsideCorners();
580
-
581
- /**
582
- * An object containing sizing and path information about outside corners.
583
- * @type {!Object}
584
- */
585
- this.OUTSIDE_CORNERS = this.makeOutsideCorners();
586
- }
587
-
588
- /**
589
- * Refresh constants properties that depend on the theme.
590
- * @param {!Theme} theme The current workspace theme.
591
- * @package
592
- */
593
- setTheme(theme) {
594
- /**
595
- * The block styles map.
596
- * @type {Object<string, !Theme.BlockStyle>}
597
- * @package
598
- */
599
- this.blockStyles = Object.create(null);
600
-
601
- const blockStyles = theme.blockStyles;
602
- for (const key in blockStyles) {
603
- this.blockStyles[key] = this.validatedBlockStyle_(blockStyles[key]);
604
- }
605
-
606
- this.setDynamicProperties_(theme);
607
- }
608
-
609
- /**
610
- * Sets dynamic properties that depend on other values or theme properties.
611
- * @param {!Theme} theme The current workspace theme.
612
- * @protected
613
- */
614
- setDynamicProperties_(theme) {
615
- this.setFontConstants_(theme);
616
- this.setComponentConstants_(theme);
617
-
618
- this.ADD_START_HATS =
619
- theme.startHats !== null ? theme.startHats : this.ADD_START_HATS;
620
- }
621
-
622
- /**
623
- * Set constants related to fonts.
624
- * @param {!Theme} theme The current workspace theme.
625
- * @protected
626
- */
627
- setFontConstants_(theme) {
628
- if (theme.fontStyle && theme.fontStyle['family']) {
629
- this.FIELD_TEXT_FONTFAMILY = theme.fontStyle['family'];
630
- }
631
-
632
- if (theme.fontStyle && theme.fontStyle['weight']) {
633
- this.FIELD_TEXT_FONTWEIGHT = theme.fontStyle['weight'];
634
- }
635
-
636
- if (theme.fontStyle && theme.fontStyle['size']) {
637
- this.FIELD_TEXT_FONTSIZE = theme.fontStyle['size'];
638
- }
639
-
640
- const fontMetrics = dom.measureFontMetrics(
641
- 'Hg', this.FIELD_TEXT_FONTSIZE + 'pt', this.FIELD_TEXT_FONTWEIGHT,
642
- this.FIELD_TEXT_FONTFAMILY);
643
-
644
- this.FIELD_TEXT_HEIGHT = fontMetrics.height;
645
- this.FIELD_TEXT_BASELINE = fontMetrics.baseline;
646
- }
647
-
648
- /**
649
- * Set constants from a theme's component styles.
650
- * @param {!Theme} theme The current workspace theme.
651
- * @protected
652
- */
653
- setComponentConstants_(theme) {
654
- this.CURSOR_COLOUR =
655
- theme.getComponentStyle('cursorColour') || this.CURSOR_COLOUR;
656
- this.MARKER_COLOUR =
657
- theme.getComponentStyle('markerColour') || this.MARKER_COLOUR;
658
- this.INSERTION_MARKER_COLOUR =
659
- theme.getComponentStyle('insertionMarkerColour') ||
660
- this.INSERTION_MARKER_COLOUR;
661
- this.INSERTION_MARKER_OPACITY =
662
- Number(theme.getComponentStyle('insertionMarkerOpacity')) ||
663
- this.INSERTION_MARKER_OPACITY;
664
- }
665
-
666
- /**
667
- * Get or create a block style based on a single colour value. Generate a
668
- * name for the style based on the colour.
669
- * @param {string} colour #RRGGBB colour string.
670
- * @return {{style: !Theme.BlockStyle, name: string}} An object
671
- * containing the style and an autogenerated name for that style.
672
- * @package
673
- */
674
- getBlockStyleForColour(colour) {
675
- const name = 'auto_' + colour;
676
- if (!this.blockStyles[name]) {
677
- this.blockStyles[name] = this.createBlockStyle_(colour);
678
- }
679
- return {style: this.blockStyles[name], name: name};
680
- }
681
-
682
- /**
683
- * Gets the BlockStyle for the given block style name.
684
- * @param {?string} blockStyleName The name of the block style.
685
- * @return {!Theme.BlockStyle} The named block style, or a default style
686
- * if no style with the given name was found.
687
- */
688
- getBlockStyle(blockStyleName) {
689
- return this.blockStyles[blockStyleName || ''] ||
690
- (blockStyleName && blockStyleName.indexOf('auto_') === 0 ?
691
- this.getBlockStyleForColour(blockStyleName.substring(5)).style :
692
- this.createBlockStyle_('#000000'));
693
- }
694
-
695
- /**
696
- * Create a block style object based on the given colour.
697
- * @param {string} colour #RRGGBB colour string.
698
- * @return {!Theme.BlockStyle} A populated block style based on the
699
- * given colour.
700
- * @protected
701
- */
702
- createBlockStyle_(colour) {
703
- return this.validatedBlockStyle_({'colourPrimary': colour});
704
- }
705
-
706
- /**
707
- * Get a full block style object based on the input style object. Populate
708
- * any missing values.
709
- * @param {{
710
- * colourPrimary:string,
711
- * colourSecondary:(string|undefined),
712
- * colourTertiary:(string|undefined),
713
- * hat:(string|undefined)
714
- * }} blockStyle A full or partial block style object.
715
-
716
- * @return {!Theme.BlockStyle} A full block style object, with all
717
- * required properties populated.
718
- * @protected
719
- */
720
- validatedBlockStyle_(blockStyle) {
721
- // Make a new object with all of the same properties.
722
- const valid = /** @type {!Theme.BlockStyle} */ ({});
723
- if (blockStyle) {
724
- object.mixin(valid, blockStyle);
725
- }
726
- // Validate required properties.
727
- const parsedColour =
728
- parsing.parseBlockColour(valid['colourPrimary'] || '#000');
729
- valid.colourPrimary = parsedColour.hex;
730
- valid.colourSecondary = valid['colourSecondary'] ?
731
- parsing.parseBlockColour(valid['colourSecondary']).hex :
732
- this.generateSecondaryColour_(valid.colourPrimary);
733
- valid.colourTertiary = valid['colourTertiary'] ?
734
- parsing.parseBlockColour(valid['colourTertiary']).hex :
735
- this.generateTertiaryColour_(valid.colourPrimary);
736
-
737
- valid.hat = valid['hat'] || '';
738
- return valid;
739
- }
740
-
741
- /**
742
- * Generate a secondary colour from the passed in primary colour.
743
- * @param {string} inputColour Primary colour.
744
- * @return {string} The generated secondary colour.
745
- * @protected
746
- */
747
- generateSecondaryColour_(inputColour) {
748
- return colour.blend('#fff', inputColour, 0.6) || inputColour;
749
- }
750
-
751
- /**
752
- * Generate a tertiary colour from the passed in primary colour.
753
- * @param {string} inputColour Primary colour.
754
- * @return {string} The generated tertiary colour.
755
- * @protected
756
- */
757
- generateTertiaryColour_(inputColour) {
758
- return colour.blend('#fff', inputColour, 0.3) || inputColour;
759
- }
760
-
761
- /**
762
- * Dispose of this constants provider.
763
- * Delete all DOM elements that this provider created.
764
- * @package
765
- */
766
- dispose() {
767
- if (this.embossFilter_) {
768
- dom.removeNode(this.embossFilter_);
769
- }
770
- if (this.disabledPattern_) {
771
- dom.removeNode(this.disabledPattern_);
772
- }
773
- if (this.debugFilter_) {
774
- dom.removeNode(this.debugFilter_);
775
- }
776
- this.cssNode_ = null;
777
- }
778
-
779
- /**
780
- * @return {!Object} An object containing sizing and path information about
781
- * collapsed block indicators.
782
- * @package
783
- */
784
- makeJaggedTeeth() {
785
- const height = this.JAGGED_TEETH_HEIGHT;
786
- const width = this.JAGGED_TEETH_WIDTH;
787
-
788
- const mainPath = svgPaths.line([
789
- svgPaths.point(width, height / 4),
790
- svgPaths.point(-width * 2, height / 2),
791
- svgPaths.point(width, height / 4),
792
- ]);
793
- return {height: height, width: width, path: mainPath};
794
- }
795
-
796
- /**
797
- * @return {!Object} An object containing sizing and path information about
798
- * start hats.
799
- * @package
800
- */
801
- makeStartHat() {
802
- const height = this.START_HAT_HEIGHT;
803
- const width = this.START_HAT_WIDTH;
804
-
805
- const mainPath = svgPaths.curve('c', [
806
- svgPaths.point(30, -height),
807
- svgPaths.point(70, -height),
808
- svgPaths.point(width, 0),
809
- ]);
810
- return {height: height, width: width, path: mainPath};
811
- }
812
-
813
- /**
814
- * @return {!Object} An object containing sizing and path information about
815
- * puzzle tabs.
816
- * @package
817
- */
818
- makePuzzleTab() {
819
- const width = this.TAB_WIDTH;
820
- const height = this.TAB_HEIGHT;
821
-
822
- /**
823
- * Make the main path for the puzzle tab made out of a few curves (c and s).
824
- * Those curves are defined with relative positions. The 'up' and 'down'
825
- * versions of the paths are the same, but the Y sign flips. Forward and
826
- * back are the signs to use to move the cursor in the direction that the
827
- * path is being drawn.
828
- * @param {boolean} up True if the path should be drawn from bottom to top,
829
- * false otherwise.
830
- * @return {string} A path fragment describing a puzzle tab.
831
- */
832
- function makeMainPath(up) {
833
- const forward = up ? -1 : 1;
834
- const back = -forward;
835
-
836
- const overlap = 2.5;
837
- const halfHeight = height / 2;
838
- const control1Y = halfHeight + overlap;
839
- const control2Y = halfHeight + 0.5;
840
- const control3Y = overlap; // 2.5
841
-
842
- const endPoint1 = svgPaths.point(-width, forward * halfHeight);
843
- const endPoint2 = svgPaths.point(width, forward * halfHeight);
844
-
845
- return svgPaths.curve(
846
- 'c',
847
- [
848
- svgPaths.point(0, forward * control1Y),
849
- svgPaths.point(-width, back * control2Y),
850
- endPoint1,
851
- ]) +
852
- svgPaths.curve(
853
- 's', [svgPaths.point(width, back * control3Y), endPoint2]);
854
- }
855
-
856
- // c 0,-10 -8,8 -8,-7.5 s 8,2.5 8,-7.5
857
- const pathUp = makeMainPath(true);
858
- // c 0,10 -8,-8 -8,7.5 s 8,-2.5 8,7.5
859
- const pathDown = makeMainPath(false);
860
-
861
- return {
862
- type: this.SHAPES.PUZZLE,
863
- width: width,
864
- height: height,
865
- pathDown: pathDown,
866
- pathUp: pathUp,
867
- };
868
- }
869
-
870
- /**
871
- * @return {!Object} An object containing sizing and path information about
872
- * notches.
873
- * @package
874
- */
875
- makeNotch() {
876
- const width = this.NOTCH_WIDTH;
877
- const height = this.NOTCH_HEIGHT;
878
- const innerWidth = 3;
879
- const outerWidth = (width - innerWidth) / 2;
880
-
881
- /**
882
- * Make the main path for the notch.
883
- * @param {number} dir Direction multiplier to apply to horizontal offsets
884
- * along the path. Either 1 or -1.
885
- * @return {string} A path fragment describing a notch.
886
- */
887
- function makeMainPath(dir) {
888
- return svgPaths.line([
889
- svgPaths.point(dir * outerWidth, height),
890
- svgPaths.point(dir * innerWidth, 0),
891
- svgPaths.point(dir * outerWidth, -height),
892
- ]);
893
- }
894
- const pathLeft = makeMainPath(1);
895
- const pathRight = makeMainPath(-1);
896
-
897
- return {
898
- type: this.SHAPES.NOTCH,
899
- width: width,
900
- height: height,
901
- pathLeft: pathLeft,
902
- pathRight: pathRight,
903
- };
904
- }
905
-
906
- /**
907
- * @return {!Object} An object containing sizing and path information about
908
- * inside corners.
909
- * @package
910
- */
911
- makeInsideCorners() {
912
- const radius = this.CORNER_RADIUS;
913
-
914
- const innerTopLeftCorner =
915
- svgPaths.arc('a', '0 0,0', radius, svgPaths.point(-radius, radius));
916
-
917
- const innerBottomLeftCorner =
918
- svgPaths.arc('a', '0 0,0', radius, svgPaths.point(radius, radius));
919
-
920
- return {
921
- width: radius,
922
- height: radius,
923
- pathTop: innerTopLeftCorner,
924
- pathBottom: innerBottomLeftCorner,
925
- };
926
- }
927
-
928
- /**
929
- * @return {!Object} An object containing sizing and path information about
930
- * outside corners.
931
- * @package
932
- */
933
- makeOutsideCorners() {
934
- const radius = this.CORNER_RADIUS;
935
- /**
936
- * SVG path for drawing the rounded top-left corner.
937
- * @const
938
- */
939
- const topLeft = svgPaths.moveBy(0, radius) +
940
- svgPaths.arc('a', '0 0,1', radius, svgPaths.point(radius, -radius));
941
-
942
- /**
943
- * SVG path for drawing the rounded top-right corner.
944
- * @const
945
- */
946
- const topRight =
947
- svgPaths.arc('a', '0 0,1', radius, svgPaths.point(radius, radius));
948
-
949
- /**
950
- * SVG path for drawing the rounded bottom-left corner.
951
- * @const
952
- */
953
- const bottomLeft =
954
- svgPaths.arc('a', '0 0,1', radius, svgPaths.point(-radius, -radius));
955
-
956
- /**
957
- * SVG path for drawing the rounded bottom-right corner.
958
- * @const
959
- */
960
- const bottomRight =
961
- svgPaths.arc('a', '0 0,1', radius, svgPaths.point(-radius, radius));
962
-
963
- return {
964
- topLeft: topLeft,
965
- topRight: topRight,
966
- bottomRight: bottomRight,
967
- bottomLeft: bottomLeft,
968
- rightHeight: radius,
969
- };
970
- }
971
-
972
- /**
973
- * Get an object with connection shape and sizing information based on the
974
- * type of the connection.
975
- * @param {!RenderedConnection} connection The connection to find a
976
- * shape object for
977
- * @return {!Object} The shape object for the connection.
978
- * @package
979
- */
980
- shapeFor(connection) {
981
- switch (connection.type) {
982
- case ConnectionType.INPUT_VALUE:
983
- case ConnectionType.OUTPUT_VALUE:
984
- return this.PUZZLE_TAB;
985
- case ConnectionType.PREVIOUS_STATEMENT:
986
- case ConnectionType.NEXT_STATEMENT:
987
- return this.NOTCH;
988
- default:
989
- throw Error('Unknown connection type');
990
- }
991
- }
992
-
993
- /**
994
- * Create any DOM elements that this renderer needs (filters, patterns, etc).
995
- * @param {!SVGElement} svg The root of the workspace's SVG.
996
- * @param {string} tagName The name to use for the CSS style tag.
997
- * @param {string} selector The CSS selector to use.
998
- * @suppress {strictModuleDepCheck} Debug renderer only included in
999
- * playground.
1000
- * @package
1001
- */
1002
- createDom(svg, tagName, selector) {
1003
- this.injectCSS_(tagName, selector);
1004
-
1005
- /*
1006
- <defs>
1007
- ... filters go here ...
1008
- </defs>
1009
- */
1010
- this.defs_ = dom.createSvgElement(Svg.DEFS, {}, svg);
1011
- /*
1012
- <filter id="blocklyEmbossFilter837493">
1013
- <feGaussianBlur in="SourceAlpha" stdDeviation="1" result="blur" />
1014
- <feSpecularLighting in="blur" surfaceScale="1" specularConstant="0.5"
1015
- specularExponent="10" lighting-color="white"
1016
- result="specOut">
1017
- <fePointLight x="-5000" y="-10000" z="20000" />
1018
- </feSpecularLighting>
1019
- <feComposite in="specOut" in2="SourceAlpha" operator="in"
1020
- result="specOut" />
1021
- <feComposite in="SourceGraphic" in2="specOut" operator="arithmetic"
1022
- k1="0" k2="1" k3="1" k4="0" />
1023
- </filter>
1024
- */
1025
- const embossFilter = dom.createSvgElement(
1026
- Svg.FILTER, {'id': 'blocklyEmbossFilter' + this.randomIdentifier},
1027
- this.defs_);
1028
- dom.createSvgElement(
1029
- Svg.FEGAUSSIANBLUR,
1030
- {'in': 'SourceAlpha', 'stdDeviation': 1, 'result': 'blur'},
1031
- embossFilter);
1032
- const feSpecularLighting = dom.createSvgElement(
1033
- Svg.FESPECULARLIGHTING, {
1034
- 'in': 'blur',
1035
- 'surfaceScale': 1,
1036
- 'specularConstant': 0.5,
1037
- 'specularExponent': 10,
1038
- 'lighting-color': 'white',
1039
- 'result': 'specOut',
1040
- },
1041
- embossFilter);
1042
- dom.createSvgElement(
1043
- Svg.FEPOINTLIGHT, {'x': -5000, 'y': -10000, 'z': 20000},
1044
- feSpecularLighting);
1045
- dom.createSvgElement(
1046
- Svg.FECOMPOSITE, {
1047
- 'in': 'specOut',
1048
- 'in2': 'SourceAlpha',
1049
- 'operator': 'in',
1050
- 'result': 'specOut',
1051
- },
1052
- embossFilter);
1053
- dom.createSvgElement(
1054
- Svg.FECOMPOSITE, {
1055
- 'in': 'SourceGraphic',
1056
- 'in2': 'specOut',
1057
- 'operator': 'arithmetic',
1058
- 'k1': 0,
1059
- 'k2': 1,
1060
- 'k3': 1,
1061
- 'k4': 0,
1062
- },
1063
- embossFilter);
1064
- this.embossFilterId = embossFilter.id;
1065
- this.embossFilter_ = embossFilter;
1066
-
1067
- /*
1068
- <pattern id="blocklyDisabledPattern837493" patternUnits="userSpaceOnUse"
1069
- width="10" height="10">
1070
- <rect width="10" height="10" fill="#aaa" />
1071
- <path d="M 0 0 L 10 10 M 10 0 L 0 10" stroke="#cc0" />
1072
- </pattern>
1073
- */
1074
- const disabledPattern = dom.createSvgElement(
1075
- Svg.PATTERN, {
1076
- 'id': 'blocklyDisabledPattern' + this.randomIdentifier,
1077
- 'patternUnits': 'userSpaceOnUse',
1078
- 'width': 10,
1079
- 'height': 10,
1080
- },
1081
- this.defs_);
1082
- dom.createSvgElement(
1083
- Svg.RECT, {'width': 10, 'height': 10, 'fill': '#aaa'}, disabledPattern);
1084
- dom.createSvgElement(
1085
- Svg.PATH, {'d': 'M 0 0 L 10 10 M 10 0 L 0 10', 'stroke': '#cc0'},
1086
- disabledPattern);
1087
- this.disabledPatternId = disabledPattern.id;
1088
- this.disabledPattern_ = disabledPattern;
1089
-
1090
- this.createDebugFilter();
1091
- }
1092
-
1093
- /**
1094
- * Create a filter for highlighting the currently rendering block during
1095
- * render debugging.
1096
- * @private
1097
- */
1098
- createDebugFilter() {
1099
- // Only create the debug filter once.
1100
- if (!this.debugFilter_) {
1101
- const debugFilter = dom.createSvgElement(
1102
- Svg.FILTER, {
1103
- 'id': 'blocklyDebugFilter' + this.randomIdentifier,
1104
- 'height': '160%',
1105
- 'width': '180%',
1106
- 'y': '-30%',
1107
- 'x': '-40%',
1108
- },
1109
- this.defs_);
1110
- // Set all gaussian blur pixels to 1 opacity before applying flood
1111
- const debugComponentTransfer = dom.createSvgElement(
1112
- Svg.FECOMPONENTTRANSFER, {'result': 'outBlur'}, debugFilter);
1113
- dom.createSvgElement(
1114
- Svg.FEFUNCA,
1115
- {'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'},
1116
- debugComponentTransfer);
1117
- // Color the highlight
1118
- dom.createSvgElement(
1119
- Svg.FEFLOOD, {
1120
- 'flood-color': '#ff0000',
1121
- 'flood-opacity': 0.5,
1122
- 'result': 'outColor',
1123
- },
1124
- debugFilter);
1125
- dom.createSvgElement(
1126
- Svg.FECOMPOSITE, {
1127
- 'in': 'outColor',
1128
- 'in2': 'outBlur',
1129
- 'operator': 'in',
1130
- 'result': 'outGlow',
1131
- },
1132
- debugFilter);
1133
- this.debugFilterId = debugFilter.id;
1134
- this.debugFilter_ = debugFilter;
1135
- }
1136
- }
1137
-
1138
- /**
1139
- * Inject renderer specific CSS into the page.
1140
- * @param {string} tagName The name of the style tag to use.
1141
- * @param {string} selector The CSS selector to use.
1142
- * @protected
1143
- */
1144
- injectCSS_(tagName, selector) {
1145
- const cssArray = this.getCSS_(selector);
1146
- const cssNodeId = 'blockly-renderer-style-' + tagName;
1147
- this.cssNode_ =
1148
- /** @type {!HTMLStyleElement} */ (document.getElementById(cssNodeId));
1149
- const text = cssArray.join('\n');
1150
- if (this.cssNode_) {
1151
- // Already injected, update if the theme changed.
1152
- this.cssNode_.firstChild.textContent = text;
1153
- return;
1154
- }
1155
- // Inject CSS tag at start of head.
1156
- const cssNode =
1157
- /** @type {!HTMLStyleElement} */ (document.createElement('style'));
1158
- cssNode.id = cssNodeId;
1159
- const cssTextNode = document.createTextNode(text);
1160
- cssNode.appendChild(cssTextNode);
1161
- document.head.insertBefore(cssNode, document.head.firstChild);
1162
- this.cssNode_ = cssNode;
1163
- }
1164
-
1165
- /**
1166
- * Get any renderer specific CSS to inject when the renderer is initialized.
1167
- * @param {string} selector CSS selector to use.
1168
- * @return {!Array<string>} Array of CSS strings.
1169
- * @protected
1170
- */
1171
- getCSS_(selector) {
1172
- return [
1173
- /* eslint-disable indent */
1174
- /* clang-format off */
1175
- // Text.
1176
- selector + ' .blocklyText, ',
1177
- selector + ' .blocklyFlyoutLabelText {',
1178
- 'font: ' + this.FIELD_TEXT_FONTWEIGHT + ' ' +
1179
- this.FIELD_TEXT_FONTSIZE + 'pt ' + this.FIELD_TEXT_FONTFAMILY + ';',
1180
- '}',
1181
-
1182
- // Fields.
1183
- selector + ' .blocklyText {',
1184
- 'fill: #fff;',
1185
- '}',
1186
- selector + ' .blocklyNonEditableText>rect,',
1187
- selector + ' .blocklyEditableText>rect {',
1188
- 'fill: ' + this.FIELD_BORDER_RECT_COLOUR + ';',
1189
- 'fill-opacity: .6;',
1190
- 'stroke: none;',
1191
- '}',
1192
- selector + ' .blocklyNonEditableText>text,',
1193
- selector + ' .blocklyEditableText>text {',
1194
- 'fill: #000;',
1195
- '}',
1196
-
1197
- // Flyout labels.
1198
- selector + ' .blocklyFlyoutLabelText {',
1199
- 'fill: #000;',
1200
- '}',
1201
-
1202
- // Bubbles.
1203
- selector + ' .blocklyText.blocklyBubbleText {',
1204
- 'fill: #000;',
1205
- '}',
1206
-
1207
- // Editable field hover.
1208
- selector + ' .blocklyEditableText:not(.editing):hover>rect {',
1209
- 'stroke: #fff;',
1210
- 'stroke-width: 2;',
1211
- '}',
1212
-
1213
- // Text field input.
1214
- selector + ' .blocklyHtmlInput {',
1215
- 'font-family: ' + this.FIELD_TEXT_FONTFAMILY + ';',
1216
- 'font-weight: ' + this.FIELD_TEXT_FONTWEIGHT + ';',
1217
- '}',
1218
-
1219
- // Selection highlight.
1220
- selector + ' .blocklySelected>.blocklyPath {',
1221
- 'stroke: #fc3;',
1222
- 'stroke-width: 3px;',
1223
- '}',
1224
-
1225
- // Connection highlight.
1226
- selector + ' .blocklyHighlightedConnectionPath {',
1227
- 'stroke: #fc3;',
1228
- '}',
1229
-
1230
- // Replaceable highlight.
1231
- selector + ' .blocklyReplaceable .blocklyPath {',
1232
- 'fill-opacity: .5;',
1233
- '}',
1234
- selector + ' .blocklyReplaceable .blocklyPathLight,',
1235
- selector + ' .blocklyReplaceable .blocklyPathDark {',
1236
- 'display: none;',
1237
- '}',
1238
-
1239
- // Insertion marker.
1240
- selector + ' .blocklyInsertionMarker>.blocklyPath {',
1241
- 'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';',
1242
- 'stroke: none;',
1243
- '}',
1244
- /* clang-format on */
1245
- /* eslint-enable indent */
1246
- ];
1247
- }
1248
- }
1249
-
1250
- exports.ConstantProvider = ConstantProvider;