pxt-core 7.4.18 → 7.4.22

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.
Files changed (44) hide show
  1. package/built/cli.js +6 -4
  2. package/built/pxt.js +6 -4
  3. package/built/pxtblockly.js +44 -28
  4. package/built/pxtblocks.js +31 -14
  5. package/built/pxteditor.d.ts +1 -0
  6. package/built/target.js +1 -1
  7. package/built/web/main.js +1 -1
  8. package/built/web/pxtasseteditor.js +1 -1
  9. package/built/web/pxtblockly.js +2 -2
  10. package/built/web/pxtblocks.js +1 -1
  11. package/built/web/pxtembed.js +2 -2
  12. package/built/web/react-common-skillmap.css +1 -1
  13. package/built/web/rtlreact-common-skillmap.css +1 -1
  14. package/built/web/rtlsemantic.css +3 -3
  15. package/built/web/semantic.css +3 -3
  16. package/built/web/skillmap/css/main.2d214a87.chunk.css +1 -0
  17. package/built/web/skillmap/js/2.f7cdfd75.chunk.js +2 -0
  18. package/built/web/skillmap/js/main.ace2b797.chunk.js +1 -0
  19. package/localtypings/pxtarget.d.ts +1 -0
  20. package/package.json +2 -2
  21. package/react-common/components/controls/Button.tsx +7 -3
  22. package/react-common/components/controls/FocusTrap.tsx +30 -4
  23. package/react-common/components/controls/MenuBar.tsx +8 -1
  24. package/react-common/components/controls/Modal.tsx +6 -3
  25. package/react-common/components/profile/BadgeInfo.tsx +9 -2
  26. package/react-common/components/profile/BadgeList.tsx +5 -5
  27. package/react-common/components/profile/Profile.tsx +5 -0
  28. package/react-common/components/profile/UserPane.tsx +9 -5
  29. package/react-common/components/types.d.ts +1 -0
  30. package/react-common/components/util.tsx +1 -0
  31. package/react-common/styles/controls/Button.less +37 -23
  32. package/react-common/styles/controls/MenuDropdown.less +1 -1
  33. package/react-common/styles/controls/Modal.less +2 -2
  34. package/react-common/styles/react-common-variables.less +3 -2
  35. package/theme/highcontrast.less +8 -7
  36. package/theme/image-editor/imageEditor.less +8 -0
  37. package/theme/tutorial-sidebar.less +99 -16
  38. package/theme/tutorial.less +16 -8
  39. package/webapp/public/blockly/blockly_compressed.js +7 -8
  40. package/webapp/public/blockly/blocks_compressed.js +6 -6
  41. package/webapp/public/skillmap.html +2 -2
  42. package/built/web/skillmap/css/main.56e8c859.chunk.css +0 -1
  43. package/built/web/skillmap/js/2.261d5eab.chunk.js +0 -2
  44. package/built/web/skillmap/js/main.7c45ef9f.chunk.js +0 -1
package/built/cli.js CHANGED
@@ -1757,11 +1757,17 @@ async function buildSemanticUIAsync(parsed) {
1757
1757
  "--include-path=" + lessIncludePaths
1758
1758
  ]
1759
1759
  });
1760
+ let fontAwesomeSource = "node_modules/@fortawesome/fontawesome-free/webfonts/";
1761
+ if (!fs.existsSync(fontAwesomeSource)) {
1762
+ fontAwesomeSource = "node_modules/pxt-core/" + fontAwesomeSource;
1763
+ }
1760
1764
  // Inline all of our icon fonts
1761
1765
  let semCss = await readFileAsync('built/web/semantic.css', "utf8");
1762
1766
  semCss = await linkFontAsync("icons", semCss);
1763
1767
  semCss = await linkFontAsync("outline-icons", semCss);
1764
1768
  semCss = await linkFontAsync("brand-icons", semCss);
1769
+ semCss = await linkFontAsync("fa-solid-900", semCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
1770
+ semCss = await linkFontAsync("fa-regular-400", semCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
1765
1771
  // Append icons.css to semantic.css (custom pxt icons)
1766
1772
  const iconsFile = isPxtCore ? 'built/web/icons.css' : 'node_modules/pxt-core/built/web/icons.css';
1767
1773
  const iconsCss = await readFileAsync(iconsFile, "utf8");
@@ -1791,10 +1797,6 @@ async function buildSemanticUIAsync(parsed) {
1791
1797
  "--include-path=" + lessIncludePaths
1792
1798
  ]
1793
1799
  });
1794
- let fontAwesomeSource = "node_modules/@fortawesome/fontawesome-free/webfonts/";
1795
- if (!fs.existsSync(fontAwesomeSource)) {
1796
- fontAwesomeSource = "node_modules/pxt-core/" + fontAwesomeSource;
1797
- }
1798
1800
  let skillmapCss = await readFileAsync(`built/web/react-common-skillmap.css`, "utf8");
1799
1801
  skillmapCss = await linkFontAsync("fa-solid-900", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
1800
1802
  skillmapCss = await linkFontAsync("fa-regular-400", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
package/built/pxt.js CHANGED
@@ -157707,11 +157707,17 @@ async function buildSemanticUIAsync(parsed) {
157707
157707
  "--include-path=" + lessIncludePaths
157708
157708
  ]
157709
157709
  });
157710
+ let fontAwesomeSource = "node_modules/@fortawesome/fontawesome-free/webfonts/";
157711
+ if (!fs.existsSync(fontAwesomeSource)) {
157712
+ fontAwesomeSource = "node_modules/pxt-core/" + fontAwesomeSource;
157713
+ }
157710
157714
  // Inline all of our icon fonts
157711
157715
  let semCss = await readFileAsync('built/web/semantic.css', "utf8");
157712
157716
  semCss = await linkFontAsync("icons", semCss);
157713
157717
  semCss = await linkFontAsync("outline-icons", semCss);
157714
157718
  semCss = await linkFontAsync("brand-icons", semCss);
157719
+ semCss = await linkFontAsync("fa-solid-900", semCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
157720
+ semCss = await linkFontAsync("fa-regular-400", semCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
157715
157721
  // Append icons.css to semantic.css (custom pxt icons)
157716
157722
  const iconsFile = isPxtCore ? 'built/web/icons.css' : 'node_modules/pxt-core/built/web/icons.css';
157717
157723
  const iconsCss = await readFileAsync(iconsFile, "utf8");
@@ -157741,10 +157747,6 @@ async function buildSemanticUIAsync(parsed) {
157741
157747
  "--include-path=" + lessIncludePaths
157742
157748
  ]
157743
157749
  });
157744
- let fontAwesomeSource = "node_modules/@fortawesome/fontawesome-free/webfonts/";
157745
- if (!fs.existsSync(fontAwesomeSource)) {
157746
- fontAwesomeSource = "node_modules/pxt-core/" + fontAwesomeSource;
157747
- }
157748
157750
  let skillmapCss = await readFileAsync(`built/web/react-common-skillmap.css`, "utf8");
