scratch-blocks 1.1.206 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +0 -3
- package/CHANGELOG.md +111 -833
- package/TODO.md +16 -0
- package/blockly-rc/.eslintignore +28 -0
- package/blockly-rc/.eslintrc.js +187 -0
- package/blockly-rc/.gitattributes +1 -0
- package/blockly-rc/.github/CODEOWNERS +1 -0
- package/blockly-rc/.github/CONTRIBUTING.md +46 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/bug_report.yaml +58 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/config.yml +7 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/documentation.yaml +38 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/feature_request.yaml +39 -0
- package/blockly-rc/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/blockly-rc/.github/dependabot.yml +27 -0
- package/blockly-rc/.github/release.yml +32 -0
- package/blockly-rc/.github/workflows/appengine_deploy.yml +54 -0
- package/blockly-rc/.github/workflows/assign_reviewers.yml +41 -0
- package/blockly-rc/.github/workflows/browser_test.yml +55 -0
- package/blockly-rc/.github/workflows/build.yml +86 -0
- package/blockly-rc/.github/workflows/conventional-label.yml +17 -0
- package/blockly-rc/.github/workflows/develop_freeze.yml +26 -0
- package/blockly-rc/.github/workflows/tag_module_cleanup.yml +37 -0
- package/blockly-rc/.github/workflows/welcome_new_contributors.yml +36 -0
- package/blockly-rc/.prettierignore +30 -0
- package/blockly-rc/.prettierrc.js +13 -0
- package/blockly-rc/CHANGELOG.md +77 -0
- package/blockly-rc/LICENSE +202 -0
- package/blockly-rc/README.md +80 -0
- package/blockly-rc/_config.yml +1 -0
- package/blockly-rc/api-extractor.json +385 -0
- package/blockly-rc/appengine/.gcloudignore +20 -0
- package/blockly-rc/appengine/README.txt +42 -0
- package/blockly-rc/appengine/add_timestamps.py +69 -0
- package/blockly-rc/appengine/app.yaml +104 -0
- package/blockly-rc/appengine/apple-touch-icon.png +0 -0
- package/blockly-rc/appengine/blockly_compressed.js +11 -0
- package/blockly-rc/appengine/expiration.py +52 -0
- package/blockly-rc/appengine/favicon.ico +0 -0
- package/blockly-rc/appengine/index.yaml +11 -0
- package/blockly-rc/appengine/main.py +39 -0
- package/blockly-rc/appengine/redirect.html +107 -0
- package/blockly-rc/appengine/requirements.txt +1 -0
- package/blockly-rc/appengine/robots.txt +2 -0
- package/blockly-rc/appengine/storage.js +190 -0
- package/blockly-rc/appengine/storage.py +125 -0
- package/blockly-rc/blocks/blocks.ts +44 -0
- package/blockly-rc/blocks/lists.ts +1085 -0
- package/blockly-rc/blocks/logic.ts +712 -0
- package/blockly-rc/blocks/loops.ts +408 -0
- package/blockly-rc/blocks/math.ts +591 -0
- package/blockly-rc/blocks/procedures.ts +1364 -0
- package/blockly-rc/blocks/text.ts +1007 -0
- package/blockly-rc/blocks/variables.ts +183 -0
- package/blockly-rc/blocks/variables_dynamic.ts +194 -0
- package/blockly-rc/core/any_aliases.ts +8 -0
- package/blockly-rc/core/block.ts +2523 -0
- package/blockly-rc/core/block_animations.ts +225 -0
- package/blockly-rc/core/block_flyout_inflater.ts +262 -0
- package/blockly-rc/core/block_svg.ts +1768 -0
- package/blockly-rc/core/blockly.ts +605 -0
- package/blockly-rc/core/blockly_options.ts +71 -0
- package/blockly-rc/core/blocks.ts +18 -0
- package/blockly-rc/core/browser_events.ts +244 -0
- package/blockly-rc/core/bubbles/bubble.ts +658 -0
- package/blockly-rc/core/bubbles/mini_workspace_bubble.ts +280 -0
- package/blockly-rc/core/bubbles/text_bubble.ts +103 -0
- package/blockly-rc/core/bubbles/textinput_bubble.ts +344 -0
- package/blockly-rc/core/bubbles.ts +12 -0
- package/blockly-rc/core/bump_objects.ts +192 -0
- package/blockly-rc/core/button_flyout_inflater.ts +63 -0
- package/blockly-rc/core/clipboard/block_paster.ts +142 -0
- package/blockly-rc/core/clipboard/registry.ts +31 -0
- package/blockly-rc/core/clipboard/workspace_comment_paster.ts +94 -0
- package/blockly-rc/core/clipboard.ts +113 -0
- package/blockly-rc/core/comments/comment_view.ts +899 -0
- package/blockly-rc/core/comments/rendered_workspace_comment.ts +297 -0
- package/blockly-rc/core/comments/workspace_comment.ts +237 -0
- package/blockly-rc/core/comments.ts +9 -0
- package/blockly-rc/core/common.ts +305 -0
- package/blockly-rc/core/component_manager.ts +235 -0
- package/blockly-rc/core/config.ts +65 -0
- package/blockly-rc/core/connection.ts +793 -0
- package/blockly-rc/core/connection_checker.ts +348 -0
- package/blockly-rc/core/connection_db.ts +297 -0
- package/blockly-rc/core/connection_type.ts +21 -0
- package/blockly-rc/core/constants.ts +23 -0
- package/blockly-rc/core/contextmenu.ts +268 -0
- package/blockly-rc/core/contextmenu_items.ts +700 -0
- package/blockly-rc/core/contextmenu_registry.ts +194 -0
- package/blockly-rc/core/css.ts +481 -0
- package/blockly-rc/core/delete_area.ts +77 -0
- package/blockly-rc/core/dialog.ts +121 -0
- package/blockly-rc/core/drag_target.ts +97 -0
- package/blockly-rc/core/dragging/block_drag_strategy.ts +454 -0
- package/blockly-rc/core/dragging/bubble_drag_strategy.ts +52 -0
- package/blockly-rc/core/dragging/comment_drag_strategy.ts +91 -0
- package/blockly-rc/core/dragging/dragger.ts +163 -0
- package/blockly-rc/core/dragging.ts +12 -0
- package/blockly-rc/core/dropdowndiv.ts +768 -0
- package/blockly-rc/core/events/events.ts +163 -0
- package/blockly-rc/core/events/events_abstract.ts +130 -0
- package/blockly-rc/core/events/events_block_base.ts +88 -0
- package/blockly-rc/core/events/events_block_change.ts +259 -0
- package/blockly-rc/core/events/events_block_create.ts +185 -0
- package/blockly-rc/core/events/events_block_delete.ts +182 -0
- package/blockly-rc/core/events/events_block_drag.ts +116 -0
- package/blockly-rc/core/events/events_block_field_intermediate_change.ts +167 -0
- package/blockly-rc/core/events/events_block_move.ts +307 -0
- package/blockly-rc/core/events/events_bubble_open.ts +120 -0
- package/blockly-rc/core/events/events_click.ts +110 -0
- package/blockly-rc/core/events/events_comment_base.ts +126 -0
- package/blockly-rc/core/events/events_comment_change.ts +161 -0
- package/blockly-rc/core/events/events_comment_collapse.ts +103 -0
- package/blockly-rc/core/events/events_comment_create.ts +118 -0
- package/blockly-rc/core/events/events_comment_delete.ts +117 -0
- package/blockly-rc/core/events/events_comment_drag.ts +99 -0
- package/blockly-rc/core/events/events_comment_move.ts +207 -0
- package/blockly-rc/core/events/events_comment_resize.ts +174 -0
- package/blockly-rc/core/events/events_marker_move.ts +134 -0
- package/blockly-rc/core/events/events_selected.ts +98 -0
- package/blockly-rc/core/events/events_theme_change.ts +84 -0
- package/blockly-rc/core/events/events_toolbox_item_select.ts +96 -0
- package/blockly-rc/core/events/events_trashcan_open.ts +88 -0
- package/blockly-rc/core/events/events_ui_base.ts +47 -0
- package/blockly-rc/core/events/events_var_base.ts +89 -0
- package/blockly-rc/core/events/events_var_create.ts +129 -0
- package/blockly-rc/core/events/events_var_delete.ts +124 -0
- package/blockly-rc/core/events/events_var_rename.ts +133 -0
- package/blockly-rc/core/events/events_var_type_change.ts +122 -0
- package/blockly-rc/core/events/events_viewport.ts +149 -0
- package/blockly-rc/core/events/utils.ts +595 -0
- package/blockly-rc/core/events/workspace_events.ts +46 -0
- package/blockly-rc/core/extensions.ts +491 -0
- package/blockly-rc/core/field.ts +1471 -0
- package/blockly-rc/core/field_checkbox.ts +271 -0
- package/blockly-rc/core/field_dropdown.ts +857 -0
- package/blockly-rc/core/field_image.ts +297 -0
- package/blockly-rc/core/field_input.ts +755 -0
- package/blockly-rc/core/field_label.ts +150 -0
- package/blockly-rc/core/field_label_serializable.ts +73 -0
- package/blockly-rc/core/field_number.ts +381 -0
- package/blockly-rc/core/field_registry.ts +115 -0
- package/blockly-rc/core/field_textinput.ts +117 -0
- package/blockly-rc/core/field_variable.ts +651 -0
- package/blockly-rc/core/flyout_base.ts +968 -0
- package/blockly-rc/core/flyout_button.ts +416 -0
- package/blockly-rc/core/flyout_horizontal.ts +374 -0
- package/blockly-rc/core/flyout_metrics_manager.ts +90 -0
- package/blockly-rc/core/flyout_separator.ts +61 -0
- package/blockly-rc/core/flyout_vertical.ts +353 -0
- package/blockly-rc/core/generator.ts +611 -0
- package/blockly-rc/core/gesture.ts +1191 -0
- package/blockly-rc/core/grid.ts +252 -0
- package/blockly-rc/core/icons/comment_icon.ts +435 -0
- package/blockly-rc/core/icons/exceptions.ts +23 -0
- package/blockly-rc/core/icons/icon.ts +147 -0
- package/blockly-rc/core/icons/icon_types.ts +32 -0
- package/blockly-rc/core/icons/mutator_icon.ts +354 -0
- package/blockly-rc/core/icons/registry.ts +33 -0
- package/blockly-rc/core/icons/warning_icon.ts +219 -0
- package/blockly-rc/core/icons.ts +24 -0
- package/blockly-rc/core/inject.ts +428 -0
- package/blockly-rc/core/inputs/align.ts +14 -0
- package/blockly-rc/core/inputs/dummy_input.ts +26 -0
- package/blockly-rc/core/inputs/end_row_input.ts +31 -0
- package/blockly-rc/core/inputs/input.ts +318 -0
- package/blockly-rc/core/inputs/input_types.ts +27 -0
- package/blockly-rc/core/inputs/statement_input.ts +34 -0
- package/blockly-rc/core/inputs/value_input.ts +30 -0
- package/blockly-rc/core/inputs.ts +23 -0
- package/blockly-rc/core/insertion_marker_manager.ts +742 -0
- package/blockly-rc/core/insertion_marker_previewer.ts +254 -0
- package/blockly-rc/core/interfaces/i_ast_node_location.ts +12 -0
- package/blockly-rc/core/interfaces/i_ast_node_location_svg.ts +28 -0
- package/blockly-rc/core/interfaces/i_ast_node_location_with_block.ts +22 -0
- package/blockly-rc/core/interfaces/i_autohideable.ts +22 -0
- package/blockly-rc/core/interfaces/i_bounded_element.ts +30 -0
- package/blockly-rc/core/interfaces/i_bubble.ts +63 -0
- package/blockly-rc/core/interfaces/i_collapsible_toolbox_item.ts +33 -0
- package/blockly-rc/core/interfaces/i_comment_icon.ts +47 -0
- package/blockly-rc/core/interfaces/i_component.ts +19 -0
- package/blockly-rc/core/interfaces/i_connection_checker.ts +100 -0
- package/blockly-rc/core/interfaces/i_connection_previewer.ts +50 -0
- package/blockly-rc/core/interfaces/i_contextmenu.ts +16 -0
- package/blockly-rc/core/interfaces/i_copyable.ts +31 -0
- package/blockly-rc/core/interfaces/i_deletable.ts +34 -0
- package/blockly-rc/core/interfaces/i_delete_area.ts +28 -0
- package/blockly-rc/core/interfaces/i_drag_target.ts +69 -0
- package/blockly-rc/core/interfaces/i_draggable.ts +72 -0
- package/blockly-rc/core/interfaces/i_dragger.ts +35 -0
- package/blockly-rc/core/interfaces/i_flyout.ts +189 -0
- package/blockly-rc/core/interfaces/i_flyout_inflater.ts +41 -0
- package/blockly-rc/core/interfaces/i_has_bubble.ts +20 -0
- package/blockly-rc/core/interfaces/i_icon.ts +114 -0
- package/blockly-rc/core/interfaces/i_keyboard_accessible.ts +21 -0
- package/blockly-rc/core/interfaces/i_legacy_procedure_blocks.ts +50 -0
- package/blockly-rc/core/interfaces/i_metrics_manager.ts +149 -0
- package/blockly-rc/core/interfaces/i_movable.ts +19 -0
- package/blockly-rc/core/interfaces/i_observable.ts +24 -0
- package/blockly-rc/core/interfaces/i_parameter_model.ts +51 -0
- package/blockly-rc/core/interfaces/i_paster.ts +25 -0
- package/blockly-rc/core/interfaces/i_positionable.ts +33 -0
- package/blockly-rc/core/interfaces/i_procedure_block.ts +27 -0
- package/blockly-rc/core/interfaces/i_procedure_map.ts +18 -0
- package/blockly-rc/core/interfaces/i_procedure_model.ts +71 -0
- package/blockly-rc/core/interfaces/i_registrable.ts +12 -0
- package/blockly-rc/core/interfaces/i_rendered_element.ts +22 -0
- package/blockly-rc/core/interfaces/i_selectable.ts +34 -0
- package/blockly-rc/core/interfaces/i_selectable_toolbox_item.ts +63 -0
- package/blockly-rc/core/interfaces/i_serializable.ts +28 -0
- package/blockly-rc/core/interfaces/i_serializer.ts +55 -0
- package/blockly-rc/core/interfaces/i_styleable.ts +26 -0
- package/blockly-rc/core/interfaces/i_toolbox.ts +112 -0
- package/blockly-rc/core/interfaces/i_toolbox_item.ts +81 -0
- package/blockly-rc/core/interfaces/i_variable_backed_parameter_model.ts +23 -0
- package/blockly-rc/core/interfaces/i_variable_map.ts +65 -0
- package/blockly-rc/core/interfaces/i_variable_model.ts +57 -0
- package/blockly-rc/core/internal_constants.ts +47 -0
- package/blockly-rc/core/keyboard_nav/ast_node.ts +884 -0
- package/blockly-rc/core/keyboard_nav/basic_cursor.ts +223 -0
- package/blockly-rc/core/keyboard_nav/cursor.ts +138 -0
- package/blockly-rc/core/keyboard_nav/marker.ts +113 -0
- package/blockly-rc/core/keyboard_nav/tab_navigate_cursor.ts +46 -0
- package/blockly-rc/core/label_flyout_inflater.ts +59 -0
- package/blockly-rc/core/layer_manager.ts +186 -0
- package/blockly-rc/core/layers.ts +17 -0
- package/blockly-rc/core/main.ts +31 -0
- package/blockly-rc/core/marker_manager.ts +189 -0
- package/blockly-rc/core/menu.ts +463 -0
- package/blockly-rc/core/menuitem.ts +221 -0
- package/blockly-rc/core/metrics_manager.ts +486 -0
- package/blockly-rc/core/msg.ts +27 -0
- package/blockly-rc/core/names.ts +275 -0
- package/blockly-rc/core/observable_procedure_map.ts +66 -0
- package/blockly-rc/core/options.ts +377 -0
- package/blockly-rc/core/positionable_helpers.ts +186 -0
- package/blockly-rc/core/procedures.ts +510 -0
- package/blockly-rc/core/registry.ts +400 -0
- package/blockly-rc/core/render_management.ts +193 -0
- package/blockly-rc/core/rendered_connection.ts +571 -0
- package/blockly-rc/core/renderers/common/block_rendering.ts +120 -0
- package/blockly-rc/core/renderers/common/constants.ts +1198 -0
- package/blockly-rc/core/renderers/common/drawer.ts +518 -0
- package/blockly-rc/core/renderers/common/i_path_object.ts +137 -0
- package/blockly-rc/core/renderers/common/info.ts +767 -0
- package/blockly-rc/core/renderers/common/marker_svg.ts +765 -0
- package/blockly-rc/core/renderers/common/path_object.ts +324 -0
- package/blockly-rc/core/renderers/common/renderer.ts +281 -0
- package/blockly-rc/core/renderers/geras/constants.ts +46 -0
- package/blockly-rc/core/renderers/geras/drawer.ts +167 -0
- package/blockly-rc/core/renderers/geras/geras.ts +31 -0
- package/blockly-rc/core/renderers/geras/highlight_constants.ts +342 -0
- package/blockly-rc/core/renderers/geras/highlighter.ts +313 -0
- package/blockly-rc/core/renderers/geras/info.ts +478 -0
- package/blockly-rc/core/renderers/geras/measurables/inline_input.ts +37 -0
- package/blockly-rc/core/renderers/geras/measurables/statement_input.ts +36 -0
- package/blockly-rc/core/renderers/geras/path_object.ts +135 -0
- package/blockly-rc/core/renderers/geras/renderer.ts +124 -0
- package/blockly-rc/core/renderers/measurables/base.ts +41 -0
- package/blockly-rc/core/renderers/measurables/bottom_row.ts +104 -0
- package/blockly-rc/core/renderers/measurables/connection.ts +43 -0
- package/blockly-rc/core/renderers/measurables/external_value_input.ts +53 -0
- package/blockly-rc/core/renderers/measurables/field.ts +50 -0
- package/blockly-rc/core/renderers/measurables/hat.ts +33 -0
- package/blockly-rc/core/renderers/measurables/icon.ts +42 -0
- package/blockly-rc/core/renderers/measurables/in_row_spacer.ts +29 -0
- package/blockly-rc/core/renderers/measurables/inline_input.ts +63 -0
- package/blockly-rc/core/renderers/measurables/input_connection.ts +57 -0
- package/blockly-rc/core/renderers/measurables/input_row.ts +67 -0
- package/blockly-rc/core/renderers/measurables/jagged_edge.ts +28 -0
- package/blockly-rc/core/renderers/measurables/next_connection.ts +34 -0
- package/blockly-rc/core/renderers/measurables/output_connection.ts +43 -0
- package/blockly-rc/core/renderers/measurables/previous_connection.ts +34 -0
- package/blockly-rc/core/renderers/measurables/round_corner.ts +34 -0
- package/blockly-rc/core/renderers/measurables/row.ts +191 -0
- package/blockly-rc/core/renderers/measurables/spacer_row.ts +44 -0
- package/blockly-rc/core/renderers/measurables/square_corner.ts +32 -0
- package/blockly-rc/core/renderers/measurables/statement_input.ts +41 -0
- package/blockly-rc/core/renderers/measurables/top_row.ts +110 -0
- package/blockly-rc/core/renderers/measurables/types.ts +319 -0
- package/blockly-rc/core/renderers/thrasos/info.ts +328 -0
- package/blockly-rc/core/renderers/thrasos/renderer.ts +40 -0
- package/blockly-rc/core/renderers/thrasos/thrasos.ts +14 -0
- package/blockly-rc/core/renderers/zelos/constants.ts +877 -0
- package/blockly-rc/core/renderers/zelos/drawer.ts +274 -0
- package/blockly-rc/core/renderers/zelos/info.ts +652 -0
- package/blockly-rc/core/renderers/zelos/marker_svg.ts +145 -0
- package/blockly-rc/core/renderers/zelos/measurables/bottom_row.ts +44 -0
- package/blockly-rc/core/renderers/zelos/measurables/inputs.ts +41 -0
- package/blockly-rc/core/renderers/zelos/measurables/row_elements.ts +29 -0
- package/blockly-rc/core/renderers/zelos/measurables/top_row.ts +50 -0
- package/blockly-rc/core/renderers/zelos/path_object.ts +209 -0
- package/blockly-rc/core/renderers/zelos/renderer.ts +143 -0
- package/blockly-rc/core/renderers/zelos/zelos.ts +33 -0
- package/blockly-rc/core/scrollbar.ts +898 -0
- package/blockly-rc/core/scrollbar_pair.ts +349 -0
- package/blockly-rc/core/separator_flyout_inflater.ts +69 -0
- package/blockly-rc/core/serialization/blocks.ts +868 -0
- package/blockly-rc/core/serialization/exceptions.ts +112 -0
- package/blockly-rc/core/serialization/priorities.ts +25 -0
- package/blockly-rc/core/serialization/procedures.ts +158 -0
- package/blockly-rc/core/serialization/registry.ts +30 -0
- package/blockly-rc/core/serialization/variables.ts +68 -0
- package/blockly-rc/core/serialization/workspace_comments.ts +143 -0
- package/blockly-rc/core/serialization/workspaces.ts +94 -0
- package/blockly-rc/core/serialization.ts +32 -0
- package/blockly-rc/core/shortcut_items.ts +338 -0
- package/blockly-rc/core/shortcut_registry.ts +368 -0
- package/blockly-rc/core/sprites.ts +15 -0
- package/blockly-rc/core/theme/classic.ts +40 -0
- package/blockly-rc/core/theme/themes.ts +12 -0
- package/blockly-rc/core/theme/zelos.ts +80 -0
- package/blockly-rc/core/theme.ts +232 -0
- package/blockly-rc/core/theme_manager.ts +192 -0
- package/blockly-rc/core/toolbox/category.ts +739 -0
- package/blockly-rc/core/toolbox/collapsible_category.ts +288 -0
- package/blockly-rc/core/toolbox/separator.ts +105 -0
- package/blockly-rc/core/toolbox/toolbox.ts +1134 -0
- package/blockly-rc/core/toolbox/toolbox_item.ts +152 -0
- package/blockly-rc/core/tooltip.ts +466 -0
- package/blockly-rc/core/touch.ts +155 -0
- package/blockly-rc/core/trashcan.ts +748 -0
- package/blockly-rc/core/utils/aria.ts +144 -0
- package/blockly-rc/core/utils/array.ts +24 -0
- package/blockly-rc/core/utils/colour.ts +265 -0
- package/blockly-rc/core/utils/coordinate.ts +129 -0
- package/blockly-rc/core/utils/deprecation.ts +47 -0
- package/blockly-rc/core/utils/dom.ts +356 -0
- package/blockly-rc/core/utils/idgenerator.ts +70 -0
- package/blockly-rc/core/utils/keycodes.ts +154 -0
- package/blockly-rc/core/utils/math.ts +50 -0
- package/blockly-rc/core/utils/metrics.ts +86 -0
- package/blockly-rc/core/utils/object.ts +28 -0
- package/blockly-rc/core/utils/parsing.ts +287 -0
- package/blockly-rc/core/utils/rect.ts +69 -0
- package/blockly-rc/core/utils/size.ts +62 -0
- package/blockly-rc/core/utils/string.ts +289 -0
- package/blockly-rc/core/utils/style.ts +219 -0
- package/blockly-rc/core/utils/svg.ts +84 -0
- package/blockly-rc/core/utils/svg_math.ts +208 -0
- package/blockly-rc/core/utils/svg_paths.ts +133 -0
- package/blockly-rc/core/utils/toolbox.ts +419 -0
- package/blockly-rc/core/utils/useragent.ts +86 -0
- package/blockly-rc/core/utils/xml.ts +165 -0
- package/blockly-rc/core/utils.ts +59 -0
- package/blockly-rc/core/variable_map.ts +437 -0
- package/blockly-rc/core/variable_model.ts +149 -0
- package/blockly-rc/core/variables.ts +773 -0
- package/blockly-rc/core/variables_dynamic.ts +142 -0
- package/blockly-rc/core/widgetdiv.ts +319 -0
- package/blockly-rc/core/workspace.ts +957 -0
- package/blockly-rc/core/workspace_audio.ts +171 -0
- package/blockly-rc/core/workspace_dragger.ts +97 -0
- package/blockly-rc/core/workspace_svg.ts +2519 -0
- package/blockly-rc/core/xml.ts +1133 -0
- package/blockly-rc/core/zoom_controls.ts +492 -0
- package/blockly-rc/demos/blockfactory/analytics.js +195 -0
- package/blockly-rc/demos/blockfactory/app_controller.js +726 -0
- package/blockly-rc/demos/blockfactory/block_definition_extractor.js +742 -0
- package/blockly-rc/demos/blockfactory/block_exporter_controller.js +311 -0
- package/blockly-rc/demos/blockfactory/block_exporter_tools.js +212 -0
- package/blockly-rc/demos/blockfactory/block_exporter_view.js +101 -0
- package/blockly-rc/demos/blockfactory/block_library_controller.js +325 -0
- package/blockly-rc/demos/blockfactory/block_library_storage.js +149 -0
- package/blockly-rc/demos/blockfactory/block_library_view.js +178 -0
- package/blockly-rc/demos/blockfactory/block_option.js +151 -0
- package/blockly-rc/demos/blockfactory/blocks.js +916 -0
- package/blockly-rc/demos/blockfactory/cp.css +46 -0
- package/blockly-rc/demos/blockfactory/cp.js +179 -0
- package/blockly-rc/demos/blockfactory/factory.css +586 -0
- package/blockly-rc/demos/blockfactory/factory.js +337 -0
- package/blockly-rc/demos/blockfactory/factory_utils.js +1036 -0
- package/blockly-rc/demos/blockfactory/icon.png +0 -0
- package/blockly-rc/demos/blockfactory/index.html +767 -0
- package/blockly-rc/demos/blockfactory/link.png +0 -0
- package/blockly-rc/demos/blockfactory/standard_categories.js +384 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_controller.js +1332 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_generator.js +224 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_init.js +541 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_model.js +548 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_view.js +424 -0
- package/blockly-rc/demos/code/code.js +626 -0
- package/blockly-rc/demos/code/icon.png +0 -0
- package/blockly-rc/demos/code/icons.png +0 -0
- package/blockly-rc/demos/code/index.html +359 -0
- package/blockly-rc/demos/code/msg/ar.js +24 -0
- package/blockly-rc/demos/code/msg/be-tarask.js +24 -0
- package/blockly-rc/demos/code/msg/br.js +24 -0
- package/blockly-rc/demos/code/msg/ca.js +24 -0
- package/blockly-rc/demos/code/msg/cs.js +24 -0
- package/blockly-rc/demos/code/msg/da.js +24 -0
- package/blockly-rc/demos/code/msg/de.js +24 -0
- package/blockly-rc/demos/code/msg/el.js +24 -0
- package/blockly-rc/demos/code/msg/en.js +24 -0
- package/blockly-rc/demos/code/msg/es.js +24 -0
- package/blockly-rc/demos/code/msg/et.js +24 -0
- package/blockly-rc/demos/code/msg/fa.js +24 -0
- package/blockly-rc/demos/code/msg/fr.js +24 -0
- package/blockly-rc/demos/code/msg/he.js +24 -0
- package/blockly-rc/demos/code/msg/hr.js +24 -0
- package/blockly-rc/demos/code/msg/hrx.js +24 -0
- package/blockly-rc/demos/code/msg/hu.js +24 -0
- package/blockly-rc/demos/code/msg/ia.js +24 -0
- package/blockly-rc/demos/code/msg/is.js +24 -0
- package/blockly-rc/demos/code/msg/it.js +24 -0
- package/blockly-rc/demos/code/msg/ja.js +24 -0
- package/blockly-rc/demos/code/msg/kab.js +24 -0
- package/blockly-rc/demos/code/msg/ko.js +24 -0
- package/blockly-rc/demos/code/msg/mk.js +24 -0
- package/blockly-rc/demos/code/msg/ms.js +24 -0
- package/blockly-rc/demos/code/msg/nb.js +24 -0
- package/blockly-rc/demos/code/msg/nl.js +24 -0
- package/blockly-rc/demos/code/msg/oc.js +24 -0
- package/blockly-rc/demos/code/msg/pl.js +24 -0
- package/blockly-rc/demos/code/msg/pms.js +24 -0
- package/blockly-rc/demos/code/msg/pt-br.js +24 -0
- package/blockly-rc/demos/code/msg/ro.js +24 -0
- package/blockly-rc/demos/code/msg/ru.js +24 -0
- package/blockly-rc/demos/code/msg/sc.js +24 -0
- package/blockly-rc/demos/code/msg/sk.js +24 -0
- package/blockly-rc/demos/code/msg/sr.js +24 -0
- package/blockly-rc/demos/code/msg/sv.js +24 -0
- package/blockly-rc/demos/code/msg/ta.js +24 -0
- package/blockly-rc/demos/code/msg/th.js +24 -0
- package/blockly-rc/demos/code/msg/tlh.js +24 -0
- package/blockly-rc/demos/code/msg/tr.js +24 -0
- package/blockly-rc/demos/code/msg/uk.js +24 -0
- package/blockly-rc/demos/code/msg/vi.js +24 -0
- package/blockly-rc/demos/code/msg/zh-hans.js +24 -0
- package/blockly-rc/demos/code/msg/zh-hant.js +24 -0
- package/blockly-rc/demos/code/style.css +184 -0
- package/blockly-rc/demos/index.html +68 -0
- package/blockly-rc/demos/minimap/icon.png +0 -0
- package/blockly-rc/demos/minimap/index.html +91 -0
- package/blockly-rc/demos/minimap/minimap.js +302 -0
- package/blockly-rc/demos/mobile/README.md +53 -0
- package/blockly-rc/demos/mobile/android/README.md +45 -0
- package/blockly-rc/demos/mobile/android/app/build.gradle +64 -0
- package/blockly-rc/demos/mobile/android/app/proguard-rules.pro +21 -0
- package/blockly-rc/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java +26 -0
- package/blockly-rc/demos/mobile/android/app/src/main/AndroidManifest.xml +21 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java +40 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java +150 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java +32 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java +18 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml +74 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/layout/activity_main.xml +17 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/layout/js_prompt.xml +37 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/colors.xml +6 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml +7 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/strings.xml +3 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/styles.xml +11 -0
- package/blockly-rc/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java +17 -0
- package/blockly-rc/demos/mobile/android/build.gradle +27 -0
- package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/blockly-rc/demos/mobile/android/gradle.properties +13 -0
- package/blockly-rc/demos/mobile/android/gradlew +172 -0
- package/blockly-rc/demos/mobile/android/gradlew.bat +84 -0
- package/blockly-rc/demos/mobile/android/settings.gradle +1 -0
- package/blockly-rc/demos/mobile/html/index.html +31 -0
- package/blockly-rc/demos/mobile/html/ln_resources.sh +22 -0
- package/blockly-rc/demos/mobile/html/toolbox_standard.js +333 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/AppDelegate.swift +46 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json +6 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard +25 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard +44 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Info.plist +45 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/ViewController.swift +110 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj +390 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/blockly-rc/demos/mobile/ios/cp_resources.sh +21 -0
- package/blockly-rc/demos/storage/icon.png +0 -0
- package/blockly-rc/demos/storage/index.html +104 -0
- package/blockly-rc/generators/dart/dart_generator.ts +321 -0
- package/blockly-rc/generators/dart/lists.ts +525 -0
- package/blockly-rc/generators/dart/logic.ts +155 -0
- package/blockly-rc/generators/dart/loops.ts +217 -0
- package/blockly-rc/generators/dart/math.ts +559 -0
- package/blockly-rc/generators/dart/procedures.ts +138 -0
- package/blockly-rc/generators/dart/text.ts +405 -0
- package/blockly-rc/generators/dart/variables.ts +32 -0
- package/blockly-rc/generators/dart/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/dart.ts +50 -0
- package/blockly-rc/generators/javascript/javascript_generator.ts +346 -0
- package/blockly-rc/generators/javascript/lists.ts +465 -0
- package/blockly-rc/generators/javascript/logic.ts +153 -0
- package/blockly-rc/generators/javascript/loops.ts +245 -0
- package/blockly-rc/generators/javascript/math.ts +450 -0
- package/blockly-rc/generators/javascript/procedures.ts +142 -0
- package/blockly-rc/generators/javascript/text.ts +418 -0
- package/blockly-rc/generators/javascript/variables.ts +32 -0
- package/blockly-rc/generators/javascript/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/javascript.ts +46 -0
- package/blockly-rc/generators/lua/lists.ts +445 -0
- package/blockly-rc/generators/lua/logic.ts +142 -0
- package/blockly-rc/generators/lua/loops.ts +192 -0
- package/blockly-rc/generators/lua/lua_generator.ts +225 -0
- package/blockly-rc/generators/lua/math.ts +473 -0
- package/blockly-rc/generators/lua/procedures.ts +144 -0
- package/blockly-rc/generators/lua/text.ts +380 -0
- package/blockly-rc/generators/lua/variables.ts +31 -0
- package/blockly-rc/generators/lua/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/lua.ts +44 -0
- package/blockly-rc/generators/php/lists.ts +585 -0
- package/blockly-rc/generators/php/logic.ts +155 -0
- package/blockly-rc/generators/php/loops.ts +218 -0
- package/blockly-rc/generators/php/math.ts +408 -0
- package/blockly-rc/generators/php/php_generator.ts +320 -0
- package/blockly-rc/generators/php/procedures.ts +159 -0
- package/blockly-rc/generators/php/text.ts +315 -0
- package/blockly-rc/generators/php/variables.ts +32 -0
- package/blockly-rc/generators/php/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/php.ts +46 -0
- package/blockly-rc/generators/python/lists.ts +398 -0
- package/blockly-rc/generators/python/logic.ts +148 -0
- package/blockly-rc/generators/python/loops.ts +251 -0
- package/blockly-rc/generators/python/math.ts +434 -0
- package/blockly-rc/generators/python/procedures.ts +159 -0
- package/blockly-rc/generators/python/python_generator.ts +355 -0
- package/blockly-rc/generators/python/text.ts +338 -0
- package/blockly-rc/generators/python/variables.ts +31 -0
- package/blockly-rc/generators/python/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/python.ts +51 -0
- package/blockly-rc/gulpfile.js +54 -0
- package/blockly-rc/jsconfig.json +7 -0
- package/blockly-rc/media/1x1.gif +0 -0
- package/blockly-rc/media/click.mp3 +0 -0
- package/blockly-rc/media/click.ogg +0 -0
- package/blockly-rc/media/click.wav +0 -0
- package/blockly-rc/media/delete-icon.svg +1 -0
- package/blockly-rc/media/delete.mp3 +0 -0
- package/blockly-rc/media/delete.ogg +0 -0
- package/blockly-rc/media/delete.wav +0 -0
- package/blockly-rc/media/disconnect.mp3 +0 -0
- package/blockly-rc/media/disconnect.ogg +0 -0
- package/blockly-rc/media/disconnect.wav +0 -0
- package/blockly-rc/media/dropdown-arrow.svg +1 -0
- package/blockly-rc/media/foldout-icon.svg +1 -0
- package/blockly-rc/media/handclosed.cur +0 -0
- package/blockly-rc/media/handdelete.cur +0 -0
- package/blockly-rc/media/handopen.cur +0 -0
- package/blockly-rc/media/pilcrow.png +0 -0
- package/blockly-rc/media/quote0.png +0 -0
- package/blockly-rc/media/quote1.png +0 -0
- package/blockly-rc/media/resize-handle.svg +3 -0
- package/blockly-rc/media/sprites.png +0 -0
- package/blockly-rc/media/sprites.svg +74 -0
- package/blockly-rc/msg/json/README.md +33 -0
- package/blockly-rc/msg/json/ab.json +222 -0
- package/blockly-rc/msg/json/ace.json +7 -0
- package/blockly-rc/msg/json/af.json +34 -0
- package/blockly-rc/msg/json/am.json +30 -0
- package/blockly-rc/msg/json/ar.json +355 -0
- package/blockly-rc/msg/json/ast.json +10 -0
- package/blockly-rc/msg/json/az.json +332 -0
- package/blockly-rc/msg/json/ba.json +211 -0
- package/blockly-rc/msg/json/bcc.json +290 -0
- package/blockly-rc/msg/json/be-tarask.json +334 -0
- package/blockly-rc/msg/json/be.json +324 -0
- package/blockly-rc/msg/json/bg.json +345 -0
- package/blockly-rc/msg/json/bn.json +189 -0
- package/blockly-rc/msg/json/br.json +334 -0
- package/blockly-rc/msg/json/bs.json +166 -0
- package/blockly-rc/msg/json/ca.json +341 -0
- package/blockly-rc/msg/json/cdo.json +6 -0
- package/blockly-rc/msg/json/ce.json +326 -0
- package/blockly-rc/msg/json/constants.json +12 -0
- package/blockly-rc/msg/json/cs.json +343 -0
- package/blockly-rc/msg/json/da.json +346 -0
- package/blockly-rc/msg/json/de.json +369 -0
- package/blockly-rc/msg/json/diq.json +258 -0
- package/blockly-rc/msg/json/dtp.json +198 -0
- package/blockly-rc/msg/json/dty.json +97 -0
- package/blockly-rc/msg/json/ee.json +160 -0
- package/blockly-rc/msg/json/el.json +356 -0
- package/blockly-rc/msg/json/en-gb.json +199 -0
- package/blockly-rc/msg/json/en.json +400 -0
- package/blockly-rc/msg/json/eo.json +337 -0
- package/blockly-rc/msg/json/es.json +358 -0
- package/blockly-rc/msg/json/et.json +326 -0
- package/blockly-rc/msg/json/eu.json +219 -0
- package/blockly-rc/msg/json/fa.json +341 -0
- package/blockly-rc/msg/json/fi.json +350 -0
- package/blockly-rc/msg/json/fo.json +46 -0
- package/blockly-rc/msg/json/fr.json +373 -0
- package/blockly-rc/msg/json/frr.json +6 -0
- package/blockly-rc/msg/json/gl.json +338 -0
- package/blockly-rc/msg/json/gn.json +54 -0
- package/blockly-rc/msg/json/gor.json +87 -0
- package/blockly-rc/msg/json/ha.json +313 -0
- package/blockly-rc/msg/json/hak.json +17 -0
- package/blockly-rc/msg/json/he.json +354 -0
- package/blockly-rc/msg/json/hi.json +318 -0
- package/blockly-rc/msg/json/hr.json +327 -0
- package/blockly-rc/msg/json/hrx.json +287 -0
- package/blockly-rc/msg/json/hsb.json +128 -0
- package/blockly-rc/msg/json/hu.json +349 -0
- package/blockly-rc/msg/json/hy.json +337 -0
- package/blockly-rc/msg/json/ia.json +337 -0
- package/blockly-rc/msg/json/id.json +335 -0
- package/blockly-rc/msg/json/ig.json +323 -0
- package/blockly-rc/msg/json/inh.json +80 -0
- package/blockly-rc/msg/json/is.json +331 -0
- package/blockly-rc/msg/json/it.json +346 -0
- package/blockly-rc/msg/json/ja.json +361 -0
- package/blockly-rc/msg/json/ka.json +14 -0
- package/blockly-rc/msg/json/kab.json +323 -0
- package/blockly-rc/msg/json/kbd-cyrl.json +84 -0
- package/blockly-rc/msg/json/km.json +29 -0
- package/blockly-rc/msg/json/kn.json +332 -0
- package/blockly-rc/msg/json/ko.json +372 -0
- package/blockly-rc/msg/json/ksh.json +43 -0
- package/blockly-rc/msg/json/ku-latn.json +41 -0
- package/blockly-rc/msg/json/ky.json +71 -0
- package/blockly-rc/msg/json/la.json +6 -0
- package/blockly-rc/msg/json/lb.json +156 -0
- package/blockly-rc/msg/json/lki.json +282 -0
- package/blockly-rc/msg/json/lo.json +92 -0
- package/blockly-rc/msg/json/lrc.json +123 -0
- package/blockly-rc/msg/json/lt.json +321 -0
- package/blockly-rc/msg/json/lv.json +324 -0
- package/blockly-rc/msg/json/mg.json +58 -0
- package/blockly-rc/msg/json/mk.json +178 -0
- package/blockly-rc/msg/json/ml.json +35 -0
- package/blockly-rc/msg/json/mnw.json +90 -0
- package/blockly-rc/msg/json/ms.json +300 -0
- package/blockly-rc/msg/json/my.json +57 -0
- package/blockly-rc/msg/json/mzn.json +6 -0
- package/blockly-rc/msg/json/nb.json +330 -0
- package/blockly-rc/msg/json/ne.json +247 -0
- package/blockly-rc/msg/json/nl.json +357 -0
- package/blockly-rc/msg/json/oc.json +194 -0
- package/blockly-rc/msg/json/olo.json +37 -0
- package/blockly-rc/msg/json/pa.json +69 -0
- package/blockly-rc/msg/json/pl.json +357 -0
- package/blockly-rc/msg/json/pms.json +324 -0
- package/blockly-rc/msg/json/ps.json +50 -0
- package/blockly-rc/msg/json/pt-br.json +369 -0
- package/blockly-rc/msg/json/pt.json +358 -0
- package/blockly-rc/msg/json/qqq.json +406 -0
- package/blockly-rc/msg/json/ro.json +333 -0
- package/blockly-rc/msg/json/ru.json +363 -0
- package/blockly-rc/msg/json/sc.json +283 -0
- package/blockly-rc/msg/json/sco.json +11 -0
- package/blockly-rc/msg/json/sd.json +158 -0
- package/blockly-rc/msg/json/shn.json +109 -0
- package/blockly-rc/msg/json/si.json +16 -0
- package/blockly-rc/msg/json/sk.json +332 -0
- package/blockly-rc/msg/json/skr-arab.json +117 -0
- package/blockly-rc/msg/json/sl.json +355 -0
- package/blockly-rc/msg/json/smn.json +133 -0
- package/blockly-rc/msg/json/sq.json +343 -0
- package/blockly-rc/msg/json/sr-latn.json +324 -0
- package/blockly-rc/msg/json/sr.json +348 -0
- package/blockly-rc/msg/json/sv.json +347 -0
- package/blockly-rc/msg/json/sw.json +12 -0
- package/blockly-rc/msg/json/synonyms.json +22 -0
- package/blockly-rc/msg/json/ta.json +306 -0
- package/blockly-rc/msg/json/tcy.json +316 -0
- package/blockly-rc/msg/json/tdd.json +109 -0
- package/blockly-rc/msg/json/te.json +101 -0
- package/blockly-rc/msg/json/th.json +333 -0
- package/blockly-rc/msg/json/ti.json +50 -0
- package/blockly-rc/msg/json/tl.json +129 -0
- package/blockly-rc/msg/json/tlh.json +179 -0
- package/blockly-rc/msg/json/tr.json +369 -0
- package/blockly-rc/msg/json/ug-arab.json +132 -0
- package/blockly-rc/msg/json/uk.json +345 -0
- package/blockly-rc/msg/json/ur.json +117 -0
- package/blockly-rc/msg/json/uz.json +36 -0
- package/blockly-rc/msg/json/vi.json +345 -0
- package/blockly-rc/msg/json/xmf.json +96 -0
- package/blockly-rc/msg/json/yo.json +316 -0
- package/blockly-rc/msg/json/zgh.json +83 -0
- package/blockly-rc/msg/json/zh-hans.json +372 -0
- package/blockly-rc/msg/json/zh-hant.json +362 -0
- package/blockly-rc/msg/messages.js +1616 -0
- package/blockly-rc/package-lock.json +12324 -0
- package/blockly-rc/package.json +149 -0
- package/blockly-rc/patches/@microsoft+api-documenter+7.22.4.patch +81 -0
- package/blockly-rc/scripts/goog_module/convert-file.sh +406 -0
- package/blockly-rc/scripts/gulpfiles/appengine_tasks.js +195 -0
- package/blockly-rc/scripts/gulpfiles/build_tasks.js +752 -0
- package/blockly-rc/scripts/gulpfiles/config.js +41 -0
- package/blockly-rc/scripts/gulpfiles/docs_tasks.js +147 -0
- package/blockly-rc/scripts/gulpfiles/git_tasks.js +181 -0
- package/blockly-rc/scripts/gulpfiles/helper_tasks.js +19 -0
- package/blockly-rc/scripts/gulpfiles/package_tasks.js +262 -0
- package/blockly-rc/scripts/gulpfiles/release_tasks.js +183 -0
- package/blockly-rc/scripts/gulpfiles/test_tasks.js +405 -0
- package/blockly-rc/scripts/helpers.js +74 -0
- package/blockly-rc/scripts/i18n/common.py +233 -0
- package/blockly-rc/scripts/i18n/create_messages.py +167 -0
- package/blockly-rc/scripts/i18n/dedup_json.py +72 -0
- package/blockly-rc/scripts/i18n/js_to_json.py +135 -0
- package/blockly-rc/scripts/i18n/tests.py +46 -0
- package/blockly-rc/scripts/migration/cjs2esm +162 -0
- package/blockly-rc/scripts/migration/js2ts +168 -0
- package/blockly-rc/scripts/migration/renamings.json5 +1599 -0
- package/blockly-rc/scripts/package/README.md +93 -0
- package/blockly-rc/scripts/package/core-node.js +31 -0
- package/blockly-rc/scripts/package/index.js +23 -0
- package/blockly-rc/scripts/package/templates/umd-msg.template +16 -0
- package/blockly-rc/scripts/package/templates/umd.template +13 -0
- package/blockly-rc/scripts/themes/blockStyles_example.json +11 -0
- package/blockly-rc/scripts/themes/create_blockStyles.py +181 -0
- package/blockly-rc/scripts/tsick.js +86 -0
- package/blockly-rc/tests/.eslintrc.json +10 -0
- package/blockly-rc/tests/browser/.eslintrc.json +29 -0
- package/blockly-rc/tests/browser/.mocharc.js +6 -0
- package/blockly-rc/tests/browser/test/basic_block_factory_test.mjs +44 -0
- package/blockly-rc/tests/browser/test/basic_block_test.mjs +39 -0
- package/blockly-rc/tests/browser/test/basic_playground_test.mjs +198 -0
- package/blockly-rc/tests/browser/test/block_undo_test.mjs +50 -0
- package/blockly-rc/tests/browser/test/delete_blocks_test.mjs +211 -0
- package/blockly-rc/tests/browser/test/extensive_test.mjs +195 -0
- package/blockly-rc/tests/browser/test/field_edits_test.mjs +61 -0
- package/blockly-rc/tests/browser/test/hooks.mjs +23 -0
- package/blockly-rc/tests/browser/test/mutator_test.mjs +88 -0
- package/blockly-rc/tests/browser/test/procedure_test.mjs +109 -0
- package/blockly-rc/tests/browser/test/test_setup.mjs +589 -0
- package/blockly-rc/tests/browser/test/toolbox_drag_test.mjs +207 -0
- package/blockly-rc/tests/browser/test/workspace_comment_test.mjs +224 -0
- package/blockly-rc/tests/compile/index.html +43 -0
- package/blockly-rc/tests/compile/main.js +53 -0
- package/blockly-rc/tests/compile/test_blocks.js +47 -0
- package/blockly-rc/tests/compile/webdriver.js +81 -0
- package/blockly-rc/tests/generators/functions.xml +561 -0
- package/blockly-rc/tests/generators/golden/generated.dart +1604 -0
- package/blockly-rc/tests/generators/golden/generated.js +1552 -0
- package/blockly-rc/tests/generators/golden/generated.lua +1828 -0
- package/blockly-rc/tests/generators/golden/generated.php +1611 -0
- package/blockly-rc/tests/generators/golden/generated.py +1407 -0
- package/blockly-rc/tests/generators/index.html +405 -0
- package/blockly-rc/tests/generators/lists.xml +8675 -0
- package/blockly-rc/tests/generators/logic.xml +1019 -0
- package/blockly-rc/tests/generators/loops1.xml +345 -0
- package/blockly-rc/tests/generators/loops2.xml +891 -0
- package/blockly-rc/tests/generators/loops3.xml +735 -0
- package/blockly-rc/tests/generators/math.xml +2077 -0
- package/blockly-rc/tests/generators/text.xml +4651 -0
- package/blockly-rc/tests/generators/unittest.js +103 -0
- package/blockly-rc/tests/generators/unittest_dart.js +163 -0
- package/blockly-rc/tests/generators/unittest_javascript.js +167 -0
- package/blockly-rc/tests/generators/unittest_lua.js +165 -0
- package/blockly-rc/tests/generators/unittest_php.js +154 -0
- package/blockly-rc/tests/generators/unittest_python.js +138 -0
- package/blockly-rc/tests/generators/variables.xml +68 -0
- package/blockly-rc/tests/generators/webdriver.js +123 -0
- package/blockly-rc/tests/media/200px.png +0 -0
- package/blockly-rc/tests/media/30px.png +0 -0
- package/blockly-rc/tests/media/50px.png +0 -0
- package/blockly-rc/tests/media/a.png +0 -0
- package/blockly-rc/tests/media/arrow.png +0 -0
- package/blockly-rc/tests/media/b.png +0 -0
- package/blockly-rc/tests/media/c.png +0 -0
- package/blockly-rc/tests/media/d.png +0 -0
- package/blockly-rc/tests/media/e.png +0 -0
- package/blockly-rc/tests/media/f.png +0 -0
- package/blockly-rc/tests/media/g.png +0 -0
- package/blockly-rc/tests/media/h.png +0 -0
- package/blockly-rc/tests/media/i.png +0 -0
- package/blockly-rc/tests/media/j.png +0 -0
- package/blockly-rc/tests/media/k.png +0 -0
- package/blockly-rc/tests/media/l.png +0 -0
- package/blockly-rc/tests/media/m.png +0 -0
- package/blockly-rc/tests/migration/renamings.schema.json +59 -0
- package/blockly-rc/tests/migration/validate-renamings.mjs +60 -0
- package/blockly-rc/tests/mocha/.eslintrc.json +21 -0
- package/blockly-rc/tests/mocha/.mocharc.js +6 -0
- package/blockly-rc/tests/mocha/astnode_test.js +850 -0
- package/blockly-rc/tests/mocha/block_json_test.js +777 -0
- package/blockly-rc/tests/mocha/block_test.js +2743 -0
- package/blockly-rc/tests/mocha/blocks/lists_test.js +196 -0
- package/blockly-rc/tests/mocha/blocks/logic_ternary_test.js +320 -0
- package/blockly-rc/tests/mocha/blocks/loops_test.js +56 -0
- package/blockly-rc/tests/mocha/blocks/procedures_test.js +2495 -0
- package/blockly-rc/tests/mocha/blocks/variables_test.js +311 -0
- package/blockly-rc/tests/mocha/clipboard_test.js +136 -0
- package/blockly-rc/tests/mocha/comment_deserialization_test.js +122 -0
- package/blockly-rc/tests/mocha/comment_test.js +170 -0
- package/blockly-rc/tests/mocha/comment_view_test.js +188 -0
- package/blockly-rc/tests/mocha/connection_checker_test.js +666 -0
- package/blockly-rc/tests/mocha/connection_db_test.js +362 -0
- package/blockly-rc/tests/mocha/connection_test.js +3738 -0
- package/blockly-rc/tests/mocha/contextmenu_items_test.js +488 -0
- package/blockly-rc/tests/mocha/contextmenu_test.js +71 -0
- package/blockly-rc/tests/mocha/cursor_test.js +134 -0
- package/blockly-rc/tests/mocha/dropdowndiv_test.js +116 -0
- package/blockly-rc/tests/mocha/event_block_change_test.js +126 -0
- package/blockly-rc/tests/mocha/event_block_create_test.js +109 -0
- package/blockly-rc/tests/mocha/event_block_delete_test.js +55 -0
- package/blockly-rc/tests/mocha/event_block_drag_test.js +36 -0
- package/blockly-rc/tests/mocha/event_block_field_intermediate_change_test.js +67 -0
- package/blockly-rc/tests/mocha/event_block_move_test.js +39 -0
- package/blockly-rc/tests/mocha/event_bubble_open_test.js +42 -0
- package/blockly-rc/tests/mocha/event_click_test.js +40 -0
- package/blockly-rc/tests/mocha/event_comment_change_test.js +39 -0
- package/blockly-rc/tests/mocha/event_comment_collapse_test.js +34 -0
- package/blockly-rc/tests/mocha/event_comment_create_test.js +38 -0
- package/blockly-rc/tests/mocha/event_comment_delete_test.js +38 -0
- package/blockly-rc/tests/mocha/event_comment_drag_test.js +35 -0
- package/blockly-rc/tests/mocha/event_comment_move_test.js +40 -0
- package/blockly-rc/tests/mocha/event_comment_resize_test.js +38 -0
- package/blockly-rc/tests/mocha/event_marker_move_test.js +44 -0
- package/blockly-rc/tests/mocha/event_selected_test.js +41 -0
- package/blockly-rc/tests/mocha/event_test.js +1578 -0
- package/blockly-rc/tests/mocha/event_theme_change_test.js +36 -0
- package/blockly-rc/tests/mocha/event_toolbox_item_select_test.js +64 -0
- package/blockly-rc/tests/mocha/event_trashcan_open_test.js +36 -0
- package/blockly-rc/tests/mocha/event_var_create_test.js +54 -0
- package/blockly-rc/tests/mocha/event_var_delete_test.js +54 -0
- package/blockly-rc/tests/mocha/event_var_rename_test.js +39 -0
- package/blockly-rc/tests/mocha/event_var_type_change_test.js +43 -0
- package/blockly-rc/tests/mocha/event_viewport_test.js +39 -0
- package/blockly-rc/tests/mocha/extensions_test.js +613 -0
- package/blockly-rc/tests/mocha/field_checkbox_test.js +299 -0
- package/blockly-rc/tests/mocha/field_colour_test.js +395 -0
- package/blockly-rc/tests/mocha/field_dropdown_test.js +282 -0
- package/blockly-rc/tests/mocha/field_image_test.js +241 -0
- package/blockly-rc/tests/mocha/field_label_serializable_test.js +252 -0
- package/blockly-rc/tests/mocha/field_label_test.js +226 -0
- package/blockly-rc/tests/mocha/field_number_test.js +505 -0
- package/blockly-rc/tests/mocha/field_registry_test.js +116 -0
- package/blockly-rc/tests/mocha/field_test.js +822 -0
- package/blockly-rc/tests/mocha/field_textinput_test.js +297 -0
- package/blockly-rc/tests/mocha/field_variable_test.js +611 -0
- package/blockly-rc/tests/mocha/flyout_test.js +638 -0
- package/blockly-rc/tests/mocha/generator_test.js +233 -0
- package/blockly-rc/tests/mocha/gesture_test.js +97 -0
- package/blockly-rc/tests/mocha/icon_test.js +369 -0
- package/blockly-rc/tests/mocha/index.html +229 -0
- package/blockly-rc/tests/mocha/input_test.js +296 -0
- package/blockly-rc/tests/mocha/insertion_marker_manager_test.js +443 -0
- package/blockly-rc/tests/mocha/insertion_marker_test.js +432 -0
- package/blockly-rc/tests/mocha/jso_deserialization_test.js +849 -0
- package/blockly-rc/tests/mocha/jso_serialization_test.js +1067 -0
- package/blockly-rc/tests/mocha/json_test.js +315 -0
- package/blockly-rc/tests/mocha/keydown_test.js +364 -0
- package/blockly-rc/tests/mocha/layering_test.js +95 -0
- package/blockly-rc/tests/mocha/metrics_test.js +671 -0
- package/blockly-rc/tests/mocha/mutator_test.js +87 -0
- package/blockly-rc/tests/mocha/names_test.js +97 -0
- package/blockly-rc/tests/mocha/old_workspace_comment_test.js +256 -0
- package/blockly-rc/tests/mocha/procedure_map_test.js +57 -0
- package/blockly-rc/tests/mocha/registry_test.js +281 -0
- package/blockly-rc/tests/mocha/render_management_test.js +127 -0
- package/blockly-rc/tests/mocha/serializer_test.js +2104 -0
- package/blockly-rc/tests/mocha/shortcut_registry_test.js +450 -0
- package/blockly-rc/tests/mocha/test_helpers/block_definitions.js +204 -0
- package/blockly-rc/tests/mocha/test_helpers/code_generation.js +115 -0
- package/blockly-rc/tests/mocha/test_helpers/common.js +106 -0
- package/blockly-rc/tests/mocha/test_helpers/events.js +290 -0
- package/blockly-rc/tests/mocha/test_helpers/fields.js +310 -0
- package/blockly-rc/tests/mocha/test_helpers/icon_mocks.js +81 -0
- package/blockly-rc/tests/mocha/test_helpers/procedures.js +302 -0
- package/blockly-rc/tests/mocha/test_helpers/serialization.js +124 -0
- package/blockly-rc/tests/mocha/test_helpers/setup_teardown.js +209 -0
- package/blockly-rc/tests/mocha/test_helpers/toolbox_definitions.js +271 -0
- package/blockly-rc/tests/mocha/test_helpers/user_input.js +62 -0
- package/blockly-rc/tests/mocha/test_helpers/variables.js +23 -0
- package/blockly-rc/tests/mocha/test_helpers/warnings.js +83 -0
- package/blockly-rc/tests/mocha/test_helpers/workspace.js +1691 -0
- package/blockly-rc/tests/mocha/theme_test.js +307 -0
- package/blockly-rc/tests/mocha/toolbox_test.js +761 -0
- package/blockly-rc/tests/mocha/tooltip_test.js +276 -0
- package/blockly-rc/tests/mocha/touch_test.js +109 -0
- package/blockly-rc/tests/mocha/trashcan_test.js +375 -0
- package/blockly-rc/tests/mocha/utils_test.js +536 -0
- package/blockly-rc/tests/mocha/variable_map_test.js +509 -0
- package/blockly-rc/tests/mocha/variable_model_test.js +85 -0
- package/blockly-rc/tests/mocha/webdriver.js +96 -0
- package/blockly-rc/tests/mocha/widget_div_test.js +272 -0
- package/blockly-rc/tests/mocha/workspace_comment_test.js +171 -0
- package/blockly-rc/tests/mocha/workspace_svg_test.js +414 -0
- package/blockly-rc/tests/mocha/workspace_test.js +27 -0
- package/blockly-rc/tests/mocha/xml_test.js +951 -0
- package/blockly-rc/tests/mocha/zoom_controls_test.js +81 -0
- package/blockly-rc/tests/multi_playground.html +482 -0
- package/blockly-rc/tests/node/.eslintrc.json +12 -0
- package/blockly-rc/tests/node/.mocharc.js +6 -0
- package/blockly-rc/tests/node/run_node_test.mjs +72 -0
- package/blockly-rc/tests/playground.html +1280 -0
- package/blockly-rc/tests/playgrounds/advanced_playground.html +158 -0
- package/blockly-rc/tests/playgrounds/iframe.html +40 -0
- package/blockly-rc/tests/playgrounds/screenshot.js +123 -0
- package/blockly-rc/tests/scripts/check_metadata.sh +166 -0
- package/blockly-rc/tests/scripts/compile_typings.sh +32 -0
- package/blockly-rc/tests/scripts/load.mjs +140 -0
- package/blockly-rc/tests/scripts/setup_linux_env.sh +7 -0
- package/blockly-rc/tests/scripts/update_metadata.sh +46 -0
- package/blockly-rc/tests/themes/test_themes.js +62 -0
- package/blockly-rc/tests/typescript/README.md +4 -0
- package/blockly-rc/tests/typescript/src/field/different_user_input.ts +81 -0
- package/blockly-rc/tests/typescript/src/generators/dart.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/javascript.ts +28 -0
- package/blockly-rc/tests/typescript/src/generators/lua.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/php.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/python.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators.ts +31 -0
- package/blockly-rc/tests/typescript/src/msg.ts +20 -0
- package/blockly-rc/tests/typescript/tsconfig.json +20 -0
- package/blockly-rc/tests/xml/README.txt +11 -0
- package/blockly-rc/tests/xml/blockly.xsd +178 -0
- package/blockly-rc/tests/xml/invalid.xml +6 -0
- package/blockly-rc/tests/xml/toolbox.xml +311 -0
- package/blockly-rc/tests/xml/workspace.xml +114 -0
- package/blockly-rc/tsconfig.json +37 -0
- package/blockly-rc/tsdoc.json +35 -0
- package/blockly-rc/typings/README.md +5 -0
- package/blockly-rc/typings/blocks.d.ts +17 -0
- package/blockly-rc/typings/core.d.ts +7 -0
- package/blockly-rc/typings/dart.d.ts +7 -0
- package/blockly-rc/typings/index.d.ts +10 -0
- package/blockly-rc/typings/javascript.d.ts +7 -0
- package/blockly-rc/typings/lua.d.ts +7 -0
- package/blockly-rc/typings/msg/ab.d.ts +8 -0
- package/blockly-rc/typings/msg/ace.d.ts +8 -0
- package/blockly-rc/typings/msg/af.d.ts +8 -0
- package/blockly-rc/typings/msg/am.d.ts +8 -0
- package/blockly-rc/typings/msg/ar.d.ts +8 -0
- package/blockly-rc/typings/msg/ast.d.ts +8 -0
- package/blockly-rc/typings/msg/az.d.ts +8 -0
- package/blockly-rc/typings/msg/ba.d.ts +8 -0
- package/blockly-rc/typings/msg/bcc.d.ts +8 -0
- package/blockly-rc/typings/msg/be-tarask.d.ts +8 -0
- package/blockly-rc/typings/msg/be.d.ts +8 -0
- package/blockly-rc/typings/msg/bg.d.ts +8 -0
- package/blockly-rc/typings/msg/bn.d.ts +8 -0
- package/blockly-rc/typings/msg/br.d.ts +8 -0
- package/blockly-rc/typings/msg/bs.d.ts +8 -0
- package/blockly-rc/typings/msg/ca.d.ts +8 -0
- package/blockly-rc/typings/msg/cdo.d.ts +8 -0
- package/blockly-rc/typings/msg/ce.d.ts +8 -0
- package/blockly-rc/typings/msg/cs.d.ts +8 -0
- package/blockly-rc/typings/msg/da.d.ts +8 -0
- package/blockly-rc/typings/msg/de.d.ts +8 -0
- package/blockly-rc/typings/msg/diq.d.ts +8 -0
- package/blockly-rc/typings/msg/dtp.d.ts +8 -0
- package/blockly-rc/typings/msg/dty.d.ts +8 -0
- package/blockly-rc/typings/msg/ee.d.ts +8 -0
- package/blockly-rc/typings/msg/el.d.ts +8 -0
- package/blockly-rc/typings/msg/en-gb.d.ts +8 -0
- package/blockly-rc/typings/msg/en.d.ts +8 -0
- package/blockly-rc/typings/msg/eo.d.ts +8 -0
- package/blockly-rc/typings/msg/es.d.ts +8 -0
- package/blockly-rc/typings/msg/et.d.ts +8 -0
- package/blockly-rc/typings/msg/eu.d.ts +8 -0
- package/blockly-rc/typings/msg/fa.d.ts +8 -0
- package/blockly-rc/typings/msg/fi.d.ts +8 -0
- package/blockly-rc/typings/msg/fo.d.ts +8 -0
- package/blockly-rc/typings/msg/fr.d.ts +8 -0
- package/blockly-rc/typings/msg/frr.d.ts +8 -0
- package/blockly-rc/typings/msg/gl.d.ts +8 -0
- package/blockly-rc/typings/msg/gn.d.ts +8 -0
- package/blockly-rc/typings/msg/gor.d.ts +8 -0
- package/blockly-rc/typings/msg/ha.d.ts +8 -0
- package/blockly-rc/typings/msg/hak.d.ts +8 -0
- package/blockly-rc/typings/msg/he.d.ts +8 -0
- package/blockly-rc/typings/msg/hi.d.ts +8 -0
- package/blockly-rc/typings/msg/hr.d.ts +8 -0
- package/blockly-rc/typings/msg/hrx.d.ts +8 -0
- package/blockly-rc/typings/msg/hsb.d.ts +8 -0
- package/blockly-rc/typings/msg/hu.d.ts +8 -0
- package/blockly-rc/typings/msg/hy.d.ts +8 -0
- package/blockly-rc/typings/msg/ia.d.ts +8 -0
- package/blockly-rc/typings/msg/id.d.ts +8 -0
- package/blockly-rc/typings/msg/ig.d.ts +8 -0
- package/blockly-rc/typings/msg/inh.d.ts +8 -0
- package/blockly-rc/typings/msg/is.d.ts +8 -0
- package/blockly-rc/typings/msg/it.d.ts +8 -0
- package/blockly-rc/typings/msg/ja.d.ts +8 -0
- package/blockly-rc/typings/msg/ka.d.ts +8 -0
- package/blockly-rc/typings/msg/kab.d.ts +8 -0
- package/blockly-rc/typings/msg/kbd-cyrl.d.ts +8 -0
- package/blockly-rc/typings/msg/km.d.ts +8 -0
- package/blockly-rc/typings/msg/kn.d.ts +8 -0
- package/blockly-rc/typings/msg/ko.d.ts +8 -0
- package/blockly-rc/typings/msg/ksh.d.ts +8 -0
- package/blockly-rc/typings/msg/ku-latn.d.ts +8 -0
- package/blockly-rc/typings/msg/ky.d.ts +8 -0
- package/blockly-rc/typings/msg/la.d.ts +8 -0
- package/blockly-rc/typings/msg/lb.d.ts +8 -0
- package/blockly-rc/typings/msg/lki.d.ts +8 -0
- package/blockly-rc/typings/msg/lo.d.ts +8 -0
- package/blockly-rc/typings/msg/lrc.d.ts +8 -0
- package/blockly-rc/typings/msg/lt.d.ts +8 -0
- package/blockly-rc/typings/msg/lv.d.ts +8 -0
- package/blockly-rc/typings/msg/mg.d.ts +8 -0
- package/blockly-rc/typings/msg/mk.d.ts +8 -0
- package/blockly-rc/typings/msg/ml.d.ts +8 -0
- package/blockly-rc/typings/msg/mnw.d.ts +8 -0
- package/blockly-rc/typings/msg/ms.d.ts +8 -0
- package/blockly-rc/typings/msg/msg.d.ts +440 -0
- package/blockly-rc/typings/msg/my.d.ts +8 -0
- package/blockly-rc/typings/msg/mzn.d.ts +8 -0
- package/blockly-rc/typings/msg/nb.d.ts +8 -0
- package/blockly-rc/typings/msg/ne.d.ts +8 -0
- package/blockly-rc/typings/msg/nl.d.ts +8 -0
- package/blockly-rc/typings/msg/oc.d.ts +8 -0
- package/blockly-rc/typings/msg/olo.d.ts +8 -0
- package/blockly-rc/typings/msg/pa.d.ts +8 -0
- package/blockly-rc/typings/msg/pl.d.ts +8 -0
- package/blockly-rc/typings/msg/pms.d.ts +8 -0
- package/blockly-rc/typings/msg/ps.d.ts +8 -0
- package/blockly-rc/typings/msg/pt-br.d.ts +8 -0
- package/blockly-rc/typings/msg/pt.d.ts +8 -0
- package/blockly-rc/typings/msg/ro.d.ts +8 -0
- package/blockly-rc/typings/msg/ru.d.ts +8 -0
- package/blockly-rc/typings/msg/sc.d.ts +8 -0
- package/blockly-rc/typings/msg/sco.d.ts +8 -0
- package/blockly-rc/typings/msg/sd.d.ts +8 -0
- package/blockly-rc/typings/msg/shn.d.ts +8 -0
- package/blockly-rc/typings/msg/si.d.ts +8 -0
- package/blockly-rc/typings/msg/sk.d.ts +8 -0
- package/blockly-rc/typings/msg/skr-arab.d.ts +8 -0
- package/blockly-rc/typings/msg/sl.d.ts +8 -0
- package/blockly-rc/typings/msg/smn.d.ts +8 -0
- package/blockly-rc/typings/msg/sq.d.ts +8 -0
- package/blockly-rc/typings/msg/sr-latn.d.ts +8 -0
- package/blockly-rc/typings/msg/sr.d.ts +8 -0
- package/blockly-rc/typings/msg/sv.d.ts +8 -0
- package/blockly-rc/typings/msg/sw.d.ts +8 -0
- package/blockly-rc/typings/msg/ta.d.ts +8 -0
- package/blockly-rc/typings/msg/tcy.d.ts +8 -0
- package/blockly-rc/typings/msg/tdd.d.ts +8 -0
- package/blockly-rc/typings/msg/te.d.ts +8 -0
- package/blockly-rc/typings/msg/th.d.ts +8 -0
- package/blockly-rc/typings/msg/ti.d.ts +8 -0
- package/blockly-rc/typings/msg/tl.d.ts +8 -0
- package/blockly-rc/typings/msg/tlh.d.ts +8 -0
- package/blockly-rc/typings/msg/tr.d.ts +8 -0
- package/blockly-rc/typings/msg/ug-arab.d.ts +8 -0
- package/blockly-rc/typings/msg/uk.d.ts +8 -0
- package/blockly-rc/typings/msg/ur.d.ts +8 -0
- package/blockly-rc/typings/msg/uz.d.ts +8 -0
- package/blockly-rc/typings/msg/vi.d.ts +8 -0
- package/blockly-rc/typings/msg/xmf.d.ts +8 -0
- package/blockly-rc/typings/msg/yo.d.ts +8 -0
- package/blockly-rc/typings/msg/zgh.d.ts +8 -0
- package/blockly-rc/typings/msg/zh-hans.d.ts +8 -0
- package/blockly-rc/typings/msg/zh-hant.d.ts +8 -0
- package/blockly-rc/typings/php.d.ts +7 -0
- package/blockly-rc/typings/python.d.ts +7 -0
- package/blockly-rc/typings/templates/blockly-header.template +11 -0
- package/blockly-rc/typings/templates/blockly-interfaces.template +83 -0
- package/blockly-rc/typings/templates/msg.template +15 -0
- package/blockly-rc/typings/tsconfig.json +23 -0
- package/continuous-toolbox.d.ts +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +163 -0
- package/media/delete-icon.svg +10 -0
- package/media/resize-handle.svg +3 -0
- package/msg/scratch_msgs.js +184 -164
- package/package.json +25 -40
- package/release.config.js +8 -0
- package/src/block_reporting.js +31 -0
- package/src/blocks/colour.js +56 -0
- package/src/blocks/control.js +492 -0
- package/src/blocks/data.js +690 -0
- package/src/blocks/event.js +305 -0
- package/src/blocks/looks.js +537 -0
- package/src/blocks/math.js +137 -0
- package/src/blocks/matrix.js +47 -0
- package/src/blocks/motion.js +513 -0
- package/src/blocks/note.js +48 -0
- package/src/blocks/operators.js +463 -0
- package/src/blocks/procedures.js +1009 -0
- package/src/blocks/sensing.js +441 -0
- package/src/blocks/sound.js +205 -0
- package/src/blocks/text.js +45 -0
- package/src/blocks/vertical_extensions.js +309 -0
- package/src/categories.js +15 -0
- package/src/checkable_continuous_flyout.js +138 -0
- package/src/checkbox_bubble.js +282 -0
- package/src/colours.js +77 -0
- package/src/constants.js +63 -0
- package/src/context_menu_items.js +150 -0
- package/src/css.js +1197 -0
- package/src/data_category.js +556 -0
- package/src/events/events_block_comment_base.js +35 -0
- package/src/events/events_block_comment_change.js +43 -0
- package/src/events/events_block_comment_collapse.js +43 -0
- package/src/events/events_block_comment_create.js +52 -0
- package/src/events/events_block_comment_delete.js +27 -0
- package/src/events/events_block_comment_move.js +54 -0
- package/src/events/events_block_comment_resize.js +52 -0
- package/src/events/events_block_drag_end.js +33 -0
- package/src/events/events_block_drag_outside.js +30 -0
- package/src/events/events_scratch_variable_create.js +67 -0
- package/src/fields/field_angle.js +433 -0
- package/src/fields/field_colour_slider.js +388 -0
- package/src/fields/field_dropdown.js +42 -0
- package/src/fields/field_matrix.js +634 -0
- package/src/fields/field_note.js +937 -0
- package/src/fields/field_number.js +380 -0
- package/src/fields/field_textinput_removable.js +107 -0
- package/src/fields/field_variable.js +171 -0
- package/src/fields/field_variable_getter.js +109 -0
- package/src/fields/field_vertical_separator.js +139 -0
- package/src/flyout_checkbox_icon.js +88 -0
- package/src/glows.js +98 -0
- package/src/index.ts +137 -0
- package/src/procedures.js +425 -0
- package/src/recyclable_block_flyout_inflater.js +194 -0
- package/src/renderer/bowler_hat.js +17 -0
- package/src/renderer/constants.js +45 -0
- package/src/renderer/drawer.js +51 -0
- package/src/renderer/path_object.js +35 -0
- package/src/renderer/render_info.js +98 -0
- package/src/renderer/renderer.js +74 -0
- package/src/scratch_block_paster.js +46 -0
- package/src/scratch_blocks_utils.js +148 -0
- package/src/scratch_comment_bubble.js +169 -0
- package/src/scratch_comment_icon.js +195 -0
- package/src/scratch_connection_checker.js +29 -0
- package/src/scratch_continuous_category.js +80 -0
- package/src/scratch_continuous_toolbox.js +78 -0
- package/src/scratch_dragger.js +142 -0
- package/src/scratch_variable_map.js +25 -0
- package/src/scratch_variable_model.js +24 -0
- package/src/shadows.js +61 -0
- package/src/status_indicator_label.js +186 -0
- package/src/status_indicator_label_flyout_inflater.js +42 -0
- package/src/variables.js +355 -0
- package/temp-use-blockly-v12-rc.sh +26 -0
- package/tsconfig.json +13 -0
- package/blockly_compressed_horizontal.js +0 -2255
- package/blockly_compressed_vertical.js +0 -2283
- package/blockly_uncompressed_horizontal.js +0 -1210
- package/blockly_uncompressed_vertical.js +0 -1210
- package/blocks_common/colour.js +0 -61
- package/blocks_common/math.js +0 -159
- package/blocks_common/matrix.js +0 -54
- package/blocks_common/note.js +0 -58
- package/blocks_common/text.js +0 -57
- package/blocks_compressed.js +0 -36
- package/blocks_compressed_horizontal.js +0 -67
- package/blocks_compressed_vertical.js +0 -208
- package/blocks_horizontal/control.js +0 -212
- package/blocks_horizontal/default_toolbox.js +0 -139
- package/blocks_horizontal/event.js +0 -190
- package/blocks_horizontal/wedo.js +0 -325
- package/blocks_vertical/control.js +0 -532
- package/blocks_vertical/data.js +0 -666
- package/blocks_vertical/default_toolbox.js +0 -564
- package/blocks_vertical/event.js +0 -329
- package/blocks_vertical/extensions.js +0 -294
- package/blocks_vertical/looks.js +0 -591
- package/blocks_vertical/motion.js +0 -587
- package/blocks_vertical/operators.js +0 -470
- package/blocks_vertical/procedures.js +0 -973
- package/blocks_vertical/sensing.js +0 -539
- package/blocks_vertical/sound.js +0 -246
- package/blocks_vertical/vertical_extensions.js +0 -266
- package/build/gen_blocks.js +0 -1
- package/build/test_expect.js +0 -1
- package/build/test_input.js +0 -1
- package/build.py +0 -636
- package/cleanup.sh +0 -101
- package/core/block.js +0 -1837
- package/core/block_animations.js +0 -107
- package/core/block_drag_surface.js +0 -299
- package/core/block_dragger.js +0 -421
- package/core/block_events.js +0 -531
- package/core/block_render_svg_horizontal.js +0 -890
- package/core/block_render_svg_vertical.js +0 -1732
- package/core/block_svg.js +0 -1316
- package/core/blockly.js +0 -622
- package/core/blocks.js +0 -37
- package/core/bubble.js +0 -664
- package/core/bubble_dragger.js +0 -285
- package/core/colours.js +0 -160
- package/core/comment.js +0 -293
- package/core/comment_events.js +0 -539
- package/core/connection.js +0 -766
- package/core/connection_db.js +0 -300
- package/core/constants.js +0 -387
- package/core/contextmenu.js +0 -519
- package/core/css.js +0 -1351
- package/core/data_category.js +0 -490
- package/core/dragged_connection_manager.js +0 -260
- package/core/dropdowndiv.js +0 -408
- package/core/events.js +0 -429
- package/core/events_abstract.js +0 -113
- package/core/extensions.js +0 -450
- package/core/field.js +0 -807
- package/core/field_angle.js +0 -398
- package/core/field_checkbox.js +0 -133
- package/core/field_colour.js +0 -253
- package/core/field_colour_slider.js +0 -387
- package/core/field_date.js +0 -353
- package/core/field_dropdown.js +0 -483
- package/core/field_iconmenu.js +0 -309
- package/core/field_image.js +0 -193
- package/core/field_label.js +0 -136
- package/core/field_label_serializable.js +0 -125
- package/core/field_matrix.js +0 -566
- package/core/field_note.js +0 -850
- package/core/field_number.js +0 -366
- package/core/field_numberdropdown.js +0 -77
- package/core/field_textdropdown.js +0 -164
- package/core/field_textinput.js +0 -675
- package/core/field_textinput_removable.js +0 -105
- package/core/field_variable.js +0 -385
- package/core/field_variable_getter.js +0 -185
- package/core/field_vertical_separator.js +0 -161
- package/core/flyout_base.js +0 -923
- package/core/flyout_button.js +0 -322
- package/core/flyout_dragger.js +0 -83
- package/core/flyout_extension_category_header.js +0 -159
- package/core/flyout_horizontal.js +0 -475
- package/core/flyout_vertical.js +0 -770
- package/core/generator.js +0 -426
- package/core/gesture.js +0 -1011
- package/core/grid.js +0 -227
- package/core/icon.js +0 -205
- package/core/inject.js +0 -491
- package/core/input.js +0 -285
- package/core/insertion_marker_manager.js +0 -678
- package/core/msg.js +0 -62
- package/core/mutator.js +0 -426
- package/core/names.js +0 -198
- package/core/options.js +0 -244
- package/core/procedures.js +0 -577
- package/core/rendered_connection.js +0 -417
- package/core/scratch_block_comment.js +0 -653
- package/core/scratch_blocks_utils.js +0 -244
- package/core/scratch_bubble.js +0 -696
- package/core/scratch_events.js +0 -131
- package/core/scratch_msgs.js +0 -85
- package/core/scrollbar.js +0 -875
- package/core/toolbox.js +0 -801
- package/core/tooltip.js +0 -337
- package/core/touch.js +0 -226
- package/core/trashcan.js +0 -343
- package/core/ui_events.js +0 -91
- package/core/ui_menu_utils.js +0 -68
- package/core/utils.js +0 -948
- package/core/variable_events.js +0 -259
- package/core/variable_map.js +0 -415
- package/core/variable_model.js +0 -116
- package/core/variables.js +0 -674
- package/core/warning.js +0 -199
- package/core/widgetdiv.js +0 -344
- package/core/workspace.js +0 -673
- package/core/workspace_audio.js +0 -170
- package/core/workspace_comment.js +0 -432
- package/core/workspace_comment_render_svg.js +0 -723
- package/core/workspace_comment_svg.js +0 -611
- package/core/workspace_drag_surface_svg.js +0 -195
- package/core/workspace_dragger.js +0 -132
- package/core/workspace_svg.js +0 -2267
- package/core/xml.js +0 -919
- package/core/zoom_controls.js +0 -301
- package/dist/horizontal.js +0 -222
- package/dist/vertical.js +0 -222
- package/dist/web/horizontal.js +0 -232
- package/dist/web/vertical.js +0 -232
- package/local_build.sh +0 -70
- package/pack/scratch-blocks-1.1.206.tgz +0 -0
- package/pull_from_blockly.sh +0 -151
- package/shim/blockly_compressed_horizontal-blocks_compressed.js +0 -1
- package/shim/blockly_compressed_horizontal.Blockly.js +0 -1
- package/shim/blockly_compressed_horizontal.goog.js +0 -1
- package/shim/blockly_compressed_horizontal.js +0 -1
- package/shim/blockly_compressed_vertical-blocks_compressed.js +0 -1
- package/shim/blockly_compressed_vertical.Blockly.js +0 -1
- package/shim/blockly_compressed_vertical.goog.js +0 -1
- package/shim/blockly_compressed_vertical.js +0 -1
- package/shim/blocks_compressed_horizontal-blockly_compressed_horizontal-messages.js +0 -1
- package/shim/blocks_compressed_horizontal.js +0 -1
- package/shim/blocks_compressed_vertical-blockly_compressed_vertical-messages.js +0 -1
- package/shim/blocks_compressed_vertical.js +0 -1
- package/shim/gh-pages.js +0 -1
- package/shim/horizontal.js +0 -1
- package/shim/index.js +0 -17
- package/shim/vertical.js +0 -1
- /package/media/{comment-arrow-down.svg → foldout-icon.svg} +0 -0
package/core/block_svg.js
DELETED
|
@@ -1,1316 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Visual Blocks Editor
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2012 Google Inc.
|
|
6
|
-
* https://developers.google.com/blockly/
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @fileoverview Methods for graphically rendering a block as SVG.
|
|
23
|
-
* @author fraser@google.com (Neil Fraser)
|
|
24
|
-
*/
|
|
25
|
-
'use strict';
|
|
26
|
-
|
|
27
|
-
goog.provide('Blockly.BlockSvg');
|
|
28
|
-
|
|
29
|
-
goog.require('Blockly.Block');
|
|
30
|
-
goog.require('Blockly.BlockAnimations');
|
|
31
|
-
goog.require('Blockly.ContextMenu');
|
|
32
|
-
goog.require('Blockly.Events.Ui');
|
|
33
|
-
goog.require('Blockly.Events.BlockMove');
|
|
34
|
-
goog.require('Blockly.Grid');
|
|
35
|
-
goog.require('Blockly.RenderedConnection');
|
|
36
|
-
goog.require('Blockly.scratchBlocksUtils');
|
|
37
|
-
goog.require('Blockly.Tooltip');
|
|
38
|
-
goog.require('Blockly.Touch');
|
|
39
|
-
goog.require('Blockly.utils');
|
|
40
|
-
|
|
41
|
-
goog.require('goog.Timer');
|
|
42
|
-
goog.require('goog.asserts');
|
|
43
|
-
goog.require('goog.dom');
|
|
44
|
-
goog.require('goog.math.Coordinate');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Class for a block's SVG representation.
|
|
49
|
-
* Not normally called directly, workspace.newBlock() is preferred.
|
|
50
|
-
* @param {!Blockly.Workspace} workspace The block's workspace.
|
|
51
|
-
* @param {?string} prototypeName Name of the language object containing
|
|
52
|
-
* type-specific functions for this block.
|
|
53
|
-
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
|
|
54
|
-
* create a new ID. If the ID conflicts with an in-use ID, a new one will
|
|
55
|
-
* be generated.
|
|
56
|
-
* @extends {Blockly.Block}
|
|
57
|
-
* @constructor
|
|
58
|
-
*/
|
|
59
|
-
Blockly.BlockSvg = function(workspace, prototypeName, opt_id) {
|
|
60
|
-
// Create core elements for the block.
|
|
61
|
-
/**
|
|
62
|
-
* @type {SVGElement}
|
|
63
|
-
* @private
|
|
64
|
-
*/
|
|
65
|
-
this.svgGroup_ = Blockly.utils.createSvgElement('g', {}, null);
|
|
66
|
-
/** @type {SVGElement} */
|
|
67
|
-
this.svgPath_ = Blockly.utils.createSvgElement('path',
|
|
68
|
-
{'class': 'blocklyPath blocklyBlockBackground'},
|
|
69
|
-
this.svgGroup_);
|
|
70
|
-
this.svgPath_.tooltip = this;
|
|
71
|
-
|
|
72
|
-
/** @type {boolean} */
|
|
73
|
-
this.rendered = false;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Whether to move the block to the drag surface when it is dragged.
|
|
77
|
-
* True if it should move, false if it should be translated directly.
|
|
78
|
-
* @type {boolean}
|
|
79
|
-
* @private
|
|
80
|
-
*/
|
|
81
|
-
this.useDragSurface_ = Blockly.utils.is3dSupported() && !!workspace.blockDragSurface_;
|
|
82
|
-
|
|
83
|
-
Blockly.Tooltip.bindMouseEvents(this.svgPath_);
|
|
84
|
-
Blockly.BlockSvg.superClass_.constructor.call(this,
|
|
85
|
-
workspace, prototypeName, opt_id);
|
|
86
|
-
|
|
87
|
-
// Expose this block's ID on its top-level SVG group.
|
|
88
|
-
if (this.svgGroup_.dataset) {
|
|
89
|
-
this.svgGroup_.dataset.id = this.id;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
goog.inherits(Blockly.BlockSvg, Blockly.Block);
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Height of this block, not including any statement blocks above or below.
|
|
96
|
-
* Height is in workspace units.
|
|
97
|
-
*/
|
|
98
|
-
Blockly.BlockSvg.prototype.height = 0;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Width of this block, including any connected value blocks.
|
|
102
|
-
* Width is in workspace units.
|
|
103
|
-
*/
|
|
104
|
-
Blockly.BlockSvg.prototype.width = 0;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Minimum width of block if insertion marker; comes from inserting block.
|
|
108
|
-
* @type {number}
|
|
109
|
-
*/
|
|
110
|
-
Blockly.BlockSvg.prototype.insertionMarkerMinWidth_ = 0;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Opacity of this block between 0 and 1.
|
|
114
|
-
* @type {number}
|
|
115
|
-
* @private
|
|
116
|
-
*/
|
|
117
|
-
Blockly.BlockSvg.prototype.opacity_ = 1;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Original location of block being dragged.
|
|
121
|
-
* @type {goog.math.Coordinate}
|
|
122
|
-
* @private
|
|
123
|
-
*/
|
|
124
|
-
Blockly.BlockSvg.prototype.dragStartXY_ = null;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Whether the block glows as if running.
|
|
128
|
-
* @type {boolean}
|
|
129
|
-
* @private
|
|
130
|
-
*/
|
|
131
|
-
Blockly.BlockSvg.prototype.isGlowingBlock_ = false;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Whether the block's whole stack glows as if running.
|
|
135
|
-
* @type {boolean}
|
|
136
|
-
* @private
|
|
137
|
-
*/
|
|
138
|
-
Blockly.BlockSvg.prototype.isGlowingStack_ = false;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Constant for identifying rows that are to be rendered inline.
|
|
142
|
-
* Don't collide with Blockly.INPUT_VALUE and friends.
|
|
143
|
-
* @const
|
|
144
|
-
*/
|
|
145
|
-
Blockly.BlockSvg.INLINE = -1;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Create and initialize the SVG representation of the block.
|
|
149
|
-
* May be called more than once.
|
|
150
|
-
*/
|
|
151
|
-
Blockly.BlockSvg.prototype.initSvg = function() {
|
|
152
|
-
goog.asserts.assert(this.workspace.rendered, 'Workspace is headless.');
|
|
153
|
-
if (!this.isInsertionMarker()) { // Insertion markers not allowed to have inputs or icons
|
|
154
|
-
// Input shapes are empty holes drawn when a value input is not connected.
|
|
155
|
-
for (var i = 0, input; input = this.inputList[i]; i++) {
|
|
156
|
-
input.init();
|
|
157
|
-
input.initOutlinePath(this.svgGroup_);
|
|
158
|
-
}
|
|
159
|
-
var icons = this.getIcons();
|
|
160
|
-
for (i = 0; i < icons.length; i++) {
|
|
161
|
-
icons[i].createIcon();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
this.updateColour();
|
|
165
|
-
this.updateMovable();
|
|
166
|
-
if (!this.workspace.options.readOnly && !this.eventsInit_) {
|
|
167
|
-
Blockly.bindEventWithChecks_(
|
|
168
|
-
this.getSvgRoot(), 'mousedown', this, this.onMouseDown_);
|
|
169
|
-
}
|
|
170
|
-
this.eventsInit_ = true;
|
|
171
|
-
|
|
172
|
-
if (!this.getSvgRoot().parentNode) {
|
|
173
|
-
this.workspace.getCanvas().appendChild(this.getSvgRoot());
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Select this block. Highlight it visually.
|
|
179
|
-
*/
|
|
180
|
-
Blockly.BlockSvg.prototype.select = function() {
|
|
181
|
-
if (this.isShadow() && this.getParent()) {
|
|
182
|
-
// Shadow blocks should not be selected.
|
|
183
|
-
this.getParent().select();
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
if (Blockly.selected == this) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
var oldId = null;
|
|
190
|
-
if (Blockly.selected) {
|
|
191
|
-
oldId = Blockly.selected.id;
|
|
192
|
-
// Unselect any previously selected block.
|
|
193
|
-
Blockly.Events.disable();
|
|
194
|
-
try {
|
|
195
|
-
Blockly.selected.unselect();
|
|
196
|
-
} finally {
|
|
197
|
-
Blockly.Events.enable();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
var event = new Blockly.Events.Ui(null, 'selected', oldId, this.id);
|
|
201
|
-
event.workspaceId = this.workspace.id;
|
|
202
|
-
Blockly.Events.fire(event);
|
|
203
|
-
Blockly.selected = this;
|
|
204
|
-
this.addSelect();
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Unselect this block. Remove its highlighting.
|
|
209
|
-
*/
|
|
210
|
-
Blockly.BlockSvg.prototype.unselect = function() {
|
|
211
|
-
if (Blockly.selected != this) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
var event = new Blockly.Events.Ui(null, 'selected', this.id, null);
|
|
215
|
-
event.workspaceId = this.workspace.id;
|
|
216
|
-
Blockly.Events.fire(event);
|
|
217
|
-
Blockly.selected = null;
|
|
218
|
-
this.removeSelect();
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Glow only this particular block, to highlight it visually as if it's running.
|
|
223
|
-
* @param {boolean} isGlowingBlock Whether the block should glow.
|
|
224
|
-
*/
|
|
225
|
-
Blockly.BlockSvg.prototype.setGlowBlock = function(isGlowingBlock) {
|
|
226
|
-
this.isGlowingBlock_ = isGlowingBlock;
|
|
227
|
-
this.updateColour();
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Glow the stack starting with this block, to highlight it visually as if it's running.
|
|
232
|
-
* @param {boolean} isGlowingStack Whether the stack starting with this block should glow.
|
|
233
|
-
*/
|
|
234
|
-
Blockly.BlockSvg.prototype.setGlowStack = function(isGlowingStack) {
|
|
235
|
-
this.isGlowingStack_ = isGlowingStack;
|
|
236
|
-
// Update the applied SVG filter if the property has changed
|
|
237
|
-
var svg = this.getSvgRoot();
|
|
238
|
-
if (this.isGlowingStack_ && !svg.hasAttribute('filter')) {
|
|
239
|
-
var stackGlowFilterId = this.workspace.options.stackGlowFilterId || 'blocklyStackGlowFilter';
|
|
240
|
-
svg.setAttribute('filter', 'url(#' + stackGlowFilterId + ')');
|
|
241
|
-
} else if (!this.isGlowingStack_ && svg.hasAttribute('filter')) {
|
|
242
|
-
svg.removeAttribute('filter');
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Block's mutator icon (if any).
|
|
248
|
-
* @type {Blockly.Mutator}
|
|
249
|
-
*/
|
|
250
|
-
Blockly.BlockSvg.prototype.mutator = null;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Block's comment icon (if any).
|
|
254
|
-
* @type {Blockly.Comment}
|
|
255
|
-
*/
|
|
256
|
-
Blockly.BlockSvg.prototype.comment = null;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Block's warning icon (if any).
|
|
260
|
-
* @type {Blockly.Warning}
|
|
261
|
-
*/
|
|
262
|
-
Blockly.BlockSvg.prototype.warning = null;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Returns a list of mutator, comment, and warning icons.
|
|
266
|
-
* @return {!Array} List of icons.
|
|
267
|
-
*/
|
|
268
|
-
Blockly.BlockSvg.prototype.getIcons = function() {
|
|
269
|
-
var icons = [];
|
|
270
|
-
if (this.mutator) {
|
|
271
|
-
icons.push(this.mutator);
|
|
272
|
-
}
|
|
273
|
-
if (this.comment) {
|
|
274
|
-
icons.push(this.comment);
|
|
275
|
-
}
|
|
276
|
-
if (this.warning) {
|
|
277
|
-
icons.push(this.warning);
|
|
278
|
-
}
|
|
279
|
-
return icons;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Set parent of this block to be a new block or null.
|
|
284
|
-
* @param {Blockly.BlockSvg} newParent New parent block.
|
|
285
|
-
*/
|
|
286
|
-
Blockly.BlockSvg.prototype.setParent = function(newParent) {
|
|
287
|
-
var oldParent = this.parentBlock_;
|
|
288
|
-
if (newParent == oldParent) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
Blockly.Field.startCache();
|
|
292
|
-
Blockly.BlockSvg.superClass_.setParent.call(this, newParent);
|
|
293
|
-
Blockly.Field.stopCache();
|
|
294
|
-
|
|
295
|
-
var svgRoot = this.getSvgRoot();
|
|
296
|
-
|
|
297
|
-
// Bail early if workspace is clearing, or we aren't rendered.
|
|
298
|
-
// We won't need to reattach ourselves anywhere.
|
|
299
|
-
if (this.workspace.isClearing || !svgRoot) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var oldXY = this.getRelativeToSurfaceXY();
|
|
304
|
-
if (newParent) {
|
|
305
|
-
newParent.getSvgRoot().appendChild(svgRoot);
|
|
306
|
-
var newXY = this.getRelativeToSurfaceXY();
|
|
307
|
-
// Move the connections to match the child's new position.
|
|
308
|
-
this.moveConnections_(newXY.x - oldXY.x, newXY.y - oldXY.y);
|
|
309
|
-
// If we are a shadow block, inherit tertiary colour.
|
|
310
|
-
if (this.isShadow()) {
|
|
311
|
-
this.setColour(this.getColour(), this.getColourSecondary(),
|
|
312
|
-
newParent.getColourTertiary(), this.getColourQuaternary());
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
// If we are losing a parent, we want to move our DOM element to the
|
|
316
|
-
// root of the workspace.
|
|
317
|
-
else if (oldParent) {
|
|
318
|
-
this.workspace.getCanvas().appendChild(svgRoot);
|
|
319
|
-
this.translate(oldXY.x, oldXY.y);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Return the coordinates of the top-left corner of this block relative to the
|
|
326
|
-
* drawing surface's origin (0,0), in workspace units.
|
|
327
|
-
* If the block is on the workspace, (0, 0) is the origin of the workspace
|
|
328
|
-
* coordinate system.
|
|
329
|
-
* This does not change with workspace scale.
|
|
330
|
-
* @return {!goog.math.Coordinate} Object with .x and .y properties in
|
|
331
|
-
* workspace coordinates.
|
|
332
|
-
*/
|
|
333
|
-
Blockly.BlockSvg.prototype.getRelativeToSurfaceXY = function() {
|
|
334
|
-
// The drawing surface is relative to either the workspace canvas
|
|
335
|
-
// or to the drag surface group.
|
|
336
|
-
var x = 0;
|
|
337
|
-
var y = 0;
|
|
338
|
-
|
|
339
|
-
var dragSurfaceGroup = this.useDragSurface_ ?
|
|
340
|
-
this.workspace.blockDragSurface_.getGroup() : null;
|
|
341
|
-
|
|
342
|
-
var element = this.getSvgRoot();
|
|
343
|
-
if (element) {
|
|
344
|
-
do {
|
|
345
|
-
// Loop through this block and every parent.
|
|
346
|
-
var xy = Blockly.utils.getRelativeXY(element);
|
|
347
|
-
x += xy.x;
|
|
348
|
-
y += xy.y;
|
|
349
|
-
// If this element is the current element on the drag surface, include
|
|
350
|
-
// the translation of the drag surface itself.
|
|
351
|
-
if (this.useDragSurface_ &&
|
|
352
|
-
this.workspace.blockDragSurface_.getCurrentBlock() == element) {
|
|
353
|
-
var surfaceTranslation = this.workspace.blockDragSurface_.getSurfaceTranslation();
|
|
354
|
-
x += surfaceTranslation.x;
|
|
355
|
-
y += surfaceTranslation.y;
|
|
356
|
-
}
|
|
357
|
-
element = element.parentNode;
|
|
358
|
-
} while (element && element != this.workspace.getCanvas() &&
|
|
359
|
-
element != dragSurfaceGroup);
|
|
360
|
-
}
|
|
361
|
-
return new goog.math.Coordinate(x, y);
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Move a block by a relative offset.
|
|
366
|
-
* @param {number} dx Horizontal offset in workspace units.
|
|
367
|
-
* @param {number} dy Vertical offset in workspace units.
|
|
368
|
-
*/
|
|
369
|
-
Blockly.BlockSvg.prototype.moveBy = function(dx, dy) {
|
|
370
|
-
goog.asserts.assert(!this.parentBlock_, 'Block has parent.');
|
|
371
|
-
var eventsEnabled = Blockly.Events.isEnabled();
|
|
372
|
-
if (eventsEnabled) {
|
|
373
|
-
var event = new Blockly.Events.BlockMove(this);
|
|
374
|
-
}
|
|
375
|
-
var xy = this.getRelativeToSurfaceXY();
|
|
376
|
-
this.translate(xy.x + dx, xy.y + dy);
|
|
377
|
-
this.moveConnections_(dx, dy);
|
|
378
|
-
if (eventsEnabled) {
|
|
379
|
-
event.recordNew();
|
|
380
|
-
Blockly.Events.fire(event);
|
|
381
|
-
}
|
|
382
|
-
this.workspace.resizeContents();
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Transforms a block by setting the translation on the transform attribute
|
|
387
|
-
* of the block's SVG.
|
|
388
|
-
* @param {number} x The x coordinate of the translation in workspace units.
|
|
389
|
-
* @param {number} y The y coordinate of the translation in workspace units.
|
|
390
|
-
*/
|
|
391
|
-
Blockly.BlockSvg.prototype.translate = function(x, y) {
|
|
392
|
-
this.getSvgRoot().setAttribute('transform',
|
|
393
|
-
'translate(' + x + ',' + y + ')');
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Move this block to its workspace's drag surface, accounting for positioning.
|
|
398
|
-
* Generally should be called at the same time as setDragging_(true).
|
|
399
|
-
* Does nothing if useDragSurface_ is false.
|
|
400
|
-
* @private
|
|
401
|
-
*/
|
|
402
|
-
Blockly.BlockSvg.prototype.moveToDragSurface_ = function() {
|
|
403
|
-
if (!this.useDragSurface_) {
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
// The translation for drag surface blocks,
|
|
407
|
-
// is equal to the current relative-to-surface position,
|
|
408
|
-
// to keep the position in sync as it move on/off the surface.
|
|
409
|
-
// This is in workspace coordinates.
|
|
410
|
-
var xy = this.getRelativeToSurfaceXY();
|
|
411
|
-
this.clearTransformAttributes_();
|
|
412
|
-
this.workspace.blockDragSurface_.translateSurface(xy.x, xy.y);
|
|
413
|
-
// Execute the move on the top-level SVG component
|
|
414
|
-
this.workspace.blockDragSurface_.setBlocksAndShow(this.getSvgRoot());
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Move this block back to the workspace block canvas.
|
|
419
|
-
* Generally should be called at the same time as setDragging_(false).
|
|
420
|
-
* Does nothing if useDragSurface_ is false.
|
|
421
|
-
* @param {!goog.math.Coordinate} newXY The position the block should take on
|
|
422
|
-
* on the workspace canvas, in workspace coordinates.
|
|
423
|
-
* @private
|
|
424
|
-
*/
|
|
425
|
-
Blockly.BlockSvg.prototype.moveOffDragSurface_ = function(newXY) {
|
|
426
|
-
if (!this.useDragSurface_) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
// Translate to current position, turning off 3d.
|
|
430
|
-
this.translate(newXY.x, newXY.y);
|
|
431
|
-
this.workspace.blockDragSurface_.clearAndHide(this.workspace.getCanvas());
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Move this block during a drag, taking into account whether we are using a
|
|
436
|
-
* drag surface to translate blocks.
|
|
437
|
-
* This block must be a top-level block.
|
|
438
|
-
* @param {!goog.math.Coordinate} newLoc The location to translate to, in
|
|
439
|
-
* workspace coordinates.
|
|
440
|
-
* @package
|
|
441
|
-
*/
|
|
442
|
-
Blockly.BlockSvg.prototype.moveDuringDrag = function(newLoc) {
|
|
443
|
-
if (this.useDragSurface_) {
|
|
444
|
-
this.workspace.blockDragSurface_.translateSurface(newLoc.x, newLoc.y);
|
|
445
|
-
} else {
|
|
446
|
-
this.svgGroup_.translate_ = 'translate(' + newLoc.x + ',' + newLoc.y + ')';
|
|
447
|
-
this.svgGroup_.setAttribute('transform',
|
|
448
|
-
this.svgGroup_.translate_ + this.svgGroup_.skew_);
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Clear the block of transform="..." attributes.
|
|
454
|
-
* Used when the block is switching from 3d to 2d transform or vice versa.
|
|
455
|
-
* @private
|
|
456
|
-
*/
|
|
457
|
-
Blockly.BlockSvg.prototype.clearTransformAttributes_ = function() {
|
|
458
|
-
Blockly.utils.removeAttribute(this.getSvgRoot(), 'transform');
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Snap this block to the nearest grid point.
|
|
463
|
-
*/
|
|
464
|
-
Blockly.BlockSvg.prototype.snapToGrid = function() {
|
|
465
|
-
if (!this.workspace) {
|
|
466
|
-
return; // Deleted block.
|
|
467
|
-
}
|
|
468
|
-
if (this.workspace.isDragging()) {
|
|
469
|
-
return; // Don't bump blocks during a drag.
|
|
470
|
-
}
|
|
471
|
-
if (this.getParent()) {
|
|
472
|
-
return; // Only snap top-level blocks.
|
|
473
|
-
}
|
|
474
|
-
if (this.isInFlyout) {
|
|
475
|
-
return; // Don't move blocks around in a flyout.
|
|
476
|
-
}
|
|
477
|
-
var grid = this.workspace.getGrid();
|
|
478
|
-
if (!grid || !grid.shouldSnap()) {
|
|
479
|
-
return; // Config says no snapping.
|
|
480
|
-
}
|
|
481
|
-
var spacing = grid.getSpacing();
|
|
482
|
-
var half = spacing / 2;
|
|
483
|
-
var xy = this.getRelativeToSurfaceXY();
|
|
484
|
-
var dx = Math.round((xy.x - half) / spacing) * spacing + half - xy.x;
|
|
485
|
-
var dy = Math.round((xy.y - half) / spacing) * spacing + half - xy.y;
|
|
486
|
-
dx = Math.round(dx);
|
|
487
|
-
dy = Math.round(dy);
|
|
488
|
-
if (dx != 0 || dy != 0) {
|
|
489
|
-
this.moveBy(dx, dy);
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* Returns the coordinates of a bounding box describing the dimensions of this
|
|
495
|
-
* block and any blocks stacked below it.
|
|
496
|
-
* Coordinate system: workspace coordinates.
|
|
497
|
-
* @return {!{topLeft: goog.math.Coordinate, bottomRight: goog.math.Coordinate}}
|
|
498
|
-
* Object with top left and bottom right coordinates of the bounding box.
|
|
499
|
-
*/
|
|
500
|
-
Blockly.BlockSvg.prototype.getBoundingRectangle = function() {
|
|
501
|
-
var blockXY = this.getRelativeToSurfaceXY(this);
|
|
502
|
-
var blockBounds = this.getHeightWidth();
|
|
503
|
-
var topLeft;
|
|
504
|
-
var bottomRight;
|
|
505
|
-
if (this.RTL) {
|
|
506
|
-
topLeft = new goog.math.Coordinate(blockXY.x - blockBounds.width,
|
|
507
|
-
blockXY.y);
|
|
508
|
-
bottomRight = new goog.math.Coordinate(blockXY.x,
|
|
509
|
-
blockXY.y + blockBounds.height);
|
|
510
|
-
} else {
|
|
511
|
-
topLeft = new goog.math.Coordinate(blockXY.x, blockXY.y);
|
|
512
|
-
bottomRight = new goog.math.Coordinate(blockXY.x + blockBounds.width,
|
|
513
|
-
blockXY.y + blockBounds.height);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
return {topLeft: topLeft, bottomRight: bottomRight};
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Set block opacity for SVG rendering.
|
|
521
|
-
* @param {number} opacity Intended opacity, betweeen 0 and 1
|
|
522
|
-
*/
|
|
523
|
-
Blockly.BlockSvg.prototype.setOpacity = function(opacity) {
|
|
524
|
-
this.opacity_ = opacity;
|
|
525
|
-
if (this.rendered) {
|
|
526
|
-
this.updateColour();
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* Get block opacity for SVG rendering.
|
|
532
|
-
* @return {number} Intended opacity, betweeen 0 and 1
|
|
533
|
-
*/
|
|
534
|
-
Blockly.BlockSvg.prototype.getOpacity = function() {
|
|
535
|
-
return this.opacity_;
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Set whether the block is collapsed or not.
|
|
540
|
-
* @param {boolean} collapsed True if collapsed.
|
|
541
|
-
*/
|
|
542
|
-
Blockly.BlockSvg.prototype.setCollapsed = function(collapsed) {
|
|
543
|
-
if (this.collapsed_ == collapsed) {
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
var renderList = [];
|
|
547
|
-
// Show/hide the inputs.
|
|
548
|
-
for (var i = 0, input; input = this.inputList[i]; i++) {
|
|
549
|
-
renderList.push.apply(renderList, input.setVisible(!collapsed));
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
var COLLAPSED_INPUT_NAME = '_TEMP_COLLAPSED_INPUT';
|
|
553
|
-
if (collapsed) {
|
|
554
|
-
var icons = this.getIcons();
|
|
555
|
-
for (var i = 0; i < icons.length; i++) {
|
|
556
|
-
icons[i].setVisible(false);
|
|
557
|
-
}
|
|
558
|
-
var text = this.toString(Blockly.COLLAPSE_CHARS);
|
|
559
|
-
this.appendDummyInput(COLLAPSED_INPUT_NAME).appendField(text).init();
|
|
560
|
-
} else {
|
|
561
|
-
this.removeInput(COLLAPSED_INPUT_NAME);
|
|
562
|
-
// Clear any warnings inherited from enclosed blocks.
|
|
563
|
-
this.setWarningText(null);
|
|
564
|
-
}
|
|
565
|
-
Blockly.BlockSvg.superClass_.setCollapsed.call(this, collapsed);
|
|
566
|
-
|
|
567
|
-
if (!renderList.length) {
|
|
568
|
-
// No child blocks, just render this block.
|
|
569
|
-
renderList[0] = this;
|
|
570
|
-
}
|
|
571
|
-
if (this.rendered) {
|
|
572
|
-
for (var i = 0, block; block = renderList[i]; i++) {
|
|
573
|
-
block.render();
|
|
574
|
-
}
|
|
575
|
-
// Don't bump neighbours.
|
|
576
|
-
// Although bumping neighbours would make sense, users often collapse
|
|
577
|
-
// all their functions and store them next to each other. Expanding and
|
|
578
|
-
// bumping causes all their definitions to go out of alignment.
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Open the next (or previous) FieldTextInput.
|
|
584
|
-
* @param {Blockly.Field|Blockly.Block} start Current location.
|
|
585
|
-
* @param {boolean} forward If true go forward, otherwise backward.
|
|
586
|
-
*/
|
|
587
|
-
Blockly.BlockSvg.prototype.tab = function(start, forward) {
|
|
588
|
-
var list = this.createTabList_();
|
|
589
|
-
var i = list.indexOf(start);
|
|
590
|
-
if (i == -1) {
|
|
591
|
-
// No start location, start at the beginning or end.
|
|
592
|
-
i = forward ? -1 : list.length;
|
|
593
|
-
}
|
|
594
|
-
var target = list[forward ? i + 1 : i - 1];
|
|
595
|
-
if (!target) {
|
|
596
|
-
// Ran off of list.
|
|
597
|
-
// If there is an output, tab up to that block.
|
|
598
|
-
var outputBlock = this.outputConnection && this.outputConnection.targetBlock();
|
|
599
|
-
if (outputBlock) {
|
|
600
|
-
outputBlock.tab(this, forward);
|
|
601
|
-
} else { // Otherwise, go to next / previous block, depending on value of `forward`
|
|
602
|
-
var block = forward ? this.getNextBlock() : this.getPreviousBlock();
|
|
603
|
-
if (block) {
|
|
604
|
-
block.tab(this, forward);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
} else if (target instanceof Blockly.Field) {
|
|
608
|
-
target.showEditor_();
|
|
609
|
-
} else {
|
|
610
|
-
target.tab(null, forward);
|
|
611
|
-
}
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Create an ordered list of all text fields and connected inputs.
|
|
616
|
-
* @return {!Array.<!Blockly.FieldTextInput|!Blockly.Input>} The ordered list.
|
|
617
|
-
* @private
|
|
618
|
-
*/
|
|
619
|
-
Blockly.BlockSvg.prototype.createTabList_ = function() {
|
|
620
|
-
// This function need not be efficient since it runs once on a keypress.
|
|
621
|
-
var list = [];
|
|
622
|
-
for (var i = 0, input; input = this.inputList[i]; i++) {
|
|
623
|
-
for (var j = 0, field; field = input.fieldRow[j]; j++) {
|
|
624
|
-
if (field instanceof Blockly.FieldTextInput) {
|
|
625
|
-
// TODO(# 1276): Also support dropdown fields.
|
|
626
|
-
list.push(field);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
if (input.connection) {
|
|
630
|
-
var block = input.connection.targetBlock();
|
|
631
|
-
if (block) {
|
|
632
|
-
list.push(block);
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
return list;
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
/**
|
|
640
|
-
* Handle a mouse-down on an SVG block.
|
|
641
|
-
* @param {!Event} e Mouse down event or touch start event.
|
|
642
|
-
* @private
|
|
643
|
-
*/
|
|
644
|
-
Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
|
|
645
|
-
var gesture = this.workspace && this.workspace.getGesture(e);
|
|
646
|
-
if (gesture) {
|
|
647
|
-
gesture.handleBlockStart(e, this);
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* Load the block's help page in a new window.
|
|
653
|
-
* @private
|
|
654
|
-
*/
|
|
655
|
-
Blockly.BlockSvg.prototype.showHelp_ = function() {
|
|
656
|
-
var url = goog.isFunction(this.helpUrl) ? this.helpUrl() : this.helpUrl;
|
|
657
|
-
if (url) {
|
|
658
|
-
// @todo rewrite
|
|
659
|
-
alert(url);
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Show the context menu for this block.
|
|
666
|
-
* @param {!Event} e Mouse event.
|
|
667
|
-
* @private
|
|
668
|
-
*/
|
|
669
|
-
Blockly.BlockSvg.prototype.showContextMenu_ = function(e) {
|
|
670
|
-
if (this.workspace.options.readOnly || !this.contextMenu) {
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
// Save the current block in a variable for use in closures.
|
|
674
|
-
var block = this;
|
|
675
|
-
var menuOptions = [];
|
|
676
|
-
if (this.isDeletable() && this.isMovable() && !block.isInFlyout) {
|
|
677
|
-
menuOptions.push(
|
|
678
|
-
Blockly.ContextMenu.blockDuplicateOption(block, e));
|
|
679
|
-
if (this.isEditable() && this.workspace.options.comments) {
|
|
680
|
-
menuOptions.push(Blockly.ContextMenu.blockCommentOption(block));
|
|
681
|
-
}
|
|
682
|
-
menuOptions.push(Blockly.ContextMenu.blockDeleteOption(block));
|
|
683
|
-
} else if (this.parentBlock_ && this.isShadow_) {
|
|
684
|
-
this.parentBlock_.showContextMenu_(e);
|
|
685
|
-
return;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
// Allow the block to add or modify menuOptions.
|
|
689
|
-
if (this.customContextMenu) {
|
|
690
|
-
this.customContextMenu(menuOptions);
|
|
691
|
-
}
|
|
692
|
-
Blockly.ContextMenu.show(e, menuOptions, this.RTL);
|
|
693
|
-
Blockly.ContextMenu.currentBlock = this;
|
|
694
|
-
};
|
|
695
|
-
|
|
696
|
-
/**
|
|
697
|
-
* Move the connections for this block and all blocks attached under it.
|
|
698
|
-
* Also update any attached bubbles.
|
|
699
|
-
* @param {number} dx Horizontal offset from current location, in workspace
|
|
700
|
-
* units.
|
|
701
|
-
* @param {number} dy Vertical offset from current location, in workspace
|
|
702
|
-
* units.
|
|
703
|
-
* @private
|
|
704
|
-
*/
|
|
705
|
-
Blockly.BlockSvg.prototype.moveConnections_ = function(dx, dy) {
|
|
706
|
-
if (!this.rendered) {
|
|
707
|
-
// Rendering is required to lay out the blocks.
|
|
708
|
-
// This is probably an invisible block attached to a collapsed block.
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
var myConnections = this.getConnections_(false);
|
|
712
|
-
for (var i = 0; i < myConnections.length; i++) {
|
|
713
|
-
myConnections[i].moveBy(dx, dy);
|
|
714
|
-
}
|
|
715
|
-
var icons = this.getIcons();
|
|
716
|
-
for (i = 0; i < icons.length; i++) {
|
|
717
|
-
icons[i].computeIconLocation();
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
// Recurse through all blocks attached under this one.
|
|
721
|
-
for (i = 0; i < this.childBlocks_.length; i++) {
|
|
722
|
-
this.childBlocks_[i].moveConnections_(dx, dy);
|
|
723
|
-
}
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* Recursively adds or removes the dragging class to this node and its children.
|
|
728
|
-
* @param {boolean} adding True if adding, false if removing.
|
|
729
|
-
* @package
|
|
730
|
-
*/
|
|
731
|
-
Blockly.BlockSvg.prototype.setDragging = function(adding) {
|
|
732
|
-
if (adding) {
|
|
733
|
-
var group = this.getSvgRoot();
|
|
734
|
-
group.translate_ = '';
|
|
735
|
-
group.skew_ = '';
|
|
736
|
-
Blockly.draggingConnections_ =
|
|
737
|
-
Blockly.draggingConnections_.concat(this.getConnections_(true));
|
|
738
|
-
Blockly.utils.addClass(
|
|
739
|
-
/** @type {!Element} */ (this.svgGroup_), 'blocklyDragging');
|
|
740
|
-
} else {
|
|
741
|
-
Blockly.draggingConnections_ = [];
|
|
742
|
-
Blockly.utils.removeClass(
|
|
743
|
-
/** @type {!Element} */ (this.svgGroup_), 'blocklyDragging');
|
|
744
|
-
}
|
|
745
|
-
// Recurse through all blocks attached under this one.
|
|
746
|
-
for (var i = 0; i < this.childBlocks_.length; i++) {
|
|
747
|
-
this.childBlocks_[i].setDragging(adding);
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
/**
|
|
752
|
-
* Add or remove the UI indicating if this block is movable or not.
|
|
753
|
-
*/
|
|
754
|
-
Blockly.BlockSvg.prototype.updateMovable = function() {
|
|
755
|
-
if (this.isMovable()) {
|
|
756
|
-
Blockly.utils.addClass(
|
|
757
|
-
/** @type {!Element} */ (this.svgGroup_), 'blocklyDraggable');
|
|
758
|
-
} else {
|
|
759
|
-
Blockly.utils.removeClass(
|
|
760
|
-
/** @type {!Element} */ (this.svgGroup_), 'blocklyDraggable');
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Set whether this block is movable or not.
|
|
766
|
-
* @param {boolean} movable True if movable.
|
|
767
|
-
*/
|
|
768
|
-
Blockly.BlockSvg.prototype.setMovable = function(movable) {
|
|
769
|
-
Blockly.BlockSvg.superClass_.setMovable.call(this, movable);
|
|
770
|
-
this.updateMovable();
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* Set whether this block is editable or not.
|
|
775
|
-
* @param {boolean} editable True if editable.
|
|
776
|
-
*/
|
|
777
|
-
Blockly.BlockSvg.prototype.setEditable = function(editable) {
|
|
778
|
-
Blockly.BlockSvg.superClass_.setEditable.call(this, editable);
|
|
779
|
-
var icons = this.getIcons();
|
|
780
|
-
for (var i = 0; i < icons.length; i++) {
|
|
781
|
-
icons[i].updateEditable();
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
* Set whether this block is a shadow block or not.
|
|
787
|
-
* @param {boolean} shadow True if a shadow.
|
|
788
|
-
*/
|
|
789
|
-
Blockly.BlockSvg.prototype.setShadow = function(shadow) {
|
|
790
|
-
Blockly.BlockSvg.superClass_.setShadow.call(this, shadow);
|
|
791
|
-
this.updateColour();
|
|
792
|
-
};
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
* Set whether this block is an insertion marker block or not.
|
|
796
|
-
* @param {boolean} insertionMarker True if an insertion marker.
|
|
797
|
-
* @param {Number=} opt_minWidth Optional minimum width of the marker.
|
|
798
|
-
*/
|
|
799
|
-
Blockly.BlockSvg.prototype.setInsertionMarker = function(insertionMarker, opt_minWidth) {
|
|
800
|
-
Blockly.BlockSvg.superClass_.setInsertionMarker.call(this, insertionMarker);
|
|
801
|
-
this.insertionMarkerMinWidth_ = opt_minWidth;
|
|
802
|
-
this.updateColour();
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* Return the root node of the SVG or null if none exists.
|
|
807
|
-
* @return {Element} The root SVG node (probably a group).
|
|
808
|
-
*/
|
|
809
|
-
Blockly.BlockSvg.prototype.getSvgRoot = function() {
|
|
810
|
-
return this.svgGroup_;
|
|
811
|
-
};
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
* Dispose of this block.
|
|
815
|
-
* @param {boolean} healStack If true, then try to heal any gap by connecting
|
|
816
|
-
* the next statement with the previous statement. Otherwise, dispose of
|
|
817
|
-
* all children of this block.
|
|
818
|
-
* @param {boolean} animate If true, show a disposal animation and sound.
|
|
819
|
-
*/
|
|
820
|
-
Blockly.BlockSvg.prototype.dispose = function(healStack, animate) {
|
|
821
|
-
if (!this.workspace) {
|
|
822
|
-
// The block has already been deleted.
|
|
823
|
-
return;
|
|
824
|
-
}
|
|
825
|
-
Blockly.Tooltip.hide();
|
|
826
|
-
Blockly.Field.startCache();
|
|
827
|
-
// Save the block's workspace temporarily so we can resize the
|
|
828
|
-
// contents once the block is disposed.
|
|
829
|
-
var blockWorkspace = this.workspace;
|
|
830
|
-
// If this block is being dragged, unlink the mouse events.
|
|
831
|
-
if (Blockly.selected == this) {
|
|
832
|
-
this.unselect();
|
|
833
|
-
this.workspace.cancelCurrentGesture();
|
|
834
|
-
}
|
|
835
|
-
// If this block has a context menu open, close it.
|
|
836
|
-
if (Blockly.ContextMenu.currentBlock == this) {
|
|
837
|
-
Blockly.ContextMenu.hide();
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
if (animate && this.rendered) {
|
|
841
|
-
this.unplug(healStack);
|
|
842
|
-
Blockly.BlockAnimations.disposeUiEffect(this);
|
|
843
|
-
}
|
|
844
|
-
// Stop rerendering.
|
|
845
|
-
this.rendered = false;
|
|
846
|
-
|
|
847
|
-
Blockly.Events.disable();
|
|
848
|
-
try {
|
|
849
|
-
var icons = this.getIcons();
|
|
850
|
-
for (var i = 0; i < icons.length; i++) {
|
|
851
|
-
icons[i].dispose();
|
|
852
|
-
}
|
|
853
|
-
} finally {
|
|
854
|
-
Blockly.Events.enable();
|
|
855
|
-
}
|
|
856
|
-
Blockly.BlockSvg.superClass_.dispose.call(this, healStack);
|
|
857
|
-
|
|
858
|
-
goog.dom.removeNode(this.svgGroup_);
|
|
859
|
-
blockWorkspace.resizeContents();
|
|
860
|
-
// Sever JavaScript to DOM connections.
|
|
861
|
-
this.svgGroup_ = null;
|
|
862
|
-
this.svgPath_ = null;
|
|
863
|
-
Blockly.Field.stopCache();
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
/**
|
|
867
|
-
* Enable or disable a block.
|
|
868
|
-
*/
|
|
869
|
-
Blockly.BlockSvg.prototype.updateDisabled = function() {
|
|
870
|
-
// not supported
|
|
871
|
-
};
|
|
872
|
-
|
|
873
|
-
/**
|
|
874
|
-
* Returns the comment on this block (or '' if none).
|
|
875
|
-
* @return {string} Block's comment.
|
|
876
|
-
*/
|
|
877
|
-
Blockly.BlockSvg.prototype.getCommentText = function() {
|
|
878
|
-
if (this.comment) {
|
|
879
|
-
var comment = this.comment.getText();
|
|
880
|
-
// Trim off trailing whitespace.
|
|
881
|
-
return comment.replace(/\s+$/, '').replace(/ +\n/g, '\n');
|
|
882
|
-
}
|
|
883
|
-
return '';
|
|
884
|
-
};
|
|
885
|
-
|
|
886
|
-
/**
|
|
887
|
-
* Set this block's comment text.
|
|
888
|
-
* @param {?string} text The text, or null to delete.
|
|
889
|
-
* @param {string=} commentId Id of the comment, or a new one will be generated if not provided.
|
|
890
|
-
* @param {number=} commentX Optional x position for scratch comment in workspace coordinates
|
|
891
|
-
* @param {number=} commentY Optional y position for scratch comment in workspace coordinates
|
|
892
|
-
* @param {boolean=} minimized Optional minimized state for scratch comment, defaults to false
|
|
893
|
-
*/
|
|
894
|
-
Blockly.BlockSvg.prototype.setCommentText = function(text, commentId,
|
|
895
|
-
commentX, commentY, minimized) {
|
|
896
|
-
var changedState = false;
|
|
897
|
-
if (goog.isString(text)) {
|
|
898
|
-
if (!this.comment) {
|
|
899
|
-
this.comment = new Blockly.ScratchBlockComment(this, text, commentId,
|
|
900
|
-
commentX, commentY, minimized);
|
|
901
|
-
changedState = true;
|
|
902
|
-
} else {
|
|
903
|
-
this.comment.setText(/** @type {string} */ (text));
|
|
904
|
-
}
|
|
905
|
-
} else {
|
|
906
|
-
if (this.comment) {
|
|
907
|
-
this.comment.dispose();
|
|
908
|
-
changedState = true;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
if (changedState && this.rendered) {
|
|
912
|
-
this.render();
|
|
913
|
-
if (goog.isString(text)) {
|
|
914
|
-
this.comment.setVisible(true);
|
|
915
|
-
}
|
|
916
|
-
// Adding or removing a comment icon will cause the block to change shape.
|
|
917
|
-
this.bumpNeighbours_();
|
|
918
|
-
}
|
|
919
|
-
};
|
|
920
|
-
|
|
921
|
-
/**
|
|
922
|
-
* Set this block's warning text.
|
|
923
|
-
* @param {?string} text The text, or null to delete.
|
|
924
|
-
* @param {string=} opt_id An optional ID for the warning text to be able to
|
|
925
|
-
* maintain multiple warnings.
|
|
926
|
-
*/
|
|
927
|
-
Blockly.BlockSvg.prototype.setWarningText = function(text, opt_id) {
|
|
928
|
-
if (!this.setWarningText.pid_) {
|
|
929
|
-
// Create a database of warning PIDs.
|
|
930
|
-
// Only runs once per block (and only those with warnings).
|
|
931
|
-
this.setWarningText.pid_ = Object.create(null);
|
|
932
|
-
}
|
|
933
|
-
var id = opt_id || '';
|
|
934
|
-
if (!id) {
|
|
935
|
-
// Kill all previous pending processes, this edit supersedes them all.
|
|
936
|
-
for (var n in this.setWarningText.pid_) {
|
|
937
|
-
clearTimeout(this.setWarningText.pid_[n]);
|
|
938
|
-
delete this.setWarningText.pid_[n];
|
|
939
|
-
}
|
|
940
|
-
} else if (this.setWarningText.pid_[id]) {
|
|
941
|
-
// Only queue up the latest change. Kill any earlier pending process.
|
|
942
|
-
clearTimeout(this.setWarningText.pid_[id]);
|
|
943
|
-
delete this.setWarningText.pid_[id];
|
|
944
|
-
}
|
|
945
|
-
if (this.workspace.isDragging()) {
|
|
946
|
-
// Don't change the warning text during a drag.
|
|
947
|
-
// Wait until the drag finishes.
|
|
948
|
-
var thisBlock = this;
|
|
949
|
-
this.setWarningText.pid_[id] = setTimeout(function() {
|
|
950
|
-
if (thisBlock.workspace) { // Check block wasn't deleted.
|
|
951
|
-
delete thisBlock.setWarningText.pid_[id];
|
|
952
|
-
thisBlock.setWarningText(text, id);
|
|
953
|
-
}
|
|
954
|
-
}, 100);
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
if (this.isInFlyout) {
|
|
958
|
-
text = null;
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
var changedState = false;
|
|
962
|
-
if (goog.isString(text)) {
|
|
963
|
-
if (!this.warning) {
|
|
964
|
-
this.warning = new Blockly.Warning(this);
|
|
965
|
-
changedState = true;
|
|
966
|
-
}
|
|
967
|
-
this.warning.setText(/** @type {string} */ (text), id);
|
|
968
|
-
} else {
|
|
969
|
-
// Dispose all warnings if no ID is given.
|
|
970
|
-
if (this.warning && !id) {
|
|
971
|
-
this.warning.dispose();
|
|
972
|
-
changedState = true;
|
|
973
|
-
} else if (this.warning) {
|
|
974
|
-
var oldText = this.warning.getText();
|
|
975
|
-
this.warning.setText('', id);
|
|
976
|
-
var newText = this.warning.getText();
|
|
977
|
-
if (!newText) {
|
|
978
|
-
this.warning.dispose();
|
|
979
|
-
}
|
|
980
|
-
changedState = oldText != newText;
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
if (changedState && this.rendered) {
|
|
984
|
-
this.render();
|
|
985
|
-
// Adding or removing a warning icon will cause the block to change shape.
|
|
986
|
-
this.bumpNeighbours_();
|
|
987
|
-
}
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Give this block a mutator dialog.
|
|
992
|
-
* @param {Blockly.Mutator} mutator A mutator dialog instance or null to remove.
|
|
993
|
-
*/
|
|
994
|
-
Blockly.BlockSvg.prototype.setMutator = function(mutator) {
|
|
995
|
-
if (this.mutator && this.mutator !== mutator) {
|
|
996
|
-
this.mutator.dispose();
|
|
997
|
-
}
|
|
998
|
-
if (mutator) {
|
|
999
|
-
mutator.block_ = this;
|
|
1000
|
-
this.mutator = mutator;
|
|
1001
|
-
mutator.createIcon();
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
1004
|
-
|
|
1005
|
-
/**
|
|
1006
|
-
* Select this block. Highlight it visually.
|
|
1007
|
-
*/
|
|
1008
|
-
Blockly.BlockSvg.prototype.addSelect = function() {
|
|
1009
|
-
Blockly.utils.addClass(
|
|
1010
|
-
/** @type {!Element} */ (this.svgGroup_), 'blocklySelected');
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
/**
|
|
1014
|
-
* Unselect this block. Remove its highlighting.
|
|
1015
|
-
*/
|
|
1016
|
-
Blockly.BlockSvg.prototype.removeSelect = function() {
|
|
1017
|
-
Blockly.utils.removeClass(
|
|
1018
|
-
/** @type {!Element} */ (this.svgGroup_), 'blocklySelected');
|
|
1019
|
-
};
|
|
1020
|
-
|
|
1021
|
-
/**
|
|
1022
|
-
* Update the cursor over this block by adding or removing a class.
|
|
1023
|
-
* @param {boolean} letMouseThrough True if the blocks should ignore pointer
|
|
1024
|
-
* events, false otherwise.
|
|
1025
|
-
* @package
|
|
1026
|
-
*/
|
|
1027
|
-
Blockly.BlockSvg.prototype.setMouseThroughStyle = function(letMouseThrough) {
|
|
1028
|
-
if (letMouseThrough) {
|
|
1029
|
-
Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
|
|
1030
|
-
'blocklyDraggingMouseThrough');
|
|
1031
|
-
} else {
|
|
1032
|
-
Blockly.utils.removeClass(/** @type {!Element} */ (this.svgGroup_),
|
|
1033
|
-
'blocklyDraggingMouseThrough');
|
|
1034
|
-
}
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
|
-
/**
|
|
1038
|
-
* Update the cursor over this block by adding or removing a class.
|
|
1039
|
-
* @param {boolean} enable True if the delete cursor should be shown, false
|
|
1040
|
-
* otherwise.
|
|
1041
|
-
* @package
|
|
1042
|
-
*/
|
|
1043
|
-
Blockly.BlockSvg.prototype.setDeleteStyle = function(enable) {
|
|
1044
|
-
if (enable) {
|
|
1045
|
-
Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
|
|
1046
|
-
'blocklyDraggingDelete');
|
|
1047
|
-
} else {
|
|
1048
|
-
Blockly.utils.removeClass(/** @type {!Element} */ (this.svgGroup_),
|
|
1049
|
-
'blocklyDraggingDelete');
|
|
1050
|
-
}
|
|
1051
|
-
};
|
|
1052
|
-
|
|
1053
|
-
// Overrides of functions on Blockly.Block that take into account whether the
|
|
1054
|
-
// block has been rendered.
|
|
1055
|
-
|
|
1056
|
-
/**
|
|
1057
|
-
* Change the colour of a block.
|
|
1058
|
-
* @param {number|string} colour HSV hue value, or #RRGGBB string.
|
|
1059
|
-
* @param {number|string} colourSecondary Secondary HSV hue value, or #RRGGBB
|
|
1060
|
-
* string.
|
|
1061
|
-
* @param {number|string} colourTertiary Tertiary HSV hue value, or #RRGGBB
|
|
1062
|
-
* string.
|
|
1063
|
-
* @param {number|string} colourQuaternary Quaternary HSV hue value, or #RRGGBB
|
|
1064
|
-
* string.
|
|
1065
|
-
*/
|
|
1066
|
-
Blockly.BlockSvg.prototype.setColour = function(colour, colourSecondary,
|
|
1067
|
-
colourTertiary, colourQuaternary) {
|
|
1068
|
-
Blockly.BlockSvg.superClass_.setColour.call(this, colour, colourSecondary,
|
|
1069
|
-
colourTertiary, colourQuaternary);
|
|
1070
|
-
|
|
1071
|
-
if (this.rendered) {
|
|
1072
|
-
this.updateColour();
|
|
1073
|
-
}
|
|
1074
|
-
};
|
|
1075
|
-
|
|
1076
|
-
/**
|
|
1077
|
-
* Move this block to the front of the visible workspace.
|
|
1078
|
-
* <g> tags do not respect z-index so SVG renders them in the
|
|
1079
|
-
* order that they are in the DOM. By placing this block first within the
|
|
1080
|
-
* block group's <g>, it will render on top of any other blocks.
|
|
1081
|
-
* @package
|
|
1082
|
-
*/
|
|
1083
|
-
Blockly.BlockSvg.prototype.bringToFront = function() {
|
|
1084
|
-
var block = this;
|
|
1085
|
-
do {
|
|
1086
|
-
var root = block.getSvgRoot();
|
|
1087
|
-
root.parentNode.appendChild(root);
|
|
1088
|
-
block = block.getParent();
|
|
1089
|
-
} while (block);
|
|
1090
|
-
};
|
|
1091
|
-
|
|
1092
|
-
/**
|
|
1093
|
-
* Set whether this block can chain onto the bottom of another block.
|
|
1094
|
-
* @param {boolean} newBoolean True if there can be a previous statement.
|
|
1095
|
-
* @param {(string|Array.<string>|null)=} opt_check Statement type or
|
|
1096
|
-
* list of statement types. Null/undefined if any type could be connected.
|
|
1097
|
-
*/
|
|
1098
|
-
Blockly.BlockSvg.prototype.setPreviousStatement = function(newBoolean,
|
|
1099
|
-
opt_check) {
|
|
1100
|
-
Blockly.BlockSvg.superClass_.setPreviousStatement.call(this, newBoolean,
|
|
1101
|
-
opt_check);
|
|
1102
|
-
|
|
1103
|
-
if (this.rendered) {
|
|
1104
|
-
this.render();
|
|
1105
|
-
this.bumpNeighbours_();
|
|
1106
|
-
}
|
|
1107
|
-
};
|
|
1108
|
-
|
|
1109
|
-
/**
|
|
1110
|
-
* Set whether another block can chain onto the bottom of this block.
|
|
1111
|
-
* @param {boolean} newBoolean True if there can be a next statement.
|
|
1112
|
-
* @param {(string|Array.<string>|null)=} opt_check Statement type or
|
|
1113
|
-
* list of statement types. Null/undefined if any type could be connected.
|
|
1114
|
-
*/
|
|
1115
|
-
Blockly.BlockSvg.prototype.setNextStatement = function(newBoolean, opt_check) {
|
|
1116
|
-
Blockly.BlockSvg.superClass_.setNextStatement.call(this, newBoolean,
|
|
1117
|
-
opt_check);
|
|
1118
|
-
|
|
1119
|
-
if (this.rendered) {
|
|
1120
|
-
this.render();
|
|
1121
|
-
this.bumpNeighbours_();
|
|
1122
|
-
}
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
/**
|
|
1126
|
-
* Set whether this block returns a value.
|
|
1127
|
-
* @param {boolean} newBoolean True if there is an output.
|
|
1128
|
-
* @param {(string|Array.<string>|null)=} opt_check Returned type or list
|
|
1129
|
-
* of returned types. Null or undefined if any type could be returned
|
|
1130
|
-
* (e.g. variable get).
|
|
1131
|
-
*/
|
|
1132
|
-
Blockly.BlockSvg.prototype.setOutput = function(newBoolean, opt_check) {
|
|
1133
|
-
Blockly.BlockSvg.superClass_.setOutput.call(this, newBoolean, opt_check);
|
|
1134
|
-
|
|
1135
|
-
if (this.rendered) {
|
|
1136
|
-
this.render();
|
|
1137
|
-
this.bumpNeighbours_();
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
|
-
/**
|
|
1142
|
-
* Set whether value inputs are arranged horizontally or vertically.
|
|
1143
|
-
* @param {boolean} newBoolean True if inputs are horizontal.
|
|
1144
|
-
*/
|
|
1145
|
-
Blockly.BlockSvg.prototype.setInputsInline = function(newBoolean) {
|
|
1146
|
-
Blockly.BlockSvg.superClass_.setInputsInline.call(this, newBoolean);
|
|
1147
|
-
|
|
1148
|
-
if (this.rendered) {
|
|
1149
|
-
this.render();
|
|
1150
|
-
this.bumpNeighbours_();
|
|
1151
|
-
}
|
|
1152
|
-
};
|
|
1153
|
-
|
|
1154
|
-
/**
|
|
1155
|
-
* Remove an input from this block.
|
|
1156
|
-
* @param {string} name The name of the input.
|
|
1157
|
-
* @param {boolean=} opt_quiet True to prevent error if input is not present.
|
|
1158
|
-
* @throws {goog.asserts.AssertionError} if the input is not present and
|
|
1159
|
-
* opt_quiet is not true.
|
|
1160
|
-
*/
|
|
1161
|
-
Blockly.BlockSvg.prototype.removeInput = function(name, opt_quiet) {
|
|
1162
|
-
Blockly.BlockSvg.superClass_.removeInput.call(this, name, opt_quiet);
|
|
1163
|
-
|
|
1164
|
-
if (this.rendered) {
|
|
1165
|
-
this.render();
|
|
1166
|
-
// Removing an input will cause the block to change shape.
|
|
1167
|
-
this.bumpNeighbours_();
|
|
1168
|
-
}
|
|
1169
|
-
};
|
|
1170
|
-
|
|
1171
|
-
/**
|
|
1172
|
-
* Move a numbered input to a different location on this block.
|
|
1173
|
-
* @param {number} inputIndex Index of the input to move.
|
|
1174
|
-
* @param {number} refIndex Index of input that should be after the moved input.
|
|
1175
|
-
*/
|
|
1176
|
-
Blockly.BlockSvg.prototype.moveNumberedInputBefore = function(
|
|
1177
|
-
inputIndex, refIndex) {
|
|
1178
|
-
Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this, inputIndex,
|
|
1179
|
-
refIndex);
|
|
1180
|
-
|
|
1181
|
-
if (this.rendered) {
|
|
1182
|
-
this.render();
|
|
1183
|
-
// Moving an input will cause the block to change shape.
|
|
1184
|
-
this.bumpNeighbours_();
|
|
1185
|
-
}
|
|
1186
|
-
};
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* Add a value input, statement input or local variable to this block.
|
|
1190
|
-
* @param {number} type Either Blockly.INPUT_VALUE or Blockly.NEXT_STATEMENT or
|
|
1191
|
-
* Blockly.DUMMY_INPUT.
|
|
1192
|
-
* @param {string} name Language-neutral identifier which may used to find this
|
|
1193
|
-
* input again. Should be unique to this block.
|
|
1194
|
-
* @return {!Blockly.Input} The input object created.
|
|
1195
|
-
* @private
|
|
1196
|
-
*/
|
|
1197
|
-
Blockly.BlockSvg.prototype.appendInput_ = function(type, name) {
|
|
1198
|
-
var input = Blockly.BlockSvg.superClass_.appendInput_.call(this, type, name);
|
|
1199
|
-
|
|
1200
|
-
if (this.rendered) {
|
|
1201
|
-
this.render();
|
|
1202
|
-
// Adding an input will cause the block to change shape.
|
|
1203
|
-
this.bumpNeighbours_();
|
|
1204
|
-
}
|
|
1205
|
-
return input;
|
|
1206
|
-
};
|
|
1207
|
-
|
|
1208
|
-
/**
|
|
1209
|
-
* Returns connections originating from this block.
|
|
1210
|
-
* @param {boolean} all If true, return all connections even hidden ones.
|
|
1211
|
-
* Otherwise, for a non-rendered block return an empty list, and for a
|
|
1212
|
-
* collapsed block don't return inputs connections.
|
|
1213
|
-
* @return {!Array.<!Blockly.Connection>} Array of connections.
|
|
1214
|
-
* @package
|
|
1215
|
-
*/
|
|
1216
|
-
Blockly.BlockSvg.prototype.getConnections_ = function(all) {
|
|
1217
|
-
var myConnections = [];
|
|
1218
|
-
if (all || this.rendered) {
|
|
1219
|
-
if (this.outputConnection) {
|
|
1220
|
-
myConnections.push(this.outputConnection);
|
|
1221
|
-
}
|
|
1222
|
-
if (this.previousConnection) {
|
|
1223
|
-
myConnections.push(this.previousConnection);
|
|
1224
|
-
}
|
|
1225
|
-
if (this.nextConnection) {
|
|
1226
|
-
myConnections.push(this.nextConnection);
|
|
1227
|
-
}
|
|
1228
|
-
if (all || !this.collapsed_) {
|
|
1229
|
-
for (var i = 0, input; input = this.inputList[i]; i++) {
|
|
1230
|
-
if (input.connection) {
|
|
1231
|
-
myConnections.push(input.connection);
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
return myConnections;
|
|
1237
|
-
};
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* Create a connection of the specified type.
|
|
1241
|
-
* @param {number} type The type of the connection to create.
|
|
1242
|
-
* @return {!Blockly.RenderedConnection} A new connection of the specified type.
|
|
1243
|
-
* @private
|
|
1244
|
-
*/
|
|
1245
|
-
Blockly.BlockSvg.prototype.makeConnection_ = function(type) {
|
|
1246
|
-
return new Blockly.RenderedConnection(this, type);
|
|
1247
|
-
};
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* Bump unconnected blocks out of alignment. Two blocks which aren't actually
|
|
1251
|
-
* connected should not coincidentally line up on screen.
|
|
1252
|
-
* @private
|
|
1253
|
-
*/
|
|
1254
|
-
Blockly.BlockSvg.prototype.bumpNeighbours_ = function() {
|
|
1255
|
-
if (!this.workspace) {
|
|
1256
|
-
return; // Deleted block.
|
|
1257
|
-
}
|
|
1258
|
-
if (this.workspace.isDragging()) {
|
|
1259
|
-
return; // Don't bump blocks during a drag.
|
|
1260
|
-
}
|
|
1261
|
-
var rootBlock = this.getRootBlock();
|
|
1262
|
-
if (rootBlock.isInFlyout) {
|
|
1263
|
-
return; // Don't move blocks around in a flyout.
|
|
1264
|
-
}
|
|
1265
|
-
// Loop through every connection on this block.
|
|
1266
|
-
var myConnections = this.getConnections_(false);
|
|
1267
|
-
for (var i = 0, connection; connection = myConnections[i]; i++) {
|
|
1268
|
-
|
|
1269
|
-
// Spider down from this block bumping all sub-blocks.
|
|
1270
|
-
if (connection.isConnected() && connection.isSuperior()) {
|
|
1271
|
-
connection.targetBlock().bumpNeighbours_();
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
var neighbours = connection.neighbours_(Blockly.SNAP_RADIUS);
|
|
1275
|
-
for (var j = 0, otherConnection; otherConnection = neighbours[j]; j++) {
|
|
1276
|
-
|
|
1277
|
-
// If both connections are connected, that's probably fine. But if
|
|
1278
|
-
// either one of them is unconnected, then there could be confusion.
|
|
1279
|
-
if (!connection.isConnected() || !otherConnection.isConnected()) {
|
|
1280
|
-
// Only bump blocks if they are from different tree structures.
|
|
1281
|
-
if (otherConnection.getSourceBlock().getRootBlock() != rootBlock) {
|
|
1282
|
-
|
|
1283
|
-
// Always bump the inferior block.
|
|
1284
|
-
if (connection.isSuperior()) {
|
|
1285
|
-
otherConnection.bumpAwayFrom_(connection);
|
|
1286
|
-
} else {
|
|
1287
|
-
connection.bumpAwayFrom_(otherConnection);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
};
|
|
1294
|
-
|
|
1295
|
-
/**
|
|
1296
|
-
* Schedule snapping to grid and bumping neighbours to occur after a brief
|
|
1297
|
-
* delay.
|
|
1298
|
-
* @package
|
|
1299
|
-
*/
|
|
1300
|
-
Blockly.BlockSvg.prototype.scheduleSnapAndBump = function() {
|
|
1301
|
-
var block = this;
|
|
1302
|
-
// Ensure that any snap and bump are part of this move's event group.
|
|
1303
|
-
var group = Blockly.Events.getGroup();
|
|
1304
|
-
|
|
1305
|
-
setTimeout(function() {
|
|
1306
|
-
Blockly.Events.setGroup(group);
|
|
1307
|
-
block.snapToGrid();
|
|
1308
|
-
Blockly.Events.setGroup(false);
|
|
1309
|
-
}, Blockly.BUMP_DELAY / 2);
|
|
1310
|
-
|
|
1311
|
-
setTimeout(function() {
|
|
1312
|
-
Blockly.Events.setGroup(group);
|
|
1313
|
-
block.bumpNeighbours_();
|
|
1314
|
-
Blockly.Events.setGroup(false);
|
|
1315
|
-
}, Blockly.BUMP_DELAY);
|
|
1316
|
-
};
|