pxt-core 7.4.27 → 7.4.30
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 +3 -2
- package/built/pxtblockly.js +264 -82
- package/built/pxtblocks.d.ts +47 -9
- package/built/pxtblocks.js +247 -65
- package/built/pxtcompiler.js +1 -0
- package/built/pxteditor.js +2 -2
- package/built/pxtlib.js +2 -2
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtasseteditor.js +1 -1
- package/built/web/pxtblockly.js +2 -2
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxtcompiler.js +1 -1
- package/built/web/pxteditor.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/localtypings/pxtarget.d.ts +2 -0
- package/package.json +2 -2
- package/webapp/public/blockly/blockly_compressed.js +17 -17
package/built/pxt.js
CHANGED
|
@@ -113477,7 +113477,7 @@ var ts;
|
|
|
113477
113477
|
return r;
|
|
113478
113478
|
}
|
|
113479
113479
|
pxtc.emptyExtInfo = emptyExtInfo;
|
|
113480
|
-
const numberAttributes = ["weight", "imageLiteral", "topblockWeight"];
|
|
113480
|
+
const numberAttributes = ["weight", "imageLiteral", "topblockWeight", "inlineInputModeLimit"];
|
|
113481
113481
|
const booleanAttributes = [
|
|
113482
113482
|
"advanced",
|
|
113483
113483
|
"handlerStatement",
|
|
@@ -115528,7 +115528,7 @@ var pxt;
|
|
|
115528
115528
|
id,
|
|
115529
115529
|
type: "tilemap" /* Tilemap */,
|
|
115530
115530
|
meta: {
|
|
115531
|
-
displayName: id
|
|
115531
|
+
displayName: name || id
|
|
115532
115532
|
},
|
|
115533
115533
|
data: data
|
|
115534
115534
|
});
|
|
@@ -139245,6 +139245,7 @@ var ts;
|
|
|
139245
139245
|
let snippet;
|
|
139246
139246
|
if (preDefinedSnippet) {
|
|
139247
139247
|
snippet = [preDefinedSnippet];
|
|
139248
|
+
snippetPrefix = undefined;
|
|
139248
139249
|
}
|
|
139249
139250
|
else {
|
|
139250
139251
|
snippet = [fnName];
|
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)},
|
|
@@ -401,8 +401,8 @@ Blockly.ConnectionChecker.prototype.getErrorMessage=function(a,b,c){switch(a){ca
|
|
|
401
401
|
Blockly.ConnectionChecker.prototype.doSafetyChecks=function(a,b){if(!a||!b)return Blockly.Connection.REASON_TARGET_NULL;if(a.isSuperior())var c=a.getSourceBlock(),d=b.getSourceBlock();else d=a.getSourceBlock(),c=b.getSourceBlock();return c==d?Blockly.Connection.REASON_SELF_CONNECTION:b.type!=Blockly.OPPOSITE_TYPE[a.type]?Blockly.Connection.REASON_WRONG_TYPE:c.workspace!==d.workspace?Blockly.Connection.REASON_DIFFERENT_WORKSPACES:Blockly.Connection.CAN_CONNECT};
|
|
402
402
|
Blockly.ConnectionChecker.prototype.doTypeChecks=function(a,b){a=a.getCheck();b=b.getCheck();if(!a||!b)return!0;for(var c=0;c<a.length;c++)if(-1!=b.indexOf(a[c]))return!0;return!1};
|
|
403
403
|
Blockly.ConnectionChecker.prototype.doDragChecks=function(a,b,c){if(a.distanceFrom(b)>c||b.getSourceBlock().isInsertionMarker())return!1;switch(b.type){case Blockly.connectionTypes.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(a,b);case Blockly.connectionTypes.OUTPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isInsertionMarker()||a.isConnected())return!1;break;case Blockly.connectionTypes.INPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isMovable()&&!b.targetBlock().isShadow()||b&&b.targetBlock()&&
|
|
404
|
-
(c=b.targetBlock(),c.isShadow()&&Blockly.pxtBlocklyUtils.isFunctionArgumentReporter(c))
|
|
405
|
-
Blockly.draggingConnections.indexOf(b)?!1:!0};Blockly.ConnectionChecker.prototype.canConnectToPrevious_=function(a,b){if(a.targetConnection||-1!=Blockly.draggingConnections.indexOf(b))return!1;var c=a.getSourceBlock(),d=c.getFirstStatementConnection(),e=a==d;a=a==c.nextConnection;if(null!=d&&!e&&!a)return!1;c=null!=c.previousConnection;if(e&&c||!b.targetConnection)return!0;b=b.targetBlock();return b.isInsertionMarker()?!b.getPreviousBlock():!1};
|
|
404
|
+
(c=b.targetBlock(),c.isShadow()&&Blockly.pxtBlocklyUtils.isFunctionArgumentReporter(c)))return!1;if(Blockly.pxtBlocklyUtils.isFunctionArgumentReporter(a.getSourceBlock())){c=b.getSourceBlock().getParent();for(var d=!1;c;){if(!c.isEnabled()||Blockly.pxtBlocklyUtils.hasMatchingArgumentReporter(c,a.getSourceBlock())){d=!0;break}c=c.getParent()}if(!d)return!1}break;case Blockly.connectionTypes.NEXT_STATEMENT:if(b.isConnected()&&!a.getSourceBlock().nextConnection&&!b.targetBlock().isShadow()&&b.targetBlock().nextConnection)return!1;
|
|
405
|
+
break;default:return!1}return-1!=Blockly.draggingConnections.indexOf(b)?!1:!0};Blockly.ConnectionChecker.prototype.canConnectToPrevious_=function(a,b){if(a.targetConnection||-1!=Blockly.draggingConnections.indexOf(b))return!1;var c=a.getSourceBlock(),d=c.getFirstStatementConnection(),e=a==d;a=a==c.nextConnection;if(null!=d&&!e&&!a)return!1;c=null!=c.previousConnection;if(e&&c||!b.targetConnection)return!0;b=b.targetBlock();return b.isInsertionMarker()?!b.getPreviousBlock():!1};
|
|
406
406
|
Blockly.registry.register(Blockly.registry.Type.CONNECTION_CHECKER,Blockly.registry.DEFAULT,Blockly.ConnectionChecker);Blockly.VariableMap=function(a){this.variableMap_=Object.create(null);this.workspace=a};Blockly.VariableMap.prototype.clear=function(){this.variableMap_=Object.create(null)};Blockly.VariableMap.prototype.renameVariable=function(a,b){var c=this.getVariable(b,a.type),d=this.workspace.getAllBlocks(!1);Blockly.Events.setGroup(!0);try{c&&c.getId()!=a.getId()?this.renameVariableWithConflict_(a,b,c,d):this.renameVariableAndUses_(a,b,d)}finally{Blockly.Events.setGroup(!1)}};
|
|
407
407
|
Blockly.VariableMap.prototype.renameVariableById=function(a,b){var c=this.getVariableById(a);if(!c)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.renameVariable(c,b)};Blockly.VariableMap.prototype.renameVariableAndUses_=function(a,b,c){Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_RENAME))(a,b));a.name=b;for(b=0;b<c.length;b++)c[b].updateVarName(a)};
|
|
408
408
|
Blockly.VariableMap.prototype.renameVariableWithConflict_=function(a,b,c,d){var e=a.type;b!=c.name&&this.renameVariableAndUses_(c,b,d);for(b=0;b<d.length;b++)d[b].renameVarById(a.getId(),c.getId());Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_DELETE))(a));a=this.getVariablesOfType(e).indexOf(a);this.variableMap_[e].splice(a,1)};
|
|
@@ -674,7 +674,7 @@ Blockly.Field.prototype.markDirty=function(){this.isDirty_=!0;this.constants_=nu
|
|
|
674
674
|
Blockly.Field.prototype.setValue=function(a){if(null!==a){var b=this.doClassValidation_(a);a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,b),a instanceof Error)return;b=this.sourceBlock_;if(!b||!b.disposed){var c=this.getValue();c===a?this.doValueUpdate_(a):(b&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.BLOCK_CHANGE))(b,"field",this.name||null,c,a)),this.doValueUpdate_(a),
|
|
675
675
|
this.isDirty_&&this.forceRerender())}}}};Blockly.Field.prototype.processValidation_=function(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a};Blockly.Field.prototype.getValue=function(){return this.value_};Blockly.Field.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:a};Blockly.Field.prototype.doValueUpdate_=function(a){this.value_=a;this.isDirty_=!0};Blockly.Field.prototype.doValueInvalid_=function(a){};
|
|
676
676
|
Blockly.Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)};Blockly.Field.prototype.setTooltip=function(a){a||""===a||(a=this.sourceBlock_);var b=this.getClickTarget_();b?b.tooltip=a:this.tooltip_=a};Blockly.Field.prototype.getTooltip=function(){var a=this.getClickTarget_();return a?Blockly.Tooltip.getTooltipOfObject(a):Blockly.Tooltip.getTooltipOfObject({tooltip:this.tooltip_})};
|
|
677
|
-
Blockly.Field.prototype.getClickTarget_=function(){if(this.clickTarget_)return this.clickTarget_;if(!this.sourceBlock_)return null;for(var a=0,b=0,c=0,d;d=this.sourceBlock_.inputList[c];c++){for(var e=0,f;f=d.fieldRow[e];e++)f instanceof Blockly.FieldLabel||a++;d.connection&&b++}return this.clickTarget_=1>=a&&this.sourceBlock_.outputConnection&&!b?this.sourceBlock_.getSvgRoot():this.getSvgRoot()};
|
|
677
|
+
Blockly.Field.prototype.getClickTarget_=function(){if(this.clickTarget_)return this.clickTarget_;if(!this.sourceBlock_||!this.sourceBlock_.getSvgRoot)return null;for(var a=0,b=0,c=0,d;d=this.sourceBlock_.inputList[c];c++){for(var e=0,f;f=d.fieldRow[e];e++)f instanceof Blockly.FieldLabel||a++;d.connection&&b++}return this.clickTarget_=1>=a&&this.sourceBlock_.outputConnection&&!b?this.sourceBlock_.getSvgRoot():this.getSvgRoot()};
|
|
678
678
|
Blockly.Field.prototype.getTotalFields_=function(a){a=void 0===a?!1:a;for(var b=0,c=0,d;d=this.sourceBlock_.inputList[c];c++)for(var e=0,f;f=d.fieldRow[e];e++)f instanceof Blockly.FieldLabel&&a||b++;return b};Blockly.Field.prototype.getAbsoluteXY_=function(){return Blockly.utils.style.getPageOffset(this.getClickTarget_())};Blockly.Field.prototype.referencesVariables=function(){return!1};
|
|
679
679
|
Blockly.Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;d<b.inputList.length;d++)for(var e=c[d],f=e.fieldRow,g=0;g<f.length;g++)if(f[g]===this){a=e;break}return a};Blockly.Field.prototype.getFlipRtl=function(){return!1};Blockly.Field.prototype.isTabNavigable=function(){return!1};Blockly.Field.prototype.onShortcut=function(a){return!1};
|
|
680
680
|
Blockly.Field.prototype.setCursorSvg=function(a){a?(this.fieldGroup_.appendChild(a),this.cursorSvg_=a):this.cursorSvg_=null};Blockly.Field.prototype.setMarkerSvg=function(a){a?(this.fieldGroup_.appendChild(a),this.markerSvg_=a):this.markerSvg_=null};Blockly.Field.prototype.updateMarkers_=function(){var a=this.sourceBlock_.workspace;a.keyboardAccessibilityMode&&this.cursorSvg_&&a.getCursor().draw();a.keyboardAccessibilityMode&&this.markerSvg_&&a.getMarker(Blockly.MarkerManager.LOCAL_MARKER).draw()};Blockly.fieldRegistry={};Blockly.fieldRegistry.register=function(a,b){Blockly.registry.register(Blockly.registry.Type.FIELD,a,b)};Blockly.fieldRegistry.unregister=function(a){Blockly.registry.unregister(Blockly.registry.Type.FIELD,a)};
|
|
@@ -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.13";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}};
|
|
@@ -5891,6 +5891,7 @@ var pxt;
|
|
|
5891
5891
|
registerFieldEditor('protractor', pxtblockly.FieldProtractor);
|
|
5892
5892
|
registerFieldEditor('position', pxtblockly.FieldPosition);
|
|
5893
5893
|
registerFieldEditor('melody', pxtblockly.FieldCustomMelody);
|
|
5894
|
+
registerFieldEditor('autocomplete', pxtblockly.FieldAutoComplete);
|
|
5894
5895
|
}
|
|
5895
5896
|
blocks.initFieldEditors = initFieldEditors;
|
|
5896
5897
|
function registerFieldEditor(selector, field, validator) {
|
|
@@ -7470,11 +7471,10 @@ var pxt;
|
|
|
7470
7471
|
block.appendChild(createShadowValue(info, t, t.shadowBlockId || "variables_get", t.defaultValue || t.definitionName));
|
|
7471
7472
|
}
|
|
7472
7473
|
if (fn.parameters) {
|
|
7473
|
-
comp.parameters.filter(pr =>
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|| pr.defaultValue))
|
|
7474
|
+
comp.parameters.filter(pr => primitiveTypeRegex.test(pr.type)
|
|
7475
|
+
|| primitiveTypeRegex.test(isArrayType(pr.type))
|
|
7476
|
+
|| pr.shadowBlockId
|
|
7477
|
+
|| pr.defaultValue)
|
|
7478
7478
|
.forEach(pr => {
|
|
7479
7479
|
block.appendChild(createShadowValue(info, pr));
|
|
7480
7480
|
});
|
|
@@ -10808,18 +10808,27 @@ var pxt;
|
|
|
10808
10808
|
// by BlocklyLoader. The number makes it an invalid JS identifier
|
|
10809
10809
|
const buttonAddName = "0_add_button";
|
|
10810
10810
|
const buttonRemName = "0_rem_button";
|
|
10811
|
+
const buttonAddRemName = "0_add_rem_button";
|
|
10811
10812
|
const numVisibleAttr = "_expanded";
|
|
10812
10813
|
const inputInitAttr = "_input_init";
|
|
10813
10814
|
const optionNames = def.parameters.map(p => p.name);
|
|
10814
10815
|
const totalOptions = def.parameters.length;
|
|
10815
10816
|
const buttonDelta = toggle ? totalOptions : 1;
|
|
10817
|
+
const variableInlineInputs = info.blocksById[b.type].attributes.inlineInputMode === "variable";
|
|
10818
|
+
const inlineInputModeLimit = info.blocksById[b.type].attributes.inlineInputModeLimit || 4;
|
|
10819
|
+
const breakString = info.blocksById[b.type].attributes.expandableArgumentBreaks;
|
|
10820
|
+
let breaks;
|
|
10821
|
+
if (breakString) {
|
|
10822
|
+
breaks = breakString.split(/[;,]/).map(s => parseInt(s));
|
|
10823
|
+
}
|
|
10816
10824
|
const state = new MutationState(b);
|
|
10817
10825
|
state.setEventsEnabled(false);
|
|
10818
10826
|
state.setValue(numVisibleAttr, 0);
|
|
10819
10827
|
state.setValue(inputInitAttr, false);
|
|
10820
10828
|
state.setEventsEnabled(true);
|
|
10821
10829
|
Blockly.Extensions.apply('inline-svgs', b, false);
|
|
10822
|
-
|
|
10830
|
+
let updatingInputs = false;
|
|
10831
|
+
let firstRender = true;
|
|
10823
10832
|
appendMutation(b, {
|
|
10824
10833
|
mutationToDom: (el) => {
|
|
10825
10834
|
// The reason we store the inputsInitialized variable separately from visibleOptions
|
|
@@ -10834,8 +10843,8 @@ var pxt;
|
|
|
10834
10843
|
state.setEventsEnabled(false);
|
|
10835
10844
|
if (saved.hasAttribute(inputInitAttr) && saved.getAttribute(inputInitAttr) == "true" && !state.getBoolean(inputInitAttr)) {
|
|
10836
10845
|
state.setValue(inputInitAttr, true);
|
|
10837
|
-
initOptionalInputs();
|
|
10838
10846
|
}
|
|
10847
|
+
initOptionalInputs();
|
|
10839
10848
|
if (saved.hasAttribute(numVisibleAttr)) {
|
|
10840
10849
|
const val = parseInt(saved.getAttribute(numVisibleAttr));
|
|
10841
10850
|
if (!isNaN(val)) {
|
|
@@ -10846,6 +10855,7 @@ var pxt;
|
|
|
10846
10855
|
}
|
|
10847
10856
|
else {
|
|
10848
10857
|
state.setValue(numVisibleAttr, addDelta(delta));
|
|
10858
|
+
updateButtons();
|
|
10849
10859
|
}
|
|
10850
10860
|
}
|
|
10851
10861
|
else {
|
|
@@ -10856,14 +10866,18 @@ var pxt;
|
|
|
10856
10866
|
state.setEventsEnabled(true);
|
|
10857
10867
|
}
|
|
10858
10868
|
});
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
if (
|
|
10869
|
+
initOptionalInputs();
|
|
10870
|
+
b.render = (opt_bubble) => {
|
|
10871
|
+
if (updatingInputs)
|
|
10872
|
+
return;
|
|
10873
|
+
if (firstRender) {
|
|
10874
|
+
firstRender = false;
|
|
10875
|
+
updatingInputs = true;
|
|
10864
10876
|
updateShape(0, undefined, true);
|
|
10877
|
+
updatingInputs = false;
|
|
10865
10878
|
}
|
|
10866
|
-
|
|
10879
|
+
Blockly.BlockSvg.prototype.render.call(b, opt_bubble);
|
|
10880
|
+
};
|
|
10867
10881
|
// Set skipRender to true if the block is still initializing. Otherwise
|
|
10868
10882
|
// the inputs will render before their shadow blocks are created and
|
|
10869
10883
|
// leave behind annoying artifacts
|
|
@@ -10893,25 +10907,14 @@ var pxt;
|
|
|
10893
10907
|
setInputVisible(input, visible);
|
|
10894
10908
|
if (visible && input.connection && !input.connection.isConnected() && !b.isInsertionMarker()) {
|
|
10895
10909
|
const param = comp.definitionNameToParam[def.parameters[optIndex].name];
|
|
10896
|
-
|
|
10897
|
-
if (shadow.tagName.toLowerCase() === "value") {
|
|
10898
|
-
// Unwrap the block
|
|
10899
|
-
shadow = shadow.firstElementChild;
|
|
10900
|
-
}
|
|
10901
|
-
Blockly.Events.disable();
|
|
10902
|
-
try {
|
|
10903
|
-
const nb = Blockly.Xml.domToBlock(shadow, b.workspace);
|
|
10904
|
-
if (nb) {
|
|
10905
|
-
input.connection.connect(nb.outputConnection);
|
|
10906
|
-
}
|
|
10907
|
-
}
|
|
10908
|
-
catch (e) { }
|
|
10909
|
-
Blockly.Events.enable();
|
|
10910
|
+
attachShadowBlock(input, param);
|
|
10910
10911
|
}
|
|
10911
10912
|
++optIndex;
|
|
10912
10913
|
}
|
|
10913
10914
|
}
|
|
10914
10915
|
updateButtons();
|
|
10916
|
+
if (variableInlineInputs)
|
|
10917
|
+
b.setInputsInline(visibleOptions < inlineInputModeLimit);
|
|
10915
10918
|
if (!skipRender)
|
|
10916
10919
|
b.render();
|
|
10917
10920
|
}
|
|
@@ -10920,31 +10923,32 @@ var pxt;
|
|
|
10920
10923
|
.appendField(new Blockly.FieldImage(uri, 24, 24, alt, () => updateShape(delta), false));
|
|
10921
10924
|
}
|
|
10922
10925
|
function updateButtons() {
|
|
10926
|
+
if (updatingInputs)
|
|
10927
|
+
return;
|
|
10923
10928
|
const visibleOptions = state.getNumber(numVisibleAttr);
|
|
10924
10929
|
const showPlus = visibleOptions !== totalOptions;
|
|
10925
10930
|
const showMinus = visibleOptions !== 0;
|
|
10926
|
-
|
|
10927
|
-
const hasPlus = !!b.getInput(buttonAddName);
|
|
10928
|
-
if (!showPlus) {
|
|
10931
|
+
if (b.inputList.some(i => i.name === buttonAddName))
|
|
10929
10932
|
b.removeInput(buttonAddName, true);
|
|
10930
|
-
|
|
10931
|
-
if (!showMinus) {
|
|
10933
|
+
if (b.inputList.some(i => i.name === buttonRemName))
|
|
10932
10934
|
b.removeInput(buttonRemName, true);
|
|
10935
|
+
if (b.inputList.some(i => i.name === buttonAddRemName))
|
|
10936
|
+
b.removeInput(buttonAddRemName, true);
|
|
10937
|
+
if (showPlus && showMinus) {
|
|
10938
|
+
addPlusAndMinusButtons();
|
|
10933
10939
|
}
|
|
10934
|
-
if (
|
|
10935
|
-
|
|
10940
|
+
else if (showPlus) {
|
|
10941
|
+
addPlusButton();
|
|
10936
10942
|
}
|
|
10937
|
-
if (
|
|
10938
|
-
|
|
10939
|
-
if (hasPlus && b.inputList.findIndex(el => el.name === buttonAddName) !== b.inputList.length - 1) {
|
|
10940
|
-
b.removeInput(buttonAddName, true);
|
|
10941
|
-
addPlusButton();
|
|
10942
|
-
}
|
|
10943
|
-
else if (!hasPlus) {
|
|
10944
|
-
addPlusButton();
|
|
10945
|
-
}
|
|
10943
|
+
else if (showMinus) {
|
|
10944
|
+
addMinusButton();
|
|
10946
10945
|
}
|
|
10947
10946
|
}
|
|
10947
|
+
function addPlusAndMinusButtons() {
|
|
10948
|
+
b.appendDummyInput(buttonAddRemName)
|
|
10949
|
+
.appendField(new Blockly.FieldImage(b.REMOVE_IMAGE_DATAURI, 24, 24, lf("Hide optional arguments"), () => updateShape(-1 * buttonDelta), false))
|
|
10950
|
+
.appendField(new Blockly.FieldImage(b.ADD_IMAGE_DATAURI, 24, 24, lf("Reveal optional arguments"), () => updateShape(buttonDelta), false));
|
|
10951
|
+
}
|
|
10948
10952
|
function addPlusButton() {
|
|
10949
10953
|
addButton(buttonAddName, b.ADD_IMAGE_DATAURI, lf("Reveal optional arguments"), buttonDelta);
|
|
10950
10954
|
}
|
|
@@ -10957,16 +10961,48 @@ var pxt;
|
|
|
10957
10961
|
updateButtons();
|
|
10958
10962
|
}
|
|
10959
10963
|
function addDelta(delta) {
|
|
10960
|
-
|
|
10964
|
+
const newValue = Math.min(Math.max(state.getNumber(numVisibleAttr) + delta, 0), totalOptions);
|
|
10965
|
+
if (breaks) {
|
|
10966
|
+
if (delta >= 0) {
|
|
10967
|
+
if (newValue === 0)
|
|
10968
|
+
return 0;
|
|
10969
|
+
for (const breakpoint of breaks) {
|
|
10970
|
+
if (breakpoint >= newValue) {
|
|
10971
|
+
return breakpoint;
|
|
10972
|
+
}
|
|
10973
|
+
}
|
|
10974
|
+
return totalOptions;
|
|
10975
|
+
}
|
|
10976
|
+
else {
|
|
10977
|
+
for (let i = 0; i < breaks.length; i++) {
|
|
10978
|
+
if (breaks[i] >= newValue) {
|
|
10979
|
+
return i > 0 ? breaks[i - 1] : 0;
|
|
10980
|
+
}
|
|
10981
|
+
}
|
|
10982
|
+
return breaks[breaks.length - 1];
|
|
10983
|
+
}
|
|
10984
|
+
}
|
|
10985
|
+
return newValue;
|
|
10961
10986
|
}
|
|
10962
10987
|
function setInputVisible(input, visible) {
|
|
10963
10988
|
// If the block isn't rendered, Blockly will crash
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10989
|
+
input.setVisible(visible);
|
|
10990
|
+
}
|
|
10991
|
+
function attachShadowBlock(input, param) {
|
|
10992
|
+
let shadow = blocks.createShadowValue(info, param);
|
|
10993
|
+
if (shadow.tagName.toLowerCase() === "value") {
|
|
10994
|
+
// Unwrap the block
|
|
10995
|
+
shadow = shadow.firstElementChild;
|
|
10996
|
+
}
|
|
10997
|
+
Blockly.Events.disable();
|
|
10998
|
+
try {
|
|
10999
|
+
const nb = Blockly.Xml.domToBlock(shadow, b.workspace);
|
|
11000
|
+
if (nb) {
|
|
11001
|
+
input.connection.connect(nb.outputConnection);
|
|
11002
|
+
}
|
|
10969
11003
|
}
|
|
11004
|
+
catch (e) { }
|
|
11005
|
+
Blockly.Events.enable();
|
|
10970
11006
|
}
|
|
10971
11007
|
}
|
|
10972
11008
|
blocks.initExpandableBlock = initExpandableBlock;
|
|
@@ -11890,6 +11926,162 @@ var pxtblockly;
|
|
|
11890
11926
|
}
|
|
11891
11927
|
pxtblockly.FieldArgumentVariable = FieldArgumentVariable;
|
|
11892
11928
|
})(pxtblockly || (pxtblockly = {}));
|
|
11929
|
+
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
11930
|
+
var pxtblockly;
|
|
11931
|
+
(function (pxtblockly) {
|
|
11932
|
+
class FieldTextDropdown extends Blockly.FieldTextDropdown {
|
|
11933
|
+
constructor(text, options, opt_validator) {
|
|
11934
|
+
super(text, options.values, opt_validator);
|
|
11935
|
+
this.isFieldCustom_ = true;
|
|
11936
|
+
}
|
|
11937
|
+
}
|
|
11938
|
+
pxtblockly.FieldTextDropdown = FieldTextDropdown;
|
|
11939
|
+
})(pxtblockly || (pxtblockly = {}));
|
|
11940
|
+
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
11941
|
+
/// <reference path="./field_textdropdown.ts" />
|
|
11942
|
+
var pxtblockly;
|
|
11943
|
+
(function (pxtblockly) {
|
|
11944
|
+
class FieldAutoComplete extends Blockly.FieldTextDropdown {
|
|
11945
|
+
constructor(text, options, opt_validator) {
|
|
11946
|
+
super(text, () => [], opt_validator);
|
|
11947
|
+
this.isFieldCustom_ = true;
|
|
11948
|
+
this.key = options.key;
|
|
11949
|
+
this.isTextValid_ = true;
|
|
11950
|
+
}
|
|
11951
|
+
isOptionListDynamic() {
|
|
11952
|
+
return true;
|
|
11953
|
+
}
|
|
11954
|
+
getDisplayText_() {
|
|
11955
|
+
return this.parsedValue || "";
|
|
11956
|
+
}
|
|
11957
|
+
doValueUpdate_(newValue) {
|
|
11958
|
+
if (newValue === null)
|
|
11959
|
+
return;
|
|
11960
|
+
if (/['"`].*['"`]/.test(newValue)) {
|
|
11961
|
+
this.parsedValue = JSON.parse(newValue);
|
|
11962
|
+
}
|
|
11963
|
+
else {
|
|
11964
|
+
this.parsedValue = newValue;
|
|
11965
|
+
}
|
|
11966
|
+
this.value_ = this.parsedValue;
|
|
11967
|
+
}
|
|
11968
|
+
getValue() {
|
|
11969
|
+
if (this.parsedValue) {
|
|
11970
|
+
return JSON.stringify(this.parsedValue);
|
|
11971
|
+
}
|
|
11972
|
+
else
|
|
11973
|
+
return '""';
|
|
11974
|
+
}
|
|
11975
|
+
getOptions() {
|
|
11976
|
+
var _a;
|
|
11977
|
+
const workspace = (_a = this.sourceBlock_) === null || _a === void 0 ? void 0 : _a.workspace;
|
|
11978
|
+
if (!workspace)
|
|
11979
|
+
return [];
|
|
11980
|
+
const res = [];
|
|
11981
|
+
const fields = pxtblockly.getAllFields(workspace, field => field instanceof FieldAutoComplete && field.getKey() === this.key);
|
|
11982
|
+
const options = fields.map(field => field.ref.getDisplayText_());
|
|
11983
|
+
for (const option of options) {
|
|
11984
|
+
if (!option.trim() || res.some(tuple => tuple[0] === option))
|
|
11985
|
+
continue;
|
|
11986
|
+
res.push([option, option]);
|
|
11987
|
+
}
|
|
11988
|
+
res.sort((a, b) => a[0].localeCompare(b[0]));
|
|
11989
|
+
return res;
|
|
11990
|
+
}
|
|
11991
|
+
showDropdown_() {
|
|
11992
|
+
const options = this.getOptions();
|
|
11993
|
+
if (options.length)
|
|
11994
|
+
super.showDropdown_();
|
|
11995
|
+
}
|
|
11996
|
+
getKey() {
|
|
11997
|
+
if (this.key)
|
|
11998
|
+
return this.key;
|
|
11999
|
+
if (this.sourceBlock_)
|
|
12000
|
+
return this.sourceBlock_.type;
|
|
12001
|
+
return undefined;
|
|
12002
|
+
}
|
|
12003
|
+
// Copied from field_string in pxt-blockly
|
|
12004
|
+
initView() {
|
|
12005
|
+
// Add quotes around the string
|
|
12006
|
+
// Positioned on updatSize, after text size is calculated.
|
|
12007
|
+
this.quoteSize_ = 16;
|
|
12008
|
+
this.quoteWidth_ = 8;
|
|
12009
|
+
this.quoteLeftX_ = 0;
|
|
12010
|
+
this.quoteRightX_ = 0;
|
|
12011
|
+
this.quoteY_ = 10;
|
|
12012
|
+
if (this.quoteLeft_)
|
|
12013
|
+
this.quoteLeft_.parentNode.removeChild(this.quoteLeft_);
|
|
12014
|
+
this.quoteLeft_ = Blockly.utils.dom.createSvgElement('text', {
|
|
12015
|
+
'font-size': this.quoteSize_ + 'px',
|
|
12016
|
+
'class': 'field-text-quote'
|
|
12017
|
+
}, this.fieldGroup_);
|
|
12018
|
+
super.initView();
|
|
12019
|
+
if (this.quoteRight_)
|
|
12020
|
+
this.quoteRight_.parentNode.removeChild(this.quoteRight_);
|
|
12021
|
+
this.quoteRight_ = Blockly.utils.dom.createSvgElement('text', {
|
|
12022
|
+
'font-size': this.quoteSize_ + 'px',
|
|
12023
|
+
'class': 'field-text-quote'
|
|
12024
|
+
}, this.fieldGroup_);
|
|
12025
|
+
this.quoteLeft_.appendChild(document.createTextNode('"'));
|
|
12026
|
+
this.quoteRight_.appendChild(document.createTextNode('"'));
|
|
12027
|
+
}
|
|
12028
|
+
// Copied from field_string in pxt-blockly
|
|
12029
|
+
updateSize_() {
|
|
12030
|
+
super.updateSize_();
|
|
12031
|
+
const sWidth = Math.max(this.size_.width, 1);
|
|
12032
|
+
const xPadding = 3;
|
|
12033
|
+
let addedWidth = this.positionLeft(sWidth + xPadding);
|
|
12034
|
+
this.textElement_.setAttribute('x', addedWidth.toString());
|
|
12035
|
+
addedWidth += this.positionRight(addedWidth + sWidth + xPadding);
|
|
12036
|
+
this.size_.width = sWidth + addedWidth;
|
|
12037
|
+
}
|
|
12038
|
+
// Copied from field_string in pxt-blockly
|
|
12039
|
+
positionRight(x) {
|
|
12040
|
+
if (!this.quoteRight_) {
|
|
12041
|
+
return 0;
|
|
12042
|
+
}
|
|
12043
|
+
let addedWidth = 0;
|
|
12044
|
+
if (this.sourceBlock_.RTL) {
|
|
12045
|
+
this.quoteRightX_ = Blockly.FieldString.quotePadding;
|
|
12046
|
+
addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
|
|
12047
|
+
}
|
|
12048
|
+
else {
|
|
12049
|
+
this.quoteRightX_ = x + Blockly.FieldString.quotePadding;
|
|
12050
|
+
addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
|
|
12051
|
+
}
|
|
12052
|
+
this.quoteRight_.setAttribute('transform', 'translate(' + this.quoteRightX_ + ',' + this.quoteY_ + ')');
|
|
12053
|
+
return addedWidth;
|
|
12054
|
+
}
|
|
12055
|
+
// Copied from field_string in pxt-blockly
|
|
12056
|
+
positionLeft(x) {
|
|
12057
|
+
if (!this.quoteLeft_) {
|
|
12058
|
+
return 0;
|
|
12059
|
+
}
|
|
12060
|
+
let addedWidth = 0;
|
|
12061
|
+
if (this.sourceBlock_.RTL) {
|
|
12062
|
+
this.quoteLeftX_ = x + this.quoteWidth_ + Blockly.FieldString.quotePadding * 2;
|
|
12063
|
+
addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
|
|
12064
|
+
}
|
|
12065
|
+
else {
|
|
12066
|
+
this.quoteLeftX_ = 0;
|
|
12067
|
+
addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
|
|
12068
|
+
}
|
|
12069
|
+
this.quoteLeft_.setAttribute('transform', 'translate(' + this.quoteLeftX_ + ',' + this.quoteY_ + ')');
|
|
12070
|
+
return addedWidth;
|
|
12071
|
+
}
|
|
12072
|
+
createSVGArrow_() {
|
|
12073
|
+
// This creates the little arrow for dropdown fields. Intentionally
|
|
12074
|
+
// do nothing
|
|
12075
|
+
}
|
|
12076
|
+
showPromptEditor_() {
|
|
12077
|
+
Blockly.prompt(Blockly.Msg['CHANGE_VALUE_TITLE'], this.parsedValue, (newValue) => {
|
|
12078
|
+
this.setValue(this.getValueFromEditorText_(newValue));
|
|
12079
|
+
this.forceRerender();
|
|
12080
|
+
});
|
|
12081
|
+
}
|
|
12082
|
+
}
|
|
12083
|
+
pxtblockly.FieldAutoComplete = FieldAutoComplete;
|
|
12084
|
+
})(pxtblockly || (pxtblockly = {}));
|
|
11893
12085
|
/// <reference path="../../localtypings/blockly.d.ts" />
|
|
11894
12086
|
/// <reference path="../../built/pxtsim.d.ts" />
|
|
11895
12087
|
var pxtblockly;
|
|
@@ -15232,17 +15424,6 @@ var pxtblockly;
|
|
|
15232
15424
|
})(pxtblockly || (pxtblockly = {}));
|
|
15233
15425
|
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
15234
15426
|
var pxtblockly;
|
|
15235
|
-
(function (pxtblockly) {
|
|
15236
|
-
class FieldTextDropdown extends Blockly.FieldTextDropdown {
|
|
15237
|
-
constructor(text, options, opt_validator) {
|
|
15238
|
-
super(text, options.values, opt_validator);
|
|
15239
|
-
this.isFieldCustom_ = true;
|
|
15240
|
-
}
|
|
15241
|
-
}
|
|
15242
|
-
pxtblockly.FieldTextDropdown = FieldTextDropdown;
|
|
15243
|
-
})(pxtblockly || (pxtblockly = {}));
|
|
15244
|
-
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
15245
|
-
var pxtblockly;
|
|
15246
15427
|
(function (pxtblockly) {
|
|
15247
15428
|
class FieldTextInput extends Blockly.FieldTextInput {
|
|
15248
15429
|
constructor(value, options, opt_validator) {
|
|
@@ -16354,11 +16535,11 @@ var pxtblockly;
|
|
|
16354
16535
|
}
|
|
16355
16536
|
}
|
|
16356
16537
|
function getAllBlocksWithTilemaps(ws) {
|
|
16357
|
-
return
|
|
16538
|
+
return getAllFields(ws, f => f instanceof pxtblockly.FieldTilemap && !f.isGreyBlock);
|
|
16358
16539
|
}
|
|
16359
16540
|
pxtblockly.getAllBlocksWithTilemaps = getAllBlocksWithTilemaps;
|
|
16360
16541
|
function getAllBlocksWithTilesets(ws) {
|
|
16361
|
-
return
|
|
16542
|
+
return getAllFields(ws, f => f instanceof pxtblockly.FieldTileset);
|
|
16362
16543
|
}
|
|
16363
16544
|
pxtblockly.getAllBlocksWithTilesets = getAllBlocksWithTilesets;
|
|
16364
16545
|
function needsTilemapUpgrade(ws) {
|
|
@@ -16414,7 +16595,7 @@ var pxtblockly;
|
|
|
16414
16595
|
}
|
|
16415
16596
|
}
|
|
16416
16597
|
pxtblockly.upgradeTilemapsInWorkspace = upgradeTilemapsInWorkspace;
|
|
16417
|
-
function
|
|
16598
|
+
function getAllFields(ws, predicate) {
|
|
16418
16599
|
const result = [];
|
|
16419
16600
|
const top = ws.getTopBlocks(false);
|
|
16420
16601
|
top.forEach(block => getAllFieldsRecursive(block));
|
|
@@ -16435,6 +16616,7 @@ var pxtblockly;
|
|
|
16435
16616
|
}
|
|
16436
16617
|
}
|
|
16437
16618
|
}
|
|
16619
|
+
pxtblockly.getAllFields = getAllFields;
|
|
16438
16620
|
function getAllReferencedTiles(workspace, excludeBlockID) {
|
|
16439
16621
|
var _a;
|
|
16440
16622
|
let all = {};
|
|
@@ -16473,10 +16655,10 @@ var pxtblockly;
|
|
|
16473
16655
|
function getTemporaryAssets(workspace, type) {
|
|
16474
16656
|
switch (type) {
|
|
16475
16657
|
case "image" /* Image */:
|
|
16476
|
-
return
|
|
16658
|
+
return getAllFields(workspace, field => field instanceof pxtblockly.FieldSpriteEditor && field.isTemporaryAsset())
|
|
16477
16659
|
.map(f => f.ref.getAsset());
|
|
16478
16660
|
case "animation" /* Animation */:
|
|
16479
|
-
return
|
|
16661
|
+
return getAllFields(workspace, field => field instanceof pxtblockly.FieldAnimationEditor && field.isTemporaryAsset())
|
|
16480
16662
|
.map(f => f.ref.getAsset());
|
|
16481
16663
|
default: return [];
|
|
16482
16664
|
}
|