157749
157751
  skillmapCss = await linkFontAsync("fa-solid-900", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
157750
157752
  skillmapCss = await linkFontAsync("fa-regular-400", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
@@ -701,7 +701,7 @@ Blockly.FieldLabel.prototype.setClass=function(a){this.textElement_&&(this.class
701
701
  */
702
702
  Blockly.FieldLabelHover=function(a,b){Blockly.FieldLabelHover.superClass_.constructor.call(this,a,b);this.arrowWidth_=0};Blockly.utils.object.inherits(Blockly.FieldLabelHover,Blockly.FieldLabel);
703
703
  Blockly.FieldLabelHover.prototype.initView=function(){Blockly.FieldLabelHover.superClass_.initView.call(this);this.sourceBlock_.isEditable()&&(this.mouseOverWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseover",this,this.onMouseOver_),this.mouseOutWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseout",this,this.onMouseOut_))};Blockly.FieldLabelHover.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldLabelHover(b,a["class"])};
704
- Blockly.FieldLabelHover.prototype.EDITABLE=!1;Blockly.FieldLabelHover.prototype.SERIALIZABLE=!0;Blockly.FieldLabelHover.prototype.updateWidth=function(){this.size_.width=Blockly.utils.dom.getFastTextWidth(this.textElement_,this.constants_.FIELD_TEXT_FONTSIZE,this.constants_.FIELD_TEXT_FONTWEIGHT,this.constants_.FIELD_TEXT_FONTFAMILY)};
704
+ Blockly.FieldLabelHover.prototype.EDITABLE=!1;Blockly.FieldLabelHover.prototype.SERIALIZABLE=!0;Blockly.FieldLabelHover.prototype.updateWidth=function(){this.size_.width=Blockly.utils.dom.getFastTextWidth(this.textElement_,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY)};
705
705
  Blockly.FieldLabelHover.prototype.onMouseOver_=function(a){!this.sourceBlock_.isInFlyout&&this.sourceBlock_.isShadow()&&(a=this.sourceBlock_.workspace.getGesture(a),a&&a.isDragging()||!this.sourceBlock_.pathObject.svgPath||(Blockly.utils.dom.addClass(this.sourceBlock_.pathObject.svgPath,"blocklyFieldHover"),this.sourceBlock_.pathObject.svgPath.style.strokeDasharray="2"))};
706
706
  Blockly.FieldLabelHover.prototype.clearHover=function(){this.sourceBlock_.pathObject.svgPath&&(Blockly.utils.dom.removeClass(this.sourceBlock_.pathObject.svgPath,"blocklyFieldHover"),this.sourceBlock_.pathObject.svgPath.style.strokeDasharray="")};Blockly.FieldLabelHover.prototype.onMouseOut_=function(a){!this.sourceBlock_.isInFlyout&&this.sourceBlock_.isShadow()&&((a=this.sourceBlock_.workspace.getGesture(a))&&a.isDragging()||this.clearHover())};
707
707
  Blockly.FieldLabelHover.dispose=function(){this.mouseOverWrapper_&&(Blockly.unbindEvent_(this.mouseOverWrapper_),this.mouseOverWrapper_=null);this.mouseOutWrapper_&&(Blockly.unbindEvent_(this.mouseOutWrapper_),this.mouseOutWrapper_=null);Blockly.FieldLabelHover.superClass_.dispose.call(this);this.variableMap_=this.workspace_=null};Blockly.fieldRegistry.register("field_label_hover",Blockly.FieldLabelHover);Blockly.FieldVariableGetter=function(a,b,c,d,e){this.defaultVariableName=a||"";this.size_=new Blockly.utils.Size(0,0);e&&this.configure_(e);b&&this.setValidator(b);e||this.setTypes_(c,d)};Blockly.utils.object.inherits(Blockly.FieldVariableGetter,Blockly.Field);Blockly.FieldVariableGetter.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariableGetter(b,null,a.variableTypes,a.defaultType)};Blockly.FieldVariableGetter.prototype.workspace_=null;
@@ -1656,7 +1656,7 @@ return Blockly.Functions.namesInUse(b,null,a)[c]?(Blockly.alert(Blockly.Msg.VARI
1656
1656
  Blockly.Functions.mutateCallersAndDefinition=function(a,b,c){var d=Blockly.Functions.getDefinition(a,b);d?(a=Blockly.Functions.getCallers(a,d.workspace),a.push(d),Blockly.Events.setGroup(!0),a.forEach(function(a){var b=a.mutationToDom(),e=b&&Blockly.Xml.domToText(b);a.domToMutation(c);var h=a.mutationToDom(),k=h&&Blockly.Xml.domToText(h);if(e!=k)if(Blockly.Events.fire(new Blockly.Events.BlockChange(a,"mutation",null,e,k)),a.id==d.id){var l=Blockly.Functions.getArgMap(b),m=Blockly.Functions.getArgMap(h,
1657
1657
  !0);d.getDescendants().forEach(function(a){if(Blockly.pxtBlocklyUtils.isFunctionArgumentReporter(a)){var b=a.getFieldValue("VALUE"),c=l[b];m[c]?m[c]!==b&&a.setFieldValue(m[c],"VALUE"):a.dispose()}})}else setTimeout(function(){a.bumpNeighbours()},Blockly.BUMP_DELAY)}),Blockly.Events.setGroup(!1)):console.warn("Attempted to change function "+a+", but no definition block was found on the workspace")};
1658
1658
  Blockly.Functions.createFlyout=function(a,b){var c=new Blockly.Options({scrollbars:!0,disabledPatternId:a.options.disabledPatternId,parentWorkspace:a,rtl:a.RTL,oneBasedIndex:a.options.oneBasedIndex,horizontalLayout:a.horizontalLayout,toolboxPosition:a.options.toolboxPosition,zoomOptions:a.options.zoomOptions,renderer:a.options.renderer,rendererOverrides:a.options.rendererOverrides,newFunctions:a.options.newFunctions,move:{scrollbars:!0}});c=c.horizontalLayout?new Blockly.HorizontalFlyout(c):new Blockly.VerticalFlyout(c);
1659
- var d=c.createDom("svg");goog.dom.insertSiblingAfter(d,b);c.init(a);return c};Blockly.VERSION="4.0.6";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.parentContainer=null;Blockly.svgSize=function(a){Blockly.utils.deprecation.warn("Blockly.svgSize","March 2021","March 2022","workspace.getCachedParentSvgSize");return new Blockly.utils.Size(a.cachedWidth_,a.cachedHeight_)};Blockly.resizeSvgContents=function(a){a.resizeContents()};
1659
+ var d=c.createDom("svg");goog.dom.insertSiblingAfter(d,b);c.init(a);return c};Blockly.VERSION="4.0.8";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.parentContainer=null;Blockly.svgSize=function(a){Blockly.utils.deprecation.warn("Blockly.svgSize","March 2021","March 2022","workspace.getCachedParentSvgSize");return new Blockly.utils.Size(a.cachedWidth_,a.cachedHeight_)};Blockly.resizeSvgContents=function(a){a.resizeContents()};
1660
1660
  Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=a.getCachedParentSvgSize(),d=b.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.width!=e&&(b.setAttribute("width",e+"px"),a.setCachedParentSvgSize(e,null));c.height!=d&&(b.setAttribute("height",d+"px"),a.setCachedParentSvgSize(null,d));a.resize()}};
