pxt-core 8.2.13 → 8.2.14

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 (47) hide show
  1. package/built/buildengine.js +3 -3
  2. package/built/cli.js +5 -5
  3. package/built/gdb.js +4 -4
  4. package/built/nodeutil.d.ts +1 -0
  5. package/built/pxt.js +360 -360
  6. package/built/pxtblockly.js +35 -35
  7. package/built/pxtblocks.js +35 -35
  8. package/built/pxtcompiler.js +156 -156
  9. package/built/pxteditor.d.ts +15 -3
  10. package/built/pxteditor.js +6 -6
  11. package/built/pxtlib.d.ts +2 -1
  12. package/built/pxtlib.js +162 -161
  13. package/built/pxtpy.js +34 -35
  14. package/built/pxtsim.d.ts +5 -5
  15. package/built/pxtsim.js +3 -3
  16. package/built/server.js +5 -5
  17. package/built/storage.js +4 -4
  18. package/built/target.js +1 -1
  19. package/built/web/main.js +1 -1
  20. package/built/web/pxtapp.js +1 -1
  21. package/built/web/pxtasseteditor.js +1 -1
  22. package/built/web/pxteditor.js +1 -1
  23. package/built/web/pxtembed.js +2 -2
  24. package/built/web/pxtlib.js +1 -1
  25. package/built/web/pxtpy.js +1 -1
  26. package/built/web/pxtsim.js +1 -1
  27. package/built/web/pxtworker.js +1 -1
  28. package/built/web/rtlsemantic.css +1 -1
  29. package/built/web/semantic.css +1 -1
  30. package/built/web/skillmap/js/2.960f04a5.chunk.js +2 -0
  31. package/built/web/skillmap/js/main.44b2383f.chunk.js +1 -0
  32. package/common-docs/static/logo/social-buttons/google-classroom.png +0 -0
  33. package/common-docs/static/logo/social-buttons/microsoft-teams.png +0 -0
  34. package/docfiles/pxtweb/tsconfig.json +2 -1
  35. package/localtypings/dom.d.ts +3 -0
  36. package/localtypings/react.d.ts +1 -1
  37. package/package.json +6 -6
  38. package/react-common/components/controls/Modal.tsx +2 -2
  39. package/react-common/components/share/ShareInfo.tsx +1 -1
  40. package/react-common/tsconfig.json +3 -2
  41. package/theme/common.less +5 -3
  42. package/theme/highcontrast.less +3 -0
  43. package/theme/toolbox.less +25 -0
  44. package/theme/tutorial-sidebar.less +171 -115
  45. package/webapp/public/skillmap.html +1 -1
  46. package/built/web/skillmap/js/2.26325281.chunk.js +0 -2
  47. package/built/web/skillmap/js/main.d94a2bd9.chunk.js +0 -1
package/built/pxtpy.js CHANGED
@@ -175,12 +175,12 @@ var pxt;
175
175
  error(null, 9501, pxt.U.lf("unknown type '{0}' near '{1}'", tp, currErrorCtx || "???"));
176
176
  return mkType({ primType: tp });
177
177
  }
178
- if (sym.kind == 7 /* EnumMember */)
178
+ if (sym.kind == 7 /* SK.EnumMember */)
179
179
  return tpNumber;
180
180
  // sym.pyInstanceType might not be initialized yet and we don't want to call symbolType() here to avoid infinite recursion
181
- if (sym.kind == 8 /* Class */ || sym.kind == 9 /* Interface */)
181
+ if (sym.kind == 8 /* SK.Class */ || sym.kind == 9 /* SK.Interface */)
182
182
  return sym.pyInstanceType || mkType({ classType: sym });
183
- if (sym.kind == 6 /* Enum */)
183
+ if (sym.kind == 6 /* SK.Enum */)
184
184
  return tpNumber;
185
185
  error(null, 9502, pxt.U.lf("'{0}' is not a type near '{1}'", tp, currErrorCtx || "???"));
186
186
  return mkType({ primType: tp });
@@ -237,7 +237,7 @@ var pxt;
237
237
  if (prevRetType) {
238
238
  unify(sym.pyAST, prevRetType, sym.pyRetType);
239
239
  }
