pxt-core 7.5.32 → 7.5.35
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 +49 -26
- package/built/pxtblockly.js +4 -5
- package/built/pxtblocks.js +4 -5
- package/built/pxtcompiler.js +40 -25
- package/built/pxtlib.d.ts +1 -0
- package/built/pxtlib.js +8 -1
- package/built/pxtrunner.d.ts +1 -0
- package/built/pxtrunner.js +1 -0
- package/built/pxtsim.d.ts +1 -0
- package/built/pxtsim.js +1 -0
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtblockly.js +1 -1
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxtcompiler.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/pxtsim.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/react-common-authcode.css +5 -0
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/built/web/skillmap/js/{main.d734c596.chunk.js → main.9d7e815e.chunk.js} +1 -1
- package/localtypings/pxtarget.d.ts +1 -0
- package/package.json +1 -1
- package/react-common/components/controls/DraggableGraph.tsx +4 -2
- package/react-common/components/controls/Input.tsx +1 -1
- package/react-common/components/controls/Modal.tsx +4 -3
- package/react-common/styles/controls/Button.less +1 -0
- package/react-common/styles/controls/DraggableGraph.less +4 -0
- package/react-common/styles/controls/Input.less +1 -0
- package/theme/common.less +38 -14
- package/theme/tutorial-sidebar.less +7 -0
- package/webapp/public/run.html +4 -1
- package/webapp/public/skillmap.html +1 -1
package/built/pxt.js
CHANGED
|
@@ -101518,6 +101518,7 @@ var pxt;
|
|
|
101518
101518
|
shadowBlockId: def.shadowBlockId,
|
|
101519
101519
|
type: fn.namespace,
|
|
101520
101520
|
defaultValue: defaultValue,
|
|
101521
|
+
definitionIndex: defParameters.indexOf(def),
|
|
101521
101522
|
// Normally we pass ths actual parameter name, but the "this" parameter doesn't have one
|
|
101522
101523
|
fieldEditor: fieldEditor(defName, THIS_NAME),
|
|
101523
101524
|
fieldOptions: fieldOptions(defName, THIS_NAME),
|
|
@@ -101547,6 +101548,7 @@ var pxt;
|
|
|
101547
101548
|
type: p.type,
|
|
101548
101549
|
defaultValue: isVarOrArray ? (def.varName || p.default) : p.default,
|
|
101549
101550
|
definitionName: defName,
|
|
101551
|
+
definitionIndex: def ? defParameters.indexOf(def) : i,
|
|
101550
101552
|
shadowBlockId: def && def.shadowBlockId,
|
|
101551
101553
|
isOptional: defParameters ? defParameters.indexOf(def) >= optionalStart : false,
|
|
101552
101554
|
fieldEditor: fieldEditor(defName, p.name),
|
|
@@ -114378,7 +114380,11 @@ var pxt;
|
|
|
114378
114380
|
assets.MAX_FREQUENCY = 5000;
|
|
114379
114381
|
assets.MAX_VOLUME = 255;
|
|
114380
114382
|
function renderSoundPath(sound, width, height) {
|
|
114381
|
-
|
|
114383
|
+
let { startFrequency, endFrequency, startVolume, endVolume, wave, interpolation } = sound;
|
|
114384
|
+
startFrequency = Math.max(Math.min(startFrequency, assets.MAX_FREQUENCY), 1);
|
|
114385
|
+
endFrequency = Math.max(Math.min(endFrequency, assets.MAX_FREQUENCY), 1);
|
|
114386
|
+
startVolume = Math.max(Math.min(startVolume, assets.MAX_VOLUME), 0);
|
|
114387
|
+
endVolume = Math.max(Math.min(endVolume, assets.MAX_VOLUME), 0);
|
|
114382
114388
|
// To make the graph appear consistent with the implementation, use a seeded random for the noise waveform.
|
|
114383
114389
|
// The numbers are still nonsense but at least this reflects that it's deterministic.
|
|
114384
114390
|
const random = new SeededRandom(startFrequency + endFrequency + 1);
|
|
@@ -114419,6 +114425,7 @@ var pxt;
|
|
|
114419
114425
|
const random = new SeededRandom(frequency);
|
|
114420
114426
|
if (wave === "noise")
|
|
114421
114427
|
frequency = random.randomRange(500, 5000);
|
|
114428
|
+
frequency = Math.max(Math.min(frequency, assets.MAX_FREQUENCY), 1);
|
|
114422
114429
|
const amplitude = (volume / assets.MAX_VOLUME) * (height - 2) / 2;
|
|
114423
114430
|
const waveHalfWidth = (width / (frequency * timeBase / 1000)) / 2;
|
|
114424
114431
|
let numSegments = Math.ceil(width / (waveHalfWidth * 2));
|
|
@@ -125440,29 +125447,7 @@ ${output}</xml>`;
|
|
|
125440
125447
|
}
|
|
125441
125448
|
function emitValueNode(n) {
|
|
125442
125449
|
write(`<value name="${n.name}">`);
|
|
125443
|
-
|
|
125444
|
-
if (n.value.kind === "expr") {
|
|
125445
|
-
const value = n.value;
|
|
125446
|
-
if (value.type === numberType && n.shadowType === minmaxNumberType) {
|
|
125447
|
-
value.type = minmaxNumberType;
|
|
125448
|
-
value.fields[0].name = 'SLIDER';
|
|
125449
|
-
value.mutation = n.shadowMutation;
|
|
125450
|
-
}
|
|
125451
|
-
emitShadowOnly = value.type === n.shadowType;
|
|
125452
|
-
if (!emitShadowOnly) {
|
|
125453
|
-
switch (value.type) {
|
|
125454
|
-
case "math_number":
|
|
125455
|
-
case "math_number_minmax":
|
|
125456
|
-
case "math_integer":
|
|
125457
|
-
case "math_whole_number":
|
|
125458
|
-
case "logic_boolean":
|
|
125459
|
-
case "text":
|
|
125460
|
-
emitShadowOnly = !n.shadowType;
|
|
125461
|
-
break;
|
|
125462
|
-
}
|
|
125463
|
-
}
|
|
125464
|
-
}
|
|
125465
|
-
if (emitShadowOnly) {
|
|
125450
|
+
if (shouldEmitShadowOnly(n)) {
|
|
125466
125451
|
emitOutputNode(n.value, true);
|
|
125467
125452
|
}
|
|
125468
125453
|
else {
|
|
@@ -126646,7 +126631,6 @@ ${output}</xml>`;
|
|
|
126646
126631
|
switch (e.kind) {
|
|
126647
126632
|
case SK.FunctionExpression:
|
|
126648
126633
|
case SK.ArrowFunction:
|
|
126649
|
-
let expBody = e.body;
|
|
126650
126634
|
const m = getDestructuringMutation(e);
|
|
126651
126635
|
let mustPopLocalScope = false;
|
|
126652
126636
|
if (m) {
|
|
@@ -126774,7 +126758,20 @@ ${output}</xml>`;
|
|
|
126774
126758
|
if (!r.mutation)
|
|
126775
126759
|
r.mutation = {};
|
|
126776
126760
|
if (attributes.compileHiddenArguments) {
|
|
126777
|
-
|
|
126761
|
+
// Only expand the optional arguments that do not map to shadow blocks
|
|
126762
|
+
let nonOptional = 0;
|
|
126763
|
+
let expandCount = 0;
|
|
126764
|
+
for (const arg of args) {
|
|
126765
|
+
const aName = pxtc.U.htmlEscape(arg.param.definitionName);
|
|
126766
|
+
const input = r.inputs.find(i => i.name === aName);
|
|
126767
|
+
if (!arg.param.isOptional) {
|
|
126768
|
+
nonOptional++;
|
|
126769
|
+
}
|
|
126770
|
+
else if (input && !shouldEmitShadowOnly(input)) {
|
|
126771
|
+
expandCount = Math.max(arg.param.definitionIndex - nonOptional + 1, expandCount);
|
|
126772
|
+
}
|
|
126773
|
+
}
|
|
126774
|
+
r.mutation["_expanded"] = expandCount.toString();
|
|
126778
126775
|
}
|
|
126779
126776
|
else {
|
|
126780
126777
|
r.mutation["_expanded"] = optionalCount.toString();
|
|
@@ -128178,6 +128175,31 @@ ${output}</xml>`;
|
|
|
128178
128175
|
}
|
|
128179
128176
|
}
|
|
128180
128177
|
}
|
|
128178
|
+
function shouldEmitShadowOnly(n) {
|
|
128179
|
+
let emitShadowOnly = false;
|
|
128180
|
+
if (n.value.kind === "expr") {
|
|
128181
|
+
const value = n.value;
|
|
128182
|
+
if (value.type === numberType && n.shadowType === minmaxNumberType) {
|
|
128183
|
+
value.type = minmaxNumberType;
|
|
128184
|
+
value.fields[0].name = 'SLIDER';
|
|
128185
|
+
value.mutation = n.shadowMutation;
|
|
128186
|
+
}
|
|
128187
|
+
emitShadowOnly = value.type === n.shadowType;
|
|
128188
|
+
if (!emitShadowOnly) {
|
|
128189
|
+
switch (value.type) {
|
|
128190
|
+
case "math_number":
|
|
128191
|
+
case "math_number_minmax":
|
|
128192
|
+
case "math_integer":
|
|
128193
|
+
case "math_whole_number":
|
|
128194
|
+
case "logic_boolean":
|
|
128195
|
+
case "text":
|
|
128196
|
+
emitShadowOnly = !n.shadowType;
|
|
128197
|
+
break;
|
|
128198
|
+
}
|
|
128199
|
+
}
|
|
128200
|
+
}
|
|
128201
|
+
return emitShadowOnly;
|
|
128202
|
+
}
|
|
128181
128203
|
})(decompiler = pxtc.decompiler || (pxtc.decompiler = {}));
|
|
128182
128204
|
})(pxtc = ts.pxtc || (ts.pxtc = {}));
|
|
128183
128205
|
})(ts || (ts = {}));
|
|
@@ -152908,6 +152930,7 @@ var pxsim;
|
|
|
152908
152930
|
frame.frameBorder = "0";
|
|
152909
152931
|
frame.dataset['runid'] = this.runId;
|
|
152910
152932
|
frame.dataset['origin'] = new URL(furl).origin || "*";
|
|
152933
|
+
frame.dataset['hidesimbuttons'] = this._runOptions.hideSimButtons ? "true" : "false";
|
|
152911
152934
|
wrapper.appendChild(frame);
|
|
152912
152935
|
const i = document.createElement("i");
|
|
152913
152936
|
i.className = "videoplay xicon icon";
|
package/built/pxtblockly.js
CHANGED
|
@@ -7559,11 +7559,10 @@ var pxt;
|
|
|
7559
7559
|
block.appendChild(createShadowValue(info, t, t.shadowBlockId || "variables_get", t.defaultValue || t.definitionName));
|
|
7560
7560
|
}
|
|
7561
7561
|
if (fn.parameters) {
|
|
7562
|
-
comp.parameters.filter(pr =>
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|| pr.defaultValue))
|
|
7562
|
+
comp.parameters.filter(pr => primitiveTypeRegex.test(pr.type)
|
|
7563
|
+
|| primitiveTypeRegex.test(isArrayType(pr.type))
|
|
7564
|
+
|| pr.shadowBlockId
|
|
7565
|
+
|| pr.defaultValue)
|
|
7567
7566
|
.forEach(pr => {
|
|
7568
7567
|
block.appendChild(createShadowValue(info, pr));
|
|
7569
7568
|
});
|
package/built/pxtblocks.js
CHANGED
|
@@ -3997,11 +3997,10 @@ var pxt;
|
|
|
3997
3997
|
block.appendChild(createShadowValue(info, t, t.shadowBlockId || "variables_get", t.defaultValue || t.definitionName));
|
|
3998
3998
|
}
|
|
3999
3999
|
if (fn.parameters) {
|
|
4000
|
-
comp.parameters.filter(pr =>
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|| pr.defaultValue))
|
|
4000
|
+
comp.parameters.filter(pr => primitiveTypeRegex.test(pr.type)
|
|
4001
|
+
|| primitiveTypeRegex.test(isArrayType(pr.type))
|
|
4002
|
+
|| pr.shadowBlockId
|
|
4003
|
+
|| pr.defaultValue)
|
|
4005
4004
|
.forEach(pr => {
|
|
4006
4005
|
block.appendChild(createShadowValue(info, pr));
|
|
4007
4006
|
});
|
package/built/pxtcompiler.js
CHANGED
|
@@ -4485,29 +4485,7 @@ ${output}</xml>`;
|
|
|
4485
4485
|
}
|
|
4486
4486
|
function emitValueNode(n) {
|
|
4487
4487
|
write(`<value name="${n.name}">`);
|
|
4488
|
-
|
|
4489
|
-
if (n.value.kind === "expr") {
|
|
4490
|
-
const value = n.value;
|
|
4491
|
-
if (value.type === numberType && n.shadowType === minmaxNumberType) {
|
|
4492
|
-
value.type = minmaxNumberType;
|
|
4493
|
-
value.fields[0].name = 'SLIDER';
|
|
4494
|
-
value.mutation = n.shadowMutation;
|
|
4495
|
-
}
|
|
4496
|
-
emitShadowOnly = value.type === n.shadowType;
|
|
4497
|
-
if (!emitShadowOnly) {
|
|
4498
|
-
switch (value.type) {
|
|
4499
|
-
case "math_number":
|
|
4500
|
-
case "math_number_minmax":
|
|
4501
|
-
case "math_integer":
|
|
4502
|
-
case "math_whole_number":
|
|
4503
|
-
case "logic_boolean":
|
|
4504
|
-
case "text":
|
|
4505
|
-
emitShadowOnly = !n.shadowType;
|
|
4506
|
-
break;
|
|
4507
|
-
}
|
|
4508
|
-
}
|
|
4509
|
-
}
|
|
4510
|
-
if (emitShadowOnly) {
|
|
4488
|
+
if (shouldEmitShadowOnly(n)) {
|
|
4511
4489
|
emitOutputNode(n.value, true);
|
|
4512
4490
|
}
|
|
4513
4491
|
else {
|
|
@@ -5691,7 +5669,6 @@ ${output}</xml>`;
|
|
|
5691
5669
|
switch (e.kind) {
|
|
5692
5670
|
case SK.FunctionExpression:
|
|
5693
5671
|
case SK.ArrowFunction:
|
|
5694
|
-
let expBody = e.body;
|
|
5695
5672
|
const m = getDestructuringMutation(e);
|
|
5696
5673
|
let mustPopLocalScope = false;
|
|
5697
5674
|
if (m) {
|
|
@@ -5819,7 +5796,20 @@ ${output}</xml>`;
|
|
|
5819
5796
|
if (!r.mutation)
|
|
5820
5797
|
r.mutation = {};
|
|
5821
5798
|
if (attributes.compileHiddenArguments) {
|
|
5822
|
-
|
|
5799
|
+
// Only expand the optional arguments that do not map to shadow blocks
|
|
5800
|
+
let nonOptional = 0;
|
|
5801
|
+
let expandCount = 0;
|
|
5802
|
+
for (const arg of args) {
|
|
5803
|
+
const aName = pxtc.U.htmlEscape(arg.param.definitionName);
|
|
5804
|
+
const input = r.inputs.find(i => i.name === aName);
|
|
5805
|
+
if (!arg.param.isOptional) {
|
|
5806
|
+
nonOptional++;
|
|
5807
|
+
}
|
|
5808
|
+
else if (input && !shouldEmitShadowOnly(input)) {
|
|
5809
|
+
expandCount = Math.max(arg.param.definitionIndex - nonOptional + 1, expandCount);
|
|
5810
|
+
}
|
|
5811
|
+
}
|
|
5812
|
+
r.mutation["_expanded"] = expandCount.toString();
|
|
5823
5813
|
}
|
|
5824
5814
|
else {
|
|
5825
5815
|
r.mutation["_expanded"] = optionalCount.toString();
|
|
@@ -7223,6 +7213,31 @@ ${output}</xml>`;
|
|
|
7223
7213
|
}
|
|
7224
7214
|
}
|
|
7225
7215
|
}
|
|
7216
|
+
function shouldEmitShadowOnly(n) {
|
|
7217
|
+
let emitShadowOnly = false;
|
|
7218
|
+
if (n.value.kind === "expr") {
|
|
7219
|
+
const value = n.value;
|
|
7220
|
+
if (value.type === numberType && n.shadowType === minmaxNumberType) {
|
|
7221
|
+
value.type = minmaxNumberType;
|
|
7222
|
+
value.fields[0].name = 'SLIDER';
|
|
7223
|
+
value.mutation = n.shadowMutation;
|
|
7224
|
+
}
|
|
7225
|
+
emitShadowOnly = value.type === n.shadowType;
|
|
7226
|
+
if (!emitShadowOnly) {
|
|
7227
|
+
switch (value.type) {
|
|
7228
|
+
case "math_number":
|
|
7229
|
+
case "math_number_minmax":
|
|
7230
|
+
case "math_integer":
|
|
7231
|
+
case "math_whole_number":
|
|
7232
|
+
case "logic_boolean":
|
|
7233
|
+
case "text":
|
|
7234
|
+
emitShadowOnly = !n.shadowType;
|
|
7235
|
+
break;
|
|
7236
|
+
}
|
|
7237
|
+
}
|
|
7238
|
+
}
|
|
7239
|
+
return emitShadowOnly;
|
|
7240
|
+
}
|
|
7226
7241
|
})(decompiler = pxtc.decompiler || (pxtc.decompiler = {}));
|
|
7227
7242
|
})(pxtc = ts.pxtc || (ts.pxtc = {}));
|
|
7228
7243
|
})(ts || (ts = {}));
|
package/built/pxtlib.d.ts
CHANGED
package/built/pxtlib.js
CHANGED
|
@@ -3832,6 +3832,7 @@ var pxt;
|
|
|
3832
3832
|
shadowBlockId: def.shadowBlockId,
|
|
3833
3833
|
type: fn.namespace,
|
|
3834
3834
|
defaultValue: defaultValue,
|
|
3835
|
+
definitionIndex: defParameters.indexOf(def),
|
|
3835
3836
|
// Normally we pass ths actual parameter name, but the "this" parameter doesn't have one
|
|
3836
3837
|
fieldEditor: fieldEditor(defName, THIS_NAME),
|
|
3837
3838
|
fieldOptions: fieldOptions(defName, THIS_NAME),
|
|
@@ -3861,6 +3862,7 @@ var pxt;
|
|
|
3861
3862
|
type: p.type,
|
|
3862
3863
|
defaultValue: isVarOrArray ? (def.varName || p.default) : p.default,
|
|
3863
3864
|
definitionName: defName,
|
|
3865
|
+
definitionIndex: def ? defParameters.indexOf(def) : i,
|
|
3864
3866
|
shadowBlockId: def && def.shadowBlockId,
|
|
3865
3867
|
isOptional: defParameters ? defParameters.indexOf(def) >= optionalStart : false,
|
|
3866
3868
|
fieldEditor: fieldEditor(defName, p.name),
|
|
@@ -16692,7 +16694,11 @@ var pxt;
|
|
|
16692
16694
|
assets.MAX_FREQUENCY = 5000;
|
|
16693
16695
|
assets.MAX_VOLUME = 255;
|
|
16694
16696
|
function renderSoundPath(sound, width, height) {
|
|
16695
|
-
|
|
16697
|
+
let { startFrequency, endFrequency, startVolume, endVolume, wave, interpolation } = sound;
|
|
16698
|
+
startFrequency = Math.max(Math.min(startFrequency, assets.MAX_FREQUENCY), 1);
|
|
16699
|
+
endFrequency = Math.max(Math.min(endFrequency, assets.MAX_FREQUENCY), 1);
|
|
16700
|
+
startVolume = Math.max(Math.min(startVolume, assets.MAX_VOLUME), 0);
|
|
16701
|
+
endVolume = Math.max(Math.min(endVolume, assets.MAX_VOLUME), 0);
|
|
16696
16702
|
// To make the graph appear consistent with the implementation, use a seeded random for the noise waveform.
|
|
16697
16703
|
// The numbers are still nonsense but at least this reflects that it's deterministic.
|
|
16698
16704
|
const random = new SeededRandom(startFrequency + endFrequency + 1);
|
|
@@ -16733,6 +16739,7 @@ var pxt;
|
|
|
16733
16739
|
const random = new SeededRandom(frequency);
|
|
16734
16740
|
if (wave === "noise")
|
|
16735
16741
|
frequency = random.randomRange(500, 5000);
|
|
16742
|
+
frequency = Math.max(Math.min(frequency, assets.MAX_FREQUENCY), 1);
|
|
16736
16743
|
const amplitude = (volume / assets.MAX_VOLUME) * (height - 2) / 2;
|
|
16737
16744
|
const waveHalfWidth = (width / (frequency * timeBase / 1000)) / 2;
|
|
16738
16745
|
let numSegments = Math.ceil(width / (waveHalfWidth * 2));
|
package/built/pxtrunner.d.ts
CHANGED
package/built/pxtrunner.js
CHANGED
|
@@ -1750,6 +1750,7 @@ var pxt;
|
|
|
1750
1750
|
storedState: storedState,
|
|
1751
1751
|
light: simOptions.light,
|
|
1752
1752
|
single: simOptions.single,
|
|
1753
|
+
hideSimButtons: simOptions.hideSimButtons
|
|
1753
1754
|
};
|
|
1754
1755
|
if (pxt.appTarget.simulator && !simOptions.fullScreen)
|
|
1755
1756
|
runOptions.aspectRatio = parts.length && pxt.appTarget.simulator.partsAspectRatio
|
package/built/pxtsim.d.ts
CHANGED
package/built/pxtsim.js
CHANGED
|
@@ -6308,6 +6308,7 @@ var pxsim;
|
|
|
6308
6308
|
frame.frameBorder = "0";
|
|
6309
6309
|
frame.dataset['runid'] = this.runId;
|
|
6310
6310
|
frame.dataset['origin'] = new URL(furl).origin || "*";
|
|
6311
|
+
frame.dataset['hidesimbuttons'] = this._runOptions.hideSimButtons ? "true" : "false";
|
|
6311
6312
|
wrapper.appendChild(frame);
|
|
6312
6313
|
const i = document.createElement("i");
|
|
6313
6314
|
i.className = "videoplay xicon icon";
|