1661
1661
  Blockly.onKeyDown=function(a){var b=Blockly.mainWorkspace;if(b&&!(Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible()))Blockly.ShortcutRegistry.registry.onKeyDown(b,a)};Blockly.deleteBlock=function(a){a.workspace.isFlyout||(Blockly.Events.setGroup(!0),Blockly.hideChaff(),a.outputConnection?a.dispose(!1,!0):a.dispose(!0,!0),Blockly.Events.setGroup(!1))};Blockly.copy=function(a){if(a=a.toCopyData())Blockly.clipboardXml_=a.xml,Blockly.clipboardSource_=a.source,Blockly.clipboardTypeCounts_=a.typeCounts};
1662
1662
  Blockly.paste=function(){if(!Blockly.clipboardXml_)return!1;var a=Blockly.clipboardSource_;a.isFlyout&&(a=a.targetWorkspace);return Blockly.clipboardTypeCounts_&&a.isCapacityAvailable(Blockly.clipboardTypeCounts_)?(Blockly.Events.setGroup(!0),a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1),!0):!1};
@@ -1986,8 +1986,7 @@ Blockly.ContextMenuItems.registerDisable=function(){Blockly.ContextMenuRegistry.
1986
1986
  scopeType:Blockly.ContextMenuRegistry.ScopeType.BLOCK,id:"blockDisable",weight:5})};
1987
1987
  Blockly.ContextMenuItems.registerDelete=function(){Blockly.ContextMenuRegistry.registry.register({displayText:function(a){var b=a.block;a=b.getDescendants(!1).length;(b=b.getNextBlock())&&(a-=b.getDescendants(!1).length);return 1==a?Blockly.Msg.DELETE_BLOCK:Blockly.Msg.DELETE_X_BLOCKS.replace("%1",String(a))},preconditionFn:function(a){return!a.block.isInFlyout&&a.block.isDeletable()?"enabled":"hidden"},callback:function(a){Blockly.Events.setGroup(!0);a.block&&Blockly.deleteBlock(a.block);Blockly.Events.setGroup(!1)},
1988
1988
  scopeType:Blockly.ContextMenuRegistry.ScopeType.BLOCK,id:"blockDelete",weight:6})};Blockly.ContextMenuItems.registerHelp=function(){Blockly.ContextMenuRegistry.registry.register({displayText:function(){return Blockly.Msg.HELP},preconditionFn:function(a){a=a.block;return("function"==typeof a.helpUrl?a.helpUrl():a.helpUrl)?"enabled":"hidden"},callback:function(a){a.block.showHelp()},scopeType:Blockly.ContextMenuRegistry.ScopeType.BLOCK,id:"blockHelp",weight:7})};
1989
- Blockly.ContextMenuItems.registerBlockOptions_=function(){Blockly.ContextMenuItems.registerDuplicate();Blockly.ContextMenuItems.registerComment();Blockly.ContextMenuItems.registerInline();Blockly.ContextMenuItems.registerCollapseExpandBlock();Blockly.ContextMenuItems.registerDisable();Blockly.ContextMenuItems.registerDelete();Blockly.ContextMenuItems.registerHelp()};Blockly.ContextMenuItems.registerDefaultOptions=function(){Blockly.ContextMenuItems.registerWorkspaceOptions_();Blockly.ContextMenuItems.registerBlockOptions_()};
1990
- Blockly.ContextMenuItems.registerDefaultOptions();Blockly.Mutator=function(a){Blockly.Mutator.superClass_.constructor.call(this,null);this.quarkNames_=a};Blockly.utils.object.inherits(Blockly.Mutator,Blockly.Icon);Blockly.Mutator.prototype.workspace_=null;Blockly.Mutator.prototype.workspaceWidth_=0;Blockly.Mutator.prototype.workspaceHeight_=0;Blockly.Mutator.prototype.setBlock=function(a){this.block_=a};Blockly.Mutator.prototype.getWorkspace=function(){return this.workspace_};
1989
+ Blockly.ContextMenuItems.registerBlockOptions_=function(){Blockly.ContextMenuItems.registerDuplicate();Blockly.ContextMenuItems.registerComment();Blockly.ContextMenuItems.registerCollapseExpandBlock();Blockly.ContextMenuItems.registerDisable();Blockly.ContextMenuItems.registerDelete();Blockly.ContextMenuItems.registerHelp()};Blockly.ContextMenuItems.registerDefaultOptions=function(){Blockly.ContextMenuItems.registerWorkspaceOptions_();Blockly.ContextMenuItems.registerBlockOptions_()};Blockly.ContextMenuItems.registerDefaultOptions();Blockly.Mutator=function(a){Blockly.Mutator.superClass_.constructor.call(this,null);this.quarkNames_=a};Blockly.utils.object.inherits(Blockly.Mutator,Blockly.Icon);Blockly.Mutator.prototype.workspace_=null;Blockly.Mutator.prototype.workspaceWidth_=0;Blockly.Mutator.prototype.workspaceHeight_=0;Blockly.Mutator.prototype.setBlock=function(a){this.block_=a};Blockly.Mutator.prototype.getWorkspace=function(){return this.workspace_};
1991
1990
  Blockly.Mutator.prototype.drawIcon_=function(a){Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{"class":"blocklyIconShape",rx:"10",ry:"10",height:"16",width:"16"},a);Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.PATH,{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},
1992
1991
  a);Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.CIRCLE,{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};Blockly.Mutator.prototype.iconClick_=function(a){this.block_.isEditable()&&Blockly.Icon.prototype.iconClick_.call(this,a)};
1993
1992
  Blockly.Mutator.prototype.createEditor_=function(){this.svgDialog_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.SVG,{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH},null);if(this.quarkNames_.length)for(var a=Blockly.utils.xml.createElement("xml"),b=0,c;c=this.quarkNames_[b];b++){var d=Blockly.utils.xml.createElement("block");d.setAttribute("type",c);a.appendChild(d)}else a=null;b=new Blockly.Options({disable:!1,parentWorkspace:this.block_.workspace,media:this.block_.workspace.options.pathToMedia,
@@ -2320,7 +2319,7 @@ Blockly.FieldDropdown.IMAGE_Y_OFFSET=5;Blockly.FieldDropdown.IMAGE_Y_PADDING=2*B
2320
2319
  Blockly.FieldDropdown.prototype.initView=function(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot();this.createTextElement_();this.imageElement_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{},this.fieldGroup_);this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_();this.borderRect_&&Blockly.utils.dom.addClass(this.borderRect_,"blocklyDropdownRect")};
2321
2320
  Blockly.FieldDropdown.prototype.shouldAddBorderRect_=function(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()};
2322
2321
  Blockly.FieldDropdown.prototype.createTextArrow_=function(){this.arrow_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TSPAN,{},this.textElement_);this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?Blockly.FieldDropdown.ARROW_CHAR+" ":" "+Blockly.FieldDropdown.ARROW_CHAR));this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):this.textElement_.appendChild(this.arrow_)};
