pxt-core 8.4.2 → 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.
Files changed (82) hide show
  1. package/built/backendutils.js +1 -0
  2. package/built/cli.js +83 -75
  3. package/built/pxt.js +1279 -180
  4. package/built/pxtblockly.js +323 -40
  5. package/built/pxtblocks.d.ts +30 -7
  6. package/built/pxtblocks.js +324 -41
  7. package/built/pxtlib.d.ts +91 -5
  8. package/built/pxtlib.js +1173 -98
  9. package/built/pxtrunner.d.ts +1 -0
  10. package/built/pxtrunner.js +2 -1
  11. package/built/pxtsim.d.ts +1 -0
  12. package/built/pxtsim.js +23 -7
  13. package/built/server.js +4 -0
  14. package/built/target.js +1 -1
  15. package/built/web/main.js +1 -1
  16. package/built/web/multiplayer/css/main.1b9969ea.css +4 -0
  17. package/built/web/multiplayer/js/main.9f7f3192.js +2 -0
  18. package/built/web/pxtapp.js +1 -1
  19. package/built/web/pxtasseteditor.js +1 -1
  20. package/built/web/pxtblockly.js +1 -1
  21. package/built/web/pxtblocks.js +1 -1
  22. package/built/web/pxtembed.js +2 -2
  23. package/built/web/pxtlib.js +1 -1
  24. package/built/web/pxtrunner.js +1 -1
  25. package/built/web/pxtsim.js +1 -1
  26. package/built/web/pxtworker.js +2 -2
  27. package/built/web/react-common-authcode.css +4 -6993
  28. package/built/web/react-common-multiplayer.css +13 -0
  29. package/built/web/react-common-skillmap.css +1 -1
  30. package/built/web/rtlreact-common-authcode.css +13 -0
  31. package/built/web/rtlreact-common-multiplayer.css +13 -0
  32. package/built/web/rtlreact-common-skillmap.css +1 -1
  33. package/built/web/rtlsemantic.css +1 -1
  34. package/built/web/semantic.css +1 -1
  35. package/built/web/skillmap/js/main.a6cf40e1.chunk.js +1 -0
  36. package/common-docs/identity/sign-in.md +17 -3
  37. package/common-docs/static/music-editor/apple.png +0 -0
  38. package/common-docs/static/music-editor/burger.png +0 -0
  39. package/common-docs/static/music-editor/cake.png +0 -0
  40. package/common-docs/static/music-editor/car.png +0 -0
  41. package/common-docs/static/music-editor/cat.png +0 -0
  42. package/common-docs/static/music-editor/cherry.png +0 -0
  43. package/common-docs/static/music-editor/clam.png +0 -0
  44. package/common-docs/static/music-editor/computer.png +0 -0
  45. package/common-docs/static/music-editor/crab.png +0 -0
  46. package/common-docs/static/music-editor/dog.png +0 -0
  47. package/common-docs/static/music-editor/duck.png +0 -0
  48. package/common-docs/static/music-editor/egg.png +0 -0
  49. package/common-docs/static/music-editor/explosion.png +0 -0
  50. package/common-docs/static/music-editor/fish.png +0 -0
  51. package/common-docs/static/music-editor/ice-cream.png +0 -0
  52. package/common-docs/static/music-editor/lemon.png +0 -0
  53. package/common-docs/static/music-editor/metronomeWorker.js +35 -0
  54. package/common-docs/static/music-editor/snake.png +0 -0
  55. package/common-docs/static/music-editor/star.png +0 -0
  56. package/common-docs/static/music-editor/strawberry.png +0 -0
  57. package/common-docs/static/music-editor/taco.png +0 -0
  58. package/common-docs/static/music-editor/treble-clef.svg +1 -0
  59. package/package.json +4 -2
  60. package/react-common/components/controls/Input.tsx +7 -3
  61. package/react-common/styles/controls/Button.less +9 -0
  62. package/react-common/styles/react-common-authcode-core.less +1 -1
  63. package/react-common/styles/react-common-authcode.less +1 -1
  64. package/react-common/styles/react-common-multiplayer-core.less +10 -0
  65. package/react-common/styles/react-common-multiplayer.less +12 -0
  66. package/theme/highcontrast.less +6 -0
  67. package/theme/music-editor/EditControls.less +22 -0
  68. package/theme/music-editor/MusicEditor.less +25 -0
  69. package/theme/music-editor/Note.less +16 -0
  70. package/theme/music-editor/NoteGroup.less +7 -0
  71. package/theme/music-editor/PlaybackControls.less +55 -0
  72. package/theme/music-editor/ScrollableWorkspace.less +3 -0
  73. package/theme/music-editor/Staff.less +31 -0
  74. package/theme/music-editor/Track.less +0 -0
  75. package/theme/music-editor/TrackSelector.less +48 -0
  76. package/theme/music-editor/Workspace.less +3 -0
  77. package/theme/pxt.less +1 -0
  78. package/theme/tutorial-sidebar.less +3 -0
  79. package/webapp/public/multiplayer.html +1 -0
  80. package/webapp/public/run.html +13 -2
  81. package/webapp/public/skillmap.html +1 -1
  82. package/built/web/skillmap/js/main.6eec9e0f.chunk.js +0 -1
@@ -710,6 +710,7 @@ var pxt;
710
710
  const url = new URL(`https://${endpointName}.streaming.media.azure.net/${videoID}/manifest(format=mpd-time-csf).mpd`);
711
711
  if (startTime) {
712
712
  url.hash = `t=${startTime}`;
713
+ url.searchParams.append("startTime", startTime);
713
714
  }
714
715
  if (endTime) {
715
716
  url.searchParams.append("endTime", endTime);
package/built/cli.js CHANGED
@@ -306,7 +306,8 @@ function pxtFileList(pref) {
306
306
  .concat(nodeutil.allFiles(pref + "built/web/fonts", { maxDepth: 1 }))
307
307
  .concat(nodeutil.allFiles(pref + "built/web/vs", { maxDepth: 4 }))
308
308
  .concat(nodeutil.allFiles(pref + "built/web/skillmap", { maxDepth: 4 }))
309
- .concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }));
309
+ .concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
310
+ .concat(nodeutil.allFiles(pref + "built/web/multiplayer", { maxDepth: 4 }));
310
311
  }
311
312
  function semverCmp(a, b) {
312
313
  let parse = (s) => {
@@ -387,7 +388,8 @@ function ciAsync() {
387
388
  .then(() => buildWebStringsAsync())
388
389
  .then(() => crowdin.execCrowdinAsync("upload", "built/webstrings.json"))
389
390
  .then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
390
- .then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"));
391
+ .then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
392
+ .then(() => crowdin.execCrowdinAsync("upload", "built/multiplayer-strings.json"));
391
393
  if (uploadApiStrings)
392
394
  p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"));
393
395
  if (uploadDocs || uploadApiStrings)
@@ -906,6 +908,7 @@ function uploadCoreAsync(opts) {
906
908
  "asseteditorUrl": opts.localDir + "asseteditor.html",
907
909
  "skillmapUrl": opts.localDir + "skillmap.html",
908
910
  "authcodeUrl": opts.localDir + "authcode.html",
911
+ "multiplayerUrl": opts.localDir + "multiplayer.html",
909
912
  "isStatic": true,
910
913
  };
911
914
  const targetImagePaths = targetImages.map(k => `${opts.localDir}${path.join('./docs', logos[k])}`);
@@ -952,14 +955,16 @@ function uploadCoreAsync(opts) {
952
955
  "multi.html",
953
956
  "asseteditor.html",
954
957
  "skillmap.html",
955
- "authcode.html"
958
+ "authcode.html",
959
+ "multiplayer.html",
956
960
  ];
957
961
  // expandHtml is manually called on these files before upload
958
962
  // runs <!-- @include --> substitutions, fills in locale, etc
959
963
  let expandFiles = [
960
964
  "index.html",
961
965
  "skillmap.html",
962
- "authcode.html"
966
+ "authcode.html",
967
+ "multiplayer.html",
963
968
  ];
964
969
  nodeutil.mkdirP("built/uploadrepl");
965
970
  function encodeURLs(urls) {
@@ -1753,33 +1758,29 @@ async function buildSemanticUIAsync(parsed) {
1753
1758
  ]
1754
1759
  });
1755
1760
  }
1756
- // Generate react-common css for skillmap and authcode
1757
- const skillmapFile = isPxtCore ? "react-common/styles/react-common-skillmap-core.less" :
1758
- "node_modules/pxt-core/react-common/styles/react-common-skillmap.less";
1759
- await nodeutil.spawnAsync({
1760
- cmd: "node",
1761
- args: [
1762
- lessCPath,
1763
- skillmapFile,
1764
- "built/web/react-common-skillmap.css",
1765
- "--include-path=" + lessIncludePaths
1766
- ]
1767
- });
1768
- const authcodeFile = isPxtCore ? "react-common/styles/react-common-authcode-core.less" :
1769
- "node_modules/pxt-core/react-common/styles/react-common-authcode.less";
1770
- await nodeutil.spawnAsync({
1771
- cmd: "node",
1772
- args: [
1773
- lessCPath,
1774
- authcodeFile,
1775
- "built/web/react-common-authcode.css",
1776
- "--include-path=" + lessIncludePaths
1777
- ]
1778
- });
1779
- let skillmapCss = await readFileAsync(`built/web/react-common-skillmap.css`, "utf8");
1780
- skillmapCss = await linkFontAsync("fa-solid-900", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
1781
- skillmapCss = await linkFontAsync("fa-regular-400", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
1782
- await writeFileAsync(`built/web/react-common-skillmap.css`, skillmapCss, "utf8");
1761
+ async function generateReactCommonCss(app) {
1762
+ const appFile = isPxtCore ? `react-common/styles/react-common-${app}-core.less` :
1763
+ `node_modules/pxt-core/react-common/styles/react-common-${app}.less`;
1764
+ await nodeutil.spawnAsync({
1765
+ cmd: "node",
1766
+ args: [
1767
+ lessCPath,
1768
+ appFile,
1769
+ `built/web/react-common-${app}.css`,
1770
+ "--include-path=" + lessIncludePaths
1771
+ ]
1772
+ });
1773
+ let appCss = await readFileAsync(`built/web/react-common-${app}.css`, "utf8");
1774
+ appCss = await linkFontAsync("fa-solid-900", appCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
1775
+ appCss = await linkFontAsync("fa-regular-400", appCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
1776
+ await writeFileAsync(`built/web/react-common-${app}.css`, appCss, "utf8");
1777
+ }
1778
+ // Generate react-common css for skillmap, authcode, and multiplayer
1779
+ await Promise.all([
1780
+ generateReactCommonCss("skillmap"),
1781
+ generateReactCommonCss("authcode"),
1782
+ generateReactCommonCss("multiplayer")
1783
+ ]);
1783
1784
  // Run postcss with autoprefixer and rtlcss
1784
1785
  pxt.debug("running postcss");
1785
1786
  const postcss = require('postcss');
@@ -1799,7 +1800,7 @@ async function buildSemanticUIAsync(parsed) {
1799
1800
  autoprefixer: { browsers: browserList, add: true }
1800
1801
  });
1801
1802
  const rtlcss = require("rtlcss");
1802
- const files = ["semantic.css", "blockly.css", "react-common-skillmap.css"];
1803
+ const files = ["semantic.css", "blockly.css", "react-common-skillmap.css", "react-common-authcode.css", "react-common-multiplayer.css"];
1803
1804
  for (const cssFile of files) {
1804
1805
  const css = await readFileAsync(`built/web/${cssFile}`, "utf8");
1805
1806
  const processed = await postcss([cssnano])
@@ -1810,9 +1811,13 @@ async function buildSemanticUIAsync(parsed) {
1810
1811
  await writeFileAsync(`built/web/rtl${cssFile}`, processedRtl.css, "utf8");
1811
1812
  }
1812
1813
  if (!isPxtCore) {
1813
- // This is just to support the local skillmap serve for development
1814
+ // This is just to support the local skillmap/cra-app serve for development
1814
1815
  nodeutil.cp("built/web/react-common-skillmap.css", "node_modules/pxt-core/skillmap/public/blb");
1816
+ nodeutil.cp("built/web/react-common-authcode.css", "node_modules/pxt-core/authcode/public/blb");
1817
+ nodeutil.cp("built/web/react-common-multiplayer.css", "node_modules/pxt-core/multiplayer/public/blb");
1815
1818
  nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/skillmap/public/blb");
1819
+ nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/authcode/public/blb");
1820
+ nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/multiplayer/public/blb");
1816
1821
  }
1817
1822
  }
1818
1823
  async function linkFontAsync(font, semCss, sourceDir = "node_modules/semantic-ui-less/themes/default/assets/fonts/", refDir = "fonts\\/") {
@@ -1831,47 +1836,13 @@ function buildWebStringsAsync() {
1831
1836
  nodeutil.writeFileSync("built/webstrings.json", nodeutil.stringify(webstringsJson()));
1832
1837
  return Promise.resolve();
1833
1838
  }
1834
- function buildSkillMapAsync(parsed) {
1839
+ function buildReactAppAsync(app, parsed, opts) {
1840
+ opts = opts || {
1841
+ copyAssets: true
1842
+ };
1835
1843
  // local serve
1836
- const skillmapRoot = "node_modules/pxt-core/skillmap";
1837
- const reactScriptsConfigRoot = `${skillmapRoot}/node_modules/react-scripts/config`;
1844
+ const appRoot = `node_modules/pxt-core/${app}`;
1838
1845
  const docsPath = parsed.flags["docs"];
1839
- return rimrafAsync(`${skillmapRoot}/public/blb`, {})
1840
- .then(() => rimrafAsync(`${skillmapRoot}/build/assets`, {}))
1841
- .then(() => rimrafAsync(`${skillmapRoot}/public/docs`, {}))
1842
- .then(() => rimrafAsync(`${skillmapRoot}/public/static`, {}))
1843
- .then(() => {
1844
- // read pxtarget.json, save into 'pxtTargetBundle' global variable
1845
- let cfg = readLocalPxTarget();
1846
- nodeutil.writeFileSync(`${skillmapRoot}/public/blb/target.js`, "// eslint-disable-next-line \n" + targetJsPrefix + JSON.stringify(cfg));
1847
- nodeutil.cp("node_modules/pxt-core/built/pxtlib.js", `${skillmapRoot}/public/blb`);
1848
- nodeutil.cp("built/web/semantic.css", `${skillmapRoot}/public/blb`);
1849
- nodeutil.cp("node_modules/pxt-core/built/web/icons.css", `${skillmapRoot}/public/blb`);
1850
- nodeutil.cp("node_modules/pxt-core/built/web/react-common-skillmap.css", `${skillmapRoot}/public/blb`);
1851
- // copy 'assets' over from docs/static
1852
- nodeutil.cpR("docs/static/skillmap/assets", `${skillmapRoot}/public/assets`);
1853
- // copy default react-scripts webpack config into a webpack.config.base file if necessary
1854
- if (!fs.existsSync(`${reactScriptsConfigRoot}/webpack.config.base.js`)) {
1855
- nodeutil.cp(`${reactScriptsConfigRoot}/webpack.config.js`, reactScriptsConfigRoot, "webpack.config.base.js");
1856
- }
1857
- // wrap the config in our webpack.config.override for build customization
1858
- nodeutil.cp(`${skillmapRoot}/webpack.config.override.js`, reactScriptsConfigRoot, "webpack.config.js");
1859
- if (docsPath) {
1860
- // copy docs over from specified path
1861
- nodeutil.cpR(`docs/${docsPath}`, `${skillmapRoot}/public/docs/${docsPath}`);
1862
- nodeutil.cpR(`docs/static/${docsPath}`, `${skillmapRoot}/public/static/${docsPath}`);
1863
- }
1864
- return nodeutil.spawnAsync({
1865
- cmd: os.platform() === "win32" ? "npm.cmd" : "npm",
1866
- args: ["run-script", "start"],
1867
- cwd: skillmapRoot,
1868
- shell: true
1869
- });
1870
- });
1871
- }
1872
- function buildAuthcodeAsync(parsed) {
1873
- // local serve
1874
- const appRoot = "node_modules/pxt-core/authcode";
1875
1846
  return rimrafAsync(`${appRoot}/public/blb`, {})
1876
1847
  .then(() => rimrafAsync(`${appRoot}/build/assets`, {}))
1877
1848
  .then(() => rimrafAsync(`${appRoot}/public/docs`, {}))
@@ -1883,9 +1854,16 @@ function buildAuthcodeAsync(parsed) {
1883
1854
  nodeutil.cp("node_modules/pxt-core/built/pxtlib.js", `${appRoot}/public/blb`);
1884
1855
  nodeutil.cp("built/web/semantic.css", `${appRoot}/public/blb`);
1885
1856
  nodeutil.cp("node_modules/pxt-core/built/web/icons.css", `${appRoot}/public/blb`);
1886
- nodeutil.cp("node_modules/pxt-core/built/web/react-common-authcode.css", `${appRoot}/public/blb`);
1887
- // copy 'assets' over from docs/static
1888
- nodeutil.cpR("docs/static/authcode/assets", `${appRoot}/public/assets`);
1857
+ nodeutil.cp(`node_modules/pxt-core/built/web/react-common-${app}.css`, `${appRoot}/public/blb`);
1858
+ if (opts.copyAssets) {
1859
+ // copy 'assets' over from docs/static
1860
+ nodeutil.cpR(`docs/static/${app}/assets`, `${appRoot}/public/assets`);
1861
+ }
1862
+ if (docsPath) {
1863
+ // copy docs over from specified path
1864
+ nodeutil.cpR(`docs/${docsPath}`, `${appRoot}/public/docs/${docsPath}`);
1865
+ nodeutil.cpR(`docs/static/${docsPath}`, `${appRoot}/public/static/${docsPath}`);
1866
+ }
1889
1867
  return nodeutil.spawnAsync({
1890
1868
  cmd: os.platform() === "win32" ? "npm.cmd" : "npm",
1891
1869
  args: ["run-script", "start"],
@@ -1894,6 +1872,15 @@ function buildAuthcodeAsync(parsed) {
1894
1872
  });
1895
1873
  });
1896
1874
  }
1875
+ function buildSkillMapAsync(parsed) {
1876
+ return buildReactAppAsync("skillmap", parsed);
1877
+ }
1878
+ function buildAuthcodeAsync(parsed) {
1879
+ return buildReactAppAsync("authcode", parsed, { copyAssets: false });
1880
+ }
1881
+ function buildMultiplayerAsync(parsed) {
1882
+ return buildReactAppAsync("multiplayer", parsed, { copyAssets: false });
1883
+ }
1897
1884
  function updateDefaultProjects(cfg) {
1898
1885
  let defaultProjects = [
1899
1886
  pxt.BLOCKS_PROJECT_NAME,
@@ -6285,9 +6272,30 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
6285
6272
  flags: {
6286
6273
  serve: {
6287
6274
  description: "Serve the authcode app locally after building (npm start)"
6275
+ },
6276
+ docs: {
6277
+ description: "Path to local docs folder to copy into authcode",
6278
+ type: "string",
6279
+ argument: "docs"
6288
6280
  }
6289
6281
  }
6290
6282
  }, buildAuthcodeAsync);
6283
+ p.defineCommand({
6284
+ name: "buildmultiplayer",
6285
+ aliases: ["multiplayer", "mp"],
6286
+ advanced: true,
6287
+ help: "Serves the multiplayer webapp",
6288
+ flags: {
6289
+ serve: {
6290
+ description: "Serve the multiplayer app locally after building (npm start)"
6291
+ },
6292
+ docs: {
6293
+ description: "Path to local docs folder to copy into multiplayer",
6294
+ type: "string",
6295
+ argument: "docs"
6296
+ }
6297
+ }
6298
+ }, buildMultiplayerAsync);
6291
6299
  advancedCommand("augmentdocs", "test markdown docs replacements", augmnetDocsAsync, "<temlate.md> <doc.md>");
6292
6300
  advancedCommand("crowdin", "upload, download, clean, stats files to/from crowdin", pc => crowdin.execCrowdinAsync.apply(undefined, pc.args), "<cmd> <path> [output]");
6293
6301
  advancedCommand("hidlist", "list HID devices", hid.listAsync);