nodeskini 1.0.1 → 1.0.2
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 +3 -3
|
@@ -0,0 +1,984 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Toolbox from whence to create blocks.
|
|
9
|
+
* @author fraser@google.com (Neil Fraser)
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
goog.provide('Blockly.Toolbox');
|
|
14
|
+
|
|
15
|
+
goog.require('Blockly.CollapsibleToolboxCategory');
|
|
16
|
+
goog.require('Blockly.Css');
|
|
17
|
+
goog.require('Blockly.Events');
|
|
18
|
+
goog.require('Blockly.Events.Ui');
|
|
19
|
+
goog.require('Blockly.navigation');
|
|
20
|
+
goog.require('Blockly.registry');
|
|
21
|
+
goog.require('Blockly.Touch');
|
|
22
|
+
goog.require('Blockly.utils');
|
|
23
|
+
goog.require('Blockly.utils.aria');
|
|
24
|
+
goog.require('Blockly.utils.dom');
|
|
25
|
+
goog.require('Blockly.utils.Rect');
|
|
26
|
+
goog.require('Blockly.utils.toolbox');
|
|
27
|
+
|
|
28
|
+
goog.requireType('Blockly.Action');
|
|
29
|
+
goog.requireType('Blockly.IBlocklyActionable');
|
|
30
|
+
goog.requireType('Blockly.ICollapsibleToolboxItem');
|
|
31
|
+
goog.requireType('Blockly.IDeleteArea');
|
|
32
|
+
goog.requireType('Blockly.IFlyout');
|
|
33
|
+
goog.requireType('Blockly.ISelectableToolboxItem');
|
|
34
|
+
goog.requireType('Blockly.IStyleable');
|
|
35
|
+
goog.requireType('Blockly.IToolbox');
|
|
36
|
+
goog.requireType('Blockly.IToolboxItem');
|
|
37
|
+
goog.requireType('Blockly.WorkspaceSvg');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Class for a Toolbox.
|
|
42
|
+
* Creates the toolbox's DOM.
|
|
43
|
+
* @param {!Blockly.WorkspaceSvg} workspace The workspace in which to create new
|
|
44
|
+
* blocks.
|
|
45
|
+
* @constructor
|
|
46
|
+
* @implements {Blockly.IBlocklyActionable}
|
|
47
|
+
* @implements {Blockly.IDeleteArea}
|
|
48
|
+
* @implements {Blockly.IStyleable}
|
|
49
|
+
* @implements {Blockly.IToolbox}
|
|
50
|
+
*/
|
|
51
|
+
Blockly.Toolbox = function(workspace) {
|
|
52
|
+
/**
|
|
53
|
+
* The workspace this toolbox is on.
|
|
54
|
+
* @type {!Blockly.WorkspaceSvg}
|
|
55
|
+
* @protected
|
|
56
|
+
*/
|
|
57
|
+
this.workspace_ = workspace;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The JSON describing the contents of this toolbox.
|
|
61
|
+
* @type {!Blockly.utils.toolbox.ToolboxInfo}
|
|
62
|
+
* @protected
|
|
63
|
+
*/
|
|
64
|
+
this.toolboxDef_ = workspace.options.languageTree || {'contents': []};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Whether the toolbox should be laid out horizontally.
|
|
68
|
+
* @type {boolean}
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
this.horizontalLayout_ = workspace.options.horizontalLayout;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The html container for the toolbox.
|
|
75
|
+
* @type {?Element}
|
|
76
|
+
*/
|
|
77
|
+
this.HtmlDiv = null;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The html container for the contents of a toolbox.
|
|
81
|
+
* @type {?Element}
|
|
82
|
+
* @protected
|
|
83
|
+
*/
|
|
84
|
+
this.contentsDiv_ = null;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The list of items in the toolbox.
|
|
88
|
+
* @type {!Array<!Blockly.IToolboxItem>}
|
|
89
|
+
* @protected
|
|
90
|
+
*/
|
|
91
|
+
this.contents_ = [];
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The width of the toolbox.
|
|
95
|
+
* @type {number}
|
|
96
|
+
* @protected
|
|
97
|
+
*/
|
|
98
|
+
this.width_ = 0;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The height of the toolbox.
|
|
102
|
+
* @type {number}
|
|
103
|
+
* @protected
|
|
104
|
+
*/
|
|
105
|
+
this.height_ = 0;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Is RTL vs LTR.
|
|
109
|
+
* @type {boolean}
|
|
110
|
+
*/
|
|
111
|
+
this.RTL = workspace.options.RTL;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The flyout for the toolbox.
|
|
115
|
+
* @type {?Blockly.IFlyout}
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
this.flyout_ = null;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A map from toolbox item IDs to toolbox items.
|
|
122
|
+
* @type {!Object<string, Blockly.IToolboxItem>}
|
|
123
|
+
* @protected
|
|
124
|
+
*/
|
|
125
|
+
this.contentMap_ = {};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Position of the toolbox and flyout relative to the workspace.
|
|
129
|
+
* @type {!Blockly.utils.toolbox.Position}
|
|
130
|
+
*/
|
|
131
|
+
this.toolboxPosition = workspace.options.toolboxPosition;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The currently selected item.
|
|
135
|
+
* @type {?Blockly.ISelectableToolboxItem}
|
|
136
|
+
* @protected
|
|
137
|
+
*/
|
|
138
|
+
this.selectedItem_ = null;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The previously selected item.
|
|
142
|
+
* @type {?Blockly.ISelectableToolboxItem}
|
|
143
|
+
* @protected
|
|
144
|
+
*/
|
|
145
|
+
this.previouslySelectedItem_ = null;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Array holding info needed to unbind event handlers.
|
|
149
|
+
* Used for disposing.
|
|
150
|
+
* Ex: [[node, name, func], [node, name, func]].
|
|
151
|
+
* @type {!Array<!Blockly.EventData>}
|
|
152
|
+
* @protected
|
|
153
|
+
*/
|
|
154
|
+
this.boundEvents_ = [];
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Initializes the toolbox
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
Blockly.Toolbox.prototype.init = function() {
|
|
162
|
+
var workspace = this.workspace_;
|
|
163
|
+
var svg = workspace.getParentSvg();
|
|
164
|
+
|
|
165
|
+
this.flyout_ = this.createFlyout_();
|
|
166
|
+
|
|
167
|
+
this.HtmlDiv = this.createDom_(this.workspace_);
|
|
168
|
+
Blockly.utils.dom.insertAfter(this.flyout_.createDom('svg'), svg);
|
|
169
|
+
this.flyout_.init(workspace);
|
|
170
|
+
|
|
171
|
+
this.render(this.toolboxDef_);
|
|
172
|
+
var themeManager = workspace.getThemeManager();
|
|
173
|
+
themeManager.subscribe(this.HtmlDiv, 'toolboxBackgroundColour',
|
|
174
|
+
'background-color');
|
|
175
|
+
themeManager.subscribe(this.HtmlDiv, 'toolboxForegroundColour', 'color');
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Creates the dom for the toolbox.
|
|
180
|
+
* @param {!Blockly.WorkspaceSvg} workspace The workspace this toolbox is on.
|
|
181
|
+
* @return {!Element} The html container for the toolbox.
|
|
182
|
+
* @protected
|
|
183
|
+
*/
|
|
184
|
+
Blockly.Toolbox.prototype.createDom_ = function(workspace) {
|
|
185
|
+
var svg = workspace.getParentSvg();
|
|
186
|
+
|
|
187
|
+
var container = this.createContainer_();
|
|
188
|
+
|
|
189
|
+
this.contentsDiv_ = this.createContentsContainer_();
|
|
190
|
+
this.contentsDiv_.tabIndex = 0;
|
|
191
|
+
Blockly.utils.aria.setRole(this.contentsDiv_, Blockly.utils.aria.Role.TREE);
|
|
192
|
+
container.appendChild(this.contentsDiv_);
|
|
193
|
+
|
|
194
|
+
svg.parentNode.insertBefore(container, svg);
|
|
195
|
+
|
|
196
|
+
this.attachEvents_(container, this.contentsDiv_);
|
|
197
|
+
return container;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Creates the container div for the toolbox.
|
|
202
|
+
* @return {!Element} The html container for the toolbox.
|
|
203
|
+
* @protected
|
|
204
|
+
*/
|
|
205
|
+
Blockly.Toolbox.prototype.createContainer_ = function() {
|
|
206
|
+
var toolboxContainer = document.createElement('div');
|
|
207
|
+
toolboxContainer.setAttribute('layout', this.isHorizontal() ? 'h' : 'v');
|
|
208
|
+
Blockly.utils.dom.addClass(toolboxContainer, 'blocklyToolboxDiv');
|
|
209
|
+
Blockly.utils.dom.addClass(toolboxContainer, 'blocklyNonSelectable');
|
|
210
|
+
toolboxContainer.setAttribute('dir', this.RTL ? 'RTL' : 'LTR');
|
|
211
|
+
return toolboxContainer;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Creates the container for all the contents in the toolbox.
|
|
216
|
+
* @return {!Element} The html container for the toolbox contents.
|
|
217
|
+
* @protected
|
|
218
|
+
*/
|
|
219
|
+
Blockly.Toolbox.prototype.createContentsContainer_ = function() {
|
|
220
|
+
var contentsContainer = document.createElement('div');
|
|
221
|
+
Blockly.utils.dom.addClass(contentsContainer, 'blocklyToolboxContents');
|
|
222
|
+
if (this.isHorizontal()) {
|
|
223
|
+
contentsContainer.style.flexDirection = 'row';
|
|
224
|
+
}
|
|
225
|
+
return contentsContainer;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Adds event listeners to the toolbox container div.
|
|
230
|
+
* @param {!Element} container The html container for the toolbox.
|
|
231
|
+
* @param {!Element} contentsContainer The html container for the contents
|
|
232
|
+
* of the toolbox.
|
|
233
|
+
* @protected
|
|
234
|
+
*/
|
|
235
|
+
Blockly.Toolbox.prototype.attachEvents_ = function(container,
|
|
236
|
+
contentsContainer) {
|
|
237
|
+
// Clicking on toolbox closes popups.
|
|
238
|
+
var clickEvent = Blockly.bindEventWithChecks_(container, 'mousedown', this,
|
|
239
|
+
this.onClick_, /* opt_noCaptureIdentifier */ false,
|
|
240
|
+
/* opt_noPreventDefault */ true);
|
|
241
|
+
this.boundEvents_.push(clickEvent);
|
|
242
|
+
|
|
243
|
+
var keyDownEvent = Blockly.bindEventWithChecks_(contentsContainer, 'keydown',
|
|
244
|
+
this, this.onKeyDown_, /* opt_noCaptureIdentifier */ false,
|
|
245
|
+
/* opt_noPreventDefault */ true);
|
|
246
|
+
this.boundEvents_.push(keyDownEvent);
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Handles on click events for when the toolbox or toolbox items are clicked.
|
|
251
|
+
* @param {!Event} e Click event to handle.
|
|
252
|
+
* @protected
|
|
253
|
+
*/
|
|
254
|
+
Blockly.Toolbox.prototype.onClick_ = function(e) {
|
|
255
|
+
if (Blockly.utils.isRightButton(e) || e.target == this.HtmlDiv) {
|
|
256
|
+
// Close flyout.
|
|
257
|
+
Blockly.hideChaff(false);
|
|
258
|
+
} else {
|
|
259
|
+
var srcElement = e.srcElement;
|
|
260
|
+
var itemId = srcElement.getAttribute('id');
|
|
261
|
+
if (itemId) {
|
|
262
|
+
var item = this.getToolboxItemById(itemId);
|
|
263
|
+
if (item.isSelectable()) {
|
|
264
|
+
this.setSelectedItem(item);
|
|
265
|
+
item.onClick(e);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// Just close popups.
|
|
269
|
+
Blockly.hideChaff(true);
|
|
270
|
+
}
|
|
271
|
+
Blockly.Touch.clearTouchIdentifier(); // Don't block future drags.
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Handles key down events for the toolbox.
|
|
276
|
+
* @param {!KeyboardEvent} e The key down event.
|
|
277
|
+
* @protected
|
|
278
|
+
*/
|
|
279
|
+
Blockly.Toolbox.prototype.onKeyDown_ = function(e) {
|
|
280
|
+
var handled = false;
|
|
281
|
+
switch (e.keyCode) {
|
|
282
|
+
case Blockly.utils.KeyCodes.DOWN:
|
|
283
|
+
handled = this.selectNext_();
|
|
284
|
+
break;
|
|
285
|
+
case Blockly.utils.KeyCodes.UP:
|
|
286
|
+
handled = this.selectPrevious_();
|
|
287
|
+
break;
|
|
288
|
+
case Blockly.utils.KeyCodes.LEFT:
|
|
289
|
+
handled = this.selectParent_();
|
|
290
|
+
break;
|
|
291
|
+
case Blockly.utils.KeyCodes.RIGHT:
|
|
292
|
+
handled = this.selectChild_();
|
|
293
|
+
break;
|
|
294
|
+
case Blockly.utils.KeyCodes.ENTER:
|
|
295
|
+
case Blockly.utils.KeyCodes.SPACE:
|
|
296
|
+
if (this.selectedItem_ && this.selectedItem_.isCollapsible()) {
|
|
297
|
+
var collapsibleItem = /** @type {!Blockly.ICollapsibleToolboxItem} */ (this.selectedItem_);
|
|
298
|
+
collapsibleItem.toggleExpanded();
|
|
299
|
+
handled = true;
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
default:
|
|
303
|
+
handled = false;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (handled) {
|
|
308
|
+
e.preventDefault();
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Creates the flyout based on the toolbox layout.
|
|
314
|
+
* @return {!Blockly.IFlyout} The flyout for the toolbox.
|
|
315
|
+
* @throws {Error} If missing a require for `Blockly.HorizontalFlyout`,
|
|
316
|
+
* `Blockly.VerticalFlyout`, and no flyout plugin is specified.
|
|
317
|
+
* @protected
|
|
318
|
+
*/
|
|
319
|
+
Blockly.Toolbox.prototype.createFlyout_ = function() {
|
|
320
|
+
var workspace = this.workspace_;
|
|
321
|
+
// TODO (#4247): Look into adding a makeFlyout method to Blockly Options.
|
|
322
|
+
var workspaceOptions = new Blockly.Options(
|
|
323
|
+
/** @type {!Blockly.BlocklyOptions} */
|
|
324
|
+
({
|
|
325
|
+
'parentWorkspace': workspace,
|
|
326
|
+
'rtl': workspace.RTL,
|
|
327
|
+
'oneBasedIndex': workspace.options.oneBasedIndex,
|
|
328
|
+
'horizontalLayout': workspace.horizontalLayout,
|
|
329
|
+
'renderer': workspace.options.renderer,
|
|
330
|
+
'rendererOverrides': workspace.options.rendererOverrides
|
|
331
|
+
}));
|
|
332
|
+
// Options takes in either 'end' or 'start'. This has already been parsed to
|
|
333
|
+
// be either 0 or 1, so set it after.
|
|
334
|
+
workspaceOptions.toolboxPosition = workspace.options.toolboxPosition;
|
|
335
|
+
var FlyoutClass = null;
|
|
336
|
+
if (workspace.horizontalLayout) {
|
|
337
|
+
FlyoutClass = Blockly.registry.getClassFromOptions(
|
|
338
|
+
Blockly.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, workspace.options);
|
|
339
|
+
} else {
|
|
340
|
+
FlyoutClass = Blockly.registry.getClassFromOptions(
|
|
341
|
+
Blockly.registry.Type.FLYOUTS_VERTICAL_TOOLBOX, workspace.options);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (!FlyoutClass) {
|
|
345
|
+
throw new Error('Blockly.VerticalFlyout, Blockly.HorizontalFlyout or your own' +
|
|
346
|
+
' custom flyout must be required.');
|
|
347
|
+
}
|
|
348
|
+
return new FlyoutClass(workspaceOptions);
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Fills the toolbox with new toolbox items and removes any old contents.
|
|
353
|
+
* @param {!Blockly.utils.toolbox.ToolboxInfo} toolboxDef Object holding information
|
|
354
|
+
* for creating a toolbox.
|
|
355
|
+
* @package
|
|
356
|
+
*/
|
|
357
|
+
Blockly.Toolbox.prototype.render = function(toolboxDef) {
|
|
358
|
+
this.toolboxDef_ = toolboxDef;
|
|
359
|
+
for (var i = 0; i < this.contents_.length; i++) {
|
|
360
|
+
var toolboxItem = this.contents_[i];
|
|
361
|
+
if (toolboxItem) {
|
|
362
|
+
toolboxItem.dispose();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
this.contents_ = [];
|
|
366
|
+
this.contentMap_ = {};
|
|
367
|
+
this.renderContents_(toolboxDef['contents']);
|
|
368
|
+
this.position();
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Adds all the toolbox items to the toolbox.
|
|
373
|
+
* @param {!Array<!Blockly.utils.toolbox.ToolboxItemInfo>} toolboxDef Array
|
|
374
|
+
* holding objects containing information on the contents of the toolbox.
|
|
375
|
+
* @protected
|
|
376
|
+
*/
|
|
377
|
+
Blockly.Toolbox.prototype.renderContents_ = function(toolboxDef) {
|
|
378
|
+
// This is for performance reasons. By using document fragment we only have to
|
|
379
|
+
// add to the dom once.
|
|
380
|
+
var fragment = document.createDocumentFragment();
|
|
381
|
+
for (var i = 0, toolboxItemDef; (toolboxItemDef = toolboxDef[i]); i++) {
|
|
382
|
+
this.createToolboxItem_(toolboxItemDef, fragment);
|
|
383
|
+
}
|
|
384
|
+
this.contentsDiv_.appendChild(fragment);
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Creates and renders the toolbox item.
|
|
389
|
+
* @param {Blockly.utils.toolbox.ToolboxItemInfo} toolboxItemDef Any information
|
|
390
|
+
* that can be used to create an item in the toolbox.
|
|
391
|
+
* @param {!DocumentFragment} fragment The document fragment to add the child
|
|
392
|
+
* toolbox elements to.
|
|
393
|
+
* @private
|
|
394
|
+
*/
|
|
395
|
+
Blockly.Toolbox.prototype.createToolboxItem_ = function(toolboxItemDef, fragment) {
|
|
396
|
+
var registryName = toolboxItemDef['kind'];
|
|
397
|
+
|
|
398
|
+
// Categories that are collapsible are created using a class registered under
|
|
399
|
+
// a diffferent name.
|
|
400
|
+
if (registryName.toUpperCase() == 'CATEGORY' &&
|
|
401
|
+
Blockly.utils.toolbox.isCategoryCollapsible(
|
|
402
|
+
/** @type {!Blockly.utils.toolbox.CategoryInfo} */(toolboxItemDef))) {
|
|
403
|
+
registryName = Blockly.CollapsibleToolboxCategory.registrationName;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
var ToolboxItemClass = Blockly.registry.getClass(
|
|
407
|
+
Blockly.registry.Type.TOOLBOX_ITEM, registryName.toLowerCase());
|
|
408
|
+
if (ToolboxItemClass) {
|
|
409
|
+
var toolboxItem = new ToolboxItemClass(toolboxItemDef, this);
|
|
410
|
+
this.addToolboxItem_(toolboxItem);
|
|
411
|
+
toolboxItem.init();
|
|
412
|
+
var toolboxItemDom = toolboxItem.getDiv();
|
|
413
|
+
if (toolboxItemDom) {
|
|
414
|
+
fragment.appendChild(toolboxItemDom);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Adds an item to the toolbox.
|
|
421
|
+
* @param {!Blockly.IToolboxItem} toolboxItem The item in the toolbox.
|
|
422
|
+
* @protected
|
|
423
|
+
*/
|
|
424
|
+
Blockly.Toolbox.prototype.addToolboxItem_ = function(toolboxItem) {
|
|
425
|
+
this.contents_.push(toolboxItem);
|
|
426
|
+
this.contentMap_[toolboxItem.getId()] = toolboxItem;
|
|
427
|
+
if (toolboxItem.isCollapsible()) {
|
|
428
|
+
var collapsibleItem = /** @type {Blockly.ICollapsibleToolboxItem} */
|
|
429
|
+
(toolboxItem);
|
|
430
|
+
for (var i = 0, child; (child = collapsibleItem.getChildToolboxItems()[i]); i++) {
|
|
431
|
+
this.addToolboxItem_(child);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Gets the items in the toolbox.
|
|
438
|
+
* @return {!Array<!Blockly.IToolboxItem>} The list of items in the toolbox.
|
|
439
|
+
* @public
|
|
440
|
+
*/
|
|
441
|
+
Blockly.Toolbox.prototype.getToolboxItems = function() {
|
|
442
|
+
return this.contents_;
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Adds a style on the toolbox. Usually used to change the cursor.
|
|
447
|
+
* @param {string} style The name of the class to add.
|
|
448
|
+
* @package
|
|
449
|
+
*/
|
|
450
|
+
Blockly.Toolbox.prototype.addStyle = function(style) {
|
|
451
|
+
Blockly.utils.dom.addClass(/** @type {!Element} */ (this.HtmlDiv), style);
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Removes a style from the toolbox. Usually used to change the cursor.
|
|
456
|
+
* @param {string} style The name of the class to remove.
|
|
457
|
+
* @package
|
|
458
|
+
*/
|
|
459
|
+
Blockly.Toolbox.prototype.removeStyle = function(style) {
|
|
460
|
+
Blockly.utils.dom.removeClass(/** @type {!Element} */ (this.HtmlDiv), style);
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Return the deletion rectangle for this toolbox.
|
|
465
|
+
* @return {?Blockly.utils.Rect} Rectangle in which to delete.
|
|
466
|
+
* @public
|
|
467
|
+
*/
|
|
468
|
+
Blockly.Toolbox.prototype.getClientRect = function() {
|
|
469
|
+
if (!this.HtmlDiv) {
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// BIG_NUM is offscreen padding so that blocks dragged beyond the toolbox
|
|
474
|
+
// area are still deleted. Must be smaller than Infinity, but larger than
|
|
475
|
+
// the largest screen size.
|
|
476
|
+
var BIG_NUM = 10000000;
|
|
477
|
+
var toolboxRect = this.HtmlDiv.getBoundingClientRect();
|
|
478
|
+
|
|
479
|
+
var top = toolboxRect.top;
|
|
480
|
+
var bottom = top + toolboxRect.height;
|
|
481
|
+
var left = toolboxRect.left;
|
|
482
|
+
var right = left + toolboxRect.width;
|
|
483
|
+
|
|
484
|
+
// Assumes that the toolbox is on the SVG edge. If this changes
|
|
485
|
+
// (e.g. toolboxes in mutators) then this code will need to be more complex.
|
|
486
|
+
if (this.toolboxPosition == Blockly.utils.toolbox.Position.TOP) {
|
|
487
|
+
return new Blockly.utils.Rect(-BIG_NUM, bottom, -BIG_NUM, BIG_NUM);
|
|
488
|
+
} else if (this.toolboxPosition == Blockly.utils.toolbox.Position.BOTTOM) {
|
|
489
|
+
return new Blockly.utils.Rect(top, BIG_NUM, -BIG_NUM, BIG_NUM);
|
|
490
|
+
} else if (this.toolboxPosition == Blockly.utils.toolbox.Position.LEFT) {
|
|
491
|
+
return new Blockly.utils.Rect(-BIG_NUM, BIG_NUM, -BIG_NUM, right);
|
|
492
|
+
} else { // Right
|
|
493
|
+
return new Blockly.utils.Rect(-BIG_NUM, BIG_NUM, left, BIG_NUM);
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Gets the toolbox item with the given id.
|
|
499
|
+
* @param {string} id The id of the toolbox item.
|
|
500
|
+
* @return {?Blockly.IToolboxItem} The toolbox item with the given id, or null if
|
|
501
|
+
* no item exists.
|
|
502
|
+
* @public
|
|
503
|
+
*/
|
|
504
|
+
Blockly.Toolbox.prototype.getToolboxItemById = function(id) {
|
|
505
|
+
return this.contentMap_[id];
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Gets the width of the toolbox.
|
|
510
|
+
* @return {number} The width of the toolbox.
|
|
511
|
+
* @public
|
|
512
|
+
*/
|
|
513
|
+
Blockly.Toolbox.prototype.getWidth = function() {
|
|
514
|
+
return this.width_;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Gets the height of the toolbox.
|
|
519
|
+
* @return {number} The width of the toolbox.
|
|
520
|
+
* @public
|
|
521
|
+
*/
|
|
522
|
+
Blockly.Toolbox.prototype.getHeight = function() {
|
|
523
|
+
return this.height_;
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Gets the toolbox flyout.
|
|
528
|
+
* @return {?Blockly.IFlyout} The toolbox flyout.
|
|
529
|
+
* @public
|
|
530
|
+
*/
|
|
531
|
+
Blockly.Toolbox.prototype.getFlyout = function() {
|
|
532
|
+
return this.flyout_;
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Gets the workspace for the toolbox.
|
|
537
|
+
* @return {!Blockly.WorkspaceSvg} The parent workspace for the toolbox.
|
|
538
|
+
* @public
|
|
539
|
+
*/
|
|
540
|
+
Blockly.Toolbox.prototype.getWorkspace = function() {
|
|
541
|
+
return this.workspace_;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Gets the selected item.
|
|
546
|
+
* @return {?Blockly.ISelectableToolboxItem} The selected item, or null if no item is
|
|
547
|
+
* currently selected.
|
|
548
|
+
* @public
|
|
549
|
+
*/
|
|
550
|
+
Blockly.Toolbox.prototype.getSelectedItem = function() {
|
|
551
|
+
return this.selectedItem_;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Gets the previously selected item.
|
|
556
|
+
* @return {?Blockly.ISelectableToolboxItem} The previously selected item, or null if no
|
|
557
|
+
* item was previously selected.
|
|
558
|
+
* @public
|
|
559
|
+
*/
|
|
560
|
+
Blockly.Toolbox.prototype.getPreviouslySelectedItem = function() {
|
|
561
|
+
return this.previouslySelectedItem_;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Gets whether or not the toolbox is horizontal.
|
|
566
|
+
* @return {boolean} True if the toolbox is horizontal, false if the toolbox is
|
|
567
|
+
* vertical.
|
|
568
|
+
* @public
|
|
569
|
+
*/
|
|
570
|
+
Blockly.Toolbox.prototype.isHorizontal = function() {
|
|
571
|
+
return this.horizontalLayout_;
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Positions the toolbox based on whether it is a horizontal toolbox and whether
|
|
576
|
+
* the workspace is in rtl.
|
|
577
|
+
* @public
|
|
578
|
+
*/
|
|
579
|
+
Blockly.Toolbox.prototype.position = function() {
|
|
580
|
+
var toolboxDiv = this.HtmlDiv;
|
|
581
|
+
if (!toolboxDiv) {
|
|
582
|
+
// Not initialized yet.
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (this.horizontalLayout_) {
|
|
587
|
+
toolboxDiv.style.left = '0';
|
|
588
|
+
toolboxDiv.style.height = 'auto';
|
|
589
|
+
toolboxDiv.style.width = '100%';
|
|
590
|
+
this.height_ = toolboxDiv.offsetHeight;
|
|
591
|
+
if (this.toolboxPosition == Blockly.TOOLBOX_AT_TOP) { // Top
|
|
592
|
+
toolboxDiv.style.top = '0';
|
|
593
|
+
} else { // Bottom
|
|
594
|
+
toolboxDiv.style.bottom = '0';
|
|
595
|
+
}
|
|
596
|
+
} else {
|
|
597
|
+
if (this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT) { // Right
|
|
598
|
+
toolboxDiv.style.right = '0';
|
|
599
|
+
} else { // Left
|
|
600
|
+
toolboxDiv.style.left = '0';
|
|
601
|
+
}
|
|
602
|
+
toolboxDiv.style.height = '100%';
|
|
603
|
+
this.width_ = toolboxDiv.offsetWidth;
|
|
604
|
+
}
|
|
605
|
+
this.flyout_.position();
|
|
606
|
+
};
|
|
607
|
+
/**
|
|
608
|
+
* Handles resizing the toolbox when a toolbox item resizes.
|
|
609
|
+
* @package
|
|
610
|
+
*/
|
|
611
|
+
Blockly.Toolbox.prototype.handleToolboxItemResize = function() {
|
|
612
|
+
// Reposition the workspace so that (0,0) is in the correct position relative
|
|
613
|
+
// to the new absolute edge (ie toolbox edge).
|
|
614
|
+
var workspace = this.workspace_;
|
|
615
|
+
var rect = this.HtmlDiv.getBoundingClientRect();
|
|
616
|
+
var newX = this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT ?
|
|
617
|
+
workspace.scrollX + rect.width : 0;
|
|
618
|
+
var newY = this.toolboxPosition == Blockly.TOOLBOX_AT_TOP ?
|
|
619
|
+
workspace.scrollY + rect.height : 0;
|
|
620
|
+
workspace.translate(newX, newY);
|
|
621
|
+
|
|
622
|
+
// Even though the div hasn't changed size, the visible workspace
|
|
623
|
+
// surface of the workspace has, so we may need to reposition everything.
|
|
624
|
+
Blockly.svgResize(workspace);
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Unhighlights any previously selected item.
|
|
629
|
+
* @public
|
|
630
|
+
*/
|
|
631
|
+
Blockly.Toolbox.prototype.clearSelection = function() {
|
|
632
|
+
this.setSelectedItem(null);
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Updates the category colours and background colour of selected categories.
|
|
637
|
+
* @package
|
|
638
|
+
*/
|
|
639
|
+
Blockly.Toolbox.prototype.refreshTheme = function() {
|
|
640
|
+
for (var i = 0; i < this.contents_.length; i++) {
|
|
641
|
+
var child = this.contents_[i];
|
|
642
|
+
if (child.refreshTheme) {
|
|
643
|
+
child.refreshTheme();
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Updates the flyout's content without closing it. Should be used in response
|
|
650
|
+
* to a change in one of the dynamic categories, such as variables or
|
|
651
|
+
* procedures.
|
|
652
|
+
* @public
|
|
653
|
+
*/
|
|
654
|
+
Blockly.Toolbox.prototype.refreshSelection = function() {
|
|
655
|
+
if (this.selectedItem_ && this.selectedItem_.isSelectable() &&
|
|
656
|
+
this.selectedItem_.getContents().length) {
|
|
657
|
+
this.flyout_.show(this.selectedItem_.getContents());
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Shows or hides the toolbox.
|
|
663
|
+
* @param {boolean} isVisible True if toolbox should be visible.
|
|
664
|
+
* @public
|
|
665
|
+
*/
|
|
666
|
+
Blockly.Toolbox.prototype.setVisible = function(isVisible) {
|
|
667
|
+
this.HtmlDiv.style.display = isVisible ? 'block' : 'none';
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Sets the given item as selected.
|
|
672
|
+
* No-op if the item is not selectable.
|
|
673
|
+
* @param {?Blockly.IToolboxItem} newItem The toolbox item to select.
|
|
674
|
+
* @public
|
|
675
|
+
*/
|
|
676
|
+
Blockly.Toolbox.prototype.setSelectedItem = function(newItem) {
|
|
677
|
+
var oldItem = this.selectedItem_;
|
|
678
|
+
|
|
679
|
+
if ((!newItem && !oldItem) || (newItem && !newItem.isSelectable())) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
newItem = /** @type {Blockly.ISelectableToolboxItem} */ (newItem);
|
|
683
|
+
|
|
684
|
+
if (this.shouldDeselectItem_(oldItem, newItem) && oldItem != null) {
|
|
685
|
+
this.deselectItem_(oldItem);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
if (this.shouldSelectItem_(oldItem, newItem) && newItem != null) {
|
|
689
|
+
this.selectItem_(oldItem, newItem);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
this.updateFlyout_(oldItem, newItem);
|
|
693
|
+
this.fireSelectEvent_(oldItem, newItem);
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Decides whether the old item should be deselected.
|
|
698
|
+
* @param {?Blockly.ISelectableToolboxItem} oldItem The previously selected
|
|
699
|
+
* toolbox item.
|
|
700
|
+
* @param {?Blockly.ISelectableToolboxItem} newItem The newly selected toolbox
|
|
701
|
+
* item.
|
|
702
|
+
* @return {boolean} True if the old item should be deselected, false otherwise.
|
|
703
|
+
* @protected
|
|
704
|
+
*/
|
|
705
|
+
Blockly.Toolbox.prototype.shouldDeselectItem_ = function(oldItem, newItem) {
|
|
706
|
+
// Deselect the old item unless the old item is collapsible and has been
|
|
707
|
+
// previously clicked on.
|
|
708
|
+
return oldItem != null && (!oldItem.isCollapsible() || oldItem != newItem);
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Decides whether the new item should be selected.
|
|
713
|
+
* @param {?Blockly.ISelectableToolboxItem} oldItem The previously selected
|
|
714
|
+
* toolbox item.
|
|
715
|
+
* @param {?Blockly.ISelectableToolboxItem} newItem The newly selected toolbox
|
|
716
|
+
* item.
|
|
717
|
+
* @return {boolean} True if the new item should be selected, false otherwise.
|
|
718
|
+
* @protected
|
|
719
|
+
*/
|
|
720
|
+
Blockly.Toolbox.prototype.shouldSelectItem_ = function(oldItem, newItem) {
|
|
721
|
+
// Select the new item unless the old item equals the new item.
|
|
722
|
+
return newItem != null && newItem != oldItem;
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Deselects the given item, marks it as unselected, and updates aria state.
|
|
727
|
+
* @param {!Blockly.ISelectableToolboxItem} item The previously selected
|
|
728
|
+
* toolbox item which should be deselected.
|
|
729
|
+
* @protected
|
|
730
|
+
*/
|
|
731
|
+
Blockly.Toolbox.prototype.deselectItem_ = function(item) {
|
|
732
|
+
this.selectedItem_ = null;
|
|
733
|
+
this.previouslySelectedItem_ = item;
|
|
734
|
+
item.setSelected(false);
|
|
735
|
+
Blockly.utils.aria.setState(/** @type {!Element} */ (this.contentsDiv_),
|
|
736
|
+
Blockly.utils.aria.State.ACTIVEDESCENDANT, '');
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Selects the given item, marks it selected, and updates aria state.
|
|
741
|
+
* @param {?Blockly.ISelectableToolboxItem} oldItem The previously selected
|
|
742
|
+
* toolbox item.
|
|
743
|
+
* @param {!Blockly.ISelectableToolboxItem} newItem The newly selected toolbox
|
|
744
|
+
* item.
|
|
745
|
+
* @protected
|
|
746
|
+
*/
|
|
747
|
+
Blockly.Toolbox.prototype.selectItem_ = function(oldItem, newItem) {
|
|
748
|
+
this.selectedItem_ = newItem;
|
|
749
|
+
this.previouslySelectedItem_ = oldItem;
|
|
750
|
+
newItem.setSelected(true);
|
|
751
|
+
Blockly.utils.aria.setState(/** @type {!Element} */ (this.contentsDiv_),
|
|
752
|
+
Blockly.utils.aria.State.ACTIVEDESCENDANT, newItem.getId());
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Selects the toolbox item by its position in the list of toolbox items.
|
|
757
|
+
* @param {number} position The position of the item to select.
|
|
758
|
+
* @public
|
|
759
|
+
*/
|
|
760
|
+
Blockly.Toolbox.prototype.selectItemByPosition = function(position) {
|
|
761
|
+
if (position > -1 && position < this.contents_.length) {
|
|
762
|
+
var item = this.contents_[position];
|
|
763
|
+
if (item.isSelectable()) {
|
|
764
|
+
this.setSelectedItem(item);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Decides whether to hide or show the flyout depending on the selected item.
|
|
771
|
+
* @param {?Blockly.ISelectableToolboxItem} oldItem The previously selected toolbox item.
|
|
772
|
+
* @param {?Blockly.ISelectableToolboxItem} newItem The newly selected toolbox item.
|
|
773
|
+
* @protected
|
|
774
|
+
*/
|
|
775
|
+
Blockly.Toolbox.prototype.updateFlyout_ = function(oldItem, newItem) {
|
|
776
|
+
if ((oldItem == newItem && !newItem.isCollapsible()) || !newItem ||
|
|
777
|
+
!newItem.getContents().length) {
|
|
778
|
+
this.flyout_.hide();
|
|
779
|
+
} else {
|
|
780
|
+
this.flyout_.show(newItem.getContents());
|
|
781
|
+
this.flyout_.scrollToStart();
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Emits an event when a new toolbox item is selected.
|
|
787
|
+
* @param {?Blockly.ISelectableToolboxItem} oldItem The previously selected
|
|
788
|
+
* toolbox item.
|
|
789
|
+
* @param {?Blockly.ISelectableToolboxItem} newItem The newly selected toolbox
|
|
790
|
+
* item.
|
|
791
|
+
* @private
|
|
792
|
+
*/
|
|
793
|
+
Blockly.Toolbox.prototype.fireSelectEvent_ = function(oldItem, newItem) {
|
|
794
|
+
var oldElement = oldItem && oldItem.getName();
|
|
795
|
+
var newElement = newItem && newItem.getName();
|
|
796
|
+
// In this case the toolbox closes, so the newElement should be null.
|
|
797
|
+
if (oldItem == newItem) {
|
|
798
|
+
newElement = null;
|
|
799
|
+
}
|
|
800
|
+
// TODO (#4187): Update Toolbox Events.
|
|
801
|
+
var event = new Blockly.Events.Ui(null, 'category',
|
|
802
|
+
oldElement, newElement);
|
|
803
|
+
event.workspaceId = this.workspace_.id;
|
|
804
|
+
Blockly.Events.fire(event);
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Handles the given Blockly action on a toolbox.
|
|
809
|
+
* This is only triggered when keyboard accessibility mode is enabled.
|
|
810
|
+
* @param {!Blockly.Action} action The action to be handled.
|
|
811
|
+
* @return {boolean} True if the field handled the action, false otherwise.
|
|
812
|
+
* @package
|
|
813
|
+
*/
|
|
814
|
+
Blockly.Toolbox.prototype.onBlocklyAction = function(action) {
|
|
815
|
+
var selected = this.selectedItem_;
|
|
816
|
+
if (!selected) {
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
switch (action.name) {
|
|
820
|
+
case Blockly.navigation.actionNames.PREVIOUS:
|
|
821
|
+
return this.selectPrevious_();
|
|
822
|
+
case Blockly.navigation.actionNames.OUT:
|
|
823
|
+
return this.selectParent_();
|
|
824
|
+
case Blockly.navigation.actionNames.NEXT:
|
|
825
|
+
return this.selectNext_();
|
|
826
|
+
case Blockly.navigation.actionNames.IN:
|
|
827
|
+
return this.selectChild_();
|
|
828
|
+
default:
|
|
829
|
+
return false;
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Closes the current item if it is expanded, or selects the parent.
|
|
835
|
+
* @return {boolean} True if a parent category was selected, false otherwise.
|
|
836
|
+
* @private
|
|
837
|
+
*/
|
|
838
|
+
Blockly.Toolbox.prototype.selectParent_ = function() {
|
|
839
|
+
if (!this.selectedItem_) {
|
|
840
|
+
return false;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
if (this.selectedItem_.isCollapsible() && this.selectedItem_.isExpanded()) {
|
|
844
|
+
var collapsibleItem = /** @type {!Blockly.ICollapsibleToolboxItem} */ (this.selectedItem_);
|
|
845
|
+
collapsibleItem.setExpanded(false);
|
|
846
|
+
return true;
|
|
847
|
+
} else if (this.selectedItem_.getParent() &&
|
|
848
|
+
this.selectedItem_.getParent().isSelectable()) {
|
|
849
|
+
this.setSelectedItem(this.selectedItem_.getParent());
|
|
850
|
+
return true;
|
|
851
|
+
}
|
|
852
|
+
return false;
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Selects the first child of the currently selected item, or nothing if the
|
|
857
|
+
* toolbox item has no children.
|
|
858
|
+
* @return {boolean} True if a child category was selected, false otherwise.
|
|
859
|
+
* @private
|
|
860
|
+
*/
|
|
861
|
+
Blockly.Toolbox.prototype.selectChild_ = function() {
|
|
862
|
+
if (!this.selectedItem_ || !this.selectedItem_.isCollapsible()) {
|
|
863
|
+
return false;
|
|
864
|
+
}
|
|
865
|
+
var collapsibleItem = /** @type {Blockly.ICollapsibleToolboxItem} */
|
|
866
|
+
(this.selectedItem_);
|
|
867
|
+
if (!collapsibleItem.isExpanded()) {
|
|
868
|
+
collapsibleItem.setExpanded(true);
|
|
869
|
+
return true;
|
|
870
|
+
} else {
|
|
871
|
+
this.selectNext_();
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Selects the next visible toolbox item.
|
|
878
|
+
* @return {boolean} True if a next category was selected, false otherwise.
|
|
879
|
+
* @private
|
|
880
|
+
*/
|
|
881
|
+
Blockly.Toolbox.prototype.selectNext_ = function() {
|
|
882
|
+
if (!this.selectedItem_) {
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
var nextItemIdx = this.contents_.indexOf(this.selectedItem_) + 1;
|
|
887
|
+
if (nextItemIdx > -1 && nextItemIdx < this.contents_.length) {
|
|
888
|
+
var nextItem = this.contents_[nextItemIdx];
|
|
889
|
+
while (nextItem && !nextItem.isSelectable()) {
|
|
890
|
+
nextItem = this.contents_[++nextItemIdx];
|
|
891
|
+
}
|
|
892
|
+
if (nextItem && nextItem.isSelectable()) {
|
|
893
|
+
this.setSelectedItem(nextItem);
|
|
894
|
+
return true;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
return false;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Selects the previous visible toolbox item.
|
|
902
|
+
* @return {boolean} True if a previous category was selected, false otherwise.
|
|
903
|
+
* @private
|
|
904
|
+
*/
|
|
905
|
+
Blockly.Toolbox.prototype.selectPrevious_ = function() {
|
|
906
|
+
if (!this.selectedItem_) {
|
|
907
|
+
return false;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
var prevItemIdx = this.contents_.indexOf(this.selectedItem_) - 1;
|
|
911
|
+
if (prevItemIdx > -1 && prevItemIdx < this.contents_.length) {
|
|
912
|
+
var prevItem = this.contents_[prevItemIdx];
|
|
913
|
+
while (prevItem && !prevItem.isSelectable()) {
|
|
914
|
+
prevItem = this.contents_[--prevItemIdx];
|
|
915
|
+
}
|
|
916
|
+
if (prevItem && prevItem.isSelectable()) {
|
|
917
|
+
this.setSelectedItem(prevItem);
|
|
918
|
+
return true;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return false;
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Disposes of this toolbox.
|
|
926
|
+
* @public
|
|
927
|
+
*/
|
|
928
|
+
Blockly.Toolbox.prototype.dispose = function() {
|
|
929
|
+
this.flyout_.dispose();
|
|
930
|
+
for (var i = 0; i < this.contents_.length; i++) {
|
|
931
|
+
var toolboxItem = this.contents_[i];
|
|
932
|
+
toolboxItem.dispose();
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
for (var j = 0; j < this.boundEvents_.length; j++) {
|
|
936
|
+
Blockly.unbindEvent_(this.boundEvents_[j]);
|
|
937
|
+
}
|
|
938
|
+
this.boundEvents_ = [];
|
|
939
|
+
this.contents_ = [];
|
|
940
|
+
|
|
941
|
+
this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv);
|
|
942
|
+
Blockly.utils.dom.removeNode(this.HtmlDiv);
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* CSS for Toolbox. See css.js for use.
|
|
947
|
+
*/
|
|
948
|
+
Blockly.Css.register([
|
|
949
|
+
/* eslint-disable indent */
|
|
950
|
+
'.blocklyToolboxDelete {',
|
|
951
|
+
'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',
|
|
952
|
+
'}',
|
|
953
|
+
|
|
954
|
+
'.blocklyToolboxGrab {',
|
|
955
|
+
'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',
|
|
956
|
+
'cursor: grabbing;',
|
|
957
|
+
'cursor: -webkit-grabbing;',
|
|
958
|
+
'}',
|
|
959
|
+
|
|
960
|
+
/* Category tree in Toolbox. */
|
|
961
|
+
'.blocklyToolboxDiv {',
|
|
962
|
+
'background-color: #ddd;',
|
|
963
|
+
'overflow-x: visible;',
|
|
964
|
+
'overflow-y: auto;',
|
|
965
|
+
'padding: 4px 0 4px 0;',
|
|
966
|
+
'position: absolute;',
|
|
967
|
+
'z-index: 70;', /* so blocks go under toolbox when dragging */
|
|
968
|
+
'-webkit-tap-highlight-color: transparent;', /* issue #1345 */
|
|
969
|
+
'}',
|
|
970
|
+
|
|
971
|
+
'.blocklyToolboxContents {',
|
|
972
|
+
'display: flex;',
|
|
973
|
+
'flex-wrap: wrap;',
|
|
974
|
+
'flex-direction: column;',
|
|
975
|
+
'}',
|
|
976
|
+
|
|
977
|
+
'.blocklyToolboxContents:focus {',
|
|
978
|
+
'outline: none;',
|
|
979
|
+
'}',
|
|
980
|
+
/* eslint-enable indent */
|
|
981
|
+
]);
|
|
982
|
+
|
|
983
|
+
Blockly.registry.register(Blockly.registry.Type.TOOLBOX,
|
|
984
|
+
Blockly.registry.DEFAULT, Blockly.Toolbox);
|