2323
- Blockly.FieldDropdown.prototype.createSVGArrow_=function(){var a=Blockly.utils.userAgent.IE||Blockly.utils.userAgent.IOS,b=a?"image":"use";a=a?this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI:"#"+(this.constants_.dropdownArrowImageId||"blocklyDropdownArrowSvg");this.svgArrow_=Blockly.utils.dom.createSvgElement(b,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS,
2322
+ Blockly.FieldDropdown.prototype.createSVGArrow_=function(){var a=Blockly.utils.userAgent.IE||Blockly.utils.userAgent.IOS,b=a?"image":"use";a=a?this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI:"#"+(this.getConstants().dropdownArrowImageId||"blocklyDropdownArrowSvg");this.svgArrow_=Blockly.utils.dom.createSvgElement(b,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS,
2324
2323
  "xlink:href",a)};
2325
2324
  Blockly.FieldDropdown.prototype.showEditor_=function(a){this.dropdownCreate_();this.menu_.openingCoords=a&&"number"===typeof a.clientX?new Blockly.utils.Coordinate(a.clientX,a.clientY):null;this.menu_.render(Blockly.DropDownDiv.getContentDiv());a=this.menu_.getElement();Blockly.utils.dom.addClass(a,"blocklyDropdownMenu");if(this.getConstants().FIELD_DROPDOWN_COLOURED_DIV){a=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().getColour():this.sourceBlock_.getColour();var b=this.sourceBlock_.isShadow()?
2326
2325
  this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;Blockly.DropDownDiv.setColour(a,b)}Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this));this.menu_.focus();this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_);this.applyColour()};
@@ -2380,10 +2379,10 @@ Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.cli
2380
2379
  */
2381
2380
  Blockly.FieldTextDropdown=function(a,b,c,d){this.menuGenerator_=b;Blockly.FieldDropdown.prototype.trimOptions_.call(this);Blockly.FieldTextDropdown.superClass_.constructor.call(this,a,c,d);this.addArgType("textdropdown")};Blockly.utils.object.inherits(Blockly.FieldTextDropdown,Blockly.FieldTextInput);Blockly.FieldTextDropdown.fromJson=function(a){var b=new Blockly.FieldTextDropdown(a.text,a.options);"boolean"==typeof a.spellcheck&&b.setSpellcheck(a.spellcheck);return b};
2382
2381
  Blockly.FieldTextDropdown.DROPDOWN_SVG_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiM1NzVFNzUiLz48L3N2Zz4K";
2383
- Blockly.FieldTextDropdown.prototype.initView=function(){Blockly.FieldTextDropdown.superClass_.initView.call(this);this.createSVGArrow_()};Blockly.FieldTextDropdown.prototype.updateSize_=function(){Blockly.FieldTextDropdown.superClass_.updateSize_.call(this);var a=this.positionSVGArrow_(this.size_.width,this.size_.height/2-this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE/2);this.size_.width+=a};
2382
+ Blockly.FieldTextDropdown.prototype.initView=function(){Blockly.FieldTextDropdown.superClass_.initView.call(this);this.createSVGArrow_()};Blockly.FieldTextDropdown.prototype.updateSize_=function(){Blockly.FieldTextDropdown.superClass_.updateSize_.call(this);var a=this.positionSVGArrow_(this.size_.width,this.size_.height/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2);this.size_.width+=a};
2384
2383
  Blockly.FieldTextDropdown.prototype.dispose=function(){this.mouseUpWrapper_&&(Blockly.unbindEvent_(this.mouseUpWrapper_),this.mouseUpWrapper_=null,Blockly.Touch.clearTouchIdentifier());Blockly.FieldTextDropdown.superClass_.dispose.call(this)};
2385
2384
  Blockly.FieldTextDropdown.prototype.showEditor_=function(a){Blockly.FieldTextDropdown.superClass_.showEditor_.call(this,a,!1,Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD,!0,function(){this.dropDownOpen_||this.showDropdown_();Blockly.Touch.clearTouchIdentifier()})};Blockly.FieldTextDropdown.prototype.isOptionListDynamic=Blockly.FieldDropdown.prototype.isOptionListDynamic;Blockly.FieldTextDropdown.prototype.getOptions=Blockly.FieldDropdown.prototype.getOptions;
2386
- Blockly.FieldTextDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=Blockly.utils.dom.createSvgElement("image",{height:this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",Blockly.FieldTextDropdown.DROPDOWN_SVG_DATAURI)};Blockly.FieldTextDropdown.prototype.showDropdown_=Blockly.FieldDropdown.prototype.showEditor_;
2385
+ Blockly.FieldTextDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=Blockly.utils.dom.createSvgElement("image",{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",Blockly.FieldTextDropdown.DROPDOWN_SVG_DATAURI)};Blockly.FieldTextDropdown.prototype.showDropdown_=Blockly.FieldDropdown.prototype.showEditor_;
2387
2386
  Blockly.FieldTextDropdown.prototype.dropdownCreate_=Blockly.FieldDropdown.prototype.dropdownCreate_;Blockly.FieldTextDropdown.prototype.dropdownDispose_=Blockly.FieldDropdown.prototype.dropdownDispose_;Blockly.FieldTextDropdown.prototype.positionSVGArrow_=Blockly.FieldDropdown.prototype.positionSVGArrow_;Blockly.FieldTextDropdown.prototype.handleMenuActionEvent_=Blockly.FieldDropdown.prototype.handleMenuActionEvent_;
2388
2387
  Blockly.FieldTextDropdown.prototype.onItemSelected_=function(a,b){a=b.getValue();null!==a&&(this.setValue(a),Blockly.WidgetDiv.hideIfOwner(this))};Blockly.fieldRegistry.register("field_textdropdown",Blockly.FieldTextDropdown);Blockly.FieldMultilineInput=function(a,b,c){Blockly.FieldMultilineInput.superClass_.constructor.call(this,a,b,c);this.textGroup_=null;this.maxLines_=Infinity;this.isOverflowedY_=!1};Blockly.utils.object.inherits(Blockly.FieldMultilineInput,Blockly.FieldTextInput);Blockly.FieldMultilineInput.prototype.configure_=function(a){Blockly.FieldMultilineInput.superClass_.configure_.call(this,a);a.maxLines&&this.setMaxLines(a.maxLines)};
2389
2388
  Blockly.FieldMultilineInput.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldMultilineInput(b,void 0,a)};Blockly.FieldMultilineInput.prototype.toXml=function(a){a.textContent=this.getValue().replace(/\n/g,"
");return a};Blockly.FieldMultilineInput.prototype.fromXml=function(a){this.setValue(a.textContent.replace(/
/g,"\n"))};
@@ -2450,7 +2449,7 @@ function(a){a=d.getVariable(a,e);c.setValue(a.getId())},e);return}}this.setValue
2450
2449
  limitations under the License.
2451
2450
  */
2452
2451
  Blockly.FieldVerticalSeparator=function(){Blockly.FieldVerticalSeparator.superClass_.constructor.call(this)};Blockly.utils.object.inherits(Blockly.FieldVerticalSeparator,Blockly.Field);Blockly.FieldVerticalSeparator.fromJson=function(a){return new Blockly.FieldVerticalSeparator};Blockly.FieldVerticalSeparator.prototype.EDITABLE=!1;
