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
|
@@ -1,1732 +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.render');
|
|
28
|
-
|
|
29
|
-
goog.require('Blockly.BlockSvg');
|
|
30
|
-
goog.require('Blockly.scratchBlocksUtils');
|
|
31
|
-
goog.require('Blockly.utils');
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// UI constants for rendering blocks.
|
|
35
|
-
/**
|
|
36
|
-
* Grid unit to pixels conversion
|
|
37
|
-
* @const
|
|
38
|
-
*/
|
|
39
|
-
Blockly.BlockSvg.GRID_UNIT = 4;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Horizontal space between elements.
|
|
43
|
-
* @const
|
|
44
|
-
*/
|
|
45
|
-
Blockly.BlockSvg.SEP_SPACE_X = 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Vertical space between elements.
|
|
49
|
-
* @const
|
|
50
|
-
*/
|
|
51
|
-
Blockly.BlockSvg.SEP_SPACE_Y = 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Minimum width of a block.
|
|
55
|
-
* @const
|
|
56
|
-
*/
|
|
57
|
-
Blockly.BlockSvg.MIN_BLOCK_X = 16 * Blockly.BlockSvg.GRID_UNIT;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Minimum width of a block with output (reporters).
|
|
61
|
-
* @const
|
|
62
|
-
*/
|
|
63
|
-
Blockly.BlockSvg.MIN_BLOCK_X_OUTPUT = 12 * Blockly.BlockSvg.GRID_UNIT;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Minimum width of a shadow block with output (single fields).
|
|
67
|
-
* @const
|
|
68
|
-
*/
|
|
69
|
-
Blockly.BlockSvg.MIN_BLOCK_X_SHADOW_OUTPUT = 10 * Blockly.BlockSvg.GRID_UNIT;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Minimum height of a block.
|
|
73
|
-
* @const
|
|
74
|
-
*/
|
|
75
|
-
Blockly.BlockSvg.MIN_BLOCK_Y = 12 * Blockly.BlockSvg.GRID_UNIT;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Height of extra row after a statement input.
|
|
79
|
-
* @const
|
|
80
|
-
*/
|
|
81
|
-
Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y = 8 * Blockly.BlockSvg.GRID_UNIT;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Minimum width of a C- or E-shaped block.
|
|
85
|
-
* @const
|
|
86
|
-
*/
|
|
87
|
-
Blockly.BlockSvg.MIN_BLOCK_X_WITH_STATEMENT = 40 * Blockly.BlockSvg.GRID_UNIT;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Minimum height of a shadow block with output and a single field.
|
|
91
|
-
* This is used for shadow blocks that only contain a field - which are smaller than even reporters.
|
|
92
|
-
* @const
|
|
93
|
-
*/
|
|
94
|
-
Blockly.BlockSvg.MIN_BLOCK_Y_SINGLE_FIELD_OUTPUT = 8 * Blockly.BlockSvg.GRID_UNIT;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Minimum height of a non-shadow block with output, i.e. a reporter.
|
|
98
|
-
* @const
|
|
99
|
-
*/
|
|
100
|
-
Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER = 10 * Blockly.BlockSvg.GRID_UNIT;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Minimum space for a statement input height.
|
|
104
|
-
* @const
|
|
105
|
-
*/
|
|
106
|
-
Blockly.BlockSvg.MIN_STATEMENT_INPUT_HEIGHT = 6 * Blockly.BlockSvg.GRID_UNIT;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Width of vertical notch.
|
|
110
|
-
* @const
|
|
111
|
-
*/
|
|
112
|
-
Blockly.BlockSvg.NOTCH_WIDTH = 8 * Blockly.BlockSvg.GRID_UNIT;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Height of vertical notch.
|
|
116
|
-
* @const
|
|
117
|
-
*/
|
|
118
|
-
Blockly.BlockSvg.NOTCH_HEIGHT = 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Rounded corner radius.
|
|
122
|
-
* @const
|
|
123
|
-
*/
|
|
124
|
-
Blockly.BlockSvg.CORNER_RADIUS = 1 * Blockly.BlockSvg.GRID_UNIT;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Minimum width of statement input edge on the left, in px.
|
|
128
|
-
* @const
|
|
129
|
-
*/
|
|
130
|
-
Blockly.BlockSvg.STATEMENT_INPUT_EDGE_WIDTH = 4 * Blockly.BlockSvg.GRID_UNIT;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Inner space between edge of statement input and notch.
|
|
134
|
-
* @const
|
|
135
|
-
*/
|
|
136
|
-
Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE = 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Height of the top hat.
|
|
140
|
-
* @const
|
|
141
|
-
*/
|
|
142
|
-
Blockly.BlockSvg.START_HAT_HEIGHT = 16;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Height of the vertical separator line for icons that appear at the left edge
|
|
146
|
-
* of a block, such as extension icons.
|
|
147
|
-
* @const
|
|
148
|
-
*/
|
|
149
|
-
Blockly.BlockSvg.ICON_SEPARATOR_HEIGHT = 10 * Blockly.BlockSvg.GRID_UNIT;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Path of the top hat's curve.
|
|
153
|
-
* @const
|
|
154
|
-
*/
|
|
155
|
-
Blockly.BlockSvg.START_HAT_PATH = 'c 25,-22 71,-22 96,0';
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* SVG path for drawing next/previous notch from left to right.
|
|
159
|
-
* @const
|
|
160
|
-
*/
|
|
161
|
-
Blockly.BlockSvg.NOTCH_PATH_LEFT = (
|
|
162
|
-
'c 2,0 3,1 4,2 ' +
|
|
163
|
-
'l 4,4 ' +
|
|
164
|
-
'c 1,1 2,2 4,2 ' +
|
|
165
|
-
'h 12 ' +
|
|
166
|
-
'c 2,0 3,-1 4,-2 ' +
|
|
167
|
-
'l 4,-4 ' +
|
|
168
|
-
'c 1,-1 2,-2 4,-2'
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* SVG path for drawing next/previous notch from right to left.
|
|
173
|
-
* @const
|
|
174
|
-
*/
|
|
175
|
-
Blockly.BlockSvg.NOTCH_PATH_RIGHT = (
|
|
176
|
-
'c -2,0 -3,1 -4,2 ' +
|
|
177
|
-
'l -4,4 ' +
|
|
178
|
-
'c -1,1 -2,2 -4,2 ' +
|
|
179
|
-
'h -12 ' +
|
|
180
|
-
'c -2,0 -3,-1 -4,-2 ' +
|
|
181
|
-
'l -4,-4 ' +
|
|
182
|
-
'c -1,-1 -2,-2 -4,-2'
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Amount of padding before the notch.
|
|
187
|
-
* @const
|
|
188
|
-
*/
|
|
189
|
-
Blockly.BlockSvg.NOTCH_START_PADDING = 3 * Blockly.BlockSvg.GRID_UNIT;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* SVG start point for drawing the top-left corner.
|
|
193
|
-
* @const
|
|
194
|
-
*/
|
|
195
|
-
Blockly.BlockSvg.TOP_LEFT_CORNER_START =
|
|
196
|
-
'm 0,' + Blockly.BlockSvg.CORNER_RADIUS;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* SVG path for drawing the rounded top-left corner.
|
|
200
|
-
* @const
|
|
201
|
-
*/
|
|
202
|
-
Blockly.BlockSvg.TOP_LEFT_CORNER =
|
|
203
|
-
'A ' + Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
204
|
-
Blockly.BlockSvg.CORNER_RADIUS + ' 0 0,1 ' +
|
|
205
|
-
Blockly.BlockSvg.CORNER_RADIUS + ',0';
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* SVG path for drawing the rounded top-right corner.
|
|
209
|
-
* @const
|
|
210
|
-
*/
|
|
211
|
-
Blockly.BlockSvg.TOP_RIGHT_CORNER =
|
|
212
|
-
'a ' + Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
213
|
-
Blockly.BlockSvg.CORNER_RADIUS + ' 0 0,1 ' +
|
|
214
|
-
Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
215
|
-
Blockly.BlockSvg.CORNER_RADIUS;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* SVG path for drawing the rounded bottom-right corner.
|
|
219
|
-
* @const
|
|
220
|
-
*/
|
|
221
|
-
Blockly.BlockSvg.BOTTOM_RIGHT_CORNER =
|
|
222
|
-
' a ' + Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
223
|
-
Blockly.BlockSvg.CORNER_RADIUS + ' 0 0,1 -' +
|
|
224
|
-
Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
225
|
-
Blockly.BlockSvg.CORNER_RADIUS;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* SVG path for drawing the rounded bottom-left corner.
|
|
229
|
-
* @const
|
|
230
|
-
*/
|
|
231
|
-
Blockly.BlockSvg.BOTTOM_LEFT_CORNER =
|
|
232
|
-
'a ' + Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
233
|
-
Blockly.BlockSvg.CORNER_RADIUS + ' 0 0,1 -' +
|
|
234
|
-
Blockly.BlockSvg.CORNER_RADIUS + ',-' +
|
|
235
|
-
Blockly.BlockSvg.CORNER_RADIUS;
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* SVG path for drawing the top-left corner of a statement input.
|
|
239
|
-
* @const
|
|
240
|
-
*/
|
|
241
|
-
Blockly.BlockSvg.INNER_TOP_LEFT_CORNER =
|
|
242
|
-
' a ' + Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
243
|
-
Blockly.BlockSvg.CORNER_RADIUS + ' 0 0,0 -' +
|
|
244
|
-
Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
245
|
-
Blockly.BlockSvg.CORNER_RADIUS;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* SVG path for drawing the bottom-left corner of a statement input.
|
|
249
|
-
* Includes the rounded inside corner.
|
|
250
|
-
* @const
|
|
251
|
-
*/
|
|
252
|
-
Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER =
|
|
253
|
-
'a ' + Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
254
|
-
Blockly.BlockSvg.CORNER_RADIUS + ' 0 0,0 ' +
|
|
255
|
-
Blockly.BlockSvg.CORNER_RADIUS + ',' +
|
|
256
|
-
Blockly.BlockSvg.CORNER_RADIUS;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* SVG path for an empty hexagonal input shape.
|
|
260
|
-
* @const
|
|
261
|
-
*/
|
|
262
|
-
Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL =
|
|
263
|
-
'M ' + 4 * Blockly.BlockSvg.GRID_UNIT + ',0 ' +
|
|
264
|
-
' h ' + 4 * Blockly.BlockSvg.GRID_UNIT +
|
|
265
|
-
' l ' + 4 * Blockly.BlockSvg.GRID_UNIT + ',' + 4 * Blockly.BlockSvg.GRID_UNIT +
|
|
266
|
-
' l ' + -4 * Blockly.BlockSvg.GRID_UNIT + ',' + 4 * Blockly.BlockSvg.GRID_UNIT +
|
|
267
|
-
' h ' + -4 * Blockly.BlockSvg.GRID_UNIT +
|
|
268
|
-
' l ' + -4 * Blockly.BlockSvg.GRID_UNIT + ',' + -4 * Blockly.BlockSvg.GRID_UNIT +
|
|
269
|
-
' l ' + 4 * Blockly.BlockSvg.GRID_UNIT + ',' + -4 * Blockly.BlockSvg.GRID_UNIT +
|
|
270
|
-
' z';
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Width of empty boolean input shape.
|
|
274
|
-
* @const
|
|
275
|
-
*/
|
|
276
|
-
Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL_WIDTH = 12 * Blockly.BlockSvg.GRID_UNIT;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* SVG path for an empty square input shape.
|
|
280
|
-
* @const
|
|
281
|
-
*/
|
|
282
|
-
Blockly.BlockSvg.INPUT_SHAPE_SQUARE =
|
|
283
|
-
Blockly.BlockSvg.TOP_LEFT_CORNER_START +
|
|
284
|
-
Blockly.BlockSvg.TOP_LEFT_CORNER +
|
|
285
|
-
' h ' + (12 * Blockly.BlockSvg.GRID_UNIT - 2 * Blockly.BlockSvg.CORNER_RADIUS) +
|
|
286
|
-
Blockly.BlockSvg.TOP_RIGHT_CORNER +
|
|
287
|
-
' v ' + (8 * Blockly.BlockSvg.GRID_UNIT - 2 * Blockly.BlockSvg.CORNER_RADIUS) +
|
|
288
|
-
Blockly.BlockSvg.BOTTOM_RIGHT_CORNER +
|
|
289
|
-
' h ' + (-12 * Blockly.BlockSvg.GRID_UNIT + 2 * Blockly.BlockSvg.CORNER_RADIUS) +
|
|
290
|
-
Blockly.BlockSvg.BOTTOM_LEFT_CORNER +
|
|
291
|
-
' z';
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Width of empty square input shape.
|
|
295
|
-
* @const
|
|
296
|
-
*/
|
|
297
|
-
Blockly.BlockSvg.INPUT_SHAPE_SQUARE_WIDTH = 10 * Blockly.BlockSvg.GRID_UNIT;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* SVG path for an empty round input shape.
|
|
301
|
-
* @const
|
|
302
|
-
*/
|
|
303
|
-
|
|
304
|
-
Blockly.BlockSvg.INPUT_SHAPE_ROUND =
|
|
305
|
-
'M ' + (4 * Blockly.BlockSvg.GRID_UNIT) + ',0' +
|
|
306
|
-
' h ' + (4 * Blockly.BlockSvg.GRID_UNIT) +
|
|
307
|
-
' a ' + (4 * Blockly.BlockSvg.GRID_UNIT) + ' ' +
|
|
308
|
-
(4 * Blockly.BlockSvg.GRID_UNIT) + ' 0 0 1 0 ' + (8 * Blockly.BlockSvg.GRID_UNIT) +
|
|
309
|
-
' h ' + (-4 * Blockly.BlockSvg.GRID_UNIT) +
|
|
310
|
-
' a ' + (4 * Blockly.BlockSvg.GRID_UNIT) + ' ' +
|
|
311
|
-
(4 * Blockly.BlockSvg.GRID_UNIT) + ' 0 0 1 0 -' + (8 * Blockly.BlockSvg.GRID_UNIT) +
|
|
312
|
-
' z';
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Width of empty round input shape.
|
|
316
|
-
* @const
|
|
317
|
-
*/
|
|
318
|
-
Blockly.BlockSvg.INPUT_SHAPE_ROUND_WIDTH = 12 * Blockly.BlockSvg.GRID_UNIT;
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Height of empty input shape.
|
|
322
|
-
* @const
|
|
323
|
-
*/
|
|
324
|
-
Blockly.BlockSvg.INPUT_SHAPE_HEIGHT = 8 * Blockly.BlockSvg.GRID_UNIT;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Height of user inputs
|
|
328
|
-
* @const
|
|
329
|
-
*/
|
|
330
|
-
Blockly.BlockSvg.FIELD_HEIGHT = 8 * Blockly.BlockSvg.GRID_UNIT;
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Width of user inputs
|
|
334
|
-
* @const
|
|
335
|
-
*/
|
|
336
|
-
Blockly.BlockSvg.FIELD_WIDTH = 6 * Blockly.BlockSvg.GRID_UNIT;
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Editable field padding (left/right of the text).
|
|
340
|
-
* @const
|
|
341
|
-
*/
|
|
342
|
-
Blockly.BlockSvg.EDITABLE_FIELD_PADDING = 6;
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Square box field padding (left/right of the text).
|
|
346
|
-
* @const
|
|
347
|
-
*/
|
|
348
|
-
Blockly.BlockSvg.BOX_FIELD_PADDING = 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Drop-down arrow padding.
|
|
352
|
-
* @const
|
|
353
|
-
*/
|
|
354
|
-
Blockly.BlockSvg.DROPDOWN_ARROW_PADDING = 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Minimum width of user inputs during editing
|
|
358
|
-
* @const
|
|
359
|
-
*/
|
|
360
|
-
Blockly.BlockSvg.FIELD_WIDTH_MIN_EDIT = 8 * Blockly.BlockSvg.GRID_UNIT;
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Maximum width of user inputs during editing
|
|
364
|
-
* @const
|
|
365
|
-
*/
|
|
366
|
-
Blockly.BlockSvg.FIELD_WIDTH_MAX_EDIT = Infinity;
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Maximum height of user inputs during editing
|
|
370
|
-
* @const
|
|
371
|
-
*/
|
|
372
|
-
Blockly.BlockSvg.FIELD_HEIGHT_MAX_EDIT = Blockly.BlockSvg.FIELD_HEIGHT;
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Top padding of user inputs
|
|
376
|
-
* @const
|
|
377
|
-
*/
|
|
378
|
-
Blockly.BlockSvg.FIELD_TOP_PADDING = 0.5 * Blockly.BlockSvg.GRID_UNIT;
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Corner radius of number inputs
|
|
382
|
-
* @const
|
|
383
|
-
*/
|
|
384
|
-
Blockly.BlockSvg.NUMBER_FIELD_CORNER_RADIUS = 4 * Blockly.BlockSvg.GRID_UNIT;
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Corner radius of text inputs
|
|
388
|
-
* @const
|
|
389
|
-
*/
|
|
390
|
-
Blockly.BlockSvg.TEXT_FIELD_CORNER_RADIUS = 1 * Blockly.BlockSvg.GRID_UNIT;
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Default radius for a field, in px.
|
|
394
|
-
* @const
|
|
395
|
-
*/
|
|
396
|
-
Blockly.BlockSvg.FIELD_DEFAULT_CORNER_RADIUS = 4 * Blockly.BlockSvg.GRID_UNIT;
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Max text display length for a field (per-horizontal/vertical)
|
|
400
|
-
* @const
|
|
401
|
-
*/
|
|
402
|
-
Blockly.BlockSvg.MAX_DISPLAY_LENGTH = Infinity;
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* Minimum X of inputs and fields for blocks with a previous connection.
|
|
406
|
-
* Ensures that inputs will not overlap with the top notch of blocks.
|
|
407
|
-
* @const
|
|
408
|
-
*/
|
|
409
|
-
Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X = 12 * Blockly.BlockSvg.GRID_UNIT;
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* Vertical padding around inline elements.
|
|
413
|
-
* @const
|
|
414
|
-
*/
|
|
415
|
-
Blockly.BlockSvg.INLINE_PADDING_Y = 1 * Blockly.BlockSvg.GRID_UNIT;
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Point size of text field before animation. Must match size in CSS.
|
|
419
|
-
* See implementation in field_textinput.
|
|
420
|
-
*/
|
|
421
|
-
Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_INITIAL = 12;
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Point size of text field after animation.
|
|
425
|
-
* See implementation in field_textinput.
|
|
426
|
-
*/
|
|
427
|
-
Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_FINAL = 12;
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Whether text fields are allowed to expand past their truncated block size.
|
|
431
|
-
* @const{boolean}
|
|
432
|
-
*/
|
|
433
|
-
Blockly.BlockSvg.FIELD_TEXTINPUT_EXPAND_PAST_TRUNCATION = false;
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Whether text fields should animate their positioning.
|
|
437
|
-
* @const{boolean}
|
|
438
|
-
*/
|
|
439
|
-
Blockly.BlockSvg.FIELD_TEXTINPUT_ANIMATE_POSITIONING = false;
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Map of output/input shapes and the amount they should cause a block to be padded.
|
|
443
|
-
* Outer key is the outer shape, inner key is the inner shape.
|
|
444
|
-
* When a block with the outer shape contains an input block with the inner shape
|
|
445
|
-
* on its left or right edge, that side is extended by the padding specified.
|
|
446
|
-
* See also: `Blockly.BlockSvg.computeOutputPadding_`.
|
|
447
|
-
*/
|
|
448
|
-
Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING = {
|
|
449
|
-
1: { // Outer shape: hexagon.
|
|
450
|
-
0: 5 * Blockly.BlockSvg.GRID_UNIT, // Field in hexagon.
|
|
451
|
-
1: 2 * Blockly.BlockSvg.GRID_UNIT, // Hexagon in hexagon.
|
|
452
|
-
2: 5 * Blockly.BlockSvg.GRID_UNIT, // Round in hexagon.
|
|
453
|
-
3: 5 * Blockly.BlockSvg.GRID_UNIT // Square in hexagon.
|
|
454
|
-
},
|
|
455
|
-
2: { // Outer shape: round.
|
|
456
|
-
0: 3 * Blockly.BlockSvg.GRID_UNIT, // Field in round.
|
|
457
|
-
1: 3 * Blockly.BlockSvg.GRID_UNIT, // Hexagon in round.
|
|
458
|
-
2: 1 * Blockly.BlockSvg.GRID_UNIT, // Round in round.
|
|
459
|
-
3: 2 * Blockly.BlockSvg.GRID_UNIT // Square in round.
|
|
460
|
-
},
|
|
461
|
-
3: { // Outer shape: square.
|
|
462
|
-
0: 2 * Blockly.BlockSvg.GRID_UNIT, // Field in square.
|
|
463
|
-
1: 2 * Blockly.BlockSvg.GRID_UNIT, // Hexagon in square.
|
|
464
|
-
2: 2 * Blockly.BlockSvg.GRID_UNIT, // Round in square.
|
|
465
|
-
3: 2 * Blockly.BlockSvg.GRID_UNIT // Square in square.
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Corner radius of the hat on the define block.
|
|
471
|
-
* @const
|
|
472
|
-
*/
|
|
473
|
-
Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS = 5 * Blockly.BlockSvg.GRID_UNIT;
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* SVG path for drawing the rounded top-left corner.
|
|
477
|
-
* @const
|
|
478
|
-
*/
|
|
479
|
-
Blockly.BlockSvg.TOP_LEFT_CORNER_DEFINE_HAT =
|
|
480
|
-
'a ' + Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS + ',' +
|
|
481
|
-
Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS + ' 0 0,1 ' +
|
|
482
|
-
Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS + ',-' +
|
|
483
|
-
Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS;
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* SVG path for drawing the rounded top-left corner.
|
|
487
|
-
* @const
|
|
488
|
-
*/
|
|
489
|
-
Blockly.BlockSvg.TOP_RIGHT_CORNER_DEFINE_HAT =
|
|
490
|
-
'a ' + Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS + ',' +
|
|
491
|
-
Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS + ' 0 0,1 ' +
|
|
492
|
-
Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS + ',' +
|
|
493
|
-
Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS;
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Padding on the right side of the internal block on the define block.
|
|
497
|
-
* @const
|
|
498
|
-
*/
|
|
499
|
-
Blockly.BlockSvg.DEFINE_BLOCK_PADDING_RIGHT = 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Change the colour of a block.
|
|
503
|
-
*/
|
|
504
|
-
Blockly.BlockSvg.prototype.updateColour = function() {
|
|
505
|
-
var strokeColour = this.getColourTertiary();
|
|
506
|
-
var renderShadowed = this.isShadow() &&
|
|
507
|
-
!Blockly.scratchBlocksUtils.isShadowArgumentReporter(this);
|
|
508
|
-
|
|
509
|
-
if (renderShadowed && this.parentBlock_) {
|
|
510
|
-
// Pull shadow block stroke colour from parent block's tertiary if possible.
|
|
511
|
-
strokeColour = this.parentBlock_.getColourTertiary();
|
|
512
|
-
// Special case: if we contain a colour field, set to a special stroke colour.
|
|
513
|
-
if (this.inputList[0] &&
|
|
514
|
-
this.inputList[0].fieldRow[0] &&
|
|
515
|
-
(this.inputList[0].fieldRow[0] instanceof Blockly.FieldColour ||
|
|
516
|
-
this.inputList[0].fieldRow[0] instanceof Blockly.FieldColourSlider)) {
|
|
517
|
-
strokeColour = Blockly.Colours.colourPickerStroke;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
// Render block stroke
|
|
522
|
-
this.svgPath_.setAttribute('stroke', strokeColour);
|
|
523
|
-
|
|
524
|
-
// Render block fill
|
|
525
|
-
if (this.isGlowingBlock_ || renderShadowed) {
|
|
526
|
-
// Use the block's shadow colour if possible.
|
|
527
|
-
if (this.getShadowColour()) {
|
|
528
|
-
var fillColour = this.getShadowColour();
|
|
529
|
-
} else {
|
|
530
|
-
var fillColour = this.getColourSecondary();
|
|
531
|
-
}
|
|
532
|
-
} else {
|
|
533
|
-
var fillColour = this.getColour();
|
|
534
|
-
}
|
|
535
|
-
this.svgPath_.setAttribute('fill', fillColour);
|
|
536
|
-
|
|
537
|
-
// Render opacity
|
|
538
|
-
this.svgPath_.setAttribute('fill-opacity', this.getOpacity());
|
|
539
|
-
|
|
540
|
-
// Update colours of input shapes.
|
|
541
|
-
for (var i = 0, input; input = this.inputList[i]; i++) {
|
|
542
|
-
if (input.outlinePath) {
|
|
543
|
-
input.outlinePath.setAttribute('fill', this.getColourTertiary());
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
// Render icon(s) if applicable
|
|
548
|
-
var icons = this.getIcons();
|
|
549
|
-
for (var i = 0; i < icons.length; i++) {
|
|
550
|
-
icons[i].updateColour();
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
// Bump every dropdown to change its colour.
|
|
554
|
-
for (var x = 0, input; input = this.inputList[x]; x++) {
|
|
555
|
-
for (var y = 0, field; field = input.fieldRow[y]; y++) {
|
|
556
|
-
field.setText(null);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Visual effect to show that if the dragging block is dropped, this block will
|
|
563
|
-
* be replaced. If a shadow block it will disappear. Otherwise it will bump.
|
|
564
|
-
* @param {boolean} add True if highlighting should be added.
|
|
565
|
-
*/
|
|
566
|
-
Blockly.BlockSvg.prototype.highlightForReplacement = function(add) {
|
|
567
|
-
if (add) {
|
|
568
|
-
var replacementGlowFilterId = this.workspace.options.replacementGlowFilterId
|
|
569
|
-
|| 'blocklyReplacementGlowFilter';
|
|
570
|
-
this.svgPath_.setAttribute('filter', 'url(#' + replacementGlowFilterId + ')');
|
|
571
|
-
Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
|
|
572
|
-
'blocklyReplaceable');
|
|
573
|
-
} else {
|
|
574
|
-
this.svgPath_.removeAttribute('filter');
|
|
575
|
-
Blockly.utils.removeClass(/** @type {!Element} */ (this.svgGroup_),
|
|
576
|
-
'blocklyReplaceable');
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
/**
|
|
581
|
-
* Visual effect to show that if the dragging block is dropped it will connect
|
|
582
|
-
* to this input.
|
|
583
|
-
* @param {Blockly.Connection} conn The connection on the input to highlight.
|
|
584
|
-
* @param {boolean} add True if highlighting should be added.
|
|
585
|
-
*/
|
|
586
|
-
Blockly.BlockSvg.prototype.highlightShapeForInput = function(conn, add) {
|
|
587
|
-
var input = this.getInputWithConnection(conn);
|
|
588
|
-
if (!input) {
|
|
589
|
-
throw 'No input found for the connection';
|
|
590
|
-
}
|
|
591
|
-
if (!input.outlinePath) {
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
if (add) {
|
|
595
|
-
var replacementGlowFilterId = this.workspace.options.replacementGlowFilterId
|
|
596
|
-
|| 'blocklyReplacementGlowFilter';
|
|
597
|
-
input.outlinePath.setAttribute('filter',
|
|
598
|
-
'url(#' + replacementGlowFilterId + ')');
|
|
599
|
-
Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
|
|
600
|
-
'blocklyReplaceable');
|
|
601
|
-
} else {
|
|
602
|
-
input.outlinePath.removeAttribute('filter');
|
|
603
|
-
Blockly.utils.removeClass(/** @type {!Element} */ (this.svgGroup_),
|
|
604
|
-
'blocklyReplaceable');
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
* Returns a bounding box describing the dimensions of this block
|
|
610
|
-
* and any blocks stacked below it.
|
|
611
|
-
* @return {!{height: number, width: number}} Object with height and width properties.
|
|
612
|
-
*/
|
|
613
|
-
Blockly.BlockSvg.prototype.getHeightWidth = function() {
|
|
614
|
-
var height = this.height;
|
|
615
|
-
var width = this.width;
|
|
616
|
-
// Recursively add size of subsequent blocks.
|
|
617
|
-
var nextBlock = this.getNextBlock();
|
|
618
|
-
if (nextBlock) {
|
|
619
|
-
var nextHeightWidth = nextBlock.getHeightWidth();
|
|
620
|
-
height += nextHeightWidth.height;
|
|
621
|
-
height -= Blockly.BlockSvg.NOTCH_HEIGHT; // Exclude height of connected notch.
|
|
622
|
-
width = Math.max(width, nextHeightWidth.width);
|
|
623
|
-
}
|
|
624
|
-
return {height: height, width: width};
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* Render the block.
|
|
629
|
-
* Lays out and reflows a block based on its contents and settings.
|
|
630
|
-
* @param {boolean=} opt_bubble If false, just render this block.
|
|
631
|
-
* If true, also render block's parent, grandparent, etc. Defaults to true.
|
|
632
|
-
*/
|
|
633
|
-
Blockly.BlockSvg.prototype.render = function(opt_bubble) {
|
|
634
|
-
Blockly.Field.startCache();
|
|
635
|
-
this.rendered = true;
|
|
636
|
-
|
|
637
|
-
var cursorX = Blockly.BlockSvg.SEP_SPACE_X;
|
|
638
|
-
if (this.RTL) {
|
|
639
|
-
cursorX = -cursorX;
|
|
640
|
-
}
|
|
641
|
-
// Move the icons into position.
|
|
642
|
-
var icons = this.getIcons();
|
|
643
|
-
var scratchCommentIcon = null;
|
|
644
|
-
for (var i = 0; i < icons.length; i++) {
|
|
645
|
-
if (icons[i] instanceof Blockly.ScratchBlockComment) {
|
|
646
|
-
// Don't render scratch block comment icon until
|
|
647
|
-
// after the inputs
|
|
648
|
-
scratchCommentIcon = icons[i];
|
|
649
|
-
} else {
|
|
650
|
-
cursorX = icons[i].renderIcon(cursorX);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
cursorX += this.RTL ?
|
|
654
|
-
Blockly.BlockSvg.SEP_SPACE_X : -Blockly.BlockSvg.SEP_SPACE_X;
|
|
655
|
-
// If there are no icons, cursorX will be 0, otherwise it will be the
|
|
656
|
-
// width that the first label needs to move over by.
|
|
657
|
-
|
|
658
|
-
// If this is an extension reporter block, add a horizontal offset.
|
|
659
|
-
if (this.isScratchExtension && this.outputConnection) {
|
|
660
|
-
cursorX += this.RTL ?
|
|
661
|
-
-Blockly.BlockSvg.GRID_UNIT : Blockly.BlockSvg.GRID_UNIT;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
var inputRows = this.renderCompute_(cursorX);
|
|
665
|
-
this.renderDraw_(cursorX, inputRows);
|
|
666
|
-
this.renderMoveConnections_();
|
|
667
|
-
|
|
668
|
-
this.renderClassify_();
|
|
669
|
-
|
|
670
|
-
// Position the Scratch Block Comment Icon at the end of the block
|
|
671
|
-
if (scratchCommentIcon) {
|
|
672
|
-
var iconX = this.RTL ? -inputRows.rightEdge : inputRows.rightEdge;
|
|
673
|
-
var inputMarginY = inputRows[0].height / 2;
|
|
674
|
-
scratchCommentIcon.renderIcon(iconX, inputMarginY);
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
if (opt_bubble !== false) {
|
|
678
|
-
// Render all blocks above this one (propagate a reflow).
|
|
679
|
-
var parentBlock = this.getParent();
|
|
680
|
-
if (parentBlock) {
|
|
681
|
-
parentBlock.render(true);
|
|
682
|
-
} else {
|
|
683
|
-
// Top-most block. Fire an event to allow scrollbars to resize.
|
|
684
|
-
Blockly.resizeSvgContents(this.workspace);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
Blockly.Field.stopCache();
|
|
688
|
-
};
|
|
689
|
-
|
|
690
|
-
/**
|
|
691
|
-
* Render a list of fields starting at the specified location.
|
|
692
|
-
* @param {!Array.<!Blockly.Field>} fieldList List of fields.
|
|
693
|
-
* @param {number} cursorX X-coordinate to start the fields.
|
|
694
|
-
* @param {number} cursorY Y-coordinate around which fields are centered.
|
|
695
|
-
* @return {number} X-coordinate of the end of the field row (plus a gap).
|
|
696
|
-
* @private
|
|
697
|
-
*/
|
|
698
|
-
Blockly.BlockSvg.prototype.renderFields_ = function(fieldList, cursorX,
|
|
699
|
-
cursorY) {
|
|
700
|
-
if (this.RTL) {
|
|
701
|
-
cursorX = -cursorX;
|
|
702
|
-
}
|
|
703
|
-
for (var t = 0, field; field = fieldList[t]; t++) {
|
|
704
|
-
var root = field.getSvgRoot();
|
|
705
|
-
if (!root) {
|
|
706
|
-
continue;
|
|
707
|
-
}
|
|
708
|
-
// In blocks with a notch, fields should be bumped to a min X,
|
|
709
|
-
// to avoid overlapping with the notch. Label and image fields are
|
|
710
|
-
// excluded.
|
|
711
|
-
if (this.previousConnection && !(field instanceof Blockly.FieldLabel) &&
|
|
712
|
-
!(field instanceof Blockly.FieldImage)) {
|
|
713
|
-
cursorX = this.RTL ?
|
|
714
|
-
Math.min(cursorX, -Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X) :
|
|
715
|
-
Math.max(cursorX, Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X);
|
|
716
|
-
}
|
|
717
|
-
// Offset the field upward by half its height.
|
|
718
|
-
// This vertically centers the fields around cursorY.
|
|
719
|
-
var yOffset = -field.getSize().height / 2;
|
|
720
|
-
|
|
721
|
-
// If this is an extension block, and this field is the first field, and
|
|
722
|
-
// it is an image field, and this block has a previous connection, bump
|
|
723
|
-
// the image down by one grid unit to align it vertically.
|
|
724
|
-
if (this.isScratchExtension && (field === this.inputList[0].fieldRow[0])
|
|
725
|
-
&& (field instanceof Blockly.FieldImage) && this.previousConnection) {
|
|
726
|
-
yOffset += Blockly.BlockSvg.GRID_UNIT;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
// If this is an extension hat block, adjust the height of the vertical
|
|
730
|
-
// separator without adjusting the field height. The effect is to move
|
|
731
|
-
// the bottom end of the line up one grid unit.
|
|
732
|
-
if (this.isScratchExtension &&
|
|
733
|
-
!this.previousConnection && this.nextConnection &&
|
|
734
|
-
field instanceof Blockly.FieldVerticalSeparator) {
|
|
735
|
-
field.setLineHeight(Blockly.BlockSvg.ICON_SEPARATOR_HEIGHT -
|
|
736
|
-
Blockly.BlockSvg.GRID_UNIT);
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
var translateX, translateY;
|
|
740
|
-
var scale = '';
|
|
741
|
-
if (this.RTL) {
|
|
742
|
-
cursorX -= field.renderSep + field.renderWidth;
|
|
743
|
-
translateX = cursorX;
|
|
744
|
-
translateY = cursorY + yOffset;
|
|
745
|
-
if (field.renderWidth) {
|
|
746
|
-
cursorX -= Blockly.BlockSvg.SEP_SPACE_X;
|
|
747
|
-
}
|
|
748
|
-
} else {
|
|
749
|
-
translateX = cursorX + field.renderSep;
|
|
750
|
-
translateY = cursorY + yOffset;
|
|
751
|
-
if (field.renderWidth) {
|
|
752
|
-
cursorX += field.renderSep + field.renderWidth +
|
|
753
|
-
Blockly.BlockSvg.SEP_SPACE_X;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
if (this.RTL &&
|
|
757
|
-
field instanceof Blockly.FieldImage &&
|
|
758
|
-
field.getFlipRTL()) {
|
|
759
|
-
scale = 'scale(-1 1)';
|
|
760
|
-
translateX += field.renderWidth;
|
|
761
|
-
}
|
|
762
|
-
root.setAttribute('transform',
|
|
763
|
-
'translate(' + translateX + ', ' + translateY + ') ' + scale);
|
|
764
|
-
|
|
765
|
-
// Fields are invisible on insertion marker.
|
|
766
|
-
if (this.isInsertionMarker()) {
|
|
767
|
-
root.setAttribute('display', 'none');
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
return this.RTL ? -cursorX : cursorX;
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* Computes the height and widths for each row and field.
|
|
775
|
-
* @param {number} iconWidth Offset of first row due to icons.
|
|
776
|
-
* @return {!Array.<!Array.<!Object>>} 2D array of objects, each containing
|
|
777
|
-
* position information.
|
|
778
|
-
* @private
|
|
779
|
-
*/
|
|
780
|
-
Blockly.BlockSvg.prototype.renderCompute_ = function(iconWidth) {
|
|
781
|
-
var inputList = this.inputList;
|
|
782
|
-
var inputRows = [];
|
|
783
|
-
// Block will be drawn from 0 (left edge) to rightEdge, in px.
|
|
784
|
-
inputRows.rightEdge = 0;
|
|
785
|
-
// Drawn from 0 to bottomEdge vertically.
|
|
786
|
-
inputRows.bottomEdge = 0;
|
|
787
|
-
var fieldValueWidth = 0; // Width of longest external value field.
|
|
788
|
-
var fieldStatementWidth = 0; // Width of longest statement field.
|
|
789
|
-
var hasValue = false;
|
|
790
|
-
var hasStatement = false;
|
|
791
|
-
var hasDummy = false;
|
|
792
|
-
var lastType = undefined;
|
|
793
|
-
|
|
794
|
-
// Previously created row, for special-casing row heights on C- and E- shaped blocks.
|
|
795
|
-
var previousRow;
|
|
796
|
-
for (var i = 0, input; input = inputList[i]; i++) {
|
|
797
|
-
if (!input.isVisible()) {
|
|
798
|
-
continue;
|
|
799
|
-
}
|
|
800
|
-
var isSecondInputOnProcedure = this.type == 'procedures_definition' &&
|
|
801
|
-
lastType && lastType == Blockly.NEXT_STATEMENT;
|
|
802
|
-
var row;
|
|
803
|
-
// Don't create a new row for the second dummy input on a procedure block.
|
|
804
|
-
// See github.com/LLK/scratch-blocks/issues/1658
|
|
805
|
-
// In all other cases, statement and value inputs catch all preceding dummy
|
|
806
|
-
// inputs, and cause a line break before following inputs.
|
|
807
|
-
if (!isSecondInputOnProcedure &&
|
|
808
|
-
(!lastType || lastType == Blockly.NEXT_STATEMENT ||
|
|
809
|
-
input.type == Blockly.NEXT_STATEMENT)) {
|
|
810
|
-
lastType = input.type;
|
|
811
|
-
row = this.createRowForInput_(input);
|
|
812
|
-
inputRows.push(row);
|
|
813
|
-
} else {
|
|
814
|
-
row = inputRows[inputRows.length - 1];
|
|
815
|
-
}
|
|
816
|
-
row.push(input);
|
|
817
|
-
|
|
818
|
-
// Compute minimum dimensions for this input.
|
|
819
|
-
input.renderHeight = this.computeInputHeight_(input, row, previousRow);
|
|
820
|
-
input.renderWidth = this.computeInputWidth_(input);
|
|
821
|
-
|
|
822
|
-
// If the input is a statement input, determine if a notch
|
|
823
|
-
// should be drawn at the inner bottom of the C.
|
|
824
|
-
row.statementNotchAtBottom = true;
|
|
825
|
-
if (input.connection && input.connection.type === Blockly.NEXT_STATEMENT) {
|
|
826
|
-
var linkedBlock = input.connection.targetBlock();
|
|
827
|
-
if (linkedBlock && !linkedBlock.lastConnectionInStack()) {
|
|
828
|
-
row.statementNotchAtBottom = false;
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
// Expand input size.
|
|
833
|
-
if (input.connection) {
|
|
834
|
-
var linkedBlock = input.connection.targetBlock();
|
|
835
|
-
var paddedHeight = 0;
|
|
836
|
-
var paddedWidth = 0;
|
|
837
|
-
if (linkedBlock) {
|
|
838
|
-
// A block is connected to the input - use its size.
|
|
839
|
-
var bBox = linkedBlock.getHeightWidth();
|
|
840
|
-
paddedHeight = bBox.height;
|
|
841
|
-
paddedWidth = bBox.width;
|
|
842
|
-
} else {
|
|
843
|
-
// No block connected - use the size of the rendered empty input shape.
|
|
844
|
-
paddedHeight = Blockly.BlockSvg.INPUT_SHAPE_HEIGHT;
|
|
845
|
-
}
|
|
846
|
-
if (input.connection.type === Blockly.INPUT_VALUE) {
|
|
847
|
-
paddedHeight += 2 * Blockly.BlockSvg.INLINE_PADDING_Y;
|
|
848
|
-
}
|
|
849
|
-
if (input.connection.type === Blockly.NEXT_STATEMENT) {
|
|
850
|
-
// Subtract height of notch, only if the last block in the stack has a next connection.
|
|
851
|
-
if (row.statementNotchAtBottom) {
|
|
852
|
-
paddedHeight -= Blockly.BlockSvg.NOTCH_HEIGHT;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
input.renderHeight = Math.max(input.renderHeight, paddedHeight);
|
|
856
|
-
input.renderWidth = Math.max(input.renderWidth, paddedWidth);
|
|
857
|
-
}
|
|
858
|
-
row.height = Math.max(row.height, input.renderHeight);
|
|
859
|
-
input.fieldWidth = 0;
|
|
860
|
-
if (inputRows.length == 1) {
|
|
861
|
-
// The first row gets shifted to accommodate any icons.
|
|
862
|
-
input.fieldWidth += this.RTL ? -iconWidth : iconWidth;
|
|
863
|
-
}
|
|
864
|
-
var previousFieldEditable = false;
|
|
865
|
-
for (var j = 0, field; field = input.fieldRow[j]; j++) {
|
|
866
|
-
if (j != 0) {
|
|
867
|
-
input.fieldWidth += Blockly.BlockSvg.SEP_SPACE_X;
|
|
868
|
-
}
|
|
869
|
-
// Get the dimensions of the field.
|
|
870
|
-
var fieldSize = field.getSize();
|
|
871
|
-
field.renderWidth = fieldSize.width;
|
|
872
|
-
field.renderSep = (previousFieldEditable && field.EDITABLE) ?
|
|
873
|
-
Blockly.BlockSvg.SEP_SPACE_X : 0;
|
|
874
|
-
// See github.com/LLK/scratch-blocks/issues/1658
|
|
875
|
-
if (!isSecondInputOnProcedure) {
|
|
876
|
-
input.fieldWidth += field.renderWidth + field.renderSep;
|
|
877
|
-
}
|
|
878
|
-
row.height = Math.max(row.height, fieldSize.height);
|
|
879
|
-
previousFieldEditable = field.EDITABLE;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
if (row.type != Blockly.BlockSvg.INLINE) {
|
|
883
|
-
if (row.type == Blockly.NEXT_STATEMENT) {
|
|
884
|
-
hasStatement = true;
|
|
885
|
-
fieldStatementWidth = Math.max(fieldStatementWidth, input.fieldWidth);
|
|
886
|
-
} else {
|
|
887
|
-
if (row.type == Blockly.INPUT_VALUE) {
|
|
888
|
-
hasValue = true;
|
|
889
|
-
} else if (row.type == Blockly.DUMMY_INPUT) {
|
|
890
|
-
hasDummy = true;
|
|
891
|
-
}
|
|
892
|
-
fieldValueWidth = Math.max(fieldValueWidth, input.fieldWidth);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
previousRow = row;
|
|
896
|
-
}
|
|
897
|
-
// Compute padding for output blocks.
|
|
898
|
-
// Data is attached to the row.
|
|
899
|
-
this.computeOutputPadding_(inputRows);
|
|
900
|
-
// Compute the statement edge.
|
|
901
|
-
// This is the width of a block where statements are nested.
|
|
902
|
-
inputRows.statementEdge = Blockly.BlockSvg.STATEMENT_INPUT_EDGE_WIDTH +
|
|
903
|
-
fieldStatementWidth;
|
|
904
|
-
|
|
905
|
-
// Compute the preferred right edge.
|
|
906
|
-
inputRows.rightEdge = this.computeRightEdge_(inputRows.rightEdge,
|
|
907
|
-
hasStatement);
|
|
908
|
-
|
|
909
|
-
// Bottom edge is sum of row heights
|
|
910
|
-
for (var i = 0; i < inputRows.length; i++) {
|
|
911
|
-
inputRows.bottomEdge += inputRows[i].height;
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
inputRows.hasValue = hasValue;
|
|
915
|
-
inputRows.hasStatement = hasStatement;
|
|
916
|
-
inputRows.hasDummy = hasDummy;
|
|
917
|
-
return inputRows;
|
|
918
|
-
};
|
|
919
|
-
|
|
920
|
-
/**
|
|
921
|
-
* Compute the minimum width of this input based on the connection type and
|
|
922
|
-
* outputs.
|
|
923
|
-
* @param {!Blockly.Input} input The input to measure.
|
|
924
|
-
* @return {number} the computed width of this input.
|
|
925
|
-
* @private
|
|
926
|
-
*/
|
|
927
|
-
Blockly.BlockSvg.prototype.computeInputWidth_ = function(input) {
|
|
928
|
-
// Empty input shape widths.
|
|
929
|
-
if (input.type == Blockly.INPUT_VALUE &&
|
|
930
|
-
(!input.connection || !input.connection.isConnected())) {
|
|
931
|
-
switch (input.connection.getOutputShape()) {
|
|
932
|
-
case Blockly.OUTPUT_SHAPE_SQUARE:
|
|
933
|
-
return Blockly.BlockSvg.INPUT_SHAPE_SQUARE_WIDTH;
|
|
934
|
-
case Blockly.OUTPUT_SHAPE_ROUND:
|
|
935
|
-
return Blockly.BlockSvg.INPUT_SHAPE_ROUND_WIDTH;
|
|
936
|
-
case Blockly.OUTPUT_SHAPE_HEXAGONAL:
|
|
937
|
-
return Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL_WIDTH;
|
|
938
|
-
default:
|
|
939
|
-
return 0;
|
|
940
|
-
}
|
|
941
|
-
} else {
|
|
942
|
-
return 0;
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* Compute the minimum height of this input.
|
|
948
|
-
* @param {!Blockly.Input} input The input to measure.
|
|
949
|
-
* @param {!Object} row The row of the block that is currently being measured.
|
|
950
|
-
* @param {!Object} previousRow The previous row of the block, which was just
|
|
951
|
-
* measured.
|
|
952
|
-
* @return {number} the computed height of this input.
|
|
953
|
-
* @private
|
|
954
|
-
*/
|
|
955
|
-
Blockly.BlockSvg.prototype.computeInputHeight_ = function(input, row,
|
|
956
|
-
previousRow) {
|
|
957
|
-
if (this.inputList.length === 1 && this.outputConnection &&
|
|
958
|
-
(this.isShadow() &&
|
|
959
|
-
!Blockly.scratchBlocksUtils.isShadowArgumentReporter(this))) {
|
|
960
|
-
// "Lone" field blocks are smaller.
|
|
961
|
-
return Blockly.BlockSvg.MIN_BLOCK_Y_SINGLE_FIELD_OUTPUT;
|
|
962
|
-
} else if (this.outputConnection) {
|
|
963
|
-
// If this is an extension reporter block, make it taller.
|
|
964
|
-
if (this.isScratchExtension) {
|
|
965
|
-
return Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER + 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
966
|
-
}
|
|
967
|
-
// All other reporters.
|
|
968
|
-
return Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER;
|
|
969
|
-
} else if (row.type == Blockly.NEXT_STATEMENT) {
|
|
970
|
-
// Statement input.
|
|
971
|
-
return Blockly.BlockSvg.MIN_STATEMENT_INPUT_HEIGHT;
|
|
972
|
-
} else if (previousRow && previousRow.type == Blockly.NEXT_STATEMENT) {
|
|
973
|
-
// Extra row for below statement input.
|
|
974
|
-
return Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y;
|
|
975
|
-
} else {
|
|
976
|
-
// If this is an extension block, and it has a previous connection,
|
|
977
|
-
// make it taller.
|
|
978
|
-
if (this.isScratchExtension && this.previousConnection) {
|
|
979
|
-
return Blockly.BlockSvg.MIN_BLOCK_Y + 2 * Blockly.BlockSvg.GRID_UNIT;
|
|
980
|
-
}
|
|
981
|
-
// All other blocks.
|
|
982
|
-
return Blockly.BlockSvg.MIN_BLOCK_Y;
|
|
983
|
-
}
|
|
984
|
-
};
|
|
985
|
-
|
|
986
|
-
/**
|
|
987
|
-
* Create a row for an input and associated fields.
|
|
988
|
-
* @param {!Blockly.Input} input The input that the row is based on.
|
|
989
|
-
* @return {!Object} The new row, with the correct type and default sizing info.
|
|
990
|
-
*/
|
|
991
|
-
Blockly.BlockSvg.prototype.createRowForInput_ = function(input) {
|
|
992
|
-
// Create new row.
|
|
993
|
-
var row = [];
|
|
994
|
-
if (input.type != Blockly.NEXT_STATEMENT) {
|
|
995
|
-
row.type = Blockly.BlockSvg.INLINE;
|
|
996
|
-
} else {
|
|
997
|
-
row.type = input.type;
|
|
998
|
-
}
|
|
999
|
-
row.height = 0;
|
|
1000
|
-
// Default padding for a block: same as separators between fields/inputs.
|
|
1001
|
-
row.paddingStart = Blockly.BlockSvg.SEP_SPACE_X;
|
|
1002
|
-
row.paddingEnd = Blockly.BlockSvg.SEP_SPACE_X;
|
|
1003
|
-
return row;
|
|
1004
|
-
};
|
|
1005
|
-
|
|
1006
|
-
/**
|
|
1007
|
-
* Compute the preferred right edge of the block.
|
|
1008
|
-
* @param {number} curEdge The previously calculated right edge.
|
|
1009
|
-
* @param {boolean} hasStatement Whether this block has a statement input.
|
|
1010
|
-
* @return {number} The preferred right edge of the block.
|
|
1011
|
-
*/
|
|
1012
|
-
Blockly.BlockSvg.prototype.computeRightEdge_ = function(curEdge, hasStatement) {
|
|
1013
|
-
var edge = curEdge;
|
|
1014
|
-
if (this.previousConnection || this.nextConnection) {
|
|
1015
|
-
// Blocks with notches
|
|
1016
|
-
edge = Math.max(edge, Blockly.BlockSvg.MIN_BLOCK_X);
|
|
1017
|
-
} else if (this.outputConnection) {
|
|
1018
|
-
if (this.isShadow() &&
|
|
1019
|
-
!Blockly.scratchBlocksUtils.isShadowArgumentReporter(this)) {
|
|
1020
|
-
// Single-fields
|
|
1021
|
-
edge = Math.max(edge, Blockly.BlockSvg.MIN_BLOCK_X_SHADOW_OUTPUT);
|
|
1022
|
-
} else {
|
|
1023
|
-
// Reporters
|
|
1024
|
-
edge = Math.max(edge, Blockly.BlockSvg.MIN_BLOCK_X_OUTPUT);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
if (hasStatement) {
|
|
1028
|
-
// Statement blocks (C- or E- shaped) have a longer minimum width.
|
|
1029
|
-
edge = Math.max(edge, Blockly.BlockSvg.MIN_BLOCK_X_WITH_STATEMENT);
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
// Ensure insertion markers are at least insertionMarkerMinWidth_ wide.
|
|
1033
|
-
if (this.insertionMarkerMinWidth_ > 0) {
|
|
1034
|
-
edge = Math.max(edge, this.insertionMarkerMinWidth_);
|
|
1035
|
-
}
|
|
1036
|
-
return edge;
|
|
1037
|
-
};
|
|
1038
|
-
|
|
1039
|
-
/**
|
|
1040
|
-
* For a block with output,
|
|
1041
|
-
* determine start and end padding, based on connected inputs.
|
|
1042
|
-
* Padding will depend on the shape of the output, the shape of the input,
|
|
1043
|
-
* and possibly the size of the input.
|
|
1044
|
-
* @param {!Array.<!Array.<!Object>>} inputRows Partially calculated rows.
|
|
1045
|
-
*/
|
|
1046
|
-
Blockly.BlockSvg.prototype.computeOutputPadding_ = function(inputRows) {
|
|
1047
|
-
// Only apply to blocks with outputs and not single fields (shadows).
|
|
1048
|
-
if (!this.getOutputShape() || !this.outputConnection ||
|
|
1049
|
-
(this.isShadow() &&
|
|
1050
|
-
!Blockly.scratchBlocksUtils.isShadowArgumentReporter(this))) {
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
// Blocks with outputs must have single row to be padded.
|
|
1054
|
-
if (inputRows.length > 1) {
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
var row = inputRows[0];
|
|
1058
|
-
var shape = this.getOutputShape();
|
|
1059
|
-
// Reset any padding: it's about to be set.
|
|
1060
|
-
row.paddingStart = 0;
|
|
1061
|
-
row.paddingEnd = 0;
|
|
1062
|
-
// Start row padding: based on first input or first field.
|
|
1063
|
-
var firstInput = row[0];
|
|
1064
|
-
var firstField = firstInput.fieldRow[0];
|
|
1065
|
-
var otherShape;
|
|
1066
|
-
// In checking the left/start side, a field takes precedence over any input.
|
|
1067
|
-
// That's because a field will be rendered before any value input.
|
|
1068
|
-
if (firstField) {
|
|
1069
|
-
otherShape = 0; // Field comes first in the row.
|
|
1070
|
-
} else {
|
|
1071
|
-
// Value input comes first in the row.
|
|
1072
|
-
var inputConnection = firstInput.connection;
|
|
1073
|
-
if (!inputConnection.targetConnection) {
|
|
1074
|
-
// Not connected: use the drawn shape.
|
|
1075
|
-
otherShape = inputConnection.getOutputShape();
|
|
1076
|
-
} else {
|
|
1077
|
-
// Connected: use the connected block's output shape.
|
|
1078
|
-
otherShape = inputConnection.targetConnection.getSourceBlock().getOutputShape();
|
|
1079
|
-
}
|
|
1080
|
-
// Special case for hexagonal output: if the connection is larger height
|
|
1081
|
-
// than a standard reporter, add some start padding.
|
|
1082
|
-
// https://github.com/LLK/scratch-blocks/issues/376
|
|
1083
|
-
if (shape == Blockly.OUTPUT_SHAPE_HEXAGONAL &&
|
|
1084
|
-
otherShape != Blockly.OUTPUT_SHAPE_HEXAGONAL) {
|
|
1085
|
-
var deltaHeight = firstInput.renderHeight - Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER;
|
|
1086
|
-
// One grid unit per level of nesting.
|
|
1087
|
-
row.paddingStart += deltaHeight / 2;
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
row.paddingStart += Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING[shape][otherShape];
|
|
1091
|
-
// End row padding: based on last input or last field.
|
|
1092
|
-
var lastInput = row[row.length - 1];
|
|
1093
|
-
// In checking the right/end side, any value input takes precedence over any field.
|
|
1094
|
-
// That's because fields are rendered before inputs...the last item
|
|
1095
|
-
// in the row will be an input, if one exists.
|
|
1096
|
-
if (lastInput.connection) {
|
|
1097
|
-
// Value input last in the row.
|
|
1098
|
-
var inputConnection = lastInput.connection;
|
|
1099
|
-
if (!inputConnection.targetConnection) {
|
|
1100
|
-
// Not connected: use the drawn shape.
|
|
1101
|
-
otherShape = inputConnection.getOutputShape();
|
|
1102
|
-
} else {
|
|
1103
|
-
// Connected: use the connected block's output shape.
|
|
1104
|
-
otherShape = inputConnection.targetConnection.getSourceBlock().getOutputShape();
|
|
1105
|
-
}
|
|
1106
|
-
// Special case for hexagonal output: if the connection is larger height
|
|
1107
|
-
// than a standard reporter, add some end padding.
|
|
1108
|
-
// https://github.com/LLK/scratch-blocks/issues/376
|
|
1109
|
-
if (shape == Blockly.OUTPUT_SHAPE_HEXAGONAL &&
|
|
1110
|
-
otherShape != Blockly.OUTPUT_SHAPE_HEXAGONAL) {
|
|
1111
|
-
var deltaHeight = lastInput.renderHeight - Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER;
|
|
1112
|
-
// One grid unit per level of nesting.
|
|
1113
|
-
row.paddingEnd += deltaHeight / 2;
|
|
1114
|
-
}
|
|
1115
|
-
} else {
|
|
1116
|
-
// No input in this row - mark as field.
|
|
1117
|
-
otherShape = 0;
|
|
1118
|
-
}
|
|
1119
|
-
row.paddingEnd += Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING[shape][otherShape];
|
|
1120
|
-
};
|
|
1121
|
-
|
|
1122
|
-
/**
|
|
1123
|
-
* Draw the path of the block.
|
|
1124
|
-
* Move the fields to the correct locations.
|
|
1125
|
-
* @param {number} iconWidth Offset of first row due to icons.
|
|
1126
|
-
* @param {!Array.<!Array.<!Object>>} inputRows 2D array of objects, each
|
|
1127
|
-
* containing position information.
|
|
1128
|
-
* @private
|
|
1129
|
-
*/
|
|
1130
|
-
Blockly.BlockSvg.prototype.renderDraw_ = function(iconWidth, inputRows) {
|
|
1131
|
-
this.startHat_ = false;
|
|
1132
|
-
// Should the top left corners be rounded or square?
|
|
1133
|
-
// Currently, it is squared only if it's a hat.
|
|
1134
|
-
this.squareTopLeftCorner_ = false;
|
|
1135
|
-
if (!this.outputConnection && !this.previousConnection) {
|
|
1136
|
-
// No output or previous connection.
|
|
1137
|
-
this.squareTopLeftCorner_ = true;
|
|
1138
|
-
this.startHat_ = true;
|
|
1139
|
-
inputRows.rightEdge = Math.max(inputRows.rightEdge, 100);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
// Amount of space to skip drawing the top and bottom,
|
|
1143
|
-
// to make room for the left and right to draw shapes (curves or angles).
|
|
1144
|
-
this.edgeShapeWidth_ = 0;
|
|
1145
|
-
this.edgeShape_ = null;
|
|
1146
|
-
if (this.outputConnection) {
|
|
1147
|
-
// Width of the curve/pointy-curve
|
|
1148
|
-
var shape = this.getOutputShape();
|
|
1149
|
-
if (shape === Blockly.OUTPUT_SHAPE_HEXAGONAL || shape === Blockly.OUTPUT_SHAPE_ROUND) {
|
|
1150
|
-
this.edgeShapeWidth_ = inputRows.bottomEdge / 2;
|
|
1151
|
-
this.edgeShape_ = shape;
|
|
1152
|
-
this.squareTopLeftCorner_ = true;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
// Assemble the block's path.
|
|
1157
|
-
var steps = [];
|
|
1158
|
-
|
|
1159
|
-
this.renderDrawTop_(steps, inputRows.rightEdge);
|
|
1160
|
-
var cursorY = this.renderDrawRight_(steps, inputRows, iconWidth);
|
|
1161
|
-
this.renderDrawBottom_(steps, cursorY);
|
|
1162
|
-
this.renderDrawLeft_(steps);
|
|
1163
|
-
|
|
1164
|
-
var pathString = steps.join(' ');
|
|
1165
|
-
this.svgPath_.setAttribute('d', pathString);
|
|
1166
|
-
|
|
1167
|
-
if (this.RTL) {
|
|
1168
|
-
// Mirror the block's path.
|
|
1169
|
-
// This is awesome.
|
|
1170
|
-
this.svgPath_.setAttribute('transform', 'scale(-1 1)');
|
|
1171
|
-
}
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
* Give the block an attribute 'data-shapes' that lists its shape[s], and an
|
|
1176
|
-
* attribute 'data-category' with its category.
|
|
1177
|
-
* @private
|
|
1178
|
-
*/
|
|
1179
|
-
Blockly.BlockSvg.prototype.renderClassify_ = function() {
|
|
1180
|
-
var shapes = [];
|
|
1181
|
-
|
|
1182
|
-
if (this.outputConnection) {
|
|
1183
|
-
if (this.isShadow_) {
|
|
1184
|
-
shapes.push('argument');
|
|
1185
|
-
} else {
|
|
1186
|
-
shapes.push('reporter');
|
|
1187
|
-
}
|
|
1188
|
-
if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_HEXAGONAL) {
|
|
1189
|
-
shapes.push('boolean');
|
|
1190
|
-
} else if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_ROUND) {
|
|
1191
|
-
shapes.push('round');
|
|
1192
|
-
}
|
|
1193
|
-
} else {
|
|
1194
|
-
// count the number of statement inputs
|
|
1195
|
-
var inputList = this.inputList;
|
|
1196
|
-
var statementCount = 0;
|
|
1197
|
-
for (var i = 0, input; input = inputList[i]; i++) {
|
|
1198
|
-
if (input.connection && input.connection.type === Blockly.NEXT_STATEMENT) {
|
|
1199
|
-
statementCount++;
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
if (statementCount) {
|
|
1204
|
-
shapes.push('c-block');
|
|
1205
|
-
shapes.push('c-' + statementCount);
|
|
1206
|
-
}
|
|
1207
|
-
if (this.startHat_) {
|
|
1208
|
-
shapes.push('hat'); // c-block+hats are possible (e.x. reprter procedures)
|
|
1209
|
-
} else if (!statementCount) {
|
|
1210
|
-
shapes.push('stack'); //only call it "stack" if it's not a c-block
|
|
1211
|
-
}
|
|
1212
|
-
if (!this.nextConnection) {
|
|
1213
|
-
shapes.push('end');
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
this.svgGroup_.setAttribute('data-shapes', shapes.join(' '));
|
|
1218
|
-
|
|
1219
|
-
if (this.getCategory()) {
|
|
1220
|
-
this.svgGroup_.setAttribute('data-category', this.getCategory());
|
|
1221
|
-
}
|
|
1222
|
-
};
|
|
1223
|
-
|
|
1224
|
-
/**
|
|
1225
|
-
* Render the top edge of the block.
|
|
1226
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1227
|
-
* @param {number} rightEdge Minimum width of block.
|
|
1228
|
-
* @private
|
|
1229
|
-
*/
|
|
1230
|
-
Blockly.BlockSvg.prototype.renderDrawTop_ = function(steps, rightEdge) {
|
|
1231
|
-
if (this.type == Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE) {
|
|
1232
|
-
steps.push('m 0, 0');
|
|
1233
|
-
steps.push(Blockly.BlockSvg.TOP_LEFT_CORNER_DEFINE_HAT);
|
|
1234
|
-
} else {
|
|
1235
|
-
// Position the cursor at the top-left starting point.
|
|
1236
|
-
if (this.squareTopLeftCorner_) {
|
|
1237
|
-
steps.push('m 0,0');
|
|
1238
|
-
if (this.startHat_) {
|
|
1239
|
-
steps.push(Blockly.BlockSvg.START_HAT_PATH);
|
|
1240
|
-
}
|
|
1241
|
-
// Skip space for the output shape
|
|
1242
|
-
if (this.edgeShapeWidth_) {
|
|
1243
|
-
steps.push('m ' + this.edgeShapeWidth_ + ',0');
|
|
1244
|
-
}
|
|
1245
|
-
} else {
|
|
1246
|
-
steps.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START);
|
|
1247
|
-
// Top-left rounded corner.
|
|
1248
|
-
steps.push(Blockly.BlockSvg.TOP_LEFT_CORNER);
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
// Top edge.
|
|
1252
|
-
if (this.previousConnection) {
|
|
1253
|
-
// Space before the notch
|
|
1254
|
-
steps.push('H', Blockly.BlockSvg.NOTCH_START_PADDING);
|
|
1255
|
-
steps.push(Blockly.BlockSvg.NOTCH_PATH_LEFT);
|
|
1256
|
-
// Create previous block connection.
|
|
1257
|
-
var connectionX = (this.RTL ?
|
|
1258
|
-
-Blockly.BlockSvg.NOTCH_WIDTH : Blockly.BlockSvg.NOTCH_WIDTH);
|
|
1259
|
-
this.previousConnection.setOffsetInBlock(connectionX, 0);
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
this.width = rightEdge;
|
|
1263
|
-
};
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
* Render the right edge of the block.
|
|
1267
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1268
|
-
* @param {!Array.<!Array.<!Object>>} inputRows 2D array of objects, each
|
|
1269
|
-
* containing position information.
|
|
1270
|
-
* @param {number} iconWidth Offset of first row due to icons.
|
|
1271
|
-
* @return {number} Height of block.
|
|
1272
|
-
* @private
|
|
1273
|
-
*/
|
|
1274
|
-
Blockly.BlockSvg.prototype.renderDrawRight_ = function(steps,
|
|
1275
|
-
inputRows, iconWidth) {
|
|
1276
|
-
var cursorX = 0;
|
|
1277
|
-
var cursorY = 0;
|
|
1278
|
-
var connectionX, connectionY;
|
|
1279
|
-
for (var y = 0, row; row = inputRows[y]; y++) {
|
|
1280
|
-
cursorX = row.paddingStart;
|
|
1281
|
-
if (y == 0) {
|
|
1282
|
-
cursorX += this.RTL ? -iconWidth : iconWidth;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
if (row.type == Blockly.BlockSvg.INLINE) {
|
|
1286
|
-
// Inline inputs.
|
|
1287
|
-
for (var x = 0, input; input = row[x]; x++) {
|
|
1288
|
-
// Align fields vertically within the row.
|
|
1289
|
-
// Moves the field to half of the row's height.
|
|
1290
|
-
// In renderFields_, the field is further centered
|
|
1291
|
-
// by its own rendered height.
|
|
1292
|
-
var fieldY = cursorY + row.height / 2;
|
|
1293
|
-
|
|
1294
|
-
var fieldX = Blockly.BlockSvg.getAlignedCursor_(cursorX, input,
|
|
1295
|
-
inputRows.rightEdge);
|
|
1296
|
-
|
|
1297
|
-
cursorX = this.renderFields_(input.fieldRow, fieldX, fieldY);
|
|
1298
|
-
if (input.type == Blockly.INPUT_VALUE) {
|
|
1299
|
-
// Create inline input connection.
|
|
1300
|
-
// In blocks with a notch, inputs should be bumped to a min X,
|
|
1301
|
-
// to avoid overlapping with the notch.
|
|
1302
|
-
if (this.previousConnection) {
|
|
1303
|
-
cursorX = Math.max(cursorX, Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X);
|
|
1304
|
-
}
|
|
1305
|
-
connectionX = this.RTL ? -cursorX : cursorX;
|
|
1306
|
-
// Attempt to center the connection vertically.
|
|
1307
|
-
var connectionYOffset = row.height / 2;
|
|
1308
|
-
connectionY = cursorY + connectionYOffset;
|
|
1309
|
-
input.connection.setOffsetInBlock(connectionX, connectionY);
|
|
1310
|
-
this.renderInputShape_(input, cursorX, cursorY + connectionYOffset);
|
|
1311
|
-
cursorX += input.renderWidth + Blockly.BlockSvg.SEP_SPACE_X;
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
// Remove final separator and replace it with right-padding.
|
|
1315
|
-
cursorX -= Blockly.BlockSvg.SEP_SPACE_X;
|
|
1316
|
-
cursorX += row.paddingEnd;
|
|
1317
|
-
// Update right edge for all inputs, such that all rows
|
|
1318
|
-
// stretch to be at least the size of all previous rows.
|
|
1319
|
-
inputRows.rightEdge = Math.max(cursorX, inputRows.rightEdge);
|
|
1320
|
-
// Move to the right edge
|
|
1321
|
-
cursorX = Math.max(cursorX, inputRows.rightEdge);
|
|
1322
|
-
this.width = Math.max(this.width, cursorX);
|
|
1323
|
-
if (!this.edgeShape_) {
|
|
1324
|
-
// Include corner radius in drawing the horizontal line.
|
|
1325
|
-
steps.push('H', cursorX - Blockly.BlockSvg.CORNER_RADIUS - this.edgeShapeWidth_);
|
|
1326
|
-
steps.push(Blockly.BlockSvg.TOP_RIGHT_CORNER);
|
|
1327
|
-
} else {
|
|
1328
|
-
// Don't include corner radius - no corner (edge shape drawn).
|
|
1329
|
-
steps.push('H', cursorX - this.edgeShapeWidth_);
|
|
1330
|
-
}
|
|
1331
|
-
// Subtract CORNER_RADIUS * 2 to account for the top right corner
|
|
1332
|
-
// and also the bottom right corner. Only move vertically the non-corner length.
|
|
1333
|
-
if (!this.edgeShape_) {
|
|
1334
|
-
steps.push('v', row.height - Blockly.BlockSvg.CORNER_RADIUS * 2);
|
|
1335
|
-
}
|
|
1336
|
-
} else if (row.type == Blockly.NEXT_STATEMENT) {
|
|
1337
|
-
// Nested statement.
|
|
1338
|
-
var input = row[0];
|
|
1339
|
-
var fieldX = cursorX;
|
|
1340
|
-
// Align fields vertically within the row.
|
|
1341
|
-
// In renderFields_, the field is further centered by its own height.
|
|
1342
|
-
var fieldY = cursorY;
|
|
1343
|
-
fieldY += Blockly.BlockSvg.MIN_STATEMENT_INPUT_HEIGHT;
|
|
1344
|
-
this.renderFields_(input.fieldRow, fieldX, fieldY);
|
|
1345
|
-
// Move to the start of the notch.
|
|
1346
|
-
cursorX = inputRows.statementEdge + Blockly.BlockSvg.NOTCH_WIDTH;
|
|
1347
|
-
|
|
1348
|
-
if (this.type == Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE) {
|
|
1349
|
-
this.renderDefineBlock_(steps, inputRows, input, row, cursorY);
|
|
1350
|
-
} else {
|
|
1351
|
-
Blockly.BlockSvg.drawStatementInputFromTopRight_(steps, cursorX,
|
|
1352
|
-
inputRows.rightEdge, row);
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
// Create statement connection.
|
|
1356
|
-
connectionX = this.RTL ? -cursorX : cursorX;
|
|
1357
|
-
input.connection.setOffsetInBlock(connectionX, cursorY);
|
|
1358
|
-
if (input.connection.isConnected()) {
|
|
1359
|
-
this.width = Math.max(this.width, inputRows.statementEdge +
|
|
1360
|
-
input.connection.targetBlock().getHeightWidth().width);
|
|
1361
|
-
}
|
|
1362
|
-
if (this.type != Blockly.PROCEDURES_DEFINITION_BLOCK_TYPE &&
|
|
1363
|
-
(y == inputRows.length - 1 ||
|
|
1364
|
-
inputRows[y + 1].type == Blockly.NEXT_STATEMENT)) {
|
|
1365
|
-
// If the final input is a statement stack, add a small row underneath.
|
|
1366
|
-
// Consecutive statement stacks are also separated by a small divider.
|
|
1367
|
-
steps.push(Blockly.BlockSvg.TOP_RIGHT_CORNER);
|
|
1368
|
-
steps.push('v', Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y - 2 * Blockly.BlockSvg.CORNER_RADIUS);
|
|
1369
|
-
cursorY += Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
cursorY += row.height;
|
|
1373
|
-
}
|
|
1374
|
-
this.drawEdgeShapeRight_(steps);
|
|
1375
|
-
if (!inputRows.length) {
|
|
1376
|
-
cursorY = Blockly.BlockSvg.MIN_BLOCK_Y;
|
|
1377
|
-
steps.push('V', cursorY);
|
|
1378
|
-
}
|
|
1379
|
-
return cursorY;
|
|
1380
|
-
};
|
|
1381
|
-
|
|
1382
|
-
/**
|
|
1383
|
-
* Render the input shapes.
|
|
1384
|
-
* If there's a connected block, hide the input shape.
|
|
1385
|
-
* Otherwise, draw and set the position of the input shape.
|
|
1386
|
-
* @param {!Blockly.Input} input Input to be rendered.
|
|
1387
|
-
* @param {Number} x X offset of input.
|
|
1388
|
-
* @param {Number} y Y offset of input.
|
|
1389
|
-
*/
|
|
1390
|
-
Blockly.BlockSvg.prototype.renderInputShape_ = function(input, x, y) {
|
|
1391
|
-
var inputShape = input.outlinePath;
|
|
1392
|
-
if (!inputShape) {
|
|
1393
|
-
// No input shape for this input - e.g., the block is an insertion marker.
|
|
1394
|
-
return;
|
|
1395
|
-
}
|
|
1396
|
-
// Input shapes are only visibly rendered on non-connected slots.
|
|
1397
|
-
if (input.connection.targetConnection) {
|
|
1398
|
-
inputShape.setAttribute('style', 'visibility: hidden');
|
|
1399
|
-
} else {
|
|
1400
|
-
var inputShapeX = 0, inputShapeY = 0;
|
|
1401
|
-
var inputShapeInfo =
|
|
1402
|
-
Blockly.BlockSvg.getInputShapeInfo_(input.connection.getOutputShape());
|
|
1403
|
-
if (this.RTL) {
|
|
1404
|
-
inputShapeX = -x - inputShapeInfo.width;
|
|
1405
|
-
} else {
|
|
1406
|
-
inputShapeX = x;
|
|
1407
|
-
}
|
|
1408
|
-
inputShapeY = y - (Blockly.BlockSvg.INPUT_SHAPE_HEIGHT / 2);
|
|
1409
|
-
inputShape.setAttribute('d', inputShapeInfo.path);
|
|
1410
|
-
inputShape.setAttribute('transform',
|
|
1411
|
-
'translate(' + inputShapeX + ',' + inputShapeY + ')');
|
|
1412
|
-
inputShape.setAttribute('data-argument-type', inputShapeInfo.argType);
|
|
1413
|
-
inputShape.setAttribute('style', 'visibility: visible');
|
|
1414
|
-
}
|
|
1415
|
-
};
|
|
1416
|
-
|
|
1417
|
-
/**
|
|
1418
|
-
* Render the bottom edge of the block.
|
|
1419
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1420
|
-
* @param {number} cursorY Height of block.
|
|
1421
|
-
* @private
|
|
1422
|
-
*/
|
|
1423
|
-
Blockly.BlockSvg.prototype.renderDrawBottom_ = function(steps, cursorY) {
|
|
1424
|
-
this.height = cursorY;
|
|
1425
|
-
if (!this.edgeShape_) {
|
|
1426
|
-
steps.push(Blockly.BlockSvg.BOTTOM_RIGHT_CORNER);
|
|
1427
|
-
}
|
|
1428
|
-
if (this.nextConnection) {
|
|
1429
|
-
// Move to the right-side of the notch.
|
|
1430
|
-
var notchStart = (
|
|
1431
|
-
Blockly.BlockSvg.NOTCH_WIDTH +
|
|
1432
|
-
Blockly.BlockSvg.NOTCH_START_PADDING +
|
|
1433
|
-
Blockly.BlockSvg.CORNER_RADIUS
|
|
1434
|
-
);
|
|
1435
|
-
steps.push('H', notchStart, ' ');
|
|
1436
|
-
steps.push(Blockly.BlockSvg.NOTCH_PATH_RIGHT);
|
|
1437
|
-
// Create next block connection.
|
|
1438
|
-
var connectionX = this.RTL ? -Blockly.BlockSvg.NOTCH_WIDTH :
|
|
1439
|
-
Blockly.BlockSvg.NOTCH_WIDTH;
|
|
1440
|
-
this.nextConnection.setOffsetInBlock(connectionX, cursorY);
|
|
1441
|
-
// Include height of notch in block height.
|
|
1442
|
-
this.height += Blockly.BlockSvg.NOTCH_HEIGHT;
|
|
1443
|
-
}
|
|
1444
|
-
// Bottom horizontal line
|
|
1445
|
-
if (!this.edgeShape_) {
|
|
1446
|
-
steps.push('H', Blockly.BlockSvg.CORNER_RADIUS);
|
|
1447
|
-
// Bottom left corner
|
|
1448
|
-
steps.push(Blockly.BlockSvg.BOTTOM_LEFT_CORNER);
|
|
1449
|
-
} else {
|
|
1450
|
-
steps.push('H', this.edgeShapeWidth_);
|
|
1451
|
-
}
|
|
1452
|
-
};
|
|
1453
|
-
|
|
1454
|
-
/**
|
|
1455
|
-
* Render the left edge of the block.
|
|
1456
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1457
|
-
* @param {number} cursorY Height of block.
|
|
1458
|
-
* @private
|
|
1459
|
-
*/
|
|
1460
|
-
Blockly.BlockSvg.prototype.renderDrawLeft_ = function(steps) {
|
|
1461
|
-
if (this.outputConnection) {
|
|
1462
|
-
// Scratch-style reporters have output connection y at half block height.
|
|
1463
|
-
this.outputConnection.setOffsetInBlock(0, this.height / 2);
|
|
1464
|
-
}
|
|
1465
|
-
if (this.edgeShape_) {
|
|
1466
|
-
// Draw the left-side edge shape.
|
|
1467
|
-
if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_ROUND) {
|
|
1468
|
-
// Draw a rounded arc.
|
|
1469
|
-
steps.push('a ' + this.edgeShapeWidth_ + ' ' + this.edgeShapeWidth_ + ' 0 0 1 0 -' + this.edgeShapeWidth_ * 2);
|
|
1470
|
-
} else if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_HEXAGONAL) {
|
|
1471
|
-
// Draw a half-hexagon.
|
|
1472
|
-
steps.push('l ' + -this.edgeShapeWidth_ + ' ' + -this.edgeShapeWidth_ +
|
|
1473
|
-
' l ' + this.edgeShapeWidth_ + ' ' + -this.edgeShapeWidth_);
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
steps.push('z');
|
|
1477
|
-
};
|
|
1478
|
-
|
|
1479
|
-
/**
|
|
1480
|
-
* Draw the edge shape (rounded or hexagonal) on the right side of a block with
|
|
1481
|
-
* an output.
|
|
1482
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1483
|
-
* @private
|
|
1484
|
-
*/
|
|
1485
|
-
Blockly.BlockSvg.prototype.drawEdgeShapeRight_ = function(steps) {
|
|
1486
|
-
if (this.edgeShape_) {
|
|
1487
|
-
// Draw the right-side edge shape.
|
|
1488
|
-
if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_ROUND) {
|
|
1489
|
-
// Draw a rounded arc.
|
|
1490
|
-
steps.push('a ' + this.edgeShapeWidth_ + ' ' + this.edgeShapeWidth_ +
|
|
1491
|
-
' 0 0 1 0 ' + this.edgeShapeWidth_ * 2);
|
|
1492
|
-
} else if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_HEXAGONAL) {
|
|
1493
|
-
// Draw an half-hexagon.
|
|
1494
|
-
steps.push('l ' + this.edgeShapeWidth_ + ' ' + this.edgeShapeWidth_ +
|
|
1495
|
-
' l ' + -this.edgeShapeWidth_ + ' ' + this.edgeShapeWidth_);
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
};
|
|
1499
|
-
|
|
1500
|
-
/**
|
|
1501
|
-
* Position an new block correctly, so that it doesn't move the existing block
|
|
1502
|
-
* when connected to it.
|
|
1503
|
-
* @param {!Blockly.Block} newBlock The block to position - either the first
|
|
1504
|
-
* block in a dragged stack or an insertion marker.
|
|
1505
|
-
* @param {!Blockly.Connection} newConnection The connection on the new block's
|
|
1506
|
-
* stack - either a connection on newBlock, or the last NEXT_STATEMENT
|
|
1507
|
-
* connection on the stack if the stack's being dropped before another
|
|
1508
|
-
* block.
|
|
1509
|
-
* @param {!Blockly.Connection} existingConnection The connection on the
|
|
1510
|
-
* existing block, which newBlock should line up with.
|
|
1511
|
-
*/
|
|
1512
|
-
Blockly.BlockSvg.prototype.positionNewBlock = function(newBlock, newConnection,
|
|
1513
|
-
existingConnection) {
|
|
1514
|
-
// We only need to position the new block if it's before the existing one,
|
|
1515
|
-
// otherwise its position is set by the previous block.
|
|
1516
|
-
if (newConnection.type == Blockly.NEXT_STATEMENT) {
|
|
1517
|
-
var dx = existingConnection.x_ - newConnection.x_;
|
|
1518
|
-
var dy = existingConnection.y_ - newConnection.y_;
|
|
1519
|
-
|
|
1520
|
-
newBlock.moveBy(dx, dy);
|
|
1521
|
-
}
|
|
1522
|
-
};
|
|
1523
|
-
|
|
1524
|
-
/**
|
|
1525
|
-
* Draw the outline of a statement input, starting at the top right corner.
|
|
1526
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1527
|
-
* @param {number} cursorX The x position of the start of the notch at the top
|
|
1528
|
-
* of the input.
|
|
1529
|
-
* @param {number} rightEdge The far right edge of the block, which determines
|
|
1530
|
-
* how wide the statement input is.
|
|
1531
|
-
* @param {!Array.<!Object>} row An object containing information about the
|
|
1532
|
-
* current row, including its height and whether it should have a notch at
|
|
1533
|
-
* the bottom.
|
|
1534
|
-
* @private
|
|
1535
|
-
*/
|
|
1536
|
-
Blockly.BlockSvg.drawStatementInputFromTopRight_ = function(steps, cursorX,
|
|
1537
|
-
rightEdge, row) {
|
|
1538
|
-
Blockly.BlockSvg.drawStatementInputTop_(steps, cursorX);
|
|
1539
|
-
steps.push('v', row.height - 2 * Blockly.BlockSvg.CORNER_RADIUS);
|
|
1540
|
-
Blockly.BlockSvg.drawStatementInputBottom_(steps, rightEdge, row);
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
/**
|
|
1544
|
-
* Draw the top of the outline of a statement input, starting at the top right
|
|
1545
|
-
* corner.
|
|
1546
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1547
|
-
* @param {number} cursorX The x position of the start of the notch at the top
|
|
1548
|
-
* of the input.
|
|
1549
|
-
* @private
|
|
1550
|
-
*/
|
|
1551
|
-
Blockly.BlockSvg.drawStatementInputTop_ = function(steps, cursorX) {
|
|
1552
|
-
steps.push(Blockly.BlockSvg.BOTTOM_RIGHT_CORNER);
|
|
1553
|
-
steps.push('H', cursorX + Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE +
|
|
1554
|
-
2 * Blockly.BlockSvg.CORNER_RADIUS);
|
|
1555
|
-
steps.push(Blockly.BlockSvg.NOTCH_PATH_RIGHT);
|
|
1556
|
-
steps.push('h', '-' + Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE);
|
|
1557
|
-
steps.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER);
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
|
-
/**
|
|
1561
|
-
* Draw the bottom of the outline of a statement input, starting at the inner
|
|
1562
|
-
* left corner.
|
|
1563
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1564
|
-
* @param {number} rightEdge The far right edge of the block, which determines
|
|
1565
|
-
* how wide the statement input is.
|
|
1566
|
-
* @param {!Array.<!Object>} row An object containing information about the
|
|
1567
|
-
* current row, including its height and whether it should have a notch at
|
|
1568
|
-
* the bottom.
|
|
1569
|
-
* @private
|
|
1570
|
-
*/
|
|
1571
|
-
Blockly.BlockSvg.drawStatementInputBottom_ = function(steps, rightEdge, row) {
|
|
1572
|
-
steps.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER);
|
|
1573
|
-
if (row.statementNotchAtBottom) {
|
|
1574
|
-
steps.push('h ', Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE);
|
|
1575
|
-
steps.push(Blockly.BlockSvg.NOTCH_PATH_LEFT);
|
|
1576
|
-
}
|
|
1577
|
-
steps.push('H', rightEdge - Blockly.BlockSvg.CORNER_RADIUS);
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
/**
|
|
1581
|
-
* Render part of the hat and the right side of the define block to fully wrap
|
|
1582
|
-
* the connected statement block.
|
|
1583
|
-
* Scratch-specific.
|
|
1584
|
-
* @param {!Array.<string>} steps Path of block outline.
|
|
1585
|
-
* @param {!Array.<!Array.<!Object>>} inputRows 2D array of objects, each
|
|
1586
|
-
* containing position information.
|
|
1587
|
-
* @param {!Blockly.Input} input The input that is currently being rendered.
|
|
1588
|
-
* @param {!Array.<!Object>} row An object containing information about the
|
|
1589
|
-
* current row, including its height and whether it should have a notch at
|
|
1590
|
-
* the bottom.
|
|
1591
|
-
* @param {number} cursorY The y position of the start of this row. Used to
|
|
1592
|
-
* position the following dummy input's fields.
|
|
1593
|
-
* @private
|
|
1594
|
-
*/
|
|
1595
|
-
Blockly.BlockSvg.prototype.renderDefineBlock_ = function(steps, inputRows,
|
|
1596
|
-
input, row, cursorY) {
|
|
1597
|
-
// Following text shows up as a dummy input after the statement input, which
|
|
1598
|
-
// we are forcing to stay inline with the statement input instead of letting
|
|
1599
|
-
// it drop to a new line.
|
|
1600
|
-
var hasFollowingText = row.length == 2;
|
|
1601
|
-
|
|
1602
|
-
// Figure out where the right side of the block is.
|
|
1603
|
-
var rightSide = inputRows.rightEdge;
|
|
1604
|
-
if (input.connection && input.connection.targetBlock()) {
|
|
1605
|
-
rightSide = inputRows.statementEdge +
|
|
1606
|
-
input.connection.targetBlock().getHeightWidth().width +
|
|
1607
|
-
Blockly.BlockSvg.DEFINE_BLOCK_PADDING_RIGHT;
|
|
1608
|
-
} else {
|
|
1609
|
-
// Handles the case where block is being rendered as an insertion marker
|
|
1610
|
-
rightSide = Math.max(Blockly.BlockSvg.MIN_BLOCK_X_WITH_STATEMENT, rightSide)
|
|
1611
|
-
+ Blockly.BlockSvg.DEFINE_BLOCK_PADDING_RIGHT;
|
|
1612
|
-
}
|
|
1613
|
-
rightSide -= Blockly.BlockSvg.DEFINE_HAT_CORNER_RADIUS;
|
|
1614
|
-
|
|
1615
|
-
if (hasFollowingText) {
|
|
1616
|
-
var followingTextInput = row[1];
|
|
1617
|
-
var fieldStart = rightSide + 3 * Blockly.BlockSvg.SEP_SPACE_X;
|
|
1618
|
-
rightSide += followingTextInput.fieldRow[0].getSize().width;
|
|
1619
|
-
rightSide += 2 * Blockly.BlockSvg.SEP_SPACE_X;
|
|
1620
|
-
|
|
1621
|
-
// Align fields vertically within the row.
|
|
1622
|
-
// In renderFields_, the field is further centered by its own height.
|
|
1623
|
-
// The dummy input's fields did not get laid out normally because we're
|
|
1624
|
-
// forcing them to stay inline with a statement input.
|
|
1625
|
-
var fieldY = cursorY;
|
|
1626
|
-
fieldY += Blockly.BlockSvg.MIN_STATEMENT_INPUT_HEIGHT;
|
|
1627
|
-
this.renderFields_(followingTextInput.fieldRow, fieldStart, fieldY);
|
|
1628
|
-
}
|
|
1629
|
-
// Draw the top and the right corner of the hat.
|
|
1630
|
-
steps.push('H', rightSide);
|
|
1631
|
-
steps.push(Blockly.BlockSvg.TOP_RIGHT_CORNER_DEFINE_HAT);
|
|
1632
|
-
row.height += 3 * Blockly.BlockSvg.GRID_UNIT;
|
|
1633
|
-
// Draw the right side of the block around the statement input.
|
|
1634
|
-
steps.push('v', row.height);
|
|
1635
|
-
// row.height will be used to update the cursor in the calling function.
|
|
1636
|
-
row.height += Blockly.BlockSvg.GRID_UNIT;
|
|
1637
|
-
|
|
1638
|
-
};
|
|
1639
|
-
|
|
1640
|
-
/**
|
|
1641
|
-
* Get some information about the input shape to draw, based on the type of the
|
|
1642
|
-
* connection.
|
|
1643
|
-
* @param {number} shape An enum representing the shape of the connection we're
|
|
1644
|
-
* drawing around.
|
|
1645
|
-
* @return {!Object} An object containing an SVG path, a string representation
|
|
1646
|
-
* of the argument type, and a width.
|
|
1647
|
-
* @private
|
|
1648
|
-
*/
|
|
1649
|
-
Blockly.BlockSvg.getInputShapeInfo_ = function(shape) {
|
|
1650
|
-
var inputShapePath = null;
|
|
1651
|
-
var inputShapeArgType = null;
|
|
1652
|
-
var inputShapeWidth = 0;
|
|
1653
|
-
|
|
1654
|
-
switch (shape) {
|
|
1655
|
-
case Blockly.OUTPUT_SHAPE_HEXAGONAL:
|
|
1656
|
-
inputShapePath = Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL;
|
|
1657
|
-
inputShapeWidth = Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL_WIDTH;
|
|
1658
|
-
inputShapeArgType = 'boolean';
|
|
1659
|
-
break;
|
|
1660
|
-
case Blockly.OUTPUT_SHAPE_ROUND:
|
|
1661
|
-
inputShapePath = Blockly.BlockSvg.INPUT_SHAPE_ROUND;
|
|
1662
|
-
inputShapeWidth = Blockly.BlockSvg.INPUT_SHAPE_ROUND_WIDTH;
|
|
1663
|
-
inputShapeArgType = 'round';
|
|
1664
|
-
break;
|
|
1665
|
-
case Blockly.OUTPUT_SHAPE_SQUARE:
|
|
1666
|
-
default: // If the input connection is not connected, draw a hole shape.
|
|
1667
|
-
inputShapePath = Blockly.BlockSvg.INPUT_SHAPE_SQUARE;
|
|
1668
|
-
inputShapeWidth = Blockly.BlockSvg.INPUT_SHAPE_SQUARE_WIDTH;
|
|
1669
|
-
inputShapeArgType = 'square';
|
|
1670
|
-
break;
|
|
1671
|
-
}
|
|
1672
|
-
return {
|
|
1673
|
-
path: inputShapePath,
|
|
1674
|
-
argType: inputShapeArgType,
|
|
1675
|
-
width: inputShapeWidth
|
|
1676
|
-
};
|
|
1677
|
-
};
|
|
1678
|
-
|
|
1679
|
-
/**
|
|
1680
|
-
* Get the correct cursor position for the given input, based on alignment,
|
|
1681
|
-
* the total size of the block, and the size of the input.
|
|
1682
|
-
* @param {number} cursorX The minimum x value of the cursor.
|
|
1683
|
-
* @param {!Blockly.Input} input The input to align the fields for.
|
|
1684
|
-
* @param {number} rightEdge The maximum width of the block. Right-aligned
|
|
1685
|
-
* fields are positioned based on this number.
|
|
1686
|
-
* @return {number} The new cursor position.
|
|
1687
|
-
* @private
|
|
1688
|
-
*/
|
|
1689
|
-
Blockly.BlockSvg.getAlignedCursor_ = function(cursorX, input, rightEdge) {
|
|
1690
|
-
// Align inline field rows (left/right/centre).
|
|
1691
|
-
if (input.align === Blockly.ALIGN_RIGHT) {
|
|
1692
|
-
cursorX += rightEdge - input.fieldWidth -
|
|
1693
|
-
(2 * Blockly.BlockSvg.SEP_SPACE_X);
|
|
1694
|
-
} else if (input.align === Blockly.ALIGN_CENTRE) {
|
|
1695
|
-
cursorX = Math.max(cursorX, rightEdge / 2 - input.fieldWidth / 2);
|
|
1696
|
-
}
|
|
1697
|
-
return cursorX;
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
|
-
/**
|
|
1701
|
-
* Update all of the connections on this block with the new locaitons calculated
|
|
1702
|
-
* in renderCompute, and move all of the connected blocks based on the new
|
|
1703
|
-
* connection locations.
|
|
1704
|
-
* @private
|
|
1705
|
-
*/
|
|
1706
|
-
Blockly.BlockSvg.prototype.renderMoveConnections_ = function() {
|
|
1707
|
-
var blockTL = this.getRelativeToSurfaceXY();
|
|
1708
|
-
// Don't tighten previous or output connections because they are inferior.
|
|
1709
|
-
if (this.previousConnection) {
|
|
1710
|
-
this.previousConnection.moveToOffset(blockTL);
|
|
1711
|
-
}
|
|
1712
|
-
if (this.outputConnection) {
|
|
1713
|
-
this.outputConnection.moveToOffset(blockTL);
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
|
-
for (var i = 0; i < this.inputList.length; i++) {
|
|
1717
|
-
var conn = this.inputList[i].connection;
|
|
1718
|
-
if (conn) {
|
|
1719
|
-
conn.moveToOffset(blockTL);
|
|
1720
|
-
if (conn.isConnected()) {
|
|
1721
|
-
conn.tighten_();
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
if (this.nextConnection) {
|
|
1727
|
-
this.nextConnection.moveToOffset(blockTL);
|
|
1728
|
-
if (this.nextConnection.isConnected()) {
|
|
1729
|
-
this.nextConnection.tighten_();
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
};
|