pxt-core 13.2.16 → 13.2.18
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/backendutils.d.ts +13 -0
- package/built/backendutils.js +66 -16
- package/built/cli.js +14 -9
- package/built/nodeutil.js +3 -7
- package/built/pxt.js +67 -25
- package/built/pxtblocks/backpack.d.ts +1 -1
- package/built/pxtblocks/clipboard.d.ts +1 -1
- package/built/pxtblocks/plugins/duplicateOnDrag/dragStrategy.d.ts +2 -0
- package/built/pxtlib.js +53 -16
- package/built/pxtservices/editorDriver.d.ts +1 -0
- package/built/target.js +1 -1
- package/built/targetlight.js +1 -1
- package/built/tests/blocksrunner.js +38 -18
- package/built/tests/blockssetup.js +38 -18
- package/built/tests/cli-test/cli/commandparser.d.ts +49 -0
- package/built/tests/cli-test/cli/nodeutil.d.ts +95 -0
- package/built/tests/cli-test/tests/cli-test/bump.d.ts +1 -0
- package/built/tests/cli-test/tests/cli-test/clirunner.d.ts +1 -0
- package/built/web/blockly.css +1 -1
- package/built/web/main.js +2 -2
- package/built/web/pxtapp.js +2 -2
- package/built/web/pxtasseteditor.js +2 -2
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/rtlblockly.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/runnerembed.js +2 -2
- package/built/web/semantic.css +1 -1
- package/built/web/teachertool/js/{main.9894b09b.js → main.c8f9e9a1.js} +2 -2
- package/built/web/tutorialtool/js/{main.347d6451.js → main.86239049.js} +2 -2
- package/localtypings/pxteditor.d.ts +1 -0
- package/package.json +1 -1
- package/theme/blockly-core.less +5 -0
- package/theme/home.less +1 -0
- package/theme/themes/pxt/globals/zindex.variables +1 -1
- package/webapp/public/controller.html +1 -0
- package/webapp/public/teachertool.html +1 -1
- package/webapp/public/tutorialtool.html +1 -1
package/built/pxtlib.js
CHANGED
|
@@ -1510,6 +1510,8 @@ const lf = ts.pxtc.Util.lf;
|
|
|
1510
1510
|
let parts = k.split(".");
|
|
1511
1511
|
for (let i = 0; i < parts.length; ++i) {
|
|
1512
1512
|
let part = parts[i];
|
|
1513
|
+
if (part === "__proto__" || part === "constructor" || part === "prototype")
|
|
1514
|
+
Util.userError("Invalid configuration key: " + k);
|
|
1513
1515
|
if (i == parts.length - 1)
|
|
1514
1516
|
ptr[part] = v[k];
|
|
1515
1517
|
else {
|
|
@@ -7804,10 +7806,11 @@ var pxt;
|
|
|
7804
7806
|
if (!inEnum)
|
|
7805
7807
|
return;
|
|
7806
7808
|
// parse the enum case, with lots of optional stuff (?)
|
|
7807
|
-
|
|
7809
|
+
const enumLine = lnNC.trim().replace(/,$/, "").trim();
|
|
7810
|
+
let mm = /^(\w+)(?:\s*=(.*))?$/.exec(enumLine);
|
|
7808
7811
|
if (mm) {
|
|
7809
7812
|
let nm = mm[1];
|
|
7810
|
-
let v = mm[
|
|
7813
|
+
let v = mm[2] && mm[2].trim();
|
|
7811
7814
|
let opt = "";
|
|
7812
7815
|
if (v) {
|
|
7813
7816
|
// user-supplied value
|
|
@@ -7845,23 +7848,26 @@ var pxt;
|
|
|
7845
7848
|
}
|
|
7846
7849
|
function parseArg(parsedAttrs, s) {
|
|
7847
7850
|
s = s.trim();
|
|
7848
|
-
|
|
7851
|
+
const equals = s.lastIndexOf("=");
|
|
7852
|
+
const m = equals < 0 ? null : /^\s*(-?\w+)$/.exec(s.slice(equals + 1));
|
|
7849
7853
|
let defl = "";
|
|
7850
7854
|
let qm = "";
|
|
7851
7855
|
if (m) {
|
|
7852
|
-
defl = m[
|
|
7856
|
+
defl = m[1];
|
|
7853
7857
|
qm = "?";
|
|
7854
|
-
s =
|
|
7858
|
+
s = s.slice(0, equals).trim();
|
|
7855
7859
|
}
|
|
7856
|
-
|
|
7857
|
-
|
|
7860
|
+
let nameStart = s.length;
|
|
7861
|
+
while (nameStart > 0 && /\w/.test(s.charAt(nameStart - 1)))
|
|
7862
|
+
--nameStart;
|
|
7863
|
+
if (nameStart == s.length || /[\r\n\u2028\u2029]/.test(s.slice(0, nameStart))) {
|
|
7858
7864
|
err("invalid argument: " + s);
|
|
7859
7865
|
return {
|
|
7860
7866
|
name: "???",
|
|
7861
7867
|
type: "int"
|
|
7862
7868
|
};
|
|
7863
7869
|
}
|
|
7864
|
-
let argName =
|
|
7870
|
+
let argName = s.slice(nameStart);
|
|
7865
7871
|
if (parsedAttrs.paramDefl[argName]) {
|
|
7866
7872
|
defl = parsedAttrs.paramDefl[argName];
|
|
7867
7873
|
qm = "?";
|
|
@@ -7876,7 +7882,7 @@ var pxt;
|
|
|
7876
7882
|
}
|
|
7877
7883
|
return {
|
|
7878
7884
|
name: argName + qm,
|
|
7879
|
-
type:
|
|
7885
|
+
type: s.slice(0, nameStart)
|
|
7880
7886
|
};
|
|
7881
7887
|
}
|
|
7882
7888
|
function parseCpp(src, isHeader) {
|
|
@@ -7886,9 +7892,28 @@ var pxt;
|
|
|
7886
7892
|
inDocComment = false;
|
|
7887
7893
|
let indexedInstanceAttrs;
|
|
7888
7894
|
let indexedInstanceIdx = -1;
|
|
7889
|
-
//
|
|
7890
|
-
|
|
7891
|
-
|
|
7895
|
+
// Match directives one line at a time so unterminated blocks cannot rescan the source.
|
|
7896
|
+
const lines = src.split(/\r?\n/);
|
|
7897
|
+
let ifStart = -1;
|
|
7898
|
+
let ifArg = "";
|
|
7899
|
+
lines.forEach((ln, i) => {
|
|
7900
|
+
const directive = /^#\s*(?:if\s+(\w+)|(elif|else|endif))$/.exec(ln.trim());
|
|
7901
|
+
if (!directive)
|
|
7902
|
+
return;
|
|
7903
|
+
if (ifStart < 0) {
|
|
7904
|
+
if (directive[1]) {
|
|
7905
|
+
ifStart = i;
|
|
7906
|
+
ifArg = directive[1];
|
|
7907
|
+
}
|
|
7908
|
+
}
|
|
7909
|
+
else if (directive[2]) {
|
|
7910
|
+
if (hash_if_options.indexOf(ifArg) >= 0 && !cpp_options[ifArg]) {
|
|
7911
|
+
for (let j = ifStart + 1; j < i; ++j)
|
|
7912
|
+
lines[j] = "";
|
|
7913
|
+
}
|
|
7914
|
+
ifStart = -1;
|
|
7915
|
+
}
|
|
7916
|
+
});
|
|
7892
7917
|
// special handling of C++ namespace that ends with Methods (e.g. FooMethods)
|
|
7893
7918
|
// such a namespace will be converted into a TypeScript interface
|
|
7894
7919
|
// this enables simple objects with methods to be defined. See, for example:
|
|
@@ -7966,10 +7991,14 @@ var pxt;
|
|
|
7966
7991
|
return "T";
|
|
7967
7992
|
case "String":
|
|
7968
7993
|
return "S";
|
|
7969
|
-
default:
|
|
7994
|
+
default: {
|
|
7970
7995
|
if (U.lookup(knownEnums, tp))
|
|
7971
7996
|
return "I";
|
|
7972
|
-
|
|
7997
|
+
let typeEnd = tp.length;
|
|
7998
|
+
while (typeEnd > 0 && /[\*_]/.test(tp.charAt(typeEnd - 1)))
|
|
7999
|
+
--typeEnd;
|
|
8000
|
+
return "_" + tp.slice(0, typeEnd);
|
|
8001
|
+
}
|
|
7973
8002
|
}
|
|
7974
8003
|
}
|
|
7975
8004
|
function generateVMWrapper(fi, argTypes) {
|
|
@@ -8051,7 +8080,7 @@ var pxt;
|
|
|
8051
8080
|
enumVal = 0;
|
|
8052
8081
|
enumsDTS.setNs("");
|
|
8053
8082
|
shimsDTS.setNs("");
|
|
8054
|
-
|
|
8083
|
+
lines.forEach(ln => {
|
|
8055
8084
|
++lineNo;
|
|
8056
8085
|
// remove comments (NC = no comments)
|
|
8057
8086
|
let lnNC = stripComments(ln);
|
|
@@ -27237,12 +27266,20 @@ ${opts.repo.name.replace(/^pxt-/, '')}=github:${opts.repo.fullName}#${opts.repo.
|
|
|
27237
27266
|
strong: 1,
|
|
27238
27267
|
em: 1,
|
|
27239
27268
|
};
|
|
27269
|
+
/** Keeps metadata and token-only HTML out of the translation catalog. */
|
|
27270
|
+
function isNonTranslatable(text) {
|
|
27271
|
+
if (text.startsWith("IE=edge,") || text.startsWith("width=device-width"))
|
|
27272
|
+
return true;
|
|
27273
|
+
// Remove URLs, template placeholders, and spacing entities to look for prose.
|
|
27274
|
+
const prose = text.replace(/(?:https?:\/\/|\/)[\w@\/.]+|@[-\w]+@|\{[^{}]+\}| /g, "");
|
|
27275
|
+
return !/[a-zA-Z]/.test(prose);
|
|
27276
|
+
}
|
|
27240
27277
|
function translate(html, locale) {
|
|
27241
27278
|
const missing = {};
|
|
27242
27279
|
function translateOne(toTranslate) {
|
|
27243
27280
|
let spm = /^(\s*)([^]*?)(\s*)$/.exec(toTranslate);
|
|
27244
27281
|
let text = spm[2].replace(/\s+/g, " ");
|
|
27245
|
-
if (
|
|
27282
|
+
if (isNonTranslatable(text))
|
|
27246
27283
|
return null;
|
|
27247
27284
|
let v = U.lookup(locale, text);
|
|
27248
27285
|
if (v)
|
|
@@ -36,6 +36,7 @@ export declare class EditorDriver extends IframeDriver {
|
|
|
36
36
|
redo(): Promise<void>;
|
|
37
37
|
setHighContrast(on: boolean): Promise<void>;
|
|
38
38
|
showThemePicker(): Promise<void>;
|
|
39
|
+
showExtensions(): Promise<void>;
|
|
39
40
|
toggleHighContrast(): Promise<void>;
|
|
40
41
|
toggleGreenScreen(): Promise<void>;
|
|
41
42
|
toggleAccessibleBlocks(): Promise<void>;
|