pxt-core 8.4.3 → 8.4.4

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
@@ -154567,8 +154567,8 @@ var pxsim;
154567
154567
  if (parentWindow) {
154568
154568
  // if message comes from parent already, don't echo
154569
154569
  if (source !== parentWindow) {
154570
- const parentOrigin = this.options.parentOrigin || window.location.origin;
154571
- parentWindow.postMessage(msg, parentOrigin);
154570
+ // posting sim messages to parent frame; no origin restriction.
154571
+ parentWindow.postMessage(msg, "*");
154572
154572
  }
154573
154573
  }
154574
154574
  if (!this.options.nestedEditorSim && !(broadcastmsg === null || broadcastmsg === void 0 ? void 0 : broadcastmsg.toParentIFrameOnly)) {
@@ -154659,7 +154659,7 @@ var pxsim;
154659
154659
  }
154660
154660
  }
154661
154661
  createFrame(url) {
154662
- var _a, _b;
154662
+ var _a, _b, _c;
154663
154663
  const wrapper = document.createElement("div");
154664
154664
  wrapper.className = `simframe ui embed`;
154665
154665
  const frame = document.createElement('iframe');
@@ -154675,12 +154675,23 @@ var pxsim;
154675
154675
  urlObject.searchParams.append("hideSimButtons", "1");
154676
154676
  furl = urlObject.toString();
154677
154677
  }
154678
+ if ((_b = this._runOptions) === null || _b === void 0 ? void 0 : _b.queryParameters) {
154679
+ const urlObject = new URL(furl);
154680
+ const parameters = this._runOptions.queryParameters.split("&");
154681
+ for (const param of parameters) {
154682
+ const [a, b] = param.split(/[:=]/);
154683
+ if (a && b) {
154684
+ urlObject.searchParams.set(a, b);
154685
+ }
154686
+ }
154687
+ furl = urlObject.toString();
154688
+ }
154678
154689
  furl += '#' + frame.id;
154679
154690
  frame.src = furl;
154680
154691
  frame.frameBorder = "0";
154681
154692
  frame.dataset['runid'] = this.runId;
154682
154693
  frame.dataset['origin'] = new URL(furl).origin || "*";
154683
- if ((_b = this._runOptions) === null || _b === void 0 ? void 0 : _b.autofocus)
154694
+ if ((_c = this._runOptions) === null || _c === void 0 ? void 0 : _c.autofocus)
154684
154695
  frame.setAttribute("autofocus", "true");
154685
154696
  wrapper.appendChild(frame);
154686
154697
  const i = document.createElement("i");
@@ -99,6 +99,7 @@ declare namespace pxt.runner {
99
99
  single?: boolean;
100
100
  hideSimButtons?: boolean;
101
101
  autofocus?: boolean;
102
+ additionalQueryParameters?: string;
102
103
  }
103
104
  let mainPkg: pxt.MainPackage;
104
105
  function initFooter(footer: HTMLElement, shareId?: string): void;
@@ -1764,7 +1764,8 @@ var pxt;
1764
1764
  light: simOptions.light,
1765
1765
  single: simOptions.single,
1766
1766
  hideSimButtons: simOptions.hideSimButtons,
1767
- autofocus: simOptions.autofocus
1767
+ autofocus: simOptions.autofocus,
1768
+ queryParameters: simOptions.additionalQueryParameters,
1768
1769
  };
1769
1770
  if (pxt.appTarget.simulator && !simOptions.fullScreen)
1770
1771
  runOptions.aspectRatio = parts.length && pxt.appTarget.simulator.partsAspectRatio
package/built/pxtsim.d.ts CHANGED
@@ -1279,6 +1279,7 @@ declare namespace pxsim {
1279
1279
  single?: boolean;
1280
1280
  hideSimButtons?: boolean;
1281
1281
  autofocus?: boolean;
1282
+ queryParameters?: string;
1282
1283
  }
1283
1284
  interface HwDebugger {
1284
1285
  postMessage: (msg: pxsim.SimulatorMessage) => void;
package/built/pxtsim.js CHANGED
@@ -6223,8 +6223,8 @@ var pxsim;
6223
6223
  if (parentWindow) {
6224
6224
  // if message comes from parent already, don't echo
6225
6225
  if (source !== parentWindow) {
6226
- const parentOrigin = this.options.parentOrigin || window.location.origin;
6227
- parentWindow.postMessage(msg, parentOrigin);
6226
+ // posting sim messages to parent frame; no origin restriction.
6227
+ parentWindow.postMessage(msg, "*");
6228
6228
  }
6229
6229
  }
6230
6230
  if (!this.options.nestedEditorSim && !(broadcastmsg === null || broadcastmsg === void 0 ? void 0 : broadcastmsg.toParentIFrameOnly)) {
@@ -6315,7 +6315,7 @@ var pxsim;
6315
6315
  }
6316
6316
  }
6317
6317
  createFrame(url) {
6318
- var _a, _b;
6318
+ var _a, _b, _c;
6319
6319
  const wrapper = document.createElement("div");
6320
6320
  wrapper.className = `simframe ui embed`;
6321
6321
  const frame = document.createElement('iframe');
@@ -6331,12 +6331,23 @@ var pxsim;
6331
6331
  urlObject.searchParams.append("hideSimButtons", "1");
6332
6332
  furl = urlObject.toString();
6333
6333
  }
6334
+ if ((_b = this._runOptions) === null || _b === void 0 ? void 0 : _b.queryParameters) {
6335
+ const urlObject = new URL(furl);
6336
+ const parameters = this._runOptions.queryParameters.split("&");
6337
+ for (const param of parameters) {
6338
+ const [a, b] = param.split(/[:=]/);
6339
+ if (a && b) {
6340
+ urlObject.searchParams.set(a, b);
6341
+ }
6342
+ }
6343
+ furl = urlObject.toString();
6344
+ }
6334
6345
  furl += '#' + frame.id;
6335
6346
  frame.src = furl;
6336
6347
  frame.frameBorder = "0";
6337
6348
  frame.dataset['runid'] = this.runId;
6338
6349
  frame.dataset['origin'] = new URL(furl).origin || "*";
6339
- if ((_b = this._runOptions) === null || _b === void 0 ? void 0 : _b.autofocus)
6350
+ if ((_c = this._runOptions) === null || _c === void 0 ? void 0 : _c.autofocus)
6340
6351
  frame.setAttribute("autofocus", "true");
6341
6352
  wrapper.appendChild(frame);
6342
6353
  const i = document.createElement("i");