nodeskini 1.0.1 → 1.0.3
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/blocklySkini/archive/blocklyControleur.js +87 -0
- package/blocklySkini/archive/blocklySkini.js +84 -0
- package/blocklySkini/archive/blocklyhop.js +75 -0
- package/blocklySkini/archive/clientControleurBlocly.js +170 -0
- package/blocklySkini/archive/index.html +76 -0
- package/blocklySkini/archive/testHHsuspend.txt +89 -0
- package/blocklySkini/archive/testHHtrap.txt +262 -0
- package/blocklySkini/archive/testOrchestration.txt +177 -0
- package/blocklySkini/archive/testOrchestration.xml +447 -0
- package/blocklySkini/archive/testOrchestration2.xml +456 -0
- package/blocklySkini/blockly/README.md +77 -0
- package/blocklySkini/blockly/blockly.d.ts +21480 -0
- package/blocklySkini/blockly/blockly.js +25 -0
- package/blocklySkini/blockly/blockly.min.js +2188 -0
- package/blocklySkini/blockly/blockly_compressed.js +1455 -0
- package/blocklySkini/blockly/blockly_compressed.js.map +1 -0
- package/blocklySkini/blockly/blocks/colour.js +122 -0
- package/blocklySkini/blockly/blocks/lists.js +862 -0
- package/blocklySkini/blockly/blocks/logic.js +635 -0
- package/blocklySkini/blockly/blocks/loops.js +357 -0
- package/blocklySkini/blockly/blocks/math.js +566 -0
- package/blocklySkini/blockly/blocks/procedures.js +1072 -0
- package/blocklySkini/blockly/blocks/text.js +923 -0
- package/blocklySkini/blockly/blocks/variables.js +163 -0
- package/blocklySkini/blockly/blocks/variables_dynamic.js +180 -0
- package/blocklySkini/blockly/blocks.d.ts +15 -0
- package/blocklySkini/blockly/blocks.js +27 -0
- package/blocklySkini/blockly/blocks_compressed.js +182 -0
- package/blocklySkini/blockly/blocks_compressed.js.map +1 -0
- package/blocklySkini/blockly/browser.js +36 -0
- package/blocklySkini/blockly/core/block.js +2010 -0
- package/blocklySkini/blockly/core/block_animations.js +203 -0
- package/blocklySkini/blockly/core/block_drag_surface.js +212 -0
- package/blocklySkini/blockly/core/block_dragger.js +378 -0
- package/blocklySkini/blockly/core/block_events.js +548 -0
- package/blocklySkini/blockly/core/block_svg.js +1763 -0
- package/blocklySkini/blockly/core/blockly.js +674 -0
- package/blocklySkini/blockly/core/blocks.js +23 -0
- package/blocklySkini/blockly/core/bubble.js +880 -0
- package/blocklySkini/blockly/core/bubble_dragger.js +274 -0
- package/blocklySkini/blockly/core/comment.js +439 -0
- package/blocklySkini/blockly/core/components/component.js +554 -0
- package/blocklySkini/blockly/core/components/tree/basenode.js +895 -0
- package/blocklySkini/blockly/core/components/tree/treecontrol.js +332 -0
- package/blocklySkini/blockly/core/components/tree/treenode.js +172 -0
- package/blocklySkini/blockly/core/connection.js +682 -0
- package/blocklySkini/blockly/core/connection_checker.js +285 -0
- package/blocklySkini/blockly/core/connection_db.js +295 -0
- package/blocklySkini/blockly/core/constants.js +277 -0
- package/blocklySkini/blockly/core/contextmenu.js +307 -0
- package/blocklySkini/blockly/core/contextmenu_items.js +534 -0
- package/blocklySkini/blockly/core/contextmenu_registry.js +165 -0
- package/blocklySkini/blockly/core/css.js +549 -0
- package/blocklySkini/blockly/core/dropdowndiv.js +776 -0
- package/blocklySkini/blockly/core/events.js +387 -0
- package/blocklySkini/blockly/core/events_abstract.js +106 -0
- package/blocklySkini/blockly/core/extensions.js +450 -0
- package/blocklySkini/blockly/core/field.js +1162 -0
- package/blocklySkini/blockly/core/field_angle.js +562 -0
- package/blocklySkini/blockly/core/field_checkbox.js +220 -0
- package/blocklySkini/blockly/core/field_colour.js +664 -0
- package/blocklySkini/blockly/core/field_dropdown.js +760 -0
- package/blocklySkini/blockly/core/field_image.js +286 -0
- package/blocklySkini/blockly/core/field_label.js +130 -0
- package/blocklySkini/blockly/core/field_label_serializable.js +69 -0
- package/blocklySkini/blockly/core/field_multilineinput.js +299 -0
- package/blocklySkini/blockly/core/field_number.js +317 -0
- package/blocklySkini/blockly/core/field_registry.js +66 -0
- package/blocklySkini/blockly/core/field_textinput.js +616 -0
- package/blocklySkini/blockly/core/field_variable.js +463 -0
- package/blocklySkini/blockly/core/flyout_base.js +1071 -0
- package/blocklySkini/blockly/core/flyout_button.js +325 -0
- package/blocklySkini/blockly/core/flyout_dragger.js +76 -0
- package/blocklySkini/blockly/core/flyout_horizontal.js +388 -0
- package/blocklySkini/blockly/core/flyout_vertical.js +397 -0
- package/blocklySkini/blockly/core/generator.js +482 -0
- package/blocklySkini/blockly/core/gesture.js +993 -0
- package/blocklySkini/blockly/core/grid.js +222 -0
- package/blocklySkini/blockly/core/icon.js +206 -0
- package/blocklySkini/blockly/core/inject.js +487 -0
- package/blocklySkini/blockly/core/input.js +296 -0
- package/blocklySkini/blockly/core/insertion_marker_manager.js +700 -0
- package/blocklySkini/blockly/core/interfaces/i_accessibility.js +72 -0
- package/blocklySkini/blockly/core/interfaces/i_bounded_element.js +31 -0
- package/blocklySkini/blockly/core/interfaces/i_bubble.js +83 -0
- package/blocklySkini/blockly/core/interfaces/i_connection_checker.js +94 -0
- package/blocklySkini/blockly/core/interfaces/i_contextmenu.js +26 -0
- package/blocklySkini/blockly/core/interfaces/i_copyable.js +40 -0
- package/blocklySkini/blockly/core/interfaces/i_deletable.js +27 -0
- package/blocklySkini/blockly/core/interfaces/i_deletearea.js +28 -0
- package/blocklySkini/blockly/core/interfaces/i_flyout.js +178 -0
- package/blocklySkini/blockly/core/interfaces/i_movable.js +27 -0
- package/blocklySkini/blockly/core/interfaces/i_registrable.js +22 -0
- package/blocklySkini/blockly/core/interfaces/i_registrable_field.js +31 -0
- package/blocklySkini/blockly/core/interfaces/i_selectable.js +43 -0
- package/blocklySkini/blockly/core/interfaces/i_styleable.js +33 -0
- package/blocklySkini/blockly/core/interfaces/i_toolbox.js +131 -0
- package/blocklySkini/blockly/core/interfaces/i_toolbox_item.js +148 -0
- package/blocklySkini/blockly/core/keyboard_nav/action.js +26 -0
- package/blocklySkini/blockly/core/keyboard_nav/ast_node.js +684 -0
- package/blocklySkini/blockly/core/keyboard_nav/basic_cursor.js +208 -0
- package/blocklySkini/blockly/core/keyboard_nav/cursor.js +170 -0
- package/blocklySkini/blockly/core/keyboard_nav/flyout_cursor.js +106 -0
- package/blocklySkini/blockly/core/keyboard_nav/key_map.js +190 -0
- package/blocklySkini/blockly/core/keyboard_nav/marker.js +120 -0
- package/blocklySkini/blockly/core/keyboard_nav/navigation.js +1084 -0
- package/blocklySkini/blockly/core/keyboard_nav/tab_navigate_cursor.js +48 -0
- package/blocklySkini/blockly/core/marker_manager.js +183 -0
- package/blocklySkini/blockly/core/menu.js +465 -0
- package/blocklySkini/blockly/core/menuitem.js +280 -0
- package/blocklySkini/blockly/core/msg.js +31 -0
- package/blocklySkini/blockly/core/mutator.js +555 -0
- package/blocklySkini/blockly/core/names.js +186 -0
- package/blocklySkini/blockly/core/options.js +365 -0
- package/blocklySkini/blockly/core/procedures.js +404 -0
- package/blocklySkini/blockly/core/registry.js +265 -0
- package/blocklySkini/blockly/core/rendered_connection.js +565 -0
- package/blocklySkini/blockly/core/renderers/common/block_rendering.js +81 -0
- package/blocklySkini/blockly/core/renderers/common/constants.js +1256 -0
- package/blocklySkini/blockly/core/renderers/common/debugger.js +431 -0
- package/blocklySkini/blockly/core/renderers/common/drawer.js +468 -0
- package/blocklySkini/blockly/core/renderers/common/i_path_object.js +151 -0
- package/blocklySkini/blockly/core/renderers/common/info.js +775 -0
- package/blocklySkini/blockly/core/renderers/common/marker_svg.js +687 -0
- package/blocklySkini/blockly/core/renderers/common/path_object.js +279 -0
- package/blocklySkini/blockly/core/renderers/common/renderer.js +301 -0
- package/blocklySkini/blockly/core/renderers/geras/constants.js +64 -0
- package/blocklySkini/blockly/core/renderers/geras/drawer.js +205 -0
- package/blocklySkini/blockly/core/renderers/geras/highlight_constants.js +311 -0
- package/blocklySkini/blockly/core/renderers/geras/highlighter.js +256 -0
- package/blocklySkini/blockly/core/renderers/geras/info.js +483 -0
- package/blocklySkini/blockly/core/renderers/geras/measurables/inputs.js +67 -0
- package/blocklySkini/blockly/core/renderers/geras/path_object.js +177 -0
- package/blocklySkini/blockly/core/renderers/geras/renderer.js +138 -0
- package/blocklySkini/blockly/core/renderers/measurables/base.js +44 -0
- package/blocklySkini/blockly/core/renderers/measurables/connections.js +114 -0
- package/blocklySkini/blockly/core/renderers/measurables/inputs.js +160 -0
- package/blocklySkini/blockly/core/renderers/measurables/row_elements.js +185 -0
- package/blocklySkini/blockly/core/renderers/measurables/rows.js +532 -0
- package/blocklySkini/blockly/core/renderers/measurables/types.js +349 -0
- package/blocklySkini/blockly/core/renderers/minimalist/constants.js +29 -0
- package/blocklySkini/blockly/core/renderers/minimalist/drawer.js +32 -0
- package/blocklySkini/blockly/core/renderers/minimalist/info.js +45 -0
- package/blocklySkini/blockly/core/renderers/minimalist/renderer.js +70 -0
- package/blocklySkini/blockly/core/renderers/thrasos/info.js +338 -0
- package/blocklySkini/blockly/core/renderers/thrasos/renderer.js +45 -0
- package/blocklySkini/blockly/core/renderers/zelos/constants.js +1002 -0
- package/blocklySkini/blockly/core/renderers/zelos/drawer.js +233 -0
- package/blocklySkini/blockly/core/renderers/zelos/info.js +587 -0
- package/blocklySkini/blockly/core/renderers/zelos/marker_svg.js +148 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/inputs.js +47 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/row_elements.js +37 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/rows.js +108 -0
- package/blocklySkini/blockly/core/renderers/zelos/path_object.js +244 -0
- package/blocklySkini/blockly/core/renderers/zelos/renderer.js +130 -0
- package/blocklySkini/blockly/core/requires.js +84 -0
- package/blocklySkini/blockly/core/scrollbar.js +880 -0
- package/blocklySkini/blockly/core/theme/classic.js +87 -0
- package/blocklySkini/blockly/core/theme/dark.js +33 -0
- package/blocklySkini/blockly/core/theme/deuteranopia.js +104 -0
- package/blocklySkini/blockly/core/theme/highcontrast.js +119 -0
- package/blocklySkini/blockly/core/theme/modern.js +108 -0
- package/blocklySkini/blockly/core/theme/tritanopia.js +103 -0
- package/blocklySkini/blockly/core/theme/zelos.js +106 -0
- package/blocklySkini/blockly/core/theme.js +236 -0
- package/blocklySkini/blockly/core/theme_manager.js +197 -0
- package/blocklySkini/blockly/core/toolbox/category.js +690 -0
- package/blocklySkini/blockly/core/toolbox/collapsible_category.js +294 -0
- package/blocklySkini/blockly/core/toolbox/separator.js +123 -0
- package/blocklySkini/blockly/core/toolbox/toolbox.js +984 -0
- package/blocklySkini/blockly/core/toolbox/toolbox_item.js +145 -0
- package/blocklySkini/blockly/core/toolbox.js +943 -0
- package/blocklySkini/blockly/core/tooltip.js +387 -0
- package/blocklySkini/blockly/core/touch.js +255 -0
- package/blocklySkini/blockly/core/touch_gesture.js +325 -0
- package/blocklySkini/blockly/core/trashcan.js +661 -0
- package/blocklySkini/blockly/core/ui_events.js +85 -0
- package/blocklySkini/blockly/core/utils/aria.js +167 -0
- package/blocklySkini/blockly/core/utils/colour.js +208 -0
- package/blocklySkini/blockly/core/utils/coordinate.js +125 -0
- package/blocklySkini/blockly/core/utils/deprecation.js +34 -0
- package/blocklySkini/blockly/core/utils/dom.js +391 -0
- package/blocklySkini/blockly/core/utils/global.js +37 -0
- package/blocklySkini/blockly/core/utils/idgenerator.js +33 -0
- package/blocklySkini/blockly/core/utils/keycodes.js +164 -0
- package/blocklySkini/blockly/core/utils/math.js +56 -0
- package/blocklySkini/blockly/core/utils/metrics.js +124 -0
- package/blocklySkini/blockly/core/utils/object.js +73 -0
- package/blocklySkini/blockly/core/utils/rect.js +54 -0
- package/blocklySkini/blockly/core/utils/size.js +58 -0
- package/blocklySkini/blockly/core/utils/string.js +284 -0
- package/blocklySkini/blockly/core/utils/style.js +281 -0
- package/blocklySkini/blockly/core/utils/svg.js +181 -0
- package/blocklySkini/blockly/core/utils/svg_paths.js +142 -0
- package/blocklySkini/blockly/core/utils/toolbox.js +401 -0
- package/blocklySkini/blockly/core/utils/useragent.js +110 -0
- package/blocklySkini/blockly/core/utils/xml.js +79 -0
- package/blocklySkini/blockly/core/utils.js +652 -0
- package/blocklySkini/blockly/core/variable_events.js +248 -0
- package/blocklySkini/blockly/core/variable_map.js +414 -0
- package/blocklySkini/blockly/core/variable_model.js +95 -0
- package/blocklySkini/blockly/core/variables.js +571 -0
- package/blocklySkini/blockly/core/variables_dynamic.js +100 -0
- package/blocklySkini/blockly/core/warning.js +200 -0
- package/blocklySkini/blockly/core/widgetdiv.js +241 -0
- package/blocklySkini/blockly/core/workspace.js +786 -0
- package/blocklySkini/blockly/core/workspace_audio.js +153 -0
- package/blocklySkini/blockly/core/workspace_comment.js +373 -0
- package/blocklySkini/blockly/core/workspace_comment_render_svg.js +461 -0
- package/blocklySkini/blockly/core/workspace_comment_svg.js +701 -0
- package/blocklySkini/blockly/core/workspace_drag_surface_svg.js +176 -0
- package/blocklySkini/blockly/core/workspace_dragger.js +85 -0
- package/blocklySkini/blockly/core/workspace_events.js +93 -0
- package/blocklySkini/blockly/core/workspace_svg.js +2661 -0
- package/blocklySkini/blockly/core/ws_comment_events.js +417 -0
- package/blocklySkini/blockly/core/xml.js +827 -0
- package/blocklySkini/blockly/core/zoom_controls.js +449 -0
- package/blocklySkini/blockly/core-browser.js +34 -0
- package/blocklySkini/blockly/core.d.ts +15 -0
- package/blocklySkini/blockly/core.js +38 -0
- package/blocklySkini/blockly/dart.d.ts +15 -0
- package/blocklySkini/blockly/dart.js +27 -0
- package/blocklySkini/blockly/dart_compressed.js +114 -0
- package/blocklySkini/blockly/dart_compressed.js.map +1 -0
- package/blocklySkini/blockly/generators/dart/colour.js +114 -0
- package/blocklySkini/blockly/generators/dart/lists.js +447 -0
- package/blocklySkini/blockly/generators/dart/logic.js +127 -0
- package/blocklySkini/blockly/generators/dart/loops.js +169 -0
- package/blocklySkini/blockly/generators/dart/math.js +485 -0
- package/blocklySkini/blockly/generators/dart/procedures.js +111 -0
- package/blocklySkini/blockly/generators/dart/text.js +339 -0
- package/blocklySkini/blockly/generators/dart/variables.js +32 -0
- package/blocklySkini/blockly/generators/dart/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/dart.js +290 -0
- package/blocklySkini/blockly/generators/javascript/colour.js +89 -0
- package/blocklySkini/blockly/generators/javascript/lists.js +388 -0
- package/blocklySkini/blockly/generators/javascript/logic.js +129 -0
- package/blocklySkini/blockly/generators/javascript/loops.js +184 -0
- package/blocklySkini/blockly/generators/javascript/math.js +409 -0
- package/blocklySkini/blockly/generators/javascript/procedures.js +113 -0
- package/blocklySkini/blockly/generators/javascript/text.js +367 -0
- package/blocklySkini/blockly/generators/javascript/variables.js +32 -0
- package/blocklySkini/blockly/generators/javascript/variables_dynamic.js +23 -0
- package/blocklySkini/blockly/generators/javascript.js +317 -0
- package/blocklySkini/blockly/generators/lua/colour.js +76 -0
- package/blocklySkini/blockly/generators/lua/lists.js +368 -0
- package/blocklySkini/blockly/generators/lua/logic.js +127 -0
- package/blocklySkini/blockly/generators/lua/loops.js +173 -0
- package/blocklySkini/blockly/generators/lua/math.js +423 -0
- package/blocklySkini/blockly/generators/lua/procedures.js +113 -0
- package/blocklySkini/blockly/generators/lua/text.js +353 -0
- package/blocklySkini/blockly/generators/lua/variables.js +32 -0
- package/blocklySkini/blockly/generators/lua/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/lua.js +198 -0
- package/blocklySkini/blockly/generators/php/colour.js +91 -0
- package/blocklySkini/blockly/generators/php/lists.js +498 -0
- package/blocklySkini/blockly/generators/php/logic.js +128 -0
- package/blocklySkini/blockly/generators/php/loops.js +170 -0
- package/blocklySkini/blockly/generators/php/math.js +370 -0
- package/blocklySkini/blockly/generators/php/procedures.js +132 -0
- package/blocklySkini/blockly/generators/php/text.js +271 -0
- package/blocklySkini/blockly/generators/php/variables.js +32 -0
- package/blocklySkini/blockly/generators/php/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/php.js +318 -0
- package/blocklySkini/blockly/generators/python/colour.js +72 -0
- package/blocklySkini/blockly/generators/python/lists.js +349 -0
- package/blocklySkini/blockly/generators/python/logic.js +127 -0
- package/blocklySkini/blockly/generators/python/loops.js +214 -0
- package/blocklySkini/blockly/generators/python/math.js +385 -0
- package/blocklySkini/blockly/generators/python/procedures.js +134 -0
- package/blocklySkini/blockly/generators/python/text.js +293 -0
- package/blocklySkini/blockly/generators/python/variables.js +32 -0
- package/blocklySkini/blockly/generators/python/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/python.js +322 -0
- package/blocklySkini/blockly/index.d.ts +22 -0
- package/blocklySkini/blockly/index.js +24 -0
- package/blocklySkini/blockly/javascript.d.ts +15 -0
- package/blocklySkini/blockly/javascript.js +27 -0
- package/blocklySkini/blockly/javascript_compressed.js +115 -0
- package/blocklySkini/blockly/javascript_compressed.js.map +1 -0
- package/blocklySkini/blockly/lua.d.ts +15 -0
- package/blocklySkini/blockly/lua.js +27 -0
- package/blocklySkini/blockly/lua_compressed.js +94 -0
- package/blocklySkini/blockly/lua_compressed.js.map +1 -0
- package/blocklySkini/blockly/media/1x1.gif +0 -0
- package/blocklySkini/blockly/media/click.mp3 +0 -0
- package/blocklySkini/blockly/media/click.ogg +0 -0
- package/blocklySkini/blockly/media/click.wav +0 -0
- package/blocklySkini/blockly/media/delete.mp3 +0 -0
- package/blocklySkini/blockly/media/delete.ogg +0 -0
- package/blocklySkini/blockly/media/delete.wav +0 -0
- package/blocklySkini/blockly/media/disconnect.mp3 +0 -0
- package/blocklySkini/blockly/media/disconnect.ogg +0 -0
- package/blocklySkini/blockly/media/disconnect.wav +0 -0
- package/blocklySkini/blockly/media/dropdown-arrow.svg +1 -0
- package/blocklySkini/blockly/media/handclosed.cur +0 -0
- package/blocklySkini/blockly/media/handdelete.cur +0 -0
- package/blocklySkini/blockly/media/handopen.cur +0 -0
- package/blocklySkini/blockly/media/pilcrow.png +0 -0
- package/blocklySkini/blockly/media/quote0.png +0 -0
- package/blocklySkini/blockly/media/quote1.png +0 -0
- package/blocklySkini/blockly/media/sprites.png +0 -0
- package/blocklySkini/blockly/media/sprites.svg +74 -0
- package/blocklySkini/blockly/msg/ab.d.ts +16 -0
- package/blocklySkini/blockly/msg/ab.js +447 -0
- package/blocklySkini/blockly/msg/ar.d.ts +16 -0
- package/blocklySkini/blockly/msg/ar.js +447 -0
- package/blocklySkini/blockly/msg/az.d.ts +16 -0
- package/blocklySkini/blockly/msg/az.js +447 -0
- package/blocklySkini/blockly/msg/ba.d.ts +16 -0
- package/blocklySkini/blockly/msg/ba.js +447 -0
- package/blocklySkini/blockly/msg/bcc.d.ts +16 -0
- package/blocklySkini/blockly/msg/bcc.js +447 -0
- package/blocklySkini/blockly/msg/be-tarask.d.ts +16 -0
- package/blocklySkini/blockly/msg/be-tarask.js +447 -0
- package/blocklySkini/blockly/msg/be.d.ts +16 -0
- package/blocklySkini/blockly/msg/be.js +447 -0
- package/blocklySkini/blockly/msg/bg.d.ts +16 -0
- package/blocklySkini/blockly/msg/bg.js +447 -0
- package/blocklySkini/blockly/msg/bn.d.ts +16 -0
- package/blocklySkini/blockly/msg/bn.js +447 -0
- package/blocklySkini/blockly/msg/br.d.ts +16 -0
- package/blocklySkini/blockly/msg/br.js +447 -0
- package/blocklySkini/blockly/msg/ca.d.ts +16 -0
- package/blocklySkini/blockly/msg/ca.js +447 -0
- package/blocklySkini/blockly/msg/constants.d.ts +16 -0
- package/blocklySkini/blockly/msg/cs.d.ts +16 -0
- package/blocklySkini/blockly/msg/cs.js +447 -0
- package/blocklySkini/blockly/msg/da.d.ts +16 -0
- package/blocklySkini/blockly/msg/da.js +447 -0
- package/blocklySkini/blockly/msg/de.d.ts +16 -0
- package/blocklySkini/blockly/msg/de.js +447 -0
- package/blocklySkini/blockly/msg/diq.d.ts +16 -0
- package/blocklySkini/blockly/msg/diq.js +447 -0
- package/blocklySkini/blockly/msg/dty.d.ts +16 -0
- package/blocklySkini/blockly/msg/dty.js +447 -0
- package/blocklySkini/blockly/msg/ee.d.ts +16 -0
- package/blocklySkini/blockly/msg/ee.js +447 -0
- package/blocklySkini/blockly/msg/el.d.ts +16 -0
- package/blocklySkini/blockly/msg/el.js +447 -0
- package/blocklySkini/blockly/msg/en-gb.d.ts +16 -0
- package/blocklySkini/blockly/msg/en-gb.js +447 -0
- package/blocklySkini/blockly/msg/en.d.ts +16 -0
- package/blocklySkini/blockly/msg/en.js +447 -0
- package/blocklySkini/blockly/msg/eo.d.ts +16 -0
- package/blocklySkini/blockly/msg/eo.js +447 -0
- package/blocklySkini/blockly/msg/es.d.ts +16 -0
- package/blocklySkini/blockly/msg/es.js +447 -0
- package/blocklySkini/blockly/msg/et.d.ts +16 -0
- package/blocklySkini/blockly/msg/et.js +447 -0
- package/blocklySkini/blockly/msg/eu.d.ts +16 -0
- package/blocklySkini/blockly/msg/eu.js +447 -0
- package/blocklySkini/blockly/msg/fa.d.ts +16 -0
- package/blocklySkini/blockly/msg/fa.js +447 -0
- package/blocklySkini/blockly/msg/fi.d.ts +16 -0
- package/blocklySkini/blockly/msg/fi.js +447 -0
- package/blocklySkini/blockly/msg/fr.d.ts +16 -0
- package/blocklySkini/blockly/msg/fr.js +447 -0
- package/blocklySkini/blockly/msg/gl.d.ts +16 -0
- package/blocklySkini/blockly/msg/gl.js +447 -0
- package/blocklySkini/blockly/msg/gor.d.ts +16 -0
- package/blocklySkini/blockly/msg/gor.js +447 -0
- package/blocklySkini/blockly/msg/ha.d.ts +16 -0
- package/blocklySkini/blockly/msg/ha.js +447 -0
- package/blocklySkini/blockly/msg/he.d.ts +16 -0
- package/blocklySkini/blockly/msg/he.js +447 -0
- package/blocklySkini/blockly/msg/hi.d.ts +16 -0
- package/blocklySkini/blockly/msg/hi.js +447 -0
- package/blocklySkini/blockly/msg/hrx.d.ts +16 -0
- package/blocklySkini/blockly/msg/hrx.js +447 -0
- package/blocklySkini/blockly/msg/hu.d.ts +16 -0
- package/blocklySkini/blockly/msg/hu.js +447 -0
- package/blocklySkini/blockly/msg/hy.d.ts +16 -0
- package/blocklySkini/blockly/msg/hy.js +447 -0
- package/blocklySkini/blockly/msg/ia.d.ts +16 -0
- package/blocklySkini/blockly/msg/ia.js +447 -0
- package/blocklySkini/blockly/msg/id.d.ts +16 -0
- package/blocklySkini/blockly/msg/id.js +447 -0
- package/blocklySkini/blockly/msg/ig.d.ts +16 -0
- package/blocklySkini/blockly/msg/ig.js +447 -0
- package/blocklySkini/blockly/msg/is.d.ts +16 -0
- package/blocklySkini/blockly/msg/is.js +447 -0
- package/blocklySkini/blockly/msg/it.d.ts +16 -0
- package/blocklySkini/blockly/msg/it.js +447 -0
- package/blocklySkini/blockly/msg/ja.d.ts +16 -0
- package/blocklySkini/blockly/msg/ja.js +447 -0
- package/blocklySkini/blockly/msg/kab.d.ts +16 -0
- package/blocklySkini/blockly/msg/kab.js +447 -0
- package/blocklySkini/blockly/msg/kn.d.ts +16 -0
- package/blocklySkini/blockly/msg/kn.js +447 -0
- package/blocklySkini/blockly/msg/ko.d.ts +16 -0
- package/blocklySkini/blockly/msg/ko.js +447 -0
- package/blocklySkini/blockly/msg/lb.d.ts +16 -0
- package/blocklySkini/blockly/msg/lb.js +447 -0
- package/blocklySkini/blockly/msg/lki.d.ts +16 -0
- package/blocklySkini/blockly/msg/lki.js +447 -0
- package/blocklySkini/blockly/msg/lo.d.ts +16 -0
- package/blocklySkini/blockly/msg/lo.js +447 -0
- package/blocklySkini/blockly/msg/lrc.d.ts +16 -0
- package/blocklySkini/blockly/msg/lrc.js +447 -0
- package/blocklySkini/blockly/msg/lt.d.ts +16 -0
- package/blocklySkini/blockly/msg/lt.js +447 -0
- package/blocklySkini/blockly/msg/lv.d.ts +16 -0
- package/blocklySkini/blockly/msg/lv.js +447 -0
- package/blocklySkini/blockly/msg/mk.d.ts +16 -0
- package/blocklySkini/blockly/msg/mk.js +447 -0
- package/blocklySkini/blockly/msg/mnw.d.ts +16 -0
- package/blocklySkini/blockly/msg/mnw.js +447 -0
- package/blocklySkini/blockly/msg/ms.d.ts +16 -0
- package/blocklySkini/blockly/msg/ms.js +447 -0
- package/blocklySkini/blockly/msg/msg.d.ts +444 -0
- package/blocklySkini/blockly/msg/nb.d.ts +16 -0
- package/blocklySkini/blockly/msg/nb.js +447 -0
- package/blocklySkini/blockly/msg/nl.d.ts +16 -0
- package/blocklySkini/blockly/msg/nl.js +447 -0
- package/blocklySkini/blockly/msg/oc.d.ts +16 -0
- package/blocklySkini/blockly/msg/oc.js +447 -0
- package/blocklySkini/blockly/msg/pl.d.ts +16 -0
- package/blocklySkini/blockly/msg/pl.js +447 -0
- package/blocklySkini/blockly/msg/pms.d.ts +16 -0
- package/blocklySkini/blockly/msg/pms.js +447 -0
- package/blocklySkini/blockly/msg/pt-br.d.ts +16 -0
- package/blocklySkini/blockly/msg/pt-br.js +447 -0
- package/blocklySkini/blockly/msg/pt.d.ts +16 -0
- package/blocklySkini/blockly/msg/pt.js +447 -0
- package/blocklySkini/blockly/msg/qqq.d.ts +16 -0
- package/blocklySkini/blockly/msg/ro.d.ts +16 -0
- package/blocklySkini/blockly/msg/ro.js +447 -0
- package/blocklySkini/blockly/msg/ru.d.ts +16 -0
- package/blocklySkini/blockly/msg/ru.js +447 -0
- package/blocklySkini/blockly/msg/sc.d.ts +16 -0
- package/blocklySkini/blockly/msg/sc.js +447 -0
- package/blocklySkini/blockly/msg/sd.d.ts +16 -0
- package/blocklySkini/blockly/msg/sd.js +447 -0
- package/blocklySkini/blockly/msg/shn.d.ts +16 -0
- package/blocklySkini/blockly/msg/shn.js +447 -0
- package/blocklySkini/blockly/msg/sk.d.ts +16 -0
- package/blocklySkini/blockly/msg/sk.js +447 -0
- package/blocklySkini/blockly/msg/skr-arab.d.ts +16 -0
- package/blocklySkini/blockly/msg/skr-arab.js +447 -0
- package/blocklySkini/blockly/msg/sl.d.ts +16 -0
- package/blocklySkini/blockly/msg/sl.js +447 -0
- package/blocklySkini/blockly/msg/sq.d.ts +16 -0
- package/blocklySkini/blockly/msg/sq.js +447 -0
- package/blocklySkini/blockly/msg/sr-latn.d.ts +16 -0
- package/blocklySkini/blockly/msg/sr-latn.js +447 -0
- package/blocklySkini/blockly/msg/sr.d.ts +16 -0
- package/blocklySkini/blockly/msg/sr.js +447 -0
- package/blocklySkini/blockly/msg/sv.d.ts +16 -0
- package/blocklySkini/blockly/msg/sv.js +447 -0
- package/blocklySkini/blockly/msg/synonyms.d.ts +16 -0
- package/blocklySkini/blockly/msg/ta.d.ts +16 -0
- package/blocklySkini/blockly/msg/ta.js +447 -0
- package/blocklySkini/blockly/msg/tcy.d.ts +16 -0
- package/blocklySkini/blockly/msg/tcy.js +447 -0
- package/blocklySkini/blockly/msg/te.d.ts +16 -0
- package/blocklySkini/blockly/msg/te.js +447 -0
- package/blocklySkini/blockly/msg/th.d.ts +16 -0
- package/blocklySkini/blockly/msg/th.js +447 -0
- package/blocklySkini/blockly/msg/tl.d.ts +16 -0
- package/blocklySkini/blockly/msg/tl.js +447 -0
- package/blocklySkini/blockly/msg/tlh.d.ts +16 -0
- package/blocklySkini/blockly/msg/tlh.js +447 -0
- package/blocklySkini/blockly/msg/tr.d.ts +16 -0
- package/blocklySkini/blockly/msg/tr.js +447 -0
- package/blocklySkini/blockly/msg/ug-arab.d.ts +16 -0
- package/blocklySkini/blockly/msg/ug-arab.js +447 -0
- package/blocklySkini/blockly/msg/uk.d.ts +16 -0
- package/blocklySkini/blockly/msg/uk.js +447 -0
- package/blocklySkini/blockly/msg/ur.d.ts +16 -0
- package/blocklySkini/blockly/msg/ur.js +447 -0
- package/blocklySkini/blockly/msg/vi.d.ts +16 -0
- package/blocklySkini/blockly/msg/vi.js +447 -0
- package/blocklySkini/blockly/msg/xmf.d.ts +16 -0
- package/blocklySkini/blockly/msg/xmf.js +447 -0
- package/blocklySkini/blockly/msg/yo.d.ts +16 -0
- package/blocklySkini/blockly/msg/yo.js +447 -0
- package/blocklySkini/blockly/msg/zh-hans.d.ts +16 -0
- package/blocklySkini/blockly/msg/zh-hans.js +447 -0
- package/blocklySkini/blockly/msg/zh-hant.d.ts +16 -0
- package/blocklySkini/blockly/msg/zh-hant.js +447 -0
- package/blocklySkini/blockly/node.js +35 -0
- package/blocklySkini/blockly/package.json +84 -0
- package/blocklySkini/blockly/php.d.ts +15 -0
- package/blocklySkini/blockly/php.js +27 -0
- package/blocklySkini/blockly/php_compressed.js +103 -0
- package/blocklySkini/blockly/php_compressed.js.map +1 -0
- package/blocklySkini/blockly/python.d.ts +15 -0
- package/blocklySkini/blockly/python.js +27 -0
- package/blocklySkini/blockly/python_compressed.js +98 -0
- package/blocklySkini/blockly/python_compressed.js.map +1 -0
- package/blocklySkini/blocklySkini.html +81 -0
- package/blocklySkini/orchestrations/.xml +1 -0
- package/blocklySkini/orchestrations/BluesSkini-1.xml +231 -0
- package/blocklySkini/orchestrations/BluesSkini-2.xml +741 -0
- package/blocklySkini/orchestrations/BluesSkini-3.xml +731 -0
- package/blocklySkini/orchestrations/BluesSkini-4.xml +695 -0
- package/blocklySkini/orchestrations/BluesSkini-5.xml +731 -0
- package/blocklySkini/orchestrations/BluesSkini.xml +704 -0
- package/blocklySkini/orchestrations/FunkBitwig-1.xml +778 -0
- package/blocklySkini/orchestrations/FunkBitwig-2.xml +471 -0
- package/blocklySkini/orchestrations/JouerLeBonInstrument1-1.xml +784 -0
- package/blocklySkini/orchestrations/MajeurMineur-1.xml +638 -0
- package/blocklySkini/orchestrations/Opus5-3 - Copie.xml +1041 -0
- package/blocklySkini/orchestrations/Opus5-3.xml +1128 -0
- package/blocklySkini/orchestrations/Quatuor1-1.xml +357 -0
- package/blocklySkini/orchestrations/TechnoBitwig-1.xml +221 -0
- package/blocklySkini/orchestrations/TestBlockly.xml +497 -0
- package/blocklySkini/orchestrations/TestBlockly1.xml +500 -0
- package/blocklySkini/orchestrations/TestBlockly2.xml +792 -0
- package/blocklySkini/orchestrations/TestBlockly3-1.xml +1182 -0
- package/blocklySkini/orchestrations/TestBlockly3.xml +1251 -0
- package/blocklySkini/orchestrations/TestFunction.xml +143 -0
- package/blocklySkini/orchestrations/TestIf.xml +80 -0
- package/blocklySkini/orchestrations/TestLoop.xml +127 -0
- package/blocklySkini/orchestrations/TestOrchestration2.xml +460 -0
- package/blocklySkini/orchestrations/TestPrint.xml +70 -0
- package/blocklySkini/orchestrations/TestSubMod.xml +81 -0
- package/blocklySkini/orchestrations/Testlogic.xml +113 -0
- package/blocklySkini/orchestrations/TrouveLaPercu-1.xml +813 -0
- package/blocklySkini/orchestrations/TrouveLaPercu-2.xml +813 -0
- package/blocklySkini/orchestrations/bar.xml +496 -0
- package/blocklySkini/orchestrations/bar2.xml +496 -0
- package/blocklySkini/orchestrations/foo.xml +500 -0
- package/blocklySkini/orchestrations/opus5Blockly - Copie.xml +496 -0
- package/blocklySkini/orchestrations/opus5Blockly-3.xml +868 -0
- package/blocklySkini/orchestrations/opus5Blockly.xml +496 -0
- package/blocklySkini/orchestrations/testOrchestration3.xml +483 -0
- package/blocklySkini/orchestrations/testOrchestration4.xml +487 -0
- package/blocklySkini/scripts/hiphop_blocks.js +6104 -0
- package/blocklySkini/scripts/main2.js +801 -0
- package/blocklySkini/styles/index.css +320 -0
- package/blocklySkini/styles/material.css +11552 -0
- package/package.json +5 -5
|
@@ -0,0 +1,786 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2012 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Object representing a workspace.
|
|
9
|
+
* @author fraser@google.com (Neil Fraser)
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
goog.provide('Blockly.Workspace');
|
|
14
|
+
|
|
15
|
+
goog.require('Blockly.ConnectionChecker');
|
|
16
|
+
goog.require('Blockly.Events');
|
|
17
|
+
goog.require('Blockly.Options');
|
|
18
|
+
goog.require('Blockly.utils');
|
|
19
|
+
goog.require('Blockly.utils.math');
|
|
20
|
+
goog.require('Blockly.VariableMap');
|
|
21
|
+
|
|
22
|
+
goog.requireType('Blockly.IASTNodeLocation');
|
|
23
|
+
goog.requireType('Blockly.IConnectionChecker');
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Class for a workspace. This is a data structure that contains blocks.
|
|
28
|
+
* There is no UI, and can be created headlessly.
|
|
29
|
+
* @param {!Blockly.Options=} opt_options Dictionary of options.
|
|
30
|
+
* @constructor
|
|
31
|
+
* @implements {Blockly.IASTNodeLocation}
|
|
32
|
+
*/
|
|
33
|
+
Blockly.Workspace = function(opt_options) {
|
|
34
|
+
/** @type {string} */
|
|
35
|
+
this.id = Blockly.utils.genUid();
|
|
36
|
+
Blockly.Workspace.WorkspaceDB_[this.id] = this;
|
|
37
|
+
/** @type {!Blockly.Options} */
|
|
38
|
+
this.options = opt_options ||
|
|
39
|
+
new Blockly.Options(/** @type {!Blockly.BlocklyOptions} */ ({}));
|
|
40
|
+
/** @type {boolean} */
|
|
41
|
+
this.RTL = !!this.options.RTL;
|
|
42
|
+
/** @type {boolean} */
|
|
43
|
+
this.horizontalLayout = !!this.options.horizontalLayout;
|
|
44
|
+
/** @type {number} */
|
|
45
|
+
this.toolboxPosition = this.options.toolboxPosition;
|
|
46
|
+
|
|
47
|
+
var connectionCheckerClass = Blockly.registry.getClassFromOptions(
|
|
48
|
+
Blockly.registry.Type.CONNECTION_CHECKER, this.options);
|
|
49
|
+
/**
|
|
50
|
+
* An object that encapsulates logic for safety, type, and dragging checks.
|
|
51
|
+
* @type {!Blockly.IConnectionChecker}
|
|
52
|
+
*/
|
|
53
|
+
this.connectionChecker = new connectionCheckerClass(this);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @type {!Array.<!Blockly.Block>}
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
this.topBlocks_ = [];
|
|
60
|
+
/**
|
|
61
|
+
* @type {!Array.<!Blockly.WorkspaceComment>}
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
this.topComments_ = [];
|
|
65
|
+
/**
|
|
66
|
+
* @type {!Object}
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
this.commentDB_ = Object.create(null);
|
|
70
|
+
/**
|
|
71
|
+
* @type {!Array.<!Function>}
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
this.listeners_ = [];
|
|
75
|
+
/**
|
|
76
|
+
* @type {!Array.<!Blockly.Events.Abstract>}
|
|
77
|
+
* @protected
|
|
78
|
+
*/
|
|
79
|
+
this.undoStack_ = [];
|
|
80
|
+
/**
|
|
81
|
+
* @type {!Array.<!Blockly.Events.Abstract>}
|
|
82
|
+
* @protected
|
|
83
|
+
*/
|
|
84
|
+
this.redoStack_ = [];
|
|
85
|
+
/**
|
|
86
|
+
* @type {!Object}
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
this.blockDB_ = Object.create(null);
|
|
90
|
+
/**
|
|
91
|
+
* @type {!Object}
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
this.typedBlocksDB_ = Object.create(null);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A map from variable type to list of variable names. The lists contain all
|
|
98
|
+
* of the named variables in the workspace, including variables
|
|
99
|
+
* that are not currently in use.
|
|
100
|
+
* @type {!Blockly.VariableMap}
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
this.variableMap_ = new Blockly.VariableMap(this);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Blocks in the flyout can refer to variables that don't exist in the main
|
|
107
|
+
* workspace. For instance, the "get item in list" block refers to an "item"
|
|
108
|
+
* variable regardless of whether the variable has been created yet.
|
|
109
|
+
* A FieldVariable must always refer to a Blockly.VariableModel. We reconcile
|
|
110
|
+
* these by tracking "potential" variables in the flyout. These variables
|
|
111
|
+
* become real when references to them are dragged into the main workspace.
|
|
112
|
+
* @type {Blockly.VariableMap}
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
this.potentialVariableMap_ = null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns `true` if the workspace is visible and `false` if it's headless.
|
|
120
|
+
* @type {boolean}
|
|
121
|
+
*/
|
|
122
|
+
Blockly.Workspace.prototype.rendered = false;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Returns `true` if the workspace is currently in the process of a bulk clear.
|
|
126
|
+
* @type {boolean}
|
|
127
|
+
* @package
|
|
128
|
+
*/
|
|
129
|
+
Blockly.Workspace.prototype.isClearing = false;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Maximum number of undo events in stack. `0` turns off undo, `Infinity` sets
|
|
133
|
+
* it to unlimited.
|
|
134
|
+
* @type {number}
|
|
135
|
+
*/
|
|
136
|
+
Blockly.Workspace.prototype.MAX_UNDO = 1024;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Set of databases for rapid lookup of connection locations.
|
|
140
|
+
* @type {Array.<!Blockly.ConnectionDB>}
|
|
141
|
+
*/
|
|
142
|
+
Blockly.Workspace.prototype.connectionDBList = null;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Dispose of this workspace.
|
|
146
|
+
* Unlink from all DOM elements to prevent memory leaks.
|
|
147
|
+
* @suppress {checkTypes}
|
|
148
|
+
*/
|
|
149
|
+
Blockly.Workspace.prototype.dispose = function() {
|
|
150
|
+
this.listeners_.length = 0;
|
|
151
|
+
this.clear();
|
|
152
|
+
// Remove from workspace database.
|
|
153
|
+
delete Blockly.Workspace.WorkspaceDB_[this.id];
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Angle away from the horizontal to sweep for blocks. Order of execution is
|
|
158
|
+
* generally top to bottom, but a small angle changes the scan to give a bit of
|
|
159
|
+
* a left to right bias (reversed in RTL). Units are in degrees.
|
|
160
|
+
* See: https://tvtropes.org/pmwiki/pmwiki.php/Main/DiagonalBilling
|
|
161
|
+
*/
|
|
162
|
+
Blockly.Workspace.SCAN_ANGLE = 3;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Compare function for sorting objects (blocks, comments, etc) by position;
|
|
166
|
+
* top to bottom (with slight LTR or RTL bias).
|
|
167
|
+
* @param {!Blockly.Block | !Blockly.WorkspaceComment} a The first object to
|
|
168
|
+
* compare.
|
|
169
|
+
* @param {!Blockly.Block | !Blockly.WorkspaceComment} b The second object to
|
|
170
|
+
* compare.
|
|
171
|
+
* @return {number} The comparison value. This tells Array.sort() how to change
|
|
172
|
+
* object a's index.
|
|
173
|
+
* @private
|
|
174
|
+
*/
|
|
175
|
+
Blockly.Workspace.prototype.sortObjects_ = function(a, b) {
|
|
176
|
+
var aXY = a.getRelativeToSurfaceXY();
|
|
177
|
+
var bXY = b.getRelativeToSurfaceXY();
|
|
178
|
+
return (aXY.y + Blockly.Workspace.prototype.sortObjects_.offset * aXY.x) -
|
|
179
|
+
(bXY.y + Blockly.Workspace.prototype.sortObjects_.offset * bXY.x);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Adds a block to the list of top blocks.
|
|
184
|
+
* @param {!Blockly.Block} block Block to add.
|
|
185
|
+
*/
|
|
186
|
+
Blockly.Workspace.prototype.addTopBlock = function(block) {
|
|
187
|
+
this.topBlocks_.push(block);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Removes a block from the list of top blocks.
|
|
192
|
+
* @param {!Blockly.Block} block Block to remove.
|
|
193
|
+
*/
|
|
194
|
+
Blockly.Workspace.prototype.removeTopBlock = function(block) {
|
|
195
|
+
if (!Blockly.utils.arrayRemove(this.topBlocks_, block)) {
|
|
196
|
+
throw Error('Block not present in workspace\'s list of top-most blocks.');
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Finds the top-level blocks and returns them. Blocks are optionally sorted
|
|
202
|
+
* by position; top to bottom (with slight LTR or RTL bias).
|
|
203
|
+
* @param {boolean} ordered Sort the list if true.
|
|
204
|
+
* @return {!Array.<!Blockly.Block>} The top-level block objects.
|
|
205
|
+
*/
|
|
206
|
+
Blockly.Workspace.prototype.getTopBlocks = function(ordered) {
|
|
207
|
+
// Copy the topBlocks_ list.
|
|
208
|
+
var blocks = [].concat(this.topBlocks_);
|
|
209
|
+
if (ordered && blocks.length > 1) {
|
|
210
|
+
this.sortObjects_.offset =
|
|
211
|
+
Math.sin(Blockly.utils.math.toRadians(Blockly.Workspace.SCAN_ANGLE));
|
|
212
|
+
if (this.RTL) {
|
|
213
|
+
this.sortObjects_.offset *= -1;
|
|
214
|
+
}
|
|
215
|
+
blocks.sort(this.sortObjects_);
|
|
216
|
+
}
|
|
217
|
+
return blocks;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Add a block to the list of blocks keyed by type.
|
|
222
|
+
* @param {!Blockly.Block} block Block to add.
|
|
223
|
+
*/
|
|
224
|
+
Blockly.Workspace.prototype.addTypedBlock = function(block) {
|
|
225
|
+
if (!this.typedBlocksDB_[block.type]) {
|
|
226
|
+
this.typedBlocksDB_[block.type] = [];
|
|
227
|
+
}
|
|
228
|
+
this.typedBlocksDB_[block.type].push(block);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Remove a block from the list of blocks keyed by type.
|
|
233
|
+
* @param {!Blockly.Block} block Block to remove.
|
|
234
|
+
*/
|
|
235
|
+
Blockly.Workspace.prototype.removeTypedBlock = function(block) {
|
|
236
|
+
this.typedBlocksDB_[block.type].splice(this.typedBlocksDB_[block.type]
|
|
237
|
+
.indexOf(block), 1);
|
|
238
|
+
if (!this.typedBlocksDB_[block.type].length) {
|
|
239
|
+
delete this.typedBlocksDB_[block.type];
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Finds the blocks with the associated type and returns them. Blocks are
|
|
245
|
+
* optionally sorted by position; top to bottom (with slight LTR or RTL bias).
|
|
246
|
+
* @param {string} type The type of block to search for.
|
|
247
|
+
* @param {boolean} ordered Sort the list if true.
|
|
248
|
+
* @return {!Array.<!Blockly.Block>} The blocks of the given type.
|
|
249
|
+
*/
|
|
250
|
+
Blockly.Workspace.prototype.getBlocksByType = function(type, ordered) {
|
|
251
|
+
if (!this.typedBlocksDB_[type]) {
|
|
252
|
+
return [];
|
|
253
|
+
}
|
|
254
|
+
var blocks = this.typedBlocksDB_[type].slice(0);
|
|
255
|
+
if (ordered && blocks.length > 1) {
|
|
256
|
+
this.sortObjects_.offset =
|
|
257
|
+
Math.sin(Blockly.utils.math.toRadians(Blockly.Workspace.SCAN_ANGLE));
|
|
258
|
+
if (this.RTL) {
|
|
259
|
+
this.sortObjects_.offset *= -1;
|
|
260
|
+
}
|
|
261
|
+
blocks.sort(this.sortObjects_);
|
|
262
|
+
}
|
|
263
|
+
return blocks;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Adds a comment to the list of top comments.
|
|
268
|
+
* @param {!Blockly.WorkspaceComment} comment comment to add.
|
|
269
|
+
* @package
|
|
270
|
+
*/
|
|
271
|
+
Blockly.Workspace.prototype.addTopComment = function(comment) {
|
|
272
|
+
this.topComments_.push(comment);
|
|
273
|
+
|
|
274
|
+
// Note: If the comment database starts to hold block comments, this may need
|
|
275
|
+
// to move to a separate function.
|
|
276
|
+
if (this.commentDB_[comment.id]) {
|
|
277
|
+
console.warn('Overriding an existing comment on this workspace, with id "' +
|
|
278
|
+
comment.id + '"');
|
|
279
|
+
}
|
|
280
|
+
this.commentDB_[comment.id] = comment;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Removes a comment from the list of top comments.
|
|
285
|
+
* @param {!Blockly.WorkspaceComment} comment comment to remove.
|
|
286
|
+
* @package
|
|
287
|
+
*/
|
|
288
|
+
Blockly.Workspace.prototype.removeTopComment = function(comment) {
|
|
289
|
+
if (!Blockly.utils.arrayRemove(this.topComments_, comment)) {
|
|
290
|
+
throw Error('Comment not present in workspace\'s list of top-most ' +
|
|
291
|
+
'comments.');
|
|
292
|
+
}
|
|
293
|
+
// Note: If the comment database starts to hold block comments, this may need
|
|
294
|
+
// to move to a separate function.
|
|
295
|
+
delete this.commentDB_[comment.id];
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Finds the top-level comments and returns them. Comments are optionally
|
|
300
|
+
* sorted by position; top to bottom (with slight LTR or RTL bias).
|
|
301
|
+
* @param {boolean} ordered Sort the list if true.
|
|
302
|
+
* @return {!Array.<!Blockly.WorkspaceComment>} The top-level comment objects.
|
|
303
|
+
* @package
|
|
304
|
+
*/
|
|
305
|
+
Blockly.Workspace.prototype.getTopComments = function(ordered) {
|
|
306
|
+
// Copy the topComments_ list.
|
|
307
|
+
var comments = [].concat(this.topComments_);
|
|
308
|
+
if (ordered && comments.length > 1) {
|
|
309
|
+
this.sortObjects_.offset =
|
|
310
|
+
Math.sin(Blockly.utils.math.toRadians(Blockly.Workspace.SCAN_ANGLE));
|
|
311
|
+
if (this.RTL) {
|
|
312
|
+
this.sortObjects_.offset *= -1;
|
|
313
|
+
}
|
|
314
|
+
comments.sort(this.sortObjects_);
|
|
315
|
+
}
|
|
316
|
+
return comments;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Find all blocks in workspace. Blocks are optionally sorted
|
|
321
|
+
* by position; top to bottom (with slight LTR or RTL bias).
|
|
322
|
+
* @param {boolean} ordered Sort the list if true.
|
|
323
|
+
* @return {!Array.<!Blockly.Block>} Array of blocks.
|
|
324
|
+
*/
|
|
325
|
+
Blockly.Workspace.prototype.getAllBlocks = function(ordered) {
|
|
326
|
+
if (ordered) {
|
|
327
|
+
// Slow, but ordered.
|
|
328
|
+
var topBlocks = this.getTopBlocks(true);
|
|
329
|
+
var blocks = [];
|
|
330
|
+
for (var i = 0; i < topBlocks.length; i++) {
|
|
331
|
+
blocks.push.apply(blocks, topBlocks[i].getDescendants(true));
|
|
332
|
+
}
|
|
333
|
+
} else {
|
|
334
|
+
// Fast, but in no particular order.
|
|
335
|
+
var blocks = this.getTopBlocks(false);
|
|
336
|
+
for (var i = 0; i < blocks.length; i++) {
|
|
337
|
+
blocks.push.apply(blocks, blocks[i].getChildren(false));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Insertion markers exist on the workspace for rendering reasons, but aren't
|
|
342
|
+
// "real" blocks from a developer perspective.
|
|
343
|
+
var filtered = blocks.filter(function(block) {
|
|
344
|
+
return !block.isInsertionMarker();
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
return filtered;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Dispose of all blocks and comments in workspace.
|
|
352
|
+
*/
|
|
353
|
+
Blockly.Workspace.prototype.clear = function() {
|
|
354
|
+
this.isClearing = true;
|
|
355
|
+
try {
|
|
356
|
+
var existingGroup = Blockly.Events.getGroup();
|
|
357
|
+
if (!existingGroup) {
|
|
358
|
+
Blockly.Events.setGroup(true);
|
|
359
|
+
}
|
|
360
|
+
while (this.topBlocks_.length) {
|
|
361
|
+
this.topBlocks_[0].dispose(false);
|
|
362
|
+
}
|
|
363
|
+
while (this.topComments_.length) {
|
|
364
|
+
this.topComments_[this.topComments_.length - 1].dispose(false);
|
|
365
|
+
}
|
|
366
|
+
if (!existingGroup) {
|
|
367
|
+
Blockly.Events.setGroup(false);
|
|
368
|
+
}
|
|
369
|
+
this.variableMap_.clear();
|
|
370
|
+
if (this.potentialVariableMap_) {
|
|
371
|
+
this.potentialVariableMap_.clear();
|
|
372
|
+
}
|
|
373
|
+
} finally {
|
|
374
|
+
this.isClearing = false;
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
/* Begin functions that are just pass-throughs to the variable map. */
|
|
379
|
+
/**
|
|
380
|
+
* Rename a variable by updating its name in the variable map. Identify the
|
|
381
|
+
* variable to rename with the given ID.
|
|
382
|
+
* @param {string} id ID of the variable to rename.
|
|
383
|
+
* @param {string} newName New variable name.
|
|
384
|
+
*/
|
|
385
|
+
Blockly.Workspace.prototype.renameVariableById = function(id, newName) {
|
|
386
|
+
this.variableMap_.renameVariableById(id, newName);
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Create a variable with a given name, optional type, and optional ID.
|
|
391
|
+
* @param {string} name The name of the variable. This must be unique across
|
|
392
|
+
* variables and procedures.
|
|
393
|
+
* @param {?string=} opt_type The type of the variable like 'int' or 'string'.
|
|
394
|
+
* Does not need to be unique. Field_variable can filter variables based on
|
|
395
|
+
* their type. This will default to '' which is a specific type.
|
|
396
|
+
* @param {?string=} opt_id The unique ID of the variable. This will default to
|
|
397
|
+
* a UUID.
|
|
398
|
+
* @return {!Blockly.VariableModel} The newly created variable.
|
|
399
|
+
*/
|
|
400
|
+
Blockly.Workspace.prototype.createVariable = function(name, opt_type, opt_id) {
|
|
401
|
+
return this.variableMap_.createVariable(name, opt_type, opt_id);
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Find all the uses of the given variable, which is identified by ID.
|
|
406
|
+
* @param {string} id ID of the variable to find.
|
|
407
|
+
* @return {!Array.<!Blockly.Block>} Array of block usages.
|
|
408
|
+
*/
|
|
409
|
+
Blockly.Workspace.prototype.getVariableUsesById = function(id) {
|
|
410
|
+
return this.variableMap_.getVariableUsesById(id);
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Delete a variables by the passed in ID and all of its uses from this
|
|
415
|
+
* workspace. May prompt the user for confirmation.
|
|
416
|
+
* @param {string} id ID of variable to delete.
|
|
417
|
+
*/
|
|
418
|
+
Blockly.Workspace.prototype.deleteVariableById = function(id) {
|
|
419
|
+
this.variableMap_.deleteVariableById(id);
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Find the variable by the given name and return it. Return null if it is not
|
|
424
|
+
* found.
|
|
425
|
+
* @param {string} name The name to check for.
|
|
426
|
+
* @param {string=} opt_type The type of the variable. If not provided it
|
|
427
|
+
* defaults to the empty string, which is a specific type.
|
|
428
|
+
* @return {Blockly.VariableModel} The variable with the given name.
|
|
429
|
+
*/
|
|
430
|
+
// TODO (#1559): Possibly delete this function after resolving #1559.
|
|
431
|
+
Blockly.Workspace.prototype.getVariable = function(name, opt_type) {
|
|
432
|
+
return this.variableMap_.getVariable(name, opt_type);
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Find the variable by the given ID and return it. Return null if it is not
|
|
437
|
+
* found.
|
|
438
|
+
* @param {string} id The ID to check for.
|
|
439
|
+
* @return {Blockly.VariableModel} The variable with the given ID.
|
|
440
|
+
*/
|
|
441
|
+
Blockly.Workspace.prototype.getVariableById = function(id) {
|
|
442
|
+
return this.variableMap_.getVariableById(id);
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Find the variable with the specified type. If type is null, return list of
|
|
447
|
+
* variables with empty string type.
|
|
448
|
+
* @param {?string} type Type of the variables to find.
|
|
449
|
+
* @return {!Array.<!Blockly.VariableModel>} The sought after variables of the
|
|
450
|
+
* passed in type. An empty array if none are found.
|
|
451
|
+
*/
|
|
452
|
+
Blockly.Workspace.prototype.getVariablesOfType = function(type) {
|
|
453
|
+
return this.variableMap_.getVariablesOfType(type);
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Return all variable types.
|
|
458
|
+
* @return {!Array.<string>} List of variable types.
|
|
459
|
+
* @package
|
|
460
|
+
*/
|
|
461
|
+
Blockly.Workspace.prototype.getVariableTypes = function() {
|
|
462
|
+
return this.variableMap_.getVariableTypes(this);
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Return all variables of all types.
|
|
467
|
+
* @return {!Array.<!Blockly.VariableModel>} List of variable models.
|
|
468
|
+
*/
|
|
469
|
+
Blockly.Workspace.prototype.getAllVariables = function() {
|
|
470
|
+
return this.variableMap_.getAllVariables();
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Returns all variable names of all types.
|
|
475
|
+
* @return {!Array.<string>} List of all variable names of all types.
|
|
476
|
+
*/
|
|
477
|
+
Blockly.Workspace.prototype.getAllVariableNames = function() {
|
|
478
|
+
return this.variableMap_.getAllVariableNames();
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
/* End functions that are just pass-throughs to the variable map. */
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Returns the horizontal offset of the workspace.
|
|
485
|
+
* Intended for LTR/RTL compatibility in XML.
|
|
486
|
+
* Not relevant for a headless workspace.
|
|
487
|
+
* @return {number} Width.
|
|
488
|
+
*/
|
|
489
|
+
Blockly.Workspace.prototype.getWidth = function() {
|
|
490
|
+
return 0;
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Obtain a newly created block.
|
|
495
|
+
* @param {!string} prototypeName Name of the language object containing
|
|
496
|
+
* type-specific functions for this block.
|
|
497
|
+
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
|
|
498
|
+
* create a new ID.
|
|
499
|
+
* @return {!Blockly.Block} The created block.
|
|
500
|
+
*/
|
|
501
|
+
Blockly.Workspace.prototype.newBlock = function(prototypeName, opt_id) {
|
|
502
|
+
return new Blockly.Block(this, prototypeName, opt_id);
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* The number of blocks that may be added to the workspace before reaching
|
|
507
|
+
* the maxBlocks.
|
|
508
|
+
* @return {number} Number of blocks left.
|
|
509
|
+
*/
|
|
510
|
+
Blockly.Workspace.prototype.remainingCapacity = function() {
|
|
511
|
+
if (isNaN(this.options.maxBlocks)) {
|
|
512
|
+
return Infinity;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
return this.options.maxBlocks - this.getAllBlocks(false).length;
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* The number of blocks of the given type that may be added to the workspace
|
|
520
|
+
* before reaching the maxInstances allowed for that type.
|
|
521
|
+
* @param {string} type Type of block to return capacity for.
|
|
522
|
+
* @return {number} Number of blocks of type left.
|
|
523
|
+
*/
|
|
524
|
+
Blockly.Workspace.prototype.remainingCapacityOfType = function(type) {
|
|
525
|
+
if (!this.options.maxInstances) {
|
|
526
|
+
return Infinity;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
var maxInstanceOfType = (this.options.maxInstances[type] !== undefined) ?
|
|
530
|
+
this.options.maxInstances[type] : Infinity;
|
|
531
|
+
|
|
532
|
+
return maxInstanceOfType - this.getBlocksByType(type, false).length;
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Check if there is remaining capacity for blocks of the given counts to be
|
|
537
|
+
* created. If the total number of blocks represented by the map is more than
|
|
538
|
+
* the total remaining capacity, it returns false. If a type count is more
|
|
539
|
+
* than the remaining capacity for that type, it returns false.
|
|
540
|
+
* @param {!Object} typeCountsMap A map of types to counts (usually representing
|
|
541
|
+
* blocks to be created).
|
|
542
|
+
* @return {boolean} True if there is capacity for the given map,
|
|
543
|
+
* false otherwise.
|
|
544
|
+
*/
|
|
545
|
+
Blockly.Workspace.prototype.isCapacityAvailable = function(typeCountsMap) {
|
|
546
|
+
if (!this.hasBlockLimits()) {
|
|
547
|
+
return true;
|
|
548
|
+
}
|
|
549
|
+
var copyableBlocksCount = 0;
|
|
550
|
+
for (var type in typeCountsMap) {
|
|
551
|
+
if (typeCountsMap[type] > this.remainingCapacityOfType(type)) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
copyableBlocksCount += typeCountsMap[type];
|
|
555
|
+
}
|
|
556
|
+
if (copyableBlocksCount > this.remainingCapacity()) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
return true;
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Checks if the workspace has any limits on the maximum number of blocks,
|
|
564
|
+
* or the maximum number of blocks of specific types.
|
|
565
|
+
* @return {boolean} True if it has block limits, false otherwise.
|
|
566
|
+
*/
|
|
567
|
+
Blockly.Workspace.prototype.hasBlockLimits = function() {
|
|
568
|
+
return this.options.maxBlocks != Infinity || !!this.options.maxInstances;
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Gets the undo stack for workplace.
|
|
573
|
+
* @return {!Array.<!Blockly.Events.Abstract>} undo stack
|
|
574
|
+
* @package
|
|
575
|
+
*/
|
|
576
|
+
Blockly.Workspace.prototype.getUndoStack = function() {
|
|
577
|
+
return this.undoStack_;
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Gets the redo stack for workplace.
|
|
582
|
+
* @return {!Array.<!Blockly.Events.Abstract>} redo stack
|
|
583
|
+
* @package
|
|
584
|
+
*/
|
|
585
|
+
Blockly.Workspace.prototype.getRedoStack = function() {
|
|
586
|
+
return this.redoStack_;
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Undo or redo the previous action.
|
|
591
|
+
* @param {boolean} redo False if undo, true if redo.
|
|
592
|
+
*/
|
|
593
|
+
Blockly.Workspace.prototype.undo = function(redo) {
|
|
594
|
+
var inputStack = redo ? this.redoStack_ : this.undoStack_;
|
|
595
|
+
var outputStack = redo ? this.undoStack_ : this.redoStack_;
|
|
596
|
+
var inputEvent = inputStack.pop();
|
|
597
|
+
if (!inputEvent) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
var events = [inputEvent];
|
|
601
|
+
// Do another undo/redo if the next one is of the same group.
|
|
602
|
+
while (inputStack.length && inputEvent.group &&
|
|
603
|
+
inputEvent.group == inputStack[inputStack.length - 1].group) {
|
|
604
|
+
events.push(inputStack.pop());
|
|
605
|
+
}
|
|
606
|
+
// Push these popped events on the opposite stack.
|
|
607
|
+
for (var i = 0, event; (event = events[i]); i++) {
|
|
608
|
+
outputStack.push(event);
|
|
609
|
+
}
|
|
610
|
+
events = Blockly.Events.filter(events, redo);
|
|
611
|
+
Blockly.Events.recordUndo = false;
|
|
612
|
+
try {
|
|
613
|
+
for (var i = 0, event; (event = events[i]); i++) {
|
|
614
|
+
event.run(redo);
|
|
615
|
+
}
|
|
616
|
+
} finally {
|
|
617
|
+
Blockly.Events.recordUndo = true;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Clear the undo/redo stacks.
|
|
623
|
+
*/
|
|
624
|
+
Blockly.Workspace.prototype.clearUndo = function() {
|
|
625
|
+
this.undoStack_.length = 0;
|
|
626
|
+
this.redoStack_.length = 0;
|
|
627
|
+
// Stop any events already in the firing queue from being undoable.
|
|
628
|
+
Blockly.Events.clearPendingUndo();
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* When something in this workspace changes, call a function.
|
|
633
|
+
* Note that there may be a few recent events already on the stack. Thus the
|
|
634
|
+
* new change listener might be called with events that occurred a few
|
|
635
|
+
* milliseconds before the change listener was added.
|
|
636
|
+
* @param {!Function} func Function to call.
|
|
637
|
+
* @return {!Function} Obsolete return value, ignore.
|
|
638
|
+
*/
|
|
639
|
+
Blockly.Workspace.prototype.addChangeListener = function(func) {
|
|
640
|
+
this.listeners_.push(func);
|
|
641
|
+
return func;
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Stop listening for this workspace's changes.
|
|
646
|
+
* @param {Function} func Function to stop calling.
|
|
647
|
+
*/
|
|
648
|
+
Blockly.Workspace.prototype.removeChangeListener = function(func) {
|
|
649
|
+
Blockly.utils.arrayRemove(this.listeners_, func);
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Fire a change event.
|
|
654
|
+
* @param {!Blockly.Events.Abstract} event Event to fire.
|
|
655
|
+
*/
|
|
656
|
+
Blockly.Workspace.prototype.fireChangeListener = function(event) {
|
|
657
|
+
if (event.recordUndo) {
|
|
658
|
+
this.undoStack_.push(event);
|
|
659
|
+
this.redoStack_.length = 0;
|
|
660
|
+
while (this.undoStack_.length > this.MAX_UNDO && this.MAX_UNDO >= 0) {
|
|
661
|
+
this.undoStack_.shift();
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
for (var i = 0, func; (func = this.listeners_[i]); i++) {
|
|
665
|
+
func(event);
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Find the block on this workspace with the specified ID.
|
|
671
|
+
* @param {string} id ID of block to find.
|
|
672
|
+
* @return {Blockly.Block} The sought after block, or null if not found.
|
|
673
|
+
*/
|
|
674
|
+
Blockly.Workspace.prototype.getBlockById = function(id) {
|
|
675
|
+
return this.blockDB_[id] || null;
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Set a block on this workspace with the specified ID.
|
|
680
|
+
* @param {string} id ID of block to set.
|
|
681
|
+
* @param {Blockly.Block} block The block to set.
|
|
682
|
+
* @package
|
|
683
|
+
*/
|
|
684
|
+
Blockly.Workspace.prototype.setBlockById = function(id, block) {
|
|
685
|
+
this.blockDB_[id] = block;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Delete a block off this workspace with the specified ID.
|
|
690
|
+
* @param {string} id ID of block to delete.
|
|
691
|
+
* @package
|
|
692
|
+
*/
|
|
693
|
+
Blockly.Workspace.prototype.removeBlockById = function(id) {
|
|
694
|
+
delete this.blockDB_[id];
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Find the comment on this workspace with the specified ID.
|
|
699
|
+
* @param {string} id ID of comment to find.
|
|
700
|
+
* @return {Blockly.WorkspaceComment} The sought after comment, or null if not
|
|
701
|
+
* found.
|
|
702
|
+
* @package
|
|
703
|
+
*/
|
|
704
|
+
Blockly.Workspace.prototype.getCommentById = function(id) {
|
|
705
|
+
return this.commentDB_[id] || null;
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Checks whether all value and statement inputs in the workspace are filled
|
|
710
|
+
* with blocks.
|
|
711
|
+
* @param {boolean=} opt_shadowBlocksAreFilled An optional argument controlling
|
|
712
|
+
* whether shadow blocks are counted as filled. Defaults to true.
|
|
713
|
+
* @return {boolean} True if all inputs are filled, false otherwise.
|
|
714
|
+
*/
|
|
715
|
+
Blockly.Workspace.prototype.allInputsFilled = function(
|
|
716
|
+
opt_shadowBlocksAreFilled) {
|
|
717
|
+
var blocks = this.getTopBlocks(false);
|
|
718
|
+
for (var i = 0, block; (block = blocks[i]); i++) {
|
|
719
|
+
if (!block.allInputsFilled(opt_shadowBlocksAreFilled)) {
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
return true;
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Return the variable map that contains "potential" variables.
|
|
728
|
+
* These exist in the flyout but not in the workspace.
|
|
729
|
+
* @return {Blockly.VariableMap} The potential variable map.
|
|
730
|
+
* @package
|
|
731
|
+
*/
|
|
732
|
+
Blockly.Workspace.prototype.getPotentialVariableMap = function() {
|
|
733
|
+
return this.potentialVariableMap_;
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Create and store the potential variable map for this workspace.
|
|
738
|
+
* @package
|
|
739
|
+
*/
|
|
740
|
+
Blockly.Workspace.prototype.createPotentialVariableMap = function() {
|
|
741
|
+
this.potentialVariableMap_ = new Blockly.VariableMap(this);
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Return the map of all variables on the workspace.
|
|
746
|
+
* @return {!Blockly.VariableMap} The variable map.
|
|
747
|
+
*/
|
|
748
|
+
Blockly.Workspace.prototype.getVariableMap = function() {
|
|
749
|
+
return this.variableMap_;
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Set the map of all variables on the workspace.
|
|
754
|
+
* @param {!Blockly.VariableMap} variableMap The variable map.
|
|
755
|
+
* @package
|
|
756
|
+
*/
|
|
757
|
+
Blockly.Workspace.prototype.setVariableMap = function(variableMap) {
|
|
758
|
+
this.variableMap_ = variableMap;
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Database of all workspaces.
|
|
763
|
+
* @private
|
|
764
|
+
*/
|
|
765
|
+
Blockly.Workspace.WorkspaceDB_ = Object.create(null);
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Find the workspace with the specified ID.
|
|
769
|
+
* @param {string} id ID of workspace to find.
|
|
770
|
+
* @return {Blockly.Workspace} The sought after workspace or null if not found.
|
|
771
|
+
*/
|
|
772
|
+
Blockly.Workspace.getById = function(id) {
|
|
773
|
+
return Blockly.Workspace.WorkspaceDB_[id] || null;
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Find all workspaces.
|
|
778
|
+
* @return {!Array.<!Blockly.Workspace>} Array of workspaces.
|
|
779
|
+
*/
|
|
780
|
+
Blockly.Workspace.getAll = function() {
|
|
781
|
+
var workspaces = [];
|
|
782
|
+
for (var workspaceId in Blockly.Workspace.WorkspaceDB_) {
|
|
783
|
+
workspaces.push(Blockly.Workspace.WorkspaceDB_[workspaceId]);
|
|
784
|
+
}
|
|
785
|
+
return workspaces;
|
|
786
|
+
};
|