Updating npm dependencies and getting the build to work (#1001)
* Updating npm dependencies and getting the build to work * update node in github actions to 14.x
This commit is contained in:
parent
617fdeb747
commit
bef4ebac43
2
.github/workflows/pxt-buildmain.yml
vendored
2
.github/workflows/pxt-buildmain.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [8.x]
|
node-version: [14.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
2
.github/workflows/pxt-buildpr.yml
vendored
2
.github/workflows/pxt-buildpr.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [8.x]
|
node-version: [14.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
2
.github/workflows/pxt-buildpush.yml
vendored
2
.github/workflows/pxt-buildpush.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [8.x]
|
node-version: [14.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
@ -49,7 +49,7 @@ declare interface Serial extends EventTarget {
|
|||||||
requestPort(options: SerialPortRequestOptions): Promise<SerialPort>;
|
requestPort(options: SerialPortRequestOptions): Promise<SerialPort>;
|
||||||
}
|
}
|
||||||
|
|
||||||
class WebSerialPackageIO implements pxt.HF2.PacketIO {
|
class WebSerialPackageIO implements pxt.packetio.PacketIO {
|
||||||
onData: (v: Uint8Array) => void;
|
onData: (v: Uint8Array) => void;
|
||||||
onError: (e: Error) => void;
|
onError: (e: Error) => void;
|
||||||
onEvent: (v: Uint8Array) => void;
|
onEvent: (v: Uint8Array) => void;
|
||||||
@ -87,7 +87,7 @@ class WebSerialPackageIO implements pxt.HF2.PacketIO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static portIos: WebSerialPackageIO[] = [];
|
static portIos: WebSerialPackageIO[] = [];
|
||||||
static async mkPacketIOAsync(): Promise<pxt.HF2.PacketIO> {
|
static async mkPacketIOAsync(): Promise<pxt.packetio.PacketIO> {
|
||||||
const serial = (<any>navigator).serial;
|
const serial = (<any>navigator).serial;
|
||||||
if (serial) {
|
if (serial) {
|
||||||
try {
|
try {
|
||||||
@ -130,7 +130,7 @@ class WebSerialPackageIO implements pxt.HF2.PacketIO {
|
|||||||
|
|
||||||
private async closeAsync() {
|
private async closeAsync() {
|
||||||
// don't close port
|
// don't close port
|
||||||
return Promise.delay(500);
|
return pxt.U.delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
reconnectAsync(): Promise<void> {
|
reconnectAsync(): Promise<void> {
|
||||||
@ -146,11 +146,33 @@ class WebSerialPackageIO implements pxt.HF2.PacketIO {
|
|||||||
this._writer = this.port.writable.getWriter();
|
this._writer = this.port.writable.getWriter();
|
||||||
return this._writer.write(pkt);
|
return this._writer.write(pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDeviceConnectionChanged(connect: boolean) {
|
||||||
|
throw new Error("onDeviceConnectionChanged not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
onConnectionChanged() {
|
||||||
|
throw new Error("onConnectionChanged not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
isConnecting() {
|
||||||
|
throw new Error("isConnecting not implemented");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
isConnected() {
|
||||||
|
throw new Error("isConnected not implemented");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
disposeAsync() {
|
||||||
|
return Promise.reject("disposeAsync not implemented")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hf2Async() {
|
function hf2Async() {
|
||||||
const pktIOAsync: Promise<pxt.HF2.PacketIO> = useWebSerial
|
const pktIOAsync: Promise<pxt.packetio.PacketIO> = useWebSerial
|
||||||
? WebSerialPackageIO.mkPacketIOAsync() : pxt.HF2.mkPacketIOAsync()
|
? WebSerialPackageIO.mkPacketIOAsync() : pxt.packetio.mkPacketIOAsync()
|
||||||
return pktIOAsync.then(h => {
|
return pktIOAsync.then(h => {
|
||||||
let w = new Ev3Wrapper(h)
|
let w = new Ev3Wrapper(h)
|
||||||
ev3 = w
|
ev3 = w
|
||||||
@ -190,14 +212,19 @@ export function enableWebSerialAsync() {
|
|||||||
else return Promise.resolve();
|
else return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanupAsync() {
|
async function cleanupAsync() {
|
||||||
if (ev3) {
|
if (ev3) {
|
||||||
console.log('cleanup previous port')
|
console.log('cleanup previous port')
|
||||||
return ev3.disconnectAsync()
|
try {
|
||||||
.catch(e => { })
|
await ev3.disconnectAsync()
|
||||||
.finally(() => { ev3 = undefined; });
|
}
|
||||||
|
catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
ev3 = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let initPromise: Promise<Ev3Wrapper>
|
let initPromise: Promise<Ev3Wrapper>
|
||||||
@ -207,7 +234,7 @@ function initHidAsync() { // needs to run within a click handler
|
|||||||
if (useHID) {
|
if (useHID) {
|
||||||
initPromise = cleanupAsync()
|
initPromise = cleanupAsync()
|
||||||
.then(() => hf2Async())
|
.then(() => hf2Async())
|
||||||
.catch(err => {
|
.catch((err: any) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
initPromise = null
|
initPromise = null
|
||||||
useHID = false;
|
useHID = false;
|
||||||
@ -284,7 +311,7 @@ export function deployCoreAsync(resp: pxtc.CompileResult) {
|
|||||||
.catch(e => {
|
.catch(e => {
|
||||||
// user easily forgets to stop robot
|
// user easily forgets to stop robot
|
||||||
bluetoothTryAgainAsync().then(() => w.disconnectAsync())
|
bluetoothTryAgainAsync().then(() => w.disconnectAsync())
|
||||||
.then(() => Promise.delay(1000))
|
.then(() => pxt.U.delay(1000))
|
||||||
.then(() => w.reconnectAsync());
|
.then(() => w.reconnectAsync());
|
||||||
|
|
||||||
// nothing we can do
|
// nothing we can do
|
||||||
@ -296,7 +323,7 @@ export function deployCoreAsync(resp: pxtc.CompileResult) {
|
|||||||
.then(() => w.flashAsync(elfPath, UF2.readBytes(origElfUF2, 0, origElfUF2.length * 256)))
|
.then(() => w.flashAsync(elfPath, UF2.readBytes(origElfUF2, 0, origElfUF2.length * 256)))
|
||||||
.then(() => w.flashAsync(rbfPath, rbfBIN))
|
.then(() => w.flashAsync(rbfPath, rbfBIN))
|
||||||
.then(() => w.runAsync(rbfPath))
|
.then(() => w.runAsync(rbfPath))
|
||||||
.then(() => Promise.delay(500))
|
.then(() => pxt.U.delay(500))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
pxt.tickEvent("webserial.success");
|
pxt.tickEvent("webserial.success");
|
||||||
return w.disconnectAsync()
|
return w.disconnectAsync()
|
||||||
|
@ -21,7 +21,7 @@ export function bluetoothTryAgainAsync(): Promise<void> {
|
|||||||
|
|
||||||
function enableWebSerialAndCompileAsync() {
|
function enableWebSerialAndCompileAsync() {
|
||||||
return enableWebSerialAsync()
|
return enableWebSerialAsync()
|
||||||
.then(() => Promise.delay(500))
|
.then(() => pxt.U.delay(500))
|
||||||
.then(() => projectView.compile());
|
.then(() => projectView.compile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ function explainWebSerialPairingAsync(): Promise<void> {
|
|||||||
export function showUploadDialogAsync(fn: string, url: string, _confirmAsync: (options: any) => Promise<number>): Promise<void> {
|
export function showUploadDialogAsync(fn: string, url: string, _confirmAsync: (options: any) => Promise<number>): Promise<void> {
|
||||||
confirmAsync = _confirmAsync;
|
confirmAsync = _confirmAsync;
|
||||||
// https://msdn.microsoft.com/en-us/library/cc848897.aspx
|
// https://msdn.microsoft.com/en-us/library/cc848897.aspx
|
||||||
// "For security reasons, data URIs are restricted to downloaded resources.
|
// "For security reasons, data URIs are restricted to downloaded resources.
|
||||||
// Data URIs cannot be used for navigation, for scripting, or to populate frame or iframe elements"
|
// Data URIs cannot be used for navigation, for scripting, or to populate frame or iframe elements"
|
||||||
const downloadAgain = !pxt.BrowserUtils.isIE() && !pxt.BrowserUtils.isEdge();
|
const downloadAgain = !pxt.BrowserUtils.isIE() && !pxt.BrowserUtils.isEdge();
|
||||||
const docUrl = pxt.appTarget.appTheme.usbDocs;
|
const docUrl = pxt.appTarget.appTheme.usbDocs;
|
||||||
@ -126,7 +126,6 @@ export function showUploadDialogAsync(fn: string, url: string, _confirmAsync: (o
|
|||||||
pxt.tickEvent("bluetooth.enable");
|
pxt.tickEvent("bluetooth.enable");
|
||||||
explainWebSerialPairingAsync()
|
explainWebSerialPairingAsync()
|
||||||
.then(() => enableWebSerialAndCompileAsync())
|
.then(() => enableWebSerialAndCompileAsync())
|
||||||
.done();
|
|
||||||
}
|
}
|
||||||
} : undefined, downloadAgain ? {
|
} : undefined, downloadAgain ? {
|
||||||
label: fn,
|
label: fn,
|
||||||
|
@ -26,7 +26,7 @@ export class Ev3Wrapper {
|
|||||||
isStreaming = false;
|
isStreaming = false;
|
||||||
dataDump = /talkdbg=1/.test(window.location.href);
|
dataDump = /talkdbg=1/.test(window.location.href);
|
||||||
|
|
||||||
constructor(public io: pxt.HF2.PacketIO) {
|
constructor(public io: pxt.packetio.PacketIO) {
|
||||||
io.onData = buf => {
|
io.onData = buf => {
|
||||||
buf = buf.slice(0, HF2.read16(buf, 0) + 2)
|
buf = buf.slice(0, HF2.read16(buf, 0) + 2)
|
||||||
if (HF2.read16(buf, 4) == usbMagic) {
|
if (HF2.read16(buf, 4) == usbMagic) {
|
||||||
@ -81,7 +81,7 @@ export class Ev3Wrapper {
|
|||||||
log(`stopping PXT app`)
|
log(`stopping PXT app`)
|
||||||
let buf = this.allocCustom(2)
|
let buf = this.allocCustom(2)
|
||||||
return this.justSendAsync(buf)
|
return this.justSendAsync(buf)
|
||||||
.then(() => Promise.delay(500))
|
.then(() => pxt.U.delay(500))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ export class Ev3Wrapper {
|
|||||||
let contFileReq = this.allocSystem(1 + 2, 0x97)
|
let contFileReq = this.allocSystem(1 + 2, 0x97)
|
||||||
HF2.write16(contFileReq, 7, 1000) // maxRead
|
HF2.write16(contFileReq, 7, 1000) // maxRead
|
||||||
contFileReq[6] = handle
|
contFileReq[6] = handle
|
||||||
return Promise.delay(data.length > 0 ? 0 : 500)
|
return pxt.U.delay(data.length > 0 ? 0 : 500)
|
||||||
.then(() => this.talkAsync(contFileReq, -1))
|
.then(() => this.talkAsync(contFileReq, -1))
|
||||||
.then(resp)
|
.then(resp)
|
||||||
}
|
}
|
||||||
@ -251,7 +251,7 @@ export class Ev3Wrapper {
|
|||||||
let loop = (): Promise<void> =>
|
let loop = (): Promise<void> =>
|
||||||
this.lock.enqueue("file", () =>
|
this.lock.enqueue("file", () =>
|
||||||
this.streamFileOnceAsync(path, cb))
|
this.streamFileOnceAsync(path, cb))
|
||||||
.then(() => Promise.delay(500))
|
.then(() => pxt.U.delay(500))
|
||||||
.then(loop)
|
.then(loop)
|
||||||
return loop()
|
return loop()
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||||
|
|
||||||
import { FieldPorts } from "./field_ports";
|
import { FieldPorts } from "./field_ports";
|
||||||
import { FieldMotors } from "./field_motors";
|
|
||||||
import { FieldBrickButtons } from "./field_brickbuttons";
|
import { FieldBrickButtons } from "./field_brickbuttons";
|
||||||
import { FieldColorEnum } from "./field_color";
|
import { FieldColorEnum } from "./field_color";
|
||||||
import { FieldMusic } from "./field_music";
|
import { FieldMusic } from "./field_music";
|
||||||
@ -14,9 +13,6 @@ pxt.editor.initFieldExtensionsAsync = function (opts: pxt.editor.FieldExtensionO
|
|||||||
fieldEditors: [{
|
fieldEditors: [{
|
||||||
selector: "ports",
|
selector: "ports",
|
||||||
editor: FieldPorts
|
editor: FieldPorts
|
||||||
}, {
|
|
||||||
selector: "motors",
|
|
||||||
editor: FieldMotors
|
|
||||||
}, {
|
}, {
|
||||||
selector: "brickbuttons",
|
selector: "brickbuttons",
|
||||||
editor: FieldBrickButtons
|
editor: FieldBrickButtons
|
||||||
|
@ -64,7 +64,7 @@ export class FieldColorEnum extends pxtblockly.FieldColorNumber implements Block
|
|||||||
}
|
}
|
||||||
this.value_ = colour;
|
this.value_ = colour;
|
||||||
if (this.sourceBlock_) {
|
if (this.sourceBlock_) {
|
||||||
this.sourceBlock_.setColour(colour, colour, colour);
|
this.sourceBlock_.setColour(colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
@ -27,7 +27,6 @@ export class FieldMusic extends pxtblockly.FieldImages implements Blockly.FieldC
|
|||||||
|
|
||||||
this.setText = Blockly.FieldDropdown.prototype.setText;
|
this.setText = Blockly.FieldDropdown.prototype.setText;
|
||||||
this.updateSize_ = (Blockly.Field as any).prototype.updateSize_;
|
this.updateSize_ = (Blockly.Field as any).prototype.updateSize_;
|
||||||
this.updateTextNode_ = Blockly.Field.prototype.updateTextNode_;
|
|
||||||
|
|
||||||
if (!pxt.BrowserUtils.isIE() && !soundCache) {
|
if (!pxt.BrowserUtils.isIE() && !soundCache) {
|
||||||
soundCache = JSON.parse(pxtTargetBundle.bundledpkgs['music']['sounds.jres']);
|
soundCache = JSON.parse(pxtTargetBundle.bundledpkgs['music']['sounds.jres']);
|
||||||
@ -68,7 +67,8 @@ export class FieldMusic extends pxtblockly.FieldImages implements Blockly.FieldC
|
|||||||
// Accessibility properties
|
// Accessibility properties
|
||||||
categoriesDiv.setAttribute('role', 'menu');
|
categoriesDiv.setAttribute('role', 'menu');
|
||||||
categoriesDiv.setAttribute('aria-haspopup', 'true');
|
categoriesDiv.setAttribute('aria-haspopup', 'true');
|
||||||
categoriesDiv.style.backgroundColor = this.sourceBlock_.getColourTertiary();
|
// FIXME: tertiary color?
|
||||||
|
categoriesDiv.style.backgroundColor = this.sourceBlock_.getColour();
|
||||||
categoriesDiv.className = 'blocklyMusicFieldCategories';
|
categoriesDiv.className = 'blocklyMusicFieldCategories';
|
||||||
|
|
||||||
this.refreshCategories(categoriesDiv, categories);
|
this.refreshCategories(categoriesDiv, categories);
|
||||||
@ -82,7 +82,9 @@ export class FieldMusic extends pxtblockly.FieldImages implements Blockly.FieldC
|
|||||||
dropdownDiv.appendChild(categoriesDiv);
|
dropdownDiv.appendChild(categoriesDiv);
|
||||||
dropdownDiv.appendChild(contentDiv);
|
dropdownDiv.appendChild(contentDiv);
|
||||||
|
|
||||||
Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(), this.sourceBlock_.getColourTertiary());
|
Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(),
|
||||||
|
// FIXME: tertiary color?
|
||||||
|
this.sourceBlock_.getColour());
|
||||||
|
|
||||||
// Calculate positioning based on the field position.
|
// Calculate positioning based on the field position.
|
||||||
let scale = (<Blockly.WorkspaceSvg>this.sourceBlock_.workspace).scale;
|
let scale = (<Blockly.WorkspaceSvg>this.sourceBlock_.workspace).scale;
|
||||||
@ -102,10 +104,9 @@ export class FieldMusic extends pxtblockly.FieldImages implements Blockly.FieldC
|
|||||||
// Update colour to look selected.
|
// Update colour to look selected.
|
||||||
if (this.sourceBlock_.isShadow()) {
|
if (this.sourceBlock_.isShadow()) {
|
||||||
this.savedPrimary_ = this.sourceBlock_.getColour();
|
this.savedPrimary_ = this.sourceBlock_.getColour();
|
||||||
this.sourceBlock_.setColour(this.sourceBlock_.getColourTertiary(),
|
// FIXME
|
||||||
this.sourceBlock_.getColourSecondary(), this.sourceBlock_.getColourTertiary());
|
// this.sourceBlock_.setColour(this.sourceBlock_.getColourTertiary(),
|
||||||
} else if (this.box_) {
|
// this.sourceBlock_.getColourSecondary(), this.sourceBlock_.getColourTertiary());
|
||||||
this.box_.setAttribute('fill', this.sourceBlock_.getColourTertiary());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ export class FieldMusic extends pxtblockly.FieldImages implements Blockly.FieldC
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshCategories(categoriesDiv: Element, categories: string[]) {
|
refreshCategories(categoriesDiv: Element, categories: string[]) {
|
||||||
// Show category dropdown.
|
// Show category dropdown.
|
||||||
for (let i = 0; i < categories.length; i++) {
|
for (let i = 0; i < categories.length; i++) {
|
||||||
const category = categories[i];
|
const category = categories[i];
|
||||||
|
|
||||||
@ -186,11 +187,13 @@ export class FieldMusic extends pxtblockly.FieldImages implements Blockly.FieldC
|
|||||||
let backgroundColor = this.savedPrimary_ || this.sourceBlock_.getColour();
|
let backgroundColor = this.savedPrimary_ || this.sourceBlock_.getColour();
|
||||||
if (value == this.getValue()) {
|
if (value == this.getValue()) {
|
||||||
// This icon is selected, show it in a different colour
|
// This icon is selected, show it in a different colour
|
||||||
backgroundColor = this.sourceBlock_.getColourTertiary();
|
// FIXME: tertiary color?
|
||||||
|
backgroundColor = this.sourceBlock_.getColour();
|
||||||
button.setAttribute('aria-selected', 'true');
|
button.setAttribute('aria-selected', 'true');
|
||||||
}
|
}
|
||||||
button.style.backgroundColor = backgroundColor;
|
button.style.backgroundColor = backgroundColor;
|
||||||
button.style.borderColor = this.sourceBlock_.getColourTertiary();
|
// FIXME: tertiary color?
|
||||||
|
button.style.borderColor = this.sourceBlock_.getColour();
|
||||||
Blockly.bindEvent_(button, 'click', this, this.buttonClick_);
|
Blockly.bindEvent_(button, 'click', this, this.buttonClick_);
|
||||||
Blockly.bindEvent_(button, 'mouseup', this, this.buttonClick_);
|
Blockly.bindEvent_(button, 'mouseup', this, this.buttonClick_);
|
||||||
// These are applied manually instead of using the :hover pseudoclass
|
// These are applied manually instead of using the :hover pseudoclass
|
||||||
|
@ -18,7 +18,6 @@ export class FieldPorts extends pxtblockly.FieldImages implements Blockly.FieldC
|
|||||||
|
|
||||||
this.setText = Blockly.FieldDropdown.prototype.setText;
|
this.setText = Blockly.FieldDropdown.prototype.setText;
|
||||||
this.updateSize_ = (Blockly.Field as any).prototype.updateSize_;
|
this.updateSize_ = (Blockly.Field as any).prototype.updateSize_;
|
||||||
this.updateTextNode_ = Blockly.Field.prototype.updateTextNode_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trimOptions_() {
|
trimOptions_() {
|
||||||
|
12
libs/base/shims.d.ts
vendored
12
libs/base/shims.d.ts
vendored
@ -87,6 +87,12 @@ declare interface Buffer {
|
|||||||
*/
|
*/
|
||||||
//% shim=BufferMethods::write
|
//% shim=BufferMethods::write
|
||||||
write(dstOffset: int32, src: Buffer): void;
|
write(dstOffset: int32, src: Buffer): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute k-bit FNV-1 non-cryptographic hash of the buffer.
|
||||||
|
*/
|
||||||
|
//% shim=BufferMethods::hash
|
||||||
|
hash(bits: int32): uint32;
|
||||||
}
|
}
|
||||||
declare namespace control {
|
declare namespace control {
|
||||||
|
|
||||||
@ -94,14 +100,14 @@ declare namespace control {
|
|||||||
* Create a new zero-initialized buffer.
|
* Create a new zero-initialized buffer.
|
||||||
* @param size number of bytes in the buffer
|
* @param size number of bytes in the buffer
|
||||||
*/
|
*/
|
||||||
//% shim=control::createBuffer
|
//% deprecated=1 shim=control::createBuffer
|
||||||
function createBuffer(size: int32): Buffer;
|
function createBuffer(size: int32): Buffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new buffer with UTF8-encoded string
|
* Create a new buffer with UTF8-encoded string
|
||||||
* @param str the string to put in the buffer
|
* @param str the string to put in the buffer
|
||||||
*/
|
*/
|
||||||
//% shim=control::createBufferFromUTF8
|
//% deprecated=1 shim=control::createBufferFromUTF8
|
||||||
function createBufferFromUTF8(str: string): Buffer;
|
function createBufferFromUTF8(str: string): Buffer;
|
||||||
}
|
}
|
||||||
declare namespace loops {
|
declare namespace loops {
|
||||||
@ -198,6 +204,8 @@ declare namespace control {
|
|||||||
*/
|
*/
|
||||||
//% shim=control::dmesgValue
|
//% shim=control::dmesgValue
|
||||||
function dmesgValue(v: any): void;
|
function dmesgValue(v: any): void;
|
||||||
|
}
|
||||||
|
declare namespace control {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force GC and dump basic information about heap.
|
* Force GC and dump basic information about heap.
|
||||||
|
@ -195,7 +195,8 @@ namespace motors {
|
|||||||
* @param brake a value indicating if the motor should break when off
|
* @param brake a value indicating if the motor should break when off
|
||||||
*/
|
*/
|
||||||
//% blockId=outputMotorSetBrakeMode block="set %motor|brake %brake=toggleOnOff"
|
//% blockId=outputMotorSetBrakeMode block="set %motor|brake %brake=toggleOnOff"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=60 blockGap=8
|
//% weight=60 blockGap=8
|
||||||
//% group="Properties"
|
//% group="Properties"
|
||||||
//% help=motors/motor/set-brake
|
//% help=motors/motor/set-brake
|
||||||
@ -209,7 +210,8 @@ namespace motors {
|
|||||||
* @param value true to pause; false to continue the program execution
|
* @param value true to pause; false to continue the program execution
|
||||||
*/
|
*/
|
||||||
//% blockId=outputMotorSetPauseMode block="set %motor|pause on run %brake=toggleOnOff"
|
//% blockId=outputMotorSetPauseMode block="set %motor|pause on run %brake=toggleOnOff"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=60 blockGap=8
|
//% weight=60 blockGap=8
|
||||||
//% group="Properties"
|
//% group="Properties"
|
||||||
setPauseOnRun(value: boolean) {
|
setPauseOnRun(value: boolean) {
|
||||||
@ -217,11 +219,12 @@ namespace motors {
|
|||||||
this._pauseOnRun = value;
|
this._pauseOnRun = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inverts the motor polarity
|
* Inverts the motor polarity
|
||||||
*/
|
*/
|
||||||
//% blockId=motorSetInverted block="set %motor|inverted %reversed=toggleOnOff"
|
//% blockId=motorSetInverted block="set %motor|inverted %reversed=toggleOnOff"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=59 blockGap=8
|
//% weight=59 blockGap=8
|
||||||
//% group="Properties"
|
//% group="Properties"
|
||||||
//% help=motors/motor/set-inverted
|
//% help=motors/motor/set-inverted
|
||||||
@ -234,11 +237,12 @@ namespace motors {
|
|||||||
return this._inverted ? -1 : 1;
|
return this._inverted ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the settle time after braking in milliseconds (default is 10ms).
|
* Set the settle time after braking in milliseconds (default is 10ms).
|
||||||
*/
|
*/
|
||||||
//% blockId=motorSetBrakeSettleTime block="set %motor|brake settle time %millis|ms"
|
//% blockId=motorSetBrakeSettleTime block="set %motor|brake settle time %millis|ms"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=1 blockGap=8
|
//% weight=1 blockGap=8
|
||||||
//% group="Properties"
|
//% group="Properties"
|
||||||
//% millis.defl=200 millis.min=0 millis.max=500
|
//% millis.defl=200 millis.min=0 millis.max=500
|
||||||
@ -343,7 +347,8 @@ namespace motors {
|
|||||||
//% blockId=motorRun block="run %motor at %speed=motorSpeedPicker|\\%||for %value %unit"
|
//% blockId=motorRun block="run %motor at %speed=motorSpeedPicker|\\%||for %value %unit"
|
||||||
//% weight=100 blockGap=8
|
//% weight=100 blockGap=8
|
||||||
//% group="Move"
|
//% group="Move"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% expandableArgumentMode=toggle
|
//% expandableArgumentMode=toggle
|
||||||
//% help=motors/motor/run
|
//% help=motors/motor/run
|
||||||
run(speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
run(speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
||||||
@ -392,7 +397,8 @@ namespace motors {
|
|||||||
//% blockId=motorSchedule block="ramp %motor at %speed=motorSpeedPicker|\\%|for %value|%unit||accelerate %acceleration|decelerate %deceleration"
|
//% blockId=motorSchedule block="ramp %motor at %speed=motorSpeedPicker|\\%|for %value|%unit||accelerate %acceleration|decelerate %deceleration"
|
||||||
//% weight=99 blockGap=8
|
//% weight=99 blockGap=8
|
||||||
//% group="Move"
|
//% group="Move"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% help=motors/motor/ramp
|
//% help=motors/motor/ramp
|
||||||
//% inlineInputMode=inline
|
//% inlineInputMode=inline
|
||||||
//% expandableArgumentMode=toggle
|
//% expandableArgumentMode=toggle
|
||||||
@ -421,7 +427,8 @@ namespace motors {
|
|||||||
* of run commands.
|
* of run commands.
|
||||||
*/
|
*/
|
||||||
//% blockId=outputMotorsetRunRamp block="set %motor|run %ramp to $value||$unit"
|
//% blockId=outputMotorsetRunRamp block="set %motor|run %ramp to $value||$unit"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=21 blockGap=8
|
//% weight=21 blockGap=8
|
||||||
//% group="Properties"
|
//% group="Properties"
|
||||||
//% help=motors/motor/set-run-phase
|
//% help=motors/motor/set-run-phase
|
||||||
@ -492,7 +499,8 @@ namespace motors {
|
|||||||
* @param value true for regulated motor
|
* @param value true for regulated motor
|
||||||
*/
|
*/
|
||||||
//% blockId=outputMotorSetRegulated block="set %motor|regulated %value=toggleOnOff"
|
//% blockId=outputMotorSetRegulated block="set %motor|regulated %value=toggleOnOff"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=58 blockGap=8
|
//% weight=58 blockGap=8
|
||||||
//% group="Properties"
|
//% group="Properties"
|
||||||
//% help=motors/motor/set-regulated
|
//% help=motors/motor/set-regulated
|
||||||
@ -517,7 +525,8 @@ namespace motors {
|
|||||||
* @param timeOut optional maximum pausing time in milliseconds
|
* @param timeOut optional maximum pausing time in milliseconds
|
||||||
*/
|
*/
|
||||||
//% blockId=motorPauseUntilRead block="pause until %motor|ready"
|
//% blockId=motorPauseUntilRead block="pause until %motor|ready"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=90 blockGap=8
|
//% weight=90 blockGap=8
|
||||||
//% group="Move"
|
//% group="Move"
|
||||||
pauseUntilReady(timeOut?: number) {
|
pauseUntilReady(timeOut?: number) {
|
||||||
@ -575,8 +584,9 @@ namespace motors {
|
|||||||
* @param motor the port which connects to the motor
|
* @param motor the port which connects to the motor
|
||||||
*/
|
*/
|
||||||
//% blockId=motorSpeed block="%motor|speed"
|
//% blockId=motorSpeed block="%motor|speed"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
//% weight=72
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
|
//% weight=72
|
||||||
//% blockGap=8
|
//% blockGap=8
|
||||||
//% group="Counters"
|
//% group="Counters"
|
||||||
//% help=motors/motor/speed
|
//% help=motors/motor/speed
|
||||||
@ -590,7 +600,8 @@ namespace motors {
|
|||||||
* @param motor the port which connects to the motor
|
* @param motor the port which connects to the motor
|
||||||
*/
|
*/
|
||||||
//% blockId=motorAngle block="%motor|angle"
|
//% blockId=motorAngle block="%motor|angle"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=70
|
//% weight=70
|
||||||
//% blockGap=8
|
//% blockGap=8
|
||||||
//% group="Counters"
|
//% group="Counters"
|
||||||
@ -604,7 +615,8 @@ namespace motors {
|
|||||||
* Clears the motor count
|
* Clears the motor count
|
||||||
*/
|
*/
|
||||||
//% blockId=motorClearCount block="clear %motor|counters"
|
//% blockId=motorClearCount block="clear %motor|counters"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=68
|
//% weight=68
|
||||||
//% blockGap=8
|
//% blockGap=8
|
||||||
//% group="Counters"
|
//% group="Counters"
|
||||||
@ -632,7 +644,8 @@ namespace motors {
|
|||||||
* Pauses the program until the motor is stalled.
|
* Pauses the program until the motor is stalled.
|
||||||
*/
|
*/
|
||||||
//% blockId=motorPauseUntilStall block="pause until %motor|stalled"
|
//% blockId=motorPauseUntilStall block="pause until %motor|stalled"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="speed"
|
||||||
|
//% motor.fieldOptions.decompileLiterals=1
|
||||||
//% weight=89
|
//% weight=89
|
||||||
//% group="Move"
|
//% group="Move"
|
||||||
//% help=motors/motor/pause-until-stalled
|
//% help=motors/motor/pause-until-stalled
|
||||||
@ -697,10 +710,10 @@ namespace motors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Move Tank block can make a robot drive forward, backward, turn, or stop.
|
* The Move Tank block can make a robot drive forward, backward, turn, or stop.
|
||||||
* Use the Move Tank block for robot vehicles that have two Large Motors,
|
* Use the Move Tank block for robot vehicles that have two Large Motors,
|
||||||
* with one motor driving the left side of the vehicle and the other the right side.
|
* with one motor driving the left side of the vehicle and the other the right side.
|
||||||
* You can make the two motors go at different speeds or in different directions
|
* You can make the two motors go at different speeds or in different directions
|
||||||
* to make your robot turn.
|
* to make your robot turn.
|
||||||
* @param speedLeft the speed on the left motor, eg: 50
|
* @param speedLeft the speed on the left motor, eg: 50
|
||||||
* @param speedRight the speed on the right motor, eg: 50
|
* @param speedRight the speed on the right motor, eg: 50
|
||||||
|
23
package.json
23
package.json
@ -32,21 +32,20 @@
|
|||||||
"docs/*/*/*.md"
|
"docs/*/*/*.md"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "2.6.1",
|
"@types/marked": "^0.3.0",
|
||||||
"react": "16.8.3",
|
"@types/node": "^9.3.0",
|
||||||
"semantic-ui-less": "2.2.14",
|
"@types/react": "16.8.25",
|
||||||
"@types/bluebird": "2.0.33",
|
|
||||||
"@types/marked": "0.3.0",
|
|
||||||
"@types/node": "8.0.53",
|
|
||||||
"webfonts-generator": "^0.4.0",
|
|
||||||
"@types/jquery": "3.2.16",
|
|
||||||
"@types/react": "16.0.25",
|
|
||||||
"@types/react-dom": "16.0.3",
|
"@types/react-dom": "16.0.3",
|
||||||
"@types/web-bluetooth": "0.0.4"
|
"@types/web-bluetooth": "0.0.4",
|
||||||
|
"@vusion/webfonts-generator": "^0.7.1",
|
||||||
|
"react": "16.8.3",
|
||||||
|
"react-dom": "16.11.0",
|
||||||
|
"semantic-ui-less": "2.4.1",
|
||||||
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-common-packages": "6.18.2",
|
"pxt-common-packages": "9.2.7",
|
||||||
"pxt-core": "5.32.3"
|
"pxt-core": "7.2.16"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
|
|
||||||
CACHE:
|
CACHE:
|
||||||
/cdn/bluebird.min.js
|
|
||||||
/cdn/pxtsim.js
|
/cdn/pxtsim.js
|
||||||
/sim/common-sim.js
|
/sim/common-sim.js
|
||||||
/sim/sim.js
|
/sim/sim.js
|
||||||
|
@ -23,7 +23,6 @@ body {
|
|||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="/cdn/bluebird.min.js"></script>
|
|
||||||
<script src="/cdn/pxtsim.js"></script>
|
<script src="/cdn/pxtsim.js"></script>
|
||||||
<script src="/sim/common-sim.js"></script>
|
<script src="/sim/common-sim.js"></script>
|
||||||
<script src="/sim/sim.js"></script>
|
<script src="/sim/sim.js"></script>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"newLine": "LF",
|
"newLine": "LF",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"lib": ["dom", "dom.iterable", "scripthost", "es6"],
|
"lib": ["dom", "dom.iterable", "scripthost", "es6"],
|
||||||
"types": ["bluebird"],
|
"types": [],
|
||||||
"typeRoots": ["../node_modules/@types"]
|
"typeRoots": ["../node_modules/@types"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace pxsim.visuals {
|
|||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
.sim-button {
|
.sim-button {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -381,7 +381,7 @@ namespace pxsim.visuals {
|
|||||||
this.screenCanvas = document.createElement("canvas");
|
this.screenCanvas = document.createElement("canvas");
|
||||||
this.screenCanvas.id = "board-screen-canvas";
|
this.screenCanvas.id = "board-screen-canvas";
|
||||||
this.screenCanvas.style.userSelect = "none";
|
this.screenCanvas.style.userSelect = "none";
|
||||||
this.screenCanvas.style.msUserSelect = "none";
|
(this.screenCanvas.style as any).msUserSelect = "none";
|
||||||
this.screenCanvas.style.webkitUserSelect = "none";
|
this.screenCanvas.style.webkitUserSelect = "none";
|
||||||
(this.screenCanvas.style as any).MozUserSelect = "none";
|
(this.screenCanvas.style as any).MozUserSelect = "none";
|
||||||
this.screenCanvas.style.position = "absolute";
|
this.screenCanvas.style.position = "absolute";
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
specify theme name below
|
specify theme name below
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@placeholder: 'default';
|
||||||
|
|
||||||
/* Global */
|
/* Global */
|
||||||
@site : 'pxt';
|
@site : 'pxt';
|
||||||
@reset : 'default';
|
@reset : 'default';
|
||||||
@ -87,7 +89,7 @@
|
|||||||
Import Theme
|
Import Theme
|
||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
@import "theme.less";
|
@import (multiple) "theme.less";
|
||||||
|
|
||||||
@fontPath : 'fonts';
|
@fontPath : 'fonts';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user