pxt-microbit 6.0.8 → 6.0.9
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/sim-strings.json +1 -1
- package/built/sim.d.ts +9 -0
- package/built/sim.js +64 -0
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.json +1 -1
- package/built/web/react-common-authcode.css +1 -1
- package/built/web/react-common-multiplayer.css +1 -1
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-authcode.css +1 -1
- package/built/web/rtlreact-common-multiplayer.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +2 -2
- package/built/web/semantic.css +2 -2
- package/package.json +2 -2
- package/sim/public/simulator.html +45 -0
package/built/sim-strings.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"Sound Level":"Sound Level","Thermometer":"Thermometer","acceleration.pitch":"acceleration.pitch","acceleration.roll":"acceleration.roll","acceleration.strength":"acceleration.strength","acceleration.x":"acceleration.x","acceleration.y":"acceleration.y","acceleration.z":"acceleration.z","heading":"heading","lightLevel":"lightLevel","logo touch (micro:bit v2 needed)":"logo touch (micro:bit v2 needed)","micro:bit v2 needed":"micro:bit v2 needed","microphone (micro:bit v2 needed)":"microphone (micro:bit v2 needed)","sound level":"sound level","temperature":"temperature"}
|
|
1
|
+
{"Sound Level":"Sound Level","Thermometer":"Thermometer","Unmute simulator":"Unmute simulator","acceleration.pitch":"acceleration.pitch","acceleration.roll":"acceleration.roll","acceleration.strength":"acceleration.strength","acceleration.x":"acceleration.x","acceleration.y":"acceleration.y","acceleration.z":"acceleration.z","heading":"heading","lightLevel":"lightLevel","logo touch (micro:bit v2 needed)":"logo touch (micro:bit v2 needed)","micro:bit v2 needed":"micro:bit v2 needed","microphone (micro:bit v2 needed)":"microphone (micro:bit v2 needed)","sound level":"sound level","temperature":"temperature"}
|
package/built/sim.d.ts
CHANGED
|
@@ -784,6 +784,15 @@ declare namespace pxsim.visuals {
|
|
|
784
784
|
private attachAPlusBEvents;
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
+
declare namespace pxsim {
|
|
788
|
+
function createMuteButton(): HTMLDivElement;
|
|
789
|
+
function shouldShowMute(): boolean;
|
|
790
|
+
function hasNavigator(): boolean;
|
|
791
|
+
function isEdge(): boolean;
|
|
792
|
+
function isIE(): boolean;
|
|
793
|
+
function isChrome(): boolean;
|
|
794
|
+
function isSafari(): boolean;
|
|
795
|
+
}
|
|
787
796
|
declare namespace pxsim.pxtcore {
|
|
788
797
|
function registerWithDal(id: number, evid: number, handler: RefAction, mode?: number): void;
|
|
789
798
|
function deepSleep(): void;
|
package/built/sim.js
CHANGED
|
@@ -133,6 +133,11 @@ var pxsim;
|
|
|
133
133
|
}), opts);
|
|
134
134
|
document.body.innerHTML = ""; // clear children
|
|
135
135
|
document.body.appendChild(this.view = this.viewHost.getView());
|
|
136
|
+
if (pxsim.shouldShowMute()) {
|
|
137
|
+
document.body.appendChild(pxsim.createMuteButton());
|
|
138
|
+
pxsim.AudioContextManager.mute(true);
|
|
139
|
+
pxsim.setParentMuteState("disabled");
|
|
140
|
+
}
|
|
136
141
|
if (msg.theme === "mbcodal") {
|
|
137
142
|
this.ensureHardwareVersion(2);
|
|
138
143
|
}
|
|
@@ -4084,6 +4089,65 @@ path.sim-board {
|
|
|
4084
4089
|
})(visuals = pxsim.visuals || (pxsim.visuals = {}));
|
|
4085
4090
|
})(pxsim || (pxsim = {}));
|
|
4086
4091
|
var pxsim;
|
|
4092
|
+
(function (pxsim) {
|
|
4093
|
+
const icon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"/></svg>`;
|
|
4094
|
+
// We only need to unmute from within the iframe once
|
|
4095
|
+
let hasUnmuted = false;
|
|
4096
|
+
function createMuteButton() {
|
|
4097
|
+
const el = document.createElement("div");
|
|
4098
|
+
el.setAttribute("id", "safari-mute-button-outer");
|
|
4099
|
+
el.innerHTML = `
|
|
4100
|
+
<button class="safari-mute-button">
|
|
4101
|
+
${icon}
|
|
4102
|
+
</button>
|
|
4103
|
+
`;
|
|
4104
|
+
const button = el.firstElementChild;
|
|
4105
|
+
button.setAttribute("title", pxsim.localization.lf("Unmute simulator"));
|
|
4106
|
+
button.addEventListener("click", () => {
|
|
4107
|
+
pxsim.AudioContextManager.mute(false);
|
|
4108
|
+
pxsim.setParentMuteState("unmuted");
|
|
4109
|
+
button.remove();
|
|
4110
|
+
hasUnmuted = true;
|
|
4111
|
+
});
|
|
4112
|
+
return el;
|
|
4113
|
+
}
|
|
4114
|
+
pxsim.createMuteButton = createMuteButton;
|
|
4115
|
+
function shouldShowMute() {
|
|
4116
|
+
return isSafari() && !hasUnmuted;
|
|
4117
|
+
}
|
|
4118
|
+
pxsim.shouldShowMute = shouldShowMute;
|
|
4119
|
+
// Everything below is taken from browserutils in pxt
|
|
4120
|
+
function hasNavigator() {
|
|
4121
|
+
return typeof navigator !== "undefined";
|
|
4122
|
+
}
|
|
4123
|
+
pxsim.hasNavigator = hasNavigator;
|
|
4124
|
+
//Microsoft Edge lies about its user agent and claims to be Chrome, but Microsoft Edge/Version
|
|
4125
|
+
//is always at the end
|
|
4126
|
+
function isEdge() {
|
|
4127
|
+
return hasNavigator() && /Edge/i.test(navigator.userAgent);
|
|
4128
|
+
}
|
|
4129
|
+
pxsim.isEdge = isEdge;
|
|
4130
|
+
//IE11 also lies about its user agent, but has Trident appear somewhere in
|
|
4131
|
+
//the user agent. Detecting the different between IE11 and Microsoft Edge isn't
|
|
4132
|
+
//super-important because the UI is similar enough
|
|
4133
|
+
function isIE() {
|
|
4134
|
+
return hasNavigator() && /Trident/i.test(navigator.userAgent);
|
|
4135
|
+
}
|
|
4136
|
+
pxsim.isIE = isIE;
|
|
4137
|
+
//Microsoft Edge and IE11 lie about being Chrome. Chromium-based Edge ("Edgeium") will be detected as Chrome, that is ok. If you're looking for Edgeium, use `isChromiumEdge()`.
|
|
4138
|
+
function isChrome() {
|
|
4139
|
+
return !isEdge() && !isIE() && !!navigator && (/Chrome/i.test(navigator.userAgent) || /Chromium/i.test(navigator.userAgent));
|
|
4140
|
+
}
|
|
4141
|
+
pxsim.isChrome = isChrome;
|
|
4142
|
+
//Chrome and Microsoft Edge lie about being Safari
|
|
4143
|
+
function isSafari() {
|
|
4144
|
+
//Could also check isMac but I don't want to risk excluding iOS
|
|
4145
|
+
//Checking for iPhone, iPod or iPad as well as Safari in order to detect home screen browsers on iOS
|
|
4146
|
+
return !isChrome() && !isEdge() && !!navigator && /(Macintosh|Safari|iPod|iPhone|iPad)/i.test(navigator.userAgent);
|
|
4147
|
+
}
|
|
4148
|
+
pxsim.isSafari = isSafari;
|
|
4149
|
+
})(pxsim || (pxsim = {}));
|
|
4150
|
+
var pxsim;
|
|
4087
4151
|
(function (pxsim) {
|
|
4088
4152
|
var pxtcore;
|
|
4089
4153
|
(function (pxtcore) {
|