2453
- Blockly.FieldVerticalSeparator.prototype.initView=function(){var a=this.constants_.ICON_SEPARATOR_HEIGHT;this.lineElement_=Blockly.utils.dom.createSvgElement("line",{stroke:this.sourceBlock_.style.colourSecondary,"stroke-linecap":"round",x1:0,y1:0,x2:0,y2:a},this.fieldGroup_);this.size_=new Blockly.utils.Size(1,a);this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_)};Blockly.FieldVerticalSeparator.prototype.setLineHeight=function(a){this.lineElement_.setAttribute("y2",a)};
2452
+ Blockly.FieldVerticalSeparator.prototype.initView=function(){var a=this.getConstants().ICON_SEPARATOR_HEIGHT;this.lineElement_=Blockly.utils.dom.createSvgElement("line",{stroke:this.sourceBlock_.style.colourSecondary,"stroke-linecap":"round",x1:0,y1:0,x2:0,y2:a},this.fieldGroup_);this.size_=new Blockly.utils.Size(1,a);this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_)};Blockly.FieldVerticalSeparator.prototype.setLineHeight=function(a){this.lineElement_.setAttribute("y2",a)};
2454
2453
  Blockly.FieldVerticalSeparator.prototype.dispose=function(){Blockly.utils.dom.removeNode(this.fieldGroup_);this.lineElement_=this.fieldGroup_=null};Blockly.FieldVerticalSeparator.prototype.getValue=function(){return null};Blockly.FieldVerticalSeparator.prototype.setValue=function(a){};Blockly.FieldVerticalSeparator.prototype.setText=function(a){};Blockly.FieldVerticalSeparator.prototype.render_=function(){};Blockly.FieldVerticalSeparator.prototype.updateWidth=function(){};
2455
2454
  Blockly.fieldRegistry.register("field_vertical_separator",Blockly.FieldVerticalSeparator);Blockly.FieldSlider=function(a,b,c,d,e,f,g){Blockly.FieldSlider.superClass_.constructor.call(this,a,null,null,null,g);this.setConstraints(b,c,d);this.step_=parseFloat(e)||void 0;this.labelText_=f};Blockly.utils.object.inherits(Blockly.FieldSlider,Blockly.FieldNumber);Blockly.FieldSlider.prototype.min_=null;Blockly.FieldSlider.prototype.max_=null;Blockly.FieldSlider.prototype.step_=null;Blockly.FieldSlider.prototype.precision_=null;Blockly.FieldSlider.prototype.labelText_=null;
2456
2455
  Blockly.FieldSlider.fromJson=function(a){return new Blockly.FieldSlider(a.value,a.min,a.max,a.precision,a.step,a.labelText)};Blockly.FieldSlider.prototype.setOptions=function(a,b,c,d){this.setConstraints(a,b,d);this.step_=parseFloat(c)||void 0;a=this.getNumRestrictor(this.min_,this.max_,this.precision_);this.setRestrictor(a)};Blockly.FieldSlider.prototype.setLabel=function(a){void 0!=a&&(this.labelText_=a)};Blockly.FieldSlider.prototype.setColor=function(a){void 0!=a&&(this.sliderColor_=a)};
