pxt-core 8.4.6 → 8.4.8
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 +33 -22
- package/built/pxtlib.js +10 -10
- package/built/pxtsim.d.ts +1 -0
- package/built/pxtsim.js +23 -12
- package/built/target.js +1 -1
- package/built/web/multiplayer/css/main.fa5f1f51.css +3 -0
- package/built/web/multiplayer/js/main.8947677c.js +2 -0
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtsim.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/package.json +1 -1
- package/webapp/public/multiplayer.html +1 -1
- package/built/web/multiplayer/css/main.6670fc70.css +0 -4
- package/built/web/multiplayer/js/main.4578acaf.js +0 -2
package/built/pxt.js
CHANGED
|
@@ -97886,7 +97886,6 @@ var pxt;
|
|
|
97886
97886
|
this.initialUserPreferences_ = undefined;
|
|
97887
97887
|
this.initialAuthCheck_ = undefined;
|
|
97888
97888
|
this.patchQueue = [];
|
|
97889
|
-
pxt.Util.assert(!_client);
|
|
97890
97889
|
// Set global instance.
|
|
97891
97890
|
_client = this;
|
|
97892
97891
|
}
|
|
@@ -121790,8 +121789,9 @@ var pxt;
|
|
|
121790
121789
|
}
|
|
121791
121790
|
Cloud.getUserId = getUserId;
|
|
121792
121791
|
function parseScriptId(uri) {
|
|
121792
|
+
var _a;
|
|
121793
121793
|
const target = pxt.appTarget;
|
|
121794
|
-
if (!uri || !target.appTheme || !target.cloud ||
|
|
121794
|
+
if (!uri || !target.appTheme || !((_a = target.cloud) === null || _a === void 0 ? void 0 : _a.sharing))
|
|
121795
121795
|
return undefined;
|
|
121796
121796
|
let domains = ["makecode.com"];
|
|
121797
121797
|
if (target.appTheme.embedUrl)
|
|
@@ -121799,14 +121799,14 @@ var pxt;
|
|
|
121799
121799
|
if (target.appTheme.shareUrl)
|
|
121800
121800
|
domains.push(target.appTheme.shareUrl);
|
|
121801
121801
|
domains = Util.unique(domains, d => d).map(d => Util.escapeForRegex(Util.stripUrlProtocol(d).replace(/\/$/, '')).toLowerCase());
|
|
121802
|
-
const
|
|
121803
|
-
const
|
|
121804
|
-
const
|
|
121805
|
-
|
|
121806
|
-
|
|
121807
|
-
|
|
121808
|
-
|
|
121809
|
-
if (
|
|
121802
|
+
const domainCheck = `(?:(?:https:\/\/)?(?:${domains.join('|')})\/)`;
|
|
121803
|
+
const versionRefCheck = "(?:v[0-9]+\/)";
|
|
121804
|
+
const oembedCheck = "api\/oembed\\?url=.*%2F([^&#]*)&.*";
|
|
121805
|
+
const sharePageCheck = "([a-z0-9\\-_]+)(?:[#?&].*)?";
|
|
121806
|
+
const scriptIdCheck = `^${domainCheck}?${versionRefCheck}?(?:(?:${oembedCheck})|(?:${sharePageCheck}))$`;
|
|
121807
|
+
const m = new RegExp(scriptIdCheck, 'i').exec(uri.trim());
|
|
121808
|
+
const scriptid = (m === null || m === void 0 ? void 0 : m[1] /** oembed res **/) || (m === null || m === void 0 ? void 0 : m[2]) /** share page res **/;
|
|
121809
|
+
if (/^(_.{12}|S?[0-9\-]{23})$/.test(scriptid))
|
|
121810
121810
|
return scriptid;
|
|
121811
121811
|
return undefined;
|
|
121812
121812
|
}
|
|
@@ -152867,6 +152867,27 @@ var pxsim;
|
|
|
152867
152867
|
return output;
|
|
152868
152868
|
}
|
|
152869
152869
|
U.delay = delay;
|
|
152870
|
+
// Returns a function, that, as long as it continues to be invoked, will only
|
|
152871
|
+
// trigger every N milliseconds. If `immediate` is passed, trigger the
|
|
152872
|
+
// function on the leading edge, instead of the trailing.
|
|
152873
|
+
function throttle(func, wait, immediate) {
|
|
152874
|
+
let timeout;
|
|
152875
|
+
return function () {
|
|
152876
|
+
let context = this;
|
|
152877
|
+
let args = arguments;
|
|
152878
|
+
let later = function () {
|
|
152879
|
+
timeout = null;
|
|
152880
|
+
if (!immediate)
|
|
152881
|
+
func.apply(context, args);
|
|
152882
|
+
};
|
|
152883
|
+
let callNow = immediate && !timeout;
|
|
152884
|
+
if (!timeout)
|
|
152885
|
+
timeout = setTimeout(later, wait);
|
|
152886
|
+
if (callNow)
|
|
152887
|
+
func.apply(context, args);
|
|
152888
|
+
};
|
|
152889
|
+
}
|
|
152890
|
+
U.throttle = throttle;
|
|
152870
152891
|
function promiseMapAll(values, mapper) {
|
|
152871
152892
|
return Promise.all(values.map(v => mapper(v)));
|
|
152872
152893
|
}
|
|
@@ -154645,18 +154666,8 @@ var pxsim;
|
|
|
154645
154666
|
}
|
|
154646
154667
|
}
|
|
154647
154668
|
postMessageCore(frame, msg) {
|
|
154648
|
-
|
|
154649
|
-
frame.contentWindow.postMessage(msg,
|
|
154650
|
-
if (pxsim.U.isLocalHostDev() && ((_a = pxt === null || pxt === void 0 ? void 0 : pxt.appTarget) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
154651
|
-
// If using the production simulator on local serve, the domain might have been
|
|
154652
|
-
// redirected by the CLI server. Also send to the production domain just in case
|
|
154653
|
-
try {
|
|
154654
|
-
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`);
|
|
154655
|
-
}
|
|
154656
|
-
catch (e) {
|
|
154657
|
-
// Ignore exceptions if the target origin doesn't match
|
|
154658
|
-
}
|
|
154659
|
-
}
|
|
154669
|
+
const origin = pxsim.U.isLocalHostDev() ? "*" : frame.dataset["origin"];
|
|
154670
|
+
frame.contentWindow.postMessage(msg, origin);
|
|
154660
154671
|
}
|
|
154661
154672
|
createFrame(url) {
|
|
154662
154673
|
var _a, _b, _c;
|
package/built/pxtlib.js
CHANGED
|
@@ -200,7 +200,6 @@ var pxt;
|
|
|
200
200
|
this.initialUserPreferences_ = undefined;
|
|
201
201
|
this.initialAuthCheck_ = undefined;
|
|
202
202
|
this.patchQueue = [];
|
|
203
|
-
pxt.Util.assert(!_client);
|
|
204
203
|
// Set global instance.
|
|
205
204
|
_client = this;
|
|
206
205
|
}
|
|
@@ -24104,8 +24103,9 @@ var pxt;
|
|
|
24104
24103
|
}
|
|
24105
24104
|
Cloud.getUserId = getUserId;
|
|
24106
24105
|
function parseScriptId(uri) {
|
|
24106
|
+
var _a;
|
|
24107
24107
|
const target = pxt.appTarget;
|
|
24108
|
-
if (!uri || !target.appTheme || !target.cloud ||
|
|
24108
|
+
if (!uri || !target.appTheme || !((_a = target.cloud) === null || _a === void 0 ? void 0 : _a.sharing))
|
|
24109
24109
|
return undefined;
|
|
24110
24110
|
let domains = ["makecode.com"];
|
|
24111
24111
|
if (target.appTheme.embedUrl)
|
|
@@ -24113,14 +24113,14 @@ var pxt;
|
|
|
24113
24113
|
if (target.appTheme.shareUrl)
|
|
24114
24114
|
domains.push(target.appTheme.shareUrl);
|
|
24115
24115
|
domains = Util.unique(domains, d => d).map(d => Util.escapeForRegex(Util.stripUrlProtocol(d).replace(/\/$/, '')).toLowerCase());
|
|
24116
|
-
const
|
|
24117
|
-
const
|
|
24118
|
-
const
|
|
24119
|
-
|
|
24120
|
-
|
|
24121
|
-
|
|
24122
|
-
|
|
24123
|
-
if (
|
|
24116
|
+
const domainCheck = `(?:(?:https:\/\/)?(?:${domains.join('|')})\/)`;
|
|
24117
|
+
const versionRefCheck = "(?:v[0-9]+\/)";
|
|
24118
|
+
const oembedCheck = "api\/oembed\\?url=.*%2F([^&#]*)&.*";
|
|
24119
|
+
const sharePageCheck = "([a-z0-9\\-_]+)(?:[#?&].*)?";
|
|
24120
|
+
const scriptIdCheck = `^${domainCheck}?${versionRefCheck}?(?:(?:${oembedCheck})|(?:${sharePageCheck}))$`;
|
|
24121
|
+
const m = new RegExp(scriptIdCheck, 'i').exec(uri.trim());
|
|
24122
|
+
const scriptid = (m === null || m === void 0 ? void 0 : m[1] /** oembed res **/) || (m === null || m === void 0 ? void 0 : m[2]) /** share page res **/;
|
|
24123
|
+
if (/^(_.{12}|S?[0-9\-]{23})$/.test(scriptid))
|
|
24124
24124
|
return scriptid;
|
|
24125
24125
|
return undefined;
|
|
24126
24126
|
}
|
package/built/pxtsim.d.ts
CHANGED
|
@@ -986,6 +986,7 @@ declare namespace pxsim {
|
|
|
986
986
|
function nextTick(f: () => void): void;
|
|
987
987
|
function delay<T>(duration: number, value: T): Promise<T>;
|
|
988
988
|
function delay(duration: number): Promise<void>;
|
|
989
|
+
function throttle(func: (...args: any[]) => any, wait: number, immediate?: boolean): any;
|
|
989
990
|
function promiseMapAll<T, V>(values: T[], mapper: (obj: T) => Promise<V>): Promise<V[]>;
|
|
990
991
|
function promiseMapAllSeries<T, V>(values: T[], mapper: (obj: T) => Promise<V>): Promise<V[]>;
|
|
991
992
|
function promisePoolAsync<T, V>(maxConcurrent: number, inputValues: T[], handler: (input: T) => Promise<V>): Promise<V[]>;
|
package/built/pxtsim.js
CHANGED
|
@@ -4523,6 +4523,27 @@ var pxsim;
|
|
|
4523
4523
|
return output;
|
|
4524
4524
|
}
|
|
4525
4525
|
U.delay = delay;
|
|
4526
|
+
// Returns a function, that, as long as it continues to be invoked, will only
|
|
4527
|
+
// trigger every N milliseconds. If `immediate` is passed, trigger the
|
|
4528
|
+
// function on the leading edge, instead of the trailing.
|
|
4529
|
+
function throttle(func, wait, immediate) {
|
|
4530
|
+
let timeout;
|
|
4531
|
+
return function () {
|
|
4532
|
+
let context = this;
|
|
4533
|
+
let args = arguments;
|
|
4534
|
+
let later = function () {
|
|
4535
|
+
timeout = null;
|
|
4536
|
+
if (!immediate)
|
|
4537
|
+
func.apply(context, args);
|
|
4538
|
+
};
|
|
4539
|
+
let callNow = immediate && !timeout;
|
|
4540
|
+
if (!timeout)
|
|
4541
|
+
timeout = setTimeout(later, wait);
|
|
4542
|
+
if (callNow)
|
|
4543
|
+
func.apply(context, args);
|
|
4544
|
+
};
|
|
4545
|
+
}
|
|
4546
|
+
U.throttle = throttle;
|
|
4526
4547
|
function promiseMapAll(values, mapper) {
|
|
4527
4548
|
return Promise.all(values.map(v => mapper(v)));
|
|
4528
4549
|
}
|
|
@@ -6301,18 +6322,8 @@ var pxsim;
|
|
|
6301
6322
|
}
|
|
6302
6323
|
}
|
|
6303
6324
|
postMessageCore(frame, msg) {
|
|
6304
|
-
|
|
6305
|
-
frame.contentWindow.postMessage(msg,
|
|
6306
|
-
if (pxsim.U.isLocalHostDev() && ((_a = pxt === null || pxt === void 0 ? void 0 : pxt.appTarget) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
6307
|
-
// If using the production simulator on local serve, the domain might have been
|
|
6308
|
-
// redirected by the CLI server. Also send to the production domain just in case
|
|
6309
|
-
try {
|
|
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
|
-
}
|
|
6312
|
-
catch (e) {
|
|
6313
|
-
// Ignore exceptions if the target origin doesn't match
|
|
6314
|
-
}
|
|
6315
|
-
}
|
|
6325
|
+
const origin = pxsim.U.isLocalHostDev() ? "*" : frame.dataset["origin"];
|
|
6326
|
+
frame.contentWindow.postMessage(msg, origin);
|
|
6316
6327
|
}
|
|
6317
6328
|
createFrame(url) {
|
|
6318
6329
|
var _a, _b, _c;
|