pxt-core 7.4.19 → 7.4.23

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 (34) hide show
  1. package/built/cli.js +6 -4
  2. package/built/pxt.js +6 -4
  3. package/built/pxtblockly.js +16 -12
  4. package/built/pxtblocks.js +14 -9
  5. package/built/target.js +1 -1
  6. package/built/web/main.js +1 -1
  7. package/built/web/pxtblockly.js +2 -2
  8. package/built/web/pxtblocks.js +1 -1
  9. package/built/web/pxtembed.js +2 -2
  10. package/built/web/react-common-skillmap.css +1 -1
  11. package/built/web/rtlreact-common-skillmap.css +1 -1
  12. package/built/web/rtlsemantic.css +3 -3
  13. package/built/web/semantic.css +3 -3
  14. package/built/web/skillmap/css/{main.4939cd1e.chunk.css → main.2d214a87.chunk.css} +1 -1
  15. package/built/web/skillmap/js/{2.a7ef6059.chunk.js → 2.f7cdfd75.chunk.js} +2 -2
  16. package/built/web/skillmap/js/main.ace2b797.chunk.js +1 -0
  17. package/package.json +2 -2
  18. package/react-common/components/controls/Button.tsx +3 -1
  19. package/react-common/components/controls/FocusTrap.tsx +6 -1
  20. package/react-common/components/controls/Modal.tsx +1 -1
  21. package/react-common/components/profile/BadgeInfo.tsx +9 -2
  22. package/react-common/components/profile/BadgeList.tsx +5 -5
  23. package/react-common/components/profile/Profile.tsx +5 -0
  24. package/react-common/components/profile/UserPane.tsx +9 -5
  25. package/react-common/components/types.d.ts +1 -0
  26. package/react-common/components/util.tsx +1 -0
  27. package/react-common/styles/controls/Button.less +28 -16
  28. package/react-common/styles/controls/MenuDropdown.less +1 -1
  29. package/react-common/styles/react-common-variables.less +2 -2
  30. package/theme/image-editor/imageEditor.less +8 -0
  31. package/theme/tutorial-sidebar.less +15 -8
  32. package/webapp/public/blockly/blockly_compressed.js +2 -3
  33. package/webapp/public/skillmap.html +2 -2
  34. package/built/web/skillmap/js/main.75ffd6e1.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\\/");
@@ -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.7";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,
@@ -9931,7 +9930,7 @@ var pxt;
9931
9930
  createDom_() {
9932
9931
  super.createDom_();
9933
9932
  this.addEvent_(this.workspace_.getInjectionDiv(), "click", this, (e) => {
9934
- if (!this.htmlDiv_.contains(e.target)) {
9933
+ if (this.htmlDiv_.style.display == "flex" && !this.htmlDiv_.contains(e.target)) {
9935
9934
  this.close();
9936
9935
  }
9937
9936
  });
@@ -15752,15 +15751,20 @@ var pxtblockly;
15752
15751
  let leftPadding = 0, rightPadding = 0;
15753
15752
  switch (outputShape) {
15754
15753
  case Blockly.OUTPUT_SHAPE_HEXAGONAL:
15755
- width = innerWidth;
15754
+ width = size.width / 2;
15756
15755
  halfWidth = width / 2;
15757
- let quarterWidth = halfWidth / 2;
15758
- // TODO: the left padding calculation is a hack, we should calculate left padding based on width (generic case)
15759
- leftPadding = -halfWidth + quarterWidth;
15760
- rightPadding = -quarterWidth;
15761
- const topLeftPoint = -quarterWidth;
15762
- const bottomRightPoint = halfWidth;
15763
- 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`);
15764
15768
  break;
15765
15769
  case Blockly.OUTPUT_SHAPE_ROUND:
15766
15770
  case Blockly.OUTPUT_SHAPE_SQUARE:
@@ -6307,7 +6307,7 @@ var pxt;
6307
6307
  createDom_() {
6308
6308
  super.createDom_();
6309
6309
  this.addEvent_(this.workspace_.getInjectionDiv(), "click", this, (e) => {
6310
- if (!this.htmlDiv_.contains(e.target)) {
6310
+ if (this.htmlDiv_.style.display == "flex" && !this.htmlDiv_.contains(e.target)) {
6311
6311
  this.close();
6312
6312
  }
6313
6313
  });
@@ -12128,15 +12128,20 @@ var pxtblockly;
12128
12128
  let leftPadding = 0, rightPadding = 0;
12129
12129
  switch (outputShape) {
12130
12130
  case Blockly.OUTPUT_SHAPE_HEXAGONAL:
12131
- width = innerWidth;
12131
+ width = size.width / 2;
12132
12132
  halfWidth = width / 2;
12133
- let quarterWidth = halfWidth / 2;
12134
- // TODO: the left padding calculation is a hack, we should calculate left padding based on width (generic case)
12135
- leftPadding = -halfWidth + quarterWidth;
12136
- rightPadding = -quarterWidth;
12137
- const topLeftPoint = -quarterWidth;
12138
- const bottomRightPoint = halfWidth;
12139
- 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`);
12140
12145
  break;
12141
12146
  case Blockly.OUTPUT_SHAPE_ROUND:
12142
12147
  case Blockly.OUTPUT_SHAPE_SQUARE: