pxt-core 7.5.2 → 7.5.5

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 (67) hide show
  1. package/built/cli.js +61 -46
  2. package/built/pxt.js +256 -91
  3. package/built/pxtblockly.js +652 -657
  4. package/built/pxtblocks.d.ts +1 -0
  5. package/built/pxtblocks.js +98 -42
  6. package/built/pxtcompiler.js +45 -4
  7. package/built/pxtlib.d.ts +7 -2
  8. package/built/pxtlib.js +77 -39
  9. package/built/pxtpy.js +73 -2
  10. package/built/server.js +4 -0
  11. package/built/target.js +1 -1
  12. package/built/web/authcode/css/main.1cf9dc37.css +2 -0
  13. package/built/web/authcode/js/main.03da4c20.js +2 -0
  14. package/built/web/main.js +1 -1
  15. package/built/web/pxtapp.js +1 -1
  16. package/built/web/pxtasseteditor.js +1 -1
  17. package/built/web/pxtblockly.js +2 -2
  18. package/built/web/pxtblocks.js +1 -1
  19. package/built/web/pxtcompiler.js +1 -1
  20. package/built/web/pxtembed.js +2 -2
  21. package/built/web/pxtlib.js +1 -1
  22. package/built/web/pxtpy.js +1 -1
  23. package/built/web/pxtworker.js +1 -1
  24. package/built/web/react-common-authcode.css +6200 -0
  25. package/built/web/react-common-skillmap.css +1 -1
  26. package/built/web/rtlreact-common-skillmap.css +1 -1
  27. package/built/web/rtlsemantic.css +1 -1
  28. package/built/web/semantic.css +1 -1
  29. package/built/web/skillmap/css/{main.e0620cee.chunk.css → main.73b22966.chunk.css} +1 -1
  30. package/built/web/skillmap/js/{2.f7cdfd75.chunk.js → 2.3e47a285.chunk.js} +2 -2
  31. package/built/web/skillmap/js/main.2485091f.chunk.js +1 -0
  32. package/common-docs/faq.md +1 -1
  33. package/common-docs/translate.md +2 -2
  34. package/docfiles/apptracking.html +1 -1
  35. package/docfiles/tracking.html +1 -1
  36. package/localtypings/projectheader.d.ts +6 -0
  37. package/package.json +5 -3
  38. package/pxtarget.json +1 -1
  39. package/react-common/components/controls/Button.tsx +4 -1
  40. package/react-common/components/controls/EditorToggle.tsx +153 -0
  41. package/react-common/components/controls/FocusList.tsx +120 -0
  42. package/react-common/components/controls/Input.tsx +4 -4
  43. package/react-common/components/controls/Link.tsx +36 -0
  44. package/react-common/components/controls/MenuBar.tsx +5 -95
  45. package/react-common/components/controls/MenuDropdown.tsx +4 -1
  46. package/react-common/components/controls/Textarea.tsx +103 -0
  47. package/react-common/components/share/GifInfo.tsx +63 -0
  48. package/react-common/components/share/GifRecorder.tsx +97 -0
  49. package/react-common/components/share/Share.tsx +49 -0
  50. package/react-common/components/share/ShareInfo.tsx +186 -0
  51. package/react-common/components/share/SocialButton.tsx +53 -0
  52. package/react-common/styles/controls/Button.less +4 -0
  53. package/react-common/styles/controls/EditorToggle.less +271 -0
  54. package/react-common/styles/controls/Modal.less +7 -5
  55. package/react-common/styles/controls/Textarea.less +81 -0
  56. package/react-common/styles/react-common-authcode-core.less +10 -0
  57. package/react-common/styles/react-common-authcode.less +12 -0
  58. package/react-common/styles/react-common-variables.less +19 -0
  59. package/react-common/styles/react-common.less +3 -0
  60. package/react-common/styles/share/share.less +116 -0
  61. package/theme/image-editor/imageEditor.less +8 -116
  62. package/webapp/public/authcode.html +1 -0
  63. package/webapp/public/blockly/blockly_compressed.js +554 -615
  64. package/webapp/public/index.html +1 -1
  65. package/webapp/public/run.html +32 -5
  66. package/webapp/public/skillmap.html +2 -2
  67. package/built/web/skillmap/js/main.f6866fc6.chunk.js +0 -1
package/built/cli.js CHANGED
@@ -186,6 +186,9 @@ class FileGithubDb {
186
186
  return p;
187
187
  });
188
188
  }
189
+ latestVersionAsync(repopath, config) {
190
+ return this.db.latestVersionAsync(repopath, config);
191
+ }
189
192
  loadConfigAsync(repopath, tag) {
190
193
  return this.loadAsync(repopath, tag, "pxt", (r, t) => this.db.loadConfigAsync(r, t));
191
194
  }
