nodeskini 1.0.0 → 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 +4 -3
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2016 Massachusetts Institute of Technology
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @fileoverview A div that floats on top of the workspace, for drop-down menus.
|
|
10
|
+
* The drop-down can be kept inside the workspace, animate in/out, etc.
|
|
11
|
+
* @author tmickel@mit.edu (Tim Mickel)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
goog.provide('Blockly.DropDownDiv');
|
|
17
|
+
|
|
18
|
+
goog.require('Blockly.utils.dom');
|
|
19
|
+
goog.require('Blockly.utils.math');
|
|
20
|
+
goog.require('Blockly.utils.style');
|
|
21
|
+
|
|
22
|
+
goog.requireType('Blockly.utils.Rect');
|
|
23
|
+
goog.requireType('Blockly.utils.Size');
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Class for drop-down div.
|
|
28
|
+
* @constructor
|
|
29
|
+
* @package
|
|
30
|
+
*/
|
|
31
|
+
Blockly.DropDownDiv = function() {
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Drop-downs will appear within the bounds of this element if possible.
|
|
36
|
+
* Set in Blockly.DropDownDiv.setBoundsElement.
|
|
37
|
+
* @type {Element}
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
Blockly.DropDownDiv.boundsElement_ = null;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The object currently using the drop-down.
|
|
44
|
+
* @type {Object}
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
Blockly.DropDownDiv.owner_ = null;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Whether the dropdown was positioned to a field or the source block.
|
|
51
|
+
* @type {?boolean}
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
Blockly.DropDownDiv.positionToField_ = null;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Arrow size in px. Should match the value in CSS
|
|
58
|
+
* (need to position pre-render).
|
|
59
|
+
* @type {number}
|
|
60
|
+
* @const
|
|
61
|
+
*/
|
|
62
|
+
Blockly.DropDownDiv.ARROW_SIZE = 16;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Drop-down border size in px. Should match the value in CSS (need to position
|
|
66
|
+
* the arrow).
|
|
67
|
+
* @type {number}
|
|
68
|
+
* @const
|
|
69
|
+
*/
|
|
70
|
+
Blockly.DropDownDiv.BORDER_SIZE = 1;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Amount the arrow must be kept away from the edges of the main drop-down div,
|
|
74
|
+
* in px.
|
|
75
|
+
* @type {number}
|
|
76
|
+
* @const
|
|
77
|
+
*/
|
|
78
|
+
Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING = 12;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Amount drop-downs should be padded away from the source, in px.
|
|
82
|
+
* @type {number}
|
|
83
|
+
* @const
|
|
84
|
+
*/
|
|
85
|
+
Blockly.DropDownDiv.PADDING_Y = 16;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Length of animations in seconds.
|
|
89
|
+
* @type {number}
|
|
90
|
+
* @const
|
|
91
|
+
*/
|
|
92
|
+
Blockly.DropDownDiv.ANIMATION_TIME = 0.25;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Timer for animation out, to be cleared if we need to immediately hide
|
|
96
|
+
* without disrupting new shows.
|
|
97
|
+
* @type {?number}
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
Blockly.DropDownDiv.animateOutTimer_ = null;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Callback for when the drop-down is hidden.
|
|
104
|
+
* @type {?Function}
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
Blockly.DropDownDiv.onHide_ = null;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* A class name representing the current owner's workspace renderer.
|
|
111
|
+
* @type {string}
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
Blockly.DropDownDiv.rendererClassName_ = '';
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* A class name representing the current owner's workspace theme.
|
|
118
|
+
* @type {string}
|
|
119
|
+
* @private
|
|
120
|
+
*/
|
|
121
|
+
Blockly.DropDownDiv.themeClassName_ = '';
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Dropdown bounds info object used to encapsulate sizing information about a
|
|
125
|
+
* bounding element (bounding box and width/height).
|
|
126
|
+
* @typedef {{
|
|
127
|
+
* top:number,
|
|
128
|
+
* left:number,
|
|
129
|
+
* bottom:number,
|
|
130
|
+
* right:number,
|
|
131
|
+
* width:number,
|
|
132
|
+
* height:number
|
|
133
|
+
* }}
|
|
134
|
+
*/
|
|
135
|
+
Blockly.DropDownDiv.BoundsInfo;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Dropdown position metrics.
|
|
139
|
+
* @typedef {{
|
|
140
|
+
* initialX:number,
|
|
141
|
+
* initialY:number,
|
|
142
|
+
* finalX:number,
|
|
143
|
+
* finalY:number,
|
|
144
|
+
* arrowX:?number,
|
|
145
|
+
* arrowY:?number,
|
|
146
|
+
* arrowAtTop:?boolean,
|
|
147
|
+
* arrowVisible:boolean
|
|
148
|
+
* }}
|
|
149
|
+
*/
|
|
150
|
+
Blockly.DropDownDiv.PositionMetrics;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Create and insert the DOM element for this div.
|
|
154
|
+
* @package
|
|
155
|
+
*/
|
|
156
|
+
Blockly.DropDownDiv.createDom = function() {
|
|
157
|
+
if (Blockly.DropDownDiv.DIV_) {
|
|
158
|
+
return; // Already created.
|
|
159
|
+
}
|
|
160
|
+
var div = document.createElement('div');
|
|
161
|
+
div.className = 'blocklyDropDownDiv';
|
|
162
|
+
var container = Blockly.parentContainer || document.body;
|
|
163
|
+
container.appendChild(div);
|
|
164
|
+
/**
|
|
165
|
+
* The div element.
|
|
166
|
+
* @type {!Element}
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
169
|
+
Blockly.DropDownDiv.DIV_ = div;
|
|
170
|
+
|
|
171
|
+
var content = document.createElement('div');
|
|
172
|
+
content.className = 'blocklyDropDownContent';
|
|
173
|
+
div.appendChild(content);
|
|
174
|
+
/**
|
|
175
|
+
* The content element.
|
|
176
|
+
* @type {!Element}
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
Blockly.DropDownDiv.content_ = content;
|
|
180
|
+
|
|
181
|
+
var arrow = document.createElement('div');
|
|
182
|
+
arrow.className = 'blocklyDropDownArrow';
|
|
183
|
+
div.appendChild(arrow);
|
|
184
|
+
/**
|
|
185
|
+
* The arrow element.
|
|
186
|
+
* @type {!Element}
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
Blockly.DropDownDiv.arrow_ = arrow;
|
|
190
|
+
|
|
191
|
+
Blockly.DropDownDiv.DIV_.style.opacity = 0;
|
|
192
|
+
|
|
193
|
+
// Transition animation for transform: translate() and opacity.
|
|
194
|
+
Blockly.DropDownDiv.DIV_.style.transition = 'transform ' +
|
|
195
|
+
Blockly.DropDownDiv.ANIMATION_TIME + 's, ' +
|
|
196
|
+
'opacity ' + Blockly.DropDownDiv.ANIMATION_TIME + 's';
|
|
197
|
+
|
|
198
|
+
// Handle focusin/out events to add a visual indicator when
|
|
199
|
+
// a child is focused or blurred.
|
|
200
|
+
div.addEventListener('focusin', function() {
|
|
201
|
+
Blockly.utils.dom.addClass(div, 'blocklyFocused');
|
|
202
|
+
});
|
|
203
|
+
div.addEventListener('focusout', function() {
|
|
204
|
+
Blockly.utils.dom.removeClass(div, 'blocklyFocused');
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Set an element to maintain bounds within. Drop-downs will appear
|
|
210
|
+
* within the box of this element if possible.
|
|
211
|
+
* @param {Element} boundsElement Element to bind drop-down to.
|
|
212
|
+
*/
|
|
213
|
+
Blockly.DropDownDiv.setBoundsElement = function(boundsElement) {
|
|
214
|
+
Blockly.DropDownDiv.boundsElement_ = boundsElement;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Provide the div for inserting content into the drop-down.
|
|
219
|
+
* @return {!Element} Div to populate with content.
|
|
220
|
+
*/
|
|
221
|
+
Blockly.DropDownDiv.getContentDiv = function() {
|
|
222
|
+
return Blockly.DropDownDiv.content_;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Clear the content of the drop-down.
|
|
227
|
+
*/
|
|
228
|
+
Blockly.DropDownDiv.clearContent = function() {
|
|
229
|
+
Blockly.DropDownDiv.content_.textContent = '';
|
|
230
|
+
Blockly.DropDownDiv.content_.style.width = '';
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Set the colour for the drop-down.
|
|
235
|
+
* @param {string} backgroundColour Any CSS colour for the background.
|
|
236
|
+
* @param {string} borderColour Any CSS colour for the border.
|
|
237
|
+
*/
|
|
238
|
+
Blockly.DropDownDiv.setColour = function(backgroundColour, borderColour) {
|
|
239
|
+
Blockly.DropDownDiv.DIV_.style.backgroundColor = backgroundColour;
|
|
240
|
+
Blockly.DropDownDiv.DIV_.style.borderColor = borderColour;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Shortcut to show and place the drop-down with positioning determined
|
|
245
|
+
* by a particular block. The primary position will be below the block,
|
|
246
|
+
* and the secondary position above the block. Drop-down will be
|
|
247
|
+
* constrained to the block's workspace.
|
|
248
|
+
* @param {!Blockly.Field} field The field showing the drop-down.
|
|
249
|
+
* @param {!Blockly.BlockSvg} block Block to position the drop-down around.
|
|
250
|
+
* @param {Function=} opt_onHide Optional callback for when the drop-down is
|
|
251
|
+
* hidden.
|
|
252
|
+
* @param {number=} opt_secondaryYOffset Optional Y offset for above-block
|
|
253
|
+
* positioning.
|
|
254
|
+
* @return {boolean} True if the menu rendered below block; false if above.
|
|
255
|
+
*/
|
|
256
|
+
Blockly.DropDownDiv.showPositionedByBlock = function(field, block,
|
|
257
|
+
opt_onHide, opt_secondaryYOffset) {
|
|
258
|
+
return Blockly.DropDownDiv.showPositionedByRect_(
|
|
259
|
+
Blockly.DropDownDiv.getScaledBboxOfBlock_(block),
|
|
260
|
+
field, opt_onHide, opt_secondaryYOffset);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Shortcut to show and place the drop-down with positioning determined
|
|
265
|
+
* by a particular field. The primary position will be below the field,
|
|
266
|
+
* and the secondary position above the field. Drop-down will be
|
|
267
|
+
* constrained to the block's workspace.
|
|
268
|
+
* @param {!Blockly.Field} field The field to position the dropdown against.
|
|
269
|
+
* @param {Function=} opt_onHide Optional callback for when the drop-down is
|
|
270
|
+
* hidden.
|
|
271
|
+
* @param {number=} opt_secondaryYOffset Optional Y offset for above-block
|
|
272
|
+
* positioning.
|
|
273
|
+
* @return {boolean} True if the menu rendered below block; false if above.
|
|
274
|
+
*/
|
|
275
|
+
Blockly.DropDownDiv.showPositionedByField = function(field,
|
|
276
|
+
opt_onHide, opt_secondaryYOffset) {
|
|
277
|
+
Blockly.DropDownDiv.positionToField_ = true;
|
|
278
|
+
return Blockly.DropDownDiv.showPositionedByRect_(
|
|
279
|
+
Blockly.DropDownDiv.getScaledBboxOfField_(field),
|
|
280
|
+
field, opt_onHide, opt_secondaryYOffset);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Get the scaled bounding box of a block.
|
|
285
|
+
* @param {!Blockly.BlockSvg} block The block.
|
|
286
|
+
* @return {!Blockly.utils.Rect} The scaled bounding box of the block.
|
|
287
|
+
* @private
|
|
288
|
+
*/
|
|
289
|
+
Blockly.DropDownDiv.getScaledBboxOfBlock_ = function(block) {
|
|
290
|
+
var blockSvg = block.getSvgRoot();
|
|
291
|
+
var bBox = blockSvg.getBBox();
|
|
292
|
+
var scale = block.workspace.scale;
|
|
293
|
+
var scaledHeight = bBox.height * scale;
|
|
294
|
+
var scaledWidth = bBox.width * scale;
|
|
295
|
+
var xy = Blockly.utils.style.getPageOffset(blockSvg);
|
|
296
|
+
return new Blockly.utils.Rect(
|
|
297
|
+
xy.y, xy.y + scaledHeight, xy.x, xy.x + scaledWidth);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Get the scaled bounding box of a field.
|
|
302
|
+
* @param {!Blockly.Field} field The field.
|
|
303
|
+
* @return {!Blockly.utils.Rect} The scaled bounding box of the field.
|
|
304
|
+
* @private
|
|
305
|
+
*/
|
|
306
|
+
Blockly.DropDownDiv.getScaledBboxOfField_ = function(field) {
|
|
307
|
+
var bBox = field.getScaledBBox();
|
|
308
|
+
return new Blockly.utils.Rect(
|
|
309
|
+
bBox.top, bBox.bottom, bBox.left, bBox.right);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Helper method to show and place the drop-down with positioning determined
|
|
314
|
+
* by a scaled bounding box. The primary position will be below the rect,
|
|
315
|
+
* and the secondary position above the rect. Drop-down will be constrained to
|
|
316
|
+
* the block's workspace.
|
|
317
|
+
* @param {!Blockly.utils.Rect} bBox The scaled bounding box.
|
|
318
|
+
* @param {!Blockly.Field} field The field to position the dropdown against.
|
|
319
|
+
* @param {Function=} opt_onHide Optional callback for when the drop-down is
|
|
320
|
+
* hidden.
|
|
321
|
+
* @param {number=} opt_secondaryYOffset Optional Y offset for above-block
|
|
322
|
+
* positioning.
|
|
323
|
+
* @return {boolean} True if the menu rendered below block; false if above.
|
|
324
|
+
* @private
|
|
325
|
+
*/
|
|
326
|
+
Blockly.DropDownDiv.showPositionedByRect_ = function(bBox, field,
|
|
327
|
+
opt_onHide, opt_secondaryYOffset) {
|
|
328
|
+
// If we can fit it, render below the block.
|
|
329
|
+
var primaryX = bBox.left + (bBox.right - bBox.left) / 2;
|
|
330
|
+
var primaryY = bBox.bottom;
|
|
331
|
+
// If we can't fit it, render above the entire parent block.
|
|
332
|
+
var secondaryX = primaryX;
|
|
333
|
+
var secondaryY = bBox.top;
|
|
334
|
+
if (opt_secondaryYOffset) {
|
|
335
|
+
secondaryY += opt_secondaryYOffset;
|
|
336
|
+
}
|
|
337
|
+
var sourceBlock = /** @type {!Blockly.BlockSvg} */ (field.getSourceBlock());
|
|
338
|
+
// Set bounds to main workspace; show the drop-down.
|
|
339
|
+
var workspace = sourceBlock.workspace;
|
|
340
|
+
while (workspace.options.parentWorkspace) {
|
|
341
|
+
workspace = /** @type {!Blockly.WorkspaceSvg} */ (
|
|
342
|
+
workspace.options.parentWorkspace);
|
|
343
|
+
}
|
|
344
|
+
Blockly.DropDownDiv.setBoundsElement(
|
|
345
|
+
/** @type {Element} */ (workspace.getParentSvg().parentNode));
|
|
346
|
+
return Blockly.DropDownDiv.show(
|
|
347
|
+
field, sourceBlock.RTL,
|
|
348
|
+
primaryX, primaryY, secondaryX, secondaryY, opt_onHide);
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Show and place the drop-down.
|
|
353
|
+
* The drop-down is placed with an absolute "origin point" (x, y) - i.e.,
|
|
354
|
+
* the arrow will point at this origin and box will positioned below or above
|
|
355
|
+
* it. If we can maintain the container bounds at the primary point, the arrow
|
|
356
|
+
* will point there, and the container will be positioned below it.
|
|
357
|
+
* If we can't maintain the container bounds at the primary point, fall-back to
|
|
358
|
+
* the secondary point and position above.
|
|
359
|
+
* @param {Object} owner The object showing the drop-down
|
|
360
|
+
* @param {boolean} rtl Right-to-left (true) or left-to-right (false).
|
|
361
|
+
* @param {number} primaryX Desired origin point x, in absolute px.
|
|
362
|
+
* @param {number} primaryY Desired origin point y, in absolute px.
|
|
363
|
+
* @param {number} secondaryX Secondary/alternative origin point x, in absolute
|
|
364
|
+
* px.
|
|
365
|
+
* @param {number} secondaryY Secondary/alternative origin point y, in absolute
|
|
366
|
+
* px.
|
|
367
|
+
* @param {Function=} opt_onHide Optional callback for when the drop-down is
|
|
368
|
+
* hidden.
|
|
369
|
+
* @return {boolean} True if the menu rendered at the primary origin point.
|
|
370
|
+
* @package
|
|
371
|
+
*/
|
|
372
|
+
Blockly.DropDownDiv.show = function(owner, rtl, primaryX, primaryY,
|
|
373
|
+
secondaryX, secondaryY, opt_onHide) {
|
|
374
|
+
Blockly.DropDownDiv.owner_ = owner;
|
|
375
|
+
Blockly.DropDownDiv.onHide_ = opt_onHide || null;
|
|
376
|
+
// Set direction.
|
|
377
|
+
var div = Blockly.DropDownDiv.DIV_;
|
|
378
|
+
div.style.direction = rtl ? 'rtl' : 'ltr';
|
|
379
|
+
|
|
380
|
+
var mainWorkspace =
|
|
381
|
+
/** @type {!Blockly.WorkspaceSvg} */ (Blockly.getMainWorkspace());
|
|
382
|
+
Blockly.DropDownDiv.rendererClassName_ =
|
|
383
|
+
mainWorkspace.getRenderer().getClassName();
|
|
384
|
+
Blockly.DropDownDiv.themeClassName_ = mainWorkspace.getTheme().getClassName();
|
|
385
|
+
Blockly.utils.dom.addClass(div, Blockly.DropDownDiv.rendererClassName_);
|
|
386
|
+
Blockly.utils.dom.addClass(div, Blockly.DropDownDiv.themeClassName_);
|
|
387
|
+
|
|
388
|
+
// When we change `translate` multiple times in close succession,
|
|
389
|
+
// Chrome may choose to wait and apply them all at once.
|
|
390
|
+
// Since we want the translation to initial X, Y to be immediate,
|
|
391
|
+
// and the translation to final X, Y to be animated,
|
|
392
|
+
// we saw problems where both would be applied after animation was turned on,
|
|
393
|
+
// making the dropdown appear to fly in from (0, 0).
|
|
394
|
+
// Using both `left`, `top` for the initial translation and then `translate`
|
|
395
|
+
// for the animated transition to final X, Y is a workaround.
|
|
396
|
+
|
|
397
|
+
return Blockly.DropDownDiv.positionInternal_(
|
|
398
|
+
primaryX, primaryY, secondaryX, secondaryY);
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Get sizing info about the bounding element.
|
|
403
|
+
* @return {!Blockly.DropDownDiv.BoundsInfo} An object containing size
|
|
404
|
+
* information about the bounding element (bounding box and width/height).
|
|
405
|
+
* @private
|
|
406
|
+
*/
|
|
407
|
+
Blockly.DropDownDiv.getBoundsInfo_ = function() {
|
|
408
|
+
var boundPosition = Blockly.utils.style.getPageOffset(
|
|
409
|
+
/** @type {!Element} */ (Blockly.DropDownDiv.boundsElement_));
|
|
410
|
+
var boundSize = Blockly.utils.style.getSize(
|
|
411
|
+
/** @type {!Element} */ (Blockly.DropDownDiv.boundsElement_));
|
|
412
|
+
|
|
413
|
+
return {
|
|
414
|
+
left: boundPosition.x,
|
|
415
|
+
right: boundPosition.x + boundSize.width,
|
|
416
|
+
top: boundPosition.y,
|
|
417
|
+
bottom: boundPosition.y + boundSize.height,
|
|
418
|
+
width: boundSize.width,
|
|
419
|
+
height: boundSize.height
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Helper to position the drop-down and the arrow, maintaining bounds.
|
|
425
|
+
* See explanation of origin points in Blockly.DropDownDiv.show.
|
|
426
|
+
* @param {number} primaryX Desired origin point x, in absolute px.
|
|
427
|
+
* @param {number} primaryY Desired origin point y, in absolute px.
|
|
428
|
+
* @param {number} secondaryX Secondary/alternative origin point x,
|
|
429
|
+
* in absolute px.
|
|
430
|
+
* @param {number} secondaryY Secondary/alternative origin point y,
|
|
431
|
+
* in absolute px.
|
|
432
|
+
* @return {!Blockly.DropDownDiv.PositionMetrics} Various final metrics,
|
|
433
|
+
* including rendered positions for drop-down and arrow.
|
|
434
|
+
* @private
|
|
435
|
+
*/
|
|
436
|
+
Blockly.DropDownDiv.getPositionMetrics_ = function(primaryX, primaryY,
|
|
437
|
+
secondaryX, secondaryY) {
|
|
438
|
+
var boundsInfo = Blockly.DropDownDiv.getBoundsInfo_();
|
|
439
|
+
var divSize = Blockly.utils.style.getSize(
|
|
440
|
+
/** @type {!Element} */ (Blockly.DropDownDiv.DIV_));
|
|
441
|
+
|
|
442
|
+
// Can we fit in-bounds below the target?
|
|
443
|
+
if (primaryY + divSize.height < boundsInfo.bottom) {
|
|
444
|
+
return Blockly.DropDownDiv.getPositionBelowMetrics_(
|
|
445
|
+
primaryX, primaryY, boundsInfo, divSize);
|
|
446
|
+
}
|
|
447
|
+
// Can we fit in-bounds above the target?
|
|
448
|
+
if (secondaryY - divSize.height > boundsInfo.top) {
|
|
449
|
+
return Blockly.DropDownDiv.getPositionAboveMetrics_(
|
|
450
|
+
secondaryX, secondaryY, boundsInfo, divSize);
|
|
451
|
+
}
|
|
452
|
+
// Can we fit outside the workspace bounds (but inside the window) below?
|
|
453
|
+
if (primaryY + divSize.height < document.documentElement.clientHeight) {
|
|
454
|
+
return Blockly.DropDownDiv.getPositionBelowMetrics_(
|
|
455
|
+
primaryX, primaryY, boundsInfo, divSize);
|
|
456
|
+
}
|
|
457
|
+
// Can we fit outside the workspace bounds (but inside the window) above?
|
|
458
|
+
if (secondaryY - divSize.height > document.documentElement.clientTop) {
|
|
459
|
+
return Blockly.DropDownDiv.getPositionAboveMetrics_(
|
|
460
|
+
secondaryX, secondaryY, boundsInfo, divSize);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// Last resort, render at top of page.
|
|
464
|
+
return Blockly.DropDownDiv.getPositionTopOfPageMetrics_(
|
|
465
|
+
primaryX, boundsInfo, divSize);
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Get the metrics for positioning the div below the source.
|
|
470
|
+
* @param {number} primaryX Desired origin point x, in absolute px.
|
|
471
|
+
* @param {number} primaryY Desired origin point y, in absolute px.
|
|
472
|
+
* @param {!Blockly.DropDownDiv.BoundsInfo} boundsInfo An object containing size
|
|
473
|
+
* information about the bounding element (bounding box and width/height).
|
|
474
|
+
* @param {!Blockly.utils.Size} divSize An object containing information about
|
|
475
|
+
* the size of the DropDownDiv (width & height).
|
|
476
|
+
* @return {!Blockly.DropDownDiv.PositionMetrics} Various final metrics,
|
|
477
|
+
* including rendered positions for drop-down and arrow.
|
|
478
|
+
* @private
|
|
479
|
+
*/
|
|
480
|
+
Blockly.DropDownDiv.getPositionBelowMetrics_ = function(
|
|
481
|
+
primaryX, primaryY, boundsInfo, divSize) {
|
|
482
|
+
|
|
483
|
+
var xCoords = Blockly.DropDownDiv.getPositionX(
|
|
484
|
+
primaryX, boundsInfo.left, boundsInfo.right, divSize.width);
|
|
485
|
+
|
|
486
|
+
var arrowY = -(Blockly.DropDownDiv.ARROW_SIZE / 2 +
|
|
487
|
+
Blockly.DropDownDiv.BORDER_SIZE);
|
|
488
|
+
var finalY = primaryY + Blockly.DropDownDiv.PADDING_Y;
|
|
489
|
+
|
|
490
|
+
return {
|
|
491
|
+
initialX: xCoords.divX,
|
|
492
|
+
initialY : primaryY,
|
|
493
|
+
finalX: xCoords.divX, // X position remains constant during animation.
|
|
494
|
+
finalY: finalY,
|
|
495
|
+
arrowX: xCoords.arrowX,
|
|
496
|
+
arrowY: arrowY,
|
|
497
|
+
arrowAtTop: true,
|
|
498
|
+
arrowVisible: true
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Get the metrics for positioning the div above the source.
|
|
504
|
+
* @param {number} secondaryX Secondary/alternative origin point x,
|
|
505
|
+
* in absolute px.
|
|
506
|
+
* @param {number} secondaryY Secondary/alternative origin point y,
|
|
507
|
+
* in absolute px.
|
|
508
|
+
* @param {!Blockly.DropDownDiv.BoundsInfo} boundsInfo An object containing size
|
|
509
|
+
* information about the bounding element (bounding box and width/height).
|
|
510
|
+
* @param {!Blockly.utils.Size} divSize An object containing information about
|
|
511
|
+
* the size of the DropDownDiv (width & height).
|
|
512
|
+
* @return {!Blockly.DropDownDiv.PositionMetrics} Various final metrics,
|
|
513
|
+
* including rendered positions for drop-down and arrow.
|
|
514
|
+
* @private
|
|
515
|
+
*/
|
|
516
|
+
Blockly.DropDownDiv.getPositionAboveMetrics_ = function(
|
|
517
|
+
secondaryX, secondaryY, boundsInfo, divSize) {
|
|
518
|
+
|
|
519
|
+
var xCoords = Blockly.DropDownDiv.getPositionX(
|
|
520
|
+
secondaryX, boundsInfo.left, boundsInfo.right, divSize.width);
|
|
521
|
+
|
|
522
|
+
var arrowY = divSize.height - (Blockly.DropDownDiv.BORDER_SIZE * 2) -
|
|
523
|
+
(Blockly.DropDownDiv.ARROW_SIZE / 2);
|
|
524
|
+
var finalY = secondaryY - divSize.height - Blockly.DropDownDiv.PADDING_Y;
|
|
525
|
+
var initialY = secondaryY - divSize.height; // No padding on Y
|
|
526
|
+
|
|
527
|
+
return {
|
|
528
|
+
initialX: xCoords.divX,
|
|
529
|
+
initialY : initialY,
|
|
530
|
+
finalX: xCoords.divX, // X position remains constant during animation.
|
|
531
|
+
finalY: finalY,
|
|
532
|
+
arrowX: xCoords.arrowX,
|
|
533
|
+
arrowY: arrowY,
|
|
534
|
+
arrowAtTop: false,
|
|
535
|
+
arrowVisible: true
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Get the metrics for positioning the div at the top of the page.
|
|
541
|
+
* @param {number} sourceX Desired origin point x, in absolute px.
|
|
542
|
+
* @param {!Blockly.DropDownDiv.BoundsInfo} boundsInfo An object containing size
|
|
543
|
+
* information about the bounding element (bounding box and width/height).
|
|
544
|
+
* @param {!Blockly.utils.Size} divSize An object containing information about
|
|
545
|
+
* the size of the DropDownDiv (width & height).
|
|
546
|
+
* @return {!Blockly.DropDownDiv.PositionMetrics} Various final metrics,
|
|
547
|
+
* including rendered positions for drop-down and arrow.
|
|
548
|
+
* @private
|
|
549
|
+
*/
|
|
550
|
+
Blockly.DropDownDiv.getPositionTopOfPageMetrics_ = function(
|
|
551
|
+
sourceX, boundsInfo, divSize) {
|
|
552
|
+
|
|
553
|
+
var xCoords = Blockly.DropDownDiv.getPositionX(
|
|
554
|
+
sourceX, boundsInfo.left, boundsInfo.right, divSize.width);
|
|
555
|
+
|
|
556
|
+
// No need to provide arrow-specific information because it won't be visible.
|
|
557
|
+
return {
|
|
558
|
+
initialX: xCoords.divX,
|
|
559
|
+
initialY : 0,
|
|
560
|
+
finalX: xCoords.divX, // X position remains constant during animation.
|
|
561
|
+
finalY: 0, // Y position remains constant during animation.
|
|
562
|
+
arrowAtTop: null,
|
|
563
|
+
arrowX: null,
|
|
564
|
+
arrowY: null,
|
|
565
|
+
arrowVisible: false
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Get the x positions for the left side of the DropDownDiv and the arrow,
|
|
571
|
+
* accounting for the bounds of the workspace.
|
|
572
|
+
* @param {number} sourceX Desired origin point x, in absolute px.
|
|
573
|
+
* @param {number} boundsLeft The left edge of the bounding element, in
|
|
574
|
+
* absolute px.
|
|
575
|
+
* @param {number} boundsRight The right edge of the bounding element, in
|
|
576
|
+
* absolute px.
|
|
577
|
+
* @param {number} divWidth The width of the div in px.
|
|
578
|
+
* @return {{divX: number, arrowX: number}} An object containing metrics for
|
|
579
|
+
* the x positions of the left side of the DropDownDiv and the arrow.
|
|
580
|
+
* @package
|
|
581
|
+
*/
|
|
582
|
+
Blockly.DropDownDiv.getPositionX = function(
|
|
583
|
+
sourceX, boundsLeft, boundsRight, divWidth) {
|
|
584
|
+
var arrowX, divX;
|
|
585
|
+
arrowX = divX = sourceX;
|
|
586
|
+
|
|
587
|
+
// Offset the topLeft coord so that the dropdowndiv is centered.
|
|
588
|
+
divX -= divWidth / 2;
|
|
589
|
+
// Fit the dropdowndiv within the bounds of the workspace.
|
|
590
|
+
divX = Blockly.utils.math.clamp(boundsLeft, divX, boundsRight - divWidth);
|
|
591
|
+
|
|
592
|
+
// Offset the arrow coord so that the arrow is centered.
|
|
593
|
+
arrowX -= Blockly.DropDownDiv.ARROW_SIZE / 2;
|
|
594
|
+
// Convert the arrow position to be relative to the top left of the div.
|
|
595
|
+
var relativeArrowX = arrowX - divX;
|
|
596
|
+
var horizPadding = Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING;
|
|
597
|
+
// Clamp the arrow position so that it stays attached to the dropdowndiv.
|
|
598
|
+
relativeArrowX = Blockly.utils.math.clamp(
|
|
599
|
+
horizPadding,
|
|
600
|
+
relativeArrowX,
|
|
601
|
+
divWidth - horizPadding - Blockly.DropDownDiv.ARROW_SIZE);
|
|
602
|
+
|
|
603
|
+
return {
|
|
604
|
+
arrowX: relativeArrowX,
|
|
605
|
+
divX: divX
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Is the container visible?
|
|
611
|
+
* @return {boolean} True if visible.
|
|
612
|
+
*/
|
|
613
|
+
Blockly.DropDownDiv.isVisible = function() {
|
|
614
|
+
return !!Blockly.DropDownDiv.owner_;
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Hide the menu only if it is owned by the provided object.
|
|
619
|
+
* @param {Object} owner Object which must be owning the drop-down to hide.
|
|
620
|
+
* @param {boolean=} opt_withoutAnimation True if we should hide the dropdown
|
|
621
|
+
* without animating.
|
|
622
|
+
* @return {boolean} True if hidden.
|
|
623
|
+
*/
|
|
624
|
+
Blockly.DropDownDiv.hideIfOwner = function(owner, opt_withoutAnimation) {
|
|
625
|
+
if (Blockly.DropDownDiv.owner_ === owner) {
|
|
626
|
+
if (opt_withoutAnimation) {
|
|
627
|
+
Blockly.DropDownDiv.hideWithoutAnimation();
|
|
628
|
+
} else {
|
|
629
|
+
Blockly.DropDownDiv.hide();
|
|
630
|
+
}
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
return false;
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Hide the menu, triggering animation.
|
|
638
|
+
*/
|
|
639
|
+
Blockly.DropDownDiv.hide = function() {
|
|
640
|
+
// Start the animation by setting the translation and fading out.
|
|
641
|
+
var div = Blockly.DropDownDiv.DIV_;
|
|
642
|
+
// Reset to (initialX, initialY) - i.e., no translation.
|
|
643
|
+
div.style.transform = 'translate(0, 0)';
|
|
644
|
+
div.style.opacity = 0;
|
|
645
|
+
// Finish animation - reset all values to default.
|
|
646
|
+
Blockly.DropDownDiv.animateOutTimer_ =
|
|
647
|
+
setTimeout(function() {
|
|
648
|
+
Blockly.DropDownDiv.hideWithoutAnimation();
|
|
649
|
+
}, Blockly.DropDownDiv.ANIMATION_TIME * 1000);
|
|
650
|
+
if (Blockly.DropDownDiv.onHide_) {
|
|
651
|
+
Blockly.DropDownDiv.onHide_();
|
|
652
|
+
Blockly.DropDownDiv.onHide_ = null;
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Hide the menu, without animation.
|
|
658
|
+
*/
|
|
659
|
+
Blockly.DropDownDiv.hideWithoutAnimation = function() {
|
|
660
|
+
if (!Blockly.DropDownDiv.isVisible()) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
if (Blockly.DropDownDiv.animateOutTimer_) {
|
|
664
|
+
clearTimeout(Blockly.DropDownDiv.animateOutTimer_);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// Reset style properties in case this gets called directly
|
|
668
|
+
// instead of hide() - see discussion on #2551.
|
|
669
|
+
var div = Blockly.DropDownDiv.DIV_;
|
|
670
|
+
div.style.transform = '';
|
|
671
|
+
div.style.left = '';
|
|
672
|
+
div.style.top = '';
|
|
673
|
+
div.style.opacity = 0;
|
|
674
|
+
div.style.display = 'none';
|
|
675
|
+
div.style.backgroundColor = '';
|
|
676
|
+
div.style.borderColor = '';
|
|
677
|
+
|
|
678
|
+
if (Blockly.DropDownDiv.onHide_) {
|
|
679
|
+
Blockly.DropDownDiv.onHide_();
|
|
680
|
+
Blockly.DropDownDiv.onHide_ = null;
|
|
681
|
+
}
|
|
682
|
+
Blockly.DropDownDiv.clearContent();
|
|
683
|
+
Blockly.DropDownDiv.owner_ = null;
|
|
684
|
+
|
|
685
|
+
if (Blockly.DropDownDiv.rendererClassName_) {
|
|
686
|
+
Blockly.utils.dom.removeClass(div, Blockly.DropDownDiv.rendererClassName_);
|
|
687
|
+
Blockly.DropDownDiv.rendererClassName_ = '';
|
|
688
|
+
}
|
|
689
|
+
if (Blockly.DropDownDiv.themeClassName_) {
|
|
690
|
+
Blockly.utils.dom.removeClass(div, Blockly.DropDownDiv.themeClassName_);
|
|
691
|
+
Blockly.DropDownDiv.themeClassName_ = '';
|
|
692
|
+
}
|
|
693
|
+
(/** @type {!Blockly.WorkspaceSvg} */ (
|
|
694
|
+
Blockly.getMainWorkspace())).markFocused();
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Set the dropdown div's position.
|
|
699
|
+
* @param {number} primaryX Desired origin point x, in absolute px.
|
|
700
|
+
* @param {number} primaryY Desired origin point y, in absolute px.
|
|
701
|
+
* @param {number} secondaryX Secondary/alternative origin point x,
|
|
702
|
+
* in absolute px.
|
|
703
|
+
* @param {number} secondaryY Secondary/alternative origin point y,
|
|
704
|
+
* in absolute px.
|
|
705
|
+
* @return {boolean} True if the menu rendered at the primary origin point.
|
|
706
|
+
* @private
|
|
707
|
+
*/
|
|
708
|
+
Blockly.DropDownDiv.positionInternal_ = function(
|
|
709
|
+
primaryX, primaryY, secondaryX, secondaryY) {
|
|
710
|
+
var metrics = Blockly.DropDownDiv.getPositionMetrics_(primaryX, primaryY,
|
|
711
|
+
secondaryX, secondaryY);
|
|
712
|
+
|
|
713
|
+
// Update arrow CSS.
|
|
714
|
+
if (metrics.arrowVisible) {
|
|
715
|
+
Blockly.DropDownDiv.arrow_.style.display = '';
|
|
716
|
+
Blockly.DropDownDiv.arrow_.style.transform = 'translate(' +
|
|
717
|
+
metrics.arrowX + 'px,' + metrics.arrowY + 'px) rotate(45deg)';
|
|
718
|
+
Blockly.DropDownDiv.arrow_.setAttribute('class', metrics.arrowAtTop ?
|
|
719
|
+
'blocklyDropDownArrow blocklyArrowTop' :
|
|
720
|
+
'blocklyDropDownArrow blocklyArrowBottom');
|
|
721
|
+
} else {
|
|
722
|
+
Blockly.DropDownDiv.arrow_.style.display = 'none';
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
var initialX = Math.floor(metrics.initialX);
|
|
726
|
+
var initialY = Math.floor(metrics.initialY);
|
|
727
|
+
var finalX = Math.floor(metrics.finalX);
|
|
728
|
+
var finalY = Math.floor(metrics.finalY);
|
|
729
|
+
|
|
730
|
+
var div = Blockly.DropDownDiv.DIV_;
|
|
731
|
+
// First apply initial translation.
|
|
732
|
+
div.style.left = initialX + 'px';
|
|
733
|
+
div.style.top = initialY + 'px';
|
|
734
|
+
|
|
735
|
+
// Show the div.
|
|
736
|
+
div.style.display = 'block';
|
|
737
|
+
div.style.opacity = 1;
|
|
738
|
+
// Add final translate, animated through `transition`.
|
|
739
|
+
// Coordinates are relative to (initialX, initialY),
|
|
740
|
+
// where the drop-down is absolutely positioned.
|
|
741
|
+
var dx = finalX - initialX;
|
|
742
|
+
var dy = finalY - initialY;
|
|
743
|
+
div.style.transform = 'translate(' + dx + 'px,' + dy + 'px)';
|
|
744
|
+
|
|
745
|
+
return !!metrics.arrowAtTop;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Repositions the dropdownDiv on window resize. If it doesn't know how to
|
|
750
|
+
* calculate the new position, it will just hide it instead.
|
|
751
|
+
* @package
|
|
752
|
+
*/
|
|
753
|
+
Blockly.DropDownDiv.repositionForWindowResize = function() {
|
|
754
|
+
// This condition mainly catches the dropdown div when it is being used as a
|
|
755
|
+
// dropdown. It is important not to close it in this case because on Android,
|
|
756
|
+
// when a field is focused, the soft keyboard opens triggering a window resize
|
|
757
|
+
// event and we want the dropdown div to stick around so users can type into
|
|
758
|
+
// it.
|
|
759
|
+
if (Blockly.DropDownDiv.owner_) {
|
|
760
|
+
var field = /** @type {!Blockly.Field} */ (Blockly.DropDownDiv.owner_);
|
|
761
|
+
var block = /** @type {!Blockly.BlockSvg} */ (field.getSourceBlock());
|
|
762
|
+
var bBox = Blockly.DropDownDiv.positionToField_ ?
|
|
763
|
+
Blockly.DropDownDiv.getScaledBboxOfField_(field) :
|
|
764
|
+
Blockly.DropDownDiv.getScaledBboxOfBlock_(block);
|
|
765
|
+
// If we can fit it, render below the block.
|
|
766
|
+
var primaryX = bBox.left + (bBox.right - bBox.left) / 2;
|
|
767
|
+
var primaryY = bBox.bottom;
|
|
768
|
+
// If we can't fit it, render above the entire parent block.
|
|
769
|
+
var secondaryX = primaryX;
|
|
770
|
+
var secondaryY = bBox.top;
|
|
771
|
+
Blockly.DropDownDiv.positionInternal_(
|
|
772
|
+
primaryX, primaryY, secondaryX, secondaryY);
|
|
773
|
+
} else {
|
|
774
|
+
Blockly.DropDownDiv.hide();
|
|
775
|
+
}
|
|
776
|
+
};
|