scratch-blocks 1.1.206 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +0 -3
- package/CHANGELOG.md +111 -833
- package/TODO.md +16 -0
- package/blockly-rc/.eslintignore +28 -0
- package/blockly-rc/.eslintrc.js +187 -0
- package/blockly-rc/.gitattributes +1 -0
- package/blockly-rc/.github/CODEOWNERS +1 -0
- package/blockly-rc/.github/CONTRIBUTING.md +46 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/bug_report.yaml +58 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/config.yml +7 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/documentation.yaml +38 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/feature_request.yaml +39 -0
- package/blockly-rc/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/blockly-rc/.github/dependabot.yml +27 -0
- package/blockly-rc/.github/release.yml +32 -0
- package/blockly-rc/.github/workflows/appengine_deploy.yml +54 -0
- package/blockly-rc/.github/workflows/assign_reviewers.yml +41 -0
- package/blockly-rc/.github/workflows/browser_test.yml +55 -0
- package/blockly-rc/.github/workflows/build.yml +86 -0
- package/blockly-rc/.github/workflows/conventional-label.yml +17 -0
- package/blockly-rc/.github/workflows/develop_freeze.yml +26 -0
- package/blockly-rc/.github/workflows/tag_module_cleanup.yml +37 -0
- package/blockly-rc/.github/workflows/welcome_new_contributors.yml +36 -0
- package/blockly-rc/.prettierignore +30 -0
- package/blockly-rc/.prettierrc.js +13 -0
- package/blockly-rc/CHANGELOG.md +77 -0
- package/blockly-rc/LICENSE +202 -0
- package/blockly-rc/README.md +80 -0
- package/blockly-rc/_config.yml +1 -0
- package/blockly-rc/api-extractor.json +385 -0
- package/blockly-rc/appengine/.gcloudignore +20 -0
- package/blockly-rc/appengine/README.txt +42 -0
- package/blockly-rc/appengine/add_timestamps.py +69 -0
- package/blockly-rc/appengine/app.yaml +104 -0
- package/blockly-rc/appengine/apple-touch-icon.png +0 -0
- package/blockly-rc/appengine/blockly_compressed.js +11 -0
- package/blockly-rc/appengine/expiration.py +52 -0
- package/blockly-rc/appengine/favicon.ico +0 -0
- package/blockly-rc/appengine/index.yaml +11 -0
- package/blockly-rc/appengine/main.py +39 -0
- package/blockly-rc/appengine/redirect.html +107 -0
- package/blockly-rc/appengine/requirements.txt +1 -0
- package/blockly-rc/appengine/robots.txt +2 -0
- package/blockly-rc/appengine/storage.js +190 -0
- package/blockly-rc/appengine/storage.py +125 -0
- package/blockly-rc/blocks/blocks.ts +44 -0
- package/blockly-rc/blocks/lists.ts +1085 -0
- package/blockly-rc/blocks/logic.ts +712 -0
- package/blockly-rc/blocks/loops.ts +408 -0
- package/blockly-rc/blocks/math.ts +591 -0
- package/blockly-rc/blocks/procedures.ts +1364 -0
- package/blockly-rc/blocks/text.ts +1007 -0
- package/blockly-rc/blocks/variables.ts +183 -0
- package/blockly-rc/blocks/variables_dynamic.ts +194 -0
- package/blockly-rc/core/any_aliases.ts +8 -0
- package/blockly-rc/core/block.ts +2523 -0
- package/blockly-rc/core/block_animations.ts +225 -0
- package/blockly-rc/core/block_flyout_inflater.ts +262 -0
- package/blockly-rc/core/block_svg.ts +1768 -0
- package/blockly-rc/core/blockly.ts +605 -0
- package/blockly-rc/core/blockly_options.ts +71 -0
- package/blockly-rc/core/blocks.ts +18 -0
- package/blockly-rc/core/browser_events.ts +244 -0
- package/blockly-rc/core/bubbles/bubble.ts +658 -0
- package/blockly-rc/core/bubbles/mini_workspace_bubble.ts +280 -0
- package/blockly-rc/core/bubbles/text_bubble.ts +103 -0
- package/blockly-rc/core/bubbles/textinput_bubble.ts +344 -0
- package/blockly-rc/core/bubbles.ts +12 -0
- package/blockly-rc/core/bump_objects.ts +192 -0
- package/blockly-rc/core/button_flyout_inflater.ts +63 -0
- package/blockly-rc/core/clipboard/block_paster.ts +142 -0
- package/blockly-rc/core/clipboard/registry.ts +31 -0
- package/blockly-rc/core/clipboard/workspace_comment_paster.ts +94 -0
- package/blockly-rc/core/clipboard.ts +113 -0
- package/blockly-rc/core/comments/comment_view.ts +899 -0
- package/blockly-rc/core/comments/rendered_workspace_comment.ts +297 -0
- package/blockly-rc/core/comments/workspace_comment.ts +237 -0
- package/blockly-rc/core/comments.ts +9 -0
- package/blockly-rc/core/common.ts +305 -0
- package/blockly-rc/core/component_manager.ts +235 -0
- package/blockly-rc/core/config.ts +65 -0
- package/blockly-rc/core/connection.ts +793 -0
- package/blockly-rc/core/connection_checker.ts +348 -0
- package/blockly-rc/core/connection_db.ts +297 -0
- package/blockly-rc/core/connection_type.ts +21 -0
- package/blockly-rc/core/constants.ts +23 -0
- package/blockly-rc/core/contextmenu.ts +268 -0
- package/blockly-rc/core/contextmenu_items.ts +700 -0
- package/blockly-rc/core/contextmenu_registry.ts +194 -0
- package/blockly-rc/core/css.ts +481 -0
- package/blockly-rc/core/delete_area.ts +77 -0
- package/blockly-rc/core/dialog.ts +121 -0
- package/blockly-rc/core/drag_target.ts +97 -0
- package/blockly-rc/core/dragging/block_drag_strategy.ts +454 -0
- package/blockly-rc/core/dragging/bubble_drag_strategy.ts +52 -0
- package/blockly-rc/core/dragging/comment_drag_strategy.ts +91 -0
- package/blockly-rc/core/dragging/dragger.ts +163 -0
- package/blockly-rc/core/dragging.ts +12 -0
- package/blockly-rc/core/dropdowndiv.ts +768 -0
- package/blockly-rc/core/events/events.ts +163 -0
- package/blockly-rc/core/events/events_abstract.ts +130 -0
- package/blockly-rc/core/events/events_block_base.ts +88 -0
- package/blockly-rc/core/events/events_block_change.ts +259 -0
- package/blockly-rc/core/events/events_block_create.ts +185 -0
- package/blockly-rc/core/events/events_block_delete.ts +182 -0
- package/blockly-rc/core/events/events_block_drag.ts +116 -0
- package/blockly-rc/core/events/events_block_field_intermediate_change.ts +167 -0
- package/blockly-rc/core/events/events_block_move.ts +307 -0
- package/blockly-rc/core/events/events_bubble_open.ts +120 -0
- package/blockly-rc/core/events/events_click.ts +110 -0
- package/blockly-rc/core/events/events_comment_base.ts +126 -0
- package/blockly-rc/core/events/events_comment_change.ts +161 -0
- package/blockly-rc/core/events/events_comment_collapse.ts +103 -0
- package/blockly-rc/core/events/events_comment_create.ts +118 -0
- package/blockly-rc/core/events/events_comment_delete.ts +117 -0
- package/blockly-rc/core/events/events_comment_drag.ts +99 -0
- package/blockly-rc/core/events/events_comment_move.ts +207 -0
- package/blockly-rc/core/events/events_comment_resize.ts +174 -0
- package/blockly-rc/core/events/events_marker_move.ts +134 -0
- package/blockly-rc/core/events/events_selected.ts +98 -0
- package/blockly-rc/core/events/events_theme_change.ts +84 -0
- package/blockly-rc/core/events/events_toolbox_item_select.ts +96 -0
- package/blockly-rc/core/events/events_trashcan_open.ts +88 -0
- package/blockly-rc/core/events/events_ui_base.ts +47 -0
- package/blockly-rc/core/events/events_var_base.ts +89 -0
- package/blockly-rc/core/events/events_var_create.ts +129 -0
- package/blockly-rc/core/events/events_var_delete.ts +124 -0
- package/blockly-rc/core/events/events_var_rename.ts +133 -0
- package/blockly-rc/core/events/events_var_type_change.ts +122 -0
- package/blockly-rc/core/events/events_viewport.ts +149 -0
- package/blockly-rc/core/events/utils.ts +595 -0
- package/blockly-rc/core/events/workspace_events.ts +46 -0
- package/blockly-rc/core/extensions.ts +491 -0
- package/blockly-rc/core/field.ts +1471 -0
- package/blockly-rc/core/field_checkbox.ts +271 -0
- package/blockly-rc/core/field_dropdown.ts +857 -0
- package/blockly-rc/core/field_image.ts +297 -0
- package/blockly-rc/core/field_input.ts +755 -0
- package/blockly-rc/core/field_label.ts +150 -0
- package/blockly-rc/core/field_label_serializable.ts +73 -0
- package/blockly-rc/core/field_number.ts +381 -0
- package/blockly-rc/core/field_registry.ts +115 -0
- package/blockly-rc/core/field_textinput.ts +117 -0
- package/blockly-rc/core/field_variable.ts +651 -0
- package/blockly-rc/core/flyout_base.ts +968 -0
- package/blockly-rc/core/flyout_button.ts +416 -0
- package/blockly-rc/core/flyout_horizontal.ts +374 -0
- package/blockly-rc/core/flyout_metrics_manager.ts +90 -0
- package/blockly-rc/core/flyout_separator.ts +61 -0
- package/blockly-rc/core/flyout_vertical.ts +353 -0
- package/blockly-rc/core/generator.ts +611 -0
- package/blockly-rc/core/gesture.ts +1191 -0
- package/blockly-rc/core/grid.ts +252 -0
- package/blockly-rc/core/icons/comment_icon.ts +435 -0
- package/blockly-rc/core/icons/exceptions.ts +23 -0
- package/blockly-rc/core/icons/icon.ts +147 -0
- package/blockly-rc/core/icons/icon_types.ts +32 -0
- package/blockly-rc/core/icons/mutator_icon.ts +354 -0
- package/blockly-rc/core/icons/registry.ts +33 -0
- package/blockly-rc/core/icons/warning_icon.ts +219 -0
- package/blockly-rc/core/icons.ts +24 -0
- package/blockly-rc/core/inject.ts +428 -0
- package/blockly-rc/core/inputs/align.ts +14 -0
- package/blockly-rc/core/inputs/dummy_input.ts +26 -0
- package/blockly-rc/core/inputs/end_row_input.ts +31 -0
- package/blockly-rc/core/inputs/input.ts +318 -0
- package/blockly-rc/core/inputs/input_types.ts +27 -0
- package/blockly-rc/core/inputs/statement_input.ts +34 -0
- package/blockly-rc/core/inputs/value_input.ts +30 -0
- package/blockly-rc/core/inputs.ts +23 -0
- package/blockly-rc/core/insertion_marker_manager.ts +742 -0
- package/blockly-rc/core/insertion_marker_previewer.ts +254 -0
- package/blockly-rc/core/interfaces/i_ast_node_location.ts +12 -0
- package/blockly-rc/core/interfaces/i_ast_node_location_svg.ts +28 -0
- package/blockly-rc/core/interfaces/i_ast_node_location_with_block.ts +22 -0
- package/blockly-rc/core/interfaces/i_autohideable.ts +22 -0
- package/blockly-rc/core/interfaces/i_bounded_element.ts +30 -0
- package/blockly-rc/core/interfaces/i_bubble.ts +63 -0
- package/blockly-rc/core/interfaces/i_collapsible_toolbox_item.ts +33 -0
- package/blockly-rc/core/interfaces/i_comment_icon.ts +47 -0
- package/blockly-rc/core/interfaces/i_component.ts +19 -0
- package/blockly-rc/core/interfaces/i_connection_checker.ts +100 -0
- package/blockly-rc/core/interfaces/i_connection_previewer.ts +50 -0
- package/blockly-rc/core/interfaces/i_contextmenu.ts +16 -0
- package/blockly-rc/core/interfaces/i_copyable.ts +31 -0
- package/blockly-rc/core/interfaces/i_deletable.ts +34 -0
- package/blockly-rc/core/interfaces/i_delete_area.ts +28 -0
- package/blockly-rc/core/interfaces/i_drag_target.ts +69 -0
- package/blockly-rc/core/interfaces/i_draggable.ts +72 -0
- package/blockly-rc/core/interfaces/i_dragger.ts +35 -0
- package/blockly-rc/core/interfaces/i_flyout.ts +189 -0
- package/blockly-rc/core/interfaces/i_flyout_inflater.ts +41 -0
- package/blockly-rc/core/interfaces/i_has_bubble.ts +20 -0
- package/blockly-rc/core/interfaces/i_icon.ts +114 -0
- package/blockly-rc/core/interfaces/i_keyboard_accessible.ts +21 -0
- package/blockly-rc/core/interfaces/i_legacy_procedure_blocks.ts +50 -0
- package/blockly-rc/core/interfaces/i_metrics_manager.ts +149 -0
- package/blockly-rc/core/interfaces/i_movable.ts +19 -0
- package/blockly-rc/core/interfaces/i_observable.ts +24 -0
- package/blockly-rc/core/interfaces/i_parameter_model.ts +51 -0
- package/blockly-rc/core/interfaces/i_paster.ts +25 -0
- package/blockly-rc/core/interfaces/i_positionable.ts +33 -0
- package/blockly-rc/core/interfaces/i_procedure_block.ts +27 -0
- package/blockly-rc/core/interfaces/i_procedure_map.ts +18 -0
- package/blockly-rc/core/interfaces/i_procedure_model.ts +71 -0
- package/blockly-rc/core/interfaces/i_registrable.ts +12 -0
- package/blockly-rc/core/interfaces/i_rendered_element.ts +22 -0
- package/blockly-rc/core/interfaces/i_selectable.ts +34 -0
- package/blockly-rc/core/interfaces/i_selectable_toolbox_item.ts +63 -0
- package/blockly-rc/core/interfaces/i_serializable.ts +28 -0
- package/blockly-rc/core/interfaces/i_serializer.ts +55 -0
- package/blockly-rc/core/interfaces/i_styleable.ts +26 -0
- package/blockly-rc/core/interfaces/i_toolbox.ts +112 -0
- package/blockly-rc/core/interfaces/i_toolbox_item.ts +81 -0
- package/blockly-rc/core/interfaces/i_variable_backed_parameter_model.ts +23 -0
- package/blockly-rc/core/interfaces/i_variable_map.ts +65 -0
- package/blockly-rc/core/interfaces/i_variable_model.ts +57 -0
- package/blockly-rc/core/internal_constants.ts +47 -0
- package/blockly-rc/core/keyboard_nav/ast_node.ts +884 -0
- package/blockly-rc/core/keyboard_nav/basic_cursor.ts +223 -0
- package/blockly-rc/core/keyboard_nav/cursor.ts +138 -0
- package/blockly-rc/core/keyboard_nav/marker.ts +113 -0
- package/blockly-rc/core/keyboard_nav/tab_navigate_cursor.ts +46 -0
- package/blockly-rc/core/label_flyout_inflater.ts +59 -0
- package/blockly-rc/core/layer_manager.ts +186 -0
- package/blockly-rc/core/layers.ts +17 -0
- package/blockly-rc/core/main.ts +31 -0
- package/blockly-rc/core/marker_manager.ts +189 -0
- package/blockly-rc/core/menu.ts +463 -0
- package/blockly-rc/core/menuitem.ts +221 -0
- package/blockly-rc/core/metrics_manager.ts +486 -0
- package/blockly-rc/core/msg.ts +27 -0
- package/blockly-rc/core/names.ts +275 -0
- package/blockly-rc/core/observable_procedure_map.ts +66 -0
- package/blockly-rc/core/options.ts +377 -0
- package/blockly-rc/core/positionable_helpers.ts +186 -0
- package/blockly-rc/core/procedures.ts +510 -0
- package/blockly-rc/core/registry.ts +400 -0
- package/blockly-rc/core/render_management.ts +193 -0
- package/blockly-rc/core/rendered_connection.ts +571 -0
- package/blockly-rc/core/renderers/common/block_rendering.ts +120 -0
- package/blockly-rc/core/renderers/common/constants.ts +1198 -0
- package/blockly-rc/core/renderers/common/drawer.ts +518 -0
- package/blockly-rc/core/renderers/common/i_path_object.ts +137 -0
- package/blockly-rc/core/renderers/common/info.ts +767 -0
- package/blockly-rc/core/renderers/common/marker_svg.ts +765 -0
- package/blockly-rc/core/renderers/common/path_object.ts +324 -0
- package/blockly-rc/core/renderers/common/renderer.ts +281 -0
- package/blockly-rc/core/renderers/geras/constants.ts +46 -0
- package/blockly-rc/core/renderers/geras/drawer.ts +167 -0
- package/blockly-rc/core/renderers/geras/geras.ts +31 -0
- package/blockly-rc/core/renderers/geras/highlight_constants.ts +342 -0
- package/blockly-rc/core/renderers/geras/highlighter.ts +313 -0
- package/blockly-rc/core/renderers/geras/info.ts +478 -0
- package/blockly-rc/core/renderers/geras/measurables/inline_input.ts +37 -0
- package/blockly-rc/core/renderers/geras/measurables/statement_input.ts +36 -0
- package/blockly-rc/core/renderers/geras/path_object.ts +135 -0
- package/blockly-rc/core/renderers/geras/renderer.ts +124 -0
- package/blockly-rc/core/renderers/measurables/base.ts +41 -0
- package/blockly-rc/core/renderers/measurables/bottom_row.ts +104 -0
- package/blockly-rc/core/renderers/measurables/connection.ts +43 -0
- package/blockly-rc/core/renderers/measurables/external_value_input.ts +53 -0
- package/blockly-rc/core/renderers/measurables/field.ts +50 -0
- package/blockly-rc/core/renderers/measurables/hat.ts +33 -0
- package/blockly-rc/core/renderers/measurables/icon.ts +42 -0
- package/blockly-rc/core/renderers/measurables/in_row_spacer.ts +29 -0
- package/blockly-rc/core/renderers/measurables/inline_input.ts +63 -0
- package/blockly-rc/core/renderers/measurables/input_connection.ts +57 -0
- package/blockly-rc/core/renderers/measurables/input_row.ts +67 -0
- package/blockly-rc/core/renderers/measurables/jagged_edge.ts +28 -0
- package/blockly-rc/core/renderers/measurables/next_connection.ts +34 -0
- package/blockly-rc/core/renderers/measurables/output_connection.ts +43 -0
- package/blockly-rc/core/renderers/measurables/previous_connection.ts +34 -0
- package/blockly-rc/core/renderers/measurables/round_corner.ts +34 -0
- package/blockly-rc/core/renderers/measurables/row.ts +191 -0
- package/blockly-rc/core/renderers/measurables/spacer_row.ts +44 -0
- package/blockly-rc/core/renderers/measurables/square_corner.ts +32 -0
- package/blockly-rc/core/renderers/measurables/statement_input.ts +41 -0
- package/blockly-rc/core/renderers/measurables/top_row.ts +110 -0
- package/blockly-rc/core/renderers/measurables/types.ts +319 -0
- package/blockly-rc/core/renderers/thrasos/info.ts +328 -0
- package/blockly-rc/core/renderers/thrasos/renderer.ts +40 -0
- package/blockly-rc/core/renderers/thrasos/thrasos.ts +14 -0
- package/blockly-rc/core/renderers/zelos/constants.ts +877 -0
- package/blockly-rc/core/renderers/zelos/drawer.ts +274 -0
- package/blockly-rc/core/renderers/zelos/info.ts +652 -0
- package/blockly-rc/core/renderers/zelos/marker_svg.ts +145 -0
- package/blockly-rc/core/renderers/zelos/measurables/bottom_row.ts +44 -0
- package/blockly-rc/core/renderers/zelos/measurables/inputs.ts +41 -0
- package/blockly-rc/core/renderers/zelos/measurables/row_elements.ts +29 -0
- package/blockly-rc/core/renderers/zelos/measurables/top_row.ts +50 -0
- package/blockly-rc/core/renderers/zelos/path_object.ts +209 -0
- package/blockly-rc/core/renderers/zelos/renderer.ts +143 -0
- package/blockly-rc/core/renderers/zelos/zelos.ts +33 -0
- package/blockly-rc/core/scrollbar.ts +898 -0
- package/blockly-rc/core/scrollbar_pair.ts +349 -0
- package/blockly-rc/core/separator_flyout_inflater.ts +69 -0
- package/blockly-rc/core/serialization/blocks.ts +868 -0
- package/blockly-rc/core/serialization/exceptions.ts +112 -0
- package/blockly-rc/core/serialization/priorities.ts +25 -0
- package/blockly-rc/core/serialization/procedures.ts +158 -0
- package/blockly-rc/core/serialization/registry.ts +30 -0
- package/blockly-rc/core/serialization/variables.ts +68 -0
- package/blockly-rc/core/serialization/workspace_comments.ts +143 -0
- package/blockly-rc/core/serialization/workspaces.ts +94 -0
- package/blockly-rc/core/serialization.ts +32 -0
- package/blockly-rc/core/shortcut_items.ts +338 -0
- package/blockly-rc/core/shortcut_registry.ts +368 -0
- package/blockly-rc/core/sprites.ts +15 -0
- package/blockly-rc/core/theme/classic.ts +40 -0
- package/blockly-rc/core/theme/themes.ts +12 -0
- package/blockly-rc/core/theme/zelos.ts +80 -0
- package/blockly-rc/core/theme.ts +232 -0
- package/blockly-rc/core/theme_manager.ts +192 -0
- package/blockly-rc/core/toolbox/category.ts +739 -0
- package/blockly-rc/core/toolbox/collapsible_category.ts +288 -0
- package/blockly-rc/core/toolbox/separator.ts +105 -0
- package/blockly-rc/core/toolbox/toolbox.ts +1134 -0
- package/blockly-rc/core/toolbox/toolbox_item.ts +152 -0
- package/blockly-rc/core/tooltip.ts +466 -0
- package/blockly-rc/core/touch.ts +155 -0
- package/blockly-rc/core/trashcan.ts +748 -0
- package/blockly-rc/core/utils/aria.ts +144 -0
- package/blockly-rc/core/utils/array.ts +24 -0
- package/blockly-rc/core/utils/colour.ts +265 -0
- package/blockly-rc/core/utils/coordinate.ts +129 -0
- package/blockly-rc/core/utils/deprecation.ts +47 -0
- package/blockly-rc/core/utils/dom.ts +356 -0
- package/blockly-rc/core/utils/idgenerator.ts +70 -0
- package/blockly-rc/core/utils/keycodes.ts +154 -0
- package/blockly-rc/core/utils/math.ts +50 -0
- package/blockly-rc/core/utils/metrics.ts +86 -0
- package/blockly-rc/core/utils/object.ts +28 -0
- package/blockly-rc/core/utils/parsing.ts +287 -0
- package/blockly-rc/core/utils/rect.ts +69 -0
- package/blockly-rc/core/utils/size.ts +62 -0
- package/blockly-rc/core/utils/string.ts +289 -0
- package/blockly-rc/core/utils/style.ts +219 -0
- package/blockly-rc/core/utils/svg.ts +84 -0
- package/blockly-rc/core/utils/svg_math.ts +208 -0
- package/blockly-rc/core/utils/svg_paths.ts +133 -0
- package/blockly-rc/core/utils/toolbox.ts +419 -0
- package/blockly-rc/core/utils/useragent.ts +86 -0
- package/blockly-rc/core/utils/xml.ts +165 -0
- package/blockly-rc/core/utils.ts +59 -0
- package/blockly-rc/core/variable_map.ts +437 -0
- package/blockly-rc/core/variable_model.ts +149 -0
- package/blockly-rc/core/variables.ts +773 -0
- package/blockly-rc/core/variables_dynamic.ts +142 -0
- package/blockly-rc/core/widgetdiv.ts +319 -0
- package/blockly-rc/core/workspace.ts +957 -0
- package/blockly-rc/core/workspace_audio.ts +171 -0
- package/blockly-rc/core/workspace_dragger.ts +97 -0
- package/blockly-rc/core/workspace_svg.ts +2519 -0
- package/blockly-rc/core/xml.ts +1133 -0
- package/blockly-rc/core/zoom_controls.ts +492 -0
- package/blockly-rc/demos/blockfactory/analytics.js +195 -0
- package/blockly-rc/demos/blockfactory/app_controller.js +726 -0
- package/blockly-rc/demos/blockfactory/block_definition_extractor.js +742 -0
- package/blockly-rc/demos/blockfactory/block_exporter_controller.js +311 -0
- package/blockly-rc/demos/blockfactory/block_exporter_tools.js +212 -0
- package/blockly-rc/demos/blockfactory/block_exporter_view.js +101 -0
- package/blockly-rc/demos/blockfactory/block_library_controller.js +325 -0
- package/blockly-rc/demos/blockfactory/block_library_storage.js +149 -0
- package/blockly-rc/demos/blockfactory/block_library_view.js +178 -0
- package/blockly-rc/demos/blockfactory/block_option.js +151 -0
- package/blockly-rc/demos/blockfactory/blocks.js +916 -0
- package/blockly-rc/demos/blockfactory/cp.css +46 -0
- package/blockly-rc/demos/blockfactory/cp.js +179 -0
- package/blockly-rc/demos/blockfactory/factory.css +586 -0
- package/blockly-rc/demos/blockfactory/factory.js +337 -0
- package/blockly-rc/demos/blockfactory/factory_utils.js +1036 -0
- package/blockly-rc/demos/blockfactory/icon.png +0 -0
- package/blockly-rc/demos/blockfactory/index.html +767 -0
- package/blockly-rc/demos/blockfactory/link.png +0 -0
- package/blockly-rc/demos/blockfactory/standard_categories.js +384 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_controller.js +1332 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_generator.js +224 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_init.js +541 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_model.js +548 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_view.js +424 -0
- package/blockly-rc/demos/code/code.js +626 -0
- package/blockly-rc/demos/code/icon.png +0 -0
- package/blockly-rc/demos/code/icons.png +0 -0
- package/blockly-rc/demos/code/index.html +359 -0
- package/blockly-rc/demos/code/msg/ar.js +24 -0
- package/blockly-rc/demos/code/msg/be-tarask.js +24 -0
- package/blockly-rc/demos/code/msg/br.js +24 -0
- package/blockly-rc/demos/code/msg/ca.js +24 -0
- package/blockly-rc/demos/code/msg/cs.js +24 -0
- package/blockly-rc/demos/code/msg/da.js +24 -0
- package/blockly-rc/demos/code/msg/de.js +24 -0
- package/blockly-rc/demos/code/msg/el.js +24 -0
- package/blockly-rc/demos/code/msg/en.js +24 -0
- package/blockly-rc/demos/code/msg/es.js +24 -0
- package/blockly-rc/demos/code/msg/et.js +24 -0
- package/blockly-rc/demos/code/msg/fa.js +24 -0
- package/blockly-rc/demos/code/msg/fr.js +24 -0
- package/blockly-rc/demos/code/msg/he.js +24 -0
- package/blockly-rc/demos/code/msg/hr.js +24 -0
- package/blockly-rc/demos/code/msg/hrx.js +24 -0
- package/blockly-rc/demos/code/msg/hu.js +24 -0
- package/blockly-rc/demos/code/msg/ia.js +24 -0
- package/blockly-rc/demos/code/msg/is.js +24 -0
- package/blockly-rc/demos/code/msg/it.js +24 -0
- package/blockly-rc/demos/code/msg/ja.js +24 -0
- package/blockly-rc/demos/code/msg/kab.js +24 -0
- package/blockly-rc/demos/code/msg/ko.js +24 -0
- package/blockly-rc/demos/code/msg/mk.js +24 -0
- package/blockly-rc/demos/code/msg/ms.js +24 -0
- package/blockly-rc/demos/code/msg/nb.js +24 -0
- package/blockly-rc/demos/code/msg/nl.js +24 -0
- package/blockly-rc/demos/code/msg/oc.js +24 -0
- package/blockly-rc/demos/code/msg/pl.js +24 -0
- package/blockly-rc/demos/code/msg/pms.js +24 -0
- package/blockly-rc/demos/code/msg/pt-br.js +24 -0
- package/blockly-rc/demos/code/msg/ro.js +24 -0
- package/blockly-rc/demos/code/msg/ru.js +24 -0
- package/blockly-rc/demos/code/msg/sc.js +24 -0
- package/blockly-rc/demos/code/msg/sk.js +24 -0
- package/blockly-rc/demos/code/msg/sr.js +24 -0
- package/blockly-rc/demos/code/msg/sv.js +24 -0
- package/blockly-rc/demos/code/msg/ta.js +24 -0
- package/blockly-rc/demos/code/msg/th.js +24 -0
- package/blockly-rc/demos/code/msg/tlh.js +24 -0
- package/blockly-rc/demos/code/msg/tr.js +24 -0
- package/blockly-rc/demos/code/msg/uk.js +24 -0
- package/blockly-rc/demos/code/msg/vi.js +24 -0
- package/blockly-rc/demos/code/msg/zh-hans.js +24 -0
- package/blockly-rc/demos/code/msg/zh-hant.js +24 -0
- package/blockly-rc/demos/code/style.css +184 -0
- package/blockly-rc/demos/index.html +68 -0
- package/blockly-rc/demos/minimap/icon.png +0 -0
- package/blockly-rc/demos/minimap/index.html +91 -0
- package/blockly-rc/demos/minimap/minimap.js +302 -0
- package/blockly-rc/demos/mobile/README.md +53 -0
- package/blockly-rc/demos/mobile/android/README.md +45 -0
- package/blockly-rc/demos/mobile/android/app/build.gradle +64 -0
- package/blockly-rc/demos/mobile/android/app/proguard-rules.pro +21 -0
- package/blockly-rc/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java +26 -0
- package/blockly-rc/demos/mobile/android/app/src/main/AndroidManifest.xml +21 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java +40 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java +150 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java +32 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java +18 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml +74 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/layout/activity_main.xml +17 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/layout/js_prompt.xml +37 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/colors.xml +6 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml +7 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/strings.xml +3 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/styles.xml +11 -0
- package/blockly-rc/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java +17 -0
- package/blockly-rc/demos/mobile/android/build.gradle +27 -0
- package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/blockly-rc/demos/mobile/android/gradle.properties +13 -0
- package/blockly-rc/demos/mobile/android/gradlew +172 -0
- package/blockly-rc/demos/mobile/android/gradlew.bat +84 -0
- package/blockly-rc/demos/mobile/android/settings.gradle +1 -0
- package/blockly-rc/demos/mobile/html/index.html +31 -0
- package/blockly-rc/demos/mobile/html/ln_resources.sh +22 -0
- package/blockly-rc/demos/mobile/html/toolbox_standard.js +333 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/AppDelegate.swift +46 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json +6 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard +25 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard +44 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Info.plist +45 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/ViewController.swift +110 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj +390 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/blockly-rc/demos/mobile/ios/cp_resources.sh +21 -0
- package/blockly-rc/demos/storage/icon.png +0 -0
- package/blockly-rc/demos/storage/index.html +104 -0
- package/blockly-rc/generators/dart/dart_generator.ts +321 -0
- package/blockly-rc/generators/dart/lists.ts +525 -0
- package/blockly-rc/generators/dart/logic.ts +155 -0
- package/blockly-rc/generators/dart/loops.ts +217 -0
- package/blockly-rc/generators/dart/math.ts +559 -0
- package/blockly-rc/generators/dart/procedures.ts +138 -0
- package/blockly-rc/generators/dart/text.ts +405 -0
- package/blockly-rc/generators/dart/variables.ts +32 -0
- package/blockly-rc/generators/dart/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/dart.ts +50 -0
- package/blockly-rc/generators/javascript/javascript_generator.ts +346 -0
- package/blockly-rc/generators/javascript/lists.ts +465 -0
- package/blockly-rc/generators/javascript/logic.ts +153 -0
- package/blockly-rc/generators/javascript/loops.ts +245 -0
- package/blockly-rc/generators/javascript/math.ts +450 -0
- package/blockly-rc/generators/javascript/procedures.ts +142 -0
- package/blockly-rc/generators/javascript/text.ts +418 -0
- package/blockly-rc/generators/javascript/variables.ts +32 -0
- package/blockly-rc/generators/javascript/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/javascript.ts +46 -0
- package/blockly-rc/generators/lua/lists.ts +445 -0
- package/blockly-rc/generators/lua/logic.ts +142 -0
- package/blockly-rc/generators/lua/loops.ts +192 -0
- package/blockly-rc/generators/lua/lua_generator.ts +225 -0
- package/blockly-rc/generators/lua/math.ts +473 -0
- package/blockly-rc/generators/lua/procedures.ts +144 -0
- package/blockly-rc/generators/lua/text.ts +380 -0
- package/blockly-rc/generators/lua/variables.ts +31 -0
- package/blockly-rc/generators/lua/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/lua.ts +44 -0
- package/blockly-rc/generators/php/lists.ts +585 -0
- package/blockly-rc/generators/php/logic.ts +155 -0
- package/blockly-rc/generators/php/loops.ts +218 -0
- package/blockly-rc/generators/php/math.ts +408 -0
- package/blockly-rc/generators/php/php_generator.ts +320 -0
- package/blockly-rc/generators/php/procedures.ts +159 -0
- package/blockly-rc/generators/php/text.ts +315 -0
- package/blockly-rc/generators/php/variables.ts +32 -0
- package/blockly-rc/generators/php/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/php.ts +46 -0
- package/blockly-rc/generators/python/lists.ts +398 -0
- package/blockly-rc/generators/python/logic.ts +148 -0
- package/blockly-rc/generators/python/loops.ts +251 -0
- package/blockly-rc/generators/python/math.ts +434 -0
- package/blockly-rc/generators/python/procedures.ts +159 -0
- package/blockly-rc/generators/python/python_generator.ts +355 -0
- package/blockly-rc/generators/python/text.ts +338 -0
- package/blockly-rc/generators/python/variables.ts +31 -0
- package/blockly-rc/generators/python/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/python.ts +51 -0
- package/blockly-rc/gulpfile.js +54 -0
- package/blockly-rc/jsconfig.json +7 -0
- package/blockly-rc/media/1x1.gif +0 -0
- package/blockly-rc/media/click.mp3 +0 -0
- package/blockly-rc/media/click.ogg +0 -0
- package/blockly-rc/media/click.wav +0 -0
- package/blockly-rc/media/delete-icon.svg +1 -0
- package/blockly-rc/media/delete.mp3 +0 -0
- package/blockly-rc/media/delete.ogg +0 -0
- package/blockly-rc/media/delete.wav +0 -0
- package/blockly-rc/media/disconnect.mp3 +0 -0
- package/blockly-rc/media/disconnect.ogg +0 -0
- package/blockly-rc/media/disconnect.wav +0 -0
- package/blockly-rc/media/dropdown-arrow.svg +1 -0
- package/blockly-rc/media/foldout-icon.svg +1 -0
- package/blockly-rc/media/handclosed.cur +0 -0
- package/blockly-rc/media/handdelete.cur +0 -0
- package/blockly-rc/media/handopen.cur +0 -0
- package/blockly-rc/media/pilcrow.png +0 -0
- package/blockly-rc/media/quote0.png +0 -0
- package/blockly-rc/media/quote1.png +0 -0
- package/blockly-rc/media/resize-handle.svg +3 -0
- package/blockly-rc/media/sprites.png +0 -0
- package/blockly-rc/media/sprites.svg +74 -0
- package/blockly-rc/msg/json/README.md +33 -0
- package/blockly-rc/msg/json/ab.json +222 -0
- package/blockly-rc/msg/json/ace.json +7 -0
- package/blockly-rc/msg/json/af.json +34 -0
- package/blockly-rc/msg/json/am.json +30 -0
- package/blockly-rc/msg/json/ar.json +355 -0
- package/blockly-rc/msg/json/ast.json +10 -0
- package/blockly-rc/msg/json/az.json +332 -0
- package/blockly-rc/msg/json/ba.json +211 -0
- package/blockly-rc/msg/json/bcc.json +290 -0
- package/blockly-rc/msg/json/be-tarask.json +334 -0
- package/blockly-rc/msg/json/be.json +324 -0
- package/blockly-rc/msg/json/bg.json +345 -0
- package/blockly-rc/msg/json/bn.json +189 -0
- package/blockly-rc/msg/json/br.json +334 -0
- package/blockly-rc/msg/json/bs.json +166 -0
- package/blockly-rc/msg/json/ca.json +341 -0
- package/blockly-rc/msg/json/cdo.json +6 -0
- package/blockly-rc/msg/json/ce.json +326 -0
- package/blockly-rc/msg/json/constants.json +12 -0
- package/blockly-rc/msg/json/cs.json +343 -0
- package/blockly-rc/msg/json/da.json +346 -0
- package/blockly-rc/msg/json/de.json +369 -0
- package/blockly-rc/msg/json/diq.json +258 -0
- package/blockly-rc/msg/json/dtp.json +198 -0
- package/blockly-rc/msg/json/dty.json +97 -0
- package/blockly-rc/msg/json/ee.json +160 -0
- package/blockly-rc/msg/json/el.json +356 -0
- package/blockly-rc/msg/json/en-gb.json +199 -0
- package/blockly-rc/msg/json/en.json +400 -0
- package/blockly-rc/msg/json/eo.json +337 -0
- package/blockly-rc/msg/json/es.json +358 -0
- package/blockly-rc/msg/json/et.json +326 -0
- package/blockly-rc/msg/json/eu.json +219 -0
- package/blockly-rc/msg/json/fa.json +341 -0
- package/blockly-rc/msg/json/fi.json +350 -0
- package/blockly-rc/msg/json/fo.json +46 -0
- package/blockly-rc/msg/json/fr.json +373 -0
- package/blockly-rc/msg/json/frr.json +6 -0
- package/blockly-rc/msg/json/gl.json +338 -0
- package/blockly-rc/msg/json/gn.json +54 -0
- package/blockly-rc/msg/json/gor.json +87 -0
- package/blockly-rc/msg/json/ha.json +313 -0
- package/blockly-rc/msg/json/hak.json +17 -0
- package/blockly-rc/msg/json/he.json +354 -0
- package/blockly-rc/msg/json/hi.json +318 -0
- package/blockly-rc/msg/json/hr.json +327 -0
- package/blockly-rc/msg/json/hrx.json +287 -0
- package/blockly-rc/msg/json/hsb.json +128 -0
- package/blockly-rc/msg/json/hu.json +349 -0
- package/blockly-rc/msg/json/hy.json +337 -0
- package/blockly-rc/msg/json/ia.json +337 -0
- package/blockly-rc/msg/json/id.json +335 -0
- package/blockly-rc/msg/json/ig.json +323 -0
- package/blockly-rc/msg/json/inh.json +80 -0
- package/blockly-rc/msg/json/is.json +331 -0
- package/blockly-rc/msg/json/it.json +346 -0
- package/blockly-rc/msg/json/ja.json +361 -0
- package/blockly-rc/msg/json/ka.json +14 -0
- package/blockly-rc/msg/json/kab.json +323 -0
- package/blockly-rc/msg/json/kbd-cyrl.json +84 -0
- package/blockly-rc/msg/json/km.json +29 -0
- package/blockly-rc/msg/json/kn.json +332 -0
- package/blockly-rc/msg/json/ko.json +372 -0
- package/blockly-rc/msg/json/ksh.json +43 -0
- package/blockly-rc/msg/json/ku-latn.json +41 -0
- package/blockly-rc/msg/json/ky.json +71 -0
- package/blockly-rc/msg/json/la.json +6 -0
- package/blockly-rc/msg/json/lb.json +156 -0
- package/blockly-rc/msg/json/lki.json +282 -0
- package/blockly-rc/msg/json/lo.json +92 -0
- package/blockly-rc/msg/json/lrc.json +123 -0
- package/blockly-rc/msg/json/lt.json +321 -0
- package/blockly-rc/msg/json/lv.json +324 -0
- package/blockly-rc/msg/json/mg.json +58 -0
- package/blockly-rc/msg/json/mk.json +178 -0
- package/blockly-rc/msg/json/ml.json +35 -0
- package/blockly-rc/msg/json/mnw.json +90 -0
- package/blockly-rc/msg/json/ms.json +300 -0
- package/blockly-rc/msg/json/my.json +57 -0
- package/blockly-rc/msg/json/mzn.json +6 -0
- package/blockly-rc/msg/json/nb.json +330 -0
- package/blockly-rc/msg/json/ne.json +247 -0
- package/blockly-rc/msg/json/nl.json +357 -0
- package/blockly-rc/msg/json/oc.json +194 -0
- package/blockly-rc/msg/json/olo.json +37 -0
- package/blockly-rc/msg/json/pa.json +69 -0
- package/blockly-rc/msg/json/pl.json +357 -0
- package/blockly-rc/msg/json/pms.json +324 -0
- package/blockly-rc/msg/json/ps.json +50 -0
- package/blockly-rc/msg/json/pt-br.json +369 -0
- package/blockly-rc/msg/json/pt.json +358 -0
- package/blockly-rc/msg/json/qqq.json +406 -0
- package/blockly-rc/msg/json/ro.json +333 -0
- package/blockly-rc/msg/json/ru.json +363 -0
- package/blockly-rc/msg/json/sc.json +283 -0
- package/blockly-rc/msg/json/sco.json +11 -0
- package/blockly-rc/msg/json/sd.json +158 -0
- package/blockly-rc/msg/json/shn.json +109 -0
- package/blockly-rc/msg/json/si.json +16 -0
- package/blockly-rc/msg/json/sk.json +332 -0
- package/blockly-rc/msg/json/skr-arab.json +117 -0
- package/blockly-rc/msg/json/sl.json +355 -0
- package/blockly-rc/msg/json/smn.json +133 -0
- package/blockly-rc/msg/json/sq.json +343 -0
- package/blockly-rc/msg/json/sr-latn.json +324 -0
- package/blockly-rc/msg/json/sr.json +348 -0
- package/blockly-rc/msg/json/sv.json +347 -0
- package/blockly-rc/msg/json/sw.json +12 -0
- package/blockly-rc/msg/json/synonyms.json +22 -0
- package/blockly-rc/msg/json/ta.json +306 -0
- package/blockly-rc/msg/json/tcy.json +316 -0
- package/blockly-rc/msg/json/tdd.json +109 -0
- package/blockly-rc/msg/json/te.json +101 -0
- package/blockly-rc/msg/json/th.json +333 -0
- package/blockly-rc/msg/json/ti.json +50 -0
- package/blockly-rc/msg/json/tl.json +129 -0
- package/blockly-rc/msg/json/tlh.json +179 -0
- package/blockly-rc/msg/json/tr.json +369 -0
- package/blockly-rc/msg/json/ug-arab.json +132 -0
- package/blockly-rc/msg/json/uk.json +345 -0
- package/blockly-rc/msg/json/ur.json +117 -0
- package/blockly-rc/msg/json/uz.json +36 -0
- package/blockly-rc/msg/json/vi.json +345 -0
- package/blockly-rc/msg/json/xmf.json +96 -0
- package/blockly-rc/msg/json/yo.json +316 -0
- package/blockly-rc/msg/json/zgh.json +83 -0
- package/blockly-rc/msg/json/zh-hans.json +372 -0
- package/blockly-rc/msg/json/zh-hant.json +362 -0
- package/blockly-rc/msg/messages.js +1616 -0
- package/blockly-rc/package-lock.json +12324 -0
- package/blockly-rc/package.json +149 -0
- package/blockly-rc/patches/@microsoft+api-documenter+7.22.4.patch +81 -0
- package/blockly-rc/scripts/goog_module/convert-file.sh +406 -0
- package/blockly-rc/scripts/gulpfiles/appengine_tasks.js +195 -0
- package/blockly-rc/scripts/gulpfiles/build_tasks.js +752 -0
- package/blockly-rc/scripts/gulpfiles/config.js +41 -0
- package/blockly-rc/scripts/gulpfiles/docs_tasks.js +147 -0
- package/blockly-rc/scripts/gulpfiles/git_tasks.js +181 -0
- package/blockly-rc/scripts/gulpfiles/helper_tasks.js +19 -0
- package/blockly-rc/scripts/gulpfiles/package_tasks.js +262 -0
- package/blockly-rc/scripts/gulpfiles/release_tasks.js +183 -0
- package/blockly-rc/scripts/gulpfiles/test_tasks.js +405 -0
- package/blockly-rc/scripts/helpers.js +74 -0
- package/blockly-rc/scripts/i18n/common.py +233 -0
- package/blockly-rc/scripts/i18n/create_messages.py +167 -0
- package/blockly-rc/scripts/i18n/dedup_json.py +72 -0
- package/blockly-rc/scripts/i18n/js_to_json.py +135 -0
- package/blockly-rc/scripts/i18n/tests.py +46 -0
- package/blockly-rc/scripts/migration/cjs2esm +162 -0
- package/blockly-rc/scripts/migration/js2ts +168 -0
- package/blockly-rc/scripts/migration/renamings.json5 +1599 -0
- package/blockly-rc/scripts/package/README.md +93 -0
- package/blockly-rc/scripts/package/core-node.js +31 -0
- package/blockly-rc/scripts/package/index.js +23 -0
- package/blockly-rc/scripts/package/templates/umd-msg.template +16 -0
- package/blockly-rc/scripts/package/templates/umd.template +13 -0
- package/blockly-rc/scripts/themes/blockStyles_example.json +11 -0
- package/blockly-rc/scripts/themes/create_blockStyles.py +181 -0
- package/blockly-rc/scripts/tsick.js +86 -0
- package/blockly-rc/tests/.eslintrc.json +10 -0
- package/blockly-rc/tests/browser/.eslintrc.json +29 -0
- package/blockly-rc/tests/browser/.mocharc.js +6 -0
- package/blockly-rc/tests/browser/test/basic_block_factory_test.mjs +44 -0
- package/blockly-rc/tests/browser/test/basic_block_test.mjs +39 -0
- package/blockly-rc/tests/browser/test/basic_playground_test.mjs +198 -0
- package/blockly-rc/tests/browser/test/block_undo_test.mjs +50 -0
- package/blockly-rc/tests/browser/test/delete_blocks_test.mjs +211 -0
- package/blockly-rc/tests/browser/test/extensive_test.mjs +195 -0
- package/blockly-rc/tests/browser/test/field_edits_test.mjs +61 -0
- package/blockly-rc/tests/browser/test/hooks.mjs +23 -0
- package/blockly-rc/tests/browser/test/mutator_test.mjs +88 -0
- package/blockly-rc/tests/browser/test/procedure_test.mjs +109 -0
- package/blockly-rc/tests/browser/test/test_setup.mjs +589 -0
- package/blockly-rc/tests/browser/test/toolbox_drag_test.mjs +207 -0
- package/blockly-rc/tests/browser/test/workspace_comment_test.mjs +224 -0
- package/blockly-rc/tests/compile/index.html +43 -0
- package/blockly-rc/tests/compile/main.js +53 -0
- package/blockly-rc/tests/compile/test_blocks.js +47 -0
- package/blockly-rc/tests/compile/webdriver.js +81 -0
- package/blockly-rc/tests/generators/functions.xml +561 -0
- package/blockly-rc/tests/generators/golden/generated.dart +1604 -0
- package/blockly-rc/tests/generators/golden/generated.js +1552 -0
- package/blockly-rc/tests/generators/golden/generated.lua +1828 -0
- package/blockly-rc/tests/generators/golden/generated.php +1611 -0
- package/blockly-rc/tests/generators/golden/generated.py +1407 -0
- package/blockly-rc/tests/generators/index.html +405 -0
- package/blockly-rc/tests/generators/lists.xml +8675 -0
- package/blockly-rc/tests/generators/logic.xml +1019 -0
- package/blockly-rc/tests/generators/loops1.xml +345 -0
- package/blockly-rc/tests/generators/loops2.xml +891 -0
- package/blockly-rc/tests/generators/loops3.xml +735 -0
- package/blockly-rc/tests/generators/math.xml +2077 -0
- package/blockly-rc/tests/generators/text.xml +4651 -0
- package/blockly-rc/tests/generators/unittest.js +103 -0
- package/blockly-rc/tests/generators/unittest_dart.js +163 -0
- package/blockly-rc/tests/generators/unittest_javascript.js +167 -0
- package/blockly-rc/tests/generators/unittest_lua.js +165 -0
- package/blockly-rc/tests/generators/unittest_php.js +154 -0
- package/blockly-rc/tests/generators/unittest_python.js +138 -0
- package/blockly-rc/tests/generators/variables.xml +68 -0
- package/blockly-rc/tests/generators/webdriver.js +123 -0
- package/blockly-rc/tests/media/200px.png +0 -0
- package/blockly-rc/tests/media/30px.png +0 -0
- package/blockly-rc/tests/media/50px.png +0 -0
- package/blockly-rc/tests/media/a.png +0 -0
- package/blockly-rc/tests/media/arrow.png +0 -0
- package/blockly-rc/tests/media/b.png +0 -0
- package/blockly-rc/tests/media/c.png +0 -0
- package/blockly-rc/tests/media/d.png +0 -0
- package/blockly-rc/tests/media/e.png +0 -0
- package/blockly-rc/tests/media/f.png +0 -0
- package/blockly-rc/tests/media/g.png +0 -0
- package/blockly-rc/tests/media/h.png +0 -0
- package/blockly-rc/tests/media/i.png +0 -0
- package/blockly-rc/tests/media/j.png +0 -0
- package/blockly-rc/tests/media/k.png +0 -0
- package/blockly-rc/tests/media/l.png +0 -0
- package/blockly-rc/tests/media/m.png +0 -0
- package/blockly-rc/tests/migration/renamings.schema.json +59 -0
- package/blockly-rc/tests/migration/validate-renamings.mjs +60 -0
- package/blockly-rc/tests/mocha/.eslintrc.json +21 -0
- package/blockly-rc/tests/mocha/.mocharc.js +6 -0
- package/blockly-rc/tests/mocha/astnode_test.js +850 -0
- package/blockly-rc/tests/mocha/block_json_test.js +777 -0
- package/blockly-rc/tests/mocha/block_test.js +2743 -0
- package/blockly-rc/tests/mocha/blocks/lists_test.js +196 -0
- package/blockly-rc/tests/mocha/blocks/logic_ternary_test.js +320 -0
- package/blockly-rc/tests/mocha/blocks/loops_test.js +56 -0
- package/blockly-rc/tests/mocha/blocks/procedures_test.js +2495 -0
- package/blockly-rc/tests/mocha/blocks/variables_test.js +311 -0
- package/blockly-rc/tests/mocha/clipboard_test.js +136 -0
- package/blockly-rc/tests/mocha/comment_deserialization_test.js +122 -0
- package/blockly-rc/tests/mocha/comment_test.js +170 -0
- package/blockly-rc/tests/mocha/comment_view_test.js +188 -0
- package/blockly-rc/tests/mocha/connection_checker_test.js +666 -0
- package/blockly-rc/tests/mocha/connection_db_test.js +362 -0
- package/blockly-rc/tests/mocha/connection_test.js +3738 -0
- package/blockly-rc/tests/mocha/contextmenu_items_test.js +488 -0
- package/blockly-rc/tests/mocha/contextmenu_test.js +71 -0
- package/blockly-rc/tests/mocha/cursor_test.js +134 -0
- package/blockly-rc/tests/mocha/dropdowndiv_test.js +116 -0
- package/blockly-rc/tests/mocha/event_block_change_test.js +126 -0
- package/blockly-rc/tests/mocha/event_block_create_test.js +109 -0
- package/blockly-rc/tests/mocha/event_block_delete_test.js +55 -0
- package/blockly-rc/tests/mocha/event_block_drag_test.js +36 -0
- package/blockly-rc/tests/mocha/event_block_field_intermediate_change_test.js +67 -0
- package/blockly-rc/tests/mocha/event_block_move_test.js +39 -0
- package/blockly-rc/tests/mocha/event_bubble_open_test.js +42 -0
- package/blockly-rc/tests/mocha/event_click_test.js +40 -0
- package/blockly-rc/tests/mocha/event_comment_change_test.js +39 -0
- package/blockly-rc/tests/mocha/event_comment_collapse_test.js +34 -0
- package/blockly-rc/tests/mocha/event_comment_create_test.js +38 -0
- package/blockly-rc/tests/mocha/event_comment_delete_test.js +38 -0
- package/blockly-rc/tests/mocha/event_comment_drag_test.js +35 -0
- package/blockly-rc/tests/mocha/event_comment_move_test.js +40 -0
- package/blockly-rc/tests/mocha/event_comment_resize_test.js +38 -0
- package/blockly-rc/tests/mocha/event_marker_move_test.js +44 -0
- package/blockly-rc/tests/mocha/event_selected_test.js +41 -0
- package/blockly-rc/tests/mocha/event_test.js +1578 -0
- package/blockly-rc/tests/mocha/event_theme_change_test.js +36 -0
- package/blockly-rc/tests/mocha/event_toolbox_item_select_test.js +64 -0
- package/blockly-rc/tests/mocha/event_trashcan_open_test.js +36 -0
- package/blockly-rc/tests/mocha/event_var_create_test.js +54 -0
- package/blockly-rc/tests/mocha/event_var_delete_test.js +54 -0
- package/blockly-rc/tests/mocha/event_var_rename_test.js +39 -0
- package/blockly-rc/tests/mocha/event_var_type_change_test.js +43 -0
- package/blockly-rc/tests/mocha/event_viewport_test.js +39 -0
- package/blockly-rc/tests/mocha/extensions_test.js +613 -0
- package/blockly-rc/tests/mocha/field_checkbox_test.js +299 -0
- package/blockly-rc/tests/mocha/field_colour_test.js +395 -0
- package/blockly-rc/tests/mocha/field_dropdown_test.js +282 -0
- package/blockly-rc/tests/mocha/field_image_test.js +241 -0
- package/blockly-rc/tests/mocha/field_label_serializable_test.js +252 -0
- package/blockly-rc/tests/mocha/field_label_test.js +226 -0
- package/blockly-rc/tests/mocha/field_number_test.js +505 -0
- package/blockly-rc/tests/mocha/field_registry_test.js +116 -0
- package/blockly-rc/tests/mocha/field_test.js +822 -0
- package/blockly-rc/tests/mocha/field_textinput_test.js +297 -0
- package/blockly-rc/tests/mocha/field_variable_test.js +611 -0
- package/blockly-rc/tests/mocha/flyout_test.js +638 -0
- package/blockly-rc/tests/mocha/generator_test.js +233 -0
- package/blockly-rc/tests/mocha/gesture_test.js +97 -0
- package/blockly-rc/tests/mocha/icon_test.js +369 -0
- package/blockly-rc/tests/mocha/index.html +229 -0
- package/blockly-rc/tests/mocha/input_test.js +296 -0
- package/blockly-rc/tests/mocha/insertion_marker_manager_test.js +443 -0
- package/blockly-rc/tests/mocha/insertion_marker_test.js +432 -0
- package/blockly-rc/tests/mocha/jso_deserialization_test.js +849 -0
- package/blockly-rc/tests/mocha/jso_serialization_test.js +1067 -0
- package/blockly-rc/tests/mocha/json_test.js +315 -0
- package/blockly-rc/tests/mocha/keydown_test.js +364 -0
- package/blockly-rc/tests/mocha/layering_test.js +95 -0
- package/blockly-rc/tests/mocha/metrics_test.js +671 -0
- package/blockly-rc/tests/mocha/mutator_test.js +87 -0
- package/blockly-rc/tests/mocha/names_test.js +97 -0
- package/blockly-rc/tests/mocha/old_workspace_comment_test.js +256 -0
- package/blockly-rc/tests/mocha/procedure_map_test.js +57 -0
- package/blockly-rc/tests/mocha/registry_test.js +281 -0
- package/blockly-rc/tests/mocha/render_management_test.js +127 -0
- package/blockly-rc/tests/mocha/serializer_test.js +2104 -0
- package/blockly-rc/tests/mocha/shortcut_registry_test.js +450 -0
- package/blockly-rc/tests/mocha/test_helpers/block_definitions.js +204 -0
- package/blockly-rc/tests/mocha/test_helpers/code_generation.js +115 -0
- package/blockly-rc/tests/mocha/test_helpers/common.js +106 -0
- package/blockly-rc/tests/mocha/test_helpers/events.js +290 -0
- package/blockly-rc/tests/mocha/test_helpers/fields.js +310 -0
- package/blockly-rc/tests/mocha/test_helpers/icon_mocks.js +81 -0
- package/blockly-rc/tests/mocha/test_helpers/procedures.js +302 -0
- package/blockly-rc/tests/mocha/test_helpers/serialization.js +124 -0
- package/blockly-rc/tests/mocha/test_helpers/setup_teardown.js +209 -0
- package/blockly-rc/tests/mocha/test_helpers/toolbox_definitions.js +271 -0
- package/blockly-rc/tests/mocha/test_helpers/user_input.js +62 -0
- package/blockly-rc/tests/mocha/test_helpers/variables.js +23 -0
- package/blockly-rc/tests/mocha/test_helpers/warnings.js +83 -0
- package/blockly-rc/tests/mocha/test_helpers/workspace.js +1691 -0
- package/blockly-rc/tests/mocha/theme_test.js +307 -0
- package/blockly-rc/tests/mocha/toolbox_test.js +761 -0
- package/blockly-rc/tests/mocha/tooltip_test.js +276 -0
- package/blockly-rc/tests/mocha/touch_test.js +109 -0
- package/blockly-rc/tests/mocha/trashcan_test.js +375 -0
- package/blockly-rc/tests/mocha/utils_test.js +536 -0
- package/blockly-rc/tests/mocha/variable_map_test.js +509 -0
- package/blockly-rc/tests/mocha/variable_model_test.js +85 -0
- package/blockly-rc/tests/mocha/webdriver.js +96 -0
- package/blockly-rc/tests/mocha/widget_div_test.js +272 -0
- package/blockly-rc/tests/mocha/workspace_comment_test.js +171 -0
- package/blockly-rc/tests/mocha/workspace_svg_test.js +414 -0
- package/blockly-rc/tests/mocha/workspace_test.js +27 -0
- package/blockly-rc/tests/mocha/xml_test.js +951 -0
- package/blockly-rc/tests/mocha/zoom_controls_test.js +81 -0
- package/blockly-rc/tests/multi_playground.html +482 -0
- package/blockly-rc/tests/node/.eslintrc.json +12 -0
- package/blockly-rc/tests/node/.mocharc.js +6 -0
- package/blockly-rc/tests/node/run_node_test.mjs +72 -0
- package/blockly-rc/tests/playground.html +1280 -0
- package/blockly-rc/tests/playgrounds/advanced_playground.html +158 -0
- package/blockly-rc/tests/playgrounds/iframe.html +40 -0
- package/blockly-rc/tests/playgrounds/screenshot.js +123 -0
- package/blockly-rc/tests/scripts/check_metadata.sh +166 -0
- package/blockly-rc/tests/scripts/compile_typings.sh +32 -0
- package/blockly-rc/tests/scripts/load.mjs +140 -0
- package/blockly-rc/tests/scripts/setup_linux_env.sh +7 -0
- package/blockly-rc/tests/scripts/update_metadata.sh +46 -0
- package/blockly-rc/tests/themes/test_themes.js +62 -0
- package/blockly-rc/tests/typescript/README.md +4 -0
- package/blockly-rc/tests/typescript/src/field/different_user_input.ts +81 -0
- package/blockly-rc/tests/typescript/src/generators/dart.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/javascript.ts +28 -0
- package/blockly-rc/tests/typescript/src/generators/lua.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/php.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/python.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators.ts +31 -0
- package/blockly-rc/tests/typescript/src/msg.ts +20 -0
- package/blockly-rc/tests/typescript/tsconfig.json +20 -0
- package/blockly-rc/tests/xml/README.txt +11 -0
- package/blockly-rc/tests/xml/blockly.xsd +178 -0
- package/blockly-rc/tests/xml/invalid.xml +6 -0
- package/blockly-rc/tests/xml/toolbox.xml +311 -0
- package/blockly-rc/tests/xml/workspace.xml +114 -0
- package/blockly-rc/tsconfig.json +37 -0
- package/blockly-rc/tsdoc.json +35 -0
- package/blockly-rc/typings/README.md +5 -0
- package/blockly-rc/typings/blocks.d.ts +17 -0
- package/blockly-rc/typings/core.d.ts +7 -0
- package/blockly-rc/typings/dart.d.ts +7 -0
- package/blockly-rc/typings/index.d.ts +10 -0
- package/blockly-rc/typings/javascript.d.ts +7 -0
- package/blockly-rc/typings/lua.d.ts +7 -0
- package/blockly-rc/typings/msg/ab.d.ts +8 -0
- package/blockly-rc/typings/msg/ace.d.ts +8 -0
- package/blockly-rc/typings/msg/af.d.ts +8 -0
- package/blockly-rc/typings/msg/am.d.ts +8 -0
- package/blockly-rc/typings/msg/ar.d.ts +8 -0
- package/blockly-rc/typings/msg/ast.d.ts +8 -0
- package/blockly-rc/typings/msg/az.d.ts +8 -0
- package/blockly-rc/typings/msg/ba.d.ts +8 -0
- package/blockly-rc/typings/msg/bcc.d.ts +8 -0
- package/blockly-rc/typings/msg/be-tarask.d.ts +8 -0
- package/blockly-rc/typings/msg/be.d.ts +8 -0
- package/blockly-rc/typings/msg/bg.d.ts +8 -0
- package/blockly-rc/typings/msg/bn.d.ts +8 -0
- package/blockly-rc/typings/msg/br.d.ts +8 -0
- package/blockly-rc/typings/msg/bs.d.ts +8 -0
- package/blockly-rc/typings/msg/ca.d.ts +8 -0
- package/blockly-rc/typings/msg/cdo.d.ts +8 -0
- package/blockly-rc/typings/msg/ce.d.ts +8 -0
- package/blockly-rc/typings/msg/cs.d.ts +8 -0
- package/blockly-rc/typings/msg/da.d.ts +8 -0
- package/blockly-rc/typings/msg/de.d.ts +8 -0
- package/blockly-rc/typings/msg/diq.d.ts +8 -0
- package/blockly-rc/typings/msg/dtp.d.ts +8 -0
- package/blockly-rc/typings/msg/dty.d.ts +8 -0
- package/blockly-rc/typings/msg/ee.d.ts +8 -0
- package/blockly-rc/typings/msg/el.d.ts +8 -0
- package/blockly-rc/typings/msg/en-gb.d.ts +8 -0
- package/blockly-rc/typings/msg/en.d.ts +8 -0
- package/blockly-rc/typings/msg/eo.d.ts +8 -0
- package/blockly-rc/typings/msg/es.d.ts +8 -0
- package/blockly-rc/typings/msg/et.d.ts +8 -0
- package/blockly-rc/typings/msg/eu.d.ts +8 -0
- package/blockly-rc/typings/msg/fa.d.ts +8 -0
- package/blockly-rc/typings/msg/fi.d.ts +8 -0
- package/blockly-rc/typings/msg/fo.d.ts +8 -0
- package/blockly-rc/typings/msg/fr.d.ts +8 -0
- package/blockly-rc/typings/msg/frr.d.ts +8 -0
- package/blockly-rc/typings/msg/gl.d.ts +8 -0
- package/blockly-rc/typings/msg/gn.d.ts +8 -0
- package/blockly-rc/typings/msg/gor.d.ts +8 -0
- package/blockly-rc/typings/msg/ha.d.ts +8 -0
- package/blockly-rc/typings/msg/hak.d.ts +8 -0
- package/blockly-rc/typings/msg/he.d.ts +8 -0
- package/blockly-rc/typings/msg/hi.d.ts +8 -0
- package/blockly-rc/typings/msg/hr.d.ts +8 -0
- package/blockly-rc/typings/msg/hrx.d.ts +8 -0
- package/blockly-rc/typings/msg/hsb.d.ts +8 -0
- package/blockly-rc/typings/msg/hu.d.ts +8 -0
- package/blockly-rc/typings/msg/hy.d.ts +8 -0
- package/blockly-rc/typings/msg/ia.d.ts +8 -0
- package/blockly-rc/typings/msg/id.d.ts +8 -0
- package/blockly-rc/typings/msg/ig.d.ts +8 -0
- package/blockly-rc/typings/msg/inh.d.ts +8 -0
- package/blockly-rc/typings/msg/is.d.ts +8 -0
- package/blockly-rc/typings/msg/it.d.ts +8 -0
- package/blockly-rc/typings/msg/ja.d.ts +8 -0
- package/blockly-rc/typings/msg/ka.d.ts +8 -0
- package/blockly-rc/typings/msg/kab.d.ts +8 -0
- package/blockly-rc/typings/msg/kbd-cyrl.d.ts +8 -0
- package/blockly-rc/typings/msg/km.d.ts +8 -0
- package/blockly-rc/typings/msg/kn.d.ts +8 -0
- package/blockly-rc/typings/msg/ko.d.ts +8 -0
- package/blockly-rc/typings/msg/ksh.d.ts +8 -0
- package/blockly-rc/typings/msg/ku-latn.d.ts +8 -0
- package/blockly-rc/typings/msg/ky.d.ts +8 -0
- package/blockly-rc/typings/msg/la.d.ts +8 -0
- package/blockly-rc/typings/msg/lb.d.ts +8 -0
- package/blockly-rc/typings/msg/lki.d.ts +8 -0
- package/blockly-rc/typings/msg/lo.d.ts +8 -0
- package/blockly-rc/typings/msg/lrc.d.ts +8 -0
- package/blockly-rc/typings/msg/lt.d.ts +8 -0
- package/blockly-rc/typings/msg/lv.d.ts +8 -0
- package/blockly-rc/typings/msg/mg.d.ts +8 -0
- package/blockly-rc/typings/msg/mk.d.ts +8 -0
- package/blockly-rc/typings/msg/ml.d.ts +8 -0
- package/blockly-rc/typings/msg/mnw.d.ts +8 -0
- package/blockly-rc/typings/msg/ms.d.ts +8 -0
- package/blockly-rc/typings/msg/msg.d.ts +440 -0
- package/blockly-rc/typings/msg/my.d.ts +8 -0
- package/blockly-rc/typings/msg/mzn.d.ts +8 -0
- package/blockly-rc/typings/msg/nb.d.ts +8 -0
- package/blockly-rc/typings/msg/ne.d.ts +8 -0
- package/blockly-rc/typings/msg/nl.d.ts +8 -0
- package/blockly-rc/typings/msg/oc.d.ts +8 -0
- package/blockly-rc/typings/msg/olo.d.ts +8 -0
- package/blockly-rc/typings/msg/pa.d.ts +8 -0
- package/blockly-rc/typings/msg/pl.d.ts +8 -0
- package/blockly-rc/typings/msg/pms.d.ts +8 -0
- package/blockly-rc/typings/msg/ps.d.ts +8 -0
- package/blockly-rc/typings/msg/pt-br.d.ts +8 -0
- package/blockly-rc/typings/msg/pt.d.ts +8 -0
- package/blockly-rc/typings/msg/ro.d.ts +8 -0
- package/blockly-rc/typings/msg/ru.d.ts +8 -0
- package/blockly-rc/typings/msg/sc.d.ts +8 -0
- package/blockly-rc/typings/msg/sco.d.ts +8 -0
- package/blockly-rc/typings/msg/sd.d.ts +8 -0
- package/blockly-rc/typings/msg/shn.d.ts +8 -0
- package/blockly-rc/typings/msg/si.d.ts +8 -0
- package/blockly-rc/typings/msg/sk.d.ts +8 -0
- package/blockly-rc/typings/msg/skr-arab.d.ts +8 -0
- package/blockly-rc/typings/msg/sl.d.ts +8 -0
- package/blockly-rc/typings/msg/smn.d.ts +8 -0
- package/blockly-rc/typings/msg/sq.d.ts +8 -0
- package/blockly-rc/typings/msg/sr-latn.d.ts +8 -0
- package/blockly-rc/typings/msg/sr.d.ts +8 -0
- package/blockly-rc/typings/msg/sv.d.ts +8 -0
- package/blockly-rc/typings/msg/sw.d.ts +8 -0
- package/blockly-rc/typings/msg/ta.d.ts +8 -0
- package/blockly-rc/typings/msg/tcy.d.ts +8 -0
- package/blockly-rc/typings/msg/tdd.d.ts +8 -0
- package/blockly-rc/typings/msg/te.d.ts +8 -0
- package/blockly-rc/typings/msg/th.d.ts +8 -0
- package/blockly-rc/typings/msg/ti.d.ts +8 -0
- package/blockly-rc/typings/msg/tl.d.ts +8 -0
- package/blockly-rc/typings/msg/tlh.d.ts +8 -0
- package/blockly-rc/typings/msg/tr.d.ts +8 -0
- package/blockly-rc/typings/msg/ug-arab.d.ts +8 -0
- package/blockly-rc/typings/msg/uk.d.ts +8 -0
- package/blockly-rc/typings/msg/ur.d.ts +8 -0
- package/blockly-rc/typings/msg/uz.d.ts +8 -0
- package/blockly-rc/typings/msg/vi.d.ts +8 -0
- package/blockly-rc/typings/msg/xmf.d.ts +8 -0
- package/blockly-rc/typings/msg/yo.d.ts +8 -0
- package/blockly-rc/typings/msg/zgh.d.ts +8 -0
- package/blockly-rc/typings/msg/zh-hans.d.ts +8 -0
- package/blockly-rc/typings/msg/zh-hant.d.ts +8 -0
- package/blockly-rc/typings/php.d.ts +7 -0
- package/blockly-rc/typings/python.d.ts +7 -0
- package/blockly-rc/typings/templates/blockly-header.template +11 -0
- package/blockly-rc/typings/templates/blockly-interfaces.template +83 -0
- package/blockly-rc/typings/templates/msg.template +15 -0
- package/blockly-rc/typings/tsconfig.json +23 -0
- package/continuous-toolbox.d.ts +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +163 -0
- package/media/delete-icon.svg +10 -0
- package/media/resize-handle.svg +3 -0
- package/msg/scratch_msgs.js +184 -164
- package/package.json +25 -40
- package/release.config.js +8 -0
- package/src/block_reporting.js +31 -0
- package/src/blocks/colour.js +56 -0
- package/src/blocks/control.js +492 -0
- package/src/blocks/data.js +690 -0
- package/src/blocks/event.js +305 -0
- package/src/blocks/looks.js +537 -0
- package/src/blocks/math.js +137 -0
- package/src/blocks/matrix.js +47 -0
- package/src/blocks/motion.js +513 -0
- package/src/blocks/note.js +48 -0
- package/src/blocks/operators.js +463 -0
- package/src/blocks/procedures.js +1009 -0
- package/src/blocks/sensing.js +441 -0
- package/src/blocks/sound.js +205 -0
- package/src/blocks/text.js +45 -0
- package/src/blocks/vertical_extensions.js +309 -0
- package/src/categories.js +15 -0
- package/src/checkable_continuous_flyout.js +138 -0
- package/src/checkbox_bubble.js +282 -0
- package/src/colours.js +77 -0
- package/src/constants.js +63 -0
- package/src/context_menu_items.js +150 -0
- package/src/css.js +1197 -0
- package/src/data_category.js +556 -0
- package/src/events/events_block_comment_base.js +35 -0
- package/src/events/events_block_comment_change.js +43 -0
- package/src/events/events_block_comment_collapse.js +43 -0
- package/src/events/events_block_comment_create.js +52 -0
- package/src/events/events_block_comment_delete.js +27 -0
- package/src/events/events_block_comment_move.js +54 -0
- package/src/events/events_block_comment_resize.js +52 -0
- package/src/events/events_block_drag_end.js +33 -0
- package/src/events/events_block_drag_outside.js +30 -0
- package/src/events/events_scratch_variable_create.js +67 -0
- package/src/fields/field_angle.js +433 -0
- package/src/fields/field_colour_slider.js +388 -0
- package/src/fields/field_dropdown.js +42 -0
- package/src/fields/field_matrix.js +634 -0
- package/src/fields/field_note.js +937 -0
- package/src/fields/field_number.js +380 -0
- package/src/fields/field_textinput_removable.js +107 -0
- package/src/fields/field_variable.js +171 -0
- package/src/fields/field_variable_getter.js +109 -0
- package/src/fields/field_vertical_separator.js +139 -0
- package/src/flyout_checkbox_icon.js +88 -0
- package/src/glows.js +98 -0
- package/src/index.ts +137 -0
- package/src/procedures.js +425 -0
- package/src/recyclable_block_flyout_inflater.js +194 -0
- package/src/renderer/bowler_hat.js +17 -0
- package/src/renderer/constants.js +45 -0
- package/src/renderer/drawer.js +51 -0
- package/src/renderer/path_object.js +35 -0
- package/src/renderer/render_info.js +98 -0
- package/src/renderer/renderer.js +74 -0
- package/src/scratch_block_paster.js +46 -0
- package/src/scratch_blocks_utils.js +148 -0
- package/src/scratch_comment_bubble.js +169 -0
- package/src/scratch_comment_icon.js +195 -0
- package/src/scratch_connection_checker.js +29 -0
- package/src/scratch_continuous_category.js +80 -0
- package/src/scratch_continuous_toolbox.js +78 -0
- package/src/scratch_dragger.js +142 -0
- package/src/scratch_variable_map.js +25 -0
- package/src/scratch_variable_model.js +24 -0
- package/src/shadows.js +61 -0
- package/src/status_indicator_label.js +186 -0
- package/src/status_indicator_label_flyout_inflater.js +42 -0
- package/src/variables.js +355 -0
- package/temp-use-blockly-v12-rc.sh +26 -0
- package/tsconfig.json +13 -0
- package/blockly_compressed_horizontal.js +0 -2255
- package/blockly_compressed_vertical.js +0 -2283
- package/blockly_uncompressed_horizontal.js +0 -1210
- package/blockly_uncompressed_vertical.js +0 -1210
- package/blocks_common/colour.js +0 -61
- package/blocks_common/math.js +0 -159
- package/blocks_common/matrix.js +0 -54
- package/blocks_common/note.js +0 -58
- package/blocks_common/text.js +0 -57
- package/blocks_compressed.js +0 -36
- package/blocks_compressed_horizontal.js +0 -67
- package/blocks_compressed_vertical.js +0 -208
- package/blocks_horizontal/control.js +0 -212
- package/blocks_horizontal/default_toolbox.js +0 -139
- package/blocks_horizontal/event.js +0 -190
- package/blocks_horizontal/wedo.js +0 -325
- package/blocks_vertical/control.js +0 -532
- package/blocks_vertical/data.js +0 -666
- package/blocks_vertical/default_toolbox.js +0 -564
- package/blocks_vertical/event.js +0 -329
- package/blocks_vertical/extensions.js +0 -294
- package/blocks_vertical/looks.js +0 -591
- package/blocks_vertical/motion.js +0 -587
- package/blocks_vertical/operators.js +0 -470
- package/blocks_vertical/procedures.js +0 -973
- package/blocks_vertical/sensing.js +0 -539
- package/blocks_vertical/sound.js +0 -246
- package/blocks_vertical/vertical_extensions.js +0 -266
- package/build/gen_blocks.js +0 -1
- package/build/test_expect.js +0 -1
- package/build/test_input.js +0 -1
- package/build.py +0 -636
- package/cleanup.sh +0 -101
- package/core/block.js +0 -1837
- package/core/block_animations.js +0 -107
- package/core/block_drag_surface.js +0 -299
- package/core/block_dragger.js +0 -421
- package/core/block_events.js +0 -531
- package/core/block_render_svg_horizontal.js +0 -890
- package/core/block_render_svg_vertical.js +0 -1732
- package/core/block_svg.js +0 -1316
- package/core/blockly.js +0 -622
- package/core/blocks.js +0 -37
- package/core/bubble.js +0 -664
- package/core/bubble_dragger.js +0 -285
- package/core/colours.js +0 -160
- package/core/comment.js +0 -293
- package/core/comment_events.js +0 -539
- package/core/connection.js +0 -766
- package/core/connection_db.js +0 -300
- package/core/constants.js +0 -387
- package/core/contextmenu.js +0 -519
- package/core/css.js +0 -1351
- package/core/data_category.js +0 -490
- package/core/dragged_connection_manager.js +0 -260
- package/core/dropdowndiv.js +0 -408
- package/core/events.js +0 -429
- package/core/events_abstract.js +0 -113
- package/core/extensions.js +0 -450
- package/core/field.js +0 -807
- package/core/field_angle.js +0 -398
- package/core/field_checkbox.js +0 -133
- package/core/field_colour.js +0 -253
- package/core/field_colour_slider.js +0 -387
- package/core/field_date.js +0 -353
- package/core/field_dropdown.js +0 -483
- package/core/field_iconmenu.js +0 -309
- package/core/field_image.js +0 -193
- package/core/field_label.js +0 -136
- package/core/field_label_serializable.js +0 -125
- package/core/field_matrix.js +0 -566
- package/core/field_note.js +0 -850
- package/core/field_number.js +0 -366
- package/core/field_numberdropdown.js +0 -77
- package/core/field_textdropdown.js +0 -164
- package/core/field_textinput.js +0 -675
- package/core/field_textinput_removable.js +0 -105
- package/core/field_variable.js +0 -385
- package/core/field_variable_getter.js +0 -185
- package/core/field_vertical_separator.js +0 -161
- package/core/flyout_base.js +0 -923
- package/core/flyout_button.js +0 -322
- package/core/flyout_dragger.js +0 -83
- package/core/flyout_extension_category_header.js +0 -159
- package/core/flyout_horizontal.js +0 -475
- package/core/flyout_vertical.js +0 -770
- package/core/generator.js +0 -426
- package/core/gesture.js +0 -1011
- package/core/grid.js +0 -227
- package/core/icon.js +0 -205
- package/core/inject.js +0 -491
- package/core/input.js +0 -285
- package/core/insertion_marker_manager.js +0 -678
- package/core/msg.js +0 -62
- package/core/mutator.js +0 -426
- package/core/names.js +0 -198
- package/core/options.js +0 -244
- package/core/procedures.js +0 -577
- package/core/rendered_connection.js +0 -417
- package/core/scratch_block_comment.js +0 -653
- package/core/scratch_blocks_utils.js +0 -244
- package/core/scratch_bubble.js +0 -696
- package/core/scratch_events.js +0 -131
- package/core/scratch_msgs.js +0 -85
- package/core/scrollbar.js +0 -875
- package/core/toolbox.js +0 -801
- package/core/tooltip.js +0 -337
- package/core/touch.js +0 -226
- package/core/trashcan.js +0 -343
- package/core/ui_events.js +0 -91
- package/core/ui_menu_utils.js +0 -68
- package/core/utils.js +0 -948
- package/core/variable_events.js +0 -259
- package/core/variable_map.js +0 -415
- package/core/variable_model.js +0 -116
- package/core/variables.js +0 -674
- package/core/warning.js +0 -199
- package/core/widgetdiv.js +0 -344
- package/core/workspace.js +0 -673
- package/core/workspace_audio.js +0 -170
- package/core/workspace_comment.js +0 -432
- package/core/workspace_comment_render_svg.js +0 -723
- package/core/workspace_comment_svg.js +0 -611
- package/core/workspace_drag_surface_svg.js +0 -195
- package/core/workspace_dragger.js +0 -132
- package/core/workspace_svg.js +0 -2267
- package/core/xml.js +0 -919
- package/core/zoom_controls.js +0 -301
- package/dist/horizontal.js +0 -222
- package/dist/vertical.js +0 -222
- package/dist/web/horizontal.js +0 -232
- package/dist/web/vertical.js +0 -232
- package/local_build.sh +0 -70
- package/pack/scratch-blocks-1.1.206.tgz +0 -0
- package/pull_from_blockly.sh +0 -151
- package/shim/blockly_compressed_horizontal-blocks_compressed.js +0 -1
- package/shim/blockly_compressed_horizontal.Blockly.js +0 -1
- package/shim/blockly_compressed_horizontal.goog.js +0 -1
- package/shim/blockly_compressed_horizontal.js +0 -1
- package/shim/blockly_compressed_vertical-blocks_compressed.js +0 -1
- package/shim/blockly_compressed_vertical.Blockly.js +0 -1
- package/shim/blockly_compressed_vertical.goog.js +0 -1
- package/shim/blockly_compressed_vertical.js +0 -1
- package/shim/blocks_compressed_horizontal-blockly_compressed_horizontal-messages.js +0 -1
- package/shim/blocks_compressed_horizontal.js +0 -1
- package/shim/blocks_compressed_vertical-blockly_compressed_vertical-messages.js +0 -1
- package/shim/blocks_compressed_vertical.js +0 -1
- package/shim/gh-pages.js +0 -1
- package/shim/horizontal.js +0 -1
- package/shim/index.js +0 -17
- package/shim/vertical.js +0 -1
- /package/media/{comment-arrow-down.svg → foldout-icon.svg} +0 -0
package/core/xml.js
DELETED
|
@@ -1,919 +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 XML reader and writer.
|
|
23
|
-
* @author fraser@google.com (Neil Fraser)
|
|
24
|
-
*/
|
|
25
|
-
'use strict';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @name Blockly.Xml
|
|
29
|
-
* @namespace
|
|
30
|
-
**/
|
|
31
|
-
goog.provide('Blockly.Xml');
|
|
32
|
-
|
|
33
|
-
goog.require('Blockly.Events.BlockCreate');
|
|
34
|
-
goog.require('Blockly.Events.VarCreate');
|
|
35
|
-
|
|
36
|
-
goog.require('goog.asserts');
|
|
37
|
-
goog.require('goog.dom');
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Encode a block tree as XML.
|
|
42
|
-
* @param {!Blockly.Workspace} workspace The workspace containing blocks.
|
|
43
|
-
* @param {boolean=} opt_noId True if the encoder should skip the block IDs.
|
|
44
|
-
* @return {!Element} XML document.
|
|
45
|
-
*/
|
|
46
|
-
Blockly.Xml.workspaceToDom = function(workspace, opt_noId) {
|
|
47
|
-
var xml = goog.dom.createDom('xml');
|
|
48
|
-
xml.appendChild(Blockly.Xml.variablesToDom(workspace.getAllVariables()));
|
|
49
|
-
var comments = workspace.getTopComments(true).filter(function(topComment) {
|
|
50
|
-
return topComment instanceof Blockly.WorkspaceComment;
|
|
51
|
-
});
|
|
52
|
-
for (var i = 0, comment; comment = comments[i]; i++) {
|
|
53
|
-
xml.appendChild(comment.toXmlWithXY(opt_noId));
|
|
54
|
-
}
|
|
55
|
-
var blocks = workspace.getTopBlocks(true);
|
|
56
|
-
for (var i = 0, block; block = blocks[i]; i++) {
|
|
57
|
-
xml.appendChild(Blockly.Xml.blockToDomWithXY(block, opt_noId));
|
|
58
|
-
}
|
|
59
|
-
return xml;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Encode a list of variables as XML.
|
|
64
|
-
* @param {!Array.<!Blockly.VariableModel>} variableList List of all variable
|
|
65
|
-
* models.
|
|
66
|
-
* @return {!Element} List of XML elements.
|
|
67
|
-
*/
|
|
68
|
-
Blockly.Xml.variablesToDom = function(variableList) {
|
|
69
|
-
var variables = goog.dom.createDom('variables');
|
|
70
|
-
for (var i = 0, variable; variable = variableList[i]; i++) {
|
|
71
|
-
var element = goog.dom.createDom('variable', null, variable.name);
|
|
72
|
-
element.setAttribute('type', variable.type);
|
|
73
|
-
element.setAttribute('id', variable.getId());
|
|
74
|
-
element.setAttribute('islocal', variable.isLocal);
|
|
75
|
-
element.setAttribute('isCloud', variable.isCloud);
|
|
76
|
-
variables.appendChild(element);
|
|
77
|
-
}
|
|
78
|
-
return variables;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Encode a block subtree as XML with XY coordinates.
|
|
83
|
-
* @param {!Blockly.Block} block The root block to encode.
|
|
84
|
-
* @param {boolean=} opt_noId True if the encoder should skip the block ID.
|
|
85
|
-
* @return {!Element} Tree of XML elements.
|
|
86
|
-
*/
|
|
87
|
-
Blockly.Xml.blockToDomWithXY = function(block, opt_noId) {
|
|
88
|
-
var width; // Not used in LTR.
|
|
89
|
-
if (block.workspace.RTL) {
|
|
90
|
-
width = block.workspace.getWidth();
|
|
91
|
-
}
|
|
92
|
-
var element = Blockly.Xml.blockToDom(block, opt_noId);
|
|
93
|
-
var xy = block.getRelativeToSurfaceXY();
|
|
94
|
-
element.setAttribute('x',
|
|
95
|
-
Math.round(block.workspace.RTL ? width - xy.x : xy.x));
|
|
96
|
-
element.setAttribute('y', Math.round(xy.y));
|
|
97
|
-
return element;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Encode a variable field as XML.
|
|
102
|
-
* @param {!Blockly.FieldVariable} field The field to encode.
|
|
103
|
-
* @return {?Element} XML element, or null if the field did not need to be
|
|
104
|
-
* serialized.
|
|
105
|
-
* @private
|
|
106
|
-
*/
|
|
107
|
-
Blockly.Xml.fieldToDomVariable_ = function(field) {
|
|
108
|
-
var id = field.getValue();
|
|
109
|
-
// The field had not been initialized fully before being serialized.
|
|
110
|
-
// This can happen if a block is created directly through a call to
|
|
111
|
-
// workspace.newBlock instead of from XML.
|
|
112
|
-
// The new block will be serialized for the first time when firing a block
|
|
113
|
-
// creation event.
|
|
114
|
-
if (id == null) {
|
|
115
|
-
field.initModel();
|
|
116
|
-
id = field.getValue();
|
|
117
|
-
}
|
|
118
|
-
// Get the variable directly from the field, instead of doing a lookup. This
|
|
119
|
-
// will work even if the variable has already been deleted. This can happen
|
|
120
|
-
// because the flyout defers deleting blocks until the next time the flyout is
|
|
121
|
-
// opened.
|
|
122
|
-
var variable = field.getVariable();
|
|
123
|
-
|
|
124
|
-
if (!variable) {
|
|
125
|
-
throw Error('Tried to serialize a variable field with no variable.');
|
|
126
|
-
}
|
|
127
|
-
var container = goog.dom.createDom('field', null, variable.name);
|
|
128
|
-
container.setAttribute('name', field.name);
|
|
129
|
-
container.setAttribute('id', variable.getId());
|
|
130
|
-
container.setAttribute('variabletype', variable.type);
|
|
131
|
-
return container;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Encode a field as XML.
|
|
136
|
-
* @param {!Blockly.Field} field The field to encode.
|
|
137
|
-
* @param {!Blockly.Workspace} workspace The workspace that the field is in.
|
|
138
|
-
* @return {?Element} XML element, or null if the field did not need to be
|
|
139
|
-
* serialized.
|
|
140
|
-
* @private
|
|
141
|
-
*/
|
|
142
|
-
Blockly.Xml.fieldToDom_ = function(field) {
|
|
143
|
-
if (field.name && field.SERIALIZABLE) {
|
|
144
|
-
if (field.referencesVariables()) {
|
|
145
|
-
return Blockly.Xml.fieldToDomVariable_(field);
|
|
146
|
-
} else {
|
|
147
|
-
var container = goog.dom.createDom('field', null, field.getValue());
|
|
148
|
-
container.setAttribute('name', field.name);
|
|
149
|
-
return container;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return null;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Encode all of a block's fields as XML and attach them to the given tree of
|
|
157
|
-
* XML elements.
|
|
158
|
-
* @param {!Blockly.Block} block A block with fields to be encoded.
|
|
159
|
-
* @param {!Element} element The XML element to which the field DOM should be
|
|
160
|
-
* attached.
|
|
161
|
-
* @private
|
|
162
|
-
*/
|
|
163
|
-
Blockly.Xml.allFieldsToDom_ = function(block, element) {
|
|
164
|
-
for (var i = 0, input; input = block.inputList[i]; i++) {
|
|
165
|
-
for (var j = 0, field; field = input.fieldRow[j]; j++) {
|
|
166
|
-
var fieldDom = Blockly.Xml.fieldToDom_(field);
|
|
167
|
-
if (fieldDom) {
|
|
168
|
-
element.appendChild(fieldDom);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Encode a block subtree as XML.
|
|
176
|
-
* @param {!Blockly.Block} block The root block to encode.
|
|
177
|
-
* @param {boolean=} opt_noId True if the encoder should skip the block ID.
|
|
178
|
-
* @return {!Element} Tree of XML elements.
|
|
179
|
-
*/
|
|
180
|
-
Blockly.Xml.blockToDom = function(block, opt_noId) {
|
|
181
|
-
var element = goog.dom.createDom(block.isShadow() ? 'shadow' : 'block');
|
|
182
|
-
element.setAttribute('type', block.type);
|
|
183
|
-
if (!opt_noId) {
|
|
184
|
-
element.setAttribute('id', block.id);
|
|
185
|
-
}
|
|
186
|
-
if (block.mutationToDom) {
|
|
187
|
-
// Custom data for an advanced block.
|
|
188
|
-
var mutation = block.mutationToDom();
|
|
189
|
-
if (mutation && (mutation.hasChildNodes() || mutation.hasAttributes())) {
|
|
190
|
-
element.appendChild(mutation);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
Blockly.Xml.allFieldsToDom_(block, element);
|
|
195
|
-
|
|
196
|
-
Blockly.Xml.scratchCommentToDom_(block, element);
|
|
197
|
-
|
|
198
|
-
if (block.data) {
|
|
199
|
-
var dataElement = goog.dom.createDom('data', null, block.data);
|
|
200
|
-
element.appendChild(dataElement);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
for (var i = 0, input; input = block.inputList[i]; i++) {
|
|
204
|
-
var container;
|
|
205
|
-
var empty = true;
|
|
206
|
-
if (input.type == Blockly.DUMMY_INPUT) {
|
|
207
|
-
continue;
|
|
208
|
-
} else {
|
|
209
|
-
var childBlock = input.connection.targetBlock();
|
|
210
|
-
if (input.type == Blockly.INPUT_VALUE) {
|
|
211
|
-
container = goog.dom.createDom('value');
|
|
212
|
-
} else if (input.type == Blockly.NEXT_STATEMENT) {
|
|
213
|
-
container = goog.dom.createDom('statement');
|
|
214
|
-
}
|
|
215
|
-
var shadow = input.connection.getShadowDom();
|
|
216
|
-
if (shadow && (!childBlock || !childBlock.isShadow())) {
|
|
217
|
-
var shadowClone = Blockly.Xml.cloneShadow_(shadow);
|
|
218
|
-
// Remove the ID from the shadow dom clone if opt_noId
|
|
219
|
-
// is specified to true.
|
|
220
|
-
if (opt_noId && shadowClone.getAttribute('id')) {
|
|
221
|
-
shadowClone.removeAttribute('id');
|
|
222
|
-
}
|
|
223
|
-
container.appendChild(shadowClone);
|
|
224
|
-
}
|
|
225
|
-
if (childBlock) {
|
|
226
|
-
container.appendChild(Blockly.Xml.blockToDom(childBlock, opt_noId));
|
|
227
|
-
empty = false;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
container.setAttribute('name', input.name);
|
|
231
|
-
if (!empty) {
|
|
232
|
-
element.appendChild(container);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
if (block.inputsInlineDefault != block.inputsInline) {
|
|
236
|
-
element.setAttribute('inline', block.inputsInline);
|
|
237
|
-
}
|
|
238
|
-
if (block.isCollapsed()) {
|
|
239
|
-
element.setAttribute('collapsed', true);
|
|
240
|
-
}
|
|
241
|
-
if (block.disabled) {
|
|
242
|
-
element.setAttribute('disabled', true);
|
|
243
|
-
}
|
|
244
|
-
if (!block.isDeletable() && !block.isShadow()) {
|
|
245
|
-
element.setAttribute('deletable', false);
|
|
246
|
-
}
|
|
247
|
-
if (!block.isMovable() && !block.isShadow()) {
|
|
248
|
-
element.setAttribute('movable', false);
|
|
249
|
-
}
|
|
250
|
-
if (!block.isEditable()) {
|
|
251
|
-
element.setAttribute('editable', false);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
var nextBlock = block.getNextBlock();
|
|
255
|
-
if (nextBlock) {
|
|
256
|
-
var container = goog.dom.createDom('next', null,
|
|
257
|
-
Blockly.Xml.blockToDom(nextBlock, opt_noId));
|
|
258
|
-
element.appendChild(container);
|
|
259
|
-
}
|
|
260
|
-
var shadow = block.nextConnection && block.nextConnection.getShadowDom();
|
|
261
|
-
if (shadow && (!nextBlock || !nextBlock.isShadow())) {
|
|
262
|
-
container.appendChild(Blockly.Xml.cloneShadow_(shadow));
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return element;
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Encode a ScratchBlockComment as XML.
|
|
270
|
-
* @param {!Blockly.ScratchBlockComment} block The block possibly containing
|
|
271
|
-
* a comment to encode.
|
|
272
|
-
* @param {!Element} element The XML element to which the comment should
|
|
273
|
-
* encoding should be attached.
|
|
274
|
-
* @private
|
|
275
|
-
*/
|
|
276
|
-
Blockly.Xml.scratchCommentToDom_ = function(block, element) {
|
|
277
|
-
var commentText = block.getCommentText();
|
|
278
|
-
if (commentText) {
|
|
279
|
-
var commentElement = goog.dom.createDom('comment', null, commentText);
|
|
280
|
-
if (typeof block.comment == 'object') {
|
|
281
|
-
commentElement.setAttribute('id', block.comment.id);
|
|
282
|
-
commentElement.setAttribute('pinned', block.comment.isVisible());
|
|
283
|
-
var hw;
|
|
284
|
-
if (block.comment instanceof Blockly.ScratchBlockComment) {
|
|
285
|
-
hw = block.comment.getHeightWidth();
|
|
286
|
-
} else {
|
|
287
|
-
hw = block.comment.getBubbleSize();
|
|
288
|
-
}
|
|
289
|
-
commentElement.setAttribute('h', hw.height);
|
|
290
|
-
commentElement.setAttribute('w', hw.width);
|
|
291
|
-
var xy = block.comment.getXY();
|
|
292
|
-
commentElement.setAttribute('x',
|
|
293
|
-
Math.round(block.workspace.RTL ? block.workspace.getWidth() - xy.x - hw.width :
|
|
294
|
-
xy.x));
|
|
295
|
-
commentElement.setAttribute('y', xy.y);
|
|
296
|
-
commentElement.setAttribute('minimized', block.comment.isMinimized());
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
element.appendChild(commentElement);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Deeply clone the shadow's DOM so that changes don't back-wash to the block.
|
|
305
|
-
* @param {!Element} shadow A tree of XML elements.
|
|
306
|
-
* @return {!Element} A tree of XML elements.
|
|
307
|
-
* @private
|
|
308
|
-
*/
|
|
309
|
-
Blockly.Xml.cloneShadow_ = function(shadow) {
|
|
310
|
-
shadow = shadow.cloneNode(true);
|
|
311
|
-
// Walk the tree looking for whitespace. Don't prune whitespace in a tag.
|
|
312
|
-
var node = shadow;
|
|
313
|
-
var textNode;
|
|
314
|
-
while (node) {
|
|
315
|
-
if (node.firstChild) {
|
|
316
|
-
node = node.firstChild;
|
|
317
|
-
} else {
|
|
318
|
-
while (node && !node.nextSibling) {
|
|
319
|
-
textNode = node;
|
|
320
|
-
node = node.parentNode;
|
|
321
|
-
if (textNode.nodeType == 3 && textNode.data.trim() == '' &&
|
|
322
|
-
node.firstChild != textNode) {
|
|
323
|
-
// Prune whitespace after a tag.
|
|
324
|
-
goog.dom.removeNode(textNode);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
if (node) {
|
|
328
|
-
textNode = node;
|
|
329
|
-
node = node.nextSibling;
|
|
330
|
-
if (textNode.nodeType == 3 && textNode.data.trim() == '') {
|
|
331
|
-
// Prune whitespace before a tag.
|
|
332
|
-
goog.dom.removeNode(textNode);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
return shadow;
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Converts a DOM structure into plain text.
|
|
342
|
-
* Currently the text format is fairly ugly: all one line with no whitespace.
|
|
343
|
-
* @param {!Element} dom A tree of XML elements.
|
|
344
|
-
* @return {string} Text representation.
|
|
345
|
-
*/
|
|
346
|
-
Blockly.Xml.domToText = function(dom) {
|
|
347
|
-
var oSerializer = new XMLSerializer();
|
|
348
|
-
return oSerializer.serializeToString(dom);
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Converts a DOM structure into properly indented text.
|
|
353
|
-
* @param {!Element} dom A tree of XML elements.
|
|
354
|
-
* @return {string} Text representation.
|
|
355
|
-
*/
|
|
356
|
-
Blockly.Xml.domToPrettyText = function(dom) {
|
|
357
|
-
// This function is not guaranteed to be correct for all XML.
|
|
358
|
-
// But it handles the XML that Blockly generates.
|
|
359
|
-
var blob = Blockly.Xml.domToText(dom);
|
|
360
|
-
// Place every open and close tag on its own line.
|
|
361
|
-
var lines = blob.split('<');
|
|
362
|
-
// Indent every line.
|
|
363
|
-
var indent = '';
|
|
364
|
-
for (var i = 1; i < lines.length; i++) {
|
|
365
|
-
var line = lines[i];
|
|
366
|
-
if (line[0] == '/') {
|
|
367
|
-
indent = indent.substring(2);
|
|
368
|
-
}
|
|
369
|
-
lines[i] = indent + '<' + line;
|
|
370
|
-
if (line[0] != '/' && line.slice(-2) != '/>') {
|
|
371
|
-
indent += ' ';
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
// Pull simple tags back together.
|
|
375
|
-
// E.g. <foo></foo>
|
|
376
|
-
var text = lines.join('\n');
|
|
377
|
-
text = text.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g, '$1</$2>');
|
|
378
|
-
// Trim leading blank line.
|
|
379
|
-
return text.replace(/^\n/, '');
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Converts plain text into a DOM structure.
|
|
384
|
-
* Throws an error if XML doesn't parse.
|
|
385
|
-
* @param {string} text Text representation.
|
|
386
|
-
* @return {!Element} A tree of XML elements.
|
|
387
|
-
*/
|
|
388
|
-
Blockly.Xml.textToDom = function(text) {
|
|
389
|
-
var oParser = new DOMParser();
|
|
390
|
-
var dom = oParser.parseFromString(text, 'text/xml');
|
|
391
|
-
// The DOM should have one and only one top-level node, an XML tag.
|
|
392
|
-
if (!dom || !dom.firstChild ||
|
|
393
|
-
dom.firstChild.nodeName.toLowerCase() != 'xml' ||
|
|
394
|
-
dom.firstChild !== dom.lastChild) {
|
|
395
|
-
// Whatever we got back from the parser is not XML.
|
|
396
|
-
goog.asserts.fail('Blockly.Xml.textToDom did not obtain a valid XML tree.');
|
|
397
|
-
}
|
|
398
|
-
return dom.firstChild;
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Clear the given workspace then decode an XML DOM and
|
|
403
|
-
* create blocks on the workspace.
|
|
404
|
-
* @param {!Element} xml XML DOM.
|
|
405
|
-
* @param {!Blockly.Workspace} workspace The workspace.
|
|
406
|
-
* @return {Array.<string>} An array containing new block ids.
|
|
407
|
-
*/
|
|
408
|
-
Blockly.Xml.clearWorkspaceAndLoadFromXml = function(xml, workspace) {
|
|
409
|
-
workspace.setResizesEnabled(false);
|
|
410
|
-
workspace.setToolboxRefreshEnabled(false);
|
|
411
|
-
workspace.clear();
|
|
412
|
-
var blockIds = Blockly.Xml.domToWorkspace(xml, workspace);
|
|
413
|
-
workspace.setResizesEnabled(true);
|
|
414
|
-
workspace.setToolboxRefreshEnabled(true);
|
|
415
|
-
return blockIds;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Decode an XML DOM and create blocks on the workspace.
|
|
420
|
-
* @param {!Element} xml XML DOM.
|
|
421
|
-
* @param {!Blockly.Workspace} workspace The workspace.
|
|
422
|
-
* @return {Array.<string>} An array containing new block IDs.
|
|
423
|
-
*/
|
|
424
|
-
Blockly.Xml.domToWorkspace = function(xml, workspace) {
|
|
425
|
-
if (xml instanceof Blockly.Workspace) {
|
|
426
|
-
var swap = xml;
|
|
427
|
-
xml = workspace;
|
|
428
|
-
workspace = swap;
|
|
429
|
-
console.warn('Deprecated call to Blockly.Xml.domToWorkspace, ' +
|
|
430
|
-
'swap the arguments.');
|
|
431
|
-
}
|
|
432
|
-
var width; // Not used in LTR.
|
|
433
|
-
if (workspace.RTL) {
|
|
434
|
-
width = workspace.getWidth();
|
|
435
|
-
}
|
|
436
|
-
var newBlockIds = []; // A list of block IDs added by this call.
|
|
437
|
-
Blockly.Field.startCache();
|
|
438
|
-
// Safari 7.1.3 is known to provide node lists with extra references to
|
|
439
|
-
// children beyond the lists' length. Trust the length, do not use the
|
|
440
|
-
// looping pattern of checking the index for an object.
|
|
441
|
-
var childCount = xml.childNodes.length;
|
|
442
|
-
var existingGroup = Blockly.Events.getGroup();
|
|
443
|
-
if (!existingGroup) {
|
|
444
|
-
Blockly.Events.setGroup(true);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
// Disable workspace resizes as an optimization.
|
|
448
|
-
if (workspace.setResizesEnabled) {
|
|
449
|
-
workspace.setResizesEnabled(false);
|
|
450
|
-
}
|
|
451
|
-
var variablesFirst = true;
|
|
452
|
-
try {
|
|
453
|
-
for (var i = 0; i < childCount; i++) {
|
|
454
|
-
var xmlChild = xml.childNodes[i];
|
|
455
|
-
var name = xmlChild.nodeName.toLowerCase();
|
|
456
|
-
if (name == 'block' ||
|
|
457
|
-
(name == 'shadow' && !Blockly.Events.recordUndo)) {
|
|
458
|
-
// Allow top-level shadow blocks if recordUndo is disabled since
|
|
459
|
-
// that means an undo is in progress. Such a block is expected
|
|
460
|
-
// to be moved to a nested destination in the next operation.
|
|
461
|
-
var block = Blockly.Xml.domToBlock(xmlChild, workspace);
|
|
462
|
-
newBlockIds.push(block.id);
|
|
463
|
-
var blockX = xmlChild.hasAttribute('x') ?
|
|
464
|
-
parseInt(xmlChild.getAttribute('x'), 10) : 10;
|
|
465
|
-
var blockY = xmlChild.hasAttribute('y') ?
|
|
466
|
-
parseInt(xmlChild.getAttribute('y'), 10) : 10;
|
|
467
|
-
if (!isNaN(blockX) && !isNaN(blockY)) {
|
|
468
|
-
block.moveBy(workspace.RTL ? width - blockX : blockX, blockY);
|
|
469
|
-
if (block.comment && typeof block.comment === 'object') {
|
|
470
|
-
var commentXY = block.comment.getXY();
|
|
471
|
-
var commentWidth = block.comment.getBubbleSize().width;
|
|
472
|
-
block.comment.moveTo(block.workspace.RTL ? width - commentXY.x - commentWidth : commentXY.x, commentXY.y);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
variablesFirst = false;
|
|
476
|
-
} else if (name == 'shadow') {
|
|
477
|
-
goog.asserts.fail('Shadow block cannot be a top-level block.');
|
|
478
|
-
variablesFirst = false;
|
|
479
|
-
} else if (name == 'comment') {
|
|
480
|
-
if (workspace.rendered) {
|
|
481
|
-
Blockly.WorkspaceCommentSvg.fromXml(xmlChild, workspace, width);
|
|
482
|
-
} else {
|
|
483
|
-
Blockly.WorkspaceComment.fromXml(xmlChild, workspace);
|
|
484
|
-
}
|
|
485
|
-
} else if (name == 'variables') {
|
|
486
|
-
if (variablesFirst) {
|
|
487
|
-
Blockly.Xml.domToVariables(xmlChild, workspace);
|
|
488
|
-
} else {
|
|
489
|
-
throw Error('\'variables\' tag must exist once before block and ' +
|
|
490
|
-
'shadow tag elements in the workspace XML, but it was found in ' +
|
|
491
|
-
'another location.');
|
|
492
|
-
}
|
|
493
|
-
variablesFirst = false;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
} finally {
|
|
497
|
-
if (!existingGroup) {
|
|
498
|
-
Blockly.Events.setGroup(false);
|
|
499
|
-
}
|
|
500
|
-
Blockly.Field.stopCache();
|
|
501
|
-
}
|
|
502
|
-
// Re-enable workspace resizing.
|
|
503
|
-
if (workspace.setResizesEnabled) {
|
|
504
|
-
workspace.setResizesEnabled(true);
|
|
505
|
-
}
|
|
506
|
-
return newBlockIds;
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Decode an XML DOM and create blocks on the workspace. Position the new
|
|
511
|
-
* blocks immediately below prior blocks, aligned by their starting edge.
|
|
512
|
-
* @param {!Element} xml The XML DOM.
|
|
513
|
-
* @param {!Blockly.Workspace} workspace The workspace to add to.
|
|
514
|
-
* @return {Array.<string>} An array containing new block IDs.
|
|
515
|
-
*/
|
|
516
|
-
Blockly.Xml.appendDomToWorkspace = function(xml, workspace) {
|
|
517
|
-
var bbox; // Bounding box of the current blocks.
|
|
518
|
-
// First check if we have a workspaceSvg, otherwise the blocks have no shape
|
|
519
|
-
// and the position does not matter.
|
|
520
|
-
if (workspace.hasOwnProperty('scale')) {
|
|
521
|
-
var savetab = Blockly.BlockSvg.TAB_WIDTH;
|
|
522
|
-
try {
|
|
523
|
-
Blockly.BlockSvg.TAB_WIDTH = 0;
|
|
524
|
-
bbox = workspace.getBlocksBoundingBox();
|
|
525
|
-
} finally {
|
|
526
|
-
Blockly.BlockSvg.TAB_WIDTH = savetab;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
// Load the new blocks into the workspace and get the IDs of the new blocks.
|
|
530
|
-
var newBlockIds = Blockly.Xml.domToWorkspace(xml,workspace);
|
|
531
|
-
if (bbox && bbox.height) { // check if any previous block
|
|
532
|
-
var offsetY = 0; // offset to add to y of the new block
|
|
533
|
-
var offsetX = 0;
|
|
534
|
-
var farY = bbox.y + bbox.height; //bottom position
|
|
535
|
-
var topX = bbox.x; // x of bounding box
|
|
536
|
-
// check position of the new blocks
|
|
537
|
-
var newX = Infinity; // x of top corner
|
|
538
|
-
var newY = Infinity; // y of top corner
|
|
539
|
-
for (var i = 0; i < newBlockIds.length; i++) {
|
|
540
|
-
var blockXY = workspace.getBlockById(newBlockIds[i]).getRelativeToSurfaceXY();
|
|
541
|
-
if (blockXY.y < newY) {
|
|
542
|
-
newY = blockXY.y;
|
|
543
|
-
}
|
|
544
|
-
if (blockXY.x < newX) { //if we align also on x
|
|
545
|
-
newX = blockXY.x;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
offsetY = farY - newY + Blockly.BlockSvg.SEP_SPACE_Y;
|
|
549
|
-
offsetX = topX - newX;
|
|
550
|
-
// move the new blocks to append them at the bottom
|
|
551
|
-
var width; // Not used in LTR.
|
|
552
|
-
if (workspace.RTL) {
|
|
553
|
-
width = workspace.getWidth();
|
|
554
|
-
}
|
|
555
|
-
for (var i = 0; i < newBlockIds.length; i++) {
|
|
556
|
-
var block = workspace.getBlockById(newBlockIds[i]);
|
|
557
|
-
block.moveBy(workspace.RTL ? width - offsetX : offsetX, offsetY);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
return newBlockIds;
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Decode an XML block tag and create a block (and possibly sub blocks) on the
|
|
565
|
-
* workspace.
|
|
566
|
-
* @param {!Element} xmlBlock XML block element.
|
|
567
|
-
* @param {!Blockly.Workspace} workspace The workspace.
|
|
568
|
-
* @return {!Blockly.Block} The root block created.
|
|
569
|
-
*/
|
|
570
|
-
Blockly.Xml.domToBlock = function(xmlBlock, workspace) {
|
|
571
|
-
if (xmlBlock instanceof Blockly.Workspace) {
|
|
572
|
-
var swap = xmlBlock;
|
|
573
|
-
xmlBlock = workspace;
|
|
574
|
-
workspace = swap;
|
|
575
|
-
console.warn('Deprecated call to Blockly.Xml.domToBlock, ' +
|
|
576
|
-
'swap the arguments.');
|
|
577
|
-
}
|
|
578
|
-
// Create top-level block.
|
|
579
|
-
Blockly.Events.disable();
|
|
580
|
-
var variablesBeforeCreation = workspace.getAllVariables();
|
|
581
|
-
try {
|
|
582
|
-
var topBlock = Blockly.Xml.domToBlockHeadless_(xmlBlock, workspace);
|
|
583
|
-
// Generate list of all blocks.
|
|
584
|
-
var blocks = topBlock.getDescendants(false);
|
|
585
|
-
if (workspace.rendered) {
|
|
586
|
-
// Hide connections to speed up assembly.
|
|
587
|
-
topBlock.setConnectionsHidden(true);
|
|
588
|
-
// Render each block.
|
|
589
|
-
for (var i = blocks.length - 1; i >= 0; i--) {
|
|
590
|
-
blocks[i].initSvg();
|
|
591
|
-
}
|
|
592
|
-
for (var i = blocks.length - 1; i >= 0; i--) {
|
|
593
|
-
blocks[i].render(false);
|
|
594
|
-
}
|
|
595
|
-
// Populating the connection database may be deferred until after the
|
|
596
|
-
// blocks have rendered.
|
|
597
|
-
if (!workspace.isFlyout) {
|
|
598
|
-
setTimeout(function() {
|
|
599
|
-
if (topBlock.workspace) { // Check that the block hasn't been deleted.
|
|
600
|
-
topBlock.setConnectionsHidden(false);
|
|
601
|
-
}
|
|
602
|
-
}, 1);
|
|
603
|
-
}
|
|
604
|
-
topBlock.updateDisabled();
|
|
605
|
-
// Allow the scrollbars to resize and move based on the new contents.
|
|
606
|
-
// TODO(@picklesrus): #387. Remove when domToBlock avoids resizing.
|
|
607
|
-
workspace.resizeContents();
|
|
608
|
-
} else {
|
|
609
|
-
for (var i = blocks.length - 1; i >= 0; i--) {
|
|
610
|
-
blocks[i].initModel();
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
} finally {
|
|
614
|
-
Blockly.Events.enable();
|
|
615
|
-
}
|
|
616
|
-
if (Blockly.Events.isEnabled()) {
|
|
617
|
-
var newVariables = Blockly.Variables.getAddedVariables(workspace,
|
|
618
|
-
variablesBeforeCreation);
|
|
619
|
-
// Fire a VarCreate event for each (if any) new variable created.
|
|
620
|
-
for (var i = 0; i < newVariables.length; i++) {
|
|
621
|
-
var thisVariable = newVariables[i];
|
|
622
|
-
Blockly.Events.fire(new Blockly.Events.VarCreate(thisVariable));
|
|
623
|
-
}
|
|
624
|
-
// Block events come after var events, in case they refer to newly created
|
|
625
|
-
// variables.
|
|
626
|
-
Blockly.Events.fire(new Blockly.Events.BlockCreate(topBlock));
|
|
627
|
-
}
|
|
628
|
-
return topBlock;
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* Decode an XML list of variables and add the variables to the workspace.
|
|
633
|
-
* @param {!Element} xmlVariables List of XML variable elements.
|
|
634
|
-
* @param {!Blockly.Workspace} workspace The workspace to which the variable
|
|
635
|
-
* should be added.
|
|
636
|
-
*/
|
|
637
|
-
Blockly.Xml.domToVariables = function(xmlVariables, workspace) {
|
|
638
|
-
for (var i = 0, xmlChild; xmlChild = xmlVariables.children[i]; i++) {
|
|
639
|
-
var type = xmlChild.getAttribute('type');
|
|
640
|
-
var id = xmlChild.getAttribute('id');
|
|
641
|
-
var isLocal = xmlChild.getAttribute('islocal') == 'true';
|
|
642
|
-
var isCloud = xmlChild.getAttribute('iscloud') == 'true';
|
|
643
|
-
var name = xmlChild.textContent;
|
|
644
|
-
|
|
645
|
-
if (typeof(type) === undefined || type === null) {
|
|
646
|
-
throw Error('Variable with id, ' + id + ' is without a type');
|
|
647
|
-
}
|
|
648
|
-
workspace.createVariable(name, type, id, isLocal, isCloud);
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* Decode an XML block tag and create a block (and possibly sub blocks) on the
|
|
654
|
-
* workspace.
|
|
655
|
-
* @param {!Element} xmlBlock XML block element.
|
|
656
|
-
* @param {!Blockly.Workspace} workspace The workspace.
|
|
657
|
-
* @return {!Blockly.Block} The root block created.
|
|
658
|
-
* @private
|
|
659
|
-
*/
|
|
660
|
-
Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
|
|
661
|
-
var block = null;
|
|
662
|
-
var prototypeName = xmlBlock.getAttribute('type');
|
|
663
|
-
goog.asserts.assert(
|
|
664
|
-
prototypeName, 'Block type unspecified: %s', xmlBlock.outerHTML);
|
|
665
|
-
var id = xmlBlock.getAttribute('id');
|
|
666
|
-
block = workspace.newBlock(prototypeName, id);
|
|
667
|
-
|
|
668
|
-
var blockChild = null;
|
|
669
|
-
for (var i = 0, xmlChild; xmlChild = xmlBlock.childNodes[i]; i++) {
|
|
670
|
-
if (xmlChild.nodeType == 3) {
|
|
671
|
-
// Ignore any text at the <block> level. It's all whitespace anyway.
|
|
672
|
-
continue;
|
|
673
|
-
}
|
|
674
|
-
var input;
|
|
675
|
-
|
|
676
|
-
// Find any enclosed blocks or shadows in this tag.
|
|
677
|
-
var childBlockElement = null;
|
|
678
|
-
var childShadowElement = null;
|
|
679
|
-
for (var j = 0, grandchild; grandchild = xmlChild.childNodes[j]; j++) {
|
|
680
|
-
if (grandchild.nodeType == 1) {
|
|
681
|
-
if (grandchild.nodeName.toLowerCase() == 'block') {
|
|
682
|
-
childBlockElement = /** @type {!Element} */ (grandchild);
|
|
683
|
-
} else if (grandchild.nodeName.toLowerCase() == 'shadow') {
|
|
684
|
-
childShadowElement = /** @type {!Element} */ (grandchild);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
// Use the shadow block if there is no child block.
|
|
689
|
-
if (!childBlockElement && childShadowElement) {
|
|
690
|
-
childBlockElement = childShadowElement;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
var name = xmlChild.getAttribute('name');
|
|
694
|
-
switch (xmlChild.nodeName.toLowerCase()) {
|
|
695
|
-
case 'mutation':
|
|
696
|
-
// Custom data for an advanced block.
|
|
697
|
-
if (block.domToMutation) {
|
|
698
|
-
block.domToMutation(xmlChild);
|
|
699
|
-
if (block.initSvg) {
|
|
700
|
-
// Mutation may have added some elements that need initializing.
|
|
701
|
-
block.initSvg();
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
break;
|
|
705
|
-
case 'comment':
|
|
706
|
-
var commentId = xmlChild.getAttribute('id');
|
|
707
|
-
var bubbleX = parseInt(xmlChild.getAttribute('x'), 10);
|
|
708
|
-
var bubbleY = parseInt(xmlChild.getAttribute('y'), 10);
|
|
709
|
-
var minimized = xmlChild.getAttribute('minimized') || false;
|
|
710
|
-
|
|
711
|
-
// Note bubbleX and bubbleY can be NaN, but the ScratchBlockComment
|
|
712
|
-
// constructor will handle that.
|
|
713
|
-
block.setCommentText(xmlChild.textContent, commentId, bubbleX, bubbleY,
|
|
714
|
-
minimized == 'true');
|
|
715
|
-
|
|
716
|
-
var visible = xmlChild.getAttribute('pinned');
|
|
717
|
-
if (visible && !block.isInFlyout) {
|
|
718
|
-
// Give the renderer a millisecond to render and position the block
|
|
719
|
-
// before positioning the comment bubble.
|
|
720
|
-
setTimeout(function() {
|
|
721
|
-
if (block.comment && block.comment.setVisible) {
|
|
722
|
-
block.comment.setVisible(visible == 'true');
|
|
723
|
-
}
|
|
724
|
-
}, 1);
|
|
725
|
-
}
|
|
726
|
-
var bubbleW = parseInt(xmlChild.getAttribute('w'), 10);
|
|
727
|
-
var bubbleH = parseInt(xmlChild.getAttribute('h'), 10);
|
|
728
|
-
if (!isNaN(bubbleW) && !isNaN(bubbleH) &&
|
|
729
|
-
block.comment && block.comment.setVisible) {
|
|
730
|
-
if (block.comment instanceof Blockly.ScratchBlockComment) {
|
|
731
|
-
block.comment.setSize(bubbleW, bubbleH);
|
|
732
|
-
} else {
|
|
733
|
-
block.comment.setBubbleSize(bubbleW, bubbleH);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
break;
|
|
737
|
-
case 'data':
|
|
738
|
-
block.data = xmlChild.textContent;
|
|
739
|
-
break;
|
|
740
|
-
case 'title':
|
|
741
|
-
// Titles were renamed to field in December 2013.
|
|
742
|
-
// Fall through.
|
|
743
|
-
case 'field':
|
|
744
|
-
Blockly.Xml.domToField_(block, name, xmlChild);
|
|
745
|
-
break;
|
|
746
|
-
case 'value':
|
|
747
|
-
case 'statement':
|
|
748
|
-
input = block.getInput(name);
|
|
749
|
-
if (!input) {
|
|
750
|
-
console.warn('Ignoring non-existent input ' + name + ' in block ' +
|
|
751
|
-
prototypeName);
|
|
752
|
-
break;
|
|
753
|
-
}
|
|
754
|
-
if (childShadowElement) {
|
|
755
|
-
input.connection.setShadowDom(childShadowElement);
|
|
756
|
-
}
|
|
757
|
-
if (childBlockElement) {
|
|
758
|
-
blockChild = Blockly.Xml.domToBlockHeadless_(childBlockElement,
|
|
759
|
-
workspace);
|
|
760
|
-
if (blockChild.outputConnection) {
|
|
761
|
-
input.connection.connect(blockChild.outputConnection);
|
|
762
|
-
} else if (blockChild.previousConnection) {
|
|
763
|
-
input.connection.connect(blockChild.previousConnection);
|
|
764
|
-
} else {
|
|
765
|
-
goog.asserts.fail(
|
|
766
|
-
'Child block does not have output or previous statement.');
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
break;
|
|
770
|
-
case 'next':
|
|
771
|
-
if (childShadowElement && block.nextConnection) {
|
|
772
|
-
block.nextConnection.setShadowDom(childShadowElement);
|
|
773
|
-
}
|
|
774
|
-
if (childBlockElement) {
|
|
775
|
-
goog.asserts.assert(block.nextConnection,
|
|
776
|
-
'Next statement does not exist.');
|
|
777
|
-
// If there is more than one XML 'next' tag.
|
|
778
|
-
goog.asserts.assert(!block.nextConnection.isConnected(),
|
|
779
|
-
'Next statement is already connected.');
|
|
780
|
-
blockChild = Blockly.Xml.domToBlockHeadless_(childBlockElement,
|
|
781
|
-
workspace);
|
|
782
|
-
goog.asserts.assert(blockChild.previousConnection,
|
|
783
|
-
'Next block does not have previous statement.');
|
|
784
|
-
block.nextConnection.connect(blockChild.previousConnection);
|
|
785
|
-
}
|
|
786
|
-
break;
|
|
787
|
-
default:
|
|
788
|
-
// Unknown tag; ignore. Same principle as HTML parsers.
|
|
789
|
-
console.warn('Ignoring unknown tag: ' + xmlChild.nodeName);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
var inline = xmlBlock.getAttribute('inline');
|
|
794
|
-
if (inline) {
|
|
795
|
-
block.setInputsInline(inline == 'true');
|
|
796
|
-
}
|
|
797
|
-
var disabled = xmlBlock.getAttribute('disabled');
|
|
798
|
-
if (disabled) {
|
|
799
|
-
block.setDisabled(disabled == 'true' || disabled == 'disabled');
|
|
800
|
-
}
|
|
801
|
-
var deletable = xmlBlock.getAttribute('deletable');
|
|
802
|
-
if (deletable) {
|
|
803
|
-
block.setDeletable(deletable == 'true');
|
|
804
|
-
}
|
|
805
|
-
var movable = xmlBlock.getAttribute('movable');
|
|
806
|
-
if (movable) {
|
|
807
|
-
block.setMovable(movable == 'true');
|
|
808
|
-
}
|
|
809
|
-
var editable = xmlBlock.getAttribute('editable');
|
|
810
|
-
if (editable) {
|
|
811
|
-
block.setEditable(editable == 'true');
|
|
812
|
-
}
|
|
813
|
-
var collapsed = xmlBlock.getAttribute('collapsed');
|
|
814
|
-
if (collapsed) {
|
|
815
|
-
block.setCollapsed(collapsed == 'true');
|
|
816
|
-
}
|
|
817
|
-
if (xmlBlock.nodeName.toLowerCase() == 'shadow') {
|
|
818
|
-
// Ensure all children are also shadows.
|
|
819
|
-
var children = block.getChildren(false);
|
|
820
|
-
for (var i = 0, child; child = children[i]; i++) {
|
|
821
|
-
goog.asserts.assert(
|
|
822
|
-
child.isShadow(), 'Shadow block not allowed non-shadow child.');
|
|
823
|
-
}
|
|
824
|
-
block.setShadow(true);
|
|
825
|
-
}
|
|
826
|
-
return block;
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* Decode an XML variable field tag and set the value of that field.
|
|
831
|
-
* @param {!Blockly.Workspace} workspace The workspace that is currently being
|
|
832
|
-
* deserialized.
|
|
833
|
-
* @param {!Element} xml The field tag to decode.
|
|
834
|
-
* @param {string} text The text content of the XML tag.
|
|
835
|
-
* @param {!Blockly.FieldVariable} field The field on which the value will be
|
|
836
|
-
* set.
|
|
837
|
-
* @private
|
|
838
|
-
*/
|
|
839
|
-
Blockly.Xml.domToFieldVariable_ = function(workspace, xml, text, field) {
|
|
840
|
-
var type = xml.getAttribute('variabletype') || '';
|
|
841
|
-
// TODO (fenichel): Does this need to be explicit or not?
|
|
842
|
-
if (type == '\'\'') {
|
|
843
|
-
type = '';
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
var variable;
|
|
847
|
-
// This check ensures that there is not both a potential variable and a real
|
|
848
|
-
// variable with the same name and type.
|
|
849
|
-
if (!workspace.getPotentialVariableMap() && !workspace.isFlyout &&
|
|
850
|
-
workspace.getFlyout()) {
|
|
851
|
-
var flyoutWs = workspace.getFlyout().getWorkspace();
|
|
852
|
-
variable = Blockly.Variables.realizePotentialVar(text, type, flyoutWs, true);
|
|
853
|
-
}
|
|
854
|
-
if (!variable) {
|
|
855
|
-
variable = Blockly.Variables.getOrCreateVariablePackage(workspace, xml.id,
|
|
856
|
-
text, type);
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
// This should never happen :)
|
|
860
|
-
if (type != null && type !== variable.type) {
|
|
861
|
-
throw Error('Serialized variable type with id \'' +
|
|
862
|
-
variable.getId() + '\' had type ' + variable.type + ', and ' +
|
|
863
|
-
'does not match variable field that references it: ' +
|
|
864
|
-
Blockly.Xml.domToText(xml) + '.');
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
field.setValue(variable.getId());
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Decode an XML field tag and set the value of that field on the given block.
|
|
872
|
-
* @param {!Blockly.Block} block The block that is currently being deserialized.
|
|
873
|
-
* @param {string} fieldName The name of the field on the block.
|
|
874
|
-
* @param {!Element} xml The field tag to decode.
|
|
875
|
-
* @private
|
|
876
|
-
*/
|
|
877
|
-
Blockly.Xml.domToField_ = function(block, fieldName, xml) {
|
|
878
|
-
var field = block.getField(fieldName);
|
|
879
|
-
if (!field) {
|
|
880
|
-
console.warn('Ignoring non-existent field ' + fieldName + ' in block ' +
|
|
881
|
-
block.type);
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
var workspace = block.workspace;
|
|
886
|
-
var text = xml.textContent;
|
|
887
|
-
if (field.referencesVariables()) {
|
|
888
|
-
Blockly.Xml.domToFieldVariable_(workspace, xml, text, field);
|
|
889
|
-
} else {
|
|
890
|
-
field.setValue(text);
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
/**
|
|
895
|
-
* Remove any 'next' block (statements in a stack).
|
|
896
|
-
* @param {!Element} xmlBlock XML block element.
|
|
897
|
-
*/
|
|
898
|
-
Blockly.Xml.deleteNext = function(xmlBlock) {
|
|
899
|
-
for (var i = 0, child; child = xmlBlock.childNodes[i]; i++) {
|
|
900
|
-
if (child.nodeName.toLowerCase() == 'next') {
|
|
901
|
-
xmlBlock.removeChild(child);
|
|
902
|
-
break;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
};
|
|
906
|
-
|
|
907
|
-
// Export symbols that would otherwise be renamed by Closure compiler.
|
|
908
|
-
if (!goog.global['Blockly']) {
|
|
909
|
-
goog.global['Blockly'] = {};
|
|
910
|
-
}
|
|
911
|
-
if (!goog.global['Blockly']['Xml']) {
|
|
912
|
-
goog.global['Blockly']['Xml'] = {};
|
|
913
|
-
}
|
|
914
|
-
goog.global['Blockly']['Xml']['domToText'] = Blockly.Xml.domToText;
|
|
915
|
-
goog.global['Blockly']['Xml']['domToWorkspace'] = Blockly.Xml.domToWorkspace;
|
|
916
|
-
goog.global['Blockly']['Xml']['textToDom'] = Blockly.Xml.textToDom;
|
|
917
|
-
goog.global['Blockly']['Xml']['workspaceToDom'] = Blockly.Xml.workspaceToDom;
|
|
918
|
-
goog.global['Blockly']['Xml']['clearWorkspaceAndLoadFromXml'] =
|
|
919
|
-
Blockly.Xml.clearWorkspaceAndLoadFromXml;
|