@@ -202,46 +205,6 @@ function searchAsync(...query) {
202
205
  }
203
206
  });
204
207
  }
205
- function pkginfoAsync(repopath) {
206
- let parsed = pxt.github.parseRepoId(repopath);
207
- if (!parsed) {
208
- console.log('Unknown repo');
209
- return Promise.resolve();
210
- }
211
- const pkgInfo = (cfg, tag) => {
212
- pxt.log(`name: ${cfg.name}`);
213
- pxt.log(`description: ${cfg.description}`);
214
- if (pxt.appTarget.appTheme)
215
- pxt.log(`shareable url: ${pxt.appTarget.appTheme.embedUrl}#pub:gh/${parsed.fullName}${tag ? "#" + tag : ""}`);
216
- };
217
- return pxt.packagesConfigAsync()
218
- .then(config => {
219
- const status = pxt.github.repoStatus(parsed, config);
220
- pxt.log(`github org: ${parsed.owner}`);
221
- if (parsed.tag)
222
- pxt.log(`github tag: ${parsed.tag}`);
223
- pxt.log(`package status: ${status == pxt.github.GitRepoStatus.Approved ? "approved" : status == pxt.github.GitRepoStatus.Banned ? "banned" : "neutral"}`);
224
- if (parsed.tag)
225
- return pxt.github.downloadPackageAsync(repopath, config)
226
- .then(pkg => {
227
- let cfg = JSON.parse(pkg.files[pxt.CONFIG_NAME]);
228
- pkgInfo(cfg, parsed.tag);
229
- pxt.debug(`size: ${JSON.stringify(pkg.files).length}`);
230
- });
231
- return pxt.github.pkgConfigAsync(parsed.fullName)
232
- .then(cfg => {
233
- pkgInfo(cfg);
234
- return pxt.github.listRefsAsync(repopath)
235
- .then(tags => {
236
- pxt.log("tags: " + tags.join(", "));
237
- return pxt.github.listRefsAsync(repopath, "heads");
238
- })
239
- .then(heads => {
240
- pxt.log("branches: " + heads.join(", "));
241
- });
242
- });
243
- });
244
- }
245
208
  function pokeRepoAsync(parsed) {
246
209
  const repo = parsed.args[0];
247
210
  let data = {
@@ -342,7 +305,8 @@ function pxtFileList(pref) {
342
305
  .concat(onlyExts(nodeutil.allFiles(pref + "built/web", 1), [".js", ".css"]))
343
306
  .concat(nodeutil.allFiles(pref + "built/web/fonts", 1))
344
307
  .concat(nodeutil.allFiles(pref + "built/web/vs", 4))
345
- .concat(nodeutil.allFiles(pref + "built/web/skillmap", 4));
308
+ .concat(nodeutil.allFiles(pref + "built/web/skillmap", 4))
309
+ .concat(nodeutil.allFiles(pref + "built/web/authcode", 4));
346
310
  }
347
311
  function semverCmp(a, b) {
348
312
  let parse = (s) => {
@@ -422,7 +386,8 @@ function ciAsync() {
422
386
  p = p
423
387
  .then(() => buildWebStringsAsync())
424
388
  .then(() => crowdin.execCrowdinAsync("upload", "built/webstrings.json"))
425
- .then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"));
389
+ .then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
390
+ .then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"));
426
391
  if (uploadApiStrings)
427
392
  p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"));
428
393
  if (uploadDocs || uploadApiStrings)
@@ -940,6 +905,7 @@ function uploadCoreAsync(opts) {
940
905
  "multiUrl": opts.localDir + "multi.html",
941
906
  "asseteditorUrl": opts.localDir + "asseteditor.html",
942
907
  "skillmapUrl": opts.localDir + "skillmap.html",
908
+ "authcodeUrl": opts.localDir + "authcode.html",
943
909
  "isStatic": true,
944
910
  };
945
911
  const targetImagePaths = targetImages.map(k => `${opts.localDir}${path.join('./docs', logos[k])}`);
@@ -985,13 +951,15 @@ function uploadCoreAsync(opts) {
985
951
  "workerConfig.js",
986
952
  "multi.html",
987
953
  "asseteditor.html",
988
- "skillmap.html"
954
+ "skillmap.html",
955
+ "authcode.html"
989
956
  ];
990
957
  // expandHtml is manually called on these files before upload
991
958
  // runs <!-- @include --> substitutions, fills in locale, etc
992
959
  let expandFiles = [
993
960
  "index.html",
994
- "skillmap.html"
961
+ "skillmap.html",
962
+ "authcode.html"
995
963
  ];
996
964
  nodeutil.mkdirP("built/uploadrepl");
997
965
  function encodeURLs(urls) {
@@ -1785,7 +1753,7 @@ async function buildSemanticUIAsync(parsed) {
1785
1753
  ]
1786
1754
  });
1787
1755
  }
1788
- // Generate react-common css for skillmap
1756
+ // Generate react-common css for skillmap and authcode
1789
1757
  const skillmapFile = isPxtCore ? "react-common/styles/react-common-skillmap-core.less" :
1790
1758
  "node_modules/pxt-core/react-common/styles/react-common-skillmap.less";
1791
1759
  await nodeutil.spawnAsync({
@@ -1797,6 +1765,17 @@ async function buildSemanticUIAsync(parsed) {
1797
1765
  "--include-path=" + lessIncludePaths
1798
1766
  ]
1799
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
+ });
1800
1779
  let skillmapCss = await readFileAsync(`built/web/react-common-skillmap.css`, "utf8");
1801
1780
  skillmapCss = await linkFontAsync("fa-solid-900", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
1802
1781
  skillmapCss = await linkFontAsync("fa-regular-400", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
@@ -1890,6 +1869,31 @@ function buildSkillMapAsync(parsed) {
1890
1869
  });
1891
1870
  });
1892
1871
  }
1872
+ function buildAuthcodeAsync(parsed) {
1873
+ // local serve
1874
+ const appRoot = "node_modules/pxt-core/authcode";
1875
+ return rimrafAsync(`${appRoot}/public/blb`, {})
1876
+ .then(() => rimrafAsync(`${appRoot}/build/assets`, {}))
1877
+ .then(() => rimrafAsync(`${appRoot}/public/docs`, {}))
1878
+ .then(() => rimrafAsync(`${appRoot}/public/static`, {}))
1879
+ .then(() => {
1880
+ // read pxtarget.json, save into 'pxtTargetBundle' global variable
1881
+ let cfg = readLocalPxTarget();
1882
+ nodeutil.writeFileSync(`${appRoot}/public/blb/target.js`, "// eslint-disable-next-line \n" + targetJsPrefix + JSON.stringify(cfg));
1883
+ nodeutil.cp("node_modules/pxt-core/built/pxtlib.js", `${appRoot}/public/blb`);
1884
+ nodeutil.cp("built/web/semantic.css", `${appRoot}/public/blb`);
1885
+ 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`);
1889
+ return nodeutil.spawnAsync({
1890
+ cmd: os.platform() === "win32" ? "npm.cmd" : "npm",
1891
+ args: ["run-script", "start"],
1892
+ cwd: appRoot,
1893
+ shell: true
1894
+ });
1895
+ });
1896
+ }
1893
1897
  function updateDefaultProjects(cfg) {
1894
1898
  let defaultProjects = [
1895
1899
  pxt.BLOCKS_PROJECT_NAME,
@@ -2792,7 +2796,7 @@ function installPackageNameAsync(packageName) {
2792
2796
  return pxt.packagesConfigAsync()
2793
2797
  .then(config => (parsed.tag ? Promise.resolve(parsed.tag) : pxt.github.latestVersionAsync(parsed.slug, config))
2794
2798
  .then(tag => { parsed.tag = tag; })
2795
- .then(() => pxt.github.pkgConfigAsync(parsed.fullName, parsed.tag))
2799
+ .then(() => pxt.github.pkgConfigAsync(parsed.fullName, parsed.tag, config))
2796
2800
  .then(cfg => mainPkg.loadAsync(true)
2797
2801
  .then(() => {
2798
2802
  let ver = pxt.github.stringifyRepo(parsed);
@@ -6252,6 +6256,17 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
6252
6256
  }
6253
6257
  }
6254
6258
  }, buildSkillMapAsync);
6259
+ p.defineCommand({
6260
+ name: "buildauthcode",
6261
+ aliases: ["authcode"],
6262
+ advanced: true,
6263
+ help: "Serves the authcode webapp",
6264
+ flags: {
6265
+ serve: {
6266
+ description: "Serve the authcode app locally after building (npm start)"
6267
+ }
6268
+ }
6269
+ }, buildAuthcodeAsync);
6255
6270
  advancedCommand("augmentdocs", "test markdown docs replacements", augmnetDocsAsync, "<temlate.md> <doc.md>");
6256
6271
  advancedCommand("crowdin", "upload, download, clean, stats files to/from crowdin", pc => crowdin.execCrowdinAsync.apply(undefined, pc.args), "<cmd> <path> [output]");
6257
6272
  advancedCommand("hidlist", "list HID devices", hid.listAsync);