@@ -2852,10 +2851,10 @@ Blockly.Blocks.lists_create_with={init:function(){Blockly.Extensions.apply("inli
2852
2851
  this.horizontalAfter_&&a.setAttribute("horizontalafter",this.horizontalAfter_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);if(a=a.getAttribute("horizontalafter"))this.horizontalAfter_=parseInt(a,10);this.updateShape_()},storeConnections_:function(){this.valueConnections_=[];for(var a=0;a<this.itemCount_;a++)this.valueConnections_.push(this.getInput("ADD"+a).connection.targetConnection)},restoreConnections_:function(){for(var a=0;a<this.itemCount_;a++)Blockly.Mutator.reconnect(this.valueConnections_[a],
2853
2852
  this,"ADD"+a)},addItem_:function(){function a(a,b){var c=[];if(!a||!a.children)return c;for(var d=0;d<a.children.length;d++){var e=a.children[d];e.tagName===b&&c.push(e)}return c}function b(a,b,d){if(b&&d){var e=Blockly.utils.xml.createElement("value");e.setAttribute("name",b);e.appendChild(c("shadow",d));a.appendChild(e)}}function c(a,b){a=Blockly.utils.xml.createElement(a);a.setAttribute("type",b);a.setAttribute("id",Blockly.utils.genUid());return a}this.storeConnections_();this.update_(function(){this.itemCount_++});
2854
2853
  this.restoreConnections_();if(1<this.itemCount_){var d=this.getInput("ADD0");if(d&&d.connection.targetConnection){var e=this.getInput("ADD"+(this.itemCount_-1)),f=d.connection.getShadowDom(),g=f&&f.getAttribute("type");if(g){var l=c("shadow",g),m=a(f,"value");for(f=0;f<m.length;f++){var k=m[f],n=k.getAttribute("name"),h=a(k,"shadow")[0];h=h&&h.getAttribute("type");b(l,n,h)}e.connection.setShadowDom(l)}if((f=(d=(f=d.connection.targetConnection)&&f.getSourceBlock())&&d.type)&&f!==g){g=c("block",f);
2855
- if(d&&d.inputList)for(f=0;f<d.inputList.length;f++)k=d.inputList[f],h=(h=k.connection&&k.connection.getShadowDom())&&h.getAttribute("type"),b(g,k.name,h);g=Blockly.Xml.domToBlock(g,this.workspace);e.connection.connect(g.outputConnection)}else e.connection.respawnShadow_()}}},removeItem_:function(){this.storeConnections_();this.update_(function(){this.itemCount_--});this.restoreConnections_()},update_:function(a){Blockly.Events.setGroup(!0);var b=this,c=b.mutationToDom();c=c&&Blockly.Xml.domToText(c);
2856
- var d=b.rendered;b.rendered=!1;a&&a.call(this);this.updateShape_();b.rendered=d;b.initSvg();var e=Blockly.Events.getGroup();a=(a=b.mutationToDom())&&Blockly.Xml.domToText(a);c!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(b,"mutation",null,c,a)),setTimeout(function(){Blockly.Events.setGroup(e);b.bumpNeighbours();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY));b.rendered&&b.render();Blockly.Events.setGroup(!1)},updateShape_:function(){var a=this,b=function(){a.removeItem_()};this.itemCount_?
2857
- (this.getInput("EMPTY")&&this.removeInput("EMPTY"),this.getInput("TITLE")||this.appendDummyInput("TITLE").appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH)):(this.getInput("TITLE")&&this.removeInput("TITLE"),this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE));var c=0;for(c=0;c<this.itemCount_;c++)this.getInput("ADD"+c)||this.appendValueInput("ADD"+c);for(;this.getInput("ADD"+c);)this.removeInput("ADD"+c),c++;this.getInput("BUTTONS")&&this.removeInput("BUTTONS");
2858
- c=this.appendDummyInput("BUTTONS");0<this.itemCount_&&c.appendField(new Blockly.FieldImage(this.REMOVE_IMAGE_DATAURI,24,24,"*",b,!1));c.appendField(new Blockly.FieldImage(this.ADD_IMAGE_DATAURI,24,24,"*",function(){a.addItem_()},!1));b=this.itemCount_<=this.horizontalAfter_;this.setInputsInline(b);this.setOutputShape(b?Blockly.OUTPUT_SHAPE_ROUND:Blockly.OUTPUT_SHAPE_SQUARE)}};
2854
+ if(d)if(f===Blockly.FUNCTION_CALL_OUTPUT_BLOCK_TYPE)f=goog.dom.createDom("mutation"),f.setAttribute("name",d.getName()),g.appendChild(f);else if(d.inputList)for(f=0;f<d.inputList.length;f++)k=d.inputList[f],h=(h=k.connection&&k.connection.getShadowDom())&&h.getAttribute("type"),b(g,k.name,h);g=Blockly.Xml.domToBlock(g,this.workspace);e.connection.connect(g.outputConnection)}else e.connection.respawnShadow_()}}},removeItem_:function(){this.storeConnections_();this.update_(function(){this.itemCount_--});
2855
+ this.restoreConnections_()},update_:function(a){Blockly.Events.setGroup(!0);var b=this,c=b.mutationToDom();c=c&&Blockly.Xml.domToText(c);var d=b.rendered;b.rendered=!1;a&&a.call(this);this.updateShape_();b.rendered=d;b.initSvg();var e=Blockly.Events.getGroup();a=(a=b.mutationToDom())&&Blockly.Xml.domToText(a);c!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(b,"mutation",null,c,a)),setTimeout(function(){Blockly.Events.setGroup(e);b.bumpNeighbours();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY));
2856
+ b.rendered&&b.render();Blockly.Events.setGroup(!1)},updateShape_:function(){var a=this,b=function(){a.removeItem_()};this.itemCount_?(this.getInput("EMPTY")&&this.removeInput("EMPTY"),this.getInput("TITLE")||this.appendDummyInput("TITLE").appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH)):(this.getInput("TITLE")&&this.removeInput("TITLE"),this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE));var c=0;for(c=0;c<this.itemCount_;c++)this.getInput("ADD"+
2857
+ c)||this.appendValueInput("ADD"+c);for(;this.getInput("ADD"+c);)this.removeInput("ADD"+c),c++;this.getInput("BUTTONS")&&this.removeInput("BUTTONS");c=this.appendDummyInput("BUTTONS");0<this.itemCount_&&c.appendField(new Blockly.FieldImage(this.REMOVE_IMAGE_DATAURI,24,24,"*",b,!1));c.appendField(new Blockly.FieldImage(this.ADD_IMAGE_DATAURI,24,24,"*",function(){a.addItem_()},!1));b=this.itemCount_<=this.horizontalAfter_;this.setInputsInline(b);this.setOutputShape(b?Blockly.OUTPUT_SHAPE_ROUND:Blockly.OUTPUT_SHAPE_SQUARE)}};
2859
2858
  Blockly.Blocks.lists_create_with_container={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
2860
2859
  Blockly.Blocks.lists_create_with_item={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
2861
2860
  Blockly.Blocks.lists_indexOf={init:function(){var a=[[Blockly.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[Blockly.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.LISTS_INDEX_OF_HELPURL);this.setStyle("list_blocks");this.setOutput(!0,"Number");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);this.appendValueInput("FIND").appendField(new Blockly.FieldDropdown(a),"END");this.setInputsInline(!0);
@@ -3026,11 +3025,11 @@ Blockly.PXTBlockly.FunctionUtils.createAllInputs_=function(a){var b=!1,c=!1,d=!1
3026
3025
  Blockly.PXTBlockly.FunctionUtils.deleteShadows_=function(a){if(a)for(var b in a){var c=a[b];c&&(c=c.block)&&c.isShadow()&&(c.dispose(),delete a[b])}};Blockly.PXTBlockly.FunctionUtils.updateLabelEditor_=function(a){Blockly.Events.disable();this.getField("function_name").setValue(a);Blockly.Events.enable()};Blockly.PXTBlockly.FunctionUtils.updateLabelField_=function(a){this.getField("function_name").setValue(a)};
3027
3026
  Blockly.PXTBlockly.FunctionUtils.addLabelEditor_=function(a){a=this.type===Blockly.FUNCTION_DEFINITION_BLOCK_TYPE?new Blockly.FieldTextInput(a||"",Blockly.Functions.rename):new Blockly.FieldTextInput(a||"");a.setSpellcheck(!1);a.setAutoCapitalize(!1);this.appendDummyInput("function_name").appendField(a,"function_name")};Blockly.PXTBlockly.FunctionUtils.addLabelField_=function(a){this.appendDummyInput("function_name").appendField(new Blockly.FieldLabel(a,"functionNameText"),"function_name")};
3028
3027
  Blockly.PXTBlockly.FunctionUtils.getShadowBlockInfoFromType_=function(a,b){switch(a){case "boolean":var c="logic_boolean";var d="BOOL";a="TRUE";break;case "number":c="math_number";d="NUM";a="1";break;case "string":c="text";d="TEXT";a="abc";break;case "Array":c="variables_get";d="VAR";a=Blockly.Variables.getOrCreateVariablePackage(b,null,"list","").getId();break;default:c="variables_get",d="VAR",a=Blockly.Variables.getOrCreateVariablePackage(b,null,Blockly.PXTBlockly.FunctionUtils.getArgumentDefaultName(a),
3029
- "").getId()}return[c,d,a]};Blockly.PXTBlockly.FunctionUtils.buildShadowDom_=function(a){var b=Blockly.utils.xml.createElement("shadow"),c=Blockly.PXTBlockly.FunctionUtils.getShadowBlockInfoFromType_(a,this.workspace);a=c[1];var d=c[2];b.setAttribute("type",c[0]);c=goog.dom.createDom("field",null,d);c.setAttribute("name",a);b.appendChild(c);return b};
3028
+ "").getId()}return[c,d,a]};Blockly.PXTBlockly.FunctionUtils.buildShadowDom_=function(a){var b=Blockly.utils.xml.createElement("shadow"),c=Blockly.PXTBlockly.FunctionUtils.getShadowBlockInfoFromType_(a,this.workspace),d=c[0];a=c[1];c=c[2];var e="variables_get"===d;b.setAttribute("type",d);d=goog.dom.createDom("field",null,c);e&&(d.setAttribute("id",c),c=this.workspace.getVariableById(c),d.textContent=c?c.name:"");d.setAttribute("name",a);b.appendChild(d);return b};
3030
3029
  Blockly.PXTBlockly.FunctionUtils.attachShadow_=function(a,b){var c=Blockly.PXTBlockly.FunctionUtils.getShadowBlockInfoFromType_(b,this.workspace);b=c[0];var d=c[1];c=c[2];Blockly.Events.disable();var e=null;try{e=this.workspace.newBlock(b),e.setFieldValue(c,d),e.setShadow(!0),!this.isInsertionMarker()&&e.initSvg&&(e.initSvg(),e.render(!1))}finally{Blockly.Events.enable()}e&&e.outputConnection.connect(a.connection)};
3031
3030
  Blockly.PXTBlockly.FunctionUtils.createArgumentReporter_=function(a){switch(a.type){case "boolean":var b="argument_reporter_boolean";break;case "number":b="argument_reporter_number";break;case "string":b="argument_reporter_string";break;case "Array":b="argument_reporter_array";break;default:b="argument_reporter_custom"}Blockly.Events.disable();try{var c="argument_reporter_custom"==b?Blockly.PXTBlockly.FunctionUtils.createCustomArgumentReporter(a.type,this.workspace):this.workspace.newBlock(b);c.setShadow(!0);
3032
3031
  c.setFieldValue(a.name,"VALUE");!this.isInsertionMarker()&&c.initSvg&&(c.initSvg(),c.render(!1))}finally{Blockly.Events.enable()}return c};Blockly.PXTBlockly.FunctionUtils.createCollapseIcon_=function(){var a=this;if(a.workspace&&a.workspace.getRenderer){var b=a.workspace.getRenderer().getConstants().COLLAPSE_IMAGE_DATAURI;b&&a.appendDummyInput("function_collapse").appendField(new Blockly.FieldImage(b,24,24,"",function(){a.setCollapsed(!0)},!1))}};
3033
- Blockly.PXTBlockly.FunctionUtils.populateArgumentOnCaller_=function(a,b,c){var d=null,e=null;b&&a.id in b&&(e=b[a.id],d=e.block,e=e.shadow);b&&d&&d.outputConnection.canConnectWithReason(c.connection)===Blockly.Connection.CAN_CONNECT?(b[c.name]=null,d.outputConnection.connect(c.connection),a=e||this.buildShadowDom_(a.type),c.connection.setShadowDom(a)):(this.attachShadow_(c,a.type),d&&d.isShadow_&&d.setShadow(!1))};
3032
+ Blockly.PXTBlockly.FunctionUtils.populateArgumentOnCaller_=function(a,b,c){var d=null,e=null;b&&a.id in b&&(e=b[a.id],d=e.block,e=e.shadow);b&&d&&d.outputConnection.canConnectWithReason(c.connection)===Blockly.Connection.CAN_CONNECT?(b[c.name]=null,d.outputConnection.connect(c.connection),d.isShadow()?c.connection.setShadowDom(Blockly.Xml.blockToDom(d)):(a=e||this.buildShadowDom_(a.type),c.connection.setShadowDom(a))):(this.attachShadow_(c,a.type),d&&d.isShadow_&&d.setShadow(!1))};
3034
3033
  Blockly.PXTBlockly.FunctionUtils.populateArgumentOnDefinition_=function(a,b,c){var d=null;b&&a.id in b&&(d=b[a.id].block);b&&d?(d.setFieldValue(a.name,"VALUE"),b[c.name]=null):d=this.createArgumentReporter_(a);c.connection.connect(d.outputConnection)};Blockly.PXTBlockly.FunctionUtils.populateArgumentOnDeclaration_=function(a,b,c){a=this.createArgumentEditor_(a.type,a.name);c.connection.connect(a.outputConnection)};
3035
3034
  Blockly.PXTBlockly.FunctionUtils.createArgumentEditor_=function(a,b){Blockly.Events.disable();try{var c="";switch(a){case "boolean":c="argument_editor_boolean";break;case "number":c="argument_editor_number";break;case "string":c="argument_editor_string";break;case "Array":c="argument_editor_array";break;default:c="argument_editor_custom"}var d="argument_editor_custom"==c?Blockly.PXTBlockly.FunctionUtils.createCustomArgumentEditor(a,this.workspace):this.workspace.newBlock(c);d.setFieldValue(b,"TEXT");
3036
3035
  d.setShadow(!0);!this.isInsertionMarker()&&d.initSvg&&(d.initSvg(),d.render(!1))}finally{Blockly.Events.enable()}return d};
@@ -6480,11 +6479,12 @@ var pxt;
6480
6479
  workspace.getAllBlocks(false)
6481
6480
  .filter(b => !!b.getCommentText())
6482
6481
  .forEach(b => {
6482
+ var _a, _b;
6483
6483
  const c = b.getCommentText();
6484
6484
  if (/@highlight/.test(c)) {
6485
6485
  const cc = c.replace(/@highlight/g, '').trim();
6486
6486
  b.setCommentText(cc || null);
6487
- workspace.highlightBlock(b.id);
6487
+ (_b = (_a = workspace).highlightBlock) === null || _b === void 0 ? void 0 : _b.call(_a, b.id);
6488
6488
  }
6489
6489
  });
6490
6490
  }
@@ -8460,8 +8460,8 @@ var pxt;
8460
8460
  * moved from the position at the start of the drag, in pixel units.
8461
8461
  * @package
8462
8462
  */
8463
- const blockDrag = Blockly.BlockDragger.prototype.dragBlock;
8464
- Blockly.BlockDragger.prototype.dragBlock = function (e, currentDragDeltaXY) {
8463
+ const blockDrag = Blockly.BlockDragger.prototype.drag;
8464
+ Blockly.BlockDragger.prototype.drag = function (e, currentDragDeltaXY) {
8465
8465
  const blocklyToolboxDiv = document.getElementsByClassName('blocklyToolboxDiv')[0];
8466
8466
  const blocklyTreeRoot = document.getElementsByClassName('blocklyTreeRoot')[0]
8467
8467
  || document.getElementsByClassName('blocklyFlyout')[0];
@@ -8494,8 +8494,8 @@ var pxt;
8494
8494
  * moved from the position at the start of the drag, in pixel coordinates.
8495
8495
  * @package
8496
8496
  */
8497
- const blockEndDrag = Blockly.BlockDragger.prototype.endBlockDrag;
8498
- Blockly.BlockDragger.prototype.endBlockDrag = function (e, currentDragDeltaXY) {
8497
+ const blockEndDrag = Blockly.BlockDragger.prototype.endDrag;
8498
+ Blockly.BlockDragger.prototype.endDrag = function (e, currentDragDeltaXY) {
8499
8499
  blockEndDrag.call(this, e, currentDragDeltaXY);
8500
8500
  const blocklyToolboxDiv = document.getElementsByClassName('blocklyToolboxDiv')[0];
8501
8501
  const blocklyTreeRoot = document.getElementsByClassName('blocklyTreeRoot')[0]
@@ -8641,6 +8641,17 @@ var pxt;
8641
8641
  };
8642
8642
  options.push(screenshotOption);
8643
8643
  }
8644
+ if (pxt.appTarget.appTheme.workspaceSearch) {
8645
+ options.push({
8646
+ text: lf("Find..."),
8647
+ enabled: topBlocks.length > 0,
8648
+ callback: () => {
8649
+ var _a, _b;
8650
+ pxt.tickEvent("blocks.context.workspacesearch", undefined, { interactiveConsent: true });
8651
+ (_b = (_a = this.getComponentManager()) === null || _a === void 0 ? void 0 : _a.getComponent("workspaceSearch")) === null || _b === void 0 ? void 0 : _b.open();
8652
+ }
8653
+ });
8654
+ }
8644
8655
  // custom options...
8645
8656
  if (blocks_4.onShowContextMenu)
8646
8657
  blocks_4.onShowContextMenu(this, options);
@@ -9919,7 +9930,7 @@ var pxt;
9919
9930
  createDom_() {
9920
9931
  super.createDom_();
9921
9932
  this.addEvent_(this.workspace_.getInjectionDiv(), "click", this, (e) => {
9922
- if (!this.htmlDiv_.contains(e.target)) {
9933
+ if (this.htmlDiv_.style.display == "flex" && !this.htmlDiv_.contains(e.target)) {
9923
9934
  this.close();
9924
9935
  }
9925
9936
  });
@@ -15740,15 +15751,20 @@ var pxtblockly;
15740
15751
  let leftPadding = 0, rightPadding = 0;
15741
15752
  switch (outputShape) {
15742
15753
  case Blockly.OUTPUT_SHAPE_HEXAGONAL:
15743
- width = innerWidth;
15754
+ width = size.width / 2;
15744
15755
  halfWidth = width / 2;
15745
- let quarterWidth = halfWidth / 2;
15746
- // TODO: the left padding calculation is a hack, we should calculate left padding based on width (generic case)
15747
- leftPadding = -halfWidth + quarterWidth;
15748
- rightPadding = -quarterWidth;
15749
- const topLeftPoint = -quarterWidth;
15750
- const bottomRightPoint = halfWidth;
15751
- this.toggleThumb_.setAttribute('points', `${topLeftPoint},-14 ${topLeftPoint - 14},0 ${topLeftPoint},14 ${bottomRightPoint},14 ${bottomRightPoint + 14},0 ${bottomRightPoint},-14`);
15756
+ leftPadding = -halfWidth; // total translation when toggle is left-aligned = 0
15757
+ rightPadding = halfWidth - innerWidth; // total translation when right-aligned = width
15758
+ /**
15759
+ * Toggle defined clockwise from bottom left:
15760
+ *
15761
+ * 0, 14 ----------- width, 14
15762
+ * / \
15763
+ * -14, 0 width + 14, 0
15764
+ * \ /
15765
+ * 0, -14 ----------- width, -14
15766
+ */
15767
+ this.toggleThumb_.setAttribute('points', `${0},-14 -14,0 ${0},14 ${width},14 ${width + 14},0 ${width},-14`);
15752
15768
  break;
15753
15769
  case Blockly.OUTPUT_SHAPE_ROUND:
15754
15770
  case Blockly.OUTPUT_SHAPE_SQUARE:
@@ -2856,11 +2856,12 @@ var pxt;
2856
2856
  workspace.getAllBlocks(false)
2857
2857
  .filter(b => !!b.getCommentText())
2858
2858
  .forEach(b => {
2859
+ var _a, _b;
2859
2860
  const c = b.getCommentText();
2860
2861
  if (/@highlight/.test(c)) {
2861
2862
  const cc = c.replace(/@highlight/g, '').trim();
2862
2863
  b.setCommentText(cc || null);
2863
- workspace.highlightBlock(b.id);
2864
+ (_b = (_a = workspace).highlightBlock) === null || _b === void 0 ? void 0 : _b.call(_a, b.id);
2864
2865
  }
2865
2866
  });
2866
2867
  }
@@ -4836,8 +4837,8 @@ var pxt;
4836
4837
  * moved from the position at the start of the drag, in pixel units.
4837
4838
  * @package
4838
4839
  */
4839
- const blockDrag = Blockly.BlockDragger.prototype.dragBlock;
4840
- Blockly.BlockDragger.prototype.dragBlock = function (e, currentDragDeltaXY) {
4840
+ const blockDrag = Blockly.BlockDragger.prototype.drag;
4841
+ Blockly.BlockDragger.prototype.drag = function (e, currentDragDeltaXY) {
4841
4842
  const blocklyToolboxDiv = document.getElementsByClassName('blocklyToolboxDiv')[0];
4842
4843
  const blocklyTreeRoot = document.getElementsByClassName('blocklyTreeRoot')[0]
4843
4844
  || document.getElementsByClassName('blocklyFlyout')[0];
@@ -4870,8 +4871,8 @@ var pxt;
4870
4871
  * moved from the position at the start of the drag, in pixel coordinates.
4871
4872
  * @package
4872
4873
  */
4873
- const blockEndDrag = Blockly.BlockDragger.prototype.endBlockDrag;
4874
- Blockly.BlockDragger.prototype.endBlockDrag = function (e, currentDragDeltaXY) {
4874
+ const blockEndDrag = Blockly.BlockDragger.prototype.endDrag;
4875
+ Blockly.BlockDragger.prototype.endDrag = function (e, currentDragDeltaXY) {
4875
4876
  blockEndDrag.call(this, e, currentDragDeltaXY);
4876
4877
  const blocklyToolboxDiv = document.getElementsByClassName('blocklyToolboxDiv')[0];
4877
4878
  const blocklyTreeRoot = document.getElementsByClassName('blocklyTreeRoot')[0]
@@ -5017,6 +5018,17 @@ var pxt;
5017
5018
  };
5018
5019
  options.push(screenshotOption);
5019
5020
  }
5021
+ if (pxt.appTarget.appTheme.workspaceSearch) {
5022
+ options.push({
5023
+ text: lf("Find..."),
5024
+ enabled: topBlocks.length > 0,
5025
+ callback: () => {
5026
+ var _a, _b;
5027
+ pxt.tickEvent("blocks.context.workspacesearch", undefined, { interactiveConsent: true });
5028
+ (_b = (_a = this.getComponentManager()) === null || _a === void 0 ? void 0 : _a.getComponent("workspaceSearch")) === null || _b === void 0 ? void 0 : _b.open();
5029
+ }
5030
+ });
5031
+ }
5020
5032
  // custom options...
5021
5033
  if (blocks_4.onShowContextMenu)
5022
5034
  blocks_4.onShowContextMenu(this, options);
@@ -6295,7 +6307,7 @@ var pxt;
6295
6307
  createDom_() {
6296
6308
  super.createDom_();
6297
6309
  this.addEvent_(this.workspace_.getInjectionDiv(), "click", this, (e) => {
6298
- if (!this.htmlDiv_.contains(e.target)) {
6310
+ if (this.htmlDiv_.style.display == "flex" && !this.htmlDiv_.contains(e.target)) {
6299
6311
  this.close();
6300
6312
  }
6301
6313
  });
@@ -12116,15 +12128,20 @@ var pxtblockly;
12116
12128
  let leftPadding = 0, rightPadding = 0;
12117
12129
  switch (outputShape) {
12118
12130
  case Blockly.OUTPUT_SHAPE_HEXAGONAL:
12119
- width = innerWidth;
12131
+ width = size.width / 2;
12120
12132
  halfWidth = width / 2;
12121
- let quarterWidth = halfWidth / 2;
12122
- // TODO: the left padding calculation is a hack, we should calculate left padding based on width (generic case)
12123
- leftPadding = -halfWidth + quarterWidth;
12124
- rightPadding = -quarterWidth;
12125
- const topLeftPoint = -quarterWidth;
12126
- const bottomRightPoint = halfWidth;
12127
- this.toggleThumb_.setAttribute('points', `${topLeftPoint},-14 ${topLeftPoint - 14},0 ${topLeftPoint},14 ${bottomRightPoint},14 ${bottomRightPoint + 14},0 ${bottomRightPoint},-14`);
12133
+ leftPadding = -halfWidth; // total translation when toggle is left-aligned = 0
12134
+ rightPadding = halfWidth - innerWidth; // total translation when right-aligned = width
12135
+ /**
12136
+ * Toggle defined clockwise from bottom left:
12137
+ *
12138
+ * 0, 14 ----------- width, 14
12139
+ * / \
12140
+ * -14, 0 width + 14, 0
12141
+ * \ /
12142
+ * 0, -14 ----------- width, -14
12143
+ */
12144
+ this.toggleThumb_.setAttribute('points', `${0},-14 -14,0 ${0},14 ${width},14 ${width + 14},0 ${width},-14`);
12128
12145
  break;
12129
12146
  case Blockly.OUTPUT_SHAPE_ROUND:
12130
12147
  case Blockly.OUTPUT_SHAPE_SQUARE:
@@ -202,6 +202,7 @@ declare namespace pxt.editor {
202
202
  openProjectByHeaderIdAsync(headerId: string): Promise<void>;
203
203
  overrideTypescriptFile(text: string): void;
204
204
  overrideBlocksFile(text: string): void;
205
+ resetTutorialTemplateCode(keepAssets: boolean): Promise<void>;
205
206
  exportAsync(): Promise<string>;
206
207
  newEmptyProject(name?: string, documentation?: string, preferredEditor?: string): void;
207
208
  newProject(options?: ProjectCreationOptions): void;