pxt-core 9.3.8 → 9.3.10

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/cli.js CHANGED
@@ -308,7 +308,8 @@ function pxtFileList(pref) {
308
308
  .concat(nodeutil.allFiles(pref + "built/web/skillmap", { maxDepth: 4 }))
309
309
  .concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
310
310
  .concat(nodeutil.allFiles(pref + "built/web/multiplayer", { maxDepth: 4 }))
311
- .concat(nodeutil.allFiles(pref + "built/web/kiosk", { maxDepth: 4 }));
311
+ .concat(nodeutil.allFiles(pref + "built/web/kiosk", { maxDepth: 4 }))
312
+ .concat(nodeutil.allFiles(pref + "built/web/teachertool", { maxDepth: 4 }));
312
313
  }
313
314
  function semverCmp(a, b) {
314
315
  let parse = (s) => {
@@ -392,7 +393,8 @@ function ciAsync() {
392
393
  .then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
393
394
  .then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
394
395
  .then(() => crowdin.execCrowdinAsync("upload", "built/multiplayer-strings.json"))
395
- .then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"));
396
+ .then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"))
397
+ .then(() => crowdin.execCrowdinAsync("upload", "built/teachertool-strings.json"));
396
398
  if (uploadApiStrings)
397
399
  p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"));
398
400
  if (uploadDocs || uploadApiStrings)
@@ -922,6 +924,7 @@ function uploadCoreAsync(opts) {
922
924
  "authcodeUrl": opts.localDir + "authcode.html",
923
925
  "multiplayerUrl": opts.localDir + "multiplayer.html",
924
926
  "kioskUrl": opts.localDir + "kiosk.html",
927
+ "teachertoolUrl": opts.localDir + "teachertool.html",
925
928
  "isStatic": true,
926
929
  };
927
930
  const targetImageLocalPaths = targetImagePaths.map(k => `${opts.localDir}${path.join('./docs', k)}`);
@@ -972,6 +975,7 @@ function uploadCoreAsync(opts) {
972
975
  "authcode.html",
973
976
  "multiplayer.html",
974
977
  "kiosk.html",
978
+ "teachertool.html",
975
979
  ];
976
980
  // expandHtml is manually called on these files before upload
977
981
  // runs <!-- @include --> substitutions, fills in locale, etc
@@ -981,6 +985,7 @@ function uploadCoreAsync(opts) {
981
985
  "authcode.html",
982
986
  "multiplayer.html",
983
987
  "kiosk.html",
988
+ "teachertool.html",
984
989
  ];
985
990
  nodeutil.mkdirP("built/uploadrepl");
986
991
  function encodeURLs(urls) {
@@ -1821,7 +1826,8 @@ async function buildSemanticUIAsync(parsed) {
1821
1826
  await Promise.all([
1822
1827
  generateReactCommonCss("skillmap"),
1823
1828
  generateReactCommonCss("authcode"),
1824
- generateReactCommonCss("multiplayer")
1829
+ generateReactCommonCss("multiplayer"),
1830
+ generateReactCommonCss("teachertool")
1825
1831
  ]);
1826
1832
  // Run postcss with autoprefixer and rtlcss
1827
1833
  pxt.debug("running postcss");
@@ -1847,7 +1853,8 @@ async function buildSemanticUIAsync(parsed) {
1847
1853
  "blockly.css",
1848
1854
  "react-common-skillmap.css",
1849
1855
  "react-common-authcode.css",
1850
- "react-common-multiplayer.css"
1856
+ "react-common-multiplayer.css",
1857
+ "react-common-teachertool.css"
1851
1858
  ];
1852
1859
  for (const cssFile of files) {
1853
1860
  const css = await readFileAsync(`built/web/${cssFile}`, "utf8");
package/built/pxt.js CHANGED
@@ -97781,6 +97781,17 @@ var pxt;
97781
97781
  };
97782
97782
  }
97783
97783
  analytics.enable = enable;
97784
+ function trackPerformanceReport() {
97785
+ if (pxt.perf.perfReportLogged)
97786
+ return;
97787
+ const data = pxt.perf.report();
97788
+ if (data) {
97789
+ const { durations, milestones } = data;
97790
+ pxt.tickEvent("performance.milestones", milestones);
97791
+ pxt.tickEvent("performance.durations", durations);
97792
+ }
97793
+ }
97794
+ analytics.trackPerformanceReport = trackPerformanceReport;
97784
97795
  })(analytics = pxt.analytics || (pxt.analytics = {}));
97785
97796
  })(pxt || (pxt = {}));
