pxt-core 8.5.6 → 8.5.7
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/pxt.js +101 -23
- package/built/pxtblockly.js +0 -3
- package/built/pxtblocks.d.ts +0 -1
- package/built/pxtblocks.js +0 -3
- package/built/pxteditor.d.ts +2 -1
- package/built/pxtlib.d.ts +31 -5
- package/built/pxtlib.js +101 -23
- package/built/pxtrunner.js +1 -1
- package/built/target.js +1 -1
- package/built/web/icons.css +1 -1
- package/built/web/main.js +1 -1
- package/built/web/multiplayer/css/main.7e158d98.css +3 -0
- package/built/web/multiplayer/js/main.fce6612d.js +2 -0
- 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/pxtlib.js +1 -1
- package/built/web/pxtrunner.js +1 -1
- package/built/web/pxtworker.js +2 -2
- package/built/web/react-common-authcode.css +1 -1
- package/built/web/react-common-multiplayer.css +1 -1
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-authcode.css +1 -1
- package/built/web/rtlreact-common-multiplayer.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +2 -2
- package/built/web/semantic.css +2 -2
- package/built/web/skillmap/js/{main.65321de7.js → main.78314bdb.js} +2 -2
- package/common-docs/static/music-editor/bass-clef.svg +10 -0
- package/localtypings/pxtarget.d.ts +1 -1
- package/package.json +1 -1
- package/react-common/components/palette/ColorPickerField.tsx +2 -2
- package/react-common/components/palette/PalettePicker.tsx +1 -3
- package/react-common/components/palette/Palettes.ts +1 -0
- package/react-common/components/share/Share.tsx +19 -4
- package/react-common/components/share/ShareInfo.tsx +29 -9
- package/react-common/styles/controls/Button.less +45 -15
- package/react-common/styles/controls/Checkbox.less +3 -0
- package/react-common/styles/palette/ColorPickerField.less +4 -0
- package/react-common/styles/palette/PalettePicker.less +1 -0
- package/theme/asset-editor.less +7 -1
- package/theme/common.less +17 -10
- package/theme/image-editor/imageEditor.less +1 -1
- package/theme/music-editor/EditControls.less +1 -0
- package/theme/music-editor/MusicEditor.less +15 -0
- package/theme/music-editor/Note.less +8 -0
- package/theme/music-editor/PlaybackControls.less +20 -8
- package/theme/music-editor/ScrollableWorkspace.less +9 -0
- package/theme/music-editor/Staff.less +11 -5
- package/theme/music-editor/TrackSelector.less +25 -11
- package/theme/music-editor/Workspace.less +6 -1
- package/theme/tutorial-sidebar.less +1 -0
- package/webapp/public/multiplayer.html +1 -1
- package/webapp/public/skillmap.html +1 -1
- package/built/web/multiplayer/css/main.646bfc85.css +0 -3
- package/built/web/multiplayer/js/main.2f10b415.js +0 -2
package/built/pxt.js
CHANGED
|
@@ -97704,10 +97704,14 @@ var pxt;
|
|
|
97704
97704
|
});
|
|
97705
97705
|
}
|
|
97706
97706
|
analytics.addDefaultProperties = addDefaultProperties;
|
|
97707
|
-
function enable() {
|
|
97707
|
+
function enable(lang) {
|
|
97708
97708
|
if (!pxt.aiTrackException || !pxt.aiTrackEvent || enabled)
|
|
97709
97709
|
return;
|
|
97710
97710
|
enabled = true;
|
|
97711
|
+
if (typeof lang != "string" || lang.length == 0) {
|
|
97712
|
+
lang = "en"; //Always have a default language.
|
|
97713
|
+
}
|
|
97714
|
+
addDefaultProperties({ lang: lang });
|
|
97711
97715
|
pxt.debug('setting up app insights');
|
|
97712
97716
|
const te = pxt.tickEvent;
|
|
97713
97717
|
pxt.tickEvent = function (id, data, opts) {
|
|
@@ -97859,13 +97863,6 @@ var pxt;
|
|
|
97859
97863
|
const AUTH_LOGIN_STATE_KEY = "login-state"; // stored in local storage.
|
|
97860
97864
|
const AUTH_USER_STATE_KEY = "user-state"; // stored in local storage.
|
|
97861
97865
|
const X_PXT_TARGET = "x-pxt-target"; // header passed in auth rest calls.
|
|
97862
|
-
const DEV_BACKEND_DEFAULT = "";
|
|
97863
|
-
const DEV_BACKEND_PROD = "https://www.makecode.com";
|
|
97864
|
-
const DEV_BACKEND_STAGING = "https://staging.pxt.io";
|
|
97865
|
-
// Localhost endpoints. Ensure matching port number in pxt-backend/node/.vscode/launch.json
|
|
97866
|
-
const DEV_BACKEND_LOCALHOST_5500 = "http://localhost:5500"; // if running in Docker container
|
|
97867
|
-
const DEV_BACKEND_LOCALHOST_8080 = "http://localhost:8080"; // if not running in Docker
|
|
97868
|
-
const DEV_BACKEND = DEV_BACKEND_STAGING;
|
|
97869
97866
|
let authDisabled = false;
|
|
97870
97867
|
auth.DEFAULT_USER_PREFERENCES = () => ({
|
|
97871
97868
|
highContrast: false,
|
|
@@ -97927,7 +97924,7 @@ var pxt;
|
|
|
97927
97924
|
}
|
|
97928
97925
|
const currIdp = (_a = state.profile) === null || _a === void 0 ? void 0 : _a.idp;
|
|
97929
97926
|
// Check if we're already signed into this identity provider.
|
|
97930
|
-
if (currIdp === idp) {
|
|
97927
|
+
if ((currIdp === null || currIdp === void 0 ? void 0 : currIdp.provider) === idp) {
|
|
97931
97928
|
pxt.debug(`loginAsync: Already signed into ${idp}.`);
|
|
97932
97929
|
return;
|
|
97933
97930
|
}
|
|
@@ -98277,7 +98274,7 @@ var pxt;
|
|
|
98277
98274
|
headers["authorization"] = `mkcd ${csrfToken}`;
|
|
98278
98275
|
}
|
|
98279
98276
|
headers[X_PXT_TARGET] = (_a = pxt.appTarget) === null || _a === void 0 ? void 0 : _a.id;
|
|
98280
|
-
url = pxt.BrowserUtils.isLocalHostDev() ? `${DEV_BACKEND}${url}` : url;
|
|
98277
|
+
url = pxt.BrowserUtils.isLocalHostDev() ? `${pxt.cloud.DEV_BACKEND}${url}` : url;
|
|
98281
98278
|
return pxt.Util.requestAsync({
|
|
98282
98279
|
url,
|
|
98283
98280
|
headers,
|
|
@@ -98388,6 +98385,11 @@ var pxt;
|
|
|
98388
98385
|
return (_d = (_b = (_a = user === null || user === void 0 ? void 0 : user.idp) === null || _a === void 0 ? void 0 : _a.displayName) !== null && _b !== void 0 ? _b : (_c = user === null || user === void 0 ? void 0 : user.idp) === null || _c === void 0 ? void 0 : _c.username) !== null && _d !== void 0 ? _d : EMPTY_USERNAME;
|
|
98389
98386
|
}
|
|
98390
98387
|
auth.userName = userName;
|
|
98388
|
+
function identityProviderId() {
|
|
98389
|
+
var _a, _b, _c, _d;
|
|
98390
|
+
return (_d = (_c = (_b = (_a = client()) === null || _a === void 0 ? void 0 : _a.getState()) === null || _b === void 0 ? void 0 : _b.profile) === null || _c === void 0 ? void 0 : _c.idp) === null || _d === void 0 ? void 0 : _d.provider;
|
|
98391
|
+
}
|
|
98392
|
+
auth.identityProviderId = identityProviderId;
|
|
98391
98393
|
function firstName(user) {
|
|
98392
98394
|
const userName = pxt.auth.userName(user);
|
|
98393
98395
|
return (userName === null || userName === void 0 ? void 0 : userName.split(" ").shift()) || userName;
|
|
@@ -99993,8 +99995,10 @@ var ts;
|
|
|
99993
99995
|
const liveUpdateStrings = pxt.Util.liveLocalizationEnabled();
|
|
99994
99996
|
return downloadTranslationsAsync(targetId, baseUrl, code, pxtBranch, targetBranch, liveUpdateStrings, ts.pxtc.Util.TranslationsKind.Editor)
|
|
99995
99997
|
.then((translations) => {
|
|
99998
|
+
var _a;
|
|
99996
99999
|
if (translations) {
|
|
99997
100000
|
Util.setUserLanguage(code);
|
|
100001
|
+
(_a = pxt.analytics) === null || _a === void 0 ? void 0 : _a.addDefaultProperties({ lang: code }); //set the new language in analytics.
|
|
99998
100002
|
Util.setLocalizedStrings(translations);
|
|
99999
100003
|
}
|
|
100000
100004
|
// Download api translations
|
|
@@ -101422,6 +101426,7 @@ var pxt;
|
|
|
101422
101426
|
pxt.TUTORIAL_INFO_FILE = "tutorial-info-cache.json";
|
|
101423
101427
|
pxt.TUTORIAL_CUSTOM_TS = "tutorial.custom.ts";
|
|
101424
101428
|
pxt.BREAKPOINT_TABLET = 991; // TODO (shakao) revisit when tutorial stuff is more settled
|
|
101429
|
+
pxt.PALETTES_FILE = "_palettes.json";
|
|
101425
101430
|
function outputName(trg = null) {
|
|
101426
101431
|
if (!trg)
|
|
101427
101432
|
trg = pxt.appTarget.compile;
|
|
@@ -103483,6 +103488,20 @@ var pxt;
|
|
|
103483
103488
|
(function (pxt) {
|
|
103484
103489
|
var cloud;
|
|
103485
103490
|
(function (cloud) {
|
|
103491
|
+
const DEV_BACKEND_PROD = "https://www.makecode.com";
|
|
103492
|
+
const DEV_BACKEND_STAGING = "https://staging.pxt.io";
|
|
103493
|
+
const DEV_BACKEND_LOCALHOST = "http://localhost:8080";
|
|
103494
|
+
cloud.DEV_BACKEND = DEV_BACKEND_PROD;
|
|
103495
|
+
function devBackendType() {
|
|
103496
|
+
if (cloud.DEV_BACKEND === DEV_BACKEND_PROD)
|
|
103497
|
+
return "prod";
|
|
103498
|
+
if (cloud.DEV_BACKEND === DEV_BACKEND_STAGING)
|
|
103499
|
+
return "staging";
|
|
103500
|
+
if (cloud.DEV_BACKEND === DEV_BACKEND_LOCALHOST)
|
|
103501
|
+
return "localhost";
|
|
103502
|
+
return "prod";
|
|
103503
|
+
}
|
|
103504
|
+
cloud.devBackendType = devBackendType;
|
|
103486
103505
|
cloud.cloudStatus = {
|
|
103487
103506
|
"none": {
|
|
103488
103507
|
value: "none",
|
|
@@ -109557,16 +109576,7 @@ var pxt;
|
|
|
109557
109576
|
return [(v >> 0) & 0xff, (v >> 8) & 0xff, (v >> 16) & 0xff, 0xff];
|
|
109558
109577
|
}
|
|
109559
109578
|
if (!this.palette) {
|
|
109560
|
-
|
|
109561
|
-
// Set the alpha for transparency at index 0
|
|
109562
|
-
arrs[0][3] = 0;
|
|
109563
|
-
this.palette = new Uint8Array(arrs.length * 4);
|
|
109564
|
-
for (let i = 0; i < arrs.length; ++i) {
|
|
109565
|
-
this.palette[i * 4 + 0] = arrs[i][0];
|
|
109566
|
-
this.palette[i * 4 + 1] = arrs[i][1];
|
|
109567
|
-
this.palette[i * 4 + 2] = arrs[i][2];
|
|
109568
|
-
this.palette[i * 4 + 3] = arrs[i][3];
|
|
109569
|
-
}
|
|
109579
|
+
this.setPalette(pxt.appTarget.runtime.palette.map(htmlColorToBytes));
|
|
109570
109580
|
}
|
|
109571
109581
|
if (magic == 0xe1) {
|
|
109572
109582
|
return this.genMonochrome(data, w, h);
|
|
@@ -109574,6 +109584,18 @@ var pxt;
|
|
|
109574
109584
|
const scaleFactor = ((pxt.BrowserUtils.isEdge() || pxt.BrowserUtils.isIE()) && w < 100 && h < 100) ? 3 : 1;
|
|
109575
109585
|
return this.genColor(data, w, h, scaleFactor);
|
|
109576
109586
|
}
|
|
109587
|
+
// p: [[r,g,b,a?], [r,g,b,a?], ...]
|
|
109588
|
+
setPalette(paletteArrays) {
|
|
109589
|
+
// Set the alpha for transparency at index 0
|
|
109590
|
+
paletteArrays[0][3] = 0;
|
|
109591
|
+
this.palette = new Uint8Array(paletteArrays.length * 4);
|
|
109592
|
+
for (let i = 0; i < paletteArrays.length; ++i) {
|
|
109593
|
+
this.palette[i * 4 + 0] = paletteArrays[i][0];
|
|
109594
|
+
this.palette[i * 4 + 1] = paletteArrays[i][1];
|
|
109595
|
+
this.palette[i * 4 + 2] = paletteArrays[i][2];
|
|
109596
|
+
this.palette[i * 4 + 3] = paletteArrays[i][3];
|
|
109597
|
+
}
|
|
109598
|
+
}
|
|
109577
109599
|
genMonochrome(data, w, h) {
|
|
109578
109600
|
let outByteW = (w + 3) & ~3;
|
|
109579
109601
|
let bmpHeaderSize = 14 + 40 + this.palette.length;
|
|
@@ -111379,6 +111401,53 @@ var pxt;
|
|
|
111379
111401
|
})(storage = pxt.storage || (pxt.storage = {}));
|
|
111380
111402
|
})(pxt || (pxt = {}));
|
|
111381
111403
|
var pxt;
|
|
111404
|
+
(function (pxt) {
|
|
111405
|
+
var multiplayer;
|
|
111406
|
+
(function (multiplayer) {
|
|
111407
|
+
multiplayer.SHORT_LINKS = {
|
|
111408
|
+
PROD: "https://aka.ms/a9",
|
|
111409
|
+
PROD_BETA: "https://aka.ms/a9b",
|
|
111410
|
+
STAGING: "https://aka.ms/a9s",
|
|
111411
|
+
STAGING_BETA: "https://aka.ms/a9sb",
|
|
111412
|
+
LOCAL: "http://localhost:3000"
|
|
111413
|
+
};
|
|
111414
|
+
multiplayer.SHORT_LINK = () => {
|
|
111415
|
+
if (pxt.BrowserUtils.isLocalHostDev()) {
|
|
111416
|
+
switch (pxt.cloud.devBackendType()) {
|
|
111417
|
+
case "prod":
|
|
111418
|
+
return multiplayer.SHORT_LINKS.PROD_BETA;
|
|
111419
|
+
case "staging":
|
|
111420
|
+
return multiplayer.SHORT_LINKS.STAGING_BETA;
|
|
111421
|
+
case "localhost":
|
|
111422
|
+
return multiplayer.SHORT_LINKS.LOCAL;
|
|
111423
|
+
}
|
|
111424
|
+
}
|
|
111425
|
+
if (window.location.host.endsWith(".staging.pxt.io")) {
|
|
111426
|
+
if (window.location.pathname.startsWith("/beta")) {
|
|
111427
|
+
return multiplayer.SHORT_LINKS.STAGING_BETA;
|
|
111428
|
+
}
|
|
111429
|
+
else {
|
|
111430
|
+
return multiplayer.SHORT_LINKS.STAGING;
|
|
111431
|
+
}
|
|
111432
|
+
}
|
|
111433
|
+
if (window.location.pathname.startsWith("/beta")) {
|
|
111434
|
+
return multiplayer.SHORT_LINKS.PROD_BETA;
|
|
111435
|
+
}
|
|
111436
|
+
else {
|
|
111437
|
+
return multiplayer.SHORT_LINKS.PROD;
|
|
111438
|
+
}
|
|
111439
|
+
};
|
|
111440
|
+
function makeHostLink(shareUrlOrCode) {
|
|
111441
|
+
return `${multiplayer.SHORT_LINK()}?host=${encodeURIComponent(shareUrlOrCode)}`;
|
|
111442
|
+
}
|
|
111443
|
+
multiplayer.makeHostLink = makeHostLink;
|
|
111444
|
+
function makeJoinLink(joinCode) {
|
|
111445
|
+
return `${multiplayer.SHORT_LINK()}?join=${encodeURIComponent(joinCode)}`;
|
|
111446
|
+
}
|
|
111447
|
+
multiplayer.makeJoinLink = makeJoinLink;
|
|
111448
|
+
})(multiplayer = pxt.multiplayer || (pxt.multiplayer = {}));
|
|
111449
|
+
})(pxt || (pxt = {}));
|
|
111450
|
+
var pxt;
|
|
111382
111451
|
(function (pxt) {
|
|
111383
111452
|
var assets;
|
|
111384
111453
|
(function (assets) {
|
|
@@ -111918,6 +111987,15 @@ var pxt;
|
|
|
111918
111987
|
});
|
|
111919
111988
|
}
|
|
111920
111989
|
music.inflateSong = inflateSong;
|
|
111990
|
+
function getSongInfo(song) {
|
|
111991
|
+
return {
|
|
111992
|
+
ticksPerBeat: song.ticksPerBeat,
|
|
111993
|
+
beatsPerMeasure: song.beatsPerMeasure,
|
|
111994
|
+
beatsPerMinute: song.beatsPerMinute,
|
|
111995
|
+
measures: song.measures
|
|
111996
|
+
};
|
|
111997
|
+
}
|
|
111998
|
+
music.getSongInfo = getSongInfo;
|
|
111921
111999
|
function getEmptySong(measures) {
|
|
111922
112000
|
return {
|
|
111923
112001
|
ticksPerBeat: 8,
|
|
@@ -112059,7 +112137,7 @@ var pxt;
|
|
|
112059
112137
|
iconURI: "/static/music-editor/computer.png",
|
|
112060
112138
|
instrument: {
|
|
112061
112139
|
waveform: 15,
|
|
112062
|
-
octave:
|
|
112140
|
+
octave: 2,
|
|
112063
112141
|
ampEnvelope: {
|
|
112064
112142
|
attack: 10,
|
|
112065
112143
|
decay: 100,
|
|
@@ -112076,7 +112154,7 @@ var pxt;
|
|
|
112076
112154
|
iconURI: "/static/music-editor/burger.png",
|
|
112077
112155
|
instrument: {
|
|
112078
112156
|
waveform: 1,
|
|
112079
|
-
octave:
|
|
112157
|
+
octave: 2,
|
|
112080
112158
|
ampEnvelope: {
|
|
112081
112159
|
attack: 10,
|
|
112082
112160
|
decay: 100,
|
|
@@ -112122,7 +112200,7 @@ var pxt;
|
|
|
112122
112200
|
},
|
|
112123
112201
|
{
|
|
112124
112202
|
id: 9,
|
|
112125
|
-
name: lf("
|
|
112203
|
+
name: lf("Drums"),
|
|
112126
112204
|
notes: [],
|
|
112127
112205
|
iconURI: "/static/music-editor/explosion.png",
|
|
112128
112206
|
instrument: {
|
package/built/pxtblockly.js
CHANGED
|
@@ -14755,9 +14755,6 @@ var pxtblockly;
|
|
|
14755
14755
|
parseFieldOptions(opts) {
|
|
14756
14756
|
return {};
|
|
14757
14757
|
}
|
|
14758
|
-
isFullscreen() {
|
|
14759
|
-
return false;
|
|
14760
|
-
}
|
|
14761
14758
|
redrawPreview() {
|
|
14762
14759
|
var _a;
|
|
14763
14760
|
if (!this.fieldGroup_)
|
package/built/pxtblocks.d.ts
CHANGED
|
@@ -999,7 +999,6 @@ declare namespace pxtblockly {
|
|
|
999
999
|
render_(): void;
|
|
1000
1000
|
protected getValueText(): string;
|
|
1001
1001
|
protected parseFieldOptions(opts: FieldMusicEditorOptions): ParsedFieldMusicEditorOptions;
|
|
1002
|
-
protected isFullscreen(): boolean;
|
|
1003
1002
|
protected redrawPreview(): void;
|
|
1004
1003
|
protected previewWidth(): number;
|
|
1005
1004
|
}
|
package/built/pxtblocks.js
CHANGED
|
@@ -11193,9 +11193,6 @@ var pxtblockly;
|
|
|
11193
11193
|
parseFieldOptions(opts) {
|
|
11194
11194
|
return {};
|
|
11195
11195
|
}
|
|
11196
|
-
isFullscreen() {
|
|
11197
|
-
return false;
|
|
11198
|
-
}
|
|
11199
11196
|
redrawPreview() {
|
|
11200
11197
|
var _a;
|
|
11201
11198
|
if (!this.fieldGroup_)
|
package/built/pxteditor.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ declare namespace pxt.editor {
|
|
|
89
89
|
errorListState?: ErrorListState;
|
|
90
90
|
screenshoting?: boolean;
|
|
91
91
|
extensionsVisible?: boolean;
|
|
92
|
+
isMultiplayerGame?: boolean;
|
|
92
93
|
}
|
|
93
94
|
interface EditorState {
|
|
94
95
|
filters?: pxt.editor.ProjectFilters;
|
|
@@ -317,7 +318,7 @@ declare namespace pxt.editor {
|
|
|
317
318
|
toggleKeymap(): void;
|
|
318
319
|
showReportAbuse(): void;
|
|
319
320
|
showLanguagePicker(): void;
|
|
320
|
-
showShareDialog(title?: string): void;
|
|
321
|
+
showShareDialog(title?: string, forMultiplayer?: boolean): void;
|
|
321
322
|
showAboutDialog(): void;
|
|
322
323
|
showLoginDialog(continuationHash?: string): void;
|
|
323
324
|
showProfileDialog(location?: string): void;
|
package/built/pxtlib.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare namespace pxt {
|
|
|
14
14
|
}
|
|
15
15
|
declare namespace pxt.analytics {
|
|
16
16
|
function addDefaultProperties(props: Map<string | number>): void;
|
|
17
|
-
function enable(): void;
|
|
17
|
+
function enable(lang: string): void;
|
|
18
18
|
}
|
|
19
19
|
declare namespace pxt {
|
|
20
20
|
let appTarget: TargetBundle;
|
|
@@ -178,6 +178,7 @@ declare namespace pxt.auth {
|
|
|
178
178
|
function hasIdentity(): boolean;
|
|
179
179
|
function enableAuth(enabled?: boolean): void;
|
|
180
180
|
function userName(user: pxt.auth.UserProfile): string;
|
|
181
|
+
function identityProviderId(): pxt.IdentityProviderId | undefined;
|
|
181
182
|
function firstName(user: pxt.auth.UserProfile): string;
|
|
182
183
|
function userInitials(user: pxt.auth.UserProfile): string;
|
|
183
184
|
function generateUserProfilePicDataUrl(profile: pxt.auth.UserProfile): void;
|
|
@@ -617,6 +618,7 @@ declare namespace pxt {
|
|
|
617
618
|
const TUTORIAL_INFO_FILE = "tutorial-info-cache.json";
|
|
618
619
|
const TUTORIAL_CUSTOM_TS = "tutorial.custom.ts";
|
|
619
620
|
const BREAKPOINT_TABLET = 991;
|
|
621
|
+
const PALETTES_FILE = "_palettes.json";
|
|
620
622
|
function outputName(trg?: pxtc.CompileTarget): "binary.uf2" | "binary.bin" | "binary.pxt64" | "binary.elf" | "binary.hex";
|
|
621
623
|
function isOutputText(trg?: pxtc.CompileTarget): boolean;
|
|
622
624
|
}
|
|
@@ -867,8 +869,15 @@ declare namespace pxt.BrowserUtils {
|
|
|
867
869
|
export {};
|
|
868
870
|
}
|
|
869
871
|
declare namespace pxt.cloud {
|
|
870
|
-
type
|
|
871
|
-
|
|
872
|
+
export type DevBackendType = "default" | "prod" | "staging" | "localhost";
|
|
873
|
+
const DEV_BACKEND_PROD = "https://www.makecode.com";
|
|
874
|
+
const DEV_BACKEND_STAGING = "https://staging.pxt.io";
|
|
875
|
+
const DEV_BACKEND_LOCALHOST = "http://localhost:8080";
|
|
876
|
+
type BackendUrls = typeof DEV_BACKEND_PROD | typeof DEV_BACKEND_STAGING | typeof DEV_BACKEND_LOCALHOST;
|
|
877
|
+
export const DEV_BACKEND: BackendUrls;
|
|
878
|
+
export function devBackendType(): DevBackendType;
|
|
879
|
+
export type CloudStatus = "none" | "synced" | "justSynced" | "offline" | "syncing" | "conflict" | "localEdits";
|
|
880
|
+
export type CloudStatusInfo = {
|
|
872
881
|
value: pxt.cloud.CloudStatus;
|
|
873
882
|
icon?: string;
|
|
874
883
|
tooltip?: string;
|
|
@@ -876,9 +885,10 @@ declare namespace pxt.cloud {
|
|
|
876
885
|
longStatus?: string;
|
|
877
886
|
indicator?: string;
|
|
878
887
|
};
|
|
879
|
-
const cloudStatus: {
|
|
888
|
+
export const cloudStatus: {
|
|
880
889
|
[index in pxt.cloud.CloudStatus]: CloudStatusInfo;
|
|
881
890
|
};
|
|
891
|
+
export {};
|
|
882
892
|
}
|
|
883
893
|
declare namespace pxt.commands {
|
|
884
894
|
interface RecompileOptions {
|
|
@@ -1527,6 +1537,7 @@ declare namespace pxt {
|
|
|
1527
1537
|
private start;
|
|
1528
1538
|
logTime(): void;
|
|
1529
1539
|
convert(jresURL: string): string;
|
|
1540
|
+
setPalette(paletteArrays: number[][]): void;
|
|
1530
1541
|
genMonochrome(data: string, w: number, h: number): string;
|
|
1531
1542
|
genColor(data: string, width: number, height: number, intScale: number): string;
|
|
1532
1543
|
}
|
|
@@ -1768,6 +1779,18 @@ declare namespace pxt.storage.shared {
|
|
|
1768
1779
|
function setAsync(container: string, key: string, val: any): Promise<void>;
|
|
1769
1780
|
function delAsync(container: string, key: string): Promise<void>;
|
|
1770
1781
|
}
|
|
1782
|
+
declare namespace pxt.multiplayer {
|
|
1783
|
+
const SHORT_LINKS: {
|
|
1784
|
+
PROD: string;
|
|
1785
|
+
PROD_BETA: string;
|
|
1786
|
+
STAGING: string;
|
|
1787
|
+
STAGING_BETA: string;
|
|
1788
|
+
LOCAL: string;
|
|
1789
|
+
};
|
|
1790
|
+
const SHORT_LINK: () => string;
|
|
1791
|
+
function makeHostLink(shareUrlOrCode: string): string;
|
|
1792
|
+
function makeJoinLink(joinCode: string): string;
|
|
1793
|
+
}
|
|
1771
1794
|
declare namespace pxt.assets.music {
|
|
1772
1795
|
interface Instrument {
|
|
1773
1796
|
waveform: number;
|
|
@@ -1788,11 +1811,13 @@ declare namespace pxt.assets.music {
|
|
|
1788
1811
|
frequency: number;
|
|
1789
1812
|
amplitude: number;
|
|
1790
1813
|
}
|
|
1791
|
-
interface
|
|
1814
|
+
interface SongInfo {
|
|
1792
1815
|
measures: number;
|
|
1793
1816
|
beatsPerMeasure: number;
|
|
1794
1817
|
beatsPerMinute: number;
|
|
1795
1818
|
ticksPerBeat: number;
|
|
1819
|
+
}
|
|
1820
|
+
interface Song extends SongInfo {
|
|
1796
1821
|
tracks: Track[];
|
|
1797
1822
|
}
|
|
1798
1823
|
interface Track {
|
|
@@ -1826,6 +1851,7 @@ declare namespace pxt.assets.music {
|
|
|
1826
1851
|
function cloneSong(song: Song): Song;
|
|
1827
1852
|
function songEquals(a: Song, b: Song): boolean;
|
|
1828
1853
|
function inflateSong(song: pxt.assets.music.Song): void;
|
|
1854
|
+
function getSongInfo(song: pxt.assets.music.Song): SongInfo;
|
|
1829
1855
|
function getEmptySong(measures: number): pxt.assets.music.Song;
|
|
1830
1856
|
}
|
|
1831
1857
|
declare namespace pxt {
|
package/built/pxtlib.js
CHANGED
|
@@ -18,10 +18,14 @@ var pxt;
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
analytics.addDefaultProperties = addDefaultProperties;
|
|
21
|
-
function enable() {
|
|
21
|
+
function enable(lang) {
|
|
22
22
|
if (!pxt.aiTrackException || !pxt.aiTrackEvent || enabled)
|
|
23
23
|
return;
|
|
24
24
|
enabled = true;
|
|
25
|
+
if (typeof lang != "string" || lang.length == 0) {
|
|
26
|
+
lang = "en"; //Always have a default language.
|
|
27
|
+
}
|
|
28
|
+
addDefaultProperties({ lang: lang });
|
|
25
29
|
pxt.debug('setting up app insights');
|
|
26
30
|
const te = pxt.tickEvent;
|
|
27
31
|
pxt.tickEvent = function (id, data, opts) {
|
|
@@ -173,13 +177,6 @@ var pxt;
|
|
|
173
177
|
const AUTH_LOGIN_STATE_KEY = "login-state"; // stored in local storage.
|
|
174
178
|
const AUTH_USER_STATE_KEY = "user-state"; // stored in local storage.
|
|
175
179
|
const X_PXT_TARGET = "x-pxt-target"; // header passed in auth rest calls.
|
|
176
|
-
const DEV_BACKEND_DEFAULT = "";
|
|
177
|
-
const DEV_BACKEND_PROD = "https://www.makecode.com";
|
|
178
|
-
const DEV_BACKEND_STAGING = "https://staging.pxt.io";
|
|
179
|
-
// Localhost endpoints. Ensure matching port number in pxt-backend/node/.vscode/launch.json
|
|
180
|
-
const DEV_BACKEND_LOCALHOST_5500 = "http://localhost:5500"; // if running in Docker container
|
|
181
|
-
const DEV_BACKEND_LOCALHOST_8080 = "http://localhost:8080"; // if not running in Docker
|
|
182
|
-
const DEV_BACKEND = DEV_BACKEND_STAGING;
|
|
183
180
|
let authDisabled = false;
|
|
184
181
|
auth.DEFAULT_USER_PREFERENCES = () => ({
|
|
185
182
|
highContrast: false,
|
|
@@ -241,7 +238,7 @@ var pxt;
|
|
|
241
238
|
}
|
|
242
239
|
const currIdp = (_a = state.profile) === null || _a === void 0 ? void 0 : _a.idp;
|
|
243
240
|
// Check if we're already signed into this identity provider.
|
|
244
|
-
if (currIdp === idp) {
|
|
241
|
+
if ((currIdp === null || currIdp === void 0 ? void 0 : currIdp.provider) === idp) {
|
|
245
242
|
pxt.debug(`loginAsync: Already signed into ${idp}.`);
|
|
246
243
|
return;
|
|
247
244
|
}
|
|
@@ -591,7 +588,7 @@ var pxt;
|
|
|
591
588
|
headers["authorization"] = `mkcd ${csrfToken}`;
|
|
592
589
|
}
|
|
593
590
|
headers[X_PXT_TARGET] = (_a = pxt.appTarget) === null || _a === void 0 ? void 0 : _a.id;
|
|
594
|
-
url = pxt.BrowserUtils.isLocalHostDev() ? `${DEV_BACKEND}${url}` : url;
|
|
591
|
+
url = pxt.BrowserUtils.isLocalHostDev() ? `${pxt.cloud.DEV_BACKEND}${url}` : url;
|
|
595
592
|
return pxt.Util.requestAsync({
|
|
596
593
|
url,
|
|
597
594
|
headers,
|
|
@@ -702,6 +699,11 @@ var pxt;
|
|
|
702
699
|
return (_d = (_b = (_a = user === null || user === void 0 ? void 0 : user.idp) === null || _a === void 0 ? void 0 : _a.displayName) !== null && _b !== void 0 ? _b : (_c = user === null || user === void 0 ? void 0 : user.idp) === null || _c === void 0 ? void 0 : _c.username) !== null && _d !== void 0 ? _d : EMPTY_USERNAME;
|
|
703
700
|
}
|
|
704
701
|
auth.userName = userName;
|
|
702
|
+
function identityProviderId() {
|
|
703
|
+
var _a, _b, _c, _d;
|
|
704
|
+
return (_d = (_c = (_b = (_a = client()) === null || _a === void 0 ? void 0 : _a.getState()) === null || _b === void 0 ? void 0 : _b.profile) === null || _c === void 0 ? void 0 : _c.idp) === null || _d === void 0 ? void 0 : _d.provider;
|
|
705
|
+
}
|
|
706
|
+
auth.identityProviderId = identityProviderId;
|
|
705
707
|
function firstName(user) {
|
|
706
708
|
const userName = pxt.auth.userName(user);
|
|
707
709
|
return (userName === null || userName === void 0 ? void 0 : userName.split(" ").shift()) || userName;
|
|
@@ -2307,8 +2309,10 @@ var ts;
|
|
|
2307
2309
|
const liveUpdateStrings = pxt.Util.liveLocalizationEnabled();
|
|
2308
2310
|
return downloadTranslationsAsync(targetId, baseUrl, code, pxtBranch, targetBranch, liveUpdateStrings, ts.pxtc.Util.TranslationsKind.Editor)
|
|
2309
2311
|
.then((translations) => {
|
|
2312
|
+
var _a;
|
|
2310
2313
|
if (translations) {
|
|
2311
2314
|
Util.setUserLanguage(code);
|
|
2315
|
+
(_a = pxt.analytics) === null || _a === void 0 ? void 0 : _a.addDefaultProperties({ lang: code }); //set the new language in analytics.
|
|
2312
2316
|
Util.setLocalizedStrings(translations);
|
|
2313
2317
|
}
|
|
2314
2318
|
// Download api translations
|
|
@@ -3736,6 +3740,7 @@ var pxt;
|
|
|
3736
3740
|
pxt.TUTORIAL_INFO_FILE = "tutorial-info-cache.json";
|
|
3737
3741
|
pxt.TUTORIAL_CUSTOM_TS = "tutorial.custom.ts";
|
|
3738
3742
|
pxt.BREAKPOINT_TABLET = 991; // TODO (shakao) revisit when tutorial stuff is more settled
|
|
3743
|
+
pxt.PALETTES_FILE = "_palettes.json";
|
|
3739
3744
|
function outputName(trg = null) {
|
|
3740
3745
|
if (!trg)
|
|
3741
3746
|
trg = pxt.appTarget.compile;
|
|
@@ -5797,6 +5802,20 @@ var pxt;
|
|
|
5797
5802
|
(function (pxt) {
|
|
5798
5803
|
var cloud;
|
|
5799
5804
|
(function (cloud) {
|
|
5805
|
+
const DEV_BACKEND_PROD = "https://www.makecode.com";
|
|
5806
|
+
const DEV_BACKEND_STAGING = "https://staging.pxt.io";
|
|
5807
|
+
const DEV_BACKEND_LOCALHOST = "http://localhost:8080";
|
|
5808
|
+
cloud.DEV_BACKEND = DEV_BACKEND_PROD;
|
|
5809
|
+
function devBackendType() {
|
|
5810
|
+
if (cloud.DEV_BACKEND === DEV_BACKEND_PROD)
|
|
5811
|
+
return "prod";
|
|
5812
|
+
if (cloud.DEV_BACKEND === DEV_BACKEND_STAGING)
|
|
5813
|
+
return "staging";
|
|
5814
|
+
if (cloud.DEV_BACKEND === DEV_BACKEND_LOCALHOST)
|
|
5815
|
+
return "localhost";
|
|
5816
|
+
return "prod";
|
|
5817
|
+
}
|
|
5818
|
+
cloud.devBackendType = devBackendType;
|
|
5800
5819
|
cloud.cloudStatus = {
|
|
5801
5820
|
"none": {
|
|
5802
5821
|
value: "none",
|
|
@@ -11871,16 +11890,7 @@ var pxt;
|
|
|
11871
11890
|
return [(v >> 0) & 0xff, (v >> 8) & 0xff, (v >> 16) & 0xff, 0xff];
|
|
11872
11891
|
}
|
|
11873
11892
|
if (!this.palette) {
|
|
11874
|
-
|
|
11875
|
-
// Set the alpha for transparency at index 0
|
|
11876
|
-
arrs[0][3] = 0;
|
|
11877
|
-
this.palette = new Uint8Array(arrs.length * 4);
|
|
11878
|
-
for (let i = 0; i < arrs.length; ++i) {
|
|
11879
|
-
this.palette[i * 4 + 0] = arrs[i][0];
|
|
11880
|
-
this.palette[i * 4 + 1] = arrs[i][1];
|
|
11881
|
-
this.palette[i * 4 + 2] = arrs[i][2];
|
|
11882
|
-
this.palette[i * 4 + 3] = arrs[i][3];
|
|
11883
|
-
}
|
|
11893
|
+
this.setPalette(pxt.appTarget.runtime.palette.map(htmlColorToBytes));
|
|
11884
11894
|
}
|
|
11885
11895
|
if (magic == 0xe1) {
|
|
11886
11896
|
return this.genMonochrome(data, w, h);
|
|
@@ -11888,6 +11898,18 @@ var pxt;
|
|
|
11888
11898
|
const scaleFactor = ((pxt.BrowserUtils.isEdge() || pxt.BrowserUtils.isIE()) && w < 100 && h < 100) ? 3 : 1;
|
|
11889
11899
|
return this.genColor(data, w, h, scaleFactor);
|
|
11890
11900
|
}
|
|
11901
|
+
// p: [[r,g,b,a?], [r,g,b,a?], ...]
|
|
11902
|
+
setPalette(paletteArrays) {
|
|
11903
|
+
// Set the alpha for transparency at index 0
|
|
11904
|
+
paletteArrays[0][3] = 0;
|
|
11905
|
+
this.palette = new Uint8Array(paletteArrays.length * 4);
|
|
11906
|
+
for (let i = 0; i < paletteArrays.length; ++i) {
|
|
11907
|
+
this.palette[i * 4 + 0] = paletteArrays[i][0];
|
|
11908
|
+
this.palette[i * 4 + 1] = paletteArrays[i][1];
|
|
11909
|
+
this.palette[i * 4 + 2] = paletteArrays[i][2];
|
|
11910
|
+
this.palette[i * 4 + 3] = paletteArrays[i][3];
|
|
11911
|
+
}
|
|
11912
|
+
}
|
|
11891
11913
|
genMonochrome(data, w, h) {
|
|
11892
11914
|
let outByteW = (w + 3) & ~3;
|
|
11893
11915
|
let bmpHeaderSize = 14 + 40 + this.palette.length;
|
|
@@ -13693,6 +13715,53 @@ var pxt;
|
|
|
13693
13715
|
})(storage = pxt.storage || (pxt.storage = {}));
|
|
13694
13716
|
})(pxt || (pxt = {}));
|
|
13695
13717
|
var pxt;
|
|
13718
|
+
(function (pxt) {
|
|
13719
|
+
var multiplayer;
|
|
13720
|
+
(function (multiplayer) {
|
|
13721
|
+
multiplayer.SHORT_LINKS = {
|
|
13722
|
+
PROD: "https://aka.ms/a9",
|
|
13723
|
+
PROD_BETA: "https://aka.ms/a9b",
|
|
13724
|
+
STAGING: "https://aka.ms/a9s",
|
|
13725
|
+
STAGING_BETA: "https://aka.ms/a9sb",
|
|
13726
|
+
LOCAL: "http://localhost:3000"
|
|
13727
|
+
};
|
|
13728
|
+
multiplayer.SHORT_LINK = () => {
|
|
13729
|
+
if (pxt.BrowserUtils.isLocalHostDev()) {
|
|
13730
|
+
switch (pxt.cloud.devBackendType()) {
|
|
13731
|
+
case "prod":
|
|
13732
|
+
return multiplayer.SHORT_LINKS.PROD_BETA;
|
|
13733
|
+
case "staging":
|
|
13734
|
+
return multiplayer.SHORT_LINKS.STAGING_BETA;
|
|
13735
|
+
case "localhost":
|
|
13736
|
+
return multiplayer.SHORT_LINKS.LOCAL;
|
|
13737
|
+
}
|
|
13738
|
+
}
|
|
13739
|
+
if (window.location.host.endsWith(".staging.pxt.io")) {
|
|
13740
|
+
if (window.location.pathname.startsWith("/beta")) {
|
|
13741
|
+
return multiplayer.SHORT_LINKS.STAGING_BETA;
|
|
13742
|
+
}
|
|
13743
|
+
else {
|
|
13744
|
+
return multiplayer.SHORT_LINKS.STAGING;
|
|
13745
|
+
}
|
|
13746
|
+
}
|
|
13747
|
+
if (window.location.pathname.startsWith("/beta")) {
|
|
13748
|
+
return multiplayer.SHORT_LINKS.PROD_BETA;
|
|
13749
|
+
}
|
|
13750
|
+
else {
|
|
13751
|
+
return multiplayer.SHORT_LINKS.PROD;
|
|
13752
|
+
}
|
|
13753
|
+
};
|
|
13754
|
+
function makeHostLink(shareUrlOrCode) {
|
|
13755
|
+
return `${multiplayer.SHORT_LINK()}?host=${encodeURIComponent(shareUrlOrCode)}`;
|
|
13756
|
+
}
|
|
13757
|
+
multiplayer.makeHostLink = makeHostLink;
|
|
13758
|
+
function makeJoinLink(joinCode) {
|
|
13759
|
+
return `${multiplayer.SHORT_LINK()}?join=${encodeURIComponent(joinCode)}`;
|
|
13760
|
+
}
|
|
13761
|
+
multiplayer.makeJoinLink = makeJoinLink;
|
|
13762
|
+
})(multiplayer = pxt.multiplayer || (pxt.multiplayer = {}));
|
|
13763
|
+
})(pxt || (pxt = {}));
|
|
13764
|
+
var pxt;
|
|
13696
13765
|
(function (pxt) {
|
|
13697
13766
|
var assets;
|
|
13698
13767
|
(function (assets) {
|
|
@@ -14232,6 +14301,15 @@ var pxt;
|
|
|
14232
14301
|
});
|
|
14233
14302
|
}
|
|
14234
14303
|
music.inflateSong = inflateSong;
|
|
14304
|
+
function getSongInfo(song) {
|
|
14305
|
+
return {
|
|
14306
|
+
ticksPerBeat: song.ticksPerBeat,
|
|
14307
|
+
beatsPerMeasure: song.beatsPerMeasure,
|
|
14308
|
+
beatsPerMinute: song.beatsPerMinute,
|
|
14309
|
+
measures: song.measures
|
|
14310
|
+
};
|
|
14311
|
+
}
|
|
14312
|
+
music.getSongInfo = getSongInfo;
|
|
14235
14313
|
function getEmptySong(measures) {
|
|
14236
14314
|
return {
|
|
14237
14315
|
ticksPerBeat: 8,
|
|
@@ -14373,7 +14451,7 @@ var pxt;
|
|
|
14373
14451
|
iconURI: "/static/music-editor/computer.png",
|
|
14374
14452
|
instrument: {
|
|
14375
14453
|
waveform: 15,
|
|
14376
|
-
octave:
|
|
14454
|
+
octave: 2,
|
|
14377
14455
|
ampEnvelope: {
|
|
14378
14456
|
attack: 10,
|
|
14379
14457
|
decay: 100,
|
|
@@ -14390,7 +14468,7 @@ var pxt;
|
|
|
14390
14468
|
iconURI: "/static/music-editor/burger.png",
|
|
14391
14469
|
instrument: {
|
|
14392
14470
|
waveform: 1,
|
|
14393
|
-
octave:
|
|
14471
|
+
octave: 2,
|
|
14394
14472
|
ampEnvelope: {
|
|
14395
14473
|
attack: 10,
|
|
14396
14474
|
decay: 100,
|
|
@@ -14436,7 +14514,7 @@ var pxt;
|
|
|
14436
14514
|
},
|
|
14437
14515
|
{
|
|
14438
14516
|
id: 9,
|
|
14439
|
-
name: lf("
|
|
14517
|
+
name: lf("Drums"),
|
|
14440
14518
|
notes: [],
|
|
14441
14519
|
iconURI: "/static/music-editor/explosion.png",
|
|
14442
14520
|
instrument: {
|
package/built/pxtrunner.js
CHANGED