pxt-core 9.3.7 → 9.3.9
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/cli.js +11 -4
- package/built/pxt.js +13 -4
- package/built/pxtblockly.js +29 -4
- package/built/pxtblocks.d.ts +1 -0
- package/built/pxtblocks.js +29 -4
- package/built/pxtlib.d.ts +1 -0
- package/built/pxtrunner.js +13 -1
- package/built/pxtsim.d.ts +1 -0
- package/built/pxtsim.js +2 -0
- package/built/server.js +2 -1
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtasseteditor.js +1 -1
- package/built/web/pxtblockly.js +1 -1
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtrunner.js +1 -1
- package/built/web/pxtsim.js +1 -1
- package/built/web/react-common-teachertool.css +13 -0
- package/built/web/rtlreact-common-teachertool.css +13 -0
- package/built/web/teachertool/css/main.a04db2f1.css +1 -0
- package/built/web/teachertool/js/main.e5ff478b.js +2 -0
- package/package.json +4 -2
- package/react-common/styles/react-common-teachertool-core.less +10 -0
- package/react-common/styles/react-common-teachertool.less +12 -0
- package/webapp/public/teachertool.html +36 -0
package/built/cli.js
CHANGED
|
@@ -308,7 +308,8 @@ function pxtFileList(pref) {
|
|
|
308
308
|
.concat(nodeutil.allFiles(pref + "built/web/skillmap", { maxDepth: 4 }))
|
|
309
309
|
.concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
|
|
310
310
|
.concat(nodeutil.allFiles(pref + "built/web/multiplayer", { maxDepth: 4 }))
|
|
311
|
-
.concat(nodeutil.allFiles(pref + "built/web/kiosk", { maxDepth: 4 }))
|
|
311
|
+
.concat(nodeutil.allFiles(pref + "built/web/kiosk", { maxDepth: 4 }))
|
|
312
|
+
.concat(nodeutil.allFiles(pref + "built/web/teachertool", { maxDepth: 4 }));
|
|
312
313
|
}
|
|
313
314
|
function semverCmp(a, b) {
|
|
314
315
|
let parse = (s) => {
|
|
@@ -392,7 +393,8 @@ function ciAsync() {
|
|
|
392
393
|
.then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
|
|
393
394
|
.then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
|
|
394
395
|
.then(() => crowdin.execCrowdinAsync("upload", "built/multiplayer-strings.json"))
|
|
395
|
-
.then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"))
|
|
396
|
+
.then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"))
|
|
397
|
+
.then(() => crowdin.execCrowdinAsync("upload", "built/teachertool-strings.json"));
|
|
396
398
|
if (uploadApiStrings)
|
|
397
399
|
p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"));
|
|
398
400
|
if (uploadDocs || uploadApiStrings)
|
|
@@ -922,6 +924,7 @@ function uploadCoreAsync(opts) {
|
|
|
922
924
|
"authcodeUrl": opts.localDir + "authcode.html",
|
|
923
925
|
"multiplayerUrl": opts.localDir + "multiplayer.html",
|
|
924
926
|
"kioskUrl": opts.localDir + "kiosk.html",
|
|
927
|
+
"teachertoolUrl": opts.localDir + "teachertool.html",
|
|
925
928
|
"isStatic": true,
|
|
926
929
|
};
|
|
927
930
|
const targetImageLocalPaths = targetImagePaths.map(k => `${opts.localDir}${path.join('./docs', k)}`);
|
|
@@ -972,6 +975,7 @@ function uploadCoreAsync(opts) {
|
|
|
972
975
|
"authcode.html",
|
|
973
976
|
"multiplayer.html",
|
|
974
977
|
"kiosk.html",
|
|
978
|
+
"teachertool.html",
|
|
975
979
|
];
|
|
976
980
|
// expandHtml is manually called on these files before upload
|
|
977
981
|
// runs <!-- @include --> substitutions, fills in locale, etc
|
|
@@ -981,6 +985,7 @@ function uploadCoreAsync(opts) {
|
|
|
981
985
|
"authcode.html",
|
|
982
986
|
"multiplayer.html",
|
|
983
987
|
"kiosk.html",
|
|
988
|
+
"teachertool.html",
|
|
984
989
|
];
|
|
985
990
|
nodeutil.mkdirP("built/uploadrepl");
|
|
986
991
|
function encodeURLs(urls) {
|
|
@@ -1821,7 +1826,8 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
1821
1826
|
await Promise.all([
|
|
1822
1827
|
generateReactCommonCss("skillmap"),
|
|
1823
1828
|
generateReactCommonCss("authcode"),
|
|
1824
|
-
generateReactCommonCss("multiplayer")
|
|
1829
|
+
generateReactCommonCss("multiplayer"),
|
|
1830
|
+
generateReactCommonCss("teachertool")
|
|
1825
1831
|
]);
|
|
1826
1832
|
// Run postcss with autoprefixer and rtlcss
|
|
1827
1833
|
pxt.debug("running postcss");
|
|
@@ -1847,7 +1853,8 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
1847
1853
|
"blockly.css",
|
|
1848
1854
|
"react-common-skillmap.css",
|
|
1849
1855
|
"react-common-authcode.css",
|
|
1850
|
-
"react-common-multiplayer.css"
|
|
1856
|
+
"react-common-multiplayer.css",
|
|
1857
|
+
"react-common-teachertool.css"
|
|
1851
1858
|
];
|
|
1852
1859
|
for (const cssFile of files) {
|
|
1853
1860
|
const css = await readFileAsync(`built/web/${cssFile}`, "utf8");
|
package/built/pxt.js
CHANGED
|
@@ -155401,6 +155401,8 @@ var pxsim;
|
|
|
155401
155401
|
let isDeferrableBroadcastMessage = false;
|
|
155402
155402
|
const broadcastmsg = msg;
|
|
155403
155403
|
if (source && (broadcastmsg === null || broadcastmsg === void 0 ? void 0 : broadcastmsg.broadcast)) {
|
|
155404
|
+
// include index of the source iframe
|
|
155405
|
+
broadcastmsg.srcFrameIndex = this.simFrames().findIndex((item) => item.contentWindow === source);
|
|
155404
155406
|
// if the editor is hosted in a multi-editor setting
|
|
155405
155407
|
// don't start extra frames
|
|
155406
155408
|
const single = !!((_a = this._currentRuntime) === null || _a === void 0 ? void 0 : _a.single);
|
|
@@ -160832,7 +160834,8 @@ function pxtFileList(pref) {
|
|
|
160832
160834
|
.concat(nodeutil.allFiles(pref + "built/web/skillmap", { maxDepth: 4 }))
|
|
160833
160835
|
.concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
|
|
160834
160836
|
.concat(nodeutil.allFiles(pref + "built/web/multiplayer", { maxDepth: 4 }))
|
|
160835
|
-
.concat(nodeutil.allFiles(pref + "built/web/kiosk", { maxDepth: 4 }))
|
|
160837
|
+
.concat(nodeutil.allFiles(pref + "built/web/kiosk", { maxDepth: 4 }))
|
|
160838
|
+
.concat(nodeutil.allFiles(pref + "built/web/teachertool", { maxDepth: 4 }));
|
|
160836
160839
|
}
|
|
160837
160840
|
function semverCmp(a, b) {
|
|
160838
160841
|
let parse = (s) => {
|
|
@@ -160916,7 +160919,8 @@ function ciAsync() {
|
|
|
160916
160919
|
.then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
|
|
160917
160920
|
.then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
|
|
160918
160921
|
.then(() => crowdin.execCrowdinAsync("upload", "built/multiplayer-strings.json"))
|
|
160919
|
-
.then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"))
|
|
160922
|
+
.then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"))
|
|
160923
|
+
.then(() => crowdin.execCrowdinAsync("upload", "built/teachertool-strings.json"));
|
|
160920
160924
|
if (uploadApiStrings)
|
|
160921
160925
|
p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"));
|
|
160922
160926
|
if (uploadDocs || uploadApiStrings)
|
|
@@ -161446,6 +161450,7 @@ function uploadCoreAsync(opts) {
|
|
|
161446
161450
|
"authcodeUrl": opts.localDir + "authcode.html",
|
|
161447
161451
|
"multiplayerUrl": opts.localDir + "multiplayer.html",
|
|
161448
161452
|
"kioskUrl": opts.localDir + "kiosk.html",
|
|
161453
|
+
"teachertoolUrl": opts.localDir + "teachertool.html",
|
|
161449
161454
|
"isStatic": true,
|
|
161450
161455
|
};
|
|
161451
161456
|
const targetImageLocalPaths = targetImagePaths.map(k => `${opts.localDir}${path.join('./docs', k)}`);
|
|
@@ -161496,6 +161501,7 @@ function uploadCoreAsync(opts) {
|
|
|
161496
161501
|
"authcode.html",
|
|
161497
161502
|
"multiplayer.html",
|
|
161498
161503
|
"kiosk.html",
|
|
161504
|
+
"teachertool.html",
|
|
161499
161505
|
];
|
|
161500
161506
|
// expandHtml is manually called on these files before upload
|
|
161501
161507
|
// runs <!-- @include --> substitutions, fills in locale, etc
|
|
@@ -161505,6 +161511,7 @@ function uploadCoreAsync(opts) {
|
|
|
161505
161511
|
"authcode.html",
|
|
161506
161512
|
"multiplayer.html",
|
|
161507
161513
|
"kiosk.html",
|
|
161514
|
+
"teachertool.html",
|
|
161508
161515
|
];
|
|
161509
161516
|
nodeutil.mkdirP("built/uploadrepl");
|
|
161510
161517
|
function encodeURLs(urls) {
|
|
@@ -162345,7 +162352,8 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
162345
162352
|
await Promise.all([
|
|
162346
162353
|
generateReactCommonCss("skillmap"),
|
|
162347
162354
|
generateReactCommonCss("authcode"),
|
|
162348
|
-
generateReactCommonCss("multiplayer")
|
|
162355
|
+
generateReactCommonCss("multiplayer"),
|
|
162356
|
+
generateReactCommonCss("teachertool")
|
|
162349
162357
|
]);
|
|
162350
162358
|
// Run postcss with autoprefixer and rtlcss
|
|
162351
162359
|
pxt.debug("running postcss");
|
|
@@ -162371,7 +162379,8 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
162371
162379
|
"blockly.css",
|
|
162372
162380
|
"react-common-skillmap.css",
|
|
162373
162381
|
"react-common-authcode.css",
|
|
162374
|
-
"react-common-multiplayer.css"
|
|
162382
|
+
"react-common-multiplayer.css",
|
|
162383
|
+
"react-common-teachertool.css"
|
|
162375
162384
|
];
|
|
162376
162385
|
for (const cssFile of files) {
|
|
162377
162386
|
const css = await readFileAsync(`built/web/${cssFile}`, "utf8");
|
package/built/pxtblockly.js
CHANGED
|
@@ -16327,12 +16327,21 @@ var pxtblockly;
|
|
|
16327
16327
|
return project.lookupAsset("image" /* pxt.AssetType.Image */, this.getBlockData());
|
|
16328
16328
|
}
|
|
16329
16329
|
const bmp = text ? pxt.sprite.imageLiteralToBitmap(text) : new pxt.sprite.Bitmap(this.params.initWidth, this.params.initHeight);
|
|
16330
|
+
let data;
|
|
16330
16331
|
if (!bmp) {
|
|
16331
|
-
|
|
16332
|
-
|
|
16333
|
-
|
|
16332
|
+
// check for qualified name
|
|
16333
|
+
data = qNameToBitmapData(text);
|
|
16334
|
+
if (!data) {
|
|
16335
|
+
this.isGreyBlock = true;
|
|
16336
|
+
this.valueText = text;
|
|
16337
|
+
return undefined;
|
|
16338
|
+
}
|
|
16339
|
+
else {
|
|
16340
|
+
this.qName = text;
|
|
16341
|
+
}
|
|
16334
16342
|
}
|
|
16335
|
-
|
|
16343
|
+
if (!data)
|
|
16344
|
+
data = bmp.data();
|
|
16336
16345
|
const newAsset = {
|
|
16337
16346
|
internalID: -1,
|
|
16338
16347
|
id: this.sourceBlock_.id,
|
|
@@ -16347,6 +16356,13 @@ var pxtblockly;
|
|
|
16347
16356
|
if (this.asset && !this.isTemporaryAsset()) {
|
|
16348
16357
|
return pxt.getTSReferenceForAsset(this.asset);
|
|
16349
16358
|
}
|
|
16359
|
+
else if (this.qName) {
|
|
16360
|
+
// check if image has been edited
|
|
16361
|
+
const data = qNameToBitmapData(this.qName);
|
|
16362
|
+
if (data && pxt.sprite.bitmapEquals(data, this.asset.bitmap)) {
|
|
16363
|
+
return this.qName;
|
|
16364
|
+
}
|
|
16365
|
+
}
|
|
16350
16366
|
return pxt.sprite.bitmapToImageLiteral(this.asset && pxt.sprite.Bitmap.fromData(this.asset.bitmap), "typescript" /* pxt.editor.FileType.TypeScript */);
|
|
16351
16367
|
}
|
|
16352
16368
|
parseFieldOptions(opts) {
|
|
@@ -16411,6 +16427,15 @@ var pxtblockly;
|
|
|
16411
16427
|
return res;
|
|
16412
16428
|
}
|
|
16413
16429
|
}
|
|
16430
|
+
function qNameToBitmapData(qName) {
|
|
16431
|
+
const project = pxt.react.getTilemapProject();
|
|
16432
|
+
const images = project.getGalleryAssets("image" /* pxt.AssetType.Image */).filter(asset => asset.id === qName);
|
|
16433
|
+
const img = images.length && images[0];
|
|
16434
|
+
if (img) {
|
|
16435
|
+
return img.bitmap;
|
|
16436
|
+
}
|
|
16437
|
+
return undefined;
|
|
16438
|
+
}
|
|
16414
16439
|
})(pxtblockly || (pxtblockly = {}));
|
|
16415
16440
|
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
16416
16441
|
var pxtblockly;
|
package/built/pxtblocks.d.ts
CHANGED
|
@@ -448,6 +448,7 @@ declare namespace pxtblockly {
|
|
|
448
448
|
protected undoRedoState: any;
|
|
449
449
|
protected pendingEdit: boolean;
|
|
450
450
|
protected isEmpty: boolean;
|
|
451
|
+
protected qName?: string;
|
|
451
452
|
isGreyBlock: boolean;
|
|
452
453
|
constructor(text: string, params: any, validator?: Function);
|
|
453
454
|
protected abstract getAssetType(): pxt.AssetType;
|
package/built/pxtblocks.js
CHANGED
|
@@ -12765,12 +12765,21 @@ var pxtblockly;
|
|
|
12765
12765
|
return project.lookupAsset("image" /* pxt.AssetType.Image */, this.getBlockData());
|
|
12766
12766
|
}
|
|
12767
12767
|
const bmp = text ? pxt.sprite.imageLiteralToBitmap(text) : new pxt.sprite.Bitmap(this.params.initWidth, this.params.initHeight);
|
|
12768
|
+
let data;
|
|
12768
12769
|
if (!bmp) {
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12770
|
+
// check for qualified name
|
|
12771
|
+
data = qNameToBitmapData(text);
|
|
12772
|
+
if (!data) {
|
|
12773
|
+
this.isGreyBlock = true;
|
|
12774
|
+
this.valueText = text;
|
|
12775
|
+
return undefined;
|
|
12776
|
+
}
|
|
12777
|
+
else {
|
|
12778
|
+
this.qName = text;
|
|
12779
|
+
}
|
|
12772
12780
|
}
|
|
12773
|
-
|
|
12781
|
+
if (!data)
|
|
12782
|
+
data = bmp.data();
|
|
12774
12783
|
const newAsset = {
|
|
12775
12784
|
internalID: -1,
|
|
12776
12785
|
id: this.sourceBlock_.id,
|
|
@@ -12785,6 +12794,13 @@ var pxtblockly;
|
|
|
12785
12794
|
if (this.asset && !this.isTemporaryAsset()) {
|
|
12786
12795
|
return pxt.getTSReferenceForAsset(this.asset);
|
|
12787
12796
|
}
|
|
12797
|
+
else if (this.qName) {
|
|
12798
|
+
// check if image has been edited
|
|
12799
|
+
const data = qNameToBitmapData(this.qName);
|
|
12800
|
+
if (data && pxt.sprite.bitmapEquals(data, this.asset.bitmap)) {
|
|
12801
|
+
return this.qName;
|
|
12802
|
+
}
|
|
12803
|
+
}
|
|
12788
12804
|
return pxt.sprite.bitmapToImageLiteral(this.asset && pxt.sprite.Bitmap.fromData(this.asset.bitmap), "typescript" /* pxt.editor.FileType.TypeScript */);
|
|
12789
12805
|
}
|
|
12790
12806
|
parseFieldOptions(opts) {
|
|
@@ -12849,6 +12865,15 @@ var pxtblockly;
|
|
|
12849
12865
|
return res;
|
|
12850
12866
|
}
|
|
12851
12867
|
}
|
|
12868
|
+
function qNameToBitmapData(qName) {
|
|
12869
|
+
const project = pxt.react.getTilemapProject();
|
|
12870
|
+
const images = project.getGalleryAssets("image" /* pxt.AssetType.Image */).filter(asset => asset.id === qName);
|
|
12871
|
+
const img = images.length && images[0];
|
|
12872
|
+
if (img) {
|
|
12873
|
+
return img.bitmap;
|
|
12874
|
+
}
|
|
12875
|
+
return undefined;
|
|
12876
|
+
}
|
|
12852
12877
|
})(pxtblockly || (pxtblockly = {}));
|
|
12853
12878
|
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
12854
12879
|
var pxtblockly;
|
package/built/pxtlib.d.ts
CHANGED
package/built/pxtrunner.js
CHANGED
|
@@ -1574,6 +1574,7 @@ var pxt;
|
|
|
1574
1574
|
}
|
|
1575
1575
|
function initInnerAsync() {
|
|
1576
1576
|
pxt.setAppTarget(window.pxtTargetBundle);
|
|
1577
|
+
pxt.analytics.enable(pxt.Util.userLanguage());
|
|
1577
1578
|
pxt.Util.assert(!!pxt.appTarget);
|
|
1578
1579
|
const href = window.location.href;
|
|
1579
1580
|
let force = false;
|
|
@@ -1817,7 +1818,13 @@ var pxt;
|
|
|
1817
1818
|
runner.postSimMessage = postSimMessage;
|
|
1818
1819
|
async function fetchSimJsInfo(simOptions) {
|
|
1819
1820
|
try {
|
|
1820
|
-
|
|
1821
|
+
const start = Date.now();
|
|
1822
|
+
const result = await pxt.Cloud.downloadBuiltSimJsInfoAsync(simOptions.id);
|
|
1823
|
+
pxt.tickEvent("perfMeasurement", {
|
|
1824
|
+
durationMs: Date.now() - start,
|
|
1825
|
+
operation: "fetchSimJsInfo",
|
|
1826
|
+
});
|
|
1827
|
+
return result;
|
|
1821
1828
|
}
|
|
1822
1829
|
catch (e) {
|
|
1823
1830
|
// This exception will happen in the majority of cases, so we don't want to log it unless for debugging.
|
|
@@ -1828,6 +1835,7 @@ var pxt;
|
|
|
1828
1835
|
runner.fetchSimJsInfo = fetchSimJsInfo;
|
|
1829
1836
|
async function buildSimJsInfo(simOptions) {
|
|
1830
1837
|
var _a;
|
|
1838
|
+
const start = Date.now();
|
|
1831
1839
|
await loadPackageAsync(simOptions.id, simOptions.code, simOptions.dependencies);
|
|
1832
1840
|
let didUpgrade = false;
|
|
1833
1841
|
const currentTargetVersion = pxt.appTarget.versions.target;
|
|
@@ -1885,6 +1893,10 @@ var pxt;
|
|
|
1885
1893
|
}
|
|
1886
1894
|
const res = pxtc.buildSimJsInfo(compileResult);
|
|
1887
1895
|
res.parts = compileResult.usedParts;
|
|
1896
|
+
pxt.tickEvent("perfMeasurement", {
|
|
1897
|
+
durationMs: Date.now() - start,
|
|
1898
|
+
operation: "buildSimJsInfo",
|
|
1899
|
+
});
|
|
1888
1900
|
return res;
|
|
1889
1901
|
}
|
|
1890
1902
|
runner.buildSimJsInfo = buildSimJsInfo;
|
package/built/pxtsim.d.ts
CHANGED
|
@@ -386,6 +386,7 @@ declare namespace pxsim {
|
|
|
386
386
|
interface SimulatorBroadcastMessage extends SimulatorMessage {
|
|
387
387
|
broadcast: boolean;
|
|
388
388
|
toParentIFrameOnly?: boolean;
|
|
389
|
+
srcFrameIndex?: number;
|
|
389
390
|
}
|
|
390
391
|
interface SimulatorControlMessage extends SimulatorBroadcastMessage {
|
|
391
392
|
type: "messagepacket";
|
package/built/pxtsim.js
CHANGED
|
@@ -6253,6 +6253,8 @@ var pxsim;
|
|
|
6253
6253
|
let isDeferrableBroadcastMessage = false;
|
|
6254
6254
|
const broadcastmsg = msg;
|
|
6255
6255
|
if (source && (broadcastmsg === null || broadcastmsg === void 0 ? void 0 : broadcastmsg.broadcast)) {
|
|
6256
|
+
// include index of the source iframe
|
|
6257
|
+
broadcastmsg.srcFrameIndex = this.simFrames().findIndex((item) => item.contentWindow === source);
|
|
6256
6258
|
// if the editor is hosted in a multi-editor setting
|
|
6257
6259
|
// don't start extra frames
|
|
6258
6260
|
const single = !!((_a = this._currentRuntime) === null || _a === void 0 ? void 0 : _a.single);
|
package/built/server.js
CHANGED
|
@@ -24,7 +24,8 @@ let localHexCacheDir = path.join("built", "hexcache");
|
|
|
24
24
|
let serveOptions;
|
|
25
25
|
const webappNames = [
|
|
26
26
|
"kiosk",
|
|
27
|
-
"multiplayer"
|
|
27
|
+
"multiplayer",
|
|
28
|
+
"teachertool"
|
|
28
29
|
// TODO: Add other webapp names here: "skillmap", "authcode"
|
|
29
30
|
];
|
|
30
31
|
function setupDocfilesdirs() {
|