97786
97797
  var pxt;
@@ -101171,7 +101182,7 @@ var pxt;
101171
101182
  // Sometimes these aren't initialized, for example in tests. We only care about them
101172
101183
  // doing anything in the browser.
101173
101184
  if (!pxt.perf.report)
101174
- pxt.perf.report = () => { };
101185
+ pxt.perf.report = () => undefined;
101175
101186
  if (!pxt.perf.recordMilestone)
101176
101187
  pxt.perf.recordMilestone = () => { };
101177
101188
  if (!pxt.perf.measureStart)
@@ -101919,26 +101930,26 @@ var pxt;
101919
101930
  },
101920
101931
  'math_number': {
101921
101932
  name: pxt.Util.lf("{id:block}number"),
101922
- url: '/blocks/math/random',
101933
+ url: '/types/number',
101923
101934
  category: 'math',
101924
101935
  tooltip: (pxt.appTarget && pxt.appTarget.compile) ?
101925
101936
  pxt.Util.lf("a decimal number") : pxt.Util.lf("an integer number")
101926
101937
  },
101927
101938
  'math_integer': {
101928
101939
  name: pxt.Util.lf("{id:block}number"),
101929
- url: '/blocks/math/random',
101940
+ url: '/types/number',
101930
101941
  category: 'math',
101931
101942
  tooltip: pxt.Util.lf("an integer number")
101932
101943
  },
101933
101944
  'math_whole_number': {
101934
101945
  name: pxt.Util.lf("{id:block}number"),
101935
- url: '/blocks/math/random',
101946
+ url: '/types/number',
101936
101947
  category: 'math',
101937
101948
  tooltip: pxt.Util.lf("a whole number")
101938
101949
  },
101939
101950
  'math_number_minmax': {
101940
101951
  name: pxt.Util.lf("{id:block}number"),
101941
- url: '/blocks/math/random',
101952
+ url: '/blocks/math',
101942
101953
  category: 'math'
101943
101954
  },
