pxt-core 7.3.8 → 7.3.12
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 +27 -12
- package/built/pxtcompiler.js +7 -3
- package/built/pxteditor.d.ts +1 -1
- package/built/pxtlib.d.ts +2 -1
- package/built/pxtlib.js +20 -9
- 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/pxtcompiler.js +1 -1
- package/built/web/pxtembed.js +1 -1
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/react-common.css +69 -13
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/built/web/skillmap/css/main.70954d9b.chunk.css +1 -0
- package/built/web/skillmap/js/{2.9cb94aa0.chunk.js → 2.c64f6be2.chunk.js} +2 -2
- package/built/web/skillmap/js/main.81439fd6.chunk.js +1 -0
- package/package.json +2 -3
- package/theme/common.less +0 -28
- package/theme/highcontrast.less +4 -0
- package/webapp/public/skillmap.html +2 -2
- package/built/web/skillmap/css/main.2461a333.chunk.css +0 -1
- package/built/web/skillmap/js/main.c49acd24.chunk.js +0 -1
package/built/pxt.js
CHANGED
|
@@ -97876,14 +97876,15 @@ var pxt;
|
|
|
97876
97876
|
let _client;
|
|
97877
97877
|
function client() { return _client; }
|
|
97878
97878
|
auth.client = client;
|
|
97879
|
-
const PREFERENCES_DEBOUNCE_MS =
|
|
97880
|
-
const PREFERENCES_DEBOUNCE_MAX_MS =
|
|
97879
|
+
const PREFERENCES_DEBOUNCE_MS = 1 * 1000;
|
|
97880
|
+
const PREFERENCES_DEBOUNCE_MAX_MS = 10 * 1000;
|
|
97881
97881
|
let debouncePreferencesChangedTimeout = 0;
|
|
97882
97882
|
let debouncePreferencesChangedStarted = 0;
|
|
97883
97883
|
class AuthClient {
|
|
97884
97884
|
constructor() {
|
|
97885
97885
|
this.initialUserPreferences_ = undefined;
|
|
97886
97886
|
this.initialAuthCheck_ = undefined;
|
|
97887
|
+
this.prefPatchOps = [];
|
|
97887
97888
|
pxt.Util.assert(!_client);
|
|
97888
97889
|
// Set global instance.
|
|
97889
97890
|
_client = this;
|
|
@@ -98073,7 +98074,7 @@ var pxt;
|
|
|
98073
98074
|
}
|
|
98074
98075
|
return result.success;
|
|
98075
98076
|
}
|
|
98076
|
-
async patchUserPreferencesAsync(ops) {
|
|
98077
|
+
async patchUserPreferencesAsync(ops, immediate = false) {
|
|
98077
98078
|
ops = Array.isArray(ops) ? ops : [ops];
|
|
98078
98079
|
if (!ops.length) {
|
|
98079
98080
|
return;
|
|
@@ -98086,10 +98087,15 @@ var pxt;
|
|
|
98086
98087
|
return;
|
|
98087
98088
|
}
|
|
98088
98089
|
// If the user is logged in, save to cloud, but debounce the api call as this can be called frequently from skillmaps
|
|
98090
|
+
// Accumulate the ops and send to cloud in batch.
|
|
98091
|
+
this.prefPatchOps.push(...ops);
|
|
98089
98092
|
clearTimeout(debouncePreferencesChangedTimeout);
|
|
98090
98093
|
const savePrefs = async () => {
|
|
98091
98094
|
debouncePreferencesChangedStarted = 0;
|
|
98092
|
-
|
|
98095
|
+
// Clear queued patch ops before send.
|
|
98096
|
+
const prefPatchOps = this.prefPatchOps;
|
|
98097
|
+
this.prefPatchOps = [];
|
|
98098
|
+
const result = await this.apiAsync('/api/user/preferences', prefPatchOps, 'PATCH');
|
|
98093
98099
|
if (result.success) {
|
|
98094
98100
|
pxt.debug("Updating local user preferences w/ cloud data after result of POST");
|
|
98095
98101
|
// Set user profile from returned value so we stay in-sync
|
|
@@ -98099,14 +98105,19 @@ var pxt;
|
|
|
98099
98105
|
pxt.reportError("identity", "update preferences failed", result);
|
|
98100
98106
|
}
|
|
98101
98107
|
};
|
|
98102
|
-
if (
|
|
98103
|
-
debouncePreferencesChangedStarted = pxt.U.now();
|
|
98104
|
-
}
|
|
98105
|
-
if (PREFERENCES_DEBOUNCE_MAX_MS < pxt.U.now() - debouncePreferencesChangedStarted) {
|
|
98108
|
+
if (immediate) {
|
|
98106
98109
|
await savePrefs();
|
|
98107
98110
|
}
|
|
98108
98111
|
else {
|
|
98109
|
-
|
|
98112
|
+
if (!debouncePreferencesChangedStarted) {
|
|
98113
|
+
debouncePreferencesChangedStarted = pxt.U.now();
|
|
98114
|
+
}
|
|
98115
|
+
if (PREFERENCES_DEBOUNCE_MAX_MS < pxt.U.now() - debouncePreferencesChangedStarted) {
|
|
98116
|
+
await savePrefs();
|
|
98117
|
+
}
|
|
98118
|
+
else {
|
|
98119
|
+
debouncePreferencesChangedTimeout = setTimeout(savePrefs, PREFERENCES_DEBOUNCE_MS);
|
|
98120
|
+
}
|
|
98110
98121
|
}
|
|
98111
98122
|
}
|
|
98112
98123
|
/*protected*/ hasUserId() {
|
|
@@ -139059,6 +139070,7 @@ var ts;
|
|
|
139059
139070
|
}
|
|
139060
139071
|
service.snippetAddsDefinitions = snippetAddsDefinitions;
|
|
139061
139072
|
function getSnippet(context, fn, decl, python, recursionDepth = 0) {
|
|
139073
|
+
var _a;
|
|
139062
139074
|
// TODO: a lot of this is duplicate logic with blocklyloader.ts:buildBlockFromDef; we should
|
|
139063
139075
|
// unify these approaches
|
|
139064
139076
|
let { apis, takenNames, blocksInfo, screenSize, checker } = context;
|
|
@@ -139091,10 +139103,15 @@ var ts;
|
|
|
139091
139103
|
if (attrs.shim === "TD_ID" && recursionDepth && decl.parameters.length) {
|
|
139092
139104
|
return getParameterDefault(decl.parameters[0]);
|
|
139093
139105
|
}
|
|
139106
|
+
const element = fn;
|
|
139107
|
+
const params = pxt.blocks.compileInfo(element);
|
|
139094
139108
|
const blocksById = blocksInfo.blocksById;
|
|
139095
139109
|
// TODO: move out of getSnippet for general reuse
|
|
139110
|
+
const blockParameters = ((_a = attrs._def) === null || _a === void 0 ? void 0 : _a.parameters.filter(param => !!params.definitionNameToParam[param.name]).map(param => params.definitionNameToParam[param.name].actualName)) || [];
|
|
139096
139111
|
const includedParameters = decl.parameters ? decl.parameters
|
|
139097
|
-
|
|
139112
|
+
// Only keep required parameters and parameters included in the blockdef
|
|
139113
|
+
.filter(param => (!param.initializer && !param.questionToken)
|
|
139114
|
+
|| (blockParameters.indexOf(param.name.getText()) >= 0)) : [];
|
|
139098
139115
|
const args = includedParameters
|
|
139099
139116
|
.map(getParameterDefault)
|
|
139100
139117
|
.map(p =>
|
|
@@ -139104,7 +139121,6 @@ var ts;
|
|
|
139104
139121
|
default: p,
|
|
139105
139122
|
isLiteral: true
|
|
139106
139123
|
}));
|
|
139107
|
-
const element = fn;
|
|
139108
139124
|
if (element.attributes.block) {
|
|
139109
139125
|
if (element.attributes.defaultInstance) {
|
|
139110
139126
|
snippetPrefix = element.attributes.defaultInstance;
|
|
@@ -139152,7 +139168,6 @@ var ts;
|
|
|
139152
139168
|
isInstance = true;
|
|
139153
139169
|
}
|
|
139154
139170
|
else if (element.kind == 1 /* Method */ || element.kind == 2 /* Property */) {
|
|
139155
|
-
const params = pxt.blocks.compileInfo(element);
|
|
139156
139171
|
if (params.thisParameter) {
|
|
139157
139172
|
let varName = undefined;
|
|
139158
139173
|
if (params.thisParameter.definitionName) {
|
package/built/pxtcompiler.js
CHANGED
|
@@ -18255,6 +18255,7 @@ var ts;
|
|
|
18255
18255
|
}
|
|
18256
18256
|
service.snippetAddsDefinitions = snippetAddsDefinitions;
|
|
18257
18257
|
function getSnippet(context, fn, decl, python, recursionDepth = 0) {
|
|
18258
|
+
var _a;
|
|
18258
18259
|
// TODO: a lot of this is duplicate logic with blocklyloader.ts:buildBlockFromDef; we should
|
|
18259
18260
|
// unify these approaches
|
|
18260
18261
|
let { apis, takenNames, blocksInfo, screenSize, checker } = context;
|
|
@@ -18287,10 +18288,15 @@ var ts;
|
|
|
18287
18288
|
if (attrs.shim === "TD_ID" && recursionDepth && decl.parameters.length) {
|
|
18288
18289
|
return getParameterDefault(decl.parameters[0]);
|
|
18289
18290
|
}
|
|
18291
|
+
const element = fn;
|
|
18292
|
+
const params = pxt.blocks.compileInfo(element);
|
|
18290
18293
|
const blocksById = blocksInfo.blocksById;
|
|
18291
18294
|
// TODO: move out of getSnippet for general reuse
|
|
18295
|
+
const blockParameters = ((_a = attrs._def) === null || _a === void 0 ? void 0 : _a.parameters.filter(param => !!params.definitionNameToParam[param.name]).map(param => params.definitionNameToParam[param.name].actualName)) || [];
|
|
18292
18296
|
const includedParameters = decl.parameters ? decl.parameters
|
|
18293
|
-
|
|
18297
|
+
// Only keep required parameters and parameters included in the blockdef
|
|
18298
|
+
.filter(param => (!param.initializer && !param.questionToken)
|
|
18299
|
+
|| (blockParameters.indexOf(param.name.getText()) >= 0)) : [];
|
|
18294
18300
|
const args = includedParameters
|
|
18295
18301
|
.map(getParameterDefault)
|
|
18296
18302
|
.map(p =>
|
|
@@ -18300,7 +18306,6 @@ var ts;
|
|
|
18300
18306
|
default: p,
|
|
18301
18307
|
isLiteral: true
|
|
18302
18308
|
}));
|
|
18303
|
-
const element = fn;
|
|
18304
18309
|
if (element.attributes.block) {
|
|
18305
18310
|
if (element.attributes.defaultInstance) {
|
|
18306
18311
|
snippetPrefix = element.attributes.defaultInstance;
|
|
@@ -18348,7 +18353,6 @@ var ts;
|
|
|
18348
18353
|
isInstance = true;
|
|
18349
18354
|
}
|
|
18350
18355
|
else if (element.kind == 1 /* Method */ || element.kind == 2 /* Property */) {
|
|
18351
|
-
const params = pxt.blocks.compileInfo(element);
|
|
18352
18356
|
if (params.thisParameter) {
|
|
18353
18357
|
let varName = undefined;
|
|
18354
18358
|
if (params.thisParameter.definitionName) {
|
package/built/pxteditor.d.ts
CHANGED
|
@@ -543,7 +543,7 @@ declare namespace pxt.editor {
|
|
|
543
543
|
message?: string;
|
|
544
544
|
data?: Map<string | number>;
|
|
545
545
|
}
|
|
546
|
-
type EditorMessageTutorialEventRequest = EditorMessageTutorialProgressEventRequest | EditorMessageTutorialCompletedEventRequest | EditorMessageTutorialLoadedEventRequest;
|
|
546
|
+
type EditorMessageTutorialEventRequest = EditorMessageTutorialProgressEventRequest | EditorMessageTutorialCompletedEventRequest | EditorMessageTutorialLoadedEventRequest | EditorMessageTutorialExitEventRequest;
|
|
547
547
|
interface EditorMessageTutorialProgressEventRequest extends EditorMessageRequest {
|
|
548
548
|
action: "tutorialevent";
|
|
549
549
|
tutorialEvent: "progress";
|
package/built/pxtlib.d.ts
CHANGED
|
@@ -124,7 +124,8 @@ declare namespace pxt.auth {
|
|
|
124
124
|
username?: string;
|
|
125
125
|
avatarUrl?: string;
|
|
126
126
|
}): Promise<boolean>;
|
|
127
|
-
|
|
127
|
+
private prefPatchOps;
|
|
128
|
+
patchUserPreferencesAsync(ops: ts.pxtc.jsonPatch.PatchOperation | ts.pxtc.jsonPatch.PatchOperation[], immediate?: boolean): Promise<void>;
|
|
128
129
|
hasUserId(): boolean;
|
|
129
130
|
private fetchUserAsync;
|
|
130
131
|
private setUserProfileAsync;
|
package/built/pxtlib.js
CHANGED
|
@@ -190,14 +190,15 @@ var pxt;
|
|
|
190
190
|
let _client;
|
|
191
191
|
function client() { return _client; }
|
|
192
192
|
auth.client = client;
|
|
193
|
-
const PREFERENCES_DEBOUNCE_MS =
|
|
194
|
-
const PREFERENCES_DEBOUNCE_MAX_MS =
|
|
193
|
+
const PREFERENCES_DEBOUNCE_MS = 1 * 1000;
|
|
194
|
+
const PREFERENCES_DEBOUNCE_MAX_MS = 10 * 1000;
|
|
195
195
|
let debouncePreferencesChangedTimeout = 0;
|
|
196
196
|
let debouncePreferencesChangedStarted = 0;
|
|
197
197
|
class AuthClient {
|
|
198
198
|
constructor() {
|
|
199
199
|
this.initialUserPreferences_ = undefined;
|
|
200
200
|
this.initialAuthCheck_ = undefined;
|
|
201
|
+
this.prefPatchOps = [];
|
|
201
202
|
pxt.Util.assert(!_client);
|
|
202
203
|
// Set global instance.
|
|
203
204
|
_client = this;
|
|
@@ -387,7 +388,7 @@ var pxt;
|
|
|
387
388
|
}
|
|
388
389
|
return result.success;
|
|
389
390
|
}
|
|
390
|
-
async patchUserPreferencesAsync(ops) {
|
|
391
|
+
async patchUserPreferencesAsync(ops, immediate = false) {
|
|
391
392
|
ops = Array.isArray(ops) ? ops : [ops];
|
|
392
393
|
if (!ops.length) {
|
|
393
394
|
return;
|
|
@@ -400,10 +401,15 @@ var pxt;
|
|
|
400
401
|
return;
|
|
401
402
|
}
|
|
402
403
|
// If the user is logged in, save to cloud, but debounce the api call as this can be called frequently from skillmaps
|
|
404
|
+
// Accumulate the ops and send to cloud in batch.
|
|
405
|
+
this.prefPatchOps.push(...ops);
|
|
403
406
|
clearTimeout(debouncePreferencesChangedTimeout);
|
|
404
407
|
const savePrefs = async () => {
|
|
405
408
|
debouncePreferencesChangedStarted = 0;
|
|
406
|
-
|
|
409
|
+
// Clear queued patch ops before send.
|
|
410
|
+
const prefPatchOps = this.prefPatchOps;
|
|
411
|
+
this.prefPatchOps = [];
|
|
412
|
+
const result = await this.apiAsync('/api/user/preferences', prefPatchOps, 'PATCH');
|
|
407
413
|
if (result.success) {
|
|
408
414
|
pxt.debug("Updating local user preferences w/ cloud data after result of POST");
|
|
409
415
|
// Set user profile from returned value so we stay in-sync
|
|
@@ -413,14 +419,19 @@ var pxt;
|
|
|
413
419
|
pxt.reportError("identity", "update preferences failed", result);
|
|
414
420
|
}
|
|
415
421
|
};
|
|
416
|
-
if (
|
|
417
|
-
debouncePreferencesChangedStarted = pxt.U.now();
|
|
418
|
-
}
|
|
419
|
-
if (PREFERENCES_DEBOUNCE_MAX_MS < pxt.U.now() - debouncePreferencesChangedStarted) {
|
|
422
|
+
if (immediate) {
|
|
420
423
|
await savePrefs();
|
|
421
424
|
}
|
|
422
425
|
else {
|
|
423
|
-
|
|
426
|
+
if (!debouncePreferencesChangedStarted) {
|
|
427
|
+
debouncePreferencesChangedStarted = pxt.U.now();
|
|
428
|
+
}
|
|
429
|
+
if (PREFERENCES_DEBOUNCE_MAX_MS < pxt.U.now() - debouncePreferencesChangedStarted) {
|
|
430
|
+
await savePrefs();
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
debouncePreferencesChangedTimeout = setTimeout(savePrefs, PREFERENCES_DEBOUNCE_MS);
|
|
434
|
+
}
|
|
424
435
|
}
|
|
425
436
|
}
|
|
426
437
|
/*protected*/ hasUserId() {
|