pxt-core 8.1.6 → 8.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/built/pxt.js CHANGED
@@ -153282,7 +153282,13 @@ var pxsim;
153282
153282
  frame.setAttribute('allow', 'autoplay;microphone');
153283
153283
  frame.setAttribute('sandbox', 'allow-same-origin allow-scripts');
153284
153284
  frame.className = 'no-select';
153285
- const furl = (url || this.getSimUrl()) + '#' + frame.id;
153285
+ let furl = url || this.getSimUrl().toString();
153286
+ if (this._runOptions.hideSimButtons) {
153287
+ const urlObject = new URL(furl);
153288
+ urlObject.searchParams.append("hideSimButtons", "1");
153289
+ furl = urlObject.toString();
153290
+ }
153291
+ furl += '#' + frame.id;
153286
153292
  frame.src = furl;
153287
153293
  frame.frameBorder = "0";
153288
153294
  frame.dataset['runid'] = this.runId;
@@ -153524,8 +153530,7 @@ var pxsim;
153524
153530
  msg.frameCounter = ++this.frameCounter;
153525
153531
  msg.options = {
153526
153532
  theme: this.themes[this.nextFrameId++ % this.themes.length],
153527
- mpRole: (_b = (_a = /[\&\?]mp=(server|client)/i.exec(window.location.href)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.toLowerCase(),
153528
- hideSimButtons: /hidesimbuttons(?:[:=])1/i.test(window.location.href)
153533
+ mpRole: (_b = (_a = /[\&\?]mp=(server|client)/i.exec(window.location.href)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.toLowerCase()
153529
153534
  };
153530
153535
  msg.id = `${msg.options.theme}-${this.nextId()}`;
153531
153536
  frame.dataset['runid'] = this.runId;
@@ -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))||Blockly.pxtBlocklyUtils.isFunctionArgumentReporter(a.getSourceBlock())&&(c=b.getSourceBlock().getRootBlock(),c.isEnabled()&&!Blockly.pxtBlocklyUtils.hasMatchingArgumentReporter(c,a.getSourceBlock())))return!1;break;case Blockly.connectionTypes.NEXT_STATEMENT:if(b.isConnected()&&!a.getSourceBlock().nextConnection&&!b.targetBlock().isShadow()&&b.targetBlock().nextConnection)return!1;break;default:return!1}return-1!=
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)};
@@ -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.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()};
1087
+ var d=c.createDom("svg");goog.dom.insertSiblingAfter(d,b);c.init(a);return c};Blockly.VERSION="4.0.15";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};
@@ -1241,7 +1241,7 @@ weight:1,capabilities:[Blockly.ComponentManager.Capability.AUTOHIDEABLE,Blockly.
1241
1241
  Blockly.Toolbox.prototype.createDom_=function(a){a=a.getParentSvg();var b=this.createContainer_();this.contentsDiv_=this.createContentsContainer_();this.contentsDiv_.tabIndex=0;Blockly.utils.aria.setRole(this.contentsDiv_,Blockly.utils.aria.Role.TREE);b.appendChild(this.contentsDiv_);a.parentNode.insertBefore(b,a);this.attachEvents_(b,this.contentsDiv_);return b};
1242
1242
  Blockly.Toolbox.prototype.createContainer_=function(){var a=document.createElement("div");a.setAttribute("layout",this.isHorizontal()?"h":"v");Blockly.utils.dom.addClass(a,"blocklyToolboxDiv");Blockly.utils.dom.addClass(a,"blocklyNonSelectable");a.setAttribute("dir",this.RTL?"RTL":"LTR");return a};
1243
1243
  Blockly.Toolbox.prototype.createContentsContainer_=function(){var a=document.createElement("div");Blockly.utils.dom.addClass(a,"blocklyToolboxContents");this.isHorizontal()&&(a.style.flexDirection="row");return a};Blockly.Toolbox.prototype.attachEvents_=function(a,b){a=Blockly.browserEvents.conditionalBind(a,"click",this,this.onClick_,!1,!0);this.boundEvents_.push(a);b=Blockly.browserEvents.conditionalBind(b,"keydown",this,this.onKeyDown_,!1,!0);this.boundEvents_.push(b)};
1244
- Blockly.Toolbox.prototype.onClick_=function(a){if(Blockly.utils.isRightButton(a)||a.target==this.HtmlDiv)Blockly.hideChaff(!1);else{var b=a.target.getAttribute("id");b&&(b=this.getToolboxItemById(b),b.isSelectable()&&(this.setSelectedItem(b),b.onClick(a)));Blockly.hideChaff(!0)}Blockly.Touch.clearTouchIdentifier()};
1244
+ Blockly.Toolbox.prototype.onClick_=function(a){if(Blockly.utils.isRightButton(a)||a.target==this.HtmlDiv)Blockly.hideChaff(!1);else{var b=a.target.getAttribute("id");b&&(b=this.getToolboxItemById(b))&&b.isSelectable()&&(this.setSelectedItem(b),b.onClick(a));Blockly.hideChaff(!0)}Blockly.Touch.clearTouchIdentifier()};
1245
1245
  Blockly.Toolbox.prototype.onKeyDown_=function(a){var b=!1;switch(a.keyCode){case Blockly.utils.KeyCodes.DOWN:b=this.selectNext_();break;case Blockly.utils.KeyCodes.UP:b=this.selectPrevious_();break;case Blockly.utils.KeyCodes.LEFT:b=this.selectParent_();break;case Blockly.utils.KeyCodes.RIGHT:b=this.selectChild_();break;case Blockly.utils.KeyCodes.ENTER:case Blockly.utils.KeyCodes.SPACE:this.selectedItem_&&this.selectedItem_.isCollapsible()&&(this.selectedItem_.toggleExpanded(),b=!0);break;default:b=
1246
1246
  !1}!b&&this.selectedItem_&&this.selectedItem_.onKeyDown&&(b=this.selectedItem_.onKeyDown(a));b&&a.preventDefault()};
1247
1247
  Blockly.Toolbox.prototype.createFlyout_=function(){var a=this.workspace_,b=new Blockly.Options({parentWorkspace:a,rtl:a.RTL,oneBasedIndex:a.options.oneBasedIndex,horizontalLayout:a.horizontalLayout,renderer:a.options.renderer,rendererOverrides:a.options.rendererOverrides,move:{scrollbars:!0}});b.toolboxPosition=a.options.toolboxPosition;return new (a.horizontalLayout?Blockly.registry.getClassFromOptions(Blockly.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,a.options,!0):Blockly.registry.getClassFromOptions(Blockly.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,
@@ -97,6 +97,7 @@ declare namespace pxt.runner {
97
97
  dependencies?: string[];
98
98
  builtJsInfo?: pxtc.BuiltSimJsInfo;
99
99
  single?: boolean;
100
+ hideSimButtons?: boolean;
100
101
  autofocus?: boolean;
101
102
  }
102
103
  let mainPkg: pxt.MainPackage;
@@ -1750,6 +1750,7 @@ var pxt;
1750
1750
  storedState: storedState,
1751
1751
  light: simOptions.light,
1752
1752
  single: simOptions.single,
1753
+ hideSimButtons: simOptions.hideSimButtons,
1753
1754
  autofocus: simOptions.autofocus
1754
1755
  };
1755
1756
  if (pxt.appTarget.simulator && !simOptions.fullScreen)
package/built/pxtsim.d.ts CHANGED
@@ -1268,6 +1268,7 @@ declare namespace pxsim {
1268
1268
  ipc?: boolean;
1269
1269
  dependencies?: Map<string>;
1270
1270
  single?: boolean;
1271
+ hideSimButtons?: boolean;
1271
1272
  autofocus?: boolean;
1272
1273
  }
1273
1274
  interface HwDebugger {
package/built/pxtsim.js CHANGED
@@ -6305,7 +6305,13 @@ var pxsim;
6305
6305
  frame.setAttribute('allow', 'autoplay;microphone');
6306
6306
  frame.setAttribute('sandbox', 'allow-same-origin allow-scripts');
6307
6307
  frame.className = 'no-select';
6308
- const furl = (url || this.getSimUrl()) + '#' + frame.id;
6308
+ let furl = url || this.getSimUrl().toString();
6309
+ if (this._runOptions.hideSimButtons) {
6310
+ const urlObject = new URL(furl);
6311
+ urlObject.searchParams.append("hideSimButtons", "1");
6312
+ furl = urlObject.toString();
6313
+ }
6314
+ furl += '#' + frame.id;
6309
6315
  frame.src = furl;
6310
6316
  frame.frameBorder = "0";
6311
6317
  frame.dataset['runid'] = this.runId;
@@ -6547,8 +6553,7 @@ var pxsim;
6547
6553
  msg.frameCounter = ++this.frameCounter;
6548
6554
  msg.options = {
6549
6555
  theme: this.themes[this.nextFrameId++ % this.themes.length],
6550
- mpRole: (_b = (_a = /[\&\?]mp=(server|client)/i.exec(window.location.href)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.toLowerCase(),
6551
- hideSimButtons: /hidesimbuttons(?:[:=])1/i.test(window.location.href)
6556
+ mpRole: (_b = (_a = /[\&\?]mp=(server|client)/i.exec(window.location.href)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.toLowerCase()
6552
6557
  };
6553
6558
  msg.id = `${msg.options.theme}-${this.nextId()}`;
6554
6559
  frame.dataset['runid'] = this.runId;