pxt-core 7.5.46 → 7.5.49
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/built/pxt.js +31 -4
- package/built/pxtblockly.js +23 -15
- package/built/pxtblocks.d.ts +1 -0
- package/built/pxtblocks.js +9 -1
- package/built/pxteditor.d.ts +1 -0
- package/built/pxtlib.d.ts +2 -0
- package/built/pxtlib.js +12 -2
- package/built/pxtpy.js +19 -2
- package/built/pxtsim.d.ts +1 -0
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtblockly.js +2 -2
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtpy.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/react-common-authcode.css +117 -0
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/built/web/skillmap/js/main.f09edeb7.chunk.js +1 -0
- package/package.json +2 -2
- package/react-common/components/controls/Input.tsx +3 -2
- package/react-common/components/controls/LazyImage.tsx +6 -0
- package/react-common/styles/controls/LazyImage.less +27 -0
- package/react-common/styles/extensions/ExtensionCard.less +5 -1
- package/react-common/styles/react-common-breakpoints.less +136 -0
- package/react-common/styles/react-common-variables.less +2 -17
- package/theme/highcontrast.less +13 -0
- package/theme/serial.less +49 -1
- package/theme/soundeffecteditor.less +7 -3
- package/theme/tutorial-sidebar.less +1 -0
- package/theme/tutorial.less +1 -0
- package/webapp/public/blockly/blockly_compressed.js +14 -14
- package/webapp/public/skillmap.html +1 -1
- package/built/web/skillmap/js/main.9d7e815e.chunk.js +0 -1
package/built/pxt.js
CHANGED
|
@@ -102151,6 +102151,10 @@ var pxt;
|
|
|
102151
102151
|
(function (pxt) {
|
|
102152
102152
|
var BrowserUtils;
|
|
102153
102153
|
(function (BrowserUtils) {
|
|
102154
|
+
function isDocumentVisible() {
|
|
102155
|
+
return typeof window !== "undefined" && document.visibilityState === 'visible';
|
|
102156
|
+
}
|
|
102157
|
+
BrowserUtils.isDocumentVisible = isDocumentVisible;
|
|
102154
102158
|
function isIFrame() {
|
|
102155
102159
|
try {
|
|
102156
102160
|
return window && window.self !== window.top;
|
|
@@ -107990,6 +107994,12 @@ var pxt;
|
|
|
107990
107994
|
GitRepoStatus[GitRepoStatus["Approved"] = 1] = "Approved";
|
|
107991
107995
|
GitRepoStatus[GitRepoStatus["Banned"] = 2] = "Banned";
|
|
107992
107996
|
})(GitRepoStatus = github.GitRepoStatus || (github.GitRepoStatus = {}));
|
|
107997
|
+
function isDefaultBranch(branch, repo) {
|
|
107998
|
+
if (repo && repo.defaultBranch)
|
|
107999
|
+
return branch === repo.defaultBranch;
|
|
108000
|
+
return /^(main|master)$/.test(branch);
|
|
108001
|
+
}
|
|
108002
|
+
github.isDefaultBranch = isDefaultBranch;
|
|
107993
108003
|
function listUserReposAsync() {
|
|
107994
108004
|
const q = `{
|
|
107995
108005
|
viewer {
|
|
@@ -108007,12 +108017,12 @@ var pxt;
|
|
|
108007
108017
|
defaultBranchRef {
|
|
108008
108018
|
name
|
|
108009
108019
|
}
|
|
108010
|
-
pxtjson: object(expression: "
|
|
108020
|
+
pxtjson: object(expression: "HEAD:pxt.json") {
|
|
108011
108021
|
... on Blob {
|
|
108012
108022
|
text
|
|
108013
108023
|
}
|
|
108014
108024
|
}
|
|
108015
|
-
readme: object(expression: "
|
|
108025
|
+
readme: object(expression: "HEAD:README.md") {
|
|
108016
108026
|
... on Blob {
|
|
108017
108027
|
text
|
|
108018
108028
|
}
|
|
@@ -140367,6 +140377,7 @@ var pxt;
|
|
|
140367
140377
|
return mkType({ primType: tp });
|
|
140368
140378
|
}
|
|
140369
140379
|
function getOrSetSymbolType(sym) {
|
|
140380
|
+
var _a;
|
|
140370
140381
|
if (!sym.pySymbolType) {
|
|
140371
140382
|
currErrorCtx = sym.pyQName;
|
|
140372
140383
|
if (sym.parameters) {
|
|
@@ -140388,8 +140399,24 @@ var pxt;
|
|
|
140388
140399
|
sym.pyRetType = mkType({ moduleType: sym });
|
|
140389
140400
|
}
|
|
140390
140401
|
else {
|
|
140391
|
-
if (sym.retType)
|
|
140392
|
-
sym.
|
|
140402
|
+
if (sym.retType) {
|
|
140403
|
+
if (((_a = sym.qName) === null || _a === void 0 ? void 0 : _a.endsWith(".__constructor")) && sym.retType === "void") {
|
|
140404
|
+
// This must be a TS class. Because python treats constructors as functions,
|
|
140405
|
+
// set the return type to be the class instead of void
|
|
140406
|
+
const classSym = lookupGlobalSymbol(sym.qName.substring(0, sym.qName.lastIndexOf(".")));
|
|
140407
|
+
if (classSym) {
|
|
140408
|
+
sym.pyRetType = mkType({
|
|
140409
|
+
classType: classSym
|
|
140410
|
+
});
|
|
140411
|
+
}
|
|
140412
|
+
else {
|
|
140413
|
+
sym.pyRetType = mapTsType(sym.retType);
|
|
140414
|
+
}
|
|
140415
|
+
}
|
|
140416
|
+
else {
|
|
140417
|
+
sym.pyRetType = mapTsType(sym.retType);
|
|
140418
|
+
}
|
|
140419
|
+
}
|
|
140393
140420
|
else if (sym.pyRetType) {
|
|
140394
140421
|
// nothing to do
|
|
140395
140422
|
}
|
package/built/pxtblockly.js
CHANGED
|
@@ -190,9 +190,9 @@ Blockly.Xml.domToBlock(l,b);c.push(m.id);var n=l.hasAttribute("x")?parseInt(l.ge
|
|
|
190
190
|
Blockly.WorkspaceComment.fromXml(l,b):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==k){if(f)Blockly.Xml.domToVariables(l,b);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");f=!1}}}}finally{e||Blockly.Events.setGroup(!1),Blockly.utils.dom.stopTextWidthCache()}b.setResizesEnabled&&b.setResizesEnabled(!0);b.loadingEventsDisabled=!1;b.getAllBlocks(!1).forEach(function(a){a.onLoadedIntoWorkspace()});
|
|
191
191
|
Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.FINISHED_LOADING))(b));return c};
|
|
192
192
|
Blockly.Xml.appendDomToWorkspace=function(a,b){var c;Object.prototype.hasOwnProperty.call(b,"scale")&&(c=b.getBlocksBoundingBox());a=Blockly.Xml.domToWorkspace(a,b);if(c&&c.top!=c.bottom){var d=c.bottom;var e=b.RTL?c.right:c.left;var f=Infinity,g=-Infinity,h=Infinity;for(c=0;c<a.length;c++){var k=b.getBlockById(a[c]).getRelativeToSurfaceXY();k.y<h&&(h=k.y);k.x<f&&(f=k.x);k.x>g&&(g=k.x)}d=d-h+10;e=b.RTL?e-g:e-f;for(c=0;c<a.length;c++)b.getBlockById(a[c]).moveBy(e,d)}return a};
|
|
193
|
-
Blockly.Xml.domToBlock=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}Blockly.Events.disable();c=b.getAllVariables();try{var d=Blockly.Xml.domToBlockHeadless_(a,b),e=d.getDescendants(!1);if(b.rendered){d.setConnectionTracking(!1);for(var f=e.length-1;0<=f;f--)e[f].initSvg();for(f=e.length-1;0<=f;f--)e[f].render(!1);setTimeout(function(){d.disposed||d.
|
|
194
|
-
e.length-1;0<=f;f--)e[f].initModel()}finally{Blockly.Events.enable()}if(Blockly.Events.isEnabled()){a=Blockly.Variables.getAddedVariables(b,c);for(f=0;f<a.length;f++)b=a[f],Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_CREATE))(b));
|
|
195
|
-
Blockly.Xml.domToVariables=function(a,b){for(var c=0,d;d=a.childNodes[c];c++)if(d.nodeType==Blockly.utils.dom.NodeType.ELEMENT_NODE){var e=d.getAttribute("type"),f=d.getAttribute("id");b.createVariable(d.textContent,e,f)}};
|
|
193
|
+
Blockly.Xml.domToBlock=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}Blockly.Events.disable();c=b.getAllVariables();try{var d=Blockly.Xml.domToBlockHeadless_(a,b),e=d.getDescendants(!1);if(b.rendered){d.setConnectionTracking(!1);for(var f=e.length-1;0<=f;f--)e[f].initSvg();for(f=e.length-1;0<=f;f--)e[f].render(!1);setTimeout(function(){d.disposed||d.outputConnection&&d.outputConnection.targetConnection&&
|
|
194
|
+
d.outputConnection.targetConnection.sourceBlock_&&!d.outputConnection.targetConnection.sourceBlock_.inputList.find(function(a){return a.connection===d.outputConnection.targetConnection}).isVisible()||d.setConnectionTracking(!0)},1);d.updateDisabled();b.resizeContents()}else for(f=e.length-1;0<=f;f--)e[f].initModel()}finally{Blockly.Events.enable()}if(Blockly.Events.isEnabled()){a=Blockly.Variables.getAddedVariables(b,c);for(f=0;f<a.length;f++)b=a[f],Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_CREATE))(b));
|
|
195
|
+
Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.CREATE))(d))}return d};Blockly.Xml.domToVariables=function(a,b){for(var c=0,d;d=a.childNodes[c];c++)if(d.nodeType==Blockly.utils.dom.NodeType.ELEMENT_NODE){var e=d.getAttribute("type"),f=d.getAttribute("id");b.createVariable(d.textContent,e,f)}};
|
|
196
196
|
Blockly.Xml.mapSupportedXmlTags_=function(a){for(var b={mutation:[],comment:[],data:[],field:[],input:[],next:[],breakpoint:[]},c=0,d;d=a.childNodes[c];c++)if(d.nodeType!=Blockly.utils.dom.NodeType.TEXT_NODE)switch(d.nodeName.toLowerCase()){case "mutation":b.mutation.push(d);break;case "comment":if(!Blockly.Comment){console.warn("Missing require for Blockly.Comment, ignoring block comment.");break}b.comment.push(d);break;case "data":b.data.push(d);break;case "title":case "field":b.field.push(d);break;
|
|
197
197
|
case "value":case "statement":b.input.push(d);break;case "next":b.next.push(d);break;case "breakpoint":b.breakpoint.push(d);break;default:console.warn("Ignoring unknown tag: "+d.nodeName)}return b};Blockly.Xml.applyMutationTagNodes_=function(a,b){for(var c=!1,d=0,e;e=a[d];d++)b.domToMutation&&(b.domToMutation(e),b.initSvg&&(c=!0));return c};
|
|
198
198
|
Blockly.Xml.applyCommentTagNodes_=function(a,b){for(var c=0,d;d=a[c];c++){var e=d.textContent,f="true"==d.getAttribute("pinned"),g=parseInt(d.getAttribute("w"),10),h=parseInt(d.getAttribute("h"),10);b.setCommentText(e);b.commentModel.pinned=f;isNaN(g)||isNaN(h)||(b.commentModel.size=new Blockly.utils.Size(g,h));e=parseInt(d.getAttribute("relx"),10);d=parseInt(d.getAttribute("rely"),10);isNaN(e)||isNaN(d)||(b.commentModel.xy=new Blockly.utils.Coordinate(e,d));f&&b.getCommentIcon&&!b.isInFlyout&&setTimeout(function(){b.getCommentIcon().setVisible(!0)},
|
|
@@ -738,13 +738,13 @@ Blockly.Block.prototype.getSurroundParent=function(){var a=this;do{var b=a;a=a.g
|
|
|
738
738
|
Blockly.Block.prototype.getFirstStatementConnection=function(){for(var a=0,b;b=this.inputList[a];a++)if(b.connection&&b.connection.type==Blockly.connectionTypes.NEXT_STATEMENT)return b.connection;return null};Blockly.Block.prototype.getRootBlock=function(){var a=this;do{var b=a;a=b.parentBlock_}while(a);return b};Blockly.Block.prototype.getTopStackBlock=function(){var a=this;do var b=a.getPreviousBlock();while(b&&b.getNextBlock()==a&&(a=b));return a};
|
|
739
739
|
Blockly.Block.prototype.getChildren=function(a){if(!a)return this.childBlocks_;a=[];for(var b=0,c;c=this.inputList[b];b++)c.connection&&(c=c.connection.targetBlock())&&a.push(c);(b=this.getNextBlock())&&a.push(b);return a};
|
|
740
740
|
Blockly.Block.prototype.setParent=function(a){if(a!=this.parentBlock_){if(this.parentBlock_){Blockly.utils.arrayRemove(this.parentBlock_.childBlocks_,this);if(this.previousConnection&&this.previousConnection.isConnected())throw Error("Still connected to previous block.");if(this.outputConnection&&this.outputConnection.isConnected())throw Error("Still connected to parent block.");this.parentBlock_=null}else this.workspace.removeTopBlock(this);(this.parentBlock_=a)?a.childBlocks_.push(this):this.workspace.addTopBlock(this)}};
|
|
741
|
-
Blockly.Block.prototype.getDescendants=function(a,b){for(var c=[this],d=this.getChildren(a),e,f=0;e=d[f];f++)b&&e.isShadow()||c.push.apply(c,e.getDescendants(a));return c};Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.inDebugWorkspace=function(){return!(!this.workspace||!this.workspace.options.debugMode)};
|
|
742
|
-
Blockly.Block.prototype.isMovable=function(){return this.isMovablePersisted()&&!this.inDebugWorkspace()};Blockly.Block.prototype.isMovablePersisted=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setMovable=function(a){this.movable_=a};
|
|
743
|
-
Blockly.Block.prototype.
|
|
744
|
-
Blockly.Block.prototype.
|
|
745
|
-
Blockly.Block.prototype.getMatchingConnection=function(a,b){var c=this.getConnections_(!0);a=a.getConnections_(!0);if(c.length!=a.length)throw Error("Connection lists did not match in length.");for(var d=0;d<a.length;d++)if(a[d]==b)return c[d];return null};
|
|
746
|
-
Blockly.Block.prototype.
|
|
747
|
-
Blockly.Block.prototype.setOnChange=function(a){if(a&&"function"!=typeof a)throw Error("onchange must be a function.");this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);if(this.onchange=a)this.onchangeWrapper_=a.bind(this),this.workspace.addChangeListener(this.onchangeWrapper_)};
|
|
741
|
+
Blockly.Block.prototype.getDescendants=function(a,b){for(var c=[this],d=this.getChildren(a),e,f=0;e=d[f];f++)b&&e.isShadow()||c.push.apply(c,e.getDescendants(a));return c};Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)&&!this.inDebugWorkspace()};Blockly.Block.prototype.inDebugWorkspace=function(){return!(!this.workspace||!this.workspace.options.debugMode)};
|
|
742
|
+
Blockly.Block.prototype.setDeletable=function(a){this.deletable_=a};Blockly.Block.prototype.isMovable=function(){return this.isMovablePersisted()&&!this.inDebugWorkspace()};Blockly.Block.prototype.isMovablePersisted=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setMovable=function(a){this.movable_=a};
|
|
743
|
+
Blockly.Block.prototype.isDuplicatable=function(){return this.workspace.hasBlockLimits()?this.workspace.isCapacityAvailable(Blockly.utils.getBlockTypeCounts(this,!0)):!0};Blockly.Block.prototype.isShadow=function(){return this.isShadow_};Blockly.Block.prototype.setShadow=function(a){this.isShadow_=a};Blockly.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_};
|
|
744
|
+
Blockly.Block.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&(this.setColour(Blockly.Colours.insertionMarker),this.setOpacity(Blockly.Colours.insertionMarkerOpacity),Blockly.utils.dom.addClass(this.svgGroup_,"blocklyInsertionMarker"))};Blockly.Block.prototype.isEditable=function(){return this.isEditablePersisted()&&!this.inDebugWorkspace()};Blockly.Block.prototype.isEditablePersisted=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)};
|
|
745
|
+
Blockly.Block.prototype.setEditable=function(a){this.editable_=a;a=0;for(var b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.updateEditable()};Blockly.Block.prototype.isDisposed=function(){return this.disposed};Blockly.Block.prototype.getMatchingConnection=function(a,b){var c=this.getConnections_(!0);a=a.getConnections_(!0);if(c.length!=a.length)throw Error("Connection lists did not match in length.");for(var d=0;d<a.length;d++)if(a[d]==b)return c[d];return null};
|
|
746
|
+
Blockly.Block.prototype.setHelpUrl=function(a){this.helpUrl=a};Blockly.Block.prototype.setTooltip=function(a){this.tooltip=a};Blockly.Block.prototype.getTooltip=function(){return Blockly.Tooltip.getTooltipOfObject(this)};Blockly.Block.prototype.getColour=function(){return this.colour_};Blockly.Block.prototype.getStyleName=function(){return this.styleName_};Blockly.Block.prototype.getHue=function(){return this.hue_};
|
|
747
|
+
Blockly.Block.prototype.setColour=function(a){a=Blockly.utils.parseBlockColour(a);this.hue_=a.hue;this.colour_=a.hex};Blockly.Block.prototype.setStyle=function(a){this.styleName_=a};Blockly.Block.prototype.setOnChange=function(a){if(a&&"function"!=typeof a)throw Error("onchange must be a function.");this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);if(this.onchange=a)this.onchangeWrapper_=a.bind(this),this.workspace.addChangeListener(this.onchangeWrapper_)};
|
|
748
748
|
Blockly.Block.prototype.getField=function(a){if("string"!==typeof a)throw TypeError("Blockly.Block.prototype.getField expects a string with the field name but received "+(void 0===a?"nothing":a+" of type "+typeof a)+" instead");for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)if(e.name===a)return e;return null};
|
|
749
749
|
Blockly.Block.prototype.getVars=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.push(e.getValue());return a};Blockly.Block.prototype.getVarModels=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&(e=this.workspace.getVariableById(e.getValue()))&&a.push(e);return a};
|
|
750
750
|
Blockly.Block.prototype.updateVarName=function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.getId()==e.getValue()&&e.forceRerender()};Blockly.Block.prototype.renameVarById=function(a,b){for(var c=0,d;d=this.inputList[c];c++)for(var e=0,f;f=d.fieldRow[e];e++)f.referencesVariables()&&a==f.getValue()&&f.setValue(b)};Blockly.Block.prototype.getFieldValue=function(a){return(a=this.getField(a))?a.getValue():null};
|
|
@@ -891,7 +891,7 @@ Blockly.BlockSvg.prototype.setStyle=function(a){var b=this.workspace.getRenderer
|
|
|
891
891
|
Blockly.BlockSvg.prototype.setPreviousStatement=function(a,b){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};Blockly.BlockSvg.prototype.setNextStatement=function(a,b){Blockly.BlockSvg.superClass_.setNextStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};Blockly.BlockSvg.prototype.setOutput=function(a,b){Blockly.BlockSvg.superClass_.setOutput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};
|
|
892
892
|
Blockly.BlockSvg.prototype.setInputsInline=function(a){Blockly.BlockSvg.superClass_.setInputsInline.call(this,a);this.rendered&&(this.render(),this.bumpNeighbours())};Blockly.BlockSvg.prototype.removeInput=function(a,b){a=Blockly.BlockSvg.superClass_.removeInput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours());return a};
|
|
893
893
|
Blockly.BlockSvg.prototype.moveNumberedInputBefore=function(a,b){Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};Blockly.BlockSvg.prototype.appendInput_=function(a,b){a=Blockly.BlockSvg.superClass_.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours());return a};
|
|
894
|
-
Blockly.BlockSvg.prototype.setConnectionTracking=function(a){this.previousConnection&&this.previousConnection.setTracking(a);this.outputConnection&&this.outputConnection.setTracking(a);if(this.nextConnection){this.nextConnection.setTracking(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionTracking(a)}if(!this.collapsed_)for(b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.setTracking(a),(c=c.targetBlock())&&c.setConnectionTracking(a))}};
|
|
894
|
+
Blockly.BlockSvg.prototype.setConnectionTracking=function(a){this.previousConnection&&this.previousConnection.setTracking(a);this.outputConnection&&this.outputConnection.setTracking(a);if(this.nextConnection){this.nextConnection.setTracking(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionTracking(a)}if(!this.collapsed_)for(b=0;b<this.inputList.length;b++)if(this.inputList[b].isVisible()){var c=this.inputList[b].connection;c&&(c.setTracking(a),(c=c.targetBlock())&&c.setConnectionTracking(a))}};
|
|
895
895
|
Blockly.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};Blockly.BlockSvg.prototype.lastConnectionInStack=function(a){return Blockly.BlockSvg.superClass_.lastConnectionInStack.call(this,a)};
|
|
896
896
|
Blockly.BlockSvg.prototype.getMatchingConnection=function(a,b){return Blockly.BlockSvg.superClass_.getMatchingConnection.call(this,a,b)};Blockly.BlockSvg.prototype.makeConnection_=function(a){return new Blockly.RenderedConnection(this,a)};
|
|
897
897
|
Blockly.BlockSvg.prototype.bumpNeighbours=function(){if(this.workspace&&!this.workspace.isDragging()){var a=this.getRootBlock();if(!a.isInFlyout)for(var b=this.getConnections_(!1),c=0,d;d=b[c];c++){d.isConnected()&&d.isSuperior()&&d.targetBlock().bumpNeighbours();for(var e=d.neighbours(Blockly.SNAP_RADIUS),f=0,g;g=e[f];f++)d.isConnected()&&g.isConnected()||g.getSourceBlock().getRootBlock()!=a&&(d.isSuperior()?g.bumpAwayFrom(d):d.bumpAwayFrom(g))}}};
|
|
@@ -1084,7 +1084,7 @@ return Blockly.Functions.namesInUse(b,null,a)[c]?(Blockly.alert(Blockly.Msg.VARI
|
|
|
1084
1084
|
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,
|
|
1085
1085
|
!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")};
|
|
1086
1086
|
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);
|
|
1087
|
-
var d=c.createDom("svg");goog.dom.insertSiblingAfter(d,b);c.init(a);return c};Blockly.VERSION="4.0.
|
|
1087
|
+
var d=c.createDom("svg");goog.dom.insertSiblingAfter(d,b);c.init(a);return c};Blockly.VERSION="4.0.12";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()};
|
|
1088
1088
|
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()}};
|
|
1089
1089
|
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};
|
|
1090
1090
|
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};
|
|
@@ -2356,7 +2356,7 @@ Blockly.FieldNumber.prototype.updateDisplay_=function(a){this.htmlInput_.value=a
|
|
|
2356
2356
|
Blockly.FieldNumber.prototype.doClassValidation_=function(a){if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=a.replace(/infinity/i,"Infinity");a=Number(a||0);if(isNaN(a))return null;this.precision_&&isFinite(a)&&(a=Math.round(a/this.precision_)*this.precision_);null!=this.decimalPlaces_&&(a=Number(a.toFixed(this.decimalPlaces_)));return a};
|
|
2357
2357
|
Blockly.FieldNumber.prototype.widgetCreate_=function(a,b,c){a=Blockly.FieldNumber.superClass_.widgetCreate_.call(this,a,b,c);-Infinity<this.min_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMIN,this.min_);Infinity>this.max_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMAX,this.max_);return a};Blockly.fieldRegistry.register("field_number",Blockly.FieldNumber);Blockly.FieldNumberDropdown=function(a,b,c,d,e,f){this.setConstraints=Blockly.FieldNumber.prototype.setConstraints;this.setMinInternal_=Blockly.FieldNumber.prototype.setMinInternal_;this.setMaxInternal_=Blockly.FieldNumber.prototype.setMaxInternal_;this.setPrecisionInternal_=Blockly.FieldNumber.prototype.setPrecisionInternal_;c=Blockly.FieldNumber.prototype.getNumRestrictor.call(this,c,d,e);Blockly.FieldNumberDropdown.superClass_.constructor.call(this,a,b,f,c);this.addArgType("numberdropdown")};
|
|
2358
2358
|
Blockly.utils.object.inherits(Blockly.FieldNumberDropdown,Blockly.FieldTextDropdown);Blockly.FieldNumberDropdown.fromJson=function(a){return new Blockly.FieldNumberDropdown(a.value,a.options,a.min,a.max,a.precision)};Blockly.FieldNumberDropdown.prototype.classValidator=Blockly.FieldNumber.prototype.classValidator;Blockly.fieldRegistry.register("field_numberdropdown",Blockly.FieldNumberDropdown);Blockly.FieldVariable=function(a,b,c,d,e){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate;this.defaultVariableName="string"===typeof a?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.FieldVariable,Blockly.FieldDropdown);Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,void 0,void 0,void 0,a)};
|
|
2359
|
-
Blockly.FieldVariable.prototype.SERIALIZABLE=!0;Blockly.FieldVariable.prototype.configure_=function(a){Blockly.FieldVariable.superClass_.configure_.call(this,a);this.setTypes_(a.variableTypes,a.defaultType)};Blockly.FieldVariable.prototype.initModel=function(){if(!this.variable_){var a=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(a.getId())}};
|
|
2359
|
+
Blockly.FieldVariable.prototype.SERIALIZABLE=!0;Blockly.FieldVariable.prototype.configure_=function(a){Blockly.FieldVariable.superClass_.configure_.call(this,a);this.setTypes_(a.variableTypes,a.defaultType)};Blockly.FieldVariable.prototype.initModel=function(){if(!(this.variable_||this.sourceBlock_&&this.sourceBlock_.isInsertionMarker())){var a=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(a.getId())}};
|
|
2360
2360
|
Blockly.FieldVariable.prototype.shouldAddBorderRect_=function(){return Blockly.FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||!("variables_get"==this.sourceBlock_.type||"variables_get_reporter"==this.sourceBlock_.type))};
|
|
2361
2361
|
Blockly.FieldVariable.prototype.fromXml=function(a){a.getAttribute("id");var b=a.textContent,c=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,b,c);if(null!=c&&c!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+Blockly.Xml.domToText(a)+".");this.setValue(b.getId())};
|
|
2362
2362
|
Blockly.FieldVariable.prototype.toXml=function(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a};Blockly.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariable.superClass_.setSourceBlock.call(this,a)};
|
|
@@ -2643,7 +2643,7 @@ Blockly.zelos.ConstantProvider.prototype.makeRounded=function(){function a(a,b,f
|
|
|
2643
2643
|
connectionOffsetY:function(a){return a/2},connectionOffsetX:function(a){return-a},pathDown:function(b){return a(b,!1,!1)},pathUp:function(b){return a(b,!0,!1)},pathRightDown:function(b){return a(b,!1,!0)},pathRightUp:function(b){return a(b,!1,!0)}}};
|
|
2644
2644
|
Blockly.zelos.ConstantProvider.prototype.makeSquared=function(){function a(a,d,e){a-=2*b;return Blockly.utils.svgPaths.arc("a","0 0,1",b,Blockly.utils.svgPaths.point((d?-1:1)*b,(d?-1:1)*b))+Blockly.utils.svgPaths.lineOnAxis("v",(e?1:-1)*a)+Blockly.utils.svgPaths.arc("a","0 0,1",b,Blockly.utils.svgPaths.point((d?1:-1)*b,(d?-1:1)*b))}var b=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width:function(a){return b},height:function(a){return a},connectionOffsetY:function(a){return a/2},
|
|
2645
2645
|
connectionOffsetX:function(a){return-a},pathDown:function(b){return a(b,!1,!1)},pathUp:function(b){return a(b,!0,!1)},pathRightDown:function(b){return a(b,!1,!0)},pathRightUp:function(b){return a(b,!1,!0)}}};
|
|
2646
|
-
Blockly.zelos.ConstantProvider.prototype.shapeFor=function(a){var b=a.getCheck();!b&&a.targetConnection&&(b=a.targetConnection.getCheck());switch(a.type){case Blockly.connectionTypes.
|
|
2646
|
+
Blockly.zelos.ConstantProvider.prototype.shapeFor=function(a){var b=a.getCheck();!b&&a.targetConnection&&(b=a.targetConnection.getCheck());switch(a.type){case Blockly.connectionTypes.OUTPUT_VALUE:if(a=a.getSourceBlock().getOutputShape(),null!=a)switch(a){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}case Blockly.connectionTypes.INPUT_VALUE:if(b&&-1!=b.indexOf("Boolean"))return this.HEXAGONAL;if(b&&-1!=b.indexOf("Number"))return this.ROUNDED;
|
|
2647
2647
|
b&&b.indexOf("String");return this.ROUNDED;case Blockly.connectionTypes.PREVIOUS_STATEMENT:case Blockly.connectionTypes.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type");}};
|
|
2648
2648
|
Blockly.zelos.ConstantProvider.prototype.makeNotch=function(){function a(a){return Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,g/2),Blockly.utils.svgPaths.point(a*e,g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,g/2),Blockly.utils.svgPaths.point(a*e/2,g),Blockly.utils.svgPaths.point(a*e,g)])+Blockly.utils.svgPaths.lineOnAxis("h",a*d)+Blockly.utils.svgPaths.curve("c",
|
|
2649
2649
|
[Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,-(g/2)),Blockly.utils.svgPaths.point(a*e,-g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,-f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,-(g/2)),Blockly.utils.svgPaths.point(a*e/2,-g),Blockly.utils.svgPaths.point(a*e,-g)])}var b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=b/3,e=d/3,f=c/2,g=f/2,h=a(1),k=a(-1);return{type:this.SHAPES.NOTCH,width:b,height:c,pathLeft:h,pathRight:k}};
|
|
@@ -12212,6 +12212,12 @@ var pxtblockly;
|
|
|
12212
12212
|
// This creates the little arrow for dropdown fields. Intentionally
|
|
12213
12213
|
// do nothing
|
|
12214
12214
|
}
|
|
12215
|
+
showPromptEditor_() {
|
|
12216
|
+
Blockly.prompt(Blockly.Msg['CHANGE_VALUE_TITLE'], this.parsedValue, (newValue) => {
|
|
12217
|
+
this.setValue(this.getValueFromEditorText_(newValue));
|
|
12218
|
+
this.forceRerender();
|
|
12219
|
+
});
|
|
12220
|
+
}
|
|
12215
12221
|
}
|
|
12216
12222
|
pxtblockly.FieldAutoComplete = FieldAutoComplete;
|
|
12217
12223
|
})(pxtblockly || (pxtblockly = {}));
|
|
@@ -15487,6 +15493,7 @@ var pxtblockly;
|
|
|
15487
15493
|
widgetDiv.style.height = "";
|
|
15488
15494
|
widgetDiv.style.opacity = "";
|
|
15489
15495
|
widgetDiv.style.transition = "";
|
|
15496
|
+
widgetDiv.style.alignItems = "";
|
|
15490
15497
|
Blockly.Events.enable();
|
|
15491
15498
|
Blockly.Events.setGroup(true);
|
|
15492
15499
|
this.fireNumberInputUpdate(this.options.durationInputName, initialSound.duration);
|
|
@@ -15528,7 +15535,8 @@ var pxtblockly;
|
|
|
15528
15535
|
widgetDiv.style.top = top + "px";
|
|
15529
15536
|
widgetDiv.style.width = "30rem";
|
|
15530
15537
|
widgetDiv.style.height = "40rem";
|
|
15531
|
-
widgetDiv.style.display = "
|
|
15538
|
+
widgetDiv.style.display = "flex";
|
|
15539
|
+
widgetDiv.style.alignItems = "center";
|
|
15532
15540
|
widgetDiv.style.transition = "transform 0.25s ease 0s, opacity 0.25s ease 0s";
|
|
15533
15541
|
widgetDiv.style.borderRadius = "";
|
|
15534
15542
|
fv.onHide(() => {
|
package/built/pxtblocks.d.ts
CHANGED
package/built/pxtblocks.js
CHANGED
|
@@ -8650,6 +8650,12 @@ var pxtblockly;
|
|
|
8650
8650
|
// This creates the little arrow for dropdown fields. Intentionally
|
|
8651
8651
|
// do nothing
|
|
8652
8652
|
}
|
|
8653
|
+
showPromptEditor_() {
|
|
8654
|
+
Blockly.prompt(Blockly.Msg['CHANGE_VALUE_TITLE'], this.parsedValue, (newValue) => {
|
|
8655
|
+
this.setValue(this.getValueFromEditorText_(newValue));
|
|
8656
|
+
this.forceRerender();
|
|
8657
|
+
});
|
|
8658
|
+
}
|
|
8653
8659
|
}
|
|
8654
8660
|
pxtblockly.FieldAutoComplete = FieldAutoComplete;
|
|
8655
8661
|
})(pxtblockly || (pxtblockly = {}));
|
|
@@ -11925,6 +11931,7 @@ var pxtblockly;
|
|
|
11925
11931
|
widgetDiv.style.height = "";
|
|
11926
11932
|
widgetDiv.style.opacity = "";
|
|
11927
11933
|
widgetDiv.style.transition = "";
|
|
11934
|
+
widgetDiv.style.alignItems = "";
|
|
11928
11935
|
Blockly.Events.enable();
|
|
11929
11936
|
Blockly.Events.setGroup(true);
|
|
11930
11937
|
this.fireNumberInputUpdate(this.options.durationInputName, initialSound.duration);
|
|
@@ -11966,7 +11973,8 @@ var pxtblockly;
|
|
|
11966
11973
|
widgetDiv.style.top = top + "px";
|
|
11967
11974
|
widgetDiv.style.width = "30rem";
|
|
11968
11975
|
widgetDiv.style.height = "40rem";
|
|
11969
|
-
widgetDiv.style.display = "
|
|
11976
|
+
widgetDiv.style.display = "flex";
|
|
11977
|
+
widgetDiv.style.alignItems = "center";
|
|
11970
11978
|
widgetDiv.style.transition = "transform 0.25s ease 0s, opacity 0.25s ease 0s";
|
|
11971
11979
|
widgetDiv.style.borderRadius = "";
|
|
11972
11980
|
fv.onHide(() => {
|
package/built/pxteditor.d.ts
CHANGED
package/built/pxtlib.d.ts
CHANGED
|
@@ -689,6 +689,7 @@ declare namespace pxt.blocks {
|
|
|
689
689
|
function getBlockDefinition(blockId: string): BlockDefinition;
|
|
690
690
|
}
|
|
691
691
|
declare namespace pxt.BrowserUtils {
|
|
692
|
+
export function isDocumentVisible(): boolean;
|
|
692
693
|
export function isIFrame(): boolean;
|
|
693
694
|
export function hasNavigator(): boolean;
|
|
694
695
|
export function hasWindow(): boolean;
|
|
@@ -1305,6 +1306,7 @@ declare namespace pxt.github {
|
|
|
1305
1306
|
private?: boolean;
|
|
1306
1307
|
fork?: boolean;
|
|
1307
1308
|
}
|
|
1309
|
+
function isDefaultBranch(branch: string, repo?: GitRepo): boolean;
|
|
1308
1310
|
function listUserReposAsync(): Promise<GitRepo[]>;
|
|
1309
1311
|
function createRepoAsync(name: string, description: string, priv?: boolean): Promise<GitRepo>;
|
|
1310
1312
|
function enablePagesAsync(repo: string): Promise<void>;
|
package/built/pxtlib.js
CHANGED
|
@@ -4465,6 +4465,10 @@ var pxt;
|
|
|
4465
4465
|
(function (pxt) {
|
|
4466
4466
|
var BrowserUtils;
|
|
4467
4467
|
(function (BrowserUtils) {
|
|
4468
|
+
function isDocumentVisible() {
|
|
4469
|
+
return typeof window !== "undefined" && document.visibilityState === 'visible';
|
|
4470
|
+
}
|
|
4471
|
+
BrowserUtils.isDocumentVisible = isDocumentVisible;
|
|
4468
4472
|
function isIFrame() {
|
|
4469
4473
|
try {
|
|
4470
4474
|
return window && window.self !== window.top;
|
|
@@ -10304,6 +10308,12 @@ var pxt;
|
|
|
10304
10308
|
GitRepoStatus[GitRepoStatus["Approved"] = 1] = "Approved";
|
|
10305
10309
|
GitRepoStatus[GitRepoStatus["Banned"] = 2] = "Banned";
|
|
10306
10310
|
})(GitRepoStatus = github.GitRepoStatus || (github.GitRepoStatus = {}));
|
|
10311
|
+
function isDefaultBranch(branch, repo) {
|
|
10312
|
+
if (repo && repo.defaultBranch)
|
|
10313
|
+
return branch === repo.defaultBranch;
|
|
10314
|
+
return /^(main|master)$/.test(branch);
|
|
10315
|
+
}
|
|
10316
|
+
github.isDefaultBranch = isDefaultBranch;
|
|
10307
10317
|
function listUserReposAsync() {
|
|
10308
10318
|
const q = `{
|
|
10309
10319
|
viewer {
|
|
@@ -10321,12 +10331,12 @@ var pxt;
|
|
|
10321
10331
|
defaultBranchRef {
|
|
10322
10332
|
name
|
|
10323
10333
|
}
|
|
10324
|
-
pxtjson: object(expression: "
|
|
10334
|
+
pxtjson: object(expression: "HEAD:pxt.json") {
|
|
10325
10335
|
... on Blob {
|
|
10326
10336
|
text
|
|
10327
10337
|
}
|
|
10328
10338
|
}
|
|
10329
|
-
readme: object(expression: "
|
|
10339
|
+
readme: object(expression: "HEAD:README.md") {
|
|
10330
10340
|
... on Blob {
|
|
10331
10341
|
text
|
|
10332
10342
|
}
|
package/built/pxtpy.js
CHANGED
|
@@ -186,6 +186,7 @@ var pxt;
|
|
|
186
186
|
return mkType({ primType: tp });
|
|
187
187
|
}
|
|
188
188
|
function getOrSetSymbolType(sym) {
|
|
189
|
+
var _a;
|
|
189
190
|
if (!sym.pySymbolType) {
|
|
190
191
|
currErrorCtx = sym.pyQName;
|
|
191
192
|
if (sym.parameters) {
|
|
@@ -207,8 +208,24 @@ var pxt;
|
|
|
207
208
|
sym.pyRetType = mkType({ moduleType: sym });
|
|
208
209
|
}
|
|
209
210
|
else {
|
|
210
|
-
if (sym.retType)
|
|
211
|
-
sym.
|
|
211
|
+
if (sym.retType) {
|
|
212
|
+
if (((_a = sym.qName) === null || _a === void 0 ? void 0 : _a.endsWith(".__constructor")) && sym.retType === "void") {
|
|
213
|
+
// This must be a TS class. Because python treats constructors as functions,
|
|
214
|
+
// set the return type to be the class instead of void
|
|
215
|
+
const classSym = lookupGlobalSymbol(sym.qName.substring(0, sym.qName.lastIndexOf(".")));
|
|
216
|
+
if (classSym) {
|
|
217
|
+
sym.pyRetType = mkType({
|
|
218
|
+
classType: classSym
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
sym.pyRetType = mapTsType(sym.retType);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
sym.pyRetType = mapTsType(sym.retType);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
212
229
|
else if (sym.pyRetType) {
|
|
213
230
|
// nothing to do
|
|
214
231
|
}
|
package/built/pxtsim.d.ts
CHANGED