blockly 8.0.5 → 9.0.0-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.
- package/blockly.min.js +2002 -2269
- package/blockly_compressed.js +1499 -1994
- package/blockly_compressed.js.map +1 -1
- package/blocks/blocks.js +3 -2
- package/blocks/colour.js +3 -1
- package/blocks/lists.js +94 -22
- package/blocks/logic.js +14 -6
- package/blocks/loops.js +5 -3
- package/blocks/math.js +3 -1
- package/blocks/procedures.js +3 -1
- package/blocks/text.js +14 -6
- package/blocks/variables.js +3 -1
- package/blocks/variables_dynamic.js +3 -1
- package/blocks.d.ts +0 -2
- package/blocks_compressed.js +189 -171
- package/blocks_compressed.js.map +1 -1
- package/closure/goog/base.d.ts +1 -0
- package/closure/goog/base_minimal.d.ts +18 -0
- package/closure/goog/goog.d.ts +25 -0
- package/core/any_aliases.d.ts +1 -0
- package/core/any_aliases.ts +1 -0
- package/core/block.d.ts +779 -0
- package/core/{block.js → block.ts} +610 -719
- package/core/block_animations.d.ts +33 -0
- package/core/{block_animations.js → block_animations.ts} +75 -79
- package/core/block_drag_surface.d.ts +111 -0
- package/core/{block_drag_surface.js → block_drag_surface.ts} +85 -117
- package/core/block_dragger.d.ts +143 -0
- package/core/{block_dragger.js → block_dragger.ts} +139 -176
- package/core/block_svg.d.ts +588 -0
- package/core/{block_svg.js → block_svg.ts} +494 -630
- package/core/blockly.d.ts +562 -0
- package/core/blockly.js +1 -1
- package/core/blockly.ts +749 -0
- package/core/blockly_options.d.ts +69 -0
- package/core/blockly_options.ts +81 -0
- package/core/blocks.d.ts +17 -0
- package/core/{blocks.js → blocks.ts} +4 -8
- package/core/browser_events.d.ts +85 -0
- package/core/{browser_events.js → browser_events.ts} +98 -93
- package/core/bubble.d.ts +279 -0
- package/core/{bubble.js → bubble.ts} +277 -370
- package/core/bubble_dragger.d.ts +73 -0
- package/core/bubble_dragger.ts +229 -0
- package/core/bump_objects.d.ts +34 -0
- package/core/{bump_objects.js → bump_objects.ts} +54 -52
- package/core/clipboard.d.ts +42 -0
- package/core/clipboard.ts +91 -0
- package/core/comment.d.ts +113 -0
- package/core/{comment.js → comment.ts} +135 -185
- package/core/common.d.ts +129 -0
- package/core/{common.js → common.ts} +105 -82
- package/core/component_manager.d.ts +91 -0
- package/core/component_manager.ts +211 -0
- package/core/config.d.ts +23 -0
- package/core/{config.js → config.ts} +12 -19
- package/core/connection.d.ts +232 -0
- package/core/{connection.js → connection.ts} +187 -237
- package/core/connection_checker.d.ts +78 -0
- package/core/{connection_checker.js → connection_checker.ts} +66 -77
- package/core/connection_db.d.ts +91 -0
- package/core/{connection_db.js → connection_db.ts} +62 -87
- package/core/connection_type.d.ts +15 -0
- package/core/{connection_type.js → connection_type.ts} +8 -12
- package/core/constants.d.ts +15 -0
- package/core/{constants.js → constants.ts} +4 -8
- package/core/contextmenu.d.ts +80 -0
- package/core/{contextmenu.js → contextmenu.ts} +118 -153
- package/core/contextmenu_items.d.ts +77 -0
- package/core/contextmenu_items.ts +576 -0
- package/core/contextmenu_registry.d.ts +105 -0
- package/core/contextmenu_registry.ts +179 -0
- package/core/css.d.ts +24 -0
- package/core/{css.js → css.ts} +16 -24
- package/core/delete_area.d.ts +47 -0
- package/core/delete_area.ts +82 -0
- package/core/dialog.d.ts +61 -0
- package/core/dialog.ts +127 -0
- package/core/drag_target.d.ts +63 -0
- package/core/drag_target.ts +94 -0
- package/core/dropdowndiv.d.ts +155 -0
- package/core/{dropdowndiv.js → dropdowndiv.ts} +262 -333
- package/core/events/events.d.ts +102 -0
- package/core/events/events.ts +123 -0
- package/core/events/events_abstract.d.ts +51 -0
- package/core/events/events_abstract.ts +112 -0
- package/core/events/events_block_base.d.ts +31 -0
- package/core/events/events_block_base.ts +65 -0
- package/core/events/events_block_change.d.ts +55 -0
- package/core/events/{events_block_change.js → events_block_change.ts} +45 -48
- package/core/events/events_block_create.d.ts +35 -0
- package/core/events/{events_block_create.js → events_block_create.ts} +30 -35
- package/core/events/events_block_delete.d.ts +36 -0
- package/core/events/{events_block_delete.js → events_block_delete.ts} +34 -39
- package/core/events/events_block_drag.d.ts +36 -0
- package/core/events/events_block_drag.ts +82 -0
- package/core/events/events_block_move.d.ts +51 -0
- package/core/events/{events_block_move.js → events_block_move.ts} +54 -50
- package/core/events/events_bubble_open.d.ts +35 -0
- package/core/events/events_bubble_open.ts +82 -0
- package/core/events/events_click.d.ts +36 -0
- package/core/events/{events_click.js → events_click.ts} +27 -30
- package/core/events/events_comment_base.d.ts +39 -0
- package/core/events/events_comment_base.ts +107 -0
- package/core/events/events_comment_change.d.ts +43 -0
- package/core/events/{events_comment_change.js → events_comment_change.ts} +31 -28
- package/core/events/events_comment_create.d.ts +35 -0
- package/core/events/{events_comment_create.js → events_comment_create.ts} +24 -26
- package/core/events/events_comment_delete.d.ts +35 -0
- package/core/events/{events_comment_delete.js → events_comment_delete.ts} +20 -24
- package/core/events/events_comment_move.d.ts +55 -0
- package/core/events/{events_comment_move.js → events_comment_move.ts} +39 -42
- package/core/events/events_marker_move.d.ts +40 -0
- package/core/events/events_marker_move.ts +99 -0
- package/core/events/events_selected.d.ts +34 -0
- package/core/events/events_selected.ts +78 -0
- package/core/events/events_theme_change.d.ts +30 -0
- package/core/events/{events_theme_change.js → events_theme_change.ts} +19 -24
- package/core/events/events_toolbox_item_select.d.ts +34 -0
- package/core/events/events_toolbox_item_select.ts +79 -0
- package/core/events/events_trashcan_open.d.ts +31 -0
- package/core/events/events_trashcan_open.ts +68 -0
- package/core/events/events_ui.d.ts +37 -0
- package/core/events/{events_ui.js → events_ui.ts} +27 -26
- package/core/events/events_ui_base.d.ts +26 -0
- package/core/events/{events_ui_base.js → events_ui_base.ts} +17 -26
- package/core/events/events_var_base.d.ts +31 -0
- package/core/events/events_var_base.ts +65 -0
- package/core/events/events_var_create.d.ts +35 -0
- package/core/events/{events_var_create.js → events_var_create.ts} +24 -25
- package/core/events/events_var_delete.d.ts +35 -0
- package/core/events/{events_var_delete.js → events_var_delete.ts} +24 -25
- package/core/events/events_var_rename.d.ts +36 -0
- package/core/events/{events_var_rename.js → events_var_rename.ts} +25 -26
- package/core/events/events_viewport.d.ts +39 -0
- package/core/events/events_viewport.ts +100 -0
- package/core/events/utils.d.ts +272 -0
- package/core/events/{utils.js → utils.ts} +148 -219
- package/core/events/workspace_events.d.ts +36 -0
- package/core/events/workspace_events.ts +86 -0
- package/core/extensions.d.ts +107 -0
- package/core/{extensions.js → extensions.ts} +153 -172
- package/core/field.d.ts +534 -0
- package/core/{field.js → field.ts} +413 -489
- package/core/field_angle.d.ts +176 -0
- package/core/field_angle.ts +563 -0
- package/core/field_checkbox.d.ts +124 -0
- package/core/field_checkbox.ts +243 -0
- package/core/field_colour.d.ts +200 -0
- package/core/field_colour.ts +632 -0
- package/core/field_dropdown.d.ts +222 -0
- package/core/{field_dropdown.js → field_dropdown.ts} +277 -299
- package/core/field_image.d.ts +134 -0
- package/core/field_image.ts +282 -0
- package/core/field_label.d.ts +71 -0
- package/core/field_label.ts +152 -0
- package/core/field_label_serializable.d.ts +42 -0
- package/core/field_label_serializable.ts +76 -0
- package/core/field_multilineinput.d.ts +146 -0
- package/core/{field_multilineinput.js → field_multilineinput.ts} +166 -163
- package/core/field_number.d.ts +156 -0
- package/core/{field_number.js → field_number.ts} +110 -123
- package/core/field_registry.d.ts +45 -0
- package/core/{field_registry.js → field_registry.ts} +37 -30
- package/core/field_textinput.d.ts +219 -0
- package/core/field_textinput.ts +591 -0
- package/core/field_variable.d.ts +217 -0
- package/core/{field_variable.js → field_variable.ts} +174 -187
- package/core/flyout_base.d.ts +459 -0
- package/core/{flyout_base.js → flyout_base.ts} +429 -518
- package/core/flyout_button.d.ts +81 -0
- package/core/flyout_button.ts +292 -0
- package/core/flyout_horizontal.d.ts +82 -0
- package/core/{flyout_horizontal.js → flyout_horizontal.ts} +97 -107
- package/core/flyout_metrics_manager.d.ts +40 -0
- package/core/{flyout_metrics_manager.js → flyout_metrics_manager.ts} +22 -34
- package/core/flyout_vertical.d.ts +83 -0
- package/core/{flyout_vertical.js → flyout_vertical.ts} +106 -117
- package/core/generator.d.ts +205 -0
- package/core/{generator.js → generator.ts} +168 -193
- package/core/gesture.d.ts +357 -0
- package/core/{gesture.js → gesture.ts} +289 -369
- package/core/grid.d.ts +83 -0
- package/core/grid.ts +192 -0
- package/core/icon.d.ts +78 -0
- package/core/icon.ts +189 -0
- package/core/inject.d.ts +15 -0
- package/core/{inject.js → inject.ts} +101 -100
- package/core/input.d.ts +128 -0
- package/core/input.ts +309 -0
- package/core/input_types.d.ts +14 -0
- package/core/{input_types.js → input_types.ts} +8 -12
- package/core/insertion_marker_manager.d.ts +212 -0
- package/core/{insertion_marker_manager.js → insertion_marker_manager.ts} +234 -236
- package/core/interfaces/i_ast_node_location.d.ts +11 -0
- package/core/interfaces/{i_ast_node_location.js → i_ast_node_location.ts} +4 -7
- package/core/interfaces/i_ast_node_location_svg.d.ts +22 -0
- package/core/interfaces/i_ast_node_location_svg.ts +37 -0
- package/core/interfaces/i_ast_node_location_with_block.d.ts +18 -0
- package/core/interfaces/i_ast_node_location_with_block.ts +38 -0
- package/core/interfaces/i_autohideable.d.ts +18 -0
- package/core/interfaces/i_autohideable.ts +34 -0
- package/core/interfaces/i_block_dragger.d.ts +43 -0
- package/core/interfaces/i_block_dragger.ts +67 -0
- package/core/interfaces/i_bounded_element.d.ts +24 -0
- package/core/interfaces/i_bounded_element.ts +42 -0
- package/core/interfaces/i_bubble.d.ts +59 -0
- package/core/interfaces/i_bubble.ts +88 -0
- package/core/interfaces/i_collapsible_toolbox_item.d.ts +26 -0
- package/core/interfaces/i_collapsible_toolbox_item.ts +47 -0
- package/core/interfaces/i_component.d.ts +17 -0
- package/core/interfaces/{i_component.js → i_component.ts} +9 -14
- package/core/interfaces/i_connection_checker.d.ts +69 -0
- package/core/interfaces/i_connection_checker.ts +102 -0
- package/core/interfaces/i_contextmenu.d.ts +13 -0
- package/core/interfaces/i_contextmenu.ts +26 -0
- package/core/interfaces/i_copyable.d.ts +24 -0
- package/core/interfaces/i_copyable.ts +40 -0
- package/core/interfaces/i_deletable.d.ts +16 -0
- package/core/interfaces/{i_deletable.js → i_deletable.ts} +9 -13
- package/core/interfaces/i_delete_area.d.ts +25 -0
- package/core/interfaces/i_delete_area.ts +46 -0
- package/core/interfaces/i_drag_target.d.ts +53 -0
- package/core/interfaces/i_drag_target.ts +84 -0
- package/core/interfaces/i_draggable.d.ts +12 -0
- package/core/interfaces/{i_draggable.js → i_draggable.ts} +4 -10
- package/core/interfaces/i_flyout.d.ts +134 -0
- package/core/interfaces/i_flyout.ts +186 -0
- package/core/interfaces/i_keyboard_accessible.d.ts +18 -0
- package/core/interfaces/i_keyboard_accessible.ts +35 -0
- package/core/interfaces/i_metrics_manager.d.ts +117 -0
- package/core/interfaces/i_metrics_manager.ts +151 -0
- package/core/interfaces/i_movable.d.ts +16 -0
- package/core/interfaces/{i_movable.js → i_movable.ts} +9 -13
- package/core/interfaces/i_positionable.d.ts +27 -0
- package/core/interfaces/i_positionable.ts +50 -0
- package/core/interfaces/i_registrable.d.ts +11 -0
- package/core/interfaces/{i_registrable.js → i_registrable.ts} +3 -7
- package/core/interfaces/i_registrable_field.d.ts +17 -0
- package/core/interfaces/{i_registrable_field.js → i_registrable_field.ts} +8 -16
- package/core/interfaces/i_selectable.d.ts +18 -0
- package/core/interfaces/i_selectable.ts +34 -0
- package/core/interfaces/i_selectable_toolbox_item.d.ts +42 -0
- package/core/interfaces/i_selectable_toolbox_item.ts +64 -0
- package/core/interfaces/i_serializer.d.ts +42 -0
- package/core/interfaces/i_serializer.ts +65 -0
- package/core/interfaces/i_styleable.d.ts +21 -0
- package/core/interfaces/i_styleable.ts +35 -0
- package/core/interfaces/i_toolbox.d.ts +85 -0
- package/core/interfaces/i_toolbox.ts +127 -0
- package/core/interfaces/i_toolbox_item.d.ts +62 -0
- package/core/interfaces/i_toolbox_item.ts +84 -0
- package/core/internal_constants.d.ts +40 -0
- package/core/{internal_constants.js → internal_constants.ts} +13 -18
- package/core/keyboard_nav/ast_node.d.ts +239 -0
- package/core/keyboard_nav/{ast_node.js → ast_node.ts} +207 -231
- package/core/keyboard_nav/basic_cursor.d.ts +88 -0
- package/core/keyboard_nav/{basic_cursor.js → basic_cursor.ts} +55 -66
- package/core/keyboard_nav/cursor.d.ts +41 -0
- package/core/keyboard_nav/{cursor.js → cursor.ts} +25 -35
- package/core/keyboard_nav/marker.d.ts +58 -0
- package/core/keyboard_nav/{marker.js → marker.ts} +36 -55
- package/core/keyboard_nav/tab_navigate_cursor.d.ts +19 -0
- package/core/keyboard_nav/{tab_navigate_cursor.js → tab_navigate_cursor.ts} +11 -15
- package/core/main.d.ts +11 -0
- package/core/main.js +303 -0
- package/core/marker_manager.d.ts +85 -0
- package/core/marker_manager.ts +181 -0
- package/core/menu.d.ts +149 -0
- package/core/{menu.js → menu.ts} +141 -174
- package/core/menuitem.d.ts +118 -0
- package/core/menuitem.ts +240 -0
- package/core/metrics_manager.d.ts +201 -0
- package/core/{metrics_manager.js → metrics_manager.ts} +117 -156
- package/core/msg.d.ts +9 -0
- package/core/{msg.js → msg.ts} +4 -8
- package/core/mutator.d.ts +128 -0
- package/core/{mutator.js → mutator.ts} +196 -211
- package/core/names.d.ts +124 -0
- package/core/names.ts +267 -0
- package/core/options.d.ts +137 -0
- package/core/{options.js → options.ts} +147 -173
- package/core/positionable_helpers.d.ts +88 -0
- package/core/{positionable_helpers.js → positionable_helpers.ts} +63 -70
- package/core/procedures.d.ts +108 -0
- package/core/{procedures.js → procedures.ts} +143 -152
- package/core/registry.d.ts +137 -0
- package/core/registry.ts +339 -0
- package/core/rendered_connection.d.ts +191 -0
- package/core/{rendered_connection.js → rendered_connection.ts} +164 -184
- package/core/renderers/common/block_rendering.d.ts +114 -0
- package/core/renderers/common/block_rendering.ts +164 -0
- package/core/renderers/common/constants.d.ts +458 -0
- package/core/renderers/common/constants.ts +1124 -0
- package/core/renderers/common/debug.d.ts +28 -0
- package/core/renderers/common/{debug.js → debug.ts} +14 -20
- package/core/renderers/common/debugger.d.ts +120 -0
- package/core/renderers/common/{debugger.js → debugger.ts} +100 -124
- package/core/renderers/common/drawer.d.ts +132 -0
- package/core/renderers/common/{drawer.js → drawer.ts} +112 -137
- package/core/renderers/common/i_path_object.d.ts +117 -0
- package/core/renderers/common/i_path_object.ts +161 -0
- package/core/renderers/common/info.d.ts +194 -0
- package/core/renderers/common/{info.js → info.ts} +165 -222
- package/core/renderers/common/marker_svg.d.ts +220 -0
- package/core/renderers/common/marker_svg.ts +680 -0
- package/core/renderers/common/path_object.d.ts +146 -0
- package/core/renderers/common/path_object.ts +272 -0
- package/core/renderers/common/renderer.d.ts +157 -0
- package/core/renderers/common/renderer.ts +271 -0
- package/core/renderers/geras/constants.d.ts +23 -0
- package/core/renderers/geras/constants.ts +61 -0
- package/core/renderers/geras/drawer.d.ts +43 -0
- package/core/renderers/geras/{drawer.js → drawer.ts} +40 -84
- package/core/renderers/geras/geras.d.ts +11 -0
- package/core/renderers/geras/geras.ts +37 -0
- package/core/renderers/geras/highlight_constants.d.ts +108 -0
- package/core/renderers/geras/{highlight_constants.js → highlight_constants.ts} +107 -69
- package/core/renderers/geras/highlighter.d.ts +98 -0
- package/core/renderers/geras/{highlighter.js → highlighter.ts} +81 -86
- package/core/renderers/geras/info.d.ts +45 -0
- package/core/renderers/geras/{info.js → info.ts} +61 -99
- package/core/renderers/geras/measurables/inline_input.d.ts +23 -0
- package/core/renderers/geras/measurables/inline_input.ts +51 -0
- package/core/renderers/geras/measurables/statement_input.d.ts +23 -0
- package/core/renderers/geras/measurables/statement_input.ts +50 -0
- package/core/renderers/geras/path_object.d.ts +47 -0
- package/core/renderers/geras/{path_object.js → path_object.ts} +46 -74
- package/core/renderers/geras/renderer.d.ts +69 -0
- package/core/renderers/geras/renderer.ts +126 -0
- package/core/renderers/measurables/base.d.ts +27 -0
- package/core/renderers/measurables/base.ts +53 -0
- package/core/renderers/measurables/bottom_row.d.ts +61 -0
- package/core/renderers/measurables/bottom_row.ts +120 -0
- package/core/renderers/measurables/connection.d.ts +25 -0
- package/core/renderers/measurables/connection.ts +52 -0
- package/core/renderers/measurables/external_value_input.d.ts +27 -0
- package/core/renderers/measurables/external_value_input.ts +65 -0
- package/core/renderers/measurables/field.d.ts +30 -0
- package/core/renderers/measurables/field.ts +63 -0
- package/core/renderers/measurables/hat.d.ts +21 -0
- package/core/renderers/measurables/{hat.js → hat.ts} +12 -14
- package/core/renderers/measurables/icon.d.ts +26 -0
- package/core/renderers/measurables/{icon.js → icon.ts} +14 -18
- package/core/renderers/measurables/in_row_spacer.d.ts +21 -0
- package/core/renderers/measurables/in_row_spacer.ts +44 -0
- package/core/renderers/measurables/inline_input.d.ts +24 -0
- package/core/renderers/measurables/{inline_input.js → inline_input.ts} +22 -26
- package/core/renderers/measurables/input_connection.d.ts +29 -0
- package/core/renderers/measurables/input_connection.ts +66 -0
- package/core/renderers/measurables/input_row.d.ts +30 -0
- package/core/renderers/measurables/{input_row.js → input_row.ts} +24 -31
- package/core/renderers/measurables/jagged_edge.d.ts +20 -0
- package/core/renderers/measurables/{jagged_edge.js → jagged_edge.ts} +10 -13
- package/core/renderers/measurables/next_connection.d.ts +23 -0
- package/core/renderers/measurables/next_connection.ts +47 -0
- package/core/renderers/measurables/output_connection.d.ts +26 -0
- package/core/renderers/measurables/output_connection.ts +56 -0
- package/core/renderers/measurables/previous_connection.d.ts +23 -0
- package/core/renderers/measurables/previous_connection.ts +47 -0
- package/core/renderers/measurables/round_corner.d.ts +21 -0
- package/core/renderers/measurables/round_corner.ts +49 -0
- package/core/renderers/measurables/row.d.ts +141 -0
- package/core/renderers/measurables/row.ts +225 -0
- package/core/renderers/measurables/spacer_row.d.ts +29 -0
- package/core/renderers/measurables/spacer_row.ts +55 -0
- package/core/renderers/measurables/square_corner.d.ts +21 -0
- package/core/renderers/measurables/square_corner.ts +47 -0
- package/core/renderers/measurables/statement_input.d.ts +22 -0
- package/core/renderers/measurables/{statement_input.js → statement_input.ts} +14 -18
- package/core/renderers/measurables/top_row.d.ts +56 -0
- package/core/renderers/measurables/top_row.ts +122 -0
- package/core/renderers/measurables/types.d.ts +235 -0
- package/core/renderers/measurables/types.ts +332 -0
- package/core/renderers/minimalist/constants.d.ts +14 -0
- package/core/renderers/minimalist/{constants.js → constants.ts} +5 -10
- package/core/renderers/minimalist/drawer.d.ts +21 -0
- package/core/renderers/minimalist/drawer.ts +38 -0
- package/core/renderers/minimalist/info.d.ts +30 -0
- package/core/renderers/minimalist/info.ts +52 -0
- package/core/renderers/minimalist/minimalist.d.ts +6 -0
- package/core/renderers/minimalist/minimalist.ts +22 -0
- package/core/renderers/minimalist/renderer.d.ts +41 -0
- package/core/renderers/minimalist/renderer.ts +71 -0
- package/core/renderers/thrasos/info.d.ts +40 -0
- package/core/renderers/thrasos/{info.js → info.ts} +66 -67
- package/core/renderers/thrasos/renderer.d.ts +25 -0
- package/core/renderers/thrasos/renderer.ts +48 -0
- package/core/renderers/thrasos/thrasos.d.ts +4 -0
- package/core/renderers/thrasos/thrasos.ts +20 -0
- package/core/renderers/zelos/constants.d.ts +186 -0
- package/core/renderers/zelos/{constants.js → constants.ts} +294 -441
- package/core/renderers/zelos/drawer.d.ts +47 -0
- package/core/renderers/zelos/{drawer.js → drawer.ts} +73 -95
- package/core/renderers/zelos/info.d.ts +88 -0
- package/core/renderers/zelos/{info.js → info.ts} +111 -142
- package/core/renderers/zelos/marker_svg.d.ts +46 -0
- package/core/renderers/zelos/marker_svg.ts +151 -0
- package/core/renderers/zelos/measurables/bottom_row.d.ts +27 -0
- package/core/renderers/zelos/measurables/bottom_row.ts +53 -0
- package/core/renderers/zelos/measurables/inputs.d.ts +23 -0
- package/core/renderers/zelos/measurables/{inputs.js → inputs.ts} +14 -15
- package/core/renderers/zelos/measurables/row_elements.d.ts +21 -0
- package/core/renderers/zelos/measurables/row_elements.ts +45 -0
- package/core/renderers/zelos/measurables/top_row.d.ts +29 -0
- package/core/renderers/zelos/measurables/{top_row.js → top_row.ts} +14 -27
- package/core/renderers/zelos/path_object.d.ts +77 -0
- package/core/renderers/zelos/path_object.ts +215 -0
- package/core/renderers/zelos/renderer.d.ts +74 -0
- package/core/renderers/zelos/renderer.ts +142 -0
- package/core/renderers/zelos/zelos.d.ts +12 -0
- package/core/renderers/zelos/zelos.ts +39 -0
- package/core/scrollbar.d.ts +277 -0
- package/core/{scrollbar.js → scrollbar.ts} +307 -328
- package/core/scrollbar_pair.d.ts +105 -0
- package/core/{scrollbar_pair.js → scrollbar_pair.ts} +71 -79
- package/core/serialization/blocks.d.ts +98 -0
- package/core/serialization/{blocks.js → blocks.ts} +229 -228
- package/core/serialization/exceptions.d.ts +73 -0
- package/core/serialization/exceptions.ts +98 -0
- package/core/serialization/priorities.d.ts +15 -0
- package/core/serialization/{priorities.js → priorities.ts} +4 -10
- package/core/serialization/registry.d.ts +20 -0
- package/core/serialization/{registry.js → registry.ts} +11 -13
- package/core/serialization/variables.d.ts +14 -0
- package/core/serialization/{variables.js → variables.ts} +30 -32
- package/core/serialization/workspaces.d.ts +28 -0
- package/core/serialization/{workspaces.js → workspaces.ts} +30 -27
- package/core/shortcut_items.d.ts +61 -0
- package/core/{shortcut_items.js → shortcut_items.ts} +121 -157
- package/core/shortcut_registry.d.ts +151 -0
- package/core/shortcut_registry.ts +355 -0
- package/core/sprites.d.ts +19 -0
- package/core/{sprites.js → sprites.ts} +4 -6
- package/core/theme/classic.d.ts +12 -0
- package/core/theme/{classic.js → classic.ts} +5 -7
- package/core/theme/themes.d.ts +8 -0
- package/core/theme/themes.ts +22 -0
- package/core/theme/zelos.d.ts +11 -0
- package/core/theme/{zelos.js → zelos.ts} +4 -7
- package/core/theme.d.ts +142 -0
- package/core/theme.ts +221 -0
- package/core/theme_manager.d.ts +81 -0
- package/core/theme_manager.ts +186 -0
- package/core/toolbox/category.d.ts +239 -0
- package/core/toolbox/category.ts +679 -0
- package/core/toolbox/collapsible_category.d.ts +91 -0
- package/core/toolbox/collapsible_category.ts +273 -0
- package/core/toolbox/separator.d.ts +39 -0
- package/core/toolbox/separator.ts +105 -0
- package/core/toolbox/toolbox.d.ts +352 -0
- package/core/toolbox/{toolbox.js → toolbox.ts} +316 -432
- package/core/toolbox/toolbox_item.d.ts +85 -0
- package/core/toolbox/toolbox_item.ts +147 -0
- package/core/tooltip.d.ts +126 -0
- package/core/{tooltip.js → tooltip.ts} +136 -214
- package/core/touch.d.ts +121 -0
- package/core/touch.ts +306 -0
- package/core/touch_gesture.d.ts +115 -0
- package/core/{touch_gesture.js → touch_gesture.ts} +87 -125
- package/core/trashcan.d.ts +195 -0
- package/core/{trashcan.js → trashcan.ts} +226 -312
- package/core/utils/aria.d.ts +67 -0
- package/core/utils/{aria.js → aria.ts} +47 -61
- package/core/utils/array.d.ts +14 -0
- package/core/utils/{array.js → array.ts} +10 -12
- package/core/utils/colour.d.ts +103 -0
- package/core/utils/{colour.js → colour.ts} +60 -72
- package/core/utils/coordinate.d.ts +72 -0
- package/core/utils/coordinate.ts +124 -0
- package/core/utils/deprecation.d.ts +17 -0
- package/core/utils/{deprecation.js → deprecation.ts} +11 -11
- package/core/utils/dom.d.ts +165 -0
- package/core/utils/{dom.js → dom.ts} +125 -147
- package/core/utils/idgenerator.d.ts +25 -0
- package/core/utils/{idgenerator.js → idgenerator.ts} +15 -18
- package/core/utils/keycodes.d.ts +137 -0
- package/core/utils/keycodes.ts +169 -0
- package/core/utils/math.d.ts +30 -0
- package/core/utils/{math.js → math.ts} +17 -19
- package/core/utils/metrics.d.ts +64 -0
- package/core/utils/metrics.ts +97 -0
- package/core/utils/object.d.ts +35 -0
- package/core/utils/{object.js → object.ts} +30 -26
- package/core/utils/parsing.d.ts +50 -0
- package/core/utils/{parsing.js → parsing.ts} +50 -50
- package/core/utils/rect.d.ts +38 -0
- package/core/utils/{rect.js → rect.ts} +18 -31
- package/core/utils/sentinel.d.ts +11 -0
- package/core/utils/{sentinel.js → sentinel.ts} +3 -5
- package/core/utils/size.d.ts +27 -0
- package/core/utils/{size.js → size.ts} +12 -26
- package/core/utils/string.d.ts +55 -0
- package/core/utils/{string.js → string.ts} +64 -61
- package/core/utils/style.d.ts +127 -0
- package/core/utils/{style.js → style.ts} +102 -92
- package/core/utils/svg.d.ts +68 -0
- package/core/utils/svg.ts +88 -0
- package/core/utils/svg_math.d.ts +70 -0
- package/core/utils/{svg_math.js → svg_math.ts} +72 -71
- package/core/utils/svg_paths.d.ts +101 -0
- package/core/utils/{svg_paths.js → svg_paths.ts} +56 -65
- package/core/utils/toolbox.d.ts +193 -0
- package/core/utils/toolbox.ts +433 -0
- package/core/utils/useragent.d.ts +33 -0
- package/core/utils/useragent.ts +135 -0
- package/core/utils/xml.d.ts +52 -0
- package/core/utils/{xml.js → xml.ts} +26 -36
- package/core/utils.d.ts +217 -0
- package/core/utils.ts +428 -0
- package/core/variable_map.d.ts +141 -0
- package/core/{variable_map.js → variable_map.ts} +131 -149
- package/core/variable_model.d.ts +40 -0
- package/core/variable_model.ts +82 -0
- package/core/variables.d.ts +181 -0
- package/core/{variables.js → variables.ts} +206 -188
- package/core/variables_dynamic.d.ts +38 -0
- package/core/{variables_dynamic.js → variables_dynamic.ts} +47 -43
- package/core/warning.d.ts +50 -0
- package/core/{warning.js → warning.ts} +52 -66
- package/core/widgetdiv.d.ts +69 -0
- package/core/widgetdiv.ts +257 -0
- package/core/workspace.d.ts +386 -0
- package/core/workspace.ts +801 -0
- package/core/workspace_audio.d.ts +47 -0
- package/core/{workspace_audio.js → workspace_audio.ts} +47 -60
- package/core/workspace_comment.d.ts +170 -0
- package/core/workspace_comment.ts +398 -0
- package/core/workspace_comment_svg.d.ts +329 -0
- package/core/{workspace_comment_svg.js → workspace_comment_svg.ts} +347 -444
- package/core/workspace_drag_surface_svg.d.ts +68 -0
- package/core/{workspace_drag_surface_svg.js → workspace_drag_surface_svg.ts} +75 -82
- package/core/workspace_dragger.d.ts +48 -0
- package/core/workspace_dragger.ts +104 -0
- package/core/workspace_svg.d.ts +920 -0
- package/core/{workspace_svg.js → workspace_svg.ts} +855 -935
- package/core/xml.d.ts +117 -0
- package/core/{xml.js → xml.ts} +306 -326
- package/core/zoom_controls.d.ts +130 -0
- package/core/{zoom_controls.js → zoom_controls.ts} +185 -251
- package/core.d.ts +1 -3
- package/core.js +1 -2
- package/dart.d.ts +0 -3
- package/dart_compressed.js +387 -99
- package/dart_compressed.js.map +1 -1
- package/generators/dart/all.js +2 -0
- package/generators/dart/colour.js +1 -1
- package/generators/dart/lists.js +1 -1
- package/generators/dart/logic.js +1 -1
- package/generators/dart/loops.js +1 -1
- package/generators/dart/math.js +1 -1
- package/generators/dart/procedures.js +1 -1
- package/generators/dart/text.js +1 -1
- package/generators/dart/variables.js +1 -1
- package/generators/dart/variables_dynamic.js +1 -1
- package/generators/dart.js +1 -2
- package/generators/javascript/all.js +2 -0
- package/generators/javascript/colour.js +1 -1
- package/generators/javascript/lists.js +1 -1
- package/generators/javascript/logic.js +1 -1
- package/generators/javascript/loops.js +1 -1
- package/generators/javascript/math.js +4 -4
- package/generators/javascript/procedures.js +1 -1
- package/generators/javascript/text.js +2 -2
- package/generators/javascript/variables.js +1 -1
- package/generators/javascript/variables_dynamic.js +1 -1
- package/generators/javascript.js +1 -3
- package/generators/lua/all.js +2 -0
- package/generators/lua/colour.js +1 -1
- package/generators/lua/lists.js +1 -1
- package/generators/lua/logic.js +1 -1
- package/generators/lua/loops.js +1 -1
- package/generators/lua/math.js +1 -1
- package/generators/lua/procedures.js +1 -1
- package/generators/lua/text.js +1 -1
- package/generators/lua/variables.js +1 -1
- package/generators/lua/variables_dynamic.js +1 -1
- package/generators/lua.js +1 -2
- package/generators/php/all.js +2 -0
- package/generators/php/colour.js +1 -1
- package/generators/php/lists.js +1 -2
- package/generators/php/logic.js +1 -1
- package/generators/php/loops.js +1 -1
- package/generators/php/math.js +1 -1
- package/generators/php/procedures.js +1 -1
- package/generators/php/text.js +1 -1
- package/generators/php/variables.js +1 -1
- package/generators/php/variables_dynamic.js +1 -1
- package/generators/php.js +1 -2
- package/generators/python/all.js +2 -0
- package/generators/python/colour.js +3 -3
- package/generators/python/lists.js +1 -1
- package/generators/python/logic.js +1 -1
- package/generators/python/loops.js +4 -7
- package/generators/python/math.js +1 -1
- package/generators/python/procedures.js +1 -1
- package/generators/python/text.js +1 -1
- package/generators/python/variables.js +1 -1
- package/generators/python/variables_dynamic.js +1 -1
- package/generators/python.js +1 -2
- package/index.d.ts +2 -8
- package/javascript.d.ts +0 -3
- package/javascript_compressed.js +314 -104
- package/javascript_compressed.js.map +1 -1
- package/lua.d.ts +0 -3
- package/lua_compressed.js +399 -81
- package/lua_compressed.js.map +1 -1
- package/package.json +5 -5
- package/php.d.ts +0 -3
- package/php_compressed.js +322 -93
- package/php_compressed.js.map +1 -1
- package/python.d.ts +0 -3
- package/python_compressed.js +237 -90
- package/python_compressed.js.map +1 -1
- package/blockly.d.ts +0 -26127
- package/core/blockly_options.js +0 -28
- package/core/bubble_dragger.js +0 -298
- package/core/clipboard.js +0 -80
- package/core/component_manager.js +0 -263
- package/core/contextmenu_items.js +0 -651
- package/core/contextmenu_registry.js +0 -178
- package/core/delete_area.js +0 -87
- package/core/dialog.js +0 -107
- package/core/drag_target.js +0 -98
- package/core/events/events.js +0 -147
- package/core/events/events_abstract.js +0 -133
- package/core/events/events_block_base.js +0 -70
- package/core/events/events_block_drag.js +0 -89
- package/core/events/events_bubble_open.js +0 -90
- package/core/events/events_comment_base.js +0 -121
- package/core/events/events_marker_move.js +0 -110
- package/core/events/events_selected.js +0 -83
- package/core/events/events_toolbox_item_select.js +0 -84
- package/core/events/events_trashcan_open.js +0 -73
- package/core/events/events_var_base.js +0 -70
- package/core/events/events_viewport.js +0 -107
- package/core/events/workspace_events.js +0 -93
- package/core/field_angle.js +0 -591
- package/core/field_checkbox.js +0 -255
- package/core/field_colour.js +0 -717
- package/core/field_image.js +0 -304
- package/core/field_label.js +0 -149
- package/core/field_label_serializable.js +0 -80
- package/core/field_textinput.js +0 -619
- package/core/flyout_button.js +0 -356
- package/core/grid.js +0 -226
- package/core/icon.js +0 -225
- package/core/input.js +0 -335
- package/core/interfaces/i_ast_node_location_svg.js +0 -45
- package/core/interfaces/i_ast_node_location_with_block.js +0 -41
- package/core/interfaces/i_autohideable.js +0 -40
- package/core/interfaces/i_block_dragger.js +0 -66
- package/core/interfaces/i_bounded_element.js +0 -45
- package/core/interfaces/i_bubble.js +0 -95
- package/core/interfaces/i_collapsible_toolbox_item.js +0 -53
- package/core/interfaces/i_connection_checker.js +0 -104
- package/core/interfaces/i_contextmenu.js +0 -32
- package/core/interfaces/i_copyable.js +0 -49
- package/core/interfaces/i_delete_area.js +0 -50
- package/core/interfaces/i_drag_target.js +0 -88
- package/core/interfaces/i_flyout.js +0 -201
- package/core/interfaces/i_keyboard_accessible.js +0 -38
- package/core/interfaces/i_metrics_manager.js +0 -154
- package/core/interfaces/i_positionable.js +0 -51
- package/core/interfaces/i_selectable.js +0 -51
- package/core/interfaces/i_selectable_toolbox_item.js +0 -73
- package/core/interfaces/i_serializer.js +0 -77
- package/core/interfaces/i_styleable.js +0 -39
- package/core/interfaces/i_toolbox.js +0 -142
- package/core/interfaces/i_toolbox_item.js +0 -85
- package/core/marker_manager.js +0 -213
- package/core/menuitem.js +0 -292
- package/core/names.js +0 -293
- package/core/registry.js +0 -384
- package/core/renderers/common/block_rendering.js +0 -170
- package/core/renderers/common/constants.js +0 -1250
- package/core/renderers/common/i_path_object.js +0 -162
- package/core/renderers/common/marker_svg.js +0 -721
- package/core/renderers/common/path_object.js +0 -283
- package/core/renderers/common/renderer.js +0 -305
- package/core/renderers/geras/constants.js +0 -73
- package/core/renderers/geras/geras.js +0 -36
- package/core/renderers/geras/measurables/inline_input.js +0 -58
- package/core/renderers/geras/measurables/statement_input.js +0 -57
- package/core/renderers/geras/renderer.js +0 -149
- package/core/renderers/measurables/base.js +0 -64
- package/core/renderers/measurables/bottom_row.js +0 -138
- package/core/renderers/measurables/connection.js +0 -56
- package/core/renderers/measurables/external_value_input.js +0 -70
- package/core/renderers/measurables/field.js +0 -71
- package/core/renderers/measurables/in_row_spacer.js +0 -47
- package/core/renderers/measurables/input_connection.js +0 -75
- package/core/renderers/measurables/next_connection.js +0 -50
- package/core/renderers/measurables/output_connection.js +0 -61
- package/core/renderers/measurables/previous_connection.js +0 -50
- package/core/renderers/measurables/round_corner.js +0 -52
- package/core/renderers/measurables/row.js +0 -247
- package/core/renderers/measurables/spacer_row.js +0 -69
- package/core/renderers/measurables/square_corner.js +0 -50
- package/core/renderers/measurables/top_row.js +0 -143
- package/core/renderers/measurables/types.js +0 -353
- package/core/renderers/minimalist/drawer.js +0 -42
- package/core/renderers/minimalist/info.js +0 -54
- package/core/renderers/minimalist/minimalist.js +0 -26
- package/core/renderers/minimalist/renderer.js +0 -80
- package/core/renderers/thrasos/renderer.js +0 -53
- package/core/renderers/thrasos/thrasos.js +0 -22
- package/core/renderers/zelos/marker_svg.js +0 -179
- package/core/renderers/zelos/measurables/bottom_row.js +0 -66
- package/core/renderers/zelos/measurables/row_elements.js +0 -46
- package/core/renderers/zelos/path_object.js +0 -247
- package/core/renderers/zelos/renderer.js +0 -147
- package/core/renderers/zelos/zelos.js +0 -38
- package/core/serialization/exceptions.js +0 -144
- package/core/shortcut_registry.js +0 -366
- package/core/theme/themes.js +0 -23
- package/core/theme.js +0 -228
- package/core/theme_manager.js +0 -211
- package/core/toolbox/category.js +0 -751
- package/core/toolbox/collapsible_category.js +0 -311
- package/core/toolbox/separator.js +0 -133
- package/core/toolbox/toolbox_item.js +0 -173
- package/core/touch.js +0 -285
- package/core/utils/coordinate.js +0 -138
- package/core/utils/global.js +0 -41
- package/core/utils/keycodes.js +0 -172
- package/core/utils/metrics.js +0 -154
- package/core/utils/svg.js +0 -186
- package/core/utils/toolbox.js +0 -459
- package/core/utils/useragent.js +0 -197
- package/core/utils.js +0 -383
- package/core/variable_model.js +0 -96
- package/core/widgetdiv.js +0 -290
- package/core/workspace.js +0 -836
- package/core/workspace_comment.js +0 -400
- package/core/workspace_dragger.js +0 -115
|
@@ -7,99 +7,159 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* @fileoverview Methods for graphically rendering a block as SVG.
|
|
9
9
|
*/
|
|
10
|
-
'use strict';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Methods for graphically rendering a block as SVG.
|
|
14
13
|
* @class
|
|
15
14
|
*/
|
|
16
|
-
goog
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const Tooltip = goog.require('Blockly.Tooltip');
|
|
20
|
-
const blockAnimations = goog.require('Blockly.blockAnimations');
|
|
21
|
-
const blocks = goog.require('Blockly.serialization.blocks');
|
|
22
|
-
const browserEvents = goog.require('Blockly.browserEvents');
|
|
23
|
-
const common = goog.require('Blockly.common');
|
|
24
|
-
const constants = goog.require('Blockly.constants');
|
|
25
|
-
const dom = goog.require('Blockly.utils.dom');
|
|
26
|
-
const eventUtils = goog.require('Blockly.Events.utils');
|
|
27
|
-
const internalConstants = goog.require('Blockly.internalConstants');
|
|
28
|
-
const svgMath = goog.require('Blockly.utils.svgMath');
|
|
29
|
-
const userAgent = goog.require('Blockly.utils.userAgent');
|
|
30
|
-
const {ASTNode} = goog.require('Blockly.ASTNode');
|
|
31
|
-
const {Block} = goog.require('Blockly.Block');
|
|
32
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
33
|
-
const {BlockMove} = goog.requireType('Blockly.Events.BlockMove');
|
|
34
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
35
|
-
const {Comment} = goog.requireType('Blockly.Comment');
|
|
36
|
-
const {config} = goog.require('Blockly.config');
|
|
37
|
-
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
|
38
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
39
|
-
const {Connection} = goog.requireType('Blockly.Connection');
|
|
40
|
-
const {ContextMenuRegistry} = goog.require('Blockly.ContextMenuRegistry');
|
|
41
|
-
const {Coordinate} = goog.require('Blockly.utils.Coordinate');
|
|
42
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
43
|
-
const {Debug: BlockRenderingDebug} = goog.requireType('Blockly.blockRendering.Debug');
|
|
44
|
-
const {FieldLabel} = goog.require('Blockly.FieldLabel');
|
|
45
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
46
|
-
const {Field} = goog.requireType('Blockly.Field');
|
|
47
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
48
|
-
const {IASTNodeLocationSvg} = goog.require('Blockly.IASTNodeLocationSvg');
|
|
49
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
50
|
-
const {IBoundedElement} = goog.require('Blockly.IBoundedElement');
|
|
51
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
52
|
-
const {ICopyable} = goog.require('Blockly.ICopyable');
|
|
53
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
54
|
-
const {IDraggable} = goog.require('Blockly.IDraggable');
|
|
55
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
56
|
-
const {IPathObject} = goog.requireType('Blockly.blockRendering.IPathObject');
|
|
57
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
58
|
-
const {Icon} = goog.requireType('Blockly.Icon');
|
|
59
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
60
|
-
const {Input} = goog.requireType('Blockly.Input');
|
|
61
|
-
const {MarkerManager} = goog.require('Blockly.MarkerManager');
|
|
62
|
-
const {Msg} = goog.require('Blockly.Msg');
|
|
63
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
64
|
-
const {Mutator} = goog.requireType('Blockly.Mutator');
|
|
65
|
-
const {Rect} = goog.require('Blockly.utils.Rect');
|
|
66
|
-
const {RenderedConnection} = goog.require('Blockly.RenderedConnection');
|
|
67
|
-
const {Svg} = goog.require('Blockly.utils.Svg');
|
|
68
|
-
const {TabNavigateCursor} = goog.require('Blockly.TabNavigateCursor');
|
|
69
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
70
|
-
const {Theme} = goog.requireType('Blockly.Theme');
|
|
71
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
72
|
-
const {Warning} = goog.requireType('Blockly.Warning');
|
|
15
|
+
import * as goog from '../closure/goog/goog.js';
|
|
16
|
+
goog.declareModuleId('Blockly.BlockSvg');
|
|
17
|
+
|
|
73
18
|
/* eslint-disable-next-line no-unused-vars */
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
19
|
+
// Unused import preserved for side-effects. Remove if unneeded.
|
|
20
|
+
// import './theme.js';
|
|
21
|
+
// Unused import preserved for side-effects. Remove if unneeded.
|
|
22
|
+
import './events/events_selected.js';
|
|
23
|
+
// Unused import preserved for side-effects. Remove if unneeded.
|
|
24
|
+
// import './touch.js';
|
|
25
|
+
|
|
26
|
+
import {Block} from './block.js';
|
|
27
|
+
import * as blockAnimations from './block_animations.js';
|
|
28
|
+
import * as browserEvents from './browser_events.js';
|
|
29
|
+
import {Comment} from './comment.js';
|
|
30
|
+
import * as common from './common.js';
|
|
31
|
+
import {config} from './config.js';
|
|
32
|
+
import type {Connection} from './connection.js';
|
|
33
|
+
import {ConnectionType} from './connection_type.js';
|
|
34
|
+
import * as constants from './constants.js';
|
|
35
|
+
import * as ContextMenu from './contextmenu.js';
|
|
36
|
+
import {ContextMenuOption, ContextMenuRegistry, LegacyContextMenuOption} from './contextmenu_registry.js';
|
|
37
|
+
import type {BlockMove} from './events/events_block_move.js';
|
|
38
|
+
import * as eventUtils from './events/utils.js';
|
|
39
|
+
import type {Field} from './field.js';
|
|
40
|
+
import {FieldLabel} from './field_label.js';
|
|
41
|
+
import type {Icon} from './icon.js';
|
|
42
|
+
import type {Input} from './input.js';
|
|
43
|
+
import type {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';
|
|
44
|
+
import type {IBoundedElement} from './interfaces/i_bounded_element.js';
|
|
45
|
+
import type {CopyData, ICopyable} from './interfaces/i_copyable.js';
|
|
46
|
+
import type {IDraggable} from './interfaces/i_draggable.js';
|
|
47
|
+
import * as internalConstants from './internal_constants.js';
|
|
48
|
+
import {ASTNode} from './keyboard_nav/ast_node.js';
|
|
49
|
+
import {TabNavigateCursor} from './keyboard_nav/tab_navigate_cursor.js';
|
|
50
|
+
import {MarkerManager} from './marker_manager.js';
|
|
51
|
+
import {Msg} from './msg.js';
|
|
52
|
+
import type {Mutator} from './mutator.js';
|
|
53
|
+
import {RenderedConnection} from './rendered_connection.js';
|
|
54
|
+
import type {Debug as BlockRenderingDebug} from './renderers/common/debugger.js';
|
|
55
|
+
import type {IPathObject} from './renderers/common/i_path_object.js';
|
|
56
|
+
import * as blocks from './serialization/blocks.js';
|
|
57
|
+
import type {BlockStyle} from './theme.js';
|
|
58
|
+
import * as Tooltip from './tooltip.js';
|
|
59
|
+
import {Coordinate} from './utils/coordinate.js';
|
|
60
|
+
import * as dom from './utils/dom.js';
|
|
61
|
+
import {Rect} from './utils/rect.js';
|
|
62
|
+
import {Svg} from './utils/svg.js';
|
|
63
|
+
import * as svgMath from './utils/svg_math.js';
|
|
64
|
+
import {Warning} from './warning.js';
|
|
65
|
+
import type {Workspace} from './workspace.js';
|
|
66
|
+
import type {WorkspaceSvg} from './workspace_svg.js';
|
|
81
67
|
|
|
82
68
|
|
|
83
69
|
/**
|
|
84
70
|
* Class for a block's SVG representation.
|
|
85
71
|
* Not normally called directly, workspace.newBlock() is preferred.
|
|
86
|
-
* @extends {Block}
|
|
87
|
-
* @implements {IASTNodeLocationSvg}
|
|
88
|
-
* @implements {IBoundedElement}
|
|
89
|
-
* @implements {ICopyable}
|
|
90
|
-
* @implements {IDraggable}
|
|
91
72
|
* @alias Blockly.BlockSvg
|
|
92
73
|
*/
|
|
93
|
-
class BlockSvg extends Block
|
|
74
|
+
export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
|
75
|
+
IBoundedElement, ICopyable,
|
|
76
|
+
IDraggable {
|
|
94
77
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* type-specific functions for this block.
|
|
98
|
-
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
|
|
99
|
-
* create a new ID.
|
|
78
|
+
* Constant for identifying rows that are to be rendered inline.
|
|
79
|
+
* Don't collide with Blockly.inputTypes.
|
|
100
80
|
*/
|
|
101
|
-
|
|
81
|
+
static readonly INLINE = -1;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* ID to give the "collapsed warnings" warning. Allows us to remove the
|
|
85
|
+
* "collapsed warnings" warning without removing any warnings that belong to
|
|
86
|
+
* the block.
|
|
87
|
+
*/
|
|
88
|
+
static readonly COLLAPSED_WARNING_ID = 'TEMP_COLLAPSED_WARNING_';
|
|
89
|
+
override decompose?: ((p1: Workspace) => BlockSvg);
|
|
90
|
+
// override compose?: ((p1: BlockSvg) => void)|null;
|
|
91
|
+
saveConnections?: ((p1: BlockSvg) => AnyDuringMigration);
|
|
92
|
+
customContextMenu?:
|
|
93
|
+
((p1: Array<ContextMenuOption|LegacyContextMenuOption>) =>
|
|
94
|
+
AnyDuringMigration)|null;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* An property used internally to reference the block's rendering debugger.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
renderingDebugger: BlockRenderingDebug|null = null;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Height of this block, not including any statement blocks above or below.
|
|
104
|
+
* Height is in workspace units.
|
|
105
|
+
*/
|
|
106
|
+
height = 0;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Width of this block, including any connected value blocks.
|
|
110
|
+
* Width is in workspace units.
|
|
111
|
+
*/
|
|
112
|
+
width = 0;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Map from IDs for warnings text to PIDs of functions to apply them.
|
|
116
|
+
* Used to be able to maintain multiple warnings.
|
|
117
|
+
*/
|
|
118
|
+
private warningTextDb = new Map<string, ReturnType<typeof setTimeout>>();
|
|
119
|
+
|
|
120
|
+
/** Block's mutator icon (if any). */
|
|
121
|
+
mutator: Mutator|null = null;
|
|
122
|
+
|
|
123
|
+
/** Block's comment icon (if any). */
|
|
124
|
+
private commentIcon_: Comment|null = null;
|
|
125
|
+
|
|
126
|
+
/** Block's warning icon (if any). */
|
|
127
|
+
warning: Warning|null = null;
|
|
128
|
+
|
|
129
|
+
private svgGroup_: SVGGElement;
|
|
130
|
+
style: BlockStyle;
|
|
131
|
+
/** @internal */
|
|
132
|
+
pathObject: IPathObject;
|
|
133
|
+
override rendered = false;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Is this block currently rendering? Used to stop recursive render calls
|
|
137
|
+
* from actually triggering a re-render.
|
|
138
|
+
*/
|
|
139
|
+
private renderIsInProgress_ = false;
|
|
140
|
+
|
|
141
|
+
/** Whether mousedown events have been bound yet. */
|
|
142
|
+
private eventsInit_ = false;
|
|
143
|
+
|
|
144
|
+
override workspace: WorkspaceSvg;
|
|
145
|
+
// TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
|
|
146
|
+
override outputConnection!: RenderedConnection;
|
|
147
|
+
// TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
|
|
148
|
+
override nextConnection!: RenderedConnection;
|
|
149
|
+
// TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
|
|
150
|
+
override previousConnection!: RenderedConnection;
|
|
151
|
+
private readonly useDragSurface_: boolean;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @param workspace The block's workspace.
|
|
155
|
+
* @param prototypeName Name of the language object containing type-specific
|
|
156
|
+
* functions for this block.
|
|
157
|
+
* @param opt_id Optional ID. Use this ID if provided, otherwise create a new
|
|
158
|
+
* ID.
|
|
159
|
+
*/
|
|
160
|
+
constructor(workspace: WorkspaceSvg, prototypeName: string, opt_id?: string) {
|
|
102
161
|
super(workspace, prototypeName, opt_id);
|
|
162
|
+
this.workspace = workspace;
|
|
103
163
|
|
|
104
164
|
/**
|
|
105
165
|
* An optional method called when a mutator dialog is first opened.
|
|
@@ -108,7 +168,6 @@ class BlockSvg extends Block {
|
|
|
108
168
|
* top-level block with any sub-blocks which are appropriate. This method
|
|
109
169
|
* must also be coupled with defining a `compose` method for the default
|
|
110
170
|
* mutation dialog button and UI to appear.
|
|
111
|
-
* @type {undefined|?function(WorkspaceSvg):!BlockSvg}
|
|
112
171
|
*/
|
|
113
172
|
this.decompose = this.decompose;
|
|
114
173
|
|
|
@@ -117,7 +176,6 @@ class BlockSvg extends Block {
|
|
|
117
176
|
* This function is called to modify the original block according to new
|
|
118
177
|
* settings. This method must also be coupled with defining a `decompose`
|
|
119
178
|
* method for the default mutation dialog button and UI to appear.
|
|
120
|
-
* @type {undefined|?function(!BlockSvg)}
|
|
121
179
|
*/
|
|
122
180
|
this.compose = this.compose;
|
|
123
181
|
|
|
@@ -125,140 +183,34 @@ class BlockSvg extends Block {
|
|
|
125
183
|
* An optional method called by the default mutator UI which gives the block
|
|
126
184
|
* a chance to save information about what child blocks are connected to
|
|
127
185
|
* what mutated connections.
|
|
128
|
-
* @type {undefined|?function(!BlockSvg)}
|
|
129
186
|
*/
|
|
130
187
|
this.saveConnections = this.saveConnections;
|
|
131
188
|
|
|
132
|
-
/**
|
|
133
|
-
* An optional method for defining custom block context menu items.
|
|
134
|
-
* @type {undefined|?function(!Array<!Object>)}
|
|
135
|
-
*/
|
|
189
|
+
/** An optional method for defining custom block context menu items. */
|
|
136
190
|
this.customContextMenu = this.customContextMenu;
|
|
191
|
+
this.svgGroup_ = dom.createSvgElement(Svg.G, {});
|
|
192
|
+
(this.svgGroup_ as AnyDuringMigration).translate_ = '';
|
|
137
193
|
|
|
138
|
-
/**
|
|
139
|
-
* An property used internally to reference the block's rendering debugger.
|
|
140
|
-
* @type {?BlockRenderingDebug}
|
|
141
|
-
* @package
|
|
142
|
-
*/
|
|
143
|
-
this.renderingDebugger = null;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Height of this block, not including any statement blocks above or below.
|
|
147
|
-
* Height is in workspace units.
|
|
148
|
-
* @type {number}
|
|
149
|
-
*/
|
|
150
|
-
this.height = 0;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Width of this block, including any connected value blocks.
|
|
154
|
-
* Width is in workspace units.
|
|
155
|
-
* @type {number}
|
|
156
|
-
*/
|
|
157
|
-
this.width = 0;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Map from IDs for warnings text to PIDs of functions to apply them.
|
|
161
|
-
* Used to be able to maintain multiple warnings.
|
|
162
|
-
* @type {Object<string, number>}
|
|
163
|
-
* @private
|
|
164
|
-
*/
|
|
165
|
-
this.warningTextDb_ = null;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Block's mutator icon (if any).
|
|
169
|
-
* @type {?Mutator}
|
|
170
|
-
*/
|
|
171
|
-
this.mutator = null;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Block's comment icon (if any).
|
|
175
|
-
* @type {?Comment}
|
|
176
|
-
* @deprecated August 2019. Use getCommentIcon instead.
|
|
177
|
-
*/
|
|
178
|
-
this.comment = null;
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Block's comment icon (if any).
|
|
182
|
-
* @type {?Comment}
|
|
183
|
-
* @private
|
|
184
|
-
*/
|
|
185
|
-
this.commentIcon_ = null;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Block's warning icon (if any).
|
|
189
|
-
* @type {?Warning}
|
|
190
|
-
*/
|
|
191
|
-
this.warning = null;
|
|
192
|
-
|
|
193
|
-
// Create core elements for the block.
|
|
194
|
-
/**
|
|
195
|
-
* @type {!SVGGElement}
|
|
196
|
-
* @private
|
|
197
|
-
*/
|
|
198
|
-
this.svgGroup_ = dom.createSvgElement(Svg.G, {}, null);
|
|
199
|
-
this.svgGroup_.translate_ = '';
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* A block style object.
|
|
203
|
-
* @type {!Theme.BlockStyle}
|
|
204
|
-
*/
|
|
194
|
+
/** A block style object. */
|
|
205
195
|
this.style = workspace.getRenderer().getConstants().getBlockStyle(null);
|
|
206
196
|
|
|
207
|
-
/**
|
|
208
|
-
* The renderer's path object.
|
|
209
|
-
* @type {IPathObject}
|
|
210
|
-
* @package
|
|
211
|
-
*/
|
|
197
|
+
/** The renderer's path object. */
|
|
212
198
|
this.pathObject =
|
|
213
199
|
workspace.getRenderer().makePathObject(this.svgGroup_, this.style);
|
|
214
200
|
|
|
215
|
-
/** @type {boolean} */
|
|
216
|
-
this.rendered = false;
|
|
217
|
-
/**
|
|
218
|
-
* Is this block currently rendering? Used to stop recursive render calls
|
|
219
|
-
* from actually triggering a re-render.
|
|
220
|
-
* @type {boolean}
|
|
221
|
-
* @private
|
|
222
|
-
*/
|
|
223
|
-
this.renderIsInProgress_ = false;
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Whether mousedown events have been bound yet.
|
|
227
|
-
* @type {boolean}
|
|
228
|
-
* @private
|
|
229
|
-
*/
|
|
230
|
-
this.eventsInit_ = false;
|
|
231
|
-
|
|
232
|
-
/** @type {!WorkspaceSvg} */
|
|
233
|
-
this.workspace;
|
|
234
|
-
/** @type {RenderedConnection} */
|
|
235
|
-
this.outputConnection;
|
|
236
|
-
/** @type {RenderedConnection} */
|
|
237
|
-
this.nextConnection;
|
|
238
|
-
/** @type {RenderedConnection} */
|
|
239
|
-
this.previousConnection;
|
|
240
|
-
|
|
241
201
|
/**
|
|
242
202
|
* Whether to move the block to the drag surface when it is dragged.
|
|
243
203
|
* True if it should move, false if it should be translated directly.
|
|
244
|
-
* @type {boolean}
|
|
245
|
-
* @private
|
|
246
204
|
*/
|
|
247
205
|
this.useDragSurface_ =
|
|
248
206
|
svgMath.is3dSupported() && !!workspace.getBlockDragSurface();
|
|
249
207
|
|
|
250
208
|
const svgPath = this.pathObject.svgPath;
|
|
251
|
-
svgPath.tooltip = this;
|
|
209
|
+
(svgPath as AnyDuringMigration).tooltip = this;
|
|
252
210
|
Tooltip.bindMouseEvents(svgPath);
|
|
253
211
|
|
|
254
212
|
// Expose this block's ID on its top-level SVG group.
|
|
255
|
-
|
|
256
|
-
this.svgGroup_.dataset['id'] = this.id;
|
|
257
|
-
} else if (userAgent.IE) {
|
|
258
|
-
// SVGElement.dataset is not available on IE11, but data-* properties
|
|
259
|
-
// can be set with setAttribute().
|
|
260
|
-
this.svgGroup_.setAttribute('data-id', this.id);
|
|
261
|
-
}
|
|
213
|
+
this.svgGroup_.setAttribute('data-id', this.id);
|
|
262
214
|
|
|
263
215
|
this.doInit_();
|
|
264
216
|
}
|
|
@@ -271,7 +223,7 @@ class BlockSvg extends Block {
|
|
|
271
223
|
if (!this.workspace.rendered) {
|
|
272
224
|
throw TypeError('Workspace is headless.');
|
|
273
225
|
}
|
|
274
|
-
for (let i = 0, input;
|
|
226
|
+
for (let i = 0, input; input = this.inputList[i]; i++) {
|
|
275
227
|
input.init();
|
|
276
228
|
}
|
|
277
229
|
const icons = this.getIcons();
|
|
@@ -293,17 +245,17 @@ class BlockSvg extends Block {
|
|
|
293
245
|
|
|
294
246
|
/**
|
|
295
247
|
* Get the secondary colour of a block.
|
|
296
|
-
* @return
|
|
248
|
+
* @return #RRGGBB string.
|
|
297
249
|
*/
|
|
298
|
-
getColourSecondary() {
|
|
250
|
+
getColourSecondary(): string|null {
|
|
299
251
|
return this.style.colourSecondary;
|
|
300
252
|
}
|
|
301
253
|
|
|
302
254
|
/**
|
|
303
255
|
* Get the tertiary colour of a block.
|
|
304
|
-
* @return
|
|
256
|
+
* @return #RRGGBB string.
|
|
305
257
|
*/
|
|
306
|
-
getColourTertiary() {
|
|
258
|
+
getColourTertiary(): string|null {
|
|
307
259
|
return this.style.colourTertiary;
|
|
308
260
|
}
|
|
309
261
|
|
|
@@ -314,7 +266,7 @@ class BlockSvg extends Block {
|
|
|
314
266
|
select() {
|
|
315
267
|
if (this.isShadow() && this.getParent()) {
|
|
316
268
|
// Shadow blocks should not be selected.
|
|
317
|
-
this.getParent()
|
|
269
|
+
this.getParent()!.select();
|
|
318
270
|
return;
|
|
319
271
|
}
|
|
320
272
|
if (common.getSelected() === this) {
|
|
@@ -322,17 +274,17 @@ class BlockSvg extends Block {
|
|
|
322
274
|
}
|
|
323
275
|
let oldId = null;
|
|
324
276
|
if (common.getSelected()) {
|
|
325
|
-
oldId = common.getSelected()
|
|
277
|
+
oldId = common.getSelected()!.id;
|
|
326
278
|
// Unselect any previously selected block.
|
|
327
279
|
eventUtils.disable();
|
|
328
280
|
try {
|
|
329
|
-
common.getSelected()
|
|
281
|
+
common.getSelected()!.unselect();
|
|
330
282
|
} finally {
|
|
331
283
|
eventUtils.enable();
|
|
332
284
|
}
|
|
333
285
|
}
|
|
334
|
-
const event = new (eventUtils.get(eventUtils.SELECTED))
|
|
335
|
-
oldId, this.id, this.workspace.id);
|
|
286
|
+
const event = new (eventUtils.get(eventUtils.SELECTED))!
|
|
287
|
+
(oldId, this.id, this.workspace.id);
|
|
336
288
|
eventUtils.fire(event);
|
|
337
289
|
common.setSelected(this);
|
|
338
290
|
this.addSelect();
|
|
@@ -346,8 +298,8 @@ class BlockSvg extends Block {
|
|
|
346
298
|
if (common.getSelected() !== this) {
|
|
347
299
|
return;
|
|
348
300
|
}
|
|
349
|
-
const event = new (eventUtils.get(eventUtils.SELECTED))
|
|
350
|
-
this.id, null, this.workspace.id);
|
|
301
|
+
const event = new (eventUtils.get(eventUtils.SELECTED))!
|
|
302
|
+
(this.id, null, this.workspace.id);
|
|
351
303
|
event.workspaceId = this.workspace.id;
|
|
352
304
|
eventUtils.fire(event);
|
|
353
305
|
common.setSelected(null);
|
|
@@ -356,9 +308,9 @@ class BlockSvg extends Block {
|
|
|
356
308
|
|
|
357
309
|
/**
|
|
358
310
|
* Returns a list of mutator, comment, and warning icons.
|
|
359
|
-
* @return
|
|
311
|
+
* @return List of icons.
|
|
360
312
|
*/
|
|
361
|
-
getIcons() {
|
|
313
|
+
getIcons(): Icon[] {
|
|
362
314
|
const icons = [];
|
|
363
315
|
if (this.mutator) {
|
|
364
316
|
icons.push(this.mutator);
|
|
@@ -374,18 +326,19 @@ class BlockSvg extends Block {
|
|
|
374
326
|
|
|
375
327
|
/**
|
|
376
328
|
* Sets the parent of this block to be a new block or null.
|
|
377
|
-
* @param
|
|
378
|
-
* @
|
|
379
|
-
* @override
|
|
329
|
+
* @param newParent New parent block.
|
|
330
|
+
* @internal
|
|
380
331
|
*/
|
|
381
|
-
setParent(newParent) {
|
|
332
|
+
override setParent(newParent: this|null) {
|
|
382
333
|
const oldParent = this.parentBlock_;
|
|
383
334
|
if (newParent === oldParent) {
|
|
384
335
|
return;
|
|
385
336
|
}
|
|
386
337
|
|
|
387
338
|
dom.startTextWidthCache();
|
|
388
|
-
|
|
339
|
+
// AnyDuringMigration because: Argument of type 'Block | null' is not
|
|
340
|
+
// assignable to parameter of type 'Block'.
|
|
341
|
+
super.setParent(newParent as AnyDuringMigration);
|
|
389
342
|
dom.stopTextWidthCache();
|
|
390
343
|
|
|
391
344
|
const svgRoot = this.getSvgRoot();
|
|
@@ -398,7 +351,7 @@ class BlockSvg extends Block {
|
|
|
398
351
|
|
|
399
352
|
const oldXY = this.getRelativeToSurfaceXY();
|
|
400
353
|
if (newParent) {
|
|
401
|
-
(
|
|
354
|
+
(newParent as BlockSvg).getSvgRoot().appendChild(svgRoot);
|
|
402
355
|
const newXY = this.getRelativeToSurfaceXY();
|
|
403
356
|
// Move the connections to match the child's new position.
|
|
404
357
|
this.moveConnections(newXY.x - oldXY.x, newXY.y - oldXY.y);
|
|
@@ -418,18 +371,17 @@ class BlockSvg extends Block {
|
|
|
418
371
|
* If the block is on the workspace, (0, 0) is the origin of the workspace
|
|
419
372
|
* coordinate system.
|
|
420
373
|
* This does not change with workspace scale.
|
|
421
|
-
* @return
|
|
422
|
-
* workspace coordinates.
|
|
374
|
+
* @return Object with .x and .y properties in workspace coordinates.
|
|
423
375
|
*/
|
|
424
|
-
getRelativeToSurfaceXY() {
|
|
376
|
+
override getRelativeToSurfaceXY(): Coordinate {
|
|
425
377
|
let x = 0;
|
|
426
378
|
let y = 0;
|
|
427
379
|
|
|
428
380
|
const dragSurfaceGroup = this.useDragSurface_ ?
|
|
429
|
-
this.workspace.getBlockDragSurface()
|
|
381
|
+
this.workspace.getBlockDragSurface()!.getGroup() :
|
|
430
382
|
null;
|
|
431
383
|
|
|
432
|
-
let element = this.getSvgRoot();
|
|
384
|
+
let element: SVGElement = this.getSvgRoot();
|
|
433
385
|
if (element) {
|
|
434
386
|
do {
|
|
435
387
|
// Loop through this block and every parent.
|
|
@@ -439,14 +391,14 @@ class BlockSvg extends Block {
|
|
|
439
391
|
// If this element is the current element on the drag surface, include
|
|
440
392
|
// the translation of the drag surface itself.
|
|
441
393
|
if (this.useDragSurface_ &&
|
|
442
|
-
this.workspace.getBlockDragSurface()
|
|
394
|
+
this.workspace.getBlockDragSurface()!.getCurrentBlock() ===
|
|
443
395
|
element) {
|
|
444
396
|
const surfaceTranslation =
|
|
445
|
-
this.workspace.getBlockDragSurface()
|
|
397
|
+
this.workspace.getBlockDragSurface()!.getSurfaceTranslation();
|
|
446
398
|
x += surfaceTranslation.x;
|
|
447
399
|
y += surfaceTranslation.y;
|
|
448
400
|
}
|
|
449
|
-
element =
|
|
401
|
+
element = element.parentNode as SVGElement;
|
|
450
402
|
} while (element && element !== this.workspace.getCanvas() &&
|
|
451
403
|
element !== dragSurfaceGroup);
|
|
452
404
|
}
|
|
@@ -455,24 +407,23 @@ class BlockSvg extends Block {
|
|
|
455
407
|
|
|
456
408
|
/**
|
|
457
409
|
* Move a block by a relative offset.
|
|
458
|
-
* @param
|
|
459
|
-
* @param
|
|
410
|
+
* @param dx Horizontal offset in workspace units.
|
|
411
|
+
* @param dy Vertical offset in workspace units.
|
|
460
412
|
*/
|
|
461
|
-
moveBy(dx, dy) {
|
|
413
|
+
override moveBy(dx: number, dy: number) {
|
|
462
414
|
if (this.parentBlock_) {
|
|
463
415
|
throw Error('Block has parent.');
|
|
464
416
|
}
|
|
465
417
|
const eventsEnabled = eventUtils.isEnabled();
|
|
466
|
-
let event;
|
|
418
|
+
let event: BlockMove|null = null;
|
|
467
419
|
if (eventsEnabled) {
|
|
468
|
-
event =
|
|
469
|
-
(new (eventUtils.get(eventUtils.BLOCK_MOVE))(this));
|
|
420
|
+
event = new (eventUtils.get(eventUtils.BLOCK_MOVE))!(this) as BlockMove;
|
|
470
421
|
}
|
|
471
422
|
const xy = this.getRelativeToSurfaceXY();
|
|
472
423
|
this.translate(xy.x + dx, xy.y + dy);
|
|
473
424
|
this.moveConnections(dx, dy);
|
|
474
|
-
if (eventsEnabled) {
|
|
475
|
-
event
|
|
425
|
+
if (eventsEnabled && event) {
|
|
426
|
+
event!.recordNew();
|
|
476
427
|
eventUtils.fire(event);
|
|
477
428
|
}
|
|
478
429
|
this.workspace.resizeContents();
|
|
@@ -481,10 +432,10 @@ class BlockSvg extends Block {
|
|
|
481
432
|
/**
|
|
482
433
|
* Transforms a block by setting the translation on the transform attribute
|
|
483
434
|
* of the block's SVG.
|
|
484
|
-
* @param
|
|
485
|
-
* @param
|
|
435
|
+
* @param x The x coordinate of the translation in workspace units.
|
|
436
|
+
* @param y The y coordinate of the translation in workspace units.
|
|
486
437
|
*/
|
|
487
|
-
translate(x, y) {
|
|
438
|
+
translate(x: number, y: number) {
|
|
488
439
|
this.getSvgRoot().setAttribute(
|
|
489
440
|
'transform', 'translate(' + x + ',' + y + ')');
|
|
490
441
|
}
|
|
@@ -493,7 +444,7 @@ class BlockSvg extends Block {
|
|
|
493
444
|
* Move this block to its workspace's drag surface, accounting for
|
|
494
445
|
* positioning. Generally should be called at the same time as
|
|
495
446
|
* setDragging_(true). Does nothing if useDragSurface_ is false.
|
|
496
|
-
* @
|
|
447
|
+
* @internal
|
|
497
448
|
*/
|
|
498
449
|
moveToDragSurface() {
|
|
499
450
|
if (!this.useDragSurface_) {
|
|
@@ -505,19 +456,19 @@ class BlockSvg extends Block {
|
|
|
505
456
|
// This is in workspace coordinates.
|
|
506
457
|
const xy = this.getRelativeToSurfaceXY();
|
|
507
458
|
this.clearTransformAttributes_();
|
|
508
|
-
this.workspace.getBlockDragSurface()
|
|
459
|
+
this.workspace.getBlockDragSurface()!.translateSurface(xy.x, xy.y);
|
|
509
460
|
// Execute the move on the top-level SVG component
|
|
510
461
|
const svg = this.getSvgRoot();
|
|
511
462
|
if (svg) {
|
|
512
|
-
this.workspace.getBlockDragSurface()
|
|
463
|
+
this.workspace.getBlockDragSurface()!.setBlocksAndShow(svg);
|
|
513
464
|
}
|
|
514
465
|
}
|
|
515
466
|
|
|
516
467
|
/**
|
|
517
468
|
* Move a block to a position.
|
|
518
|
-
* @param
|
|
469
|
+
* @param xy The position to move to in workspace units.
|
|
519
470
|
*/
|
|
520
|
-
moveTo(xy) {
|
|
471
|
+
moveTo(xy: Coordinate) {
|
|
521
472
|
const curXY = this.getRelativeToSurfaceXY();
|
|
522
473
|
this.moveBy(xy.x - curXY.x, xy.y - curXY.y);
|
|
523
474
|
}
|
|
@@ -526,17 +477,17 @@ class BlockSvg extends Block {
|
|
|
526
477
|
* Move this block back to the workspace block canvas.
|
|
527
478
|
* Generally should be called at the same time as setDragging_(false).
|
|
528
479
|
* Does nothing if useDragSurface_ is false.
|
|
529
|
-
* @param
|
|
530
|
-
*
|
|
531
|
-
* @
|
|
480
|
+
* @param newXY The position the block should take on on the workspace canvas,
|
|
481
|
+
* in workspace coordinates.
|
|
482
|
+
* @internal
|
|
532
483
|
*/
|
|
533
|
-
moveOffDragSurface(newXY) {
|
|
484
|
+
moveOffDragSurface(newXY: Coordinate) {
|
|
534
485
|
if (!this.useDragSurface_) {
|
|
535
486
|
return;
|
|
536
487
|
}
|
|
537
488
|
// Translate to current position, turning off 3d.
|
|
538
489
|
this.translate(newXY.x, newXY.y);
|
|
539
|
-
this.workspace.getBlockDragSurface()
|
|
490
|
+
this.workspace.getBlockDragSurface()!.clearAndHide(
|
|
540
491
|
this.workspace.getCanvas());
|
|
541
492
|
}
|
|
542
493
|
|
|
@@ -544,40 +495,41 @@ class BlockSvg extends Block {
|
|
|
544
495
|
* Move this block during a drag, taking into account whether we are using a
|
|
545
496
|
* drag surface to translate blocks.
|
|
546
497
|
* This block must be a top-level block.
|
|
547
|
-
* @param
|
|
548
|
-
*
|
|
549
|
-
* @package
|
|
498
|
+
* @param newLoc The location to translate to, in workspace coordinates.
|
|
499
|
+
* @internal
|
|
550
500
|
*/
|
|
551
|
-
moveDuringDrag(newLoc) {
|
|
501
|
+
moveDuringDrag(newLoc: Coordinate) {
|
|
552
502
|
if (this.useDragSurface_) {
|
|
553
|
-
this.workspace.getBlockDragSurface()
|
|
503
|
+
this.workspace.getBlockDragSurface()!.translateSurface(
|
|
504
|
+
newLoc.x, newLoc.y);
|
|
554
505
|
} else {
|
|
555
|
-
this.svgGroup_.translate_ =
|
|
506
|
+
(this.svgGroup_ as AnyDuringMigration).translate_ =
|
|
556
507
|
'translate(' + newLoc.x + ',' + newLoc.y + ')';
|
|
557
|
-
this.svgGroup_
|
|
558
|
-
|
|
508
|
+
(this.svgGroup_ as AnyDuringMigration)
|
|
509
|
+
.setAttribute(
|
|
510
|
+
'transform',
|
|
511
|
+
(this.svgGroup_ as AnyDuringMigration).translate_ +
|
|
512
|
+
(this.svgGroup_ as AnyDuringMigration).skew_);
|
|
559
513
|
}
|
|
560
514
|
}
|
|
561
515
|
|
|
562
516
|
/**
|
|
563
517
|
* Clear the block of transform="..." attributes.
|
|
564
518
|
* Used when the block is switching from 3d to 2d transform or vice versa.
|
|
565
|
-
* @private
|
|
566
519
|
*/
|
|
567
|
-
clearTransformAttributes_() {
|
|
520
|
+
private clearTransformAttributes_() {
|
|
568
521
|
this.getSvgRoot().removeAttribute('transform');
|
|
569
522
|
}
|
|
570
523
|
|
|
571
|
-
/**
|
|
572
|
-
* Snap this block to the nearest grid point.
|
|
573
|
-
*/
|
|
524
|
+
/** Snap this block to the nearest grid point. */
|
|
574
525
|
snapToGrid() {
|
|
575
|
-
if (
|
|
526
|
+
if (this.disposed) {
|
|
576
527
|
return; // Deleted block.
|
|
577
528
|
}
|
|
578
529
|
if (this.workspace.isDragging()) {
|
|
579
|
-
return
|
|
530
|
+
return // Don't bump blocks during a drag.;
|
|
580
531
|
}
|
|
532
|
+
|
|
581
533
|
if (this.getParent()) {
|
|
582
534
|
return; // Only snap top-level blocks.
|
|
583
535
|
}
|
|
@@ -604,9 +556,9 @@ class BlockSvg extends Block {
|
|
|
604
556
|
* Returns the coordinates of a bounding box describing the dimensions of this
|
|
605
557
|
* block and any blocks stacked below it.
|
|
606
558
|
* Coordinate system: workspace coordinates.
|
|
607
|
-
* @return
|
|
559
|
+
* @return Object with coordinates of the bounding box.
|
|
608
560
|
*/
|
|
609
|
-
getBoundingRectangle() {
|
|
561
|
+
getBoundingRectangle(): Rect {
|
|
610
562
|
const blockXY = this.getRelativeToSurfaceXY();
|
|
611
563
|
const blockBounds = this.getHeightWidth();
|
|
612
564
|
let left;
|
|
@@ -626,19 +578,17 @@ class BlockSvg extends Block {
|
|
|
626
578
|
* A dirty field is a field that needs to be re-rendered.
|
|
627
579
|
*/
|
|
628
580
|
markDirty() {
|
|
629
|
-
this.pathObject.constants =
|
|
630
|
-
|
|
631
|
-
.getConstants();
|
|
632
|
-
for (let i = 0, input; (input = this.inputList[i]); i++) {
|
|
581
|
+
this.pathObject.constants = this.workspace.getRenderer().getConstants();
|
|
582
|
+
for (let i = 0, input; input = this.inputList[i]; i++) {
|
|
633
583
|
input.markDirty();
|
|
634
584
|
}
|
|
635
585
|
}
|
|
636
586
|
|
|
637
587
|
/**
|
|
638
588
|
* Set whether the block is collapsed or not.
|
|
639
|
-
* @param
|
|
589
|
+
* @param collapsed True if collapsed.
|
|
640
590
|
*/
|
|
641
|
-
setCollapsed(collapsed) {
|
|
591
|
+
override setCollapsed(collapsed: boolean) {
|
|
642
592
|
if (this.collapsed_ === collapsed) {
|
|
643
593
|
return;
|
|
644
594
|
}
|
|
@@ -655,14 +605,13 @@ class BlockSvg extends Block {
|
|
|
655
605
|
/**
|
|
656
606
|
* Makes sure that when the block is collapsed, it is rendered correctly
|
|
657
607
|
* for that state.
|
|
658
|
-
* @private
|
|
659
608
|
*/
|
|
660
|
-
updateCollapsed_() {
|
|
609
|
+
private updateCollapsed_() {
|
|
661
610
|
const collapsed = this.isCollapsed();
|
|
662
611
|
const collapsedInputName = constants.COLLAPSED_INPUT_NAME;
|
|
663
612
|
const collapsedFieldName = constants.COLLAPSED_FIELD_NAME;
|
|
664
613
|
|
|
665
|
-
for (let i = 0, input;
|
|
614
|
+
for (let i = 0, input; input = this.inputList[i]; i++) {
|
|
666
615
|
if (input.name !== collapsedInputName) {
|
|
667
616
|
input.setVisible(!collapsed);
|
|
668
617
|
}
|
|
@@ -675,7 +624,7 @@ class BlockSvg extends Block {
|
|
|
675
624
|
}
|
|
676
625
|
|
|
677
626
|
const icons = this.getIcons();
|
|
678
|
-
for (let i = 0, icon;
|
|
627
|
+
for (let i = 0, icon; icon = icons[i]; i++) {
|
|
679
628
|
icon.setVisible(false);
|
|
680
629
|
}
|
|
681
630
|
|
|
@@ -687,17 +636,20 @@ class BlockSvg extends Block {
|
|
|
687
636
|
}
|
|
688
637
|
const input = this.getInput(collapsedInputName) ||
|
|
689
638
|
this.appendDummyInput(collapsedInputName);
|
|
690
|
-
|
|
639
|
+
// AnyDuringMigration because: Argument of type 'FieldLabel' is not
|
|
640
|
+
// assignable to parameter of type 'string | Field'.
|
|
641
|
+
input.appendField(
|
|
642
|
+
new FieldLabel(text) as AnyDuringMigration, collapsedFieldName);
|
|
691
643
|
}
|
|
692
644
|
|
|
693
645
|
/**
|
|
694
646
|
* Open the next (or previous) FieldTextInput.
|
|
695
|
-
* @param
|
|
696
|
-
* @param
|
|
647
|
+
* @param start Current field.
|
|
648
|
+
* @param forward If true go forward, otherwise backward.
|
|
697
649
|
*/
|
|
698
|
-
tab(start, forward) {
|
|
650
|
+
tab(start: Field, forward: boolean) {
|
|
699
651
|
const tabCursor = new TabNavigateCursor();
|
|
700
|
-
tabCursor.setCurNode(ASTNode.createFieldNode(start));
|
|
652
|
+
tabCursor.setCurNode(ASTNode.createFieldNode(start)!);
|
|
701
653
|
const currentNode = tabCursor.getCurNode();
|
|
702
654
|
|
|
703
655
|
if (forward) {
|
|
@@ -708,23 +660,22 @@ class BlockSvg extends Block {
|
|
|
708
660
|
|
|
709
661
|
const nextNode = tabCursor.getCurNode();
|
|
710
662
|
if (nextNode && nextNode !== currentNode) {
|
|
711
|
-
const nextField =
|
|
663
|
+
const nextField = nextNode.getLocation() as Field;
|
|
712
664
|
nextField.showEditor();
|
|
713
665
|
|
|
714
666
|
// Also move the cursor if we're in keyboard nav mode.
|
|
715
667
|
if (this.workspace.keyboardAccessibilityMode) {
|
|
716
|
-
this.workspace.getCursor()
|
|
668
|
+
this.workspace.getCursor()!.setCurNode(nextNode);
|
|
717
669
|
}
|
|
718
670
|
}
|
|
719
671
|
}
|
|
720
672
|
|
|
721
673
|
/**
|
|
722
674
|
* Handle a mouse-down on an SVG block.
|
|
723
|
-
* @param
|
|
724
|
-
* @private
|
|
675
|
+
* @param e Mouse down event or touch start event.
|
|
725
676
|
*/
|
|
726
|
-
onMouseDown_(e) {
|
|
727
|
-
const gesture = this.workspace
|
|
677
|
+
private onMouseDown_(e: Event) {
|
|
678
|
+
const gesture = this.workspace.getGesture(e);
|
|
728
679
|
if (gesture) {
|
|
729
680
|
gesture.handleBlockStart(e, this);
|
|
730
681
|
}
|
|
@@ -732,11 +683,11 @@ class BlockSvg extends Block {
|
|
|
732
683
|
|
|
733
684
|
/**
|
|
734
685
|
* Load the block's help page in a new window.
|
|
735
|
-
* @
|
|
686
|
+
* @internal
|
|
736
687
|
*/
|
|
737
688
|
showHelp() {
|
|
738
689
|
const url =
|
|
739
|
-
|
|
690
|
+
typeof this.helpUrl === 'function' ? this.helpUrl() : this.helpUrl;
|
|
740
691
|
if (url) {
|
|
741
692
|
window.open(url);
|
|
742
693
|
}
|
|
@@ -744,15 +695,18 @@ class BlockSvg extends Block {
|
|
|
744
695
|
|
|
745
696
|
/**
|
|
746
697
|
* Generate the context menu for this block.
|
|
747
|
-
* @return
|
|
748
|
-
* @protected
|
|
698
|
+
* @return Context menu options or null if no menu.
|
|
749
699
|
*/
|
|
750
|
-
generateContextMenu()
|
|
700
|
+
protected generateContextMenu():
|
|
701
|
+
Array<ContextMenuOption|LegacyContextMenuOption>|null {
|
|
751
702
|
if (this.workspace.options.readOnly || !this.contextMenu) {
|
|
752
703
|
return null;
|
|
753
704
|
}
|
|
705
|
+
// AnyDuringMigration because: Argument of type '{ block: this; }' is not
|
|
706
|
+
// assignable to parameter of type 'Scope'.
|
|
754
707
|
const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions(
|
|
755
|
-
ContextMenuRegistry.ScopeType.BLOCK,
|
|
708
|
+
ContextMenuRegistry.ScopeType.BLOCK,
|
|
709
|
+
{block: this} as AnyDuringMigration);
|
|
756
710
|
|
|
757
711
|
// Allow the block to add or modify menuOptions.
|
|
758
712
|
if (this.customContextMenu) {
|
|
@@ -764,28 +718,28 @@ class BlockSvg extends Block {
|
|
|
764
718
|
|
|
765
719
|
/**
|
|
766
720
|
* Show the context menu for this block.
|
|
767
|
-
* @param
|
|
768
|
-
* @
|
|
721
|
+
* @param e Mouse event.
|
|
722
|
+
* @internal
|
|
769
723
|
*/
|
|
770
|
-
showContextMenu(e) {
|
|
724
|
+
showContextMenu(e: Event) {
|
|
771
725
|
const menuOptions = this.generateContextMenu();
|
|
772
726
|
|
|
773
727
|
if (menuOptions && menuOptions.length) {
|
|
774
728
|
ContextMenu.show(e, menuOptions, this.RTL);
|
|
775
|
-
|
|
729
|
+
// AnyDuringMigration because: Argument of type 'this' is not assignable
|
|
730
|
+
// to parameter of type 'Block | null'.
|
|
731
|
+
ContextMenu.setCurrentBlock(this as AnyDuringMigration);
|
|
776
732
|
}
|
|
777
733
|
}
|
|
778
734
|
|
|
779
735
|
/**
|
|
780
736
|
* Move the connections for this block and all blocks attached under it.
|
|
781
737
|
* Also update any attached bubbles.
|
|
782
|
-
* @param
|
|
783
|
-
*
|
|
784
|
-
* @
|
|
785
|
-
* units.
|
|
786
|
-
* @package
|
|
738
|
+
* @param dx Horizontal offset from current location, in workspace units.
|
|
739
|
+
* @param dy Vertical offset from current location, in workspace units.
|
|
740
|
+
* @internal
|
|
787
741
|
*/
|
|
788
|
-
moveConnections(dx, dy) {
|
|
742
|
+
moveConnections(dx: number, dy: number) {
|
|
789
743
|
if (!this.rendered) {
|
|
790
744
|
// Rendering is required to lay out the blocks.
|
|
791
745
|
// This is probably an invisible block attached to a collapsed block.
|
|
@@ -802,49 +756,47 @@ class BlockSvg extends Block {
|
|
|
802
756
|
|
|
803
757
|
// Recurse through all blocks attached under this one.
|
|
804
758
|
for (let i = 0; i < this.childBlocks_.length; i++) {
|
|
805
|
-
(
|
|
759
|
+
(this.childBlocks_[i] as BlockSvg).moveConnections(dx, dy);
|
|
806
760
|
}
|
|
807
761
|
}
|
|
808
762
|
|
|
809
763
|
/**
|
|
810
764
|
* Recursively adds or removes the dragging class to this node and its
|
|
811
765
|
* children.
|
|
812
|
-
* @param
|
|
813
|
-
* @
|
|
766
|
+
* @param adding True if adding, false if removing.
|
|
767
|
+
* @internal
|
|
814
768
|
*/
|
|
815
|
-
setDragging(adding) {
|
|
769
|
+
setDragging(adding: boolean) {
|
|
816
770
|
if (adding) {
|
|
817
771
|
const group = this.getSvgRoot();
|
|
818
|
-
group.translate_ = '';
|
|
819
|
-
group.skew_ = '';
|
|
772
|
+
(group as AnyDuringMigration).translate_ = '';
|
|
773
|
+
(group as AnyDuringMigration).skew_ = '';
|
|
820
774
|
common.draggingConnections.push(...this.getConnections_(true));
|
|
821
|
-
dom.addClass(
|
|
822
|
-
/** @type {!Element} */ (this.svgGroup_), 'blocklyDragging');
|
|
775
|
+
dom.addClass(this.svgGroup_ as Element, 'blocklyDragging');
|
|
823
776
|
} else {
|
|
824
777
|
common.draggingConnections.length = 0;
|
|
825
|
-
dom.removeClass(
|
|
826
|
-
/** @type {!Element} */ (this.svgGroup_), 'blocklyDragging');
|
|
778
|
+
dom.removeClass(this.svgGroup_ as Element, 'blocklyDragging');
|
|
827
779
|
}
|
|
828
780
|
// Recurse through all blocks attached under this one.
|
|
829
781
|
for (let i = 0; i < this.childBlocks_.length; i++) {
|
|
830
|
-
(
|
|
782
|
+
(this.childBlocks_[i] as BlockSvg).setDragging(adding);
|
|
831
783
|
}
|
|
832
784
|
}
|
|
833
785
|
|
|
834
786
|
/**
|
|
835
787
|
* Set whether this block is movable or not.
|
|
836
|
-
* @param
|
|
788
|
+
* @param movable True if movable.
|
|
837
789
|
*/
|
|
838
|
-
setMovable(movable) {
|
|
790
|
+
override setMovable(movable: boolean) {
|
|
839
791
|
super.setMovable(movable);
|
|
840
792
|
this.pathObject.updateMovable(movable);
|
|
841
793
|
}
|
|
842
794
|
|
|
843
795
|
/**
|
|
844
796
|
* Set whether this block is editable or not.
|
|
845
|
-
* @param
|
|
797
|
+
* @param editable True if editable.
|
|
846
798
|
*/
|
|
847
|
-
setEditable(editable) {
|
|
799
|
+
override setEditable(editable: boolean) {
|
|
848
800
|
super.setEditable(editable);
|
|
849
801
|
const icons = this.getIcons();
|
|
850
802
|
for (let i = 0; i < icons.length; i++) {
|
|
@@ -854,10 +806,10 @@ class BlockSvg extends Block {
|
|
|
854
806
|
|
|
855
807
|
/**
|
|
856
808
|
* Sets whether this block is a shadow block or not.
|
|
857
|
-
* @param
|
|
858
|
-
* @
|
|
809
|
+
* @param shadow True if a shadow.
|
|
810
|
+
* @internal
|
|
859
811
|
*/
|
|
860
|
-
setShadow(shadow) {
|
|
812
|
+
override setShadow(shadow: boolean) {
|
|
861
813
|
super.setShadow(shadow);
|
|
862
814
|
this.applyColour();
|
|
863
815
|
}
|
|
@@ -865,10 +817,10 @@ class BlockSvg extends Block {
|
|
|
865
817
|
/**
|
|
866
818
|
* Set whether this block is an insertion marker block or not.
|
|
867
819
|
* Once set this cannot be unset.
|
|
868
|
-
* @param
|
|
869
|
-
* @
|
|
820
|
+
* @param insertionMarker True if an insertion marker.
|
|
821
|
+
* @internal
|
|
870
822
|
*/
|
|
871
|
-
setInsertionMarker(insertionMarker) {
|
|
823
|
+
override setInsertionMarker(insertionMarker: boolean) {
|
|
872
824
|
if (this.isInsertionMarker_ === insertionMarker) {
|
|
873
825
|
return; // No change.
|
|
874
826
|
}
|
|
@@ -882,22 +834,22 @@ class BlockSvg extends Block {
|
|
|
882
834
|
|
|
883
835
|
/**
|
|
884
836
|
* Return the root node of the SVG or null if none exists.
|
|
885
|
-
* @return
|
|
837
|
+
* @return The root SVG node (probably a group).
|
|
886
838
|
*/
|
|
887
|
-
getSvgRoot() {
|
|
839
|
+
getSvgRoot(): SVGGElement {
|
|
888
840
|
return this.svgGroup_;
|
|
889
841
|
}
|
|
890
842
|
|
|
891
843
|
/**
|
|
892
844
|
* Dispose of this block.
|
|
893
|
-
* @param
|
|
894
|
-
*
|
|
895
|
-
*
|
|
896
|
-
* @param
|
|
845
|
+
* @param healStack If true, then try to heal any gap by connecting the next
|
|
846
|
+
* statement with the previous statement. Otherwise, dispose of all
|
|
847
|
+
* children of this block.
|
|
848
|
+
* @param animate If true, show a disposal animation and sound.
|
|
897
849
|
* @suppress {checkTypes}
|
|
898
850
|
*/
|
|
899
|
-
dispose(healStack, animate) {
|
|
900
|
-
if (
|
|
851
|
+
override dispose(healStack?: boolean, animate?: boolean) {
|
|
852
|
+
if (this.disposed) {
|
|
901
853
|
// The block has already been deleted.
|
|
902
854
|
return;
|
|
903
855
|
}
|
|
@@ -925,23 +877,31 @@ class BlockSvg extends Block {
|
|
|
925
877
|
this.rendered = false;
|
|
926
878
|
|
|
927
879
|
// Clear pending warnings.
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
clearTimeout(this.warningTextDb_[n]);
|
|
931
|
-
}
|
|
932
|
-
this.warningTextDb_ = null;
|
|
880
|
+
for (const n of this.warningTextDb.values()) {
|
|
881
|
+
clearTimeout(n);
|
|
933
882
|
}
|
|
883
|
+
this.warningTextDb.clear();
|
|
934
884
|
|
|
935
885
|
const icons = this.getIcons();
|
|
936
886
|
for (let i = 0; i < icons.length; i++) {
|
|
937
887
|
icons[i].dispose();
|
|
938
888
|
}
|
|
889
|
+
|
|
890
|
+
// Just deleting this block from the DOM would result in a memory leak as
|
|
891
|
+
// well as corruption of the connection database. Therefore we must
|
|
892
|
+
// methodically step through the blocks and carefully disassemble them.
|
|
893
|
+
if (common.getSelected() === this) {
|
|
894
|
+
common.setSelected(null);
|
|
895
|
+
}
|
|
896
|
+
|
|
939
897
|
super.dispose(!!healStack);
|
|
940
898
|
|
|
941
899
|
dom.removeNode(this.svgGroup_);
|
|
942
900
|
blockWorkspace.resizeContents();
|
|
943
901
|
// Sever JavaScript to DOM connections.
|
|
944
|
-
|
|
902
|
+
// AnyDuringMigration because: Type 'null' is not assignable to type
|
|
903
|
+
// 'SVGGElement'.
|
|
904
|
+
this.svgGroup_ = null as AnyDuringMigration;
|
|
945
905
|
dom.stopTextWidthCache();
|
|
946
906
|
}
|
|
947
907
|
|
|
@@ -963,32 +923,37 @@ class BlockSvg extends Block {
|
|
|
963
923
|
// (https://github.com/google/blockly/issues/4832)
|
|
964
924
|
this.dispose(false, true);
|
|
965
925
|
} else {
|
|
966
|
-
this.dispose(/* heal */
|
|
926
|
+
this.dispose(/* heal */
|
|
927
|
+
true, true);
|
|
967
928
|
}
|
|
968
929
|
eventUtils.setGroup(false);
|
|
969
930
|
}
|
|
970
931
|
|
|
971
932
|
/**
|
|
972
933
|
* Encode a block for copying.
|
|
973
|
-
* @return
|
|
974
|
-
*
|
|
975
|
-
* @package
|
|
934
|
+
* @return Copy metadata, or null if the block is an insertion marker.
|
|
935
|
+
* @internal
|
|
976
936
|
*/
|
|
977
|
-
toCopyData() {
|
|
937
|
+
toCopyData(): CopyData|null {
|
|
978
938
|
if (this.isInsertionMarker_) {
|
|
979
939
|
return null;
|
|
980
940
|
}
|
|
941
|
+
// AnyDuringMigration because: Argument of type 'this' is not assignable to
|
|
942
|
+
// parameter of type 'Block'. AnyDuringMigration because: Argument of type
|
|
943
|
+
// 'this' is not assignable to parameter of type 'Block'.
|
|
981
944
|
return {
|
|
982
|
-
saveInfo:
|
|
983
|
-
|
|
945
|
+
saveInfo: blocks.save(
|
|
946
|
+
this as AnyDuringMigration,
|
|
947
|
+
{addCoordinates: true, addNextBlocks: false}) as
|
|
948
|
+
blocks.State,
|
|
984
949
|
source: this.workspace,
|
|
985
|
-
typeCounts: common.getBlockTypeCounts(this, true),
|
|
950
|
+
typeCounts: common.getBlockTypeCounts(this as AnyDuringMigration, true),
|
|
986
951
|
};
|
|
987
952
|
}
|
|
988
953
|
|
|
989
954
|
/**
|
|
990
955
|
* Updates the colour of the block to match the block's state.
|
|
991
|
-
* @
|
|
956
|
+
* @internal
|
|
992
957
|
*/
|
|
993
958
|
applyColour() {
|
|
994
959
|
this.pathObject.applyColour(this);
|
|
@@ -998,8 +963,8 @@ class BlockSvg extends Block {
|
|
|
998
963
|
icons[i].applyColour();
|
|
999
964
|
}
|
|
1000
965
|
|
|
1001
|
-
for (let x = 0, input;
|
|
1002
|
-
for (let y = 0, field;
|
|
966
|
+
for (let x = 0, input; input = this.inputList[x]; x++) {
|
|
967
|
+
for (let y = 0, field; field = input.fieldRow[y]; y++) {
|
|
1003
968
|
field.applyColour();
|
|
1004
969
|
}
|
|
1005
970
|
}
|
|
@@ -1008,16 +973,15 @@ class BlockSvg extends Block {
|
|
|
1008
973
|
/**
|
|
1009
974
|
* Updates the color of the block (and children) to match the current disabled
|
|
1010
975
|
* state.
|
|
1011
|
-
* @
|
|
976
|
+
* @internal
|
|
1012
977
|
*/
|
|
1013
978
|
updateDisabled() {
|
|
1014
|
-
const children =
|
|
1015
|
-
/** @type {!Array<!BlockSvg>} */ (this.getChildren(false));
|
|
979
|
+
const children = (this.getChildren(false));
|
|
1016
980
|
this.applyColour();
|
|
1017
981
|
if (this.isCollapsed()) {
|
|
1018
982
|
return;
|
|
1019
983
|
}
|
|
1020
|
-
for (let i = 0, child;
|
|
984
|
+
for (let i = 0, child; child = children[i]; i++) {
|
|
1021
985
|
if (child.rendered) {
|
|
1022
986
|
child.updateDisabled();
|
|
1023
987
|
}
|
|
@@ -1027,21 +991,19 @@ class BlockSvg extends Block {
|
|
|
1027
991
|
/**
|
|
1028
992
|
* Get the comment icon attached to this block, or null if the block has no
|
|
1029
993
|
* comment.
|
|
1030
|
-
* @return
|
|
994
|
+
* @return The comment icon attached to this block, or null.
|
|
1031
995
|
*/
|
|
1032
|
-
getCommentIcon() {
|
|
996
|
+
getCommentIcon(): Comment|null {
|
|
1033
997
|
return this.commentIcon_;
|
|
1034
998
|
}
|
|
1035
999
|
|
|
1036
1000
|
/**
|
|
1037
1001
|
* Set this block's comment text.
|
|
1038
|
-
* @param
|
|
1002
|
+
* @param text The text, or null to delete.
|
|
1039
1003
|
*/
|
|
1040
|
-
setCommentText(text) {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
throw Error('Missing require for Blockly.Comment');
|
|
1044
|
-
}
|
|
1004
|
+
override setCommentText(text: string|null) {
|
|
1005
|
+
// AnyDuringMigration because: Property 'get' does not exist on type
|
|
1006
|
+
// '(name: string) => void'.
|
|
1045
1007
|
if (this.commentModel.text === text) {
|
|
1046
1008
|
return;
|
|
1047
1009
|
}
|
|
@@ -1051,14 +1013,14 @@ class BlockSvg extends Block {
|
|
|
1051
1013
|
if (!!this.commentIcon_ === shouldHaveComment) {
|
|
1052
1014
|
// If the comment's state of existence is correct, but the text is new
|
|
1053
1015
|
// that means we're just updating a comment.
|
|
1054
|
-
this.commentIcon_
|
|
1016
|
+
this.commentIcon_!.updateText();
|
|
1055
1017
|
return;
|
|
1056
1018
|
}
|
|
1057
1019
|
if (shouldHaveComment) {
|
|
1058
1020
|
this.commentIcon_ = new Comment(this);
|
|
1059
1021
|
this.comment = this.commentIcon_; // For backwards compatibility.
|
|
1060
1022
|
} else {
|
|
1061
|
-
this.commentIcon_
|
|
1023
|
+
this.commentIcon_!.dispose();
|
|
1062
1024
|
this.commentIcon_ = null;
|
|
1063
1025
|
this.comment = null; // For backwards compatibility.
|
|
1064
1026
|
}
|
|
@@ -1071,42 +1033,34 @@ class BlockSvg extends Block {
|
|
|
1071
1033
|
|
|
1072
1034
|
/**
|
|
1073
1035
|
* Set this block's warning text.
|
|
1074
|
-
* @param
|
|
1075
|
-
* @param
|
|
1076
|
-
*
|
|
1036
|
+
* @param text The text, or null to delete.
|
|
1037
|
+
* @param opt_id An optional ID for the warning text to be able to maintain
|
|
1038
|
+
* multiple warnings.
|
|
1077
1039
|
*/
|
|
1078
|
-
setWarningText(text, opt_id) {
|
|
1079
|
-
const {Warning} = goog.module.get('Blockly.Warning');
|
|
1080
|
-
if (!Warning) {
|
|
1081
|
-
throw Error('Missing require for Blockly.Warning');
|
|
1082
|
-
}
|
|
1083
|
-
if (!this.warningTextDb_) {
|
|
1084
|
-
// Create a database of warning PIDs.
|
|
1085
|
-
// Only runs once per block (and only those with warnings).
|
|
1086
|
-
this.warningTextDb_ = Object.create(null);
|
|
1087
|
-
}
|
|
1040
|
+
override setWarningText(text: string|null, opt_id?: string) {
|
|
1088
1041
|
const id = opt_id || '';
|
|
1089
1042
|
if (!id) {
|
|
1090
1043
|
// Kill all previous pending processes, this edit supersedes them all.
|
|
1091
|
-
for (const
|
|
1092
|
-
clearTimeout(
|
|
1093
|
-
delete this.warningTextDb_[n];
|
|
1044
|
+
for (const timeout of this.warningTextDb.values()) {
|
|
1045
|
+
clearTimeout(timeout);
|
|
1094
1046
|
}
|
|
1095
|
-
|
|
1047
|
+
this.warningTextDb.clear();
|
|
1048
|
+
} else if (this.warningTextDb.has(id)) {
|
|
1096
1049
|
// Only queue up the latest change. Kill any earlier pending process.
|
|
1097
|
-
clearTimeout(this.
|
|
1098
|
-
|
|
1050
|
+
clearTimeout(this.warningTextDb.get(id)!);
|
|
1051
|
+
this.warningTextDb.delete(id);
|
|
1099
1052
|
}
|
|
1100
1053
|
if (this.workspace.isDragging()) {
|
|
1101
1054
|
// Don't change the warning text during a drag.
|
|
1102
1055
|
// Wait until the drag finishes.
|
|
1103
1056
|
const thisBlock = this;
|
|
1104
|
-
this.
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1057
|
+
this.warningTextDb.set(
|
|
1058
|
+
id, setTimeout(() => {
|
|
1059
|
+
if (!this.disposed) { // Check block wasn't deleted.
|
|
1060
|
+
this.warningTextDb.delete(id);
|
|
1061
|
+
this.setWarningText(text, id);
|
|
1062
|
+
}
|
|
1063
|
+
}, 100));
|
|
1110
1064
|
return;
|
|
1111
1065
|
}
|
|
1112
1066
|
if (this.isInFlyout) {
|
|
@@ -1133,7 +1087,7 @@ class BlockSvg extends Block {
|
|
|
1133
1087
|
this.warning = new Warning(this);
|
|
1134
1088
|
changedState = true;
|
|
1135
1089
|
}
|
|
1136
|
-
this.warning
|
|
1090
|
+
this.warning!.setText((text), id);
|
|
1137
1091
|
} else {
|
|
1138
1092
|
// Dispose all warnings if no ID is given.
|
|
1139
1093
|
if (this.warning && !id) {
|
|
@@ -1158,9 +1112,9 @@ class BlockSvg extends Block {
|
|
|
1158
1112
|
|
|
1159
1113
|
/**
|
|
1160
1114
|
* Give this block a mutator dialog.
|
|
1161
|
-
* @param
|
|
1115
|
+
* @param mutator A mutator dialog instance or null to remove.
|
|
1162
1116
|
*/
|
|
1163
|
-
setMutator(mutator) {
|
|
1117
|
+
override setMutator(mutator: Mutator|null) {
|
|
1164
1118
|
if (this.mutator && this.mutator !== mutator) {
|
|
1165
1119
|
this.mutator.dispose();
|
|
1166
1120
|
}
|
|
@@ -1178,9 +1132,9 @@ class BlockSvg extends Block {
|
|
|
1178
1132
|
|
|
1179
1133
|
/**
|
|
1180
1134
|
* Set whether the block is enabled or not.
|
|
1181
|
-
* @param
|
|
1135
|
+
* @param enabled True if enabled.
|
|
1182
1136
|
*/
|
|
1183
|
-
setEnabled(enabled) {
|
|
1137
|
+
override setEnabled(enabled: boolean) {
|
|
1184
1138
|
if (this.isEnabled() !== enabled) {
|
|
1185
1139
|
super.setEnabled(enabled);
|
|
1186
1140
|
if (this.rendered && !this.getInheritedDisabled()) {
|
|
@@ -1192,9 +1146,9 @@ class BlockSvg extends Block {
|
|
|
1192
1146
|
/**
|
|
1193
1147
|
* Set whether the block is highlighted or not. Block highlighting is
|
|
1194
1148
|
* often used to visually mark blocks currently being executed.
|
|
1195
|
-
* @param
|
|
1149
|
+
* @param highlighted True if highlighted.
|
|
1196
1150
|
*/
|
|
1197
|
-
setHighlighted(highlighted) {
|
|
1151
|
+
setHighlighted(highlighted: boolean) {
|
|
1198
1152
|
if (!this.rendered) {
|
|
1199
1153
|
return;
|
|
1200
1154
|
}
|
|
@@ -1221,11 +1175,10 @@ class BlockSvg extends Block {
|
|
|
1221
1175
|
|
|
1222
1176
|
/**
|
|
1223
1177
|
* Update the cursor over this block by adding or removing a class.
|
|
1224
|
-
* @param
|
|
1225
|
-
*
|
|
1226
|
-
* @package
|
|
1178
|
+
* @param enable True if the delete cursor should be shown, false otherwise.
|
|
1179
|
+
* @internal
|
|
1227
1180
|
*/
|
|
1228
|
-
setDeleteStyle(enable) {
|
|
1181
|
+
setDeleteStyle(enable: boolean) {
|
|
1229
1182
|
this.pathObject.updateDraggingDelete(enable);
|
|
1230
1183
|
}
|
|
1231
1184
|
|
|
@@ -1235,17 +1188,17 @@ class BlockSvg extends Block {
|
|
|
1235
1188
|
|
|
1236
1189
|
/**
|
|
1237
1190
|
* Get the colour of a block.
|
|
1238
|
-
* @return
|
|
1191
|
+
* @return #RRGGBB string.
|
|
1239
1192
|
*/
|
|
1240
|
-
getColour() {
|
|
1193
|
+
override getColour(): string {
|
|
1241
1194
|
return this.style.colourPrimary;
|
|
1242
1195
|
}
|
|
1243
1196
|
|
|
1244
1197
|
/**
|
|
1245
1198
|
* Change the colour of a block.
|
|
1246
|
-
* @param
|
|
1199
|
+
* @param colour HSV hue value, or #RRGGBB string.
|
|
1247
1200
|
*/
|
|
1248
|
-
setColour(colour) {
|
|
1201
|
+
override setColour(colour: number|string) {
|
|
1249
1202
|
super.setColour(colour);
|
|
1250
1203
|
const styleObj =
|
|
1251
1204
|
this.workspace.getRenderer().getConstants().getBlockStyleForColour(
|
|
@@ -1260,10 +1213,10 @@ class BlockSvg extends Block {
|
|
|
1260
1213
|
|
|
1261
1214
|
/**
|
|
1262
1215
|
* Set the style and colour values of a block.
|
|
1263
|
-
* @param
|
|
1216
|
+
* @param blockStyleName Name of the block style.
|
|
1264
1217
|
* @throws {Error} if the block style does not exist.
|
|
1265
1218
|
*/
|
|
1266
|
-
setStyle(blockStyleName) {
|
|
1219
|
+
override setStyle(blockStyleName: string) {
|
|
1267
1220
|
const blockStyle =
|
|
1268
1221
|
this.workspace.getRenderer().getConstants().getBlockStyle(
|
|
1269
1222
|
blockStyleName);
|
|
@@ -1287,30 +1240,32 @@ class BlockSvg extends Block {
|
|
|
1287
1240
|
* <g> tags do not respect z-index so SVG renders them in the
|
|
1288
1241
|
* order that they are in the DOM. By placing this block first within the
|
|
1289
1242
|
* block group's <g>, it will render on top of any other blocks.
|
|
1290
|
-
* @
|
|
1243
|
+
* @internal
|
|
1291
1244
|
*/
|
|
1292
1245
|
bringToFront() {
|
|
1293
1246
|
let block = this;
|
|
1294
1247
|
do {
|
|
1295
1248
|
const root = block.getSvgRoot();
|
|
1296
1249
|
const parent = root.parentNode;
|
|
1297
|
-
const childNodes = parent
|
|
1250
|
+
const childNodes = parent!.childNodes;
|
|
1298
1251
|
// Avoid moving the block if it's already at the bottom.
|
|
1299
1252
|
if (childNodes[childNodes.length - 1] !== root) {
|
|
1300
|
-
parent
|
|
1253
|
+
parent!.appendChild(root);
|
|
1301
1254
|
}
|
|
1302
|
-
|
|
1255
|
+
// AnyDuringMigration because: Type 'BlockSvg | null' is not assignable
|
|
1256
|
+
// to type 'this'.
|
|
1257
|
+
block = block.getParent() as AnyDuringMigration;
|
|
1303
1258
|
} while (block);
|
|
1304
1259
|
}
|
|
1305
1260
|
|
|
1306
1261
|
/**
|
|
1307
1262
|
* Set whether this block can chain onto the bottom of another block.
|
|
1308
|
-
* @param
|
|
1309
|
-
* @param
|
|
1310
|
-
*
|
|
1311
|
-
* connected.
|
|
1263
|
+
* @param newBoolean True if there can be a previous statement.
|
|
1264
|
+
* @param opt_check Statement type or list of statement types. Null/undefined
|
|
1265
|
+
* if any type could be connected.
|
|
1312
1266
|
*/
|
|
1313
|
-
setPreviousStatement(
|
|
1267
|
+
override setPreviousStatement(
|
|
1268
|
+
newBoolean: boolean, opt_check?: string|string[]|null) {
|
|
1314
1269
|
super.setPreviousStatement(newBoolean, opt_check);
|
|
1315
1270
|
|
|
1316
1271
|
if (this.rendered) {
|
|
@@ -1321,12 +1276,12 @@ class BlockSvg extends Block {
|
|
|
1321
1276
|
|
|
1322
1277
|
/**
|
|
1323
1278
|
* Set whether another block can chain onto the bottom of this block.
|
|
1324
|
-
* @param
|
|
1325
|
-
* @param
|
|
1326
|
-
*
|
|
1327
|
-
* connected.
|
|
1279
|
+
* @param newBoolean True if there can be a next statement.
|
|
1280
|
+
* @param opt_check Statement type or list of statement types. Null/undefined
|
|
1281
|
+
* if any type could be connected.
|
|
1328
1282
|
*/
|
|
1329
|
-
setNextStatement(
|
|
1283
|
+
override setNextStatement(
|
|
1284
|
+
newBoolean: boolean, opt_check?: string|string[]|null) {
|
|
1330
1285
|
super.setNextStatement(newBoolean, opt_check);
|
|
1331
1286
|
|
|
1332
1287
|
if (this.rendered) {
|
|
@@ -1337,12 +1292,11 @@ class BlockSvg extends Block {
|
|
|
1337
1292
|
|
|
1338
1293
|
/**
|
|
1339
1294
|
* Set whether this block returns a value.
|
|
1340
|
-
* @param
|
|
1341
|
-
* @param
|
|
1342
|
-
*
|
|
1343
|
-
* (e.g. variable get).
|
|
1295
|
+
* @param newBoolean True if there is an output.
|
|
1296
|
+
* @param opt_check Returned type or list of returned types. Null or
|
|
1297
|
+
* undefined if any type could be returned (e.g. variable get).
|
|
1344
1298
|
*/
|
|
1345
|
-
setOutput(newBoolean, opt_check) {
|
|
1299
|
+
override setOutput(newBoolean: boolean, opt_check?: string|string[]|null) {
|
|
1346
1300
|
super.setOutput(newBoolean, opt_check);
|
|
1347
1301
|
|
|
1348
1302
|
if (this.rendered) {
|
|
@@ -1353,9 +1307,9 @@ class BlockSvg extends Block {
|
|
|
1353
1307
|
|
|
1354
1308
|
/**
|
|
1355
1309
|
* Set whether value inputs are arranged horizontally or vertically.
|
|
1356
|
-
* @param
|
|
1310
|
+
* @param newBoolean True if inputs are horizontal.
|
|
1357
1311
|
*/
|
|
1358
|
-
setInputsInline(newBoolean) {
|
|
1312
|
+
override setInputsInline(newBoolean: boolean) {
|
|
1359
1313
|
super.setInputsInline(newBoolean);
|
|
1360
1314
|
|
|
1361
1315
|
if (this.rendered) {
|
|
@@ -1366,13 +1320,13 @@ class BlockSvg extends Block {
|
|
|
1366
1320
|
|
|
1367
1321
|
/**
|
|
1368
1322
|
* Remove an input from this block.
|
|
1369
|
-
* @param
|
|
1370
|
-
* @param
|
|
1371
|
-
* @return
|
|
1372
|
-
*
|
|
1323
|
+
* @param name The name of the input.
|
|
1324
|
+
* @param opt_quiet True to prevent error if input is not present.
|
|
1325
|
+
* @return True if operation succeeds, false if input is not present and
|
|
1326
|
+
* opt_quiet is true
|
|
1373
1327
|
* @throws {Error} if the input is not present and opt_quiet is not true.
|
|
1374
1328
|
*/
|
|
1375
|
-
removeInput(name, opt_quiet) {
|
|
1329
|
+
override removeInput(name: string, opt_quiet?: boolean): boolean {
|
|
1376
1330
|
const removed = super.removeInput(name, opt_quiet);
|
|
1377
1331
|
|
|
1378
1332
|
if (this.rendered) {
|
|
@@ -1386,11 +1340,10 @@ class BlockSvg extends Block {
|
|
|
1386
1340
|
|
|
1387
1341
|
/**
|
|
1388
1342
|
* Move a numbered input to a different location on this block.
|
|
1389
|
-
* @param
|
|
1390
|
-
* @param
|
|
1391
|
-
* input.
|
|
1343
|
+
* @param inputIndex Index of the input to move.
|
|
1344
|
+
* @param refIndex Index of input that should be after the moved input.
|
|
1392
1345
|
*/
|
|
1393
|
-
moveNumberedInputBefore(inputIndex, refIndex) {
|
|
1346
|
+
override moveNumberedInputBefore(inputIndex: number, refIndex: number) {
|
|
1394
1347
|
super.moveNumberedInputBefore(inputIndex, refIndex);
|
|
1395
1348
|
|
|
1396
1349
|
if (this.rendered) {
|
|
@@ -1402,14 +1355,12 @@ class BlockSvg extends Block {
|
|
|
1402
1355
|
|
|
1403
1356
|
/**
|
|
1404
1357
|
* Add a value input, statement input or local variable to this block.
|
|
1405
|
-
* @param
|
|
1406
|
-
* @param
|
|
1407
|
-
*
|
|
1408
|
-
* @return
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
*/
|
|
1412
|
-
appendInput_(type, name) {
|
|
1358
|
+
* @param type One of Blockly.inputTypes.
|
|
1359
|
+
* @param name Language-neutral identifier which may used to find this input
|
|
1360
|
+
* again. Should be unique to this block.
|
|
1361
|
+
* @return The input object created.
|
|
1362
|
+
*/
|
|
1363
|
+
protected override appendInput_(type: number, name: string): Input {
|
|
1413
1364
|
const input = super.appendInput_(type, name);
|
|
1414
1365
|
|
|
1415
1366
|
if (this.rendered) {
|
|
@@ -1426,24 +1377,19 @@ class BlockSvg extends Block {
|
|
|
1426
1377
|
* Used by the deserializer to be more efficient. Setting a connection's
|
|
1427
1378
|
* tracked_ value to false keeps it from adding itself to the db when it
|
|
1428
1379
|
* gets its first moveTo call, saving expensive ops for later.
|
|
1429
|
-
* @param
|
|
1430
|
-
* @
|
|
1380
|
+
* @param track If true, start tracking. If false, stop tracking.
|
|
1381
|
+
* @internal
|
|
1431
1382
|
*/
|
|
1432
|
-
setConnectionTracking(track) {
|
|
1383
|
+
setConnectionTracking(track: boolean) {
|
|
1433
1384
|
if (this.previousConnection) {
|
|
1434
|
-
|
|
1435
|
-
.setTracking(track);
|
|
1385
|
+
(this.previousConnection).setTracking(track);
|
|
1436
1386
|
}
|
|
1437
1387
|
if (this.outputConnection) {
|
|
1438
|
-
|
|
1439
|
-
.setTracking(track);
|
|
1388
|
+
(this.outputConnection).setTracking(track);
|
|
1440
1389
|
}
|
|
1441
1390
|
if (this.nextConnection) {
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
const child =
|
|
1445
|
-
/** @type {!RenderedConnection} */ (this.nextConnection)
|
|
1446
|
-
.targetBlock();
|
|
1391
|
+
(this.nextConnection).setTracking(track);
|
|
1392
|
+
const child = (this.nextConnection).targetBlock();
|
|
1447
1393
|
if (child) {
|
|
1448
1394
|
child.setConnectionTracking(track);
|
|
1449
1395
|
}
|
|
@@ -1457,8 +1403,7 @@ class BlockSvg extends Block {
|
|
|
1457
1403
|
}
|
|
1458
1404
|
|
|
1459
1405
|
for (let i = 0; i < this.inputList.length; i++) {
|
|
1460
|
-
const conn =
|
|
1461
|
-
/** @type {!RenderedConnection} */ (this.inputList[i].connection);
|
|
1406
|
+
const conn = this.inputList[i].connection as RenderedConnection;
|
|
1462
1407
|
if (conn) {
|
|
1463
1408
|
conn.setTracking(track);
|
|
1464
1409
|
|
|
@@ -1473,13 +1418,13 @@ class BlockSvg extends Block {
|
|
|
1473
1418
|
|
|
1474
1419
|
/**
|
|
1475
1420
|
* Returns connections originating from this block.
|
|
1476
|
-
* @param
|
|
1421
|
+
* @param all If true, return all connections even hidden ones.
|
|
1477
1422
|
* Otherwise, for a non-rendered block return an empty list, and for a
|
|
1478
|
-
*
|
|
1479
|
-
* @return
|
|
1480
|
-
* @
|
|
1423
|
+
* collapsed block don't return inputs connections.
|
|
1424
|
+
* @return Array of connections.
|
|
1425
|
+
* @internal
|
|
1481
1426
|
*/
|
|
1482
|
-
getConnections_(all) {
|
|
1427
|
+
override getConnections_(all: boolean): RenderedConnection[] {
|
|
1483
1428
|
const myConnections = [];
|
|
1484
1429
|
if (all || this.rendered) {
|
|
1485
1430
|
if (this.outputConnection) {
|
|
@@ -1492,9 +1437,9 @@ class BlockSvg extends Block {
|
|
|
1492
1437
|
myConnections.push(this.nextConnection);
|
|
1493
1438
|
}
|
|
1494
1439
|
if (all || !this.collapsed_) {
|
|
1495
|
-
for (let i = 0, input;
|
|
1440
|
+
for (let i = 0, input; input = this.inputList[i]; i++) {
|
|
1496
1441
|
if (input.connection) {
|
|
1497
|
-
myConnections.push(input.connection);
|
|
1442
|
+
myConnections.push(input.connection as RenderedConnection);
|
|
1498
1443
|
}
|
|
1499
1444
|
}
|
|
1500
1445
|
}
|
|
@@ -1505,51 +1450,62 @@ class BlockSvg extends Block {
|
|
|
1505
1450
|
/**
|
|
1506
1451
|
* Walks down a stack of blocks and finds the last next connection on the
|
|
1507
1452
|
* stack.
|
|
1508
|
-
* @param
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
* @return
|
|
1512
|
-
*
|
|
1513
|
-
* @package
|
|
1514
|
-
* @override
|
|
1453
|
+
* @param ignoreShadows If true,the last connection on a non-shadow block will
|
|
1454
|
+
* be returned. If false, this will follow shadows to find the last
|
|
1455
|
+
* connection.
|
|
1456
|
+
* @return The last next connection on the stack, or null.
|
|
1457
|
+
* @internal
|
|
1515
1458
|
*/
|
|
1516
|
-
lastConnectionInStack(ignoreShadows)
|
|
1517
|
-
|
|
1518
|
-
|
|
1459
|
+
override lastConnectionInStack(ignoreShadows: boolean): RenderedConnection
|
|
1460
|
+
|null {
|
|
1461
|
+
return super.lastConnectionInStack(ignoreShadows) as RenderedConnection;
|
|
1519
1462
|
}
|
|
1520
1463
|
|
|
1521
1464
|
/**
|
|
1522
1465
|
* Find the connection on this block that corresponds to the given connection
|
|
1523
1466
|
* on the other block.
|
|
1524
1467
|
* Used to match connections between a block and its insertion marker.
|
|
1525
|
-
* @param
|
|
1526
|
-
* @param
|
|
1527
|
-
* @return
|
|
1528
|
-
*
|
|
1529
|
-
* @package
|
|
1530
|
-
* @override
|
|
1468
|
+
* @param otherBlock The other block to match against.
|
|
1469
|
+
* @param conn The other connection to match.
|
|
1470
|
+
* @return The matching connection on this block, or null.
|
|
1471
|
+
* @internal
|
|
1531
1472
|
*/
|
|
1532
|
-
getMatchingConnection(otherBlock, conn)
|
|
1533
|
-
|
|
1534
|
-
|
|
1473
|
+
override getMatchingConnection(otherBlock: Block, conn: Connection):
|
|
1474
|
+
RenderedConnection|null {
|
|
1475
|
+
return super.getMatchingConnection(otherBlock, conn) as RenderedConnection;
|
|
1535
1476
|
}
|
|
1536
1477
|
|
|
1537
1478
|
/**
|
|
1538
1479
|
* Create a connection of the specified type.
|
|
1539
|
-
* @param
|
|
1540
|
-
* @return
|
|
1541
|
-
* @protected
|
|
1480
|
+
* @param type The type of the connection to create.
|
|
1481
|
+
* @return A new connection of the specified type.
|
|
1542
1482
|
*/
|
|
1543
|
-
makeConnection_(type) {
|
|
1483
|
+
protected override makeConnection_(type: number): RenderedConnection {
|
|
1544
1484
|
return new RenderedConnection(this, type);
|
|
1545
1485
|
}
|
|
1546
1486
|
|
|
1487
|
+
/**
|
|
1488
|
+
* Return the next statement block directly connected to this block.
|
|
1489
|
+
* @return The next statement block or null.
|
|
1490
|
+
*/
|
|
1491
|
+
override getNextBlock(): BlockSvg|null {
|
|
1492
|
+
return super.getNextBlock() as BlockSvg;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Returns the block connected to the previous connection.
|
|
1497
|
+
* @return The previous statement block or null.
|
|
1498
|
+
*/
|
|
1499
|
+
override getPreviousBlock(): BlockSvg|null {
|
|
1500
|
+
return super.getPreviousBlock() as BlockSvg;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1547
1503
|
/**
|
|
1548
1504
|
* Bump unconnected blocks out of alignment. Two blocks which aren't actually
|
|
1549
1505
|
* connected should not coincidentally line up on screen.
|
|
1550
1506
|
*/
|
|
1551
|
-
bumpNeighbours() {
|
|
1552
|
-
if (
|
|
1507
|
+
override bumpNeighbours() {
|
|
1508
|
+
if (this.disposed) {
|
|
1553
1509
|
return; // Deleted block.
|
|
1554
1510
|
}
|
|
1555
1511
|
if (this.workspace.isDragging()) {
|
|
@@ -1557,21 +1513,21 @@ class BlockSvg extends Block {
|
|
|
1557
1513
|
}
|
|
1558
1514
|
const rootBlock = this.getRootBlock();
|
|
1559
1515
|
if (rootBlock.isInFlyout) {
|
|
1560
|
-
return;
|
|
1516
|
+
return;
|
|
1561
1517
|
}
|
|
1518
|
+
// Don't move blocks around in a flyout.
|
|
1562
1519
|
// Loop through every connection on this block.
|
|
1563
1520
|
const myConnections = this.getConnections_(false);
|
|
1564
|
-
for (let i = 0, connection;
|
|
1565
|
-
const renderedConn =
|
|
1521
|
+
for (let i = 0, connection; connection = myConnections[i]; i++) {
|
|
1522
|
+
const renderedConn = (connection);
|
|
1566
1523
|
// Spider down from this block bumping all sub-blocks.
|
|
1567
1524
|
if (renderedConn.isConnected() && renderedConn.isSuperior()) {
|
|
1568
|
-
renderedConn.targetBlock()
|
|
1525
|
+
renderedConn.targetBlock()!.bumpNeighbours();
|
|
1569
1526
|
}
|
|
1570
1527
|
|
|
1571
1528
|
const neighbours = connection.neighbours(config.snapRadius);
|
|
1572
|
-
for (let j = 0, otherConnection;
|
|
1573
|
-
const renderedOther =
|
|
1574
|
-
/** @type {!RenderedConnection} */ (otherConnection);
|
|
1529
|
+
for (let j = 0, otherConnection; otherConnection = neighbours[j]; j++) {
|
|
1530
|
+
const renderedOther = otherConnection as RenderedConnection;
|
|
1575
1531
|
// If both connections are connected, that's probably fine. But if
|
|
1576
1532
|
// either one of them is unconnected, then there could be confusion.
|
|
1577
1533
|
if (!renderedConn.isConnected() || !renderedOther.isConnected()) {
|
|
@@ -1592,7 +1548,7 @@ class BlockSvg extends Block {
|
|
|
1592
1548
|
/**
|
|
1593
1549
|
* Schedule snapping to grid and bumping neighbours to occur after a brief
|
|
1594
1550
|
* delay.
|
|
1595
|
-
* @
|
|
1551
|
+
* @internal
|
|
1596
1552
|
*/
|
|
1597
1553
|
scheduleSnapAndBump() {
|
|
1598
1554
|
const block = this;
|
|
@@ -1616,13 +1572,14 @@ class BlockSvg extends Block {
|
|
|
1616
1572
|
* Position a block so that it doesn't move the target block when connected.
|
|
1617
1573
|
* The block to position is usually either the first block in a dragged stack
|
|
1618
1574
|
* or an insertion marker.
|
|
1619
|
-
* @param
|
|
1620
|
-
*
|
|
1621
|
-
*
|
|
1622
|
-
*
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1575
|
+
* @param sourceConnection The connection on the moving block's stack.
|
|
1576
|
+
* @param targetConnection The connection that should stay stationary as this
|
|
1577
|
+
* block is positioned.
|
|
1578
|
+
* @internal
|
|
1579
|
+
*/
|
|
1580
|
+
positionNearConnection(
|
|
1581
|
+
sourceConnection: RenderedConnection,
|
|
1582
|
+
targetConnection: RenderedConnection) {
|
|
1626
1583
|
// We only need to position the new block if it's before the existing one,
|
|
1627
1584
|
// otherwise its position is set by the previous block.
|
|
1628
1585
|
if (sourceConnection.type === ConnectionType.NEXT_STATEMENT ||
|
|
@@ -1635,100 +1592,31 @@ class BlockSvg extends Block {
|
|
|
1635
1592
|
}
|
|
1636
1593
|
|
|
1637
1594
|
/**
|
|
1638
|
-
*
|
|
1639
|
-
* @
|
|
1640
|
-
* @override
|
|
1641
|
-
*/
|
|
1642
|
-
getParent() {
|
|
1643
|
-
return /** @type {?BlockSvg} */ (super.getParent());
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
/**
|
|
1647
|
-
* @return {?BlockSvg} The block (if any) that surrounds the current block.
|
|
1648
|
-
* @override
|
|
1649
|
-
*/
|
|
1650
|
-
getSurroundParent() {
|
|
1651
|
-
return /** @type {?BlockSvg} */ (super.getSurroundParent());
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
/**
|
|
1655
|
-
* @return {?BlockSvg} The next statement block or null.
|
|
1656
|
-
* @override
|
|
1657
|
-
*/
|
|
1658
|
-
getNextBlock() {
|
|
1659
|
-
return /** @type {?BlockSvg} */ (super.getNextBlock());
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
/**
|
|
1663
|
-
* @return {?BlockSvg} The previou statement block or null.
|
|
1664
|
-
* @override
|
|
1665
|
-
*/
|
|
1666
|
-
getPreviousBlock() {
|
|
1667
|
-
return /** @type {?BlockSvg} */ (super.getPreviousBlock());
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
/**
|
|
1671
|
-
* @return {?RenderedConnection} The first statement connection or null.
|
|
1672
|
-
* @package
|
|
1673
|
-
* @override
|
|
1674
|
-
*/
|
|
1675
|
-
getFirstStatementConnection() {
|
|
1676
|
-
return /** @type {?RenderedConnection} */ (
|
|
1677
|
-
super.getFirstStatementConnection());
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
/**
|
|
1681
|
-
* @return {!BlockSvg} The top block in a stack.
|
|
1682
|
-
* @override
|
|
1683
|
-
*/
|
|
1684
|
-
getTopStackBlock() {
|
|
1685
|
-
return /** @type {!BlockSvg} */ (super.getTopStackBlock());
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
/**
|
|
1689
|
-
* @param {boolean} ordered Sort the list if true.
|
|
1690
|
-
* @return {!Array<!BlockSvg>} Children of this block.
|
|
1691
|
-
* @override
|
|
1692
|
-
*/
|
|
1693
|
-
getChildren(ordered) {
|
|
1694
|
-
return /** @type {!Array<!BlockSvg>} */ (super.getChildren(ordered));
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
/**
|
|
1698
|
-
* @param {boolean} ordered Sort the list if true.
|
|
1699
|
-
* @return {!Array<!BlockSvg>} Descendants of this block.
|
|
1700
|
-
* @override
|
|
1701
|
-
*/
|
|
1702
|
-
getDescendants(ordered) {
|
|
1703
|
-
return /** @type {!Array<!BlockSvg>} */ (super.getDescendants(ordered));
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
/**
|
|
1707
|
-
* @param {string} name The name of the input.
|
|
1708
|
-
* @return {?BlockSvg} The attached value block, or null if the input is
|
|
1709
|
-
* either disconnected or if the input does not exist.
|
|
1710
|
-
* @override
|
|
1595
|
+
* @return The first statement connection or null.
|
|
1596
|
+
* @internal
|
|
1711
1597
|
*/
|
|
1712
|
-
|
|
1713
|
-
return
|
|
1598
|
+
override getFirstStatementConnection(): RenderedConnection|null {
|
|
1599
|
+
return super.getFirstStatementConnection() as RenderedConnection | null;
|
|
1714
1600
|
}
|
|
1715
1601
|
|
|
1716
1602
|
/**
|
|
1717
|
-
*
|
|
1718
|
-
*
|
|
1719
|
-
*
|
|
1720
|
-
*
|
|
1603
|
+
* Find all the blocks that are directly nested inside this one.
|
|
1604
|
+
* Includes value and statement inputs, as well as any following statement.
|
|
1605
|
+
* Excludes any connection on an output tab or any preceding statement.
|
|
1606
|
+
* Blocks are optionally sorted by position; top to bottom.
|
|
1607
|
+
* @param ordered Sort the list if true.
|
|
1608
|
+
* @return Array of blocks.
|
|
1721
1609
|
*/
|
|
1722
|
-
|
|
1723
|
-
return
|
|
1610
|
+
override getChildren(ordered: boolean): BlockSvg[] {
|
|
1611
|
+
return super.getChildren(ordered) as BlockSvg[];
|
|
1724
1612
|
}
|
|
1725
1613
|
|
|
1726
1614
|
/**
|
|
1727
1615
|
* Lays out and reflows a block based on its contents and settings.
|
|
1728
|
-
* @param
|
|
1616
|
+
* @param opt_bubble If false, just render this block.
|
|
1729
1617
|
* If true, also render block's parent, grandparent, etc. Defaults to true.
|
|
1730
1618
|
*/
|
|
1731
|
-
render(opt_bubble) {
|
|
1619
|
+
render(opt_bubble?: boolean) {
|
|
1732
1620
|
if (this.renderIsInProgress_) {
|
|
1733
1621
|
return; // Don't allow recursive renders.
|
|
1734
1622
|
}
|
|
@@ -1760,17 +1648,14 @@ class BlockSvg extends Block {
|
|
|
1760
1648
|
}
|
|
1761
1649
|
}
|
|
1762
1650
|
|
|
1763
|
-
/**
|
|
1764
|
-
|
|
1765
|
-
* @protected
|
|
1766
|
-
*/
|
|
1767
|
-
updateMarkers_() {
|
|
1651
|
+
/** Redraw any attached marker or cursor svgs if needed. */
|
|
1652
|
+
protected updateMarkers_() {
|
|
1768
1653
|
if (this.workspace.keyboardAccessibilityMode && this.pathObject.cursorSvg) {
|
|
1769
|
-
this.workspace.getCursor()
|
|
1654
|
+
this.workspace.getCursor()!.draw();
|
|
1770
1655
|
}
|
|
1771
1656
|
if (this.workspace.keyboardAccessibilityMode && this.pathObject.markerSvg) {
|
|
1772
1657
|
// TODO(#4592): Update all markers on the block.
|
|
1773
|
-
this.workspace.getMarker(MarkerManager.LOCAL_MARKER)
|
|
1658
|
+
this.workspace.getMarker(MarkerManager.LOCAL_MARKER)!.draw();
|
|
1774
1659
|
}
|
|
1775
1660
|
}
|
|
1776
1661
|
|
|
@@ -1778,9 +1663,8 @@ class BlockSvg extends Block {
|
|
|
1778
1663
|
* Update all of the connections on this block with the new locations
|
|
1779
1664
|
* calculated during rendering. Also move all of the connected blocks based
|
|
1780
1665
|
* on the new connection locations.
|
|
1781
|
-
* @private
|
|
1782
1666
|
*/
|
|
1783
|
-
updateConnectionLocations_() {
|
|
1667
|
+
private updateConnectionLocations_() {
|
|
1784
1668
|
const blockTL = this.getRelativeToSurfaceXY();
|
|
1785
1669
|
// Don't tighten previous or output connections because they are inferior
|
|
1786
1670
|
// connections.
|
|
@@ -1792,8 +1676,7 @@ class BlockSvg extends Block {
|
|
|
1792
1676
|
}
|
|
1793
1677
|
|
|
1794
1678
|
for (let i = 0; i < this.inputList.length; i++) {
|
|
1795
|
-
const conn =
|
|
1796
|
-
/** @type {!RenderedConnection} */ (this.inputList[i].connection);
|
|
1679
|
+
const conn = this.inputList[i].connection as RenderedConnection;
|
|
1797
1680
|
if (conn) {
|
|
1798
1681
|
conn.moveToOffset(blockTL);
|
|
1799
1682
|
if (conn.isConnected()) {
|
|
@@ -1812,83 +1695,64 @@ class BlockSvg extends Block {
|
|
|
1812
1695
|
|
|
1813
1696
|
/**
|
|
1814
1697
|
* Add the cursor SVG to this block's SVG group.
|
|
1815
|
-
* @param
|
|
1816
|
-
*
|
|
1817
|
-
* @
|
|
1698
|
+
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
|
|
1699
|
+
* group.
|
|
1700
|
+
* @internal
|
|
1818
1701
|
*/
|
|
1819
|
-
setCursorSvg(cursorSvg) {
|
|
1702
|
+
setCursorSvg(cursorSvg: SVGElement) {
|
|
1820
1703
|
this.pathObject.setCursorSvg(cursorSvg);
|
|
1821
1704
|
}
|
|
1822
1705
|
|
|
1823
1706
|
/**
|
|
1824
1707
|
* Add the marker SVG to this block's SVG group.
|
|
1825
|
-
* @param
|
|
1826
|
-
*
|
|
1827
|
-
* @
|
|
1708
|
+
* @param markerSvg The SVG root of the marker to be added to the block SVG
|
|
1709
|
+
* group.
|
|
1710
|
+
* @internal
|
|
1828
1711
|
*/
|
|
1829
|
-
setMarkerSvg(markerSvg) {
|
|
1712
|
+
setMarkerSvg(markerSvg: SVGElement) {
|
|
1830
1713
|
this.pathObject.setMarkerSvg(markerSvg);
|
|
1831
1714
|
}
|
|
1832
1715
|
|
|
1833
1716
|
/**
|
|
1834
1717
|
* Returns a bounding box describing the dimensions of this block
|
|
1835
1718
|
* and any blocks stacked below it.
|
|
1836
|
-
* @return
|
|
1837
|
-
*
|
|
1838
|
-
* @package
|
|
1719
|
+
* @return Object with height and width properties in workspace units.
|
|
1720
|
+
* @internal
|
|
1839
1721
|
*/
|
|
1840
|
-
getHeightWidth() {
|
|
1722
|
+
getHeightWidth(): {height: number, width: number} {
|
|
1841
1723
|
let height = this.height;
|
|
1842
1724
|
let width = this.width;
|
|
1843
1725
|
// Recursively add size of subsequent blocks.
|
|
1844
1726
|
const nextBlock = this.getNextBlock();
|
|
1845
1727
|
if (nextBlock) {
|
|
1846
1728
|
const nextHeightWidth = nextBlock.getHeightWidth();
|
|
1847
|
-
const
|
|
1848
|
-
|
|
1729
|
+
const tabHeight =
|
|
1730
|
+
this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;
|
|
1849
1731
|
height += nextHeightWidth.height - tabHeight;
|
|
1850
1732
|
width = Math.max(width, nextHeightWidth.width);
|
|
1851
1733
|
}
|
|
1852
|
-
return {height
|
|
1734
|
+
return {height, width};
|
|
1853
1735
|
}
|
|
1854
1736
|
|
|
1855
1737
|
/**
|
|
1856
1738
|
* Visual effect to show that if the dragging block is dropped, this block
|
|
1857
1739
|
* will be replaced. If a shadow block, it will disappear. Otherwise it will
|
|
1858
1740
|
* bump.
|
|
1859
|
-
* @param
|
|
1860
|
-
* @
|
|
1741
|
+
* @param add True if highlighting should be added.
|
|
1742
|
+
* @internal
|
|
1861
1743
|
*/
|
|
1862
|
-
fadeForReplacement(add) {
|
|
1744
|
+
fadeForReplacement(add: boolean) {
|
|
1863
1745
|
this.pathObject.updateReplacementFade(add);
|
|
1864
1746
|
}
|
|
1865
1747
|
|
|
1866
1748
|
/**
|
|
1867
1749
|
* Visual effect to show that if the dragging block is dropped it will connect
|
|
1868
1750
|
* to this input.
|
|
1869
|
-
* @param
|
|
1870
|
-
* @param
|
|
1871
|
-
* @
|
|
1751
|
+
* @param conn The connection on the input to highlight.
|
|
1752
|
+
* @param add True if highlighting should be added.
|
|
1753
|
+
* @internal
|
|
1872
1754
|
*/
|
|
1873
|
-
highlightShapeForInput(conn, add) {
|
|
1755
|
+
highlightShapeForInput(conn: Connection, add: boolean) {
|
|
1874
1756
|
this.pathObject.updateShapeForInputHighlight(conn, add);
|
|
1875
1757
|
}
|
|
1876
1758
|
}
|
|
1877
|
-
|
|
1878
|
-
/**
|
|
1879
|
-
* Constant for identifying rows that are to be rendered inline.
|
|
1880
|
-
* Don't collide with Blockly.inputTypes.
|
|
1881
|
-
* @const
|
|
1882
|
-
*/
|
|
1883
|
-
BlockSvg.INLINE = -1;
|
|
1884
|
-
|
|
1885
|
-
/**
|
|
1886
|
-
* ID to give the "collapsed warnings" warning. Allows us to remove the
|
|
1887
|
-
* "collapsed warnings" warning without removing any warnings that belong to
|
|
1888
|
-
* the block.
|
|
1889
|
-
* @type {string}
|
|
1890
|
-
* @const
|
|
1891
|
-
*/
|
|
1892
|
-
BlockSvg.COLLAPSED_WARNING_ID = 'TEMP_COLLAPSED_WARNING_';
|
|
1893
|
-
|
|
1894
|
-
exports.BlockSvg = BlockSvg;
|