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,391 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Utility methods for DOM manipulation.
|
|
9
|
+
* These methods are not specific to Blockly, and could be factored out into
|
|
10
|
+
* a JavaScript framework such as Closure.
|
|
11
|
+
* @author fraser@google.com (Neil Fraser)
|
|
12
|
+
*/
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @name Blockly.utils.dom
|
|
17
|
+
* @namespace
|
|
18
|
+
*/
|
|
19
|
+
goog.provide('Blockly.utils.dom');
|
|
20
|
+
|
|
21
|
+
goog.require('Blockly.utils.Svg');
|
|
22
|
+
goog.require('Blockly.utils.userAgent');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Required name space for SVG elements.
|
|
27
|
+
* @const
|
|
28
|
+
*/
|
|
29
|
+
Blockly.utils.dom.SVG_NS = 'http://www.w3.org/2000/svg';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Required name space for HTML elements.
|
|
33
|
+
* @const
|
|
34
|
+
*/
|
|
35
|
+
Blockly.utils.dom.HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Required name space for XLINK elements.
|
|
39
|
+
* @const
|
|
40
|
+
*/
|
|
41
|
+
Blockly.utils.dom.XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Node type constants.
|
|
45
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
|
46
|
+
* @enum {number}
|
|
47
|
+
*/
|
|
48
|
+
Blockly.utils.dom.NodeType = {
|
|
49
|
+
ELEMENT_NODE: 1,
|
|
50
|
+
TEXT_NODE: 3,
|
|
51
|
+
COMMENT_NODE: 8,
|
|
52
|
+
DOCUMENT_POSITION_CONTAINED_BY: 16
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Temporary cache of text widths.
|
|
57
|
+
* @type {Object}
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
Blockly.utils.dom.cacheWidths_ = null;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Number of current references to cache.
|
|
64
|
+
* @type {number}
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
Blockly.utils.dom.cacheReference_ = 0;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A HTML canvas context used for computing text width.
|
|
71
|
+
* @type {CanvasRenderingContext2D}
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
Blockly.utils.dom.canvasContext_ = null;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Helper method for creating SVG elements.
|
|
78
|
+
* @param {string|Blockly.utils.Svg<T>} name Element's tag name.
|
|
79
|
+
* @param {!Object} attrs Dictionary of attribute names and values.
|
|
80
|
+
* @param {Element=} opt_parent Optional parent on which to append the element.
|
|
81
|
+
* @return {T} Newly created SVG element. The return type is {!SVGElement} if
|
|
82
|
+
* name is a string or a more specific type if it a member of
|
|
83
|
+
* Blockly.utils.Svg
|
|
84
|
+
* @template T
|
|
85
|
+
*/
|
|
86
|
+
Blockly.utils.dom.createSvgElement = function(name, attrs, opt_parent) {
|
|
87
|
+
var e = /** @type {T} */
|
|
88
|
+
(document.createElementNS(Blockly.utils.dom.SVG_NS, String(name)));
|
|
89
|
+
for (var key in attrs) {
|
|
90
|
+
e.setAttribute(key, attrs[key]);
|
|
91
|
+
}
|
|
92
|
+
// IE defines a unique attribute "runtimeStyle", it is NOT applied to
|
|
93
|
+
// elements created with createElementNS. However, Closure checks for IE
|
|
94
|
+
// and assumes the presence of the attribute and crashes.
|
|
95
|
+
if (document.body.runtimeStyle) { // Indicates presence of IE-only attr.
|
|
96
|
+
e.runtimeStyle = e.currentStyle = e.style;
|
|
97
|
+
}
|
|
98
|
+
if (opt_parent) {
|
|
99
|
+
opt_parent.appendChild(e);
|
|
100
|
+
}
|
|
101
|
+
return e;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Add a CSS class to a element.
|
|
106
|
+
* Similar to Closure's goog.dom.classes.add, except it handles SVG elements.
|
|
107
|
+
* @param {!Element} element DOM element to add class to.
|
|
108
|
+
* @param {string} className Name of class to add.
|
|
109
|
+
* @return {boolean} True if class was added, false if already present.
|
|
110
|
+
*/
|
|
111
|
+
Blockly.utils.dom.addClass = function(element, className) {
|
|
112
|
+
var classes = element.getAttribute('class') || '';
|
|
113
|
+
if ((' ' + classes + ' ').indexOf(' ' + className + ' ') != -1) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (classes) {
|
|
117
|
+
classes += ' ';
|
|
118
|
+
}
|
|
119
|
+
element.setAttribute('class', classes + className);
|
|
120
|
+
return true;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Removes multiple calsses from an element.
|
|
125
|
+
* @param {!Element} element DOM element to remove classes from.
|
|
126
|
+
* @param {string} classNames A string of one or multiple class names for an
|
|
127
|
+
* element.
|
|
128
|
+
*/
|
|
129
|
+
Blockly.utils.dom.removeClasses = function(element, classNames) {
|
|
130
|
+
var classList = classNames.split(' ');
|
|
131
|
+
for (var i = 0; i < classList.length; i++) {
|
|
132
|
+
var cssName = classList[i];
|
|
133
|
+
Blockly.utils.dom.removeClass(element, cssName);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Remove a CSS class from a element.
|
|
139
|
+
* Similar to Closure's goog.dom.classes.remove, except it handles SVG elements.
|
|
140
|
+
* @param {!Element} element DOM element to remove class from.
|
|
141
|
+
* @param {string} className Name of class to remove.
|
|
142
|
+
* @return {boolean} True if class was removed, false if never present.
|
|
143
|
+
*/
|
|
144
|
+
Blockly.utils.dom.removeClass = function(element, className) {
|
|
145
|
+
var classes = element.getAttribute('class');
|
|
146
|
+
if ((' ' + classes + ' ').indexOf(' ' + className + ' ') == -1) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
var classList = classes.split(/\s+/);
|
|
150
|
+
for (var i = 0; i < classList.length; i++) {
|
|
151
|
+
if (!classList[i] || classList[i] == className) {
|
|
152
|
+
classList.splice(i, 1);
|
|
153
|
+
i--;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (classList.length) {
|
|
157
|
+
element.setAttribute('class', classList.join(' '));
|
|
158
|
+
} else {
|
|
159
|
+
element.removeAttribute('class');
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Checks if an element has the specified CSS class.
|
|
166
|
+
* Similar to Closure's goog.dom.classes.has, except it handles SVG elements.
|
|
167
|
+
* @param {!Element} element DOM element to check.
|
|
168
|
+
* @param {string} className Name of class to check.
|
|
169
|
+
* @return {boolean} True if class exists, false otherwise.
|
|
170
|
+
*/
|
|
171
|
+
Blockly.utils.dom.hasClass = function(element, className) {
|
|
172
|
+
var classes = element.getAttribute('class');
|
|
173
|
+
return (' ' + classes + ' ').indexOf(' ' + className + ' ') != -1;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Removes a node from its parent. No-op if not attached to a parent.
|
|
178
|
+
* @param {Node} node The node to remove.
|
|
179
|
+
* @return {Node} The node removed if removed; else, null.
|
|
180
|
+
*/
|
|
181
|
+
// Copied from Closure goog.dom.removeNode
|
|
182
|
+
Blockly.utils.dom.removeNode = function(node) {
|
|
183
|
+
return node && node.parentNode ? node.parentNode.removeChild(node) : null;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Insert a node after a reference node.
|
|
188
|
+
* Contrast with node.insertBefore function.
|
|
189
|
+
* @param {!Element} newNode New element to insert.
|
|
190
|
+
* @param {!Element} refNode Existing element to precede new node.
|
|
191
|
+
*/
|
|
192
|
+
Blockly.utils.dom.insertAfter = function(newNode, refNode) {
|
|
193
|
+
var siblingNode = refNode.nextSibling;
|
|
194
|
+
var parentNode = refNode.parentNode;
|
|
195
|
+
if (!parentNode) {
|
|
196
|
+
throw Error('Reference node has no parent.');
|
|
197
|
+
}
|
|
198
|
+
if (siblingNode) {
|
|
199
|
+
parentNode.insertBefore(newNode, siblingNode);
|
|
200
|
+
} else {
|
|
201
|
+
parentNode.appendChild(newNode);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Whether a node contains another node.
|
|
207
|
+
* @param {!Node} parent The node that should contain the other node.
|
|
208
|
+
* @param {!Node} descendant The node to test presence of.
|
|
209
|
+
* @return {boolean} Whether the parent node contains the descendant node.
|
|
210
|
+
*/
|
|
211
|
+
Blockly.utils.dom.containsNode = function(parent, descendant) {
|
|
212
|
+
return !!(parent.compareDocumentPosition(descendant) &
|
|
213
|
+
Blockly.utils.dom.NodeType.DOCUMENT_POSITION_CONTAINED_BY);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Sets the CSS transform property on an element. This function sets the
|
|
218
|
+
* non-vendor-prefixed and vendor-prefixed versions for backwards compatibility
|
|
219
|
+
* with older browsers. See https://caniuse.com/#feat=transforms2d
|
|
220
|
+
* @param {!Element} element Element to which the CSS transform will be applied.
|
|
221
|
+
* @param {string} transform The value of the CSS `transform` property.
|
|
222
|
+
*/
|
|
223
|
+
Blockly.utils.dom.setCssTransform = function(element, transform) {
|
|
224
|
+
element.style['transform'] = transform;
|
|
225
|
+
element.style['-webkit-transform'] = transform;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Start caching text widths. Every call to this function MUST also call
|
|
230
|
+
* stopTextWidthCache. Caches must not survive between execution threads.
|
|
231
|
+
*/
|
|
232
|
+
Blockly.utils.dom.startTextWidthCache = function() {
|
|
233
|
+
Blockly.utils.dom.cacheReference_++;
|
|
234
|
+
if (!Blockly.utils.dom.cacheWidths_) {
|
|
235
|
+
Blockly.utils.dom.cacheWidths_ = {};
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Stop caching field widths. Unless caching was already on when the
|
|
241
|
+
* corresponding call to startTextWidthCache was made.
|
|
242
|
+
*/
|
|
243
|
+
Blockly.utils.dom.stopTextWidthCache = function() {
|
|
244
|
+
Blockly.utils.dom.cacheReference_--;
|
|
245
|
+
if (!Blockly.utils.dom.cacheReference_) {
|
|
246
|
+
Blockly.utils.dom.cacheWidths_ = null;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Gets the width of a text element, caching it in the process.
|
|
252
|
+
* @param {!Element} textElement An SVG 'text' element.
|
|
253
|
+
* @return {number} Width of element.
|
|
254
|
+
*/
|
|
255
|
+
Blockly.utils.dom.getTextWidth = function(textElement) {
|
|
256
|
+
var key = textElement.textContent + '\n' + textElement.className.baseVal;
|
|
257
|
+
var width;
|
|
258
|
+
|
|
259
|
+
// Return the cached width if it exists.
|
|
260
|
+
if (Blockly.utils.dom.cacheWidths_) {
|
|
261
|
+
width = Blockly.utils.dom.cacheWidths_[key];
|
|
262
|
+
if (width) {
|
|
263
|
+
return width;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Attempt to compute fetch the width of the SVG text element.
|
|
268
|
+
try {
|
|
269
|
+
if (Blockly.utils.userAgent.IE || Blockly.utils.userAgent.EDGE) {
|
|
270
|
+
width = textElement.getBBox().width;
|
|
271
|
+
} else {
|
|
272
|
+
width = textElement.getComputedTextLength();
|
|
273
|
+
}
|
|
274
|
+
} catch (e) {
|
|
275
|
+
// In other cases where we fail to get the computed text. Instead, use an
|
|
276
|
+
// approximation and do not cache the result. At some later point in time
|
|
277
|
+
// when the block is inserted into the visible DOM, this method will be
|
|
278
|
+
// called again and, at that point in time, will not throw an exception.
|
|
279
|
+
return textElement.textContent.length * 8;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Cache the computed width and return.
|
|
283
|
+
if (Blockly.utils.dom.cacheWidths_) {
|
|
284
|
+
Blockly.utils.dom.cacheWidths_[key] = width;
|
|
285
|
+
}
|
|
286
|
+
return width;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Gets the width of a text element using a faster method than `getTextWidth`.
|
|
291
|
+
* This method requires that we know the text element's font family and size in
|
|
292
|
+
* advance. Similar to `getTextWidth`, we cache the width we compute.
|
|
293
|
+
* @param {!Element} textElement An SVG 'text' element.
|
|
294
|
+
* @param {number} fontSize The font size to use.
|
|
295
|
+
* @param {string} fontWeight The font weight to use.
|
|
296
|
+
* @param {string} fontFamily The font family to use.
|
|
297
|
+
* @return {number} Width of element.
|
|
298
|
+
*/
|
|
299
|
+
Blockly.utils.dom.getFastTextWidth = function(textElement,
|
|
300
|
+
fontSize, fontWeight, fontFamily) {
|
|
301
|
+
return Blockly.utils.dom.getFastTextWidthWithSizeString(textElement,
|
|
302
|
+
fontSize + 'pt', fontWeight, fontFamily);
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Gets the width of a text element using a faster method than `getTextWidth`.
|
|
307
|
+
* This method requires that we know the text element's font family and size in
|
|
308
|
+
* advance. Similar to `getTextWidth`, we cache the width we compute.
|
|
309
|
+
* This method is similar to ``getFastTextWidth`` but expects the font size
|
|
310
|
+
* parameter to be a string.
|
|
311
|
+
* @param {!Element} textElement An SVG 'text' element.
|
|
312
|
+
* @param {string} fontSize The font size to use.
|
|
313
|
+
* @param {string} fontWeight The font weight to use.
|
|
314
|
+
* @param {string} fontFamily The font family to use.
|
|
315
|
+
* @return {number} Width of element.
|
|
316
|
+
*/
|
|
317
|
+
Blockly.utils.dom.getFastTextWidthWithSizeString = function(textElement,
|
|
318
|
+
fontSize, fontWeight, fontFamily) {
|
|
319
|
+
var text = textElement.textContent;
|
|
320
|
+
var key = text + '\n' + textElement.className.baseVal;
|
|
321
|
+
var width;
|
|
322
|
+
|
|
323
|
+
// Return the cached width if it exists.
|
|
324
|
+
if (Blockly.utils.dom.cacheWidths_) {
|
|
325
|
+
width = Blockly.utils.dom.cacheWidths_[key];
|
|
326
|
+
if (width) {
|
|
327
|
+
return width;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (!Blockly.utils.dom.canvasContext_) {
|
|
332
|
+
// Inject the canvas element used for computing text widths.
|
|
333
|
+
var computeCanvas = document.createElement('canvas');
|
|
334
|
+
computeCanvas.className = 'blocklyComputeCanvas';
|
|
335
|
+
document.body.appendChild(computeCanvas);
|
|
336
|
+
|
|
337
|
+
// Initialize the HTML canvas context and set the font.
|
|
338
|
+
// The context font must match blocklyText's fontsize and font-family
|
|
339
|
+
// set in CSS.
|
|
340
|
+
Blockly.utils.dom.canvasContext_ = computeCanvas.getContext('2d');
|
|
341
|
+
}
|
|
342
|
+
// Set the desired font size and family.
|
|
343
|
+
Blockly.utils.dom.canvasContext_.font =
|
|
344
|
+
fontWeight + ' ' + fontSize + ' ' + fontFamily;
|
|
345
|
+
|
|
346
|
+
// Measure the text width using the helper canvas context.
|
|
347
|
+
width = Blockly.utils.dom.canvasContext_.measureText(text).width;
|
|
348
|
+
|
|
349
|
+
// Cache the computed width and return.
|
|
350
|
+
if (Blockly.utils.dom.cacheWidths_) {
|
|
351
|
+
Blockly.utils.dom.cacheWidths_[key] = width;
|
|
352
|
+
}
|
|
353
|
+
return width;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Measure a font's metrics. The height and baseline values.
|
|
358
|
+
* @param {string} text Text to measure the font dimensions of.
|
|
359
|
+
* @param {string} fontSize The font size to use.
|
|
360
|
+
* @param {string} fontWeight The font weight to use.
|
|
361
|
+
* @param {string} fontFamily The font family to use.
|
|
362
|
+
* @return {{height: number, baseline: number}} Font measurements.
|
|
363
|
+
*/
|
|
364
|
+
Blockly.utils.dom.measureFontMetrics = function(text, fontSize, fontWeight,
|
|
365
|
+
fontFamily) {
|
|
366
|
+
|
|
367
|
+
var span = document.createElement('span');
|
|
368
|
+
span.style.font = fontWeight + ' ' + fontSize + ' ' + fontFamily;
|
|
369
|
+
span.textContent = text;
|
|
370
|
+
|
|
371
|
+
var block = document.createElement('div');
|
|
372
|
+
block.style.width = '1px';
|
|
373
|
+
block.style.height = '0px';
|
|
374
|
+
|
|
375
|
+
var div = document.createElement('div');
|
|
376
|
+
div.setAttribute('style', 'position: fixed; top: 0; left: 0; display: flex;');
|
|
377
|
+
div.appendChild(span);
|
|
378
|
+
div.appendChild(block);
|
|
379
|
+
|
|
380
|
+
document.body.appendChild(div);
|
|
381
|
+
try {
|
|
382
|
+
var result = {};
|
|
383
|
+
div.style.alignItems = 'baseline';
|
|
384
|
+
result.baseline = block.offsetTop - span.offsetTop;
|
|
385
|
+
div.style.alignItems = 'flex-end';
|
|
386
|
+
result.height = block.offsetTop - span.offsetTop;
|
|
387
|
+
} finally {
|
|
388
|
+
document.body.removeChild(div);
|
|
389
|
+
}
|
|
390
|
+
return result;
|
|
391
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Provides a reference to the global object.
|
|
9
|
+
* @author samelh@google.com (Sam El-Husseini)
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @name Blockly.utils.global
|
|
15
|
+
* @namespace
|
|
16
|
+
*/
|
|
17
|
+
goog.provide('Blockly.utils.global');
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Reference to the global object.
|
|
22
|
+
*
|
|
23
|
+
* More info on this implementation here:
|
|
24
|
+
* https://docs.google.com/document/d/1NAeW4Wk7I7FV0Y2tcUFvQdGMc89k2vdgSXInw8_nvCI/edit
|
|
25
|
+
*/
|
|
26
|
+
Blockly.utils.global = function() {
|
|
27
|
+
if (typeof self === 'object') {
|
|
28
|
+
return self;
|
|
29
|
+
}
|
|
30
|
+
if (typeof window === 'object') {
|
|
31
|
+
return window;
|
|
32
|
+
}
|
|
33
|
+
if (typeof global === 'object') {
|
|
34
|
+
return global;
|
|
35
|
+
}
|
|
36
|
+
return this;
|
|
37
|
+
}();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Generator for unique element IDs.
|
|
9
|
+
* For UUIDs use Blockly.utils.genUid. The ID generator should primarily be
|
|
10
|
+
* used for IDs that end up in the DOM.
|
|
11
|
+
* @author samelh@google.com (Sam El-Husseini)
|
|
12
|
+
*/
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
goog.provide('Blockly.utils.IdGenerator');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Next unique ID to use.
|
|
20
|
+
* @type {number}
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
Blockly.utils.IdGenerator.nextId_ = 0;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Gets the next unique ID.
|
|
27
|
+
* IDs are compatible with the HTML4 id attribute restrictions:
|
|
28
|
+
* Use only ASCII letters, digits, '_', '-' and '.'
|
|
29
|
+
* @return {string} The next unique identifier.
|
|
30
|
+
*/
|
|
31
|
+
Blockly.utils.IdGenerator.getNextUniqueId = function() {
|
|
32
|
+
return 'blockly-' + (Blockly.utils.IdGenerator.nextId_++).toString(36);
|
|
33
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Constant declarations for common key codes.
|
|
9
|
+
* These methods are not specific to Blockly, and could be factored out into
|
|
10
|
+
* a JavaScript framework such as Closure.
|
|
11
|
+
* @author samelh@google.com (Sam El-Husseini)
|
|
12
|
+
*/
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
goog.provide('Blockly.utils.KeyCodes');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Key codes for common characters.
|
|
20
|
+
*
|
|
21
|
+
* Copied from Closure's goog.events.KeyCodes
|
|
22
|
+
*
|
|
23
|
+
* This list is not localized and therefore some of the key codes are not
|
|
24
|
+
* correct for non US keyboard layouts. See comments below.
|
|
25
|
+
*
|
|
26
|
+
* @enum {number}
|
|
27
|
+
*/
|
|
28
|
+
Blockly.utils.KeyCodes = {
|
|
29
|
+
WIN_KEY_FF_LINUX: 0,
|
|
30
|
+
MAC_ENTER: 3,
|
|
31
|
+
BACKSPACE: 8,
|
|
32
|
+
TAB: 9,
|
|
33
|
+
NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac
|
|
34
|
+
ENTER: 13,
|
|
35
|
+
SHIFT: 16,
|
|
36
|
+
CTRL: 17,
|
|
37
|
+
ALT: 18,
|
|
38
|
+
PAUSE: 19,
|
|
39
|
+
CAPS_LOCK: 20,
|
|
40
|
+
ESC: 27,
|
|
41
|
+
SPACE: 32,
|
|
42
|
+
PAGE_UP: 33, // also NUM_NORTH_EAST
|
|
43
|
+
PAGE_DOWN: 34, // also NUM_SOUTH_EAST
|
|
44
|
+
END: 35, // also NUM_SOUTH_WEST
|
|
45
|
+
HOME: 36, // also NUM_NORTH_WEST
|
|
46
|
+
LEFT: 37, // also NUM_WEST
|
|
47
|
+
UP: 38, // also NUM_NORTH
|
|
48
|
+
RIGHT: 39, // also NUM_EAST
|
|
49
|
+
DOWN: 40, // also NUM_SOUTH
|
|
50
|
+
PLUS_SIGN: 43, // NOT numpad plus
|
|
51
|
+
PRINT_SCREEN: 44,
|
|
52
|
+
INSERT: 45, // also NUM_INSERT
|
|
53
|
+
DELETE: 46, // also NUM_DELETE
|
|
54
|
+
ZERO: 48,
|
|
55
|
+
ONE: 49,
|
|
56
|
+
TWO: 50,
|
|
57
|
+
THREE: 51,
|
|
58
|
+
FOUR: 52,
|
|
59
|
+
FIVE: 53,
|
|
60
|
+
SIX: 54,
|
|
61
|
+
SEVEN: 55,
|
|
62
|
+
EIGHT: 56,
|
|
63
|
+
NINE: 57,
|
|
64
|
+
FF_SEMICOLON: 59, // Firefox (Gecko) fires this for semicolon instead of 186
|
|
65
|
+
FF_EQUALS: 61, // Firefox (Gecko) fires this for equals instead of 187
|
|
66
|
+
FF_DASH: 173, // Firefox (Gecko) fires this for dash instead of 189
|
|
67
|
+
// Firefox (Gecko) fires this for # on UK keyboards, rather than
|
|
68
|
+
// Shift+SINGLE_QUOTE.
|
|
69
|
+
FF_HASH: 163,
|
|
70
|
+
QUESTION_MARK: 63, // needs localization
|
|
71
|
+
AT_SIGN: 64,
|
|
72
|
+
A: 65,
|
|
73
|
+
B: 66,
|
|
74
|
+
C: 67,
|
|
75
|
+
D: 68,
|
|
76
|
+
E: 69,
|
|
77
|
+
F: 70,
|
|
78
|
+
G: 71,
|
|
79
|
+
H: 72,
|
|
80
|
+
I: 73,
|
|
81
|
+
J: 74,
|
|
82
|
+
K: 75,
|
|
83
|
+
L: 76,
|
|
84
|
+
M: 77,
|
|
85
|
+
N: 78,
|
|
86
|
+
O: 79,
|
|
87
|
+
P: 80,
|
|
88
|
+
Q: 81,
|
|
89
|
+
R: 82,
|
|
90
|
+
S: 83,
|
|
91
|
+
T: 84,
|
|
92
|
+
U: 85,
|
|
93
|
+
V: 86,
|
|
94
|
+
W: 87,
|
|
95
|
+
X: 88,
|
|
96
|
+
Y: 89,
|
|
97
|
+
Z: 90,
|
|
98
|
+
META: 91, // WIN_KEY_LEFT
|
|
99
|
+
WIN_KEY_RIGHT: 92,
|
|
100
|
+
CONTEXT_MENU: 93,
|
|
101
|
+
NUM_ZERO: 96,
|
|
102
|
+
NUM_ONE: 97,
|
|
103
|
+
NUM_TWO: 98,
|
|
104
|
+
NUM_THREE: 99,
|
|
105
|
+
NUM_FOUR: 100,
|
|
106
|
+
NUM_FIVE: 101,
|
|
107
|
+
NUM_SIX: 102,
|
|
108
|
+
NUM_SEVEN: 103,
|
|
109
|
+
NUM_EIGHT: 104,
|
|
110
|
+
NUM_NINE: 105,
|
|
111
|
+
NUM_MULTIPLY: 106,
|
|
112
|
+
NUM_PLUS: 107,
|
|
113
|
+
NUM_MINUS: 109,
|
|
114
|
+
NUM_PERIOD: 110,
|
|
115
|
+
NUM_DIVISION: 111,
|
|
116
|
+
F1: 112,
|
|
117
|
+
F2: 113,
|
|
118
|
+
F3: 114,
|
|
119
|
+
F4: 115,
|
|
120
|
+
F5: 116,
|
|
121
|
+
F6: 117,
|
|
122
|
+
F7: 118,
|
|
123
|
+
F8: 119,
|
|
124
|
+
F9: 120,
|
|
125
|
+
F10: 121,
|
|
126
|
+
F11: 122,
|
|
127
|
+
F12: 123,
|
|
128
|
+
NUMLOCK: 144,
|
|
129
|
+
SCROLL_LOCK: 145,
|
|
130
|
+
|
|
131
|
+
// OS-specific media keys like volume controls and browser controls.
|
|
132
|
+
FIRST_MEDIA_KEY: 166,
|
|
133
|
+
LAST_MEDIA_KEY: 183,
|
|
134
|
+
|
|
135
|
+
SEMICOLON: 186, // needs localization
|
|
136
|
+
DASH: 189, // needs localization
|
|
137
|
+
EQUALS: 187, // needs localization
|
|
138
|
+
COMMA: 188, // needs localization
|
|
139
|
+
PERIOD: 190, // needs localization
|
|
140
|
+
SLASH: 191, // needs localization
|
|
141
|
+
APOSTROPHE: 192, // needs localization
|
|
142
|
+
TILDE: 192, // needs localization
|
|
143
|
+
SINGLE_QUOTE: 222, // needs localization
|
|
144
|
+
OPEN_SQUARE_BRACKET: 219, // needs localization
|
|
145
|
+
BACKSLASH: 220, // needs localization
|
|
146
|
+
CLOSE_SQUARE_BRACKET: 221, // needs localization
|
|
147
|
+
WIN_KEY: 224,
|
|
148
|
+
MAC_FF_META:
|
|
149
|
+
224, // Firefox (Gecko) fires this for the meta key instead of 91
|
|
150
|
+
MAC_WK_CMD_LEFT: 91, // WebKit Left Command key fired, same as META
|
|
151
|
+
MAC_WK_CMD_RIGHT: 93, // WebKit Right Command key fired, different from META
|
|
152
|
+
WIN_IME: 229,
|
|
153
|
+
|
|
154
|
+
// "Reserved for future use". Some programs (e.g. the SlingPlayer 2.4 ActiveX
|
|
155
|
+
// control) fire this as a hacky way to disable screensavers.
|
|
156
|
+
VK_NONAME: 252,
|
|
157
|
+
|
|
158
|
+
// We've seen users whose machines fire this keycode at regular one
|
|
159
|
+
// second intervals. The common thread among these users is that
|
|
160
|
+
// they're all using Dell Inspiron laptops, so we suspect that this
|
|
161
|
+
// indicates a hardware/bios problem.
|
|
162
|
+
// http://en.community.dell.com/support-forums/laptop/f/3518/p/19285957/19523128.aspx
|
|
163
|
+
PHANTOM: 255
|
|
164
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Utility methods for math.
|
|
9
|
+
* These methods are not specific to Blockly, and could be factored out into
|
|
10
|
+
* a JavaScript framework such as Closure.
|
|
11
|
+
* @author fraser@google.com (Neil Fraser)
|
|
12
|
+
*/
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @name Blockly.utils.math
|
|
17
|
+
* @namespace
|
|
18
|
+
*/
|
|
19
|
+
goog.provide('Blockly.utils.math');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Converts degrees to radians.
|
|
24
|
+
* Copied from Closure's goog.math.toRadians.
|
|
25
|
+
* @param {number} angleDegrees Angle in degrees.
|
|
26
|
+
* @return {number} Angle in radians.
|
|
27
|
+
*/
|
|
28
|
+
Blockly.utils.math.toRadians = function(angleDegrees) {
|
|
29
|
+
return angleDegrees * Math.PI / 180;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Converts radians to degrees.
|
|
34
|
+
* Copied from Closure's goog.math.toDegrees.
|
|
35
|
+
* @param {number} angleRadians Angle in radians.
|
|
36
|
+
* @return {number} Angle in degrees.
|
|
37
|
+
*/
|
|
38
|
+
Blockly.utils.math.toDegrees = function(angleRadians) {
|
|
39
|
+
return angleRadians * 180 / Math.PI;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Clamp the provided number between the lower bound and the upper bound.
|
|
44
|
+
* @param {number} lowerBound The desired lower bound.
|
|
45
|
+
* @param {number} number The number to clamp.
|
|
46
|
+
* @param {number} upperBound The desired upper bound.
|
|
47
|
+
* @return {number} The clamped number.
|
|
48
|
+
*/
|
|
49
|
+
Blockly.utils.math.clamp = function(lowerBound, number, upperBound) {
|
|
50
|
+
if (upperBound < lowerBound) {
|
|
51
|
+
var temp = upperBound;
|
|
52
|
+
upperBound = lowerBound;
|
|
53
|
+
lowerBound = temp;
|
|
54
|
+
}
|
|
55
|
+
return Math.max(lowerBound, Math.min(number, upperBound));
|
|
56
|
+
};
|