pxt-core 8.2.7 → 8.2.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.
Files changed (39) hide show
  1. package/built/pxt-common.json +1 -1
  2. package/built/pxt.js +32 -16
  3. package/built/pxtblockly.js +20 -8
  4. package/built/pxtblocks.js +20 -8
  5. package/built/pxtcompiler.js +3 -3
  6. package/built/pxtlib.js +23 -4
  7. package/built/pxtrunner.js +13 -0
  8. package/built/pxtsim.js +6 -9
  9. package/built/target.js +1 -1
  10. package/built/web/main.js +1 -1
  11. package/built/web/pxtapp.js +1 -1
  12. package/built/web/pxtblockly.js +1 -1
  13. package/built/web/pxtblocks.js +1 -1
  14. package/built/web/pxtcompiler.js +1 -1
  15. package/built/web/pxtembed.js +2 -2
  16. package/built/web/pxtlib.js +1 -1
  17. package/built/web/pxtrunner.js +1 -1
  18. package/built/web/pxtsim.js +1 -1
  19. package/built/web/pxtworker.js +1 -1
  20. package/built/web/react-common-authcode.css +83 -13
  21. package/built/web/react-common-skillmap.css +1 -1
  22. package/built/web/rtlreact-common-skillmap.css +1 -1
  23. package/built/web/rtlsemantic.css +1 -1
  24. package/built/web/semantic.css +1 -1
  25. package/built/web/skillmap/js/main.d94a2bd9.chunk.js +1 -0
  26. package/localtypings/pxtarget.d.ts +16 -0
  27. package/package.json +1 -1
  28. package/react-common/components/profile/SignInModal.tsx +2 -2
  29. package/react-common/components/share/Share.tsx +8 -21
  30. package/react-common/components/share/ShareInfo.tsx +136 -132
  31. package/react-common/components/share/SocialButton.tsx +36 -6
  32. package/react-common/components/share/ThumbnailRecorder.tsx +137 -0
  33. package/react-common/styles/controls/Button.less +30 -3
  34. package/react-common/styles/controls/Modal.less +6 -1
  35. package/react-common/styles/share/share.less +63 -7
  36. package/webapp/public/skillmap.html +1 -1
  37. package/built/web/skillmap/js/main.b87a119c.chunk.js +0 -1
  38. package/react-common/components/share/GifInfo.tsx +0 -63
  39. package/react-common/components/share/GifRecorder.tsx +0 -97
package/built/pxtlib.js CHANGED
@@ -19318,6 +19318,7 @@ var pxt;
19318
19318
  diffify(steps, activities);
19319
19319
  }
19320
19320
  const assetFiles = parseAssetJson(assetJson);
19321
+ const globalBlockConfig = parseTutorialBlockConfig("global", tutorialmd);
19321
19322
  // strip hidden snippets
19322
19323
  steps.forEach(step => {
19323
19324
  step.contentMd = stripHiddenSnippets(step.contentMd);
@@ -19337,7 +19338,8 @@ var pxt;
19337
19338
  jres,
19338
19339
  assetFiles,
19339
19340
  customTs,
19340
- tutorialValidationRules
19341
+ tutorialValidationRules,
19342
+ globalBlockConfig
19341
19343
  };
19342
19344
  }
19343
19345
  tutorial.parseTutorial = parseTutorial;
