nodeskini 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocklySkini/archive/blocklyControleur.js +87 -0
- package/blocklySkini/archive/blocklySkini.js +84 -0
- package/blocklySkini/archive/blocklyhop.js +75 -0
- package/blocklySkini/archive/clientControleurBlocly.js +170 -0
- package/blocklySkini/archive/index.html +76 -0
- package/blocklySkini/archive/testHHsuspend.txt +89 -0
- package/blocklySkini/archive/testHHtrap.txt +262 -0
- package/blocklySkini/archive/testOrchestration.txt +177 -0
- package/blocklySkini/archive/testOrchestration.xml +447 -0
- package/blocklySkini/archive/testOrchestration2.xml +456 -0
- package/blocklySkini/blockly/README.md +77 -0
- package/blocklySkini/blockly/blockly.d.ts +21480 -0
- package/blocklySkini/blockly/blockly.js +25 -0
- package/blocklySkini/blockly/blockly.min.js +2188 -0
- package/blocklySkini/blockly/blockly_compressed.js +1455 -0
- package/blocklySkini/blockly/blockly_compressed.js.map +1 -0
- package/blocklySkini/blockly/blocks/colour.js +122 -0
- package/blocklySkini/blockly/blocks/lists.js +862 -0
- package/blocklySkini/blockly/blocks/logic.js +635 -0
- package/blocklySkini/blockly/blocks/loops.js +357 -0
- package/blocklySkini/blockly/blocks/math.js +566 -0
- package/blocklySkini/blockly/blocks/procedures.js +1072 -0
- package/blocklySkini/blockly/blocks/text.js +923 -0
- package/blocklySkini/blockly/blocks/variables.js +163 -0
- package/blocklySkini/blockly/blocks/variables_dynamic.js +180 -0
- package/blocklySkini/blockly/blocks.d.ts +15 -0
- package/blocklySkini/blockly/blocks.js +27 -0
- package/blocklySkini/blockly/blocks_compressed.js +182 -0
- package/blocklySkini/blockly/blocks_compressed.js.map +1 -0
- package/blocklySkini/blockly/browser.js +36 -0
- package/blocklySkini/blockly/core/block.js +2010 -0
- package/blocklySkini/blockly/core/block_animations.js +203 -0
- package/blocklySkini/blockly/core/block_drag_surface.js +212 -0
- package/blocklySkini/blockly/core/block_dragger.js +378 -0
- package/blocklySkini/blockly/core/block_events.js +548 -0
- package/blocklySkini/blockly/core/block_svg.js +1763 -0
- package/blocklySkini/blockly/core/blockly.js +674 -0
- package/blocklySkini/blockly/core/blocks.js +23 -0
- package/blocklySkini/blockly/core/bubble.js +880 -0
- package/blocklySkini/blockly/core/bubble_dragger.js +274 -0
- package/blocklySkini/blockly/core/comment.js +439 -0
- package/blocklySkini/blockly/core/components/component.js +554 -0
- package/blocklySkini/blockly/core/components/tree/basenode.js +895 -0
- package/blocklySkini/blockly/core/components/tree/treecontrol.js +332 -0
- package/blocklySkini/blockly/core/components/tree/treenode.js +172 -0
- package/blocklySkini/blockly/core/connection.js +682 -0
- package/blocklySkini/blockly/core/connection_checker.js +285 -0
- package/blocklySkini/blockly/core/connection_db.js +295 -0
- package/blocklySkini/blockly/core/constants.js +277 -0
- package/blocklySkini/blockly/core/contextmenu.js +307 -0
- package/blocklySkini/blockly/core/contextmenu_items.js +534 -0
- package/blocklySkini/blockly/core/contextmenu_registry.js +165 -0
- package/blocklySkini/blockly/core/css.js +549 -0
- package/blocklySkini/blockly/core/dropdowndiv.js +776 -0
- package/blocklySkini/blockly/core/events.js +387 -0
- package/blocklySkini/blockly/core/events_abstract.js +106 -0
- package/blocklySkini/blockly/core/extensions.js +450 -0
- package/blocklySkini/blockly/core/field.js +1162 -0
- package/blocklySkini/blockly/core/field_angle.js +562 -0
- package/blocklySkini/blockly/core/field_checkbox.js +220 -0
- package/blocklySkini/blockly/core/field_colour.js +664 -0
- package/blocklySkini/blockly/core/field_dropdown.js +760 -0
- package/blocklySkini/blockly/core/field_image.js +286 -0
- package/blocklySkini/blockly/core/field_label.js +130 -0
- package/blocklySkini/blockly/core/field_label_serializable.js +69 -0
- package/blocklySkini/blockly/core/field_multilineinput.js +299 -0
- package/blocklySkini/blockly/core/field_number.js +317 -0
- package/blocklySkini/blockly/core/field_registry.js +66 -0
- package/blocklySkini/blockly/core/field_textinput.js +616 -0
- package/blocklySkini/blockly/core/field_variable.js +463 -0
- package/blocklySkini/blockly/core/flyout_base.js +1071 -0
- package/blocklySkini/blockly/core/flyout_button.js +325 -0
- package/blocklySkini/blockly/core/flyout_dragger.js +76 -0
- package/blocklySkini/blockly/core/flyout_horizontal.js +388 -0
- package/blocklySkini/blockly/core/flyout_vertical.js +397 -0
- package/blocklySkini/blockly/core/generator.js +482 -0
- package/blocklySkini/blockly/core/gesture.js +993 -0
- package/blocklySkini/blockly/core/grid.js +222 -0
- package/blocklySkini/blockly/core/icon.js +206 -0
- package/blocklySkini/blockly/core/inject.js +487 -0
- package/blocklySkini/blockly/core/input.js +296 -0
- package/blocklySkini/blockly/core/insertion_marker_manager.js +700 -0
- package/blocklySkini/blockly/core/interfaces/i_accessibility.js +72 -0
- package/blocklySkini/blockly/core/interfaces/i_bounded_element.js +31 -0
- package/blocklySkini/blockly/core/interfaces/i_bubble.js +83 -0
- package/blocklySkini/blockly/core/interfaces/i_connection_checker.js +94 -0
- package/blocklySkini/blockly/core/interfaces/i_contextmenu.js +26 -0
- package/blocklySkini/blockly/core/interfaces/i_copyable.js +40 -0
- package/blocklySkini/blockly/core/interfaces/i_deletable.js +27 -0
- package/blocklySkini/blockly/core/interfaces/i_deletearea.js +28 -0
- package/blocklySkini/blockly/core/interfaces/i_flyout.js +178 -0
- package/blocklySkini/blockly/core/interfaces/i_movable.js +27 -0
- package/blocklySkini/blockly/core/interfaces/i_registrable.js +22 -0
- package/blocklySkini/blockly/core/interfaces/i_registrable_field.js +31 -0
- package/blocklySkini/blockly/core/interfaces/i_selectable.js +43 -0
- package/blocklySkini/blockly/core/interfaces/i_styleable.js +33 -0
- package/blocklySkini/blockly/core/interfaces/i_toolbox.js +131 -0
- package/blocklySkini/blockly/core/interfaces/i_toolbox_item.js +148 -0
- package/blocklySkini/blockly/core/keyboard_nav/action.js +26 -0
- package/blocklySkini/blockly/core/keyboard_nav/ast_node.js +684 -0
- package/blocklySkini/blockly/core/keyboard_nav/basic_cursor.js +208 -0
- package/blocklySkini/blockly/core/keyboard_nav/cursor.js +170 -0
- package/blocklySkini/blockly/core/keyboard_nav/flyout_cursor.js +106 -0
- package/blocklySkini/blockly/core/keyboard_nav/key_map.js +190 -0
- package/blocklySkini/blockly/core/keyboard_nav/marker.js +120 -0
- package/blocklySkini/blockly/core/keyboard_nav/navigation.js +1084 -0
- package/blocklySkini/blockly/core/keyboard_nav/tab_navigate_cursor.js +48 -0
- package/blocklySkini/blockly/core/marker_manager.js +183 -0
- package/blocklySkini/blockly/core/menu.js +465 -0
- package/blocklySkini/blockly/core/menuitem.js +280 -0
- package/blocklySkini/blockly/core/msg.js +31 -0
- package/blocklySkini/blockly/core/mutator.js +555 -0
- package/blocklySkini/blockly/core/names.js +186 -0
- package/blocklySkini/blockly/core/options.js +365 -0
- package/blocklySkini/blockly/core/procedures.js +404 -0
- package/blocklySkini/blockly/core/registry.js +265 -0
- package/blocklySkini/blockly/core/rendered_connection.js +565 -0
- package/blocklySkini/blockly/core/renderers/common/block_rendering.js +81 -0
- package/blocklySkini/blockly/core/renderers/common/constants.js +1256 -0
- package/blocklySkini/blockly/core/renderers/common/debugger.js +431 -0
- package/blocklySkini/blockly/core/renderers/common/drawer.js +468 -0
- package/blocklySkini/blockly/core/renderers/common/i_path_object.js +151 -0
- package/blocklySkini/blockly/core/renderers/common/info.js +775 -0
- package/blocklySkini/blockly/core/renderers/common/marker_svg.js +687 -0
- package/blocklySkini/blockly/core/renderers/common/path_object.js +279 -0
- package/blocklySkini/blockly/core/renderers/common/renderer.js +301 -0
- package/blocklySkini/blockly/core/renderers/geras/constants.js +64 -0
- package/blocklySkini/blockly/core/renderers/geras/drawer.js +205 -0
- package/blocklySkini/blockly/core/renderers/geras/highlight_constants.js +311 -0
- package/blocklySkini/blockly/core/renderers/geras/highlighter.js +256 -0
- package/blocklySkini/blockly/core/renderers/geras/info.js +483 -0
- package/blocklySkini/blockly/core/renderers/geras/measurables/inputs.js +67 -0
- package/blocklySkini/blockly/core/renderers/geras/path_object.js +177 -0
- package/blocklySkini/blockly/core/renderers/geras/renderer.js +138 -0
- package/blocklySkini/blockly/core/renderers/measurables/base.js +44 -0
- package/blocklySkini/blockly/core/renderers/measurables/connections.js +114 -0
- package/blocklySkini/blockly/core/renderers/measurables/inputs.js +160 -0
- package/blocklySkini/blockly/core/renderers/measurables/row_elements.js +185 -0
- package/blocklySkini/blockly/core/renderers/measurables/rows.js +532 -0
- package/blocklySkini/blockly/core/renderers/measurables/types.js +349 -0
- package/blocklySkini/blockly/core/renderers/minimalist/constants.js +29 -0
- package/blocklySkini/blockly/core/renderers/minimalist/drawer.js +32 -0
- package/blocklySkini/blockly/core/renderers/minimalist/info.js +45 -0
- package/blocklySkini/blockly/core/renderers/minimalist/renderer.js +70 -0
- package/blocklySkini/blockly/core/renderers/thrasos/info.js +338 -0
- package/blocklySkini/blockly/core/renderers/thrasos/renderer.js +45 -0
- package/blocklySkini/blockly/core/renderers/zelos/constants.js +1002 -0
- package/blocklySkini/blockly/core/renderers/zelos/drawer.js +233 -0
- package/blocklySkini/blockly/core/renderers/zelos/info.js +587 -0
- package/blocklySkini/blockly/core/renderers/zelos/marker_svg.js +148 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/inputs.js +47 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/row_elements.js +37 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/rows.js +108 -0
- package/blocklySkini/blockly/core/renderers/zelos/path_object.js +244 -0
- package/blocklySkini/blockly/core/renderers/zelos/renderer.js +130 -0
- package/blocklySkini/blockly/core/requires.js +84 -0
- package/blocklySkini/blockly/core/scrollbar.js +880 -0
- package/blocklySkini/blockly/core/theme/classic.js +87 -0
- package/blocklySkini/blockly/core/theme/dark.js +33 -0
- package/blocklySkini/blockly/core/theme/deuteranopia.js +104 -0
- package/blocklySkini/blockly/core/theme/highcontrast.js +119 -0
- package/blocklySkini/blockly/core/theme/modern.js +108 -0
- package/blocklySkini/blockly/core/theme/tritanopia.js +103 -0
- package/blocklySkini/blockly/core/theme/zelos.js +106 -0
- package/blocklySkini/blockly/core/theme.js +236 -0
- package/blocklySkini/blockly/core/theme_manager.js +197 -0
- package/blocklySkini/blockly/core/toolbox/category.js +690 -0
- package/blocklySkini/blockly/core/toolbox/collapsible_category.js +294 -0
- package/blocklySkini/blockly/core/toolbox/separator.js +123 -0
- package/blocklySkini/blockly/core/toolbox/toolbox.js +984 -0
- package/blocklySkini/blockly/core/toolbox/toolbox_item.js +145 -0
- package/blocklySkini/blockly/core/toolbox.js +943 -0
- package/blocklySkini/blockly/core/tooltip.js +387 -0
- package/blocklySkini/blockly/core/touch.js +255 -0
- package/blocklySkini/blockly/core/touch_gesture.js +325 -0
- package/blocklySkini/blockly/core/trashcan.js +661 -0
- package/blocklySkini/blockly/core/ui_events.js +85 -0
- package/blocklySkini/blockly/core/utils/aria.js +167 -0
- package/blocklySkini/blockly/core/utils/colour.js +208 -0
- package/blocklySkini/blockly/core/utils/coordinate.js +125 -0
- package/blocklySkini/blockly/core/utils/deprecation.js +34 -0
- package/blocklySkini/blockly/core/utils/dom.js +391 -0
- package/blocklySkini/blockly/core/utils/global.js +37 -0
- package/blocklySkini/blockly/core/utils/idgenerator.js +33 -0
- package/blocklySkini/blockly/core/utils/keycodes.js +164 -0
- package/blocklySkini/blockly/core/utils/math.js +56 -0
- package/blocklySkini/blockly/core/utils/metrics.js +124 -0
- package/blocklySkini/blockly/core/utils/object.js +73 -0
- package/blocklySkini/blockly/core/utils/rect.js +54 -0
- package/blocklySkini/blockly/core/utils/size.js +58 -0
- package/blocklySkini/blockly/core/utils/string.js +284 -0
- package/blocklySkini/blockly/core/utils/style.js +281 -0
- package/blocklySkini/blockly/core/utils/svg.js +181 -0
- package/blocklySkini/blockly/core/utils/svg_paths.js +142 -0
- package/blocklySkini/blockly/core/utils/toolbox.js +401 -0
- package/blocklySkini/blockly/core/utils/useragent.js +110 -0
- package/blocklySkini/blockly/core/utils/xml.js +79 -0
- package/blocklySkini/blockly/core/utils.js +652 -0
- package/blocklySkini/blockly/core/variable_events.js +248 -0
- package/blocklySkini/blockly/core/variable_map.js +414 -0
- package/blocklySkini/blockly/core/variable_model.js +95 -0
- package/blocklySkini/blockly/core/variables.js +571 -0
- package/blocklySkini/blockly/core/variables_dynamic.js +100 -0
- package/blocklySkini/blockly/core/warning.js +200 -0
- package/blocklySkini/blockly/core/widgetdiv.js +241 -0
- package/blocklySkini/blockly/core/workspace.js +786 -0
- package/blocklySkini/blockly/core/workspace_audio.js +153 -0
- package/blocklySkini/blockly/core/workspace_comment.js +373 -0
- package/blocklySkini/blockly/core/workspace_comment_render_svg.js +461 -0
- package/blocklySkini/blockly/core/workspace_comment_svg.js +701 -0
- package/blocklySkini/blockly/core/workspace_drag_surface_svg.js +176 -0
- package/blocklySkini/blockly/core/workspace_dragger.js +85 -0
- package/blocklySkini/blockly/core/workspace_events.js +93 -0
- package/blocklySkini/blockly/core/workspace_svg.js +2661 -0
- package/blocklySkini/blockly/core/ws_comment_events.js +417 -0
- package/blocklySkini/blockly/core/xml.js +827 -0
- package/blocklySkini/blockly/core/zoom_controls.js +449 -0
- package/blocklySkini/blockly/core-browser.js +34 -0
- package/blocklySkini/blockly/core.d.ts +15 -0
- package/blocklySkini/blockly/core.js +38 -0
- package/blocklySkini/blockly/dart.d.ts +15 -0
- package/blocklySkini/blockly/dart.js +27 -0
- package/blocklySkini/blockly/dart_compressed.js +114 -0
- package/blocklySkini/blockly/dart_compressed.js.map +1 -0
- package/blocklySkini/blockly/generators/dart/colour.js +114 -0
- package/blocklySkini/blockly/generators/dart/lists.js +447 -0
- package/blocklySkini/blockly/generators/dart/logic.js +127 -0
- package/blocklySkini/blockly/generators/dart/loops.js +169 -0
- package/blocklySkini/blockly/generators/dart/math.js +485 -0
- package/blocklySkini/blockly/generators/dart/procedures.js +111 -0
- package/blocklySkini/blockly/generators/dart/text.js +339 -0
- package/blocklySkini/blockly/generators/dart/variables.js +32 -0
- package/blocklySkini/blockly/generators/dart/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/dart.js +290 -0
- package/blocklySkini/blockly/generators/javascript/colour.js +89 -0
- package/blocklySkini/blockly/generators/javascript/lists.js +388 -0
- package/blocklySkini/blockly/generators/javascript/logic.js +129 -0
- package/blocklySkini/blockly/generators/javascript/loops.js +184 -0
- package/blocklySkini/blockly/generators/javascript/math.js +409 -0
- package/blocklySkini/blockly/generators/javascript/procedures.js +113 -0
- package/blocklySkini/blockly/generators/javascript/text.js +367 -0
- package/blocklySkini/blockly/generators/javascript/variables.js +32 -0
- package/blocklySkini/blockly/generators/javascript/variables_dynamic.js +23 -0
- package/blocklySkini/blockly/generators/javascript.js +317 -0
- package/blocklySkini/blockly/generators/lua/colour.js +76 -0
- package/blocklySkini/blockly/generators/lua/lists.js +368 -0
- package/blocklySkini/blockly/generators/lua/logic.js +127 -0
- package/blocklySkini/blockly/generators/lua/loops.js +173 -0
- package/blocklySkini/blockly/generators/lua/math.js +423 -0
- package/blocklySkini/blockly/generators/lua/procedures.js +113 -0
- package/blocklySkini/blockly/generators/lua/text.js +353 -0
- package/blocklySkini/blockly/generators/lua/variables.js +32 -0
- package/blocklySkini/blockly/generators/lua/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/lua.js +198 -0
- package/blocklySkini/blockly/generators/php/colour.js +91 -0
- package/blocklySkini/blockly/generators/php/lists.js +498 -0
- package/blocklySkini/blockly/generators/php/logic.js +128 -0
- package/blocklySkini/blockly/generators/php/loops.js +170 -0
- package/blocklySkini/blockly/generators/php/math.js +370 -0
- package/blocklySkini/blockly/generators/php/procedures.js +132 -0
- package/blocklySkini/blockly/generators/php/text.js +271 -0
- package/blocklySkini/blockly/generators/php/variables.js +32 -0
- package/blocklySkini/blockly/generators/php/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/php.js +318 -0
- package/blocklySkini/blockly/generators/python/colour.js +72 -0
- package/blocklySkini/blockly/generators/python/lists.js +349 -0
- package/blocklySkini/blockly/generators/python/logic.js +127 -0
- package/blocklySkini/blockly/generators/python/loops.js +214 -0
- package/blocklySkini/blockly/generators/python/math.js +385 -0
- package/blocklySkini/blockly/generators/python/procedures.js +134 -0
- package/blocklySkini/blockly/generators/python/text.js +293 -0
- package/blocklySkini/blockly/generators/python/variables.js +32 -0
- package/blocklySkini/blockly/generators/python/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/python.js +322 -0
- package/blocklySkini/blockly/index.d.ts +22 -0
- package/blocklySkini/blockly/index.js +24 -0
- package/blocklySkini/blockly/javascript.d.ts +15 -0
- package/blocklySkini/blockly/javascript.js +27 -0
- package/blocklySkini/blockly/javascript_compressed.js +115 -0
- package/blocklySkini/blockly/javascript_compressed.js.map +1 -0
- package/blocklySkini/blockly/lua.d.ts +15 -0
- package/blocklySkini/blockly/lua.js +27 -0
- package/blocklySkini/blockly/lua_compressed.js +94 -0
- package/blocklySkini/blockly/lua_compressed.js.map +1 -0
- package/blocklySkini/blockly/media/1x1.gif +0 -0
- package/blocklySkini/blockly/media/click.mp3 +0 -0
- package/blocklySkini/blockly/media/click.ogg +0 -0
- package/blocklySkini/blockly/media/click.wav +0 -0
- package/blocklySkini/blockly/media/delete.mp3 +0 -0
- package/blocklySkini/blockly/media/delete.ogg +0 -0
- package/blocklySkini/blockly/media/delete.wav +0 -0
- package/blocklySkini/blockly/media/disconnect.mp3 +0 -0
- package/blocklySkini/blockly/media/disconnect.ogg +0 -0
- package/blocklySkini/blockly/media/disconnect.wav +0 -0
- package/blocklySkini/blockly/media/dropdown-arrow.svg +1 -0
- package/blocklySkini/blockly/media/handclosed.cur +0 -0
- package/blocklySkini/blockly/media/handdelete.cur +0 -0
- package/blocklySkini/blockly/media/handopen.cur +0 -0
- package/blocklySkini/blockly/media/pilcrow.png +0 -0
- package/blocklySkini/blockly/media/quote0.png +0 -0
- package/blocklySkini/blockly/media/quote1.png +0 -0
- package/blocklySkini/blockly/media/sprites.png +0 -0
- package/blocklySkini/blockly/media/sprites.svg +74 -0
- package/blocklySkini/blockly/msg/ab.d.ts +16 -0
- package/blocklySkini/blockly/msg/ab.js +447 -0
- package/blocklySkini/blockly/msg/ar.d.ts +16 -0
- package/blocklySkini/blockly/msg/ar.js +447 -0
- package/blocklySkini/blockly/msg/az.d.ts +16 -0
- package/blocklySkini/blockly/msg/az.js +447 -0
- package/blocklySkini/blockly/msg/ba.d.ts +16 -0
- package/blocklySkini/blockly/msg/ba.js +447 -0
- package/blocklySkini/blockly/msg/bcc.d.ts +16 -0
- package/blocklySkini/blockly/msg/bcc.js +447 -0
- package/blocklySkini/blockly/msg/be-tarask.d.ts +16 -0
- package/blocklySkini/blockly/msg/be-tarask.js +447 -0
- package/blocklySkini/blockly/msg/be.d.ts +16 -0
- package/blocklySkini/blockly/msg/be.js +447 -0
- package/blocklySkini/blockly/msg/bg.d.ts +16 -0
- package/blocklySkini/blockly/msg/bg.js +447 -0
- package/blocklySkini/blockly/msg/bn.d.ts +16 -0
- package/blocklySkini/blockly/msg/bn.js +447 -0
- package/blocklySkini/blockly/msg/br.d.ts +16 -0
- package/blocklySkini/blockly/msg/br.js +447 -0
- package/blocklySkini/blockly/msg/ca.d.ts +16 -0
- package/blocklySkini/blockly/msg/ca.js +447 -0
- package/blocklySkini/blockly/msg/constants.d.ts +16 -0
- package/blocklySkini/blockly/msg/cs.d.ts +16 -0
- package/blocklySkini/blockly/msg/cs.js +447 -0
- package/blocklySkini/blockly/msg/da.d.ts +16 -0
- package/blocklySkini/blockly/msg/da.js +447 -0
- package/blocklySkini/blockly/msg/de.d.ts +16 -0
- package/blocklySkini/blockly/msg/de.js +447 -0
- package/blocklySkini/blockly/msg/diq.d.ts +16 -0
- package/blocklySkini/blockly/msg/diq.js +447 -0
- package/blocklySkini/blockly/msg/dty.d.ts +16 -0
- package/blocklySkini/blockly/msg/dty.js +447 -0
- package/blocklySkini/blockly/msg/ee.d.ts +16 -0
- package/blocklySkini/blockly/msg/ee.js +447 -0
- package/blocklySkini/blockly/msg/el.d.ts +16 -0
- package/blocklySkini/blockly/msg/el.js +447 -0
- package/blocklySkini/blockly/msg/en-gb.d.ts +16 -0
- package/blocklySkini/blockly/msg/en-gb.js +447 -0
- package/blocklySkini/blockly/msg/en.d.ts +16 -0
- package/blocklySkini/blockly/msg/en.js +447 -0
- package/blocklySkini/blockly/msg/eo.d.ts +16 -0
- package/blocklySkini/blockly/msg/eo.js +447 -0
- package/blocklySkini/blockly/msg/es.d.ts +16 -0
- package/blocklySkini/blockly/msg/es.js +447 -0
- package/blocklySkini/blockly/msg/et.d.ts +16 -0
- package/blocklySkini/blockly/msg/et.js +447 -0
- package/blocklySkini/blockly/msg/eu.d.ts +16 -0
- package/blocklySkini/blockly/msg/eu.js +447 -0
- package/blocklySkini/blockly/msg/fa.d.ts +16 -0
- package/blocklySkini/blockly/msg/fa.js +447 -0
- package/blocklySkini/blockly/msg/fi.d.ts +16 -0
- package/blocklySkini/blockly/msg/fi.js +447 -0
- package/blocklySkini/blockly/msg/fr.d.ts +16 -0
- package/blocklySkini/blockly/msg/fr.js +447 -0
- package/blocklySkini/blockly/msg/gl.d.ts +16 -0
- package/blocklySkini/blockly/msg/gl.js +447 -0
- package/blocklySkini/blockly/msg/gor.d.ts +16 -0
- package/blocklySkini/blockly/msg/gor.js +447 -0
- package/blocklySkini/blockly/msg/ha.d.ts +16 -0
- package/blocklySkini/blockly/msg/ha.js +447 -0
- package/blocklySkini/blockly/msg/he.d.ts +16 -0
- package/blocklySkini/blockly/msg/he.js +447 -0
- package/blocklySkini/blockly/msg/hi.d.ts +16 -0
- package/blocklySkini/blockly/msg/hi.js +447 -0
- package/blocklySkini/blockly/msg/hrx.d.ts +16 -0
- package/blocklySkini/blockly/msg/hrx.js +447 -0
- package/blocklySkini/blockly/msg/hu.d.ts +16 -0
- package/blocklySkini/blockly/msg/hu.js +447 -0
- package/blocklySkini/blockly/msg/hy.d.ts +16 -0
- package/blocklySkini/blockly/msg/hy.js +447 -0
- package/blocklySkini/blockly/msg/ia.d.ts +16 -0
- package/blocklySkini/blockly/msg/ia.js +447 -0
- package/blocklySkini/blockly/msg/id.d.ts +16 -0
- package/blocklySkini/blockly/msg/id.js +447 -0
- package/blocklySkini/blockly/msg/ig.d.ts +16 -0
- package/blocklySkini/blockly/msg/ig.js +447 -0
- package/blocklySkini/blockly/msg/is.d.ts +16 -0
- package/blocklySkini/blockly/msg/is.js +447 -0
- package/blocklySkini/blockly/msg/it.d.ts +16 -0
- package/blocklySkini/blockly/msg/it.js +447 -0
- package/blocklySkini/blockly/msg/ja.d.ts +16 -0
- package/blocklySkini/blockly/msg/ja.js +447 -0
- package/blocklySkini/blockly/msg/kab.d.ts +16 -0
- package/blocklySkini/blockly/msg/kab.js +447 -0
- package/blocklySkini/blockly/msg/kn.d.ts +16 -0
- package/blocklySkini/blockly/msg/kn.js +447 -0
- package/blocklySkini/blockly/msg/ko.d.ts +16 -0
- package/blocklySkini/blockly/msg/ko.js +447 -0
- package/blocklySkini/blockly/msg/lb.d.ts +16 -0
- package/blocklySkini/blockly/msg/lb.js +447 -0
- package/blocklySkini/blockly/msg/lki.d.ts +16 -0
- package/blocklySkini/blockly/msg/lki.js +447 -0
- package/blocklySkini/blockly/msg/lo.d.ts +16 -0
- package/blocklySkini/blockly/msg/lo.js +447 -0
- package/blocklySkini/blockly/msg/lrc.d.ts +16 -0
- package/blocklySkini/blockly/msg/lrc.js +447 -0
- package/blocklySkini/blockly/msg/lt.d.ts +16 -0
- package/blocklySkini/blockly/msg/lt.js +447 -0
- package/blocklySkini/blockly/msg/lv.d.ts +16 -0
- package/blocklySkini/blockly/msg/lv.js +447 -0
- package/blocklySkini/blockly/msg/mk.d.ts +16 -0
- package/blocklySkini/blockly/msg/mk.js +447 -0
- package/blocklySkini/blockly/msg/mnw.d.ts +16 -0
- package/blocklySkini/blockly/msg/mnw.js +447 -0
- package/blocklySkini/blockly/msg/ms.d.ts +16 -0
- package/blocklySkini/blockly/msg/ms.js +447 -0
- package/blocklySkini/blockly/msg/msg.d.ts +444 -0
- package/blocklySkini/blockly/msg/nb.d.ts +16 -0
- package/blocklySkini/blockly/msg/nb.js +447 -0
- package/blocklySkini/blockly/msg/nl.d.ts +16 -0
- package/blocklySkini/blockly/msg/nl.js +447 -0
- package/blocklySkini/blockly/msg/oc.d.ts +16 -0
- package/blocklySkini/blockly/msg/oc.js +447 -0
- package/blocklySkini/blockly/msg/pl.d.ts +16 -0
- package/blocklySkini/blockly/msg/pl.js +447 -0
- package/blocklySkini/blockly/msg/pms.d.ts +16 -0
- package/blocklySkini/blockly/msg/pms.js +447 -0
- package/blocklySkini/blockly/msg/pt-br.d.ts +16 -0
- package/blocklySkini/blockly/msg/pt-br.js +447 -0
- package/blocklySkini/blockly/msg/pt.d.ts +16 -0
- package/blocklySkini/blockly/msg/pt.js +447 -0
- package/blocklySkini/blockly/msg/qqq.d.ts +16 -0
- package/blocklySkini/blockly/msg/ro.d.ts +16 -0
- package/blocklySkini/blockly/msg/ro.js +447 -0
- package/blocklySkini/blockly/msg/ru.d.ts +16 -0
- package/blocklySkini/blockly/msg/ru.js +447 -0
- package/blocklySkini/blockly/msg/sc.d.ts +16 -0
- package/blocklySkini/blockly/msg/sc.js +447 -0
- package/blocklySkini/blockly/msg/sd.d.ts +16 -0
- package/blocklySkini/blockly/msg/sd.js +447 -0
- package/blocklySkini/blockly/msg/shn.d.ts +16 -0
- package/blocklySkini/blockly/msg/shn.js +447 -0
- package/blocklySkini/blockly/msg/sk.d.ts +16 -0
- package/blocklySkini/blockly/msg/sk.js +447 -0
- package/blocklySkini/blockly/msg/skr-arab.d.ts +16 -0
- package/blocklySkini/blockly/msg/skr-arab.js +447 -0
- package/blocklySkini/blockly/msg/sl.d.ts +16 -0
- package/blocklySkini/blockly/msg/sl.js +447 -0
- package/blocklySkini/blockly/msg/sq.d.ts +16 -0
- package/blocklySkini/blockly/msg/sq.js +447 -0
- package/blocklySkini/blockly/msg/sr-latn.d.ts +16 -0
- package/blocklySkini/blockly/msg/sr-latn.js +447 -0
- package/blocklySkini/blockly/msg/sr.d.ts +16 -0
- package/blocklySkini/blockly/msg/sr.js +447 -0
- package/blocklySkini/blockly/msg/sv.d.ts +16 -0
- package/blocklySkini/blockly/msg/sv.js +447 -0
- package/blocklySkini/blockly/msg/synonyms.d.ts +16 -0
- package/blocklySkini/blockly/msg/ta.d.ts +16 -0
- package/blocklySkini/blockly/msg/ta.js +447 -0
- package/blocklySkini/blockly/msg/tcy.d.ts +16 -0
- package/blocklySkini/blockly/msg/tcy.js +447 -0
- package/blocklySkini/blockly/msg/te.d.ts +16 -0
- package/blocklySkini/blockly/msg/te.js +447 -0
- package/blocklySkini/blockly/msg/th.d.ts +16 -0
- package/blocklySkini/blockly/msg/th.js +447 -0
- package/blocklySkini/blockly/msg/tl.d.ts +16 -0
- package/blocklySkini/blockly/msg/tl.js +447 -0
- package/blocklySkini/blockly/msg/tlh.d.ts +16 -0
- package/blocklySkini/blockly/msg/tlh.js +447 -0
- package/blocklySkini/blockly/msg/tr.d.ts +16 -0
- package/blocklySkini/blockly/msg/tr.js +447 -0
- package/blocklySkini/blockly/msg/ug-arab.d.ts +16 -0
- package/blocklySkini/blockly/msg/ug-arab.js +447 -0
- package/blocklySkini/blockly/msg/uk.d.ts +16 -0
- package/blocklySkini/blockly/msg/uk.js +447 -0
- package/blocklySkini/blockly/msg/ur.d.ts +16 -0
- package/blocklySkini/blockly/msg/ur.js +447 -0
- package/blocklySkini/blockly/msg/vi.d.ts +16 -0
- package/blocklySkini/blockly/msg/vi.js +447 -0
- package/blocklySkini/blockly/msg/xmf.d.ts +16 -0
- package/blocklySkini/blockly/msg/xmf.js +447 -0
- package/blocklySkini/blockly/msg/yo.d.ts +16 -0
- package/blocklySkini/blockly/msg/yo.js +447 -0
- package/blocklySkini/blockly/msg/zh-hans.d.ts +16 -0
- package/blocklySkini/blockly/msg/zh-hans.js +447 -0
- package/blocklySkini/blockly/msg/zh-hant.d.ts +16 -0
- package/blocklySkini/blockly/msg/zh-hant.js +447 -0
- package/blocklySkini/blockly/node.js +35 -0
- package/blocklySkini/blockly/package.json +84 -0
- package/blocklySkini/blockly/php.d.ts +15 -0
- package/blocklySkini/blockly/php.js +27 -0
- package/blocklySkini/blockly/php_compressed.js +103 -0
- package/blocklySkini/blockly/php_compressed.js.map +1 -0
- package/blocklySkini/blockly/python.d.ts +15 -0
- package/blocklySkini/blockly/python.js +27 -0
- package/blocklySkini/blockly/python_compressed.js +98 -0
- package/blocklySkini/blockly/python_compressed.js.map +1 -0
- package/blocklySkini/blocklySkini.html +81 -0
- package/blocklySkini/orchestrations/.xml +1 -0
- package/blocklySkini/orchestrations/BluesSkini-1.xml +231 -0
- package/blocklySkini/orchestrations/BluesSkini-2.xml +741 -0
- package/blocklySkini/orchestrations/BluesSkini-3.xml +731 -0
- package/blocklySkini/orchestrations/BluesSkini-4.xml +695 -0
- package/blocklySkini/orchestrations/BluesSkini-5.xml +731 -0
- package/blocklySkini/orchestrations/BluesSkini.xml +704 -0
- package/blocklySkini/orchestrations/FunkBitwig-1.xml +778 -0
- package/blocklySkini/orchestrations/FunkBitwig-2.xml +471 -0
- package/blocklySkini/orchestrations/JouerLeBonInstrument1-1.xml +784 -0
- package/blocklySkini/orchestrations/MajeurMineur-1.xml +638 -0
- package/blocklySkini/orchestrations/Opus5-3 - Copie.xml +1041 -0
- package/blocklySkini/orchestrations/Opus5-3.xml +1128 -0
- package/blocklySkini/orchestrations/Quatuor1-1.xml +357 -0
- package/blocklySkini/orchestrations/TechnoBitwig-1.xml +221 -0
- package/blocklySkini/orchestrations/TestBlockly.xml +497 -0
- package/blocklySkini/orchestrations/TestBlockly1.xml +500 -0
- package/blocklySkini/orchestrations/TestBlockly2.xml +792 -0
- package/blocklySkini/orchestrations/TestBlockly3-1.xml +1182 -0
- package/blocklySkini/orchestrations/TestBlockly3.xml +1251 -0
- package/blocklySkini/orchestrations/TestFunction.xml +143 -0
- package/blocklySkini/orchestrations/TestIf.xml +80 -0
- package/blocklySkini/orchestrations/TestLoop.xml +127 -0
- package/blocklySkini/orchestrations/TestOrchestration2.xml +460 -0
- package/blocklySkini/orchestrations/TestPrint.xml +70 -0
- package/blocklySkini/orchestrations/TestSubMod.xml +81 -0
- package/blocklySkini/orchestrations/Testlogic.xml +113 -0
- package/blocklySkini/orchestrations/TrouveLaPercu-1.xml +813 -0
- package/blocklySkini/orchestrations/TrouveLaPercu-2.xml +813 -0
- package/blocklySkini/orchestrations/bar.xml +496 -0
- package/blocklySkini/orchestrations/bar2.xml +496 -0
- package/blocklySkini/orchestrations/foo.xml +500 -0
- package/blocklySkini/orchestrations/opus5Blockly - Copie.xml +496 -0
- package/blocklySkini/orchestrations/opus5Blockly-3.xml +868 -0
- package/blocklySkini/orchestrations/opus5Blockly.xml +496 -0
- package/blocklySkini/orchestrations/testOrchestration3.xml +483 -0
- package/blocklySkini/orchestrations/testOrchestration4.xml +487 -0
- package/blocklySkini/scripts/hiphop_blocks.js +6104 -0
- package/blocklySkini/scripts/main2.js +801 -0
- package/blocklySkini/styles/index.css +320 -0
- package/blocklySkini/styles/material.css +11552 -0
- package/package.json +3 -3
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Text Area field.
|
|
9
|
+
* @author fraser@google.com (Neil Fraser)
|
|
10
|
+
* @author Andrew Mee
|
|
11
|
+
* @author acbart@udel.edu (Austin Cory Bart)
|
|
12
|
+
*/
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
goog.provide('Blockly.FieldMultilineInput');
|
|
16
|
+
|
|
17
|
+
goog.require('Blockly.Css');
|
|
18
|
+
goog.require('Blockly.DropDownDiv');
|
|
19
|
+
goog.require('Blockly.FieldTextInput');
|
|
20
|
+
goog.require('Blockly.utils');
|
|
21
|
+
goog.require('Blockly.utils.aria');
|
|
22
|
+
goog.require('Blockly.utils.Coordinate');
|
|
23
|
+
goog.require('Blockly.utils.dom');
|
|
24
|
+
goog.require('Blockly.utils.KeyCodes');
|
|
25
|
+
goog.require('Blockly.utils.object');
|
|
26
|
+
goog.require('Blockly.utils.Svg');
|
|
27
|
+
goog.require('Blockly.utils.userAgent');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Class for an editable text area field.
|
|
32
|
+
* @param {string=} opt_value The initial content of the field. Should cast to a
|
|
33
|
+
* string. Defaults to an empty string if null or undefined.
|
|
34
|
+
* @param {Function=} opt_validator An optional function that is called
|
|
35
|
+
* to validate any constraints on what the user entered. Takes the new
|
|
36
|
+
* text as an argument and returns either the accepted text, a replacement
|
|
37
|
+
* text, or null to abort the change.
|
|
38
|
+
* @param {Object=} opt_config A map of options used to configure the field.
|
|
39
|
+
* See the [field creation documentation]{@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/text-input#creation}
|
|
40
|
+
* for a list of properties this parameter supports.
|
|
41
|
+
* @extends {Blockly.FieldTextInput}
|
|
42
|
+
* @constructor
|
|
43
|
+
*/
|
|
44
|
+
Blockly.FieldMultilineInput = function(opt_value, opt_validator, opt_config) {
|
|
45
|
+
// TODO: Once this field is documented the opt_config link should point to its
|
|
46
|
+
// creation documentation, rather than the text input field's.
|
|
47
|
+
Blockly.FieldMultilineInput.superClass_.constructor.call(this,
|
|
48
|
+
opt_value, opt_validator, opt_config);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The SVG group element that will contain a text element for each text row
|
|
52
|
+
* when initialized.
|
|
53
|
+
* @type {SVGGElement}
|
|
54
|
+
*/
|
|
55
|
+
this.textGroup_ = null;
|
|
56
|
+
};
|
|
57
|
+
Blockly.utils.object.inherits(Blockly.FieldMultilineInput,
|
|
58
|
+
Blockly.FieldTextInput);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Construct a FieldMultilineInput from a JSON arg object,
|
|
62
|
+
* dereferencing any string table references.
|
|
63
|
+
* @param {!Object} options A JSON object with options (text, and spellcheck).
|
|
64
|
+
* @return {!Blockly.FieldMultilineInput} The new field instance.
|
|
65
|
+
* @package
|
|
66
|
+
* @nocollapse
|
|
67
|
+
*/
|
|
68
|
+
Blockly.FieldMultilineInput.fromJson = function(options) {
|
|
69
|
+
var text = Blockly.utils.replaceMessageReferences(options['text']);
|
|
70
|
+
return new Blockly.FieldMultilineInput(text, undefined, options);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Serializes this field's value to XML. Should only be called by Blockly.Xml.
|
|
75
|
+
* @param {!Element} fieldElement The element to populate with info about the
|
|
76
|
+
* field's state.
|
|
77
|
+
* @return {!Element} The element containing info about the field's state.
|
|
78
|
+
* @package
|
|
79
|
+
*/
|
|
80
|
+
Blockly.FieldMultilineInput.prototype.toXml = function(fieldElement) {
|
|
81
|
+
// Replace '\n' characters with html-escaped equivalent '
'. This is
|
|
82
|
+
// needed so the plain-text representation of the xml produced by
|
|
83
|
+
// `Blockly.Xml.domToText` will appear on a single line (this is a limitation
|
|
84
|
+
// of the plain-text format).
|
|
85
|
+
fieldElement.textContent = this.getValue().replace(/\n/g, ' ');
|
|
86
|
+
return fieldElement;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Sets the field's value based on the given XML element. Should only be
|
|
91
|
+
* called by Blockly.Xml.
|
|
92
|
+
* @param {!Element} fieldElement The element containing info about the
|
|
93
|
+
* field's state.
|
|
94
|
+
* @package
|
|
95
|
+
*/
|
|
96
|
+
Blockly.FieldMultilineInput.prototype.fromXml = function(fieldElement) {
|
|
97
|
+
this.setValue(fieldElement.textContent.replace(/ /g, '\n'));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Create the block UI for this field.
|
|
102
|
+
* @package
|
|
103
|
+
*/
|
|
104
|
+
Blockly.FieldMultilineInput.prototype.initView = function() {
|
|
105
|
+
this.createBorderRect_();
|
|
106
|
+
this.textGroup_ = Blockly.utils.dom.createSvgElement(
|
|
107
|
+
Blockly.utils.Svg.G, {
|
|
108
|
+
'class': 'blocklyEditableText',
|
|
109
|
+
}, this.fieldGroup_);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get the text from this field as displayed on screen. May differ from getText
|
|
114
|
+
* due to ellipsis, and other formatting.
|
|
115
|
+
* @return {string} Currently displayed text.
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
Blockly.FieldMultilineInput.prototype.getDisplayText_ = function() {
|
|
119
|
+
var value = this.value_;
|
|
120
|
+
if (!value) {
|
|
121
|
+
// Prevent the field from disappearing if empty.
|
|
122
|
+
return Blockly.Field.NBSP;
|
|
123
|
+
}
|
|
124
|
+
var lines = value.split('\n');
|
|
125
|
+
value = '';
|
|
126
|
+
for (var i = 0; i < lines.length; i++) {
|
|
127
|
+
var text = lines[i];
|
|
128
|
+
if (text.length > this.maxDisplayLength) {
|
|
129
|
+
// Truncate displayed string and add an ellipsis ('...').
|
|
130
|
+
text = text.substring(0, this.maxDisplayLength - 4) + '...';
|
|
131
|
+
}
|
|
132
|
+
// Replace whitespace with non-breaking spaces so the text doesn't collapse.
|
|
133
|
+
text = text.replace(/\s/g, Blockly.Field.NBSP);
|
|
134
|
+
|
|
135
|
+
value += text;
|
|
136
|
+
if (i !== lines.length - 1) {
|
|
137
|
+
value += '\n';
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (this.sourceBlock_.RTL) {
|
|
141
|
+
// The SVG is LTR, force value to be RTL.
|
|
142
|
+
value += '\u200F';
|
|
143
|
+
}
|
|
144
|
+
return value;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Updates the text of the textElement.
|
|
149
|
+
* @protected
|
|
150
|
+
*/
|
|
151
|
+
Blockly.FieldMultilineInput.prototype.render_ = function() {
|
|
152
|
+
// Remove all text group children.
|
|
153
|
+
var currentChild;
|
|
154
|
+
while ((currentChild = this.textGroup_.firstChild)) {
|
|
155
|
+
this.textGroup_.removeChild(currentChild);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Add in text elements into the group.
|
|
159
|
+
var lines = this.getDisplayText_().split('\n');
|
|
160
|
+
var y = 0;
|
|
161
|
+
for (var i = 0; i < lines.length; i++) {
|
|
162
|
+
var lineHeight = this.getConstants().FIELD_TEXT_HEIGHT +
|
|
163
|
+
this.getConstants().FIELD_BORDER_RECT_Y_PADDING;
|
|
164
|
+
var span = Blockly.utils.dom.createSvgElement(
|
|
165
|
+
Blockly.utils.Svg.TEXT, {
|
|
166
|
+
'class': 'blocklyText blocklyMultilineText',
|
|
167
|
+
x: this.getConstants().FIELD_BORDER_RECT_X_PADDING,
|
|
168
|
+
y: y + this.getConstants().FIELD_BORDER_RECT_Y_PADDING,
|
|
169
|
+
dy: this.getConstants().FIELD_TEXT_BASELINE
|
|
170
|
+
}, this.textGroup_);
|
|
171
|
+
span.appendChild(document.createTextNode(lines[i]));
|
|
172
|
+
y += lineHeight;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this.updateSize_();
|
|
176
|
+
|
|
177
|
+
if (this.isBeingEdited_) {
|
|
178
|
+
if (this.sourceBlock_.RTL) {
|
|
179
|
+
// in RTL, we need to let the browser reflow before resizing
|
|
180
|
+
// in order to get the correct bounding box of the borderRect
|
|
181
|
+
// avoiding issue #2777.
|
|
182
|
+
setTimeout(this.resizeEditor_.bind(this), 0);
|
|
183
|
+
} else {
|
|
184
|
+
this.resizeEditor_();
|
|
185
|
+
}
|
|
186
|
+
var htmlInput = /** @type {!HTMLElement} */(this.htmlInput_);
|
|
187
|
+
if (!this.isTextValid_) {
|
|
188
|
+
Blockly.utils.dom.addClass(htmlInput, 'blocklyInvalidInput');
|
|
189
|
+
Blockly.utils.aria.setState(htmlInput,
|
|
190
|
+
Blockly.utils.aria.State.INVALID, true);
|
|
191
|
+
} else {
|
|
192
|
+
Blockly.utils.dom.removeClass(htmlInput, 'blocklyInvalidInput');
|
|
193
|
+
Blockly.utils.aria.setState(htmlInput,
|
|
194
|
+
Blockly.utils.aria.State.INVALID, false);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Updates the size of the field based on the text.
|
|
201
|
+
* @protected
|
|
202
|
+
*/
|
|
203
|
+
Blockly.FieldMultilineInput.prototype.updateSize_ = function() {
|
|
204
|
+
var nodes = this.textGroup_.childNodes;
|
|
205
|
+
var totalWidth = 0;
|
|
206
|
+
var totalHeight = 0;
|
|
207
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
208
|
+
var tspan = /** @type {!Element} */ (nodes[i]);
|
|
209
|
+
var textWidth = Blockly.utils.dom.getTextWidth(tspan);
|
|
210
|
+
if (textWidth > totalWidth) {
|
|
211
|
+
totalWidth = textWidth;
|
|
212
|
+
}
|
|
213
|
+
totalHeight += this.getConstants().FIELD_TEXT_HEIGHT +
|
|
214
|
+
(i > 0 ? this.getConstants().FIELD_BORDER_RECT_Y_PADDING : 0);
|
|
215
|
+
}
|
|
216
|
+
if (this.borderRect_) {
|
|
217
|
+
totalHeight += this.getConstants().FIELD_BORDER_RECT_Y_PADDING * 2;
|
|
218
|
+
totalWidth += this.getConstants().FIELD_BORDER_RECT_X_PADDING * 2;
|
|
219
|
+
this.borderRect_.setAttribute('width', totalWidth);
|
|
220
|
+
this.borderRect_.setAttribute('height', totalHeight);
|
|
221
|
+
}
|
|
222
|
+
this.size_.width = totalWidth;
|
|
223
|
+
this.size_.height = totalHeight;
|
|
224
|
+
|
|
225
|
+
this.positionBorderRect_();
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Create the text input editor widget.
|
|
230
|
+
* @return {!HTMLTextAreaElement} The newly created text input editor.
|
|
231
|
+
* @protected
|
|
232
|
+
*/
|
|
233
|
+
Blockly.FieldMultilineInput.prototype.widgetCreate_ = function() {
|
|
234
|
+
var div = Blockly.WidgetDiv.DIV;
|
|
235
|
+
var scale = this.workspace_.getScale();
|
|
236
|
+
|
|
237
|
+
var htmlInput =
|
|
238
|
+
/** @type {HTMLTextAreaElement} */ (document.createElement('textarea'));
|
|
239
|
+
htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput';
|
|
240
|
+
htmlInput.setAttribute('spellcheck', this.spellcheck_);
|
|
241
|
+
var fontSize = (this.getConstants().FIELD_TEXT_FONTSIZE * scale) + 'pt';
|
|
242
|
+
div.style.fontSize = fontSize;
|
|
243
|
+
htmlInput.style.fontSize = fontSize;
|
|
244
|
+
var borderRadius = (Blockly.FieldTextInput.BORDERRADIUS * scale) + 'px';
|
|
245
|
+
htmlInput.style.borderRadius = borderRadius;
|
|
246
|
+
var paddingX = this.getConstants().FIELD_BORDER_RECT_X_PADDING * scale;
|
|
247
|
+
var paddingY = this.getConstants().FIELD_BORDER_RECT_Y_PADDING * scale / 2;
|
|
248
|
+
htmlInput.style.padding = paddingY + 'px ' + paddingX + 'px ' + paddingY +
|
|
249
|
+
'px ' + paddingX + 'px';
|
|
250
|
+
var lineHeight = this.getConstants().FIELD_TEXT_HEIGHT +
|
|
251
|
+
this.getConstants().FIELD_BORDER_RECT_Y_PADDING;
|
|
252
|
+
htmlInput.style.lineHeight = (lineHeight * scale) + 'px';
|
|
253
|
+
|
|
254
|
+
div.appendChild(htmlInput);
|
|
255
|
+
|
|
256
|
+
htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_);
|
|
257
|
+
htmlInput.untypedDefaultValue_ = this.value_;
|
|
258
|
+
htmlInput.oldValue_ = null;
|
|
259
|
+
if (Blockly.utils.userAgent.GECKO) {
|
|
260
|
+
// In FF, ensure the browser reflows before resizing to avoid issue #2777.
|
|
261
|
+
setTimeout(this.resizeEditor_.bind(this), 0);
|
|
262
|
+
} else {
|
|
263
|
+
this.resizeEditor_();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
this.bindInputEvents_(htmlInput);
|
|
267
|
+
|
|
268
|
+
return htmlInput;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Handle key down to the editor. Override the text input definition of this
|
|
273
|
+
* so as to not close the editor when enter is typed in.
|
|
274
|
+
* @param {!Event} e Keyboard event.
|
|
275
|
+
* @protected
|
|
276
|
+
*/
|
|
277
|
+
Blockly.FieldMultilineInput.prototype.onHtmlInputKeyDown_ = function(e) {
|
|
278
|
+
if (e.keyCode !== Blockly.utils.KeyCodes.ENTER) {
|
|
279
|
+
Blockly.FieldMultilineInput.superClass_.onHtmlInputKeyDown_.call(this, e);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* CSS for multiline field. See css.js for use.
|
|
285
|
+
*/
|
|
286
|
+
Blockly.Css.register([
|
|
287
|
+
/* eslint-disable indent */
|
|
288
|
+
'.blocklyHtmlTextAreaInput {',
|
|
289
|
+
'font-family: monospace;',
|
|
290
|
+
'resize: none;',
|
|
291
|
+
'overflow: hidden;',
|
|
292
|
+
'height: 100%;',
|
|
293
|
+
'text-align: left;',
|
|
294
|
+
'}'
|
|
295
|
+
/* eslint-enable indent */
|
|
296
|
+
]);
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
Blockly.fieldRegistry.register('field_multilinetext', Blockly.FieldMultilineInput);
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2016 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Number input field
|
|
9
|
+
* @author fenichel@google.com (Rachel Fenichel)
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
goog.provide('Blockly.FieldNumber');
|
|
14
|
+
|
|
15
|
+
goog.require('Blockly.fieldRegistry');
|
|
16
|
+
goog.require('Blockly.FieldTextInput');
|
|
17
|
+
goog.require('Blockly.utils.aria');
|
|
18
|
+
goog.require('Blockly.utils.object');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Class for an editable number field.
|
|
23
|
+
* @param {string|number=} opt_value The initial value of the field. Should cast
|
|
24
|
+
* to a number. Defaults to 0.
|
|
25
|
+
* @param {?(string|number)=} opt_min Minimum value.
|
|
26
|
+
* @param {?(string|number)=} opt_max Maximum value.
|
|
27
|
+
* @param {?(string|number)=} opt_precision Precision for value.
|
|
28
|
+
* @param {?Function=} opt_validator A function that is called to validate
|
|
29
|
+
* changes to the field's value. Takes in a number & returns a validated
|
|
30
|
+
* number, or null to abort the change.
|
|
31
|
+
* @param {Object=} opt_config A map of options used to configure the field.
|
|
32
|
+
* See the [field creation documentation]{@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/number#creation}
|
|
33
|
+
* for a list of properties this parameter supports.
|
|
34
|
+
* @extends {Blockly.FieldTextInput}
|
|
35
|
+
* @constructor
|
|
36
|
+
*/
|
|
37
|
+
Blockly.FieldNumber = function(opt_value, opt_min, opt_max, opt_precision,
|
|
38
|
+
opt_validator, opt_config) {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The minimum value this number field can contain.
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @protected
|
|
44
|
+
*/
|
|
45
|
+
this.min_ = -Infinity;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The maximum value this number field can contain.
|
|
49
|
+
* @type {number}
|
|
50
|
+
* @protected
|
|
51
|
+
*/
|
|
52
|
+
this.max_ = Infinity;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The multiple to which this fields value is rounded.
|
|
56
|
+
* @type {number}
|
|
57
|
+
* @protected
|
|
58
|
+
*/
|
|
59
|
+
this.precision_ = 0;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The number of decimal places to allow, or null to allow any number of
|
|
63
|
+
* decimal digits.
|
|
64
|
+
* @type {?number}
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
this.decimalPlaces_ = null;
|
|
68
|
+
|
|
69
|
+
Blockly.FieldNumber.superClass_.constructor.call(
|
|
70
|
+
this, opt_value, opt_validator, opt_config);
|
|
71
|
+
|
|
72
|
+
if (!opt_config) { // Only do one kind of configuration or the other.
|
|
73
|
+
this.setConstraints(opt_min, opt_max, opt_precision);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
Blockly.utils.object.inherits(Blockly.FieldNumber, Blockly.FieldTextInput);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The default value for this field.
|
|
80
|
+
* @type {*}
|
|
81
|
+
* @protected
|
|
82
|
+
*/
|
|
83
|
+
Blockly.FieldNumber.prototype.DEFAULT_VALUE = 0;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Construct a FieldNumber from a JSON arg object.
|
|
87
|
+
* @param {!Object} options A JSON object with options (value, min, max, and
|
|
88
|
+
* precision).
|
|
89
|
+
* @return {!Blockly.FieldNumber} The new field instance.
|
|
90
|
+
* @package
|
|
91
|
+
* @nocollapse
|
|
92
|
+
*/
|
|
93
|
+
Blockly.FieldNumber.fromJson = function(options) {
|
|
94
|
+
return new Blockly.FieldNumber(options['value'],
|
|
95
|
+
undefined, undefined, undefined, undefined, options);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Serializable fields are saved by the XML renderer, non-serializable fields
|
|
100
|
+
* are not. Editable fields should also be serializable.
|
|
101
|
+
* @type {boolean}
|
|
102
|
+
*/
|
|
103
|
+
Blockly.FieldNumber.prototype.SERIALIZABLE = true;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Configure the field based on the given map of options.
|
|
107
|
+
* @param {!Object} config A map of options to configure the field based on.
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
Blockly.FieldNumber.prototype.configure_ = function(config) {
|
|
111
|
+
Blockly.FieldNumber.superClass_.configure_.call(this, config);
|
|
112
|
+
this.setMinInternal_(config['min']);
|
|
113
|
+
this.setMaxInternal_(config['max']);
|
|
114
|
+
this.setPrecisionInternal_(config['precision']);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Set the maximum, minimum and precision constraints on this field.
|
|
119
|
+
* Any of these properties may be undefined or NaN to be disabled.
|
|
120
|
+
* Setting precision (usually a power of 10) enforces a minimum step between
|
|
121
|
+
* values. That is, the user's value will rounded to the closest multiple of
|
|
122
|
+
* precision. The least significant digit place is inferred from the precision.
|
|
123
|
+
* Integers values can be enforces by choosing an integer precision.
|
|
124
|
+
* @param {?(number|string|undefined)} min Minimum value.
|
|
125
|
+
* @param {?(number|string|undefined)} max Maximum value.
|
|
126
|
+
* @param {?(number|string|undefined)} precision Precision for value.
|
|
127
|
+
*/
|
|
128
|
+
Blockly.FieldNumber.prototype.setConstraints = function(min, max, precision) {
|
|
129
|
+
this.setMinInternal_(min);
|
|
130
|
+
this.setMaxInternal_(max);
|
|
131
|
+
this.setPrecisionInternal_(precision);
|
|
132
|
+
this.setValue(this.getValue());
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Sets the minimum value this field can contain. Updates the value to reflect.
|
|
137
|
+
* @param {?(number|string|undefined)} min Minimum value.
|
|
138
|
+
*/
|
|
139
|
+
Blockly.FieldNumber.prototype.setMin = function(min) {
|
|
140
|
+
this.setMinInternal_(min);
|
|
141
|
+
this.setValue(this.getValue());
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Sets the minimum value this field can contain. Called internally to avoid
|
|
146
|
+
* value updates.
|
|
147
|
+
* @param {?(number|string|undefined)} min Minimum value.
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
Blockly.FieldNumber.prototype.setMinInternal_ = function(min) {
|
|
151
|
+
if (min == null) {
|
|
152
|
+
this.min_ = -Infinity;
|
|
153
|
+
} else {
|
|
154
|
+
min = Number(min);
|
|
155
|
+
if (!isNaN(min)) {
|
|
156
|
+
this.min_ = min;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Returns the current minimum value this field can contain. Default is
|
|
163
|
+
* -Infinity.
|
|
164
|
+
* @return {number} The current minimum value this field can contain.
|
|
165
|
+
*/
|
|
166
|
+
Blockly.FieldNumber.prototype.getMin = function() {
|
|
167
|
+
return this.min_;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Sets the maximum value this field can contain. Updates the value to reflect.
|
|
172
|
+
* @param {?(number|string|undefined)} max Maximum value.
|
|
173
|
+
*/
|
|
174
|
+
Blockly.FieldNumber.prototype.setMax = function(max) {
|
|
175
|
+
this.setMaxInternal_(max);
|
|
176
|
+
this.setValue(this.getValue());
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Sets the maximum value this field can contain. Called internally to avoid
|
|
181
|
+
* value updates.
|
|
182
|
+
* @param {?(number|string|undefined)} max Maximum value.
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
Blockly.FieldNumber.prototype.setMaxInternal_ = function(max) {
|
|
186
|
+
if (max == null) {
|
|
187
|
+
this.max_ = Infinity;
|
|
188
|
+
} else {
|
|
189
|
+
max = Number(max);
|
|
190
|
+
if (!isNaN(max)) {
|
|
191
|
+
this.max_ = max;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Returns the current maximum value this field can contain. Default is
|
|
198
|
+
* Infinity.
|
|
199
|
+
* @return {number} The current maximum value this field can contain.
|
|
200
|
+
*/
|
|
201
|
+
Blockly.FieldNumber.prototype.getMax = function() {
|
|
202
|
+
return this.max_;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Sets the precision of this field's value, i.e. the number to which the
|
|
207
|
+
* value is rounded. Updates the field to reflect.
|
|
208
|
+
* @param {?(number|string|undefined)} precision The number to which the
|
|
209
|
+
* field's value is rounded.
|
|
210
|
+
*/
|
|
211
|
+
Blockly.FieldNumber.prototype.setPrecision = function(precision) {
|
|
212
|
+
this.setPrecisionInternal_(precision);
|
|
213
|
+
this.setValue(this.getValue());
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Sets the precision of this field's value. Called internally to avoid
|
|
218
|
+
* value updates.
|
|
219
|
+
* @param {?(number|string|undefined)} precision The number to which the
|
|
220
|
+
* field's value is rounded.
|
|
221
|
+
* @private
|
|
222
|
+
*/
|
|
223
|
+
Blockly.FieldNumber.prototype.setPrecisionInternal_ = function(precision) {
|
|
224
|
+
if (precision == null) {
|
|
225
|
+
// Number(precision) would also be 0, but set explicitly to be clear.
|
|
226
|
+
this.precision_ = 0;
|
|
227
|
+
} else {
|
|
228
|
+
precision = Number(precision);
|
|
229
|
+
if (!isNaN(precision)) {
|
|
230
|
+
this.precision_ = precision;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
var precisionString = this.precision_.toLocaleString("en-US", {maximumFractionDigits: 20});
|
|
235
|
+
var decimalIndex = precisionString.indexOf('.');
|
|
236
|
+
if (decimalIndex == -1) {
|
|
237
|
+
// If the precision is 0 (float) allow any number of decimals,
|
|
238
|
+
// otherwise allow none.
|
|
239
|
+
this.decimalPlaces_ = precision ? 0 : null;
|
|
240
|
+
} else {
|
|
241
|
+
this.decimalPlaces_ = precisionString.length - decimalIndex - 1;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Returns the current precision of this field. The precision being the
|
|
247
|
+
* number to which the field's value is rounded. A precision of 0 means that
|
|
248
|
+
* the value is not rounded.
|
|
249
|
+
* @return {number} The number to which this field's value is rounded.
|
|
250
|
+
*/
|
|
251
|
+
Blockly.FieldNumber.prototype.getPrecision = function() {
|
|
252
|
+
return this.precision_;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Ensure that the input value is a valid number (must fulfill the
|
|
257
|
+
* constraints placed on the field).
|
|
258
|
+
* @param {*=} opt_newValue The input value.
|
|
259
|
+
* @return {?number} A valid number, or null if invalid.
|
|
260
|
+
* @protected
|
|
261
|
+
* @override
|
|
262
|
+
*/
|
|
263
|
+
Blockly.FieldNumber.prototype.doClassValidation_ = function(opt_newValue) {
|
|
264
|
+
if (opt_newValue === null) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
// Clean up text.
|
|
268
|
+
var newValue = String(opt_newValue);
|
|
269
|
+
// TODO: Handle cases like 'ten', '1.203,14', etc.
|
|
270
|
+
// 'O' is sometimes mistaken for '0' by inexperienced users.
|
|
271
|
+
newValue = newValue.replace(/O/ig, '0');
|
|
272
|
+
// Strip out thousands separators.
|
|
273
|
+
newValue = newValue.replace(/,/g, '');
|
|
274
|
+
// Ignore case of 'Infinity'.
|
|
275
|
+
newValue = newValue.replace(/infinity/i, 'Infinity');
|
|
276
|
+
|
|
277
|
+
// Clean up number.
|
|
278
|
+
var n = Number(newValue || 0);
|
|
279
|
+
if (isNaN(n)) {
|
|
280
|
+
// Invalid number.
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
// Get the value in range.
|
|
284
|
+
n = Math.min(Math.max(n, this.min_), this.max_);
|
|
285
|
+
// Round to nearest multiple of precision.
|
|
286
|
+
if (this.precision_ && isFinite(n)) {
|
|
287
|
+
n = Math.round(n / this.precision_) * this.precision_;
|
|
288
|
+
}
|
|
289
|
+
// Clean up floating point errors.
|
|
290
|
+
if (this.decimalPlaces_ != null) {
|
|
291
|
+
n = Number(n.toFixed(this.decimalPlaces_));
|
|
292
|
+
}
|
|
293
|
+
return n;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Create the number input editor widget.
|
|
298
|
+
* @return {!HTMLElement} The newly created number input editor.
|
|
299
|
+
* @protected
|
|
300
|
+
* @override
|
|
301
|
+
*/
|
|
302
|
+
Blockly.FieldNumber.prototype.widgetCreate_ = function() {
|
|
303
|
+
var htmlInput = Blockly.FieldNumber.superClass_.widgetCreate_.call(this);
|
|
304
|
+
|
|
305
|
+
// Set the accessibility state
|
|
306
|
+
if (this.min_ > -Infinity) {
|
|
307
|
+
Blockly.utils.aria.setState(htmlInput,
|
|
308
|
+
Blockly.utils.aria.State.VALUEMIN, this.min_);
|
|
309
|
+
}
|
|
310
|
+
if (this.max_ < Infinity) {
|
|
311
|
+
Blockly.utils.aria.setState(htmlInput,
|
|
312
|
+
Blockly.utils.aria.State.VALUEMAX, this.max_);
|
|
313
|
+
}
|
|
314
|
+
return htmlInput;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
Blockly.fieldRegistry.register('field_number', Blockly.FieldNumber);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Fields can be created based on a JSON definition. This file
|
|
9
|
+
* contains methods for registering those JSON definitions, and building the
|
|
10
|
+
* fields based on JSON.
|
|
11
|
+
* @author bekawestberg@gmail.com (Beka Westberg)
|
|
12
|
+
*/
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
goog.provide('Blockly.fieldRegistry');
|
|
16
|
+
|
|
17
|
+
goog.require('Blockly.registry');
|
|
18
|
+
|
|
19
|
+
goog.requireType('Blockly.IRegistrableField');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Registers a field type.
|
|
24
|
+
* Blockly.fieldRegistry.fromJson uses this registry to
|
|
25
|
+
* find the appropriate field type.
|
|
26
|
+
* @param {string} type The field type name as used in the JSON definition.
|
|
27
|
+
* @param {!Blockly.IRegistrableField} fieldClass The field class containing a
|
|
28
|
+
* fromJson function that can construct an instance of the field.
|
|
29
|
+
* @throws {Error} if the type name is empty, the field is already
|
|
30
|
+
* registered, or the fieldClass is not an object containing a fromJson
|
|
31
|
+
* function.
|
|
32
|
+
*/
|
|
33
|
+
Blockly.fieldRegistry.register = function(type, fieldClass) {
|
|
34
|
+
Blockly.registry.register(Blockly.registry.Type.FIELD, type, fieldClass);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Unregisters the field registered with the given type.
|
|
39
|
+
* @param {string} type The field type name as used in the JSON definition.
|
|
40
|
+
*/
|
|
41
|
+
Blockly.fieldRegistry.unregister = function(type) {
|
|
42
|
+
Blockly.registry.unregister(Blockly.registry.Type.FIELD, type);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Construct a Field from a JSON arg object.
|
|
47
|
+
* Finds the appropriate registered field by the type name as registered using
|
|
48
|
+
* Blockly.fieldRegistry.register.
|
|
49
|
+
* @param {!Object} options A JSON object with a type and options specific
|
|
50
|
+
* to the field type.
|
|
51
|
+
* @return {Blockly.Field} The new field instance or null if a field wasn't
|
|
52
|
+
* found with the given type name
|
|
53
|
+
* @package
|
|
54
|
+
*/
|
|
55
|
+
Blockly.fieldRegistry.fromJson = function(options) {
|
|
56
|
+
var fieldObject = /** @type {?Blockly.IRegistrableField} */ (
|
|
57
|
+
Blockly.registry.getObject(Blockly.registry.Type.FIELD, options['type']));
|
|
58
|
+
if (!fieldObject) {
|
|
59
|
+
console.warn('Blockly could not create a field of type ' + options['type'] +
|
|
60
|
+
'. The field is probably not being registered. This could be because' +
|
|
61
|
+
' the file is not loaded, the field does not register itself (Issue' +
|
|
62
|
+
' #1584), or the registration is not being reached.');
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return fieldObject.fromJson(options);
|
|
66
|
+
};
|