blockly 7.20211209.4 → 8.0.1

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 (231) hide show
  1. package/blockly.d.ts +18963 -18432
  2. package/blockly.min.js +5 -4
  3. package/blockly_compressed.js +4 -3
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks/blocks.js +47 -0
  6. package/blocks/colour.js +13 -3
  7. package/blocks/lists.js +22 -13
  8. package/blocks/logic.js +13 -3
  9. package/blocks/loops.js +24 -11
  10. package/blocks/math.js +12 -3
  11. package/blocks/procedures.js +45 -32
  12. package/blocks/text.js +22 -13
  13. package/blocks/variables.js +14 -3
  14. package/blocks/variables_dynamic.js +13 -3
  15. package/blocks_compressed.js +1 -1
  16. package/blocks_compressed.js.map +1 -1
  17. package/core/block.js +1869 -1814
  18. package/core/block_drag_surface.js +201 -200
  19. package/core/block_dragger.js +377 -373
  20. package/core/block_svg.js +1593 -1479
  21. package/core/blockly.js +8 -22
  22. package/core/blocks.js +9 -2
  23. package/core/browser_events.js +22 -5
  24. package/core/bubble.js +841 -797
  25. package/core/bubble_dragger.js +213 -206
  26. package/core/bump_objects.js +2 -2
  27. package/core/clipboard.js +9 -9
  28. package/core/comment.js +353 -332
  29. package/core/common.js +46 -17
  30. package/core/component_manager.js +181 -174
  31. package/core/config.js +87 -0
  32. package/core/connection.js +595 -584
  33. package/core/connection_checker.js +242 -244
  34. package/core/connection_db.js +235 -230
  35. package/core/contextmenu.js +9 -6
  36. package/core/contextmenu_items.js +1 -2
  37. package/core/contextmenu_registry.js +93 -89
  38. package/core/css.js +474 -474
  39. package/core/delete_area.js +45 -42
  40. package/core/drag_target.js +57 -56
  41. package/core/dropdowndiv.js +153 -163
  42. package/core/events/events.js +2 -2
  43. package/core/events/events_abstract.js +89 -77
  44. package/core/events/events_block_base.js +37 -36
  45. package/core/events/events_block_change.js +130 -124
  46. package/core/events/events_block_create.js +73 -71
  47. package/core/events/events_block_delete.js +84 -82
  48. package/core/events/events_block_drag.js +50 -49
  49. package/core/events/events_block_move.js +147 -140
  50. package/core/events/events_bubble_open.js +51 -50
  51. package/core/events/events_click.js +48 -44
  52. package/core/events/events_comment_base.js +72 -69
  53. package/core/events/events_comment_change.js +63 -61
  54. package/core/events/events_comment_create.js +44 -42
  55. package/core/events/events_comment_delete.js +42 -40
  56. package/core/events/events_comment_move.js +106 -104
  57. package/core/events/events_marker_move.js +65 -64
  58. package/core/events/events_selected.js +46 -45
  59. package/core/events/events_theme_change.js +36 -35
  60. package/core/events/events_toolbox_item_select.js +46 -45
  61. package/core/events/events_trashcan_open.js +37 -36
  62. package/core/events/events_ui.js +47 -46
  63. package/core/events/events_ui_base.js +30 -29
  64. package/core/events/events_var_base.js +37 -36
  65. package/core/events/events_var_create.js +50 -48
  66. package/core/events/events_var_delete.js +50 -48
  67. package/core/events/events_var_rename.js +51 -49
  68. package/core/events/events_viewport.js +66 -65
  69. package/core/events/utils.js +29 -14
  70. package/core/events/workspace_events.js +49 -55
  71. package/core/extensions.js +4 -3
  72. package/core/field.js +1061 -997
  73. package/core/field_angle.js +462 -442
  74. package/core/field_checkbox.js +194 -182
  75. package/core/field_colour.js +519 -505
  76. package/core/field_dropdown.js +617 -598
  77. package/core/field_image.js +229 -220
  78. package/core/field_label.js +102 -91
  79. package/core/field_label_serializable.js +42 -41
  80. package/core/field_multilineinput.js +372 -358
  81. package/core/field_number.js +272 -253
  82. package/core/field_textinput.js +499 -467
  83. package/core/field_variable.js +458 -420
  84. package/core/flyout_base.js +1005 -952
  85. package/core/flyout_button.js +277 -260
  86. package/core/flyout_horizontal.js +304 -302
  87. package/core/flyout_metrics_manager.js +64 -64
  88. package/core/flyout_vertical.js +306 -300
  89. package/core/generator.js +459 -446
  90. package/core/gesture.js +829 -813
  91. package/core/grid.js +166 -163
  92. package/core/icon.js +168 -159
  93. package/core/inject.js +7 -5
  94. package/core/input.js +257 -248
  95. package/core/insertion_marker_manager.js +655 -624
  96. package/core/internal_constants.js +0 -129
  97. package/core/keyboard_nav/ast_node.js +605 -596
  98. package/core/keyboard_nav/basic_cursor.js +166 -165
  99. package/core/keyboard_nav/cursor.js +99 -97
  100. package/core/keyboard_nav/marker.js +83 -79
  101. package/core/keyboard_nav/tab_navigate_cursor.js +18 -23
  102. package/core/marker_manager.js +153 -141
  103. package/core/menu.js +377 -372
  104. package/core/menuitem.js +223 -217
  105. package/core/metrics_manager.js +403 -390
  106. package/core/mutator.js +468 -437
  107. package/core/names.js +229 -188
  108. package/core/options.js +290 -284
  109. package/core/procedures.js +29 -17
  110. package/core/registry.js +19 -16
  111. package/core/rendered_connection.js +482 -463
  112. package/core/renderers/common/block_rendering.js +9 -3
  113. package/core/renderers/common/constants.js +1119 -1112
  114. package/core/renderers/common/debug.js +14 -0
  115. package/core/renderers/common/debugger.js +338 -316
  116. package/core/renderers/common/drawer.js +380 -370
  117. package/core/renderers/common/i_path_object.js +2 -2
  118. package/core/renderers/common/info.js +626 -618
  119. package/core/renderers/common/marker_svg.js +579 -541
  120. package/core/renderers/common/path_object.js +203 -200
  121. package/core/renderers/common/renderer.js +220 -218
  122. package/core/renderers/geras/constants.js +36 -36
  123. package/core/renderers/geras/drawer.js +155 -147
  124. package/core/renderers/geras/highlight_constants.js +244 -238
  125. package/core/renderers/geras/highlighter.js +231 -179
  126. package/core/renderers/geras/info.js +392 -369
  127. package/core/renderers/geras/measurables/inline_input.js +25 -19
  128. package/core/renderers/geras/measurables/statement_input.js +23 -17
  129. package/core/renderers/geras/path_object.js +106 -121
  130. package/core/renderers/geras/renderer.js +96 -98
  131. package/core/renderers/measurables/base.js +30 -18
  132. package/core/renderers/measurables/bottom_row.js +83 -80
  133. package/core/renderers/measurables/connection.js +22 -15
  134. package/core/renderers/measurables/external_value_input.js +35 -22
  135. package/core/renderers/measurables/field.js +35 -20
  136. package/core/renderers/measurables/hat.js +18 -13
  137. package/core/renderers/measurables/icon.js +24 -17
  138. package/core/renderers/measurables/in_row_spacer.js +15 -13
  139. package/core/renderers/measurables/inline_input.js +43 -33
  140. package/core/renderers/measurables/input_connection.js +41 -28
  141. package/core/renderers/measurables/input_row.js +50 -44
  142. package/core/renderers/measurables/jagged_edge.js +14 -12
  143. package/core/renderers/measurables/next_connection.js +16 -14
  144. package/core/renderers/measurables/output_connection.js +26 -20
  145. package/core/renderers/measurables/previous_connection.js +16 -15
  146. package/core/renderers/measurables/round_corner.js +20 -18
  147. package/core/renderers/measurables/row.js +184 -168
  148. package/core/renderers/measurables/spacer_row.js +38 -23
  149. package/core/renderers/measurables/square_corner.js +18 -16
  150. package/core/renderers/measurables/statement_input.js +23 -20
  151. package/core/renderers/measurables/top_row.js +88 -85
  152. package/core/renderers/minimalist/constants.js +8 -7
  153. package/core/renderers/minimalist/drawer.js +11 -10
  154. package/core/renderers/minimalist/info.js +18 -18
  155. package/core/renderers/minimalist/renderer.js +40 -39
  156. package/core/renderers/thrasos/info.js +258 -248
  157. package/core/renderers/thrasos/renderer.js +20 -20
  158. package/core/renderers/zelos/constants.js +898 -873
  159. package/core/renderers/zelos/drawer.js +186 -169
  160. package/core/renderers/zelos/info.js +502 -479
  161. package/core/renderers/zelos/marker_svg.js +129 -115
  162. package/core/renderers/zelos/measurables/bottom_row.js +31 -30
  163. package/core/renderers/zelos/measurables/inputs.js +22 -21
  164. package/core/renderers/zelos/measurables/row_elements.js +14 -13
  165. package/core/renderers/zelos/measurables/top_row.js +34 -33
  166. package/core/renderers/zelos/path_object.js +181 -180
  167. package/core/renderers/zelos/renderer.js +91 -92
  168. package/core/scrollbar.js +759 -713
  169. package/core/scrollbar_pair.js +250 -245
  170. package/core/serialization/blocks.js +26 -10
  171. package/core/serialization/workspaces.js +3 -2
  172. package/core/shortcut_registry.js +286 -277
  173. package/core/sprites.js +31 -0
  174. package/core/theme.js +135 -141
  175. package/core/theme_manager.js +147 -143
  176. package/core/toolbox/category.js +602 -576
  177. package/core/toolbox/collapsible_category.js +226 -227
  178. package/core/toolbox/separator.js +70 -61
  179. package/core/toolbox/toolbox.js +934 -927
  180. package/core/toolbox/toolbox_item.js +115 -99
  181. package/core/tooltip.js +108 -35
  182. package/core/touch.js +8 -3
  183. package/core/touch_gesture.js +254 -251
  184. package/core/trashcan.js +606 -595
  185. package/core/utils/coordinate.js +97 -95
  186. package/core/utils/dom.js +2 -2
  187. package/core/utils/global.js +2 -0
  188. package/core/utils/rect.js +41 -37
  189. package/core/utils/sentinel.js +25 -0
  190. package/core/utils/size.js +30 -27
  191. package/core/utils/svg.js +18 -16
  192. package/core/variable_map.js +325 -341
  193. package/core/variable_model.js +55 -54
  194. package/core/variables.js +9 -2
  195. package/core/variables_dynamic.js +3 -1
  196. package/core/warning.js +126 -120
  197. package/core/widgetdiv.js +4 -4
  198. package/core/workspace.js +685 -664
  199. package/core/workspace_audio.js +124 -118
  200. package/core/workspace_comment.js +308 -298
  201. package/core/workspace_comment_svg.js +1029 -951
  202. package/core/workspace_drag_surface_svg.js +147 -140
  203. package/core/workspace_dragger.js +70 -71
  204. package/core/workspace_svg.js +2322 -2297
  205. package/core/xml.js +30 -20
  206. package/core/zoom_controls.js +431 -439
  207. package/generators/dart/colour.js +56 -64
  208. package/generators/dart/lists.js +61 -50
  209. package/generators/dart/math.js +160 -148
  210. package/generators/dart/text.js +83 -61
  211. package/generators/javascript/colour.js +37 -34
  212. package/generators/javascript/lists.js +50 -43
  213. package/generators/javascript/math.js +123 -139
  214. package/generators/javascript/text.js +67 -81
  215. package/generators/lua/colour.js +25 -23
  216. package/generators/lua/lists.js +97 -69
  217. package/generators/lua/logic.js +1 -2
  218. package/generators/lua/math.js +182 -144
  219. package/generators/lua/text.js +116 -99
  220. package/generators/php/colour.js +38 -32
  221. package/generators/php/lists.js +109 -89
  222. package/generators/php/math.js +90 -81
  223. package/generators/php/text.js +63 -61
  224. package/generators/python/colour.js +18 -18
  225. package/generators/python/lists.js +38 -30
  226. package/generators/python/loops.js +12 -8
  227. package/generators/python/math.js +104 -106
  228. package/generators/python/text.js +34 -30
  229. package/msg/smn.js +436 -0
  230. package/package.json +7 -6
  231. package/blocks/all.js +0 -23