101944
101955
  'math_arithmetic': {
@@ -155401,6 +155412,8 @@ var pxsim;
155401
155412
  let isDeferrableBroadcastMessage = false;
155402
155413
  const broadcastmsg = msg;
155403
155414
  if (source && (broadcastmsg === null || broadcastmsg === void 0 ? void 0 : broadcastmsg.broadcast)) {
155415
+ // include index of the source iframe
155416
+ broadcastmsg.srcFrameIndex = this.simFrames().findIndex((item) => item.contentWindow === source);
155404
155417
  // if the editor is hosted in a multi-editor setting
155405
155418
  // don't start extra frames
155406
155419
  const single = !!((_a = this._currentRuntime) === null || _a === void 0 ? void 0 : _a.single);
@@ -155572,6 +155585,7 @@ var pxsim;
155572
155585
  return wrapper;
155573
155586
  }
155574
155587
  preload(aspectRatio, clearRuntime) {
155588
+ this.addEventListeners();
155575
155589
  if (clearRuntime) {
155576
155590
  this._currentRuntime = undefined;
155577
155591
  this.container.textContent = "";
@@ -160832,7 +160846,8 @@ function pxtFileList(pref) {
160832
160846
  .concat(nodeutil.allFiles(pref + "built/web/skillmap", { maxDepth: 4 }))
160833
160847
  .concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
160834
160848
  .concat(nodeutil.allFiles(pref + "built/web/multiplayer", { maxDepth: 4 }))
160835
- .concat(nodeutil.allFiles(pref + "built/web/kiosk", { maxDepth: 4 }));
160849
+ .concat(nodeutil.allFiles(pref + "built/web/kiosk", { maxDepth: 4 }))
160850
+ .concat(nodeutil.allFiles(pref + "built/web/teachertool", { maxDepth: 4 }));
160836
160851
  }
160837
160852
  function semverCmp(a, b) {
160838
160853
  let parse = (s) => {
@@ -160916,7 +160931,8 @@ function ciAsync() {
160916
160931
  .then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
160917
160932
  .then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
160918
160933
  .then(() => crowdin.execCrowdinAsync("upload", "built/multiplayer-strings.json"))
160919
- .then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"));
160934
+ .then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"))
160935
+ .then(() => crowdin.execCrowdinAsync("upload", "built/teachertool-strings.json"));
160920
160936
  if (uploadApiStrings)
160921
160937
  p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"));
160922
160938
  if (uploadDocs || uploadApiStrings)
@@ -161446,6 +161462,7 @@ function uploadCoreAsync(opts) {
161446
161462
  "authcodeUrl": opts.localDir + "authcode.html",
161447
161463
  "multiplayerUrl": opts.localDir + "multiplayer.html",
161448
161464
  "kioskUrl": opts.localDir + "kiosk.html",
161465
+ "teachertoolUrl": opts.localDir + "teachertool.html",
161449
161466
  "isStatic": true,
161450
161467
  };
161451
161468
  const targetImageLocalPaths = targetImagePaths.map(k => `${opts.localDir}${path.join('./docs', k)}`);
@@ -161496,6 +161513,7 @@ function uploadCoreAsync(opts) {
161496
161513
  "authcode.html",
161497
161514
  "multiplayer.html",
161498
161515
  "kiosk.html",
161516
+ "teachertool.html",
161499
161517
  ];
161500
161518
  // expandHtml is manually called on these files before upload
161501
161519
  // runs <!-- @include --> substitutions, fills in locale, etc
@@ -161505,6 +161523,7 @@ function uploadCoreAsync(opts) {
161505
161523
  "authcode.html",
161506
161524
  "multiplayer.html",
161507
161525
  "kiosk.html",
161526
+ "teachertool.html",
161508
161527
  ];
161509
161528
  nodeutil.mkdirP("built/uploadrepl");
161510
161529
  function encodeURLs(urls) {
@@ -162345,7 +162364,8 @@ async function buildSemanticUIAsync(parsed) {
162345
162364
  await Promise.all([
162346
162365
  generateReactCommonCss("skillmap"),
162347
162366
  generateReactCommonCss("authcode"),
162348
- generateReactCommonCss("multiplayer")
162367
+ generateReactCommonCss("multiplayer"),
162368
+ generateReactCommonCss("teachertool")
162349
162369
  ]);
162350
162370
  // Run postcss with autoprefixer and rtlcss
162351
162371
  pxt.debug("running postcss");
@@ -162371,7 +162391,8 @@ async function buildSemanticUIAsync(parsed) {
162371
162391
  "blockly.css",
162372
162392
  "react-common-skillmap.css",
162373
162393
  "react-common-authcode.css",
162374
- "react-common-multiplayer.css"
162394
+ "react-common-multiplayer.css",
162395
+ "react-common-teachertool.css"
162375
162396
  ];
162376
162397
  for (const cssFile of files) {
162377
162398
  const css = await readFileAsync(`built/web/${cssFile}`, "utf8");
@@ -613,10 +613,10 @@ var pxt;
613
613
  (function (pxt) {
614
614
  var workspace;
615
615
  (function (workspace) {
616
- // 5 minutes
617
- const DIFF_HISTORY_INTERVAL = 1000 * 60 * 5;
618
- // 15 minutes
619
- const SNAPSHOT_HISTORY_INTERVAL = 1000 * 60 * 15;
616
+ // 5 minutes. This is overridden in pxtarget.json
617
+ const DEFAULT_DIFF_HISTORY_INTERVAL = 1000 * 60 * 5;
618
+ // 15 minutes. This is overridden in pxtarget.json
619
+ const DEFAULT_SNAPSHOT_HISTORY_INTERVAL = 1000 * 60 * 15;
620
620
  const ONE_DAY = 1000 * 60 * 60 * 24;
621
621
  function collapseHistory(history, text, options, diff, patch) {
622
622
  var _a, _b;
@@ -863,7 +863,7 @@ var pxt;
863
863
  if (history.entries.length > 1) {
864
864
  const topTime = history.entries[history.entries.length - 1].timestamp;
865
865
  const prevTime = history.entries[history.entries.length - 2].timestamp;
866
- if (currentTime - topTime < DIFF_HISTORY_INTERVAL && topTime - prevTime < DIFF_HISTORY_INTERVAL) {
866
+ if (currentTime - topTime < diffInterval() && topTime - prevTime < diffInterval()) {
867
867
  shouldCombine = true;
868
868
  }
869
869
  }
@@ -887,7 +887,7 @@ var pxt;
887
887
  if (history.snapshots.length == 0) {
888
888
  history.snapshots.push(takeSnapshot(previousText, currentTime - 1));
889
889
  }
890
- else if (currentTime - history.snapshots[history.snapshots.length - 1].timestamp >= SNAPSHOT_HISTORY_INTERVAL) {
890
+ else if (currentTime - history.snapshots[history.snapshots.length - 1].timestamp >= snapshotInterval()) {
891
891
  history.snapshots.push(takeSnapshot(previousText, currentTime));
892
892
  const trimmed = [];
893
893
  let currentDay = Math.floor(currentTime / ONE_DAY) * ONE_DAY;
@@ -965,6 +965,20 @@ var pxt;
965
965
  }
966
966
  return true;
967
967
  }
968
+ function diffInterval() {
969
+ var _a, _b;
970
+ if (((_b = (_a = pxt.appTarget) === null || _a === void 0 ? void 0 : _a.appTheme) === null || _b === void 0 ? void 0 : _b.timeMachineDiffInterval) != undefined) {
971
+ return pxt.appTarget.appTheme.timeMachineDiffInterval;
972
+ }
973
+ return DEFAULT_DIFF_HISTORY_INTERVAL;
974
+ }
975
+ function snapshotInterval() {
976
+ var _a, _b;
977
+ if (((_b = (_a = pxt.appTarget) === null || _a === void 0 ? void 0 : _a.appTheme) === null || _b === void 0 ? void 0 : _b.timeMachineSnapshotInterval) != undefined) {
978
+ return pxt.appTarget.appTheme.timeMachineSnapshotInterval;
979
+ }
980
+ return DEFAULT_SNAPSHOT_HISTORY_INTERVAL;
981
+ }
968
982
  })(workspace = pxt.workspace || (pxt.workspace = {}));
969
983
  })(pxt || (pxt = {}));
970
984
  /// <reference path="../localtypings/monaco.d.ts" />
package/built/pxtlib.d.ts CHANGED
@@ -22,6 +22,7 @@ declare namespace pxt.analytics {
22
22
  let consoleTicks: ConsoleTickOptions;
23
23
  function addDefaultProperties(props: Map<string | number>): void;
24
24
  function enable(lang: string): void;
25
+ function trackPerformanceReport(): void;
25
26
  }
26
27
  declare namespace pxt {
27
28
  let appTarget: TargetBundle;
@@ -484,7 +485,14 @@ declare namespace ts.pxtc.jsonPatch.tests {
484
485
  }
485
486
  declare namespace pxt.perf {
486
487
  let perfReportLogged: boolean;
487
- function report(): void;
488
+ function report(): {
489
+ milestones: {
490
+ [index: string]: number;
491
+ };
492
+ durations: {
493
+ [index: string]: number;
494
+ };
495
+ } | undefined;
488
496
  function recordMilestone(msg: string, time?: number): void;
489
497
  function measureStart(name: string): void;
490
498
  function measureEnd(name: string): void;
@@ -557,6 +565,7 @@ declare namespace pxt {
557
565
  authcodeUrl?: string;
558
566
  multiplayerUrl?: string;
559
567
  kioskUrl?: string;
568
+ teachertoolUrl?: string;
560
569
  isStatic?: boolean;
561
570
  verprefix?: string;
562
571
  }
@@ -3688,6 +3697,17 @@ declare namespace pxt.Cloud {
3688
3697
  thumb?: boolean;
3689
3698
  persistId?: string;
3690
3699
  }
3700
+ interface JsonText {
3701
+ "Readme.md"?: string;
3702
+ "assets.json"?: string;
3703
+ "images.g.jres"?: string;
3704
+ "images.g.ts"?: string;
3705
+ "main.blocks"?: string;
3706
+ "main.ts"?: string;
3707
+ "pxt.json"?: string;
3708
+ "tilemap.g.jres"?: string;
3709
+ "tilemap.g.ts"?: string;
3710
+ }
3691
3711
  }
3692
3712
  declare namespace ts.pxtc {
3693
3713
  function f4EncodeImg(w: number, h: number, bpp: number, getPix: (x: number, y: number) => number): string;
package/built/pxtlib.js CHANGED
@@ -95,6 +95,17 @@ var pxt;
95
95
  };
96
96
  }
97
97
  analytics.enable = enable;
98
+ function trackPerformanceReport() {
99
+ if (pxt.perf.perfReportLogged)
100
+ return;
101
+ const data = pxt.perf.report();
102
+ if (data) {
103
+ const { durations, milestones } = data;
104
+ pxt.tickEvent("performance.milestones", milestones);
105
+ pxt.tickEvent("performance.durations", durations);
106
+ }
107
+ }
108
+ analytics.trackPerformanceReport = trackPerformanceReport;
98
109
  })(analytics = pxt.analytics || (pxt.analytics = {}));
99
110
  })(pxt || (pxt = {}));
100
111
  var pxt;
@@ -3485,7 +3496,7 @@ var pxt;
3485
3496
  // Sometimes these aren't initialized, for example in tests. We only care about them
3486
3497
  // doing anything in the browser.
3487
3498
  if (!pxt.perf.report)
3488
- pxt.perf.report = () => { };
3499
+ pxt.perf.report = () => undefined;
3489
3500
  if (!pxt.perf.recordMilestone)
3490
3501
  pxt.perf.recordMilestone = () => { };
3491
3502
  if (!pxt.perf.measureStart)
@@ -4233,26 +4244,26 @@ var pxt;
4233
4244
  },
4234
4245
  'math_number': {
4235
4246
  name: pxt.Util.lf("{id:block}number"),
4236
- url: '/blocks/math/random',
4247
+ url: '/types/number',
4237
4248
  category: 'math',
4238
4249
  tooltip: (pxt.appTarget && pxt.appTarget.compile) ?
4239
4250
  pxt.Util.lf("a decimal number") : pxt.Util.lf("an integer number")
4240
4251
  },
4241
4252
  'math_integer': {
4242
4253
  name: pxt.Util.lf("{id:block}number"),
4243
- url: '/blocks/math/random',
4254
+ url: '/types/number',
4244
4255
  category: 'math',
4245
4256
  tooltip: pxt.Util.lf("an integer number")
4246
4257
  },
4247
4258
  'math_whole_number': {
4248
4259
  name: pxt.Util.lf("{id:block}number"),
4249
- url: '/blocks/math/random',
4260
+ url: '/types/number',
4250
4261
  category: 'math',
4251
4262
  tooltip: pxt.Util.lf("a whole number")
4252
4263
  },
4253
4264
  'math_number_minmax': {
4254
4265
  name: pxt.Util.lf("{id:block}number"),
4255
- url: '/blocks/math/random',
4266
+ url: '/blocks/math',
4256
4267
  category: 'math'
4257
4268
  },
4258
4269
  'math_arithmetic': {
@@ -1574,6 +1574,7 @@ var pxt;
1574
1574
  }
1575
1575
  function initInnerAsync() {
1576
1576
  pxt.setAppTarget(window.pxtTargetBundle);
1577
+ pxt.analytics.enable(pxt.Util.userLanguage());
1577
1578
  pxt.Util.assert(!!pxt.appTarget);
1578
1579
  const href = window.location.href;
1579
1580
  let force = false;
@@ -1817,7 +1818,13 @@ var pxt;
1817
1818
  runner.postSimMessage = postSimMessage;
1818
1819
  async function fetchSimJsInfo(simOptions) {
1819
1820
  try {
1820
- return await pxt.Cloud.downloadBuiltSimJsInfoAsync(simOptions.id);
1821
+ const start = Date.now();
1822
+ const result = await pxt.Cloud.downloadBuiltSimJsInfoAsync(simOptions.id);
1823
+ pxt.tickEvent("perfMeasurement", {
1824
+ durationMs: Date.now() - start,
1825
+ operation: "fetchSimJsInfo",
1826
+ });
1827
+ return result;
1821
1828
  }
1822
1829
  catch (e) {
1823
1830
  // This exception will happen in the majority of cases, so we don't want to log it unless for debugging.
@@ -1828,6 +1835,7 @@ var pxt;
1828
1835
  runner.fetchSimJsInfo = fetchSimJsInfo;
1829
1836
  async function buildSimJsInfo(simOptions) {
1830
1837
  var _a;
1838
+ const start = Date.now();
1831
1839
  await loadPackageAsync(simOptions.id, simOptions.code, simOptions.dependencies);
1832
1840
  let didUpgrade = false;
1833
1841
  const currentTargetVersion = pxt.appTarget.versions.target;
@@ -1885,6 +1893,10 @@ var pxt;
1885
1893
  }
1886
1894
  const res = pxtc.buildSimJsInfo(compileResult);
1887
1895
  res.parts = compileResult.usedParts;
1896
+ pxt.tickEvent("perfMeasurement", {
1897
+ durationMs: Date.now() - start,
1898
+ operation: "buildSimJsInfo",
1899
+ });
1888
1900
  return res;
1889
1901
  }
1890
1902
  runner.buildSimJsInfo = buildSimJsInfo;
package/built/pxtsim.d.ts CHANGED
@@ -386,6 +386,7 @@ declare namespace pxsim {
386
386
  interface SimulatorBroadcastMessage extends SimulatorMessage {
387
387
  broadcast: boolean;
388
388
  toParentIFrameOnly?: boolean;
389
+ srcFrameIndex?: number;
389
390
  }
390
391
  interface SimulatorControlMessage extends SimulatorBroadcastMessage {
391
392
  type: "messagepacket";
package/built/pxtsim.js CHANGED
@@ -6253,6 +6253,8 @@ var pxsim;
6253
6253
  let isDeferrableBroadcastMessage = false;
6254
6254
  const broadcastmsg = msg;
6255
6255
  if (source && (broadcastmsg === null || broadcastmsg === void 0 ? void 0 : broadcastmsg.broadcast)) {
6256
+ // include index of the source iframe
6257
+ broadcastmsg.srcFrameIndex = this.simFrames().findIndex((item) => item.contentWindow === source);
6256
6258
  // if the editor is hosted in a multi-editor setting
6257
6259
  // don't start extra frames
6258
6260
  const single = !!((_a = this._currentRuntime) === null || _a === void 0 ? void 0 : _a.single);
@@ -6424,6 +6426,7 @@ var pxsim;
6424
6426
  return wrapper;
6425
6427
  }
6426
6428
  preload(aspectRatio, clearRuntime) {
6429
+ this.addEventListeners();
6427
6430
  if (clearRuntime) {
6428
6431
  this._currentRuntime = undefined;
6429
6432
  this.container.textContent = "";
package/built/server.js CHANGED
@@ -24,7 +24,8 @@ let localHexCacheDir = path.join("built", "hexcache");
24
24
  let serveOptions;
25
25
  const webappNames = [
26
26
  "kiosk",
27
- "multiplayer"
27
+ "multiplayer",
28
+ "eval"
28
29
  // TODO: Add other webapp names here: "skillmap", "authcode"
29
30
  ];
30
31
  function setupDocfilesdirs() {