@@ -19364,6 +19366,8 @@ var pxt;
19364
19366
  switch (m1) {
19365
19367
  case "block":
19366
19368
  case "blocks":
19369
+ case "blockconfig.local":
19370
+ case "blockconfig.global":
19367
19371
  case "requiredTutorialBlock":
19368
19372
  case "filterblocks":
19369
19373
  if (!checkTutorialEditor(pxt.BLOCKS_PROJECT_NAME))
@@ -19516,6 +19520,7 @@ ${code}
19516
19520
  markdown.replace(stepRegex, function (match, flags, step) {
19517
19521
  step = step.trim();
19518
19522
  let { header, hint, requiredBlocks } = parseTutorialHint(step, metadata && metadata.explicitHints, metadata.tutorialCodeValidation);
19523
+ const blockConfig = parseTutorialBlockConfig("local", step);
19519
19524
  // if title is not hidden ("{TITLE HERE}"), strip flags
19520
19525
  const title = !flags.match(/^\{.*\}$/)
19521
19526
  ? flags.replace(/@(fullscreen|unplugged|showdialog|showhint|tutorialCompleted|resetDiff)/gi, "").trim()
@@ -19523,7 +19528,8 @@ ${code}
19523
19528
  let info = {
19524
19529
  title,
19525
19530
  contentMd: step,
19526
- headerContentMd: header
19531
+ headerContentMd: header,
19532
+ localBlockConfig: blockConfig
19527
19533
  };
19528
19534
  if (/@(fullscreen|unplugged|showdialog|showhint)/i.test(flags))
19529
19535
  info.showHint = true;
@@ -19578,6 +19584,18 @@ ${code}
19578
19584
  }
19579
19585
  return { header, hint, requiredBlocks };
19580
19586
  }
19587
+ function parseTutorialBlockConfig(scope, content) {
19588
+ let blockConfig = {
19589
+ md: "",
19590
+ blocks: [],
19591
+ };
19592
+ const regex = new RegExp(`\`\`\`\\s*blockconfig\\.${scope}\\s*\\n([\\s\\S]*?)\\n\`\`\``, "gmi");
19593
+ content.replace(regex, (m0, m1) => {
19594
+ blockConfig.md += `${m1}\n`;
19595
+ return "";
19596
+ });
19597
+ return blockConfig;
19598
+ }
19581
19599
  function categorizingValidationRules(listOfRules, title) {
19582
19600
  const ruleNames = Object.keys(listOfRules);
19583
19601
  for (let i = 0; i < ruleNames.length; i++) {
@@ -19593,7 +19611,7 @@ ${code}
19593
19611
  function stripHiddenSnippets(str) {
19594
19612
  if (!str)
19595
19613
  return str;
19596
- const hiddenSnippetRegex = /```(filterblocks|package|ghost|config|template|jres|assetjson|customts)\s*\n([\s\S]*?)\n```/gmi;
19614
+ const hiddenSnippetRegex = /```(filterblocks|package|ghost|config|template|jres|assetjson|customts|blockconfig\.local|blockconfig\.global)\s*\n([\s\S]*?)\n```/gmi;
19597
19615
  return str.replace(hiddenSnippetRegex, '').trim();
19598
19616
  }
19599
19617
  /*
@@ -19675,7 +19693,8 @@ ${code}
19675
19693
  jres: tutorialInfo.jres,
19676
19694
  assetFiles: tutorialInfo.assetFiles,
19677
19695
  customTs: tutorialInfo.customTs,
19678
- tutorialValidationRules: tutorialInfo.tutorialValidationRules
19696
+ tutorialValidationRules: tutorialInfo.tutorialValidationRules,
19697
+ globalBlockConfig: tutorialInfo.globalBlockConfig
19679
19698
  };
19680
19699
  return { options: tutorialOptions, editor: tutorialInfo.editor };
19681
19700
  }
@@ -1319,6 +1319,18 @@ var pxt;
1319
1319
  c = c.parent();
1320
1320
  c.remove();
1321
1321
  }
1322
+ function renderBlockConfig(options) {
1323
+ function render(scope) {
1324
+ $(`code.lang-blockconfig.${scope}`).each((i, c) => {
1325
+ let $c = $(c);
1326
+ if (options.snippetReplaceParent)
1327
+ $c = $c.parent();
1328
+ $c.remove();
1329
+ });
1330
+ }
1331
+ render("local");
1332
+ render("global");
1333
+ }
1322
1334
  function renderSims(options) {
1323
1335
  if (!options.simulatorClass)
1324
1336
  return;
@@ -1359,6 +1371,7 @@ var pxt;
1359
1371
  readAssetJson(options);
1360
1372
  renderQueue = [];
1361
1373
  renderGhost(options);
1374
+ renderBlockConfig(options);
1362
1375
  renderSims(options);
1363
1376
  renderTypeScript(options);
1364
1377
  renderDirectPython(options);
package/built/pxtsim.js CHANGED
@@ -5695,19 +5695,16 @@ var pxsim;
5695
5695
  if (Runtime.messagePosted)
5696
5696
  Runtime.messagePosted(data);
5697
5697
  }
5698
- static postScreenshotAsync(opts) {
5698
+ static async postScreenshotAsync(opts) {
5699
5699
  const b = pxsim.runtime && pxsim.runtime.board;
5700
- const p = b
5701
- ? b.screenshotAsync().catch(e => {
5702
- console.debug(`screenshot failed`);
5703
- return undefined;
5704
- })
5705
- : Promise.resolve(undefined);
5706
- return p.then(img => Runtime.postMessage({
5700
+ if (!b)
5701
+ return undefined;
5702
+ const img = await b.screenshotAsync();
5703
+ Runtime.postMessage({
5707
5704
  type: "screenshot",
5708
5705
  data: img,
5709
5706
  delay: opts && opts.delay
5710
- }));
5707
+ });
5711
5708
  }
5712
5709
  static requestToggleRecording() {
5713
5710
  const r = pxsim.runtime;