pxt-core 7.5.23 → 7.5.26
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 +16 -10
- package/built/pxtblockly.js +3 -2
- package/built/pxtblocks.js +3 -2
- package/built/pxtcompiler.js +6 -1
- package/built/pxtlib.d.ts +2 -0
- package/built/pxtlib.js +10 -9
- 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/pxtworker.js +1 -1
- package/common-docs/faq.md +1 -1
- package/docfiles/{domains.html → domains-template.html} +1 -1
- package/package.json +1 -1
- package/react-common/components/controls/DraggableGraph.tsx +4 -4
package/built/pxt.js
CHANGED
|
@@ -114473,11 +114473,10 @@ var pxt;
|
|
|
114473
114473
|
(function (pxt) {
|
|
114474
114474
|
var assets;
|
|
114475
114475
|
(function (assets) {
|
|
114476
|
+
assets.MAX_FREQUENCY = 5000;
|
|
114477
|
+
assets.MAX_VOLUME = 255;
|
|
114476
114478
|
function renderSoundPath(sound, width, height) {
|
|
114477
114479
|
const { startFrequency, endFrequency, startVolume, endVolume, wave, interpolation } = sound;
|
|
114478
|
-
const scale = (start, end, percent) => {
|
|
114479
|
-
return Math.pow(start, 1 - percent) * Math.pow(end, percent);
|
|
114480
|
-
};
|
|
114481
114480
|
// To make the graph appear consistent with the implementation, use a seeded random for the noise waveform.
|
|
114482
114481
|
// The numbers are still nonsense but at least this reflects that it's deterministic.
|
|
114483
114482
|
const random = new SeededRandom(startFrequency + endFrequency + 1);
|
|
@@ -114494,11 +114493,13 @@ var pxt;
|
|
|
114494
114493
|
break;
|
|
114495
114494
|
}
|
|
114496
114495
|
if (wave === "noise") {
|
|
114497
|
-
getFrequencyAt = () => random.randomRange(500,
|
|
114496
|
+
getFrequencyAt = () => random.randomRange(500, 5000);
|
|
114498
114497
|
}
|
|
114499
|
-
const getVolumeAt = (x) => ((endVolume - startVolume) / width) * x + startVolume;
|
|
114500
|
-
const
|
|
114501
|
-
const
|
|
114498
|
+
const getVolumeAt = (x) => Math.max(Math.min(((endVolume - startVolume) / width) * x + startVolume, assets.MAX_VOLUME), 0);
|
|
114499
|
+
const minWaveWidth = 10;
|
|
114500
|
+
const maxWaveWidth = width / 2;
|
|
114501
|
+
const volumeToAmplitude = (volume) => (volume / assets.MAX_VOLUME) * (height - 2) / 2;
|
|
114502
|
+
const frequencyToWidth = (frequency) => (1 - frequency / assets.MAX_FREQUENCY) * (maxWaveWidth - minWaveWidth) + minWaveWidth;
|
|
114502
114503
|
const parts = [`M ${2} ${height / 2}`];
|
|
114503
114504
|
let currentX = 0;
|
|
114504
114505
|
while (currentX < width) {
|
|
@@ -114515,8 +114516,8 @@ var pxt;
|
|
|
114515
114516
|
// The numbers are still nonsense but at least this reflects that it's deterministic.
|
|
114516
114517
|
const random = new SeededRandom(frequency);
|
|
114517
114518
|
if (wave === "noise")
|
|
114518
|
-
frequency = random.randomRange(500,
|
|
114519
|
-
const amplitude = (volume /
|
|
114519
|
+
frequency = random.randomRange(500, 5000);
|
|
114520
|
+
const amplitude = (volume / assets.MAX_VOLUME) * (height - 2) / 2;
|
|
114520
114521
|
const waveHalfWidth = (width / (frequency * timeBase / 1000)) / 2;
|
|
114521
114522
|
let numSegments = Math.ceil(width / (waveHalfWidth * 2));
|
|
114522
114523
|
if (numSegments % 2 === 1)
|
|
@@ -126870,7 +126871,12 @@ ${output}</xml>`;
|
|
|
126870
126871
|
if (optionalCount) {
|
|
126871
126872
|
if (!r.mutation)
|
|
126872
126873
|
r.mutation = {};
|
|
126873
|
-
|
|
126874
|
+
if (attributes.compileHiddenArguments) {
|
|
126875
|
+
r.mutation["_expanded"] = "0";
|
|
126876
|
+
}
|
|
126877
|
+
else {
|
|
126878
|
+
r.mutation["_expanded"] = optionalCount.toString();
|
|
126879
|
+
}
|
|
126874
126880
|
}
|
|
126875
126881
|
return r;
|
|
126876
126882
|
}
|
package/built/pxtblockly.js
CHANGED
|
@@ -15246,6 +15246,7 @@ var pxtblockly;
|
|
|
15246
15246
|
.size(TOTAL_WIDTH, TOTAL_HEIGHT)
|
|
15247
15247
|
.setClass("blocklySpriteField")
|
|
15248
15248
|
.stroke("#fff", 1)
|
|
15249
|
+
.fill("#dedede")
|
|
15249
15250
|
.corner(TOTAL_HEIGHT / 2);
|
|
15250
15251
|
const clipPathId = "preview-clip-" + pxt.U.guidGen();
|
|
15251
15252
|
const clip = new svg.ClipPath()
|
|
@@ -15480,8 +15481,8 @@ var pxtblockly;
|
|
|
15480
15481
|
sound = {
|
|
15481
15482
|
duration: 1000,
|
|
15482
15483
|
startFrequency: 100,
|
|
15483
|
-
endFrequency:
|
|
15484
|
-
startVolume:
|
|
15484
|
+
endFrequency: 4800,
|
|
15485
|
+
startVolume: 100,
|
|
15485
15486
|
endVolume: 0,
|
|
15486
15487
|
wave: "sine",
|
|
15487
15488
|
interpolation: "linear",
|
package/built/pxtblocks.js
CHANGED
|
@@ -11684,6 +11684,7 @@ var pxtblockly;
|
|
|
11684
11684
|
.size(TOTAL_WIDTH, TOTAL_HEIGHT)
|
|
11685
11685
|
.setClass("blocklySpriteField")
|
|
11686
11686
|
.stroke("#fff", 1)
|
|
11687
|
+
.fill("#dedede")
|
|
11687
11688
|
.corner(TOTAL_HEIGHT / 2);
|
|
11688
11689
|
const clipPathId = "preview-clip-" + pxt.U.guidGen();
|
|
11689
11690
|
const clip = new svg.ClipPath()
|
|
@@ -11918,8 +11919,8 @@ var pxtblockly;
|
|
|
11918
11919
|
sound = {
|
|
11919
11920
|
duration: 1000,
|
|
11920
11921
|
startFrequency: 100,
|
|
11921
|
-
endFrequency:
|
|
11922
|
-
startVolume:
|
|
11922
|
+
endFrequency: 4800,
|
|
11923
|
+
startVolume: 100,
|
|
11923
11924
|
endVolume: 0,
|
|
11924
11925
|
wave: "sine",
|
|
11925
11926
|
interpolation: "linear",
|
package/built/pxtcompiler.js
CHANGED
|
@@ -5818,7 +5818,12 @@ ${output}</xml>`;
|
|
|
5818
5818
|
if (optionalCount) {
|
|
5819
5819
|
if (!r.mutation)
|
|
5820
5820
|
r.mutation = {};
|
|
5821
|
-
|
|
5821
|
+
if (attributes.compileHiddenArguments) {
|
|
5822
|
+
r.mutation["_expanded"] = "0";
|
|
5823
|
+
}
|
|
5824
|
+
else {
|
|
5825
|
+
r.mutation["_expanded"] = optionalCount.toString();
|
|
5826
|
+
}
|
|
5822
5827
|
}
|
|
5823
5828
|
return r;
|
|
5824
5829
|
}
|
package/built/pxtlib.d.ts
CHANGED
|
@@ -2313,6 +2313,8 @@ declare namespace pxt.assets {
|
|
|
2313
2313
|
endVolume: number;
|
|
2314
2314
|
duration: number;
|
|
2315
2315
|
}
|
|
2316
|
+
const MAX_FREQUENCY = 5000;
|
|
2317
|
+
const MAX_VOLUME = 255;
|
|
2316
2318
|
function renderSoundPath(sound: pxt.assets.Sound, width: number, height: number): string;
|
|
2317
2319
|
function renderWaveSnapshot(frequency: number, volume: number, wave: SoundWaveForm, width: number, height: number, timeBase: number): string;
|
|
2318
2320
|
}
|
package/built/pxtlib.js
CHANGED
|
@@ -16787,11 +16787,10 @@ var pxt;
|
|
|
16787
16787
|
(function (pxt) {
|
|
16788
16788
|
var assets;
|
|
16789
16789
|
(function (assets) {
|
|
16790
|
+
assets.MAX_FREQUENCY = 5000;
|
|
16791
|
+
assets.MAX_VOLUME = 255;
|
|
16790
16792
|
function renderSoundPath(sound, width, height) {
|
|
16791
16793
|
const { startFrequency, endFrequency, startVolume, endVolume, wave, interpolation } = sound;
|
|
16792
|
-
const scale = (start, end, percent) => {
|
|
16793
|
-
return Math.pow(start, 1 - percent) * Math.pow(end, percent);
|
|
16794
|
-
};
|
|
16795
16794
|
// To make the graph appear consistent with the implementation, use a seeded random for the noise waveform.
|
|
16796
16795
|
// The numbers are still nonsense but at least this reflects that it's deterministic.
|
|
16797
16796
|
const random = new SeededRandom(startFrequency + endFrequency + 1);
|
|
@@ -16808,11 +16807,13 @@ var pxt;
|
|
|
16808
16807
|
break;
|
|
16809
16808
|
}
|
|
16810
16809
|
if (wave === "noise") {
|
|
16811
|
-
getFrequencyAt = () => random.randomRange(500,
|
|
16810
|
+
getFrequencyAt = () => random.randomRange(500, 5000);
|
|
16812
16811
|
}
|
|
16813
|
-
const getVolumeAt = (x) => ((endVolume - startVolume) / width) * x + startVolume;
|
|
16814
|
-
const
|
|
16815
|
-
const
|
|
16812
|
+
const getVolumeAt = (x) => Math.max(Math.min(((endVolume - startVolume) / width) * x + startVolume, assets.MAX_VOLUME), 0);
|
|
16813
|
+
const minWaveWidth = 10;
|
|
16814
|
+
const maxWaveWidth = width / 2;
|
|
16815
|
+
const volumeToAmplitude = (volume) => (volume / assets.MAX_VOLUME) * (height - 2) / 2;
|
|
16816
|
+
const frequencyToWidth = (frequency) => (1 - frequency / assets.MAX_FREQUENCY) * (maxWaveWidth - minWaveWidth) + minWaveWidth;
|
|
16816
16817
|
const parts = [`M ${2} ${height / 2}`];
|
|
16817
16818
|
let currentX = 0;
|
|
16818
16819
|
while (currentX < width) {
|
|
@@ -16829,8 +16830,8 @@ var pxt;
|
|
|
16829
16830
|
// The numbers are still nonsense but at least this reflects that it's deterministic.
|
|
16830
16831
|
const random = new SeededRandom(frequency);
|
|
16831
16832
|
if (wave === "noise")
|
|
16832
|
-
frequency = random.randomRange(500,
|
|
16833
|
-
const amplitude = (volume /
|
|
16833
|
+
frequency = random.randomRange(500, 5000);
|
|
16834
|
+
const amplitude = (volume / assets.MAX_VOLUME) * (height - 2) / 2;
|
|
16834
16835
|
const waveHalfWidth = (width / (frequency * timeBase / 1000)) / 2;
|
|
16835
16836
|
let numSegments = Math.ceil(width / (waveHalfWidth * 2));
|
|
16836
16837
|
if (numSegments % 2 === 1)
|