pxt-core 8.2.9 → 8.2.11
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 +40 -20
- package/built/pxtsim.d.ts +9 -0
- package/built/pxtsim.js +40 -20
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtembed.js +1 -1
- package/built/web/pxtsim.js +1 -1
- package/built/web/react-common-authcode.css +160 -32
- 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/package.json +1 -1
- package/react-common/components/share/Share.tsx +8 -21
- package/react-common/components/share/ShareInfo.tsx +142 -132
- package/react-common/components/share/SocialButton.tsx +36 -6
- package/react-common/components/share/ThumbnailRecorder.tsx +149 -0
- package/react-common/styles/controls/Button.less +30 -3
- package/react-common/styles/controls/Modal.less +7 -2
- package/react-common/styles/share/share.less +169 -31
- package/react-common/components/share/GifInfo.tsx +0 -63
- package/react-common/components/share/GifRecorder.tsx +0 -97
package/built/pxt.js
CHANGED
|
@@ -152944,19 +152944,16 @@ var pxsim;
|
|
|
152944
152944
|
if (Runtime.messagePosted)
|
|
152945
152945
|
Runtime.messagePosted(data);
|
|
152946
152946
|
}
|
|
152947
|
-
static postScreenshotAsync(opts) {
|
|
152947
|
+
static async postScreenshotAsync(opts) {
|
|
152948
152948
|
const b = pxsim.runtime && pxsim.runtime.board;
|
|
152949
|
-
|
|
152950
|
-
|
|
152951
|
-
|
|
152952
|
-
|
|
152953
|
-
})
|
|
152954
|
-
: Promise.resolve(undefined);
|
|
152955
|
-
return p.then(img => Runtime.postMessage({
|
|
152949
|
+
if (!b)
|
|
152950
|
+
return undefined;
|
|
152951
|
+
const img = await b.screenshotAsync();
|
|
152952
|
+
Runtime.postMessage({
|
|
152956
152953
|
type: "screenshot",
|
|
152957
152954
|
data: img,
|
|
152958
152955
|
delay: opts && opts.delay
|
|
152959
|
-
})
|
|
152956
|
+
});
|
|
152960
152957
|
}
|
|
152961
152958
|
static requestToggleRecording() {
|
|
152962
152959
|
const r = pxsim.runtime;
|
|
@@ -153010,17 +153007,8 @@ var pxsim;
|
|
|
153010
153007
|
this.board.screenshotAsync(this.recordingWidth)
|
|
153011
153008
|
.then(imageData => {
|
|
153012
153009
|
// check for duplicate images
|
|
153013
|
-
if (this.recordingLastImageData && imageData
|
|
153014
|
-
|
|
153015
|
-
const d0 = this.recordingLastImageData.data;
|
|
153016
|
-
const d1 = imageData.data;
|
|
153017
|
-
const n = d0.byteLength;
|
|
153018
|
-
let i = 0;
|
|
153019
|
-
for (i = 0; i < n; ++i)
|
|
153020
|
-
if (d0[i] != d1[i])
|
|
153021
|
-
break;
|
|
153022
|
-
if (i == n) // same, don't send update
|
|
153023
|
-
return;
|
|
153010
|
+
if (this.recordingLastImageData && isImageDataEqual(this.recordingLastImageData, imageData)) {
|
|
153011
|
+
return;
|
|
153024
153012
|
}
|
|
153025
153013
|
this.recordingLastImageData = imageData;
|
|
153026
153014
|
Runtime.postMessage({
|
|
@@ -153200,6 +153188,28 @@ var pxsim;
|
|
|
153200
153188
|
return ts.totalRuntime > elapsed;
|
|
153201
153189
|
});
|
|
153202
153190
|
}
|
|
153191
|
+
registerUserInteraction() {
|
|
153192
|
+
this.lastInteractionTime = Date.now();
|
|
153193
|
+
if (this.thumbnailRecordingIntervalRef || this.lastThumbnailTime && this.lastInteractionTime - this.lastThumbnailTime < 1000)
|
|
153194
|
+
return;
|
|
153195
|
+
this.thumbnailFrames = [];
|
|
153196
|
+
this.thumbnailRecordingIntervalRef = setInterval(async () => {
|
|
153197
|
+
const imageData = await this.board.screenshotAsync();
|
|
153198
|
+
if (this.thumbnailFrames.length && isImageDataEqual(imageData, this.thumbnailFrames[this.thumbnailFrames.length - 1])) {
|
|
153199
|
+
return;
|
|
153200
|
+
}
|
|
153201
|
+
this.thumbnailFrames.push(imageData);
|
|
153202
|
+
if (Date.now() - this.lastInteractionTime > 10000 || this.thumbnailFrames.length > 30) {
|
|
153203
|
+
clearInterval(this.thumbnailRecordingIntervalRef);
|
|
153204
|
+
this.thumbnailRecordingIntervalRef = undefined;
|
|
153205
|
+
this.lastThumbnailTime = Date.now();
|
|
153206
|
+
Runtime.postMessage({
|
|
153207
|
+
type: "thumbnail",
|
|
153208
|
+
frames: this.thumbnailFrames
|
|
153209
|
+
});
|
|
153210
|
+
}
|
|
153211
|
+
}, 66);
|
|
153212
|
+
}
|
|
153203
153213
|
}
|
|
153204
153214
|
pxsim.Runtime = Runtime;
|
|
153205
153215
|
class PerfCounter {
|
|
@@ -153213,6 +153223,16 @@ var pxsim;
|
|
|
153213
153223
|
}
|
|
153214
153224
|
}
|
|
153215
153225
|
pxsim.PerfCounter = PerfCounter;
|
|
153226
|
+
function isImageDataEqual(d0, d1) {
|
|
153227
|
+
if (d0.data.byteLength !== d1.data.byteLength)
|
|
153228
|
+
return false;
|
|
153229
|
+
const n = d0.data.byteLength;
|
|
153230
|
+
let i = 0;
|
|
153231
|
+
for (i = 0; i < n; ++i)
|
|
153232
|
+
if (d0.data[i] != d1.data[i])
|
|
153233
|
+
break;
|
|
153234
|
+
return i === n;
|
|
153235
|
+
}
|
|
153216
153236
|
})(pxsim || (pxsim = {}));
|
|
153217
153237
|
var pxsim;
|
|
153218
153238
|
(function (pxsim) {
|
package/built/pxtsim.d.ts
CHANGED
|
@@ -465,6 +465,10 @@ declare namespace pxsim {
|
|
|
465
465
|
delay?: number;
|
|
466
466
|
modalContext?: string;
|
|
467
467
|
}
|
|
468
|
+
interface SimulatorAutomaticThumbnailMessage extends SimulatorMessage {
|
|
469
|
+
type: "thumbnail";
|
|
470
|
+
frames: ImageData[];
|
|
471
|
+
}
|
|
468
472
|
interface SimulatorAddExtensionsMessage extends SimulatorMessage {
|
|
469
473
|
type: "addextensions";
|
|
470
474
|
/**
|
|
@@ -1147,6 +1151,10 @@ declare namespace pxsim {
|
|
|
1147
1151
|
perfOffset: number;
|
|
1148
1152
|
perfElapsed: number;
|
|
1149
1153
|
perfStack: number;
|
|
1154
|
+
lastInteractionTime: number;
|
|
1155
|
+
lastThumbnailTime: number;
|
|
1156
|
+
thumbnailRecordingIntervalRef: number;
|
|
1157
|
+
thumbnailFrames: ImageData[];
|
|
1150
1158
|
refCountingDebug: boolean;
|
|
1151
1159
|
private refObjId;
|
|
1152
1160
|
overwriteResume: (retPC: number) => void;
|
|
@@ -1191,6 +1199,7 @@ declare namespace pxsim {
|
|
|
1191
1199
|
pauseScheduled(): void;
|
|
1192
1200
|
resumeAllPausedScheduled(): void;
|
|
1193
1201
|
cleanScheduledExpired(): void;
|
|
1202
|
+
registerUserInteraction(): void;
|
|
1194
1203
|
}
|
|
1195
1204
|
class PerfCounter {
|
|
1196
1205
|
name: string;
|
package/built/pxtsim.js
CHANGED
|
@@ -5695,19 +5695,16 @@ var pxsim;
|
|
|
5695
5695
|
if (Runtime.messagePosted)
|
|
5696
5696
|
Runtime.messagePosted(data);
|
|
5697
5697
|
}
|
|
5698
|
-
static postScreenshotAsync(opts) {
|
|
5698
|
+
static async postScreenshotAsync(opts) {
|
|
5699
5699
|
const b = pxsim.runtime && pxsim.runtime.board;
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
})
|
|
5705
|
-
: Promise.resolve(undefined);
|
|
5706
|
-
return p.then(img => Runtime.postMessage({
|
|
5700
|
+
if (!b)
|
|
5701
|
+
return undefined;
|
|
5702
|
+
const img = await b.screenshotAsync();
|
|
5703
|
+
Runtime.postMessage({
|
|
5707
5704
|
type: "screenshot",
|
|
5708
5705
|
data: img,
|
|
5709
5706
|
delay: opts && opts.delay
|
|
5710
|
-
})
|
|
5707
|
+
});
|
|
5711
5708
|
}
|
|
5712
5709
|
static requestToggleRecording() {
|
|
5713
5710
|
const r = pxsim.runtime;
|
|
@@ -5761,17 +5758,8 @@ var pxsim;
|
|
|
5761
5758
|
this.board.screenshotAsync(this.recordingWidth)
|
|
5762
5759
|
.then(imageData => {
|
|
5763
5760
|
// check for duplicate images
|
|
5764
|
-
if (this.recordingLastImageData && imageData
|
|
5765
|
-
|
|
5766
|
-
const d0 = this.recordingLastImageData.data;
|
|
5767
|
-
const d1 = imageData.data;
|
|
5768
|
-
const n = d0.byteLength;
|
|
5769
|
-
let i = 0;
|
|
5770
|
-
for (i = 0; i < n; ++i)
|
|
5771
|
-
if (d0[i] != d1[i])
|
|
5772
|
-
break;
|
|
5773
|
-
if (i == n) // same, don't send update
|
|
5774
|
-
return;
|
|
5761
|
+
if (this.recordingLastImageData && isImageDataEqual(this.recordingLastImageData, imageData)) {
|
|
5762
|
+
return;
|
|
5775
5763
|
}
|
|
5776
5764
|
this.recordingLastImageData = imageData;
|
|
5777
5765
|
Runtime.postMessage({
|
|
@@ -5951,6 +5939,28 @@ var pxsim;
|
|
|
5951
5939
|
return ts.totalRuntime > elapsed;
|
|
5952
5940
|
});
|
|
5953
5941
|
}
|
|
5942
|
+
registerUserInteraction() {
|
|
5943
|
+
this.lastInteractionTime = Date.now();
|
|
5944
|
+
if (this.thumbnailRecordingIntervalRef || this.lastThumbnailTime && this.lastInteractionTime - this.lastThumbnailTime < 1000)
|
|
5945
|
+
return;
|
|
5946
|
+
this.thumbnailFrames = [];
|
|
5947
|
+
this.thumbnailRecordingIntervalRef = setInterval(async () => {
|
|
5948
|
+
const imageData = await this.board.screenshotAsync();
|
|
5949
|
+
if (this.thumbnailFrames.length && isImageDataEqual(imageData, this.thumbnailFrames[this.thumbnailFrames.length - 1])) {
|
|
5950
|
+
return;
|
|
5951
|
+
}
|
|
5952
|
+
this.thumbnailFrames.push(imageData);
|
|
5953
|
+
if (Date.now() - this.lastInteractionTime > 10000 || this.thumbnailFrames.length > 30) {
|
|
5954
|
+
clearInterval(this.thumbnailRecordingIntervalRef);
|
|
5955
|
+
this.thumbnailRecordingIntervalRef = undefined;
|
|
5956
|
+
this.lastThumbnailTime = Date.now();
|
|
5957
|
+
Runtime.postMessage({
|
|
5958
|
+
type: "thumbnail",
|
|
5959
|
+
frames: this.thumbnailFrames
|
|
5960
|
+
});
|
|
5961
|
+
}
|
|
5962
|
+
}, 66);
|
|
5963
|
+
}
|
|
5954
5964
|
}
|
|
5955
5965
|
pxsim.Runtime = Runtime;
|
|
5956
5966
|
class PerfCounter {
|
|
@@ -5964,6 +5974,16 @@ var pxsim;
|
|
|
5964
5974
|
}
|
|
5965
5975
|
}
|
|
5966
5976
|
pxsim.PerfCounter = PerfCounter;
|
|
5977
|
+
function isImageDataEqual(d0, d1) {
|
|
5978
|
+
if (d0.data.byteLength !== d1.data.byteLength)
|
|
5979
|
+
return false;
|
|
5980
|
+
const n = d0.data.byteLength;
|
|
5981
|
+
let i = 0;
|
|
5982
|
+
for (i = 0; i < n; ++i)
|
|
5983
|
+
if (d0.data[i] != d1.data[i])
|
|
5984
|
+
break;
|
|
5985
|
+
return i === n;
|
|
5986
|
+
}
|
|
5967
5987
|
})(pxsim || (pxsim = {}));
|
|
5968
5988
|
var pxsim;
|
|
5969
5989
|
(function (pxsim) {
|