240
- if (sym.kind == 3 /* Function */ || sym.kind == 1 /* Method */) {
240
+ if (sym.kind == 3 /* SK.Function */ || sym.kind == 1 /* SK.Method */) {
241
241
  let paramTypes = sym.parameters.map(p => p.pyType);
242
242
  if (paramTypes.some(isFalsy)) {
243
243
  error(null, 9526, pxt.U.lf("function symbol is missing parameter types near '{1}'", currErrorCtx || "???"));
@@ -247,7 +247,7 @@ var pxt;
247
247
  }
248
248
  else
249
249
  sym.pySymbolType = sym.pyRetType;
250
- if (sym.kind == 8 /* Class */ || sym.kind == 9 /* Interface */) {
250
+ if (sym.kind == 8 /* SK.Class */ || sym.kind == 9 /* SK.Interface */) {
251
251
  sym.pyInstanceType = mkType({ classType: sym });
252
252
  }
253
253
  currErrorCtx = undefined;
@@ -267,7 +267,7 @@ var pxt;
267
267
  else if (name.indexOf(".") && !name.endsWith(".__constructor")) {
268
268
  const base = name.substring(0, name.lastIndexOf("."));
269
269
  const baseSymbol = lookupGlobalSymbol(base);
270
- if ((baseSymbol === null || baseSymbol === void 0 ? void 0 : baseSymbol.kind) === 8 /* Class */ && ((_a = baseSymbol.extendsTypes) === null || _a === void 0 ? void 0 : _a.length)) {
270
+ if ((baseSymbol === null || baseSymbol === void 0 ? void 0 : baseSymbol.kind) === 8 /* SK.Class */ && ((_a = baseSymbol.extendsTypes) === null || _a === void 0 ? void 0 : _a.length)) {
271
271
  return lookupGlobalSymbol(baseSymbol.extendsTypes[0] + name.substring(base.length));
272
272
  }
273
273
  }
@@ -361,17 +361,17 @@ var pxt;
361
361
  }
362
362
  let qualifiedName = pref + name;
363
363
  if (scope.kind === "ClassDef") {
364
- varSym = addSymbol(2 /* Property */, qualifiedName);
364
+ varSym = addSymbol(2 /* SK.Property */, qualifiedName);
365
365
  }
366
366
  else if (isLocalScope(scope)
367
367
  && (modifier === py_1.VarModifier.Global
368
368
  || modifier === py_1.VarModifier.NonLocal)) {
369
- varSym = addSymbol(4 /* Variable */, name);
369
+ varSym = addSymbol(4 /* SK.Variable */, name);
370
370
  }
371
371
  else if (isLocalScope(scope))
372
- varSym = mkSymbol(4 /* Variable */, name);
372
+ varSym = mkSymbol(4 /* SK.Variable */, name);
373
373
  else
374
- varSym = addSymbol(4 /* Variable */, qualifiedName);
374
+ varSym = addSymbol(4 /* SK.Variable */, qualifiedName);
375
375
  varScopeSym = {
376
376
  symbol: varSym,
377
377
  modifier,
@@ -624,8 +624,7 @@ var pxt;
624
624
  }
625
625
  }
626
626
  function isSymbol(c) {
627
- var _a;
628
- return !!((_a = c) === null || _a === void 0 ? void 0 : _a.name);
627
+ return !!(c === null || c === void 0 ? void 0 : c.name);
629
628
  }
630
629
  function isGenericType(t) {
631
630
  var _a;
@@ -690,7 +689,7 @@ var pxt;
690
689
  // TODO optimize ?
691
690
  function listClassFields(cd) {
692
691
  let qn = cd.symInfo.qName;
693
- return pxt.U.values(internalApis).filter(e => e.namespace == qn && e.kind == 2 /* Property */);
692
+ return pxt.U.values(internalApis).filter(e => e.namespace == qn && e.kind == 2 /* SK.Property */);
694
693
  }
695
694
  function getClassField(ct, n, isStatic, checkOnly = false, skipBases = false) {
696
695
  let qid;
@@ -721,7 +720,7 @@ var pxt;
721
720
  }
722
721
  }
723
722
  if (!checkOnly && ct.pyAST && ct.pyAST.kind == "ClassDef") {
724
- let sym = addSymbol(2 /* Property */, qid);
723
+ let sym = addSymbol(2 /* SK.Property */, qid);
725
724
  sym.isInstance = !isStatic;
726
725
  return sym;
727
726
  }
@@ -857,10 +856,10 @@ var pxt;
857
856
  if (!s)
858
857
  return false;
859
858
  switch (s.kind) {
860
- case 5 /* Module */:
861
- case 9 /* Interface */:
862
- case 8 /* Class */:
863
- case 6 /* Enum */:
859
+ case 5 /* SK.Module */:
860
+ case 9 /* SK.Interface */:
861
+ case 8 /* SK.Class */:
862
+ case 6 /* SK.Enum */:
864
863
  return true;
865
864
  default:
866
865
  return false;
@@ -902,7 +901,7 @@ var pxt;
902
901
  let sym = lookupApi(tpName + "@type") || lookupApi(tpName);
903
902
  if (sym) {
904
903
  getOrSetSymbolType(sym);
905
- if (sym.kind == 6 /* Enum */)
904
+ if (sym.kind == 6 /* SK.Enum */)
906
905
  return tpNumber;
907
906
  if (sym.pyInstanceType)
908
907
  return sym.pyInstanceType;
@@ -1107,7 +1106,7 @@ var pxt;
1107
1106
  const nested = !!ctx.currFun;
1108
1107
  setupScope(n);
1109
1108
  const existing = lookupSymbol(getFullName(n));
1110
- const sym = addSymbolFor(isMethod ? 1 /* Method */ : 3 /* Function */, n);
1109
+ const sym = addSymbolFor(isMethod ? 1 /* SK.Method */ : 3 /* SK.Function */, n);
1111
1110
  if (!inline) {
1112
1111
  if (existing && existing.declared === currIteration) {
1113
1112
  error(n, 9520, lf("Duplicate function declaration"));
@@ -1212,7 +1211,7 @@ var pxt;
1212
1211
  FunctionDef: (n) => emitFunctionDef(n),
1213
1212
  ClassDef: (n) => guardedScope(n, () => {
1214
1213
  setupScope(n);
1215
- const sym = addSymbolFor(8 /* Class */, n);
1214
+ const sym = addSymbolFor(8 /* SK.Class */, n);
1216
1215
  pxt.U.assert(!ctx.currClass);
1217
1216
  let topLev = isTopLevel();
1218
1217
  ctx.currClass = n;
@@ -1661,7 +1660,7 @@ var pxt;
1661
1660
  const scopeSym = currentScope().vars[nm];
1662
1661
  const sym = scopeSym === null || scopeSym === void 0 ? void 0 : scopeSym.symbol;
1663
1662
  // Mark the assignment only if the variable is declared in this scope
1664
- if (sym && sym.kind === 4 /* Variable */ && scopeSym.modifier === undefined) {
1663
+ if (sym && sym.kind === 4 /* SK.Variable */ && scopeSym.modifier === undefined) {
1665
1664
  if (scopeSym.firstAssignPos === undefined
1666
1665
  || scopeSym.firstAssignPos > target.startPos) {
1667
1666
  scopeSym.firstAssignPos = target.startPos;
@@ -1728,7 +1727,7 @@ var pxt;
1728
1727
  let localScopeVar = currentScope().vars[id];
1729
1728
  let local = localScopeVar === null || localScopeVar === void 0 ? void 0 : localScopeVar.symbol;
1730
1729
  if (n.isdef === undefined) {
1731
- if (!curr || (curr.kind === 4 /* Variable */ && curr !== local)) {
1730
+ if (!curr || (curr.kind === 4 /* SK.Variable */ && curr !== local)) {
1732
1731
  if (ctx.currClass && !ctx.currFun) {
1733
1732
  n.isdef = false; // field
1734
1733
  currScopeVar = defvar(id, {});
@@ -2006,7 +2005,7 @@ var pxt;
2006
2005
  n.func.inCalledPosition = true;
2007
2006
  let nm = tryGetName(n.func);
2008
2007
  let namedSymbol = lookupSymbol(nm);
2009
- let isClass = namedSymbol && namedSymbol.kind == 8 /* Class */;
2008
+ let isClass = namedSymbol && namedSymbol.kind == 8 /* SK.Class */;
2010
2009
  let fun = namedSymbol;
2011
2010
  let recvTp = undefined;
2012
2011
  let recv = undefined;
@@ -2014,7 +2013,7 @@ var pxt;
2014
2013
  if (isClass) {
2015
2014
  fun = lookupSymbol(namedSymbol.pyQName + ".__constructor");
2016
2015
  if (!fun) {
2017
- fun = addSymbolFor(3 /* Function */, createDummyConstructorSymbol(namedSymbol === null || namedSymbol === void 0 ? void 0 : namedSymbol.pyAST));
2016
+ fun = addSymbolFor(3 /* SK.Function */, createDummyConstructorSymbol(namedSymbol === null || namedSymbol === void 0 ? void 0 : namedSymbol.pyAST));
2018
2017
  }
2019
2018
  }
2020
2019
  else {
@@ -2082,7 +2081,7 @@ var pxt;
2082
2081
  recvTp = typeOf(recv);
2083
2082
  methName = over.n.slice(1);
2084
2083
  fun = getTypeField(recv, methName);
2085
- if (fun && fun.kind == 2 /* Property */)
2084
+ if (fun && fun.kind == 2 /* SK.Property */)
2086
2085
  return B.mkInfix(expr(recv), ".", B.mkText(methName));
2087
2086
  }
2088
2087
  else {
@@ -2507,7 +2506,7 @@ var pxt;
2507
2506
  return hoisted;
2508
2507
  }
2509
2508
  function shouldHoist(sym, scope) {
2510
- let result = sym.symbol.kind === 4 /* Variable */
2509
+ let result = sym.symbol.kind === 4 /* SK.Variable */
2511
2510
  && !sym.symbol.isParam
2512
2511
  && sym.modifier === undefined
2513
2512
  && (sym.lastRefPos > sym.forVariableEndPos
@@ -2664,14 +2663,14 @@ var pxt;
2664
2663
  diagnostics = parseDiags.concat(diagnostics);
2665
2664
  const isGlobalSymbol = (si) => {
2666
2665
  switch (si.kind) {
2667
- case 6 /* Enum */:
2668
- case 7 /* EnumMember */:
2669
- case 4 /* Variable */:
2670
- case 3 /* Function */:
2671
- case 5 /* Module */:
2666
+ case 6 /* SK.Enum */:
2667
+ case 7 /* SK.EnumMember */:
2668
+ case 4 /* SK.Variable */:
2669
+ case 3 /* SK.Function */:
2670
+ case 5 /* SK.Module */:
2672
2671
  return true;
2673
- case 2 /* Property */:
2674
- case 1 /* Method */:
2672
+ case 2 /* SK.Property */:
2673
+ case 1 /* SK.Method */:
2675
2674
  return !si.isInstance;
2676
2675
  default:
2677
2676
  return false;
@@ -2908,7 +2907,7 @@ var pxt;
2908
2907
  },
2909
2908
  decorator_list: [],
2910
2909
  vars: {},
2911
- symInfo: mkSymbol(3 /* Function */, def.symInfo.qName + ".__constructor")
2910
+ symInfo: mkSymbol(3 /* SK.Function */, def.symInfo.qName + ".__constructor")
2912
2911
  };
2913
2912
  result.symInfo.parameters = [];
2914
2913
  result.symInfo.pyRetType = mkType({ classType: def.symInfo });
package/built/pxtsim.d.ts CHANGED
@@ -714,8 +714,8 @@ declare namespace pxsim {
714
714
  function nullFix(v: any): any;
715
715
  function nullCheck(v: any): void;
716
716
  function panic(code: number): void;
717
- function stringToBool(s: string): 1 | 0;
718
- function ptrToBool(v: any): 1 | 0;
717
+ function stringToBool(s: string): 0 | 1;
718
+ function ptrToBool(v: any): 0 | 1;
719
719
  function emptyToNull(s: string): any;
720
720
  function ldlocRef(r: RefRefLocal): any;
721
721
  function stlocRef(r: RefRefLocal, v: any): void;
@@ -814,7 +814,7 @@ declare namespace pxsim {
814
814
  function insertAt(c: RefCollection, x: number, y: number): void;
815
815
  function setAt(c: RefCollection, x: number, y: any): void;
816
816
  function indexOf(c: RefCollection, x: any, start: number): number;
817
- function removeElement(c: RefCollection, x: any): 1 | 0;
817
+ function removeElement(c: RefCollection, x: any): 0 | 1;
818
818
  }
819
819
  namespace Math_ {
820
820
  const imul: (x: number, y: number) => number;
@@ -896,8 +896,8 @@ declare namespace pxsim {
896
896
  function concat(a: string, b: string): string;
897
897
  function substring(s: string, i: number, j: number): string;
898
898
  function equals(s1: string, s2: string): boolean;
899
- function compare(s1: string, s2: string): 1 | 0 | -1;
900
- function compareDecr(s1: string, s2: string): 1 | 0 | -1;
899
+ function compare(s1: string, s2: string): 0 | 1 | -1;
900
+ function compareDecr(s1: string, s2: string): 0 | 1 | -1;
901
901
  function length(s: string): number;
902
902
  function substr(s: string, start: number, length?: number): string;
903
903
  function charAt(s: string, i: number): string;
package/built/pxtsim.js CHANGED
@@ -6301,13 +6301,13 @@ var pxsim;
6301
6301
  }
6302
6302
  }
6303
6303
  postMessageCore(frame, msg) {
6304
- var _a, _b, _c, _d;
6304
+ var _a, _b;
6305
6305
  frame.contentWindow.postMessage(msg, frame.dataset['origin']);
6306
- if (pxsim.U.isLocalHostDev() && ((_b = (_a = pxt) === null || _a === void 0 ? void 0 : _a.appTarget) === null || _b === void 0 ? void 0 : _b.id)) {
6306
+ if (pxsim.U.isLocalHostDev() && ((_a = pxt === null || pxt === void 0 ? void 0 : pxt.appTarget) === null || _a === void 0 ? void 0 : _a.id)) {
6307
6307
  // If using the production simulator on local serve, the domain might have been
6308
6308
  // redirected by the CLI server. Also send to the production domain just in case
6309
6309
  try {
6310
- frame.contentWindow.postMessage(msg, `https://trg-${(_d = (_c = pxt) === null || _c === void 0 ? void 0 : _c.appTarget) === null || _d === void 0 ? void 0 : _d.id}.userpxt.io/---simulator`);
6310
+ frame.contentWindow.postMessage(msg, `https://trg-${(_b = pxt === null || pxt === void 0 ? void 0 : pxt.appTarget) === null || _b === void 0 ? void 0 : _b.id}.userpxt.io/---simulator`);
6311
6311
  }
6312
6312
  catch (e) {
6313
6313
  // Ignore exceptions if the target origin doesn't match
package/built/server.js CHANGED
@@ -55,11 +55,11 @@ function setupRootDir() {
55
55
  function setupProjectsDir() {
56
56
  nodeutil.mkdirP(userProjectsDir);
57
57
  }
58
- const statAsync = util_1.promisify(fs.stat);
59
- const readdirAsync = util_1.promisify(fs.readdir);
60
- const readFileAsync = util_1.promisify(fs.readFile);
61
- const writeFileAsync = util_1.promisify(fs.writeFile);
62
- const unlinkAsync = util_1.promisify(fs.unlink);
58
+ const statAsync = (0, util_1.promisify)(fs.stat);
59
+ const readdirAsync = (0, util_1.promisify)(fs.readdir);
60
+ const readFileAsync = (0, util_1.promisify)(fs.readFile);
61
+ const writeFileAsync = (0, util_1.promisify)(fs.writeFile);
62
+ const unlinkAsync = (0, util_1.promisify)(fs.unlink);
63
63
  function existsAsync(fn) {
64
64
  return new Promise((resolve, reject) => {
65
65
  fs.exists(fn, resolve);
package/built/storage.js CHANGED
@@ -6,10 +6,10 @@ const path = require("path");
6
6
  const util_1 = require("util");
7
7
  var U = pxt.Util;
8
8
  const rootPath = path.resolve('.pxt', 'storage');
9
- const mkdirAsync = util_1.promisify(fs.mkdir);
10
- const unlinkAsync = util_1.promisify(fs.unlink);
11
- const readFileAsync = util_1.promisify(fs.readFile);
12
- const writeFileAsync = util_1.promisify(fs.writeFile);
9
+ const mkdirAsync = (0, util_1.promisify)(fs.mkdir);
10
+ const unlinkAsync = (0, util_1.promisify)(fs.unlink);
11
+ const readFileAsync = (0, util_1.promisify)(fs.readFile);
12
+ const writeFileAsync = (0, util_1.promisify)(fs.writeFile);
13
13
  async function initAsync() {
14
14
  try {
15
15
  await mkdirAsync(rootPath, { recursive: true });