package/core/icon.js CHANGED
@@ -29,188 +29,197 @@ const {Svg} = goog.require('Blockly.utils.Svg');
29
29
 
30
30
  /**
31
31
  * Class for an icon.
32
- * @param {BlockSvg} block The block associated with this icon.
33
- * @constructor
34
32
  * @abstract
35
33
  * @alias Blockly.Icon
36
34
  */
37
- const Icon = function(block) {
35
+ class Icon {
38
36
  /**
39
- * The block this icon is attached to.
40
- * @type {BlockSvg}
41
- * @protected
37
+ * @param {BlockSvg} block The block associated with this icon.
42
38
  */
43
- this.block_ = block;
39
+ constructor(block) {
40
+ /**
41
+ * The block this icon is attached to.
42
+ * @type {BlockSvg}
43
+ * @protected
44
+ */
45
+ this.block_ = block;
46
+
47
+ /**
48
+ * The icon SVG group.
49
+ * @type {?SVGGElement}
50
+ */
51
+ this.iconGroup_ = null;
52
+
53
+ /**
54
+ * Whether this icon gets hidden when the block is collapsed.
55
+ * @type {boolean}
56
+ */
57
+ this.collapseHidden = true;
58
+
59
+ /**
60
+ * Height and width of icons.
61
+ * @const
62
+ */
63
+ this.SIZE = 17;
64
+
65
+ /**
66
+ * Bubble UI (if visible).
67
+ * @type {?Bubble}
68
+ * @protected
69
+ */
70
+ this.bubble_ = null;
71
+
72
+ /**
73
+ * Absolute coordinate of icon's center.
74
+ * @type {?Coordinate}
75
+ * @protected
76
+ */
77
+ this.iconXY_ = null;
78
+ }
44
79
 
45
80
  /**
46
- * The icon SVG group.
47
- * @type {?SVGGElement}
81
+ * Create the icon on the block.
48
82
  */
49
- this.iconGroup_ = null;
50
- };
51
-
52
- /**
53
- * Does this icon get hidden when the block is collapsed.
54
- */
55
- Icon.prototype.collapseHidden = true;
56
-
57
- /**
58
- * Height and width of icons.
59
- * @const
60
- */
61
- Icon.prototype.SIZE = 17;
62
-
63
- /**
64
- * Bubble UI (if visible).
65
- * @type {?Bubble}
66
- * @protected
67
- */
68
- Icon.prototype.bubble_ = null;
69
-
70
- /**
71
- * Absolute coordinate of icon's center.
72
- * @type {?Coordinate}
73
- * @protected
74
- */
75
- Icon.prototype.iconXY_ = null;
76
-
77
- /**
78
- * Create the icon on the block.
79
- */
80
- Icon.prototype.createIcon = function() {
81
- if (this.iconGroup_) {
82
- // Icon already exists.
83
- return;
83
+ createIcon() {
84
+ if (this.iconGroup_) {
85
+ // Icon already exists.
86
+ return;
87
+ }
88
+ /* Here's the markup that will be generated:
89
+ <g class="blocklyIconGroup">
90
+ ...
91
+ </g>
92
+ */
93
+ this.iconGroup_ =
94
+ dom.createSvgElement(Svg.G, {'class': 'blocklyIconGroup'}, null);
95
+ if (this.block_.isInFlyout) {
96
+ dom.addClass(
97
+ /** @type {!Element} */ (this.iconGroup_),
98
+ 'blocklyIconGroupReadonly');
99
+ }
100
+ this.drawIcon_(this.iconGroup_);
101
+
102
+ this.block_.getSvgRoot().appendChild(this.iconGroup_);
103
+ browserEvents.conditionalBind(
104
+ this.iconGroup_, 'mouseup', this, this.iconClick_);
105
+ this.updateEditable();
84
106
  }
85
- /* Here's the markup that will be generated:
86
- <g class="blocklyIconGroup">
87
- ...
88
- </g>
89
- */
90
- this.iconGroup_ =
91
- dom.createSvgElement(Svg.G, {'class': 'blocklyIconGroup'}, null);
92
- if (this.block_.isInFlyout) {
93
- dom.addClass(
94
- /** @type {!Element} */ (this.iconGroup_), 'blocklyIconGroupReadonly');
95
- }
96
- this.drawIcon_(this.iconGroup_);
97
-
98
- this.block_.getSvgRoot().appendChild(this.iconGroup_);
99
- browserEvents.conditionalBind(
100
- this.iconGroup_, 'mouseup', this, this.iconClick_);
101
- this.updateEditable();
102
- };
103
107
 
104
- /**
105
- * Dispose of this icon.
106
- */
107
- Icon.prototype.dispose = function() {
108
- // Dispose of and unlink the icon.
109
- dom.removeNode(this.iconGroup_);
110
- this.iconGroup_ = null;
111
- // Dispose of and unlink the bubble.
112
- this.setVisible(false);
113
- this.block_ = null;
114
- };
115
-
116
- /**
117
- * Add or remove the UI indicating if this icon may be clicked or not.
118
- */
119
- Icon.prototype.updateEditable = function() {
120
- // No-op on the base class.
121
- };
108
+ /**
109
+ * Dispose of this icon.
110
+ */
111
+ dispose() {
112
+ // Dispose of and unlink the icon.
113
+ dom.removeNode(this.iconGroup_);
114
+ this.iconGroup_ = null;
115
+ // Dispose of and unlink the bubble.
116
+ this.setVisible(false);
117
+ this.block_ = null;
118
+ }
122
119
 
123
- /**
124
- * Is the associated bubble visible?
125
- * @return {boolean} True if the bubble is visible.
126
- */
127
- Icon.prototype.isVisible = function() {
128
- return !!this.bubble_;
129
- };
120
+ /**
121
+ * Add or remove the UI indicating if this icon may be clicked or not.
122
+ */
123
+ updateEditable() {
124
+ // No-op on the base class.
125
+ }
130
126
 
131
- /**
132
- * Clicking on the icon toggles if the bubble is visible.
133
- * @param {!Event} e Mouse click event.
134
- * @protected
135
- */
136
- Icon.prototype.iconClick_ = function(e) {
137
- if (this.block_.workspace.isDragging()) {
138
- // Drag operation is concluding. Don't open the editor.
139
- return;
127
+ /**
128
+ * Is the associated bubble visible?
129
+ * @return {boolean} True if the bubble is visible.
130
+ */
131
+ isVisible() {
132
+ return !!this.bubble_;
140
133
  }
141
- if (!this.block_.isInFlyout && !browserEvents.isRightButton(e)) {
142
- this.setVisible(!this.isVisible());
134
+
135
+ /**
136
+ * Clicking on the icon toggles if the bubble is visible.
137
+ * @param {!Event} e Mouse click event.
138
+ * @protected
139
+ */
140
+ iconClick_(e) {
141
+ if (this.block_.workspace.isDragging()) {
142
+ // Drag operation is concluding. Don't open the editor.
143
+ return;
144
+ }
145
+ if (!this.block_.isInFlyout && !browserEvents.isRightButton(e)) {
146
+ this.setVisible(!this.isVisible());
147
+ }
143
148
  }
144
- };
145
149
 
146
- /**
147
- * Change the colour of the associated bubble to match its block.
148
- */
149
- Icon.prototype.applyColour = function() {
150
- if (this.isVisible()) {
151
- this.bubble_.setColour(this.block_.style.colourPrimary);
150
+ /**
151
+ * Change the colour of the associated bubble to match its block.
152
+ */
153
+ applyColour() {
154
+ if (this.isVisible()) {
155
+ this.bubble_.setColour(this.block_.style.colourPrimary);
156
+ }
152
157
  }
153
- };
154
158
 
155
- /**
156
- * Notification that the icon has moved. Update the arrow accordingly.
157
- * @param {!Coordinate} xy Absolute location in workspace coordinates.
158
- */
159
- Icon.prototype.setIconLocation = function(xy) {
160
- this.iconXY_ = xy;
161
- if (this.isVisible()) {
162
- this.bubble_.setAnchorLocation(xy);
159
+ /**
160
+ * Notification that the icon has moved. Update the arrow accordingly.
161
+ * @param {!Coordinate} xy Absolute location in workspace coordinates.
162
+ */
163
+ setIconLocation(xy) {
164
+ this.iconXY_ = xy;
165
+ if (this.isVisible()) {
166
+ this.bubble_.setAnchorLocation(xy);
167
+ }
163
168
  }
164
- };
165
169
 
166
- /**
167
- * Notification that the icon has moved, but we don't really know where.
168
- * Recompute the icon's location from scratch.
169
- */
170
- Icon.prototype.computeIconLocation = function() {
171
- // Find coordinates for the centre of the icon and update the arrow.
172
- const blockXY = this.block_.getRelativeToSurfaceXY();
173
- const iconXY = svgMath.getRelativeXY(
174
- /** @type {!SVGElement} */ (this.iconGroup_));
175
- const newXY = new Coordinate(
176
- blockXY.x + iconXY.x + this.SIZE / 2,
177
- blockXY.y + iconXY.y + this.SIZE / 2);
178
- if (!Coordinate.equals(this.getIconLocation(), newXY)) {
179
- this.setIconLocation(newXY);
170
+ /**
171
+ * Notification that the icon has moved, but we don't really know where.
172
+ * Recompute the icon's location from scratch.
173
+ */
174
+ computeIconLocation() {
175
+ // Find coordinates for the centre of the icon and update the arrow.
176
+ const blockXY = this.block_.getRelativeToSurfaceXY();
177
+ const iconXY = svgMath.getRelativeXY(
178
+ /** @type {!SVGElement} */ (this.iconGroup_));
179
+ const newXY = new Coordinate(
180
+ blockXY.x + iconXY.x + this.SIZE / 2,
181
+ blockXY.y + iconXY.y + this.SIZE / 2);
182
+ if (!Coordinate.equals(this.getIconLocation(), newXY)) {
183
+ this.setIconLocation(newXY);
184
+ }
180
185
  }
181
- };
182
186
 
183
- /**
184
- * Returns the center of the block's icon relative to the surface.
185
- * @return {?Coordinate} Object with x and y properties in
186
- * workspace coordinates.
187
- */
188
- Icon.prototype.getIconLocation = function() {
189
- return this.iconXY_;
190
- };
187
+ /**
188
+ * Returns the center of the block's icon relative to the surface.
189
+ * @return {?Coordinate} Object with x and y properties in
190
+ * workspace coordinates.
191
+ */
192
+ getIconLocation() {
193
+ return this.iconXY_;
194
+ }
191
195
 
192
- /**
193
- * Get the size of the icon as used for rendering.
194
- * This differs from the actual size of the icon, because it bulges slightly
195
- * out of its row rather than increasing the height of its row.
196
- * @return {!Size} Height and width.
197
- */
198
- // TODO (#2562): Remove getCorrectedSize.
199
- Icon.prototype.getCorrectedSize = function() {
200
- return new Size(Icon.prototype.SIZE, Icon.prototype.SIZE - 2);
201
- };
196
+ /**
197
+ * Get the size of the icon as used for rendering.
198
+ * This differs from the actual size of the icon, because it bulges slightly
199
+ * out of its row rather than increasing the height of its row.
200
+ * @return {!Size} Height and width.
201
+ */
202
+ getCorrectedSize() {
203
+ // TODO (#2562): Remove getCorrectedSize.
204
+ return new Size(this.SIZE, this.SIZE - 2);
205
+ }
202
206
 
203
- /**
204
- * Draw the icon.
205
- * @param {!Element} group The icon group.
206
- * @protected
207
- */
208
- Icon.prototype.drawIcon_;
207
+ /**
208
+ * Draw the icon.
209
+ * @param {!Element} _group The icon group.
210
+ * @protected
211
+ */
212
+ drawIcon_(_group) {
213
+ // No-op on base class.
214
+ }
209
215
 
210
- /**
211
- * Show or hide the icon.
212
- * @param {boolean} visible True if the icon should be visible.
213
- */
214
- Icon.prototype.setVisible;
216
+ /**
217
+ * Show or hide the icon.
218
+ * @param {boolean} _visible True if the icon should be visible.
219
+ */
220
+ setVisible(_visible) {
221
+ // No-op on base class
222
+ }
223
+ }
215
224
 
216
225
  exports.Icon = Icon;
package/core/inject.js CHANGED
@@ -24,11 +24,11 @@ const browserEvents = goog.require('Blockly.browserEvents');
24
24
  const bumpObjects = goog.require('Blockly.bumpObjects');
25
25
  const common = goog.require('Blockly.common');
26
26
  const dom = goog.require('Blockly.utils.dom');
27
+ const dropDownDiv = goog.require('Blockly.dropDownDiv');
27
28
  const userAgent = goog.require('Blockly.utils.userAgent');
28
29
  const {BlockDragSurfaceSvg} = goog.require('Blockly.BlockDragSurfaceSvg');
29
30
  /* eslint-disable-next-line no-unused-vars */
30
31
  const {BlocklyOptions} = goog.requireType('Blockly.BlocklyOptions');
31
- const {DropDownDiv} = goog.require('Blockly.DropDownDiv');
32
32
  const {Grid} = goog.require('Blockly.Grid');
33
33
  const {Msg} = goog.require('Blockly.Msg');
34
34
  const {Options} = goog.require('Blockly.Options');
@@ -59,7 +59,8 @@ const inject = function(container, opt_options) {
59
59
  }
60
60
  const options =
61
61
  new Options(opt_options || (/** @type {!BlocklyOptions} */ ({})));
62
- const subContainer = document.createElement('div');
62
+ const subContainer =
63
+ /** @type {!HTMLDivElement} */ (document.createElement('div'));
63
64
  subContainer.className = 'injectionDiv';
64
65
  subContainer.tabIndex = 0;
65
66
  aria.setState(subContainer, aria.State.LABEL, Msg['WORKSPACE_ARIA_LABEL']);
@@ -192,7 +193,7 @@ const createMainWorkspace = function(
192
193
  // The SVG is now fully assembled.
193
194
  common.svgResize(mainWorkspace);
194
195
  WidgetDiv.createDom();
195
- DropDownDiv.createDom();
196
+ dropDownDiv.createDom();
196
197
  Tooltip.createDom();
197
198
  return mainWorkspace;
198
199
  };
@@ -274,7 +275,8 @@ const init = function(mainWorkspace) {
274
275
  // TODO (https://github.com/google/blockly/issues/1998) handle cases where there
275
276
  // are multiple workspaces and non-main workspaces are able to accept input.
276
277
  const onKeyDown = function(e) {
277
- const mainWorkspace = common.getMainWorkspace();
278
+ const mainWorkspace =
279
+ /** @type {!WorkspaceSvg} */ (common.getMainWorkspace());
278
280
  if (!mainWorkspace) {
279
281
  return;
280
282
  }
@@ -337,7 +339,7 @@ const bindDocumentEvents = function() {
337
339
  /**
338
340
  * Load sounds for the given workspace.
339
341
  * @param {string} pathToMedia The path to the media directory.
340
- * @param {!Workspace} workspace The workspace to load sounds for.
342
+ * @param {!WorkspaceSvg} workspace The workspace to load sounds for.
341
343
  */
342
344
  const loadSounds = function(pathToMedia, workspace) {
343
345
  const audioMgr = workspace.getAudioManager();