Initial target repo setup to move to master (v3.10)
This commit is contained in:
parent
cf7767ec1c
commit
6ea0c50472
@ -1,4 +1,3 @@
|
||||
/// <reference path="../node_modules/pxt-core/typings/globals/node/index.d.ts"/>
|
||||
/// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" />
|
||||
|
||||
import * as path from "path";
|
||||
|
@ -8,6 +8,7 @@
|
||||
"module": "commonjs",
|
||||
"rootDir": ".",
|
||||
"newLine": "LF",
|
||||
"sourceMap": false
|
||||
"sourceMap": false,
|
||||
"types": ["node"]
|
||||
}
|
||||
}
|
||||
|
BIN
docs/static/hero.png
vendored
Normal file
BIN
docs/static/hero.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
@ -252,7 +252,7 @@ namespace pxt.editor {
|
||||
})
|
||||
}
|
||||
|
||||
export function deployCoreAsync(resp: pxtc.CompileResult, d: pxt.commands.DeployOptions = {}): Promise<void> {
|
||||
export function deployCoreAsync(resp: pxtc.CompileResult): Promise<void> {
|
||||
let saveHexAsync = () => {
|
||||
return pxt.commands.saveOnlyAsync(resp)
|
||||
}
|
||||
@ -372,9 +372,11 @@ namespace pxt.editor {
|
||||
})
|
||||
})
|
||||
.catch(e => {
|
||||
if (e.type === "devicenotfound" && d.reportDeviceNotFoundAsync) {
|
||||
// TODO: (microbit master)
|
||||
if (e.type === "devicenotfound") { //&& d.reportDeviceNotFoundAsync) {
|
||||
pxt.tickEvent("hid.flash.devicenotfound");
|
||||
return d.reportDeviceNotFoundAsync("/device/windows-app/troubleshoot", resp);
|
||||
//return d.reportDeviceNotFoundAsync("/device/windows-app/troubleshoot", resp);
|
||||
return undefined;
|
||||
} else {
|
||||
return saveHexAsync()
|
||||
}
|
||||
|
14
fieldeditors/extensions.ts
Normal file
14
fieldeditors/extensions.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/// <reference path="../node_modules/pxt-core/built/pxteditor.d.ts"/>
|
||||
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||
import { FieldMatrix } from "./fieldMatrix";
|
||||
|
||||
pxt.editor.initFieldExtensionsAsync = function (opts: pxt.editor.FieldExtensionOptions): Promise<pxt.editor.FieldExtensionResult> {
|
||||
pxt.debug('loading pxt-microbit field editors...')
|
||||
const res: pxt.editor.FieldExtensionResult = {
|
||||
fieldEditors: [{
|
||||
selector: "matrix",
|
||||
editor: FieldMatrix
|
||||
}]
|
||||
};
|
||||
return Promise.resolve<pxt.editor.FieldExtensionResult>(res);
|
||||
}
|
225
fieldeditors/fieldMatrix.ts
Normal file
225
fieldeditors/fieldMatrix.ts
Normal file
@ -0,0 +1,225 @@
|
||||
/// <reference path="../node_modules/pxt-core/localtypings/blockly.d.ts" />
|
||||
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||
|
||||
const rowRegex = /^.*[\.#].*$/;
|
||||
|
||||
enum LabelMode {
|
||||
None,
|
||||
Number,
|
||||
Letter
|
||||
}
|
||||
|
||||
export class FieldMatrix extends Blockly.Field implements Blockly.FieldCustom {
|
||||
private static CELL_WIDTH = 23;
|
||||
private static CELL_HORIZONTAL_MARGIN = 7;
|
||||
private static CELL_VERTICAL_MARGIN = 5;
|
||||
private static CELL_CORNER_RADIUS = 5;
|
||||
private static BOTTOM_MARGIN = 9;
|
||||
private static Y_AXIS_WIDTH = 9;
|
||||
private static X_AXIS_HEIGHT = 10;
|
||||
private static TAB = " ";
|
||||
|
||||
public isFieldCustom_ = true;
|
||||
|
||||
private params: any;
|
||||
private onColor = "#e2484a";
|
||||
private offColor = "white";
|
||||
|
||||
// The number of columns
|
||||
private matrixWidth: number = 5;
|
||||
|
||||
// The number of rows
|
||||
private matrixHeight: number = 5;
|
||||
|
||||
private yAxisLabel: LabelMode = LabelMode.None;
|
||||
private xAxisLabel: LabelMode = LabelMode.None;
|
||||
|
||||
private cellState: boolean[][] = [];
|
||||
private elt: SVGSVGElement;
|
||||
|
||||
constructor(text: string, params: any, validator?: Function) {
|
||||
super(text, validator);
|
||||
this.params = params;
|
||||
|
||||
if (this.params.rows !== undefined) {
|
||||
let val = parseInt(this.params.rows);
|
||||
if (!isNaN(val)) {
|
||||
this.matrixHeight = val;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.params.columns !== undefined) {
|
||||
let val = parseInt(this.params.columns);
|
||||
if (!isNaN(val)) {
|
||||
this.matrixWidth = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the inline free-text editor on top of the text.
|
||||
* @private
|
||||
*/
|
||||
showEditor_() {
|
||||
// Intentionally left empty
|
||||
}
|
||||
|
||||
private initMatrix() {
|
||||
this.elt = pxsim.svg.parseString(`<svg xmlns="http://www.w3.org/2000/svg" id="field-matrix" />`);
|
||||
|
||||
// Initialize the matrix that holds the state
|
||||
for (let i = 0; i < this.matrixHeight; i++) {
|
||||
this.cellState.push([])
|
||||
for (let j = 0; j < this.matrixWidth; j++) {
|
||||
this.cellState[i].push(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.restoreStateFromString();
|
||||
this.updateValue()
|
||||
|
||||
// Create the cells of the matrix that is displayed
|
||||
for (let i = 0; i < this.matrixWidth; i++) {
|
||||
for (let j = 0; j < this.matrixHeight; j++) {
|
||||
this.createCell(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.xAxisLabel !== LabelMode.None) {
|
||||
const y = this.matrixHeight * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN * 2 + FieldMatrix.BOTTOM_MARGIN
|
||||
const xAxis = pxsim.svg.child(this.elt, "g", { transform: `translate(${0} ${y})` });
|
||||
for (let i = 0; i < this.matrixWidth; i++) {
|
||||
const x = this.getYAxisWidth() + i * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + FieldMatrix.CELL_WIDTH / 2 + FieldMatrix.CELL_HORIZONTAL_MARGIN / 2;
|
||||
const lbl = pxsim.svg.child(xAxis, "text", { x, class: "blocklyText" })
|
||||
lbl.textContent = this.getLabel(i, this.xAxisLabel);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.yAxisLabel !== LabelMode.None) {
|
||||
const yAxis = pxsim.svg.child(this.elt, "g", {});
|
||||
for (let i = 0; i < this.matrixHeight; i++) {
|
||||
const y = i * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_WIDTH / 2 + FieldMatrix.CELL_VERTICAL_MARGIN * 2;
|
||||
const lbl = pxsim.svg.child(yAxis, "text", { x: 0, y, class: "blocklyText" })
|
||||
lbl.textContent = this.getLabel(i, this.yAxisLabel);
|
||||
}
|
||||
}
|
||||
|
||||
this.fieldGroup_.appendChild(this.elt);
|
||||
}
|
||||
|
||||
private getLabel(index: number, mode: LabelMode) {
|
||||
switch (mode) {
|
||||
case LabelMode.Letter:
|
||||
return String.fromCharCode(index + /*char code for A*/ 65);
|
||||
default:
|
||||
return (index + 1).toString();
|
||||
}
|
||||
}
|
||||
|
||||
private createCell(x: number, y: number) {
|
||||
const tx = x * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + FieldMatrix.CELL_HORIZONTAL_MARGIN + this.getYAxisWidth();
|
||||
const ty = y * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN;
|
||||
|
||||
const cellG = pxsim.svg.child(this.elt, "g", { transform: `translate(${tx} ${ty})` }) as SVGGElement;
|
||||
const cellRect = pxsim.svg.child(cellG, "rect", { width: FieldMatrix.CELL_WIDTH, height: FieldMatrix.CELL_WIDTH, fill: this.getColor(x, y), rx: FieldMatrix.CELL_CORNER_RADIUS }) as SVGRectElement;
|
||||
|
||||
pxsim.svg.onClick(cellRect, () => {
|
||||
this.cellState[x][y] = !this.cellState[x][y];
|
||||
cellRect.setAttribute("fill", this.getColor(x, y));
|
||||
this.updateValue()
|
||||
});
|
||||
}
|
||||
|
||||
private getColor(x: number, y: number) {
|
||||
return this.cellState[x][y] ? this.onColor : this.offColor;
|
||||
}
|
||||
|
||||
render_() {
|
||||
if (!this.visible_) {
|
||||
this.size_.width = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.elt) {
|
||||
this.initMatrix();
|
||||
}
|
||||
|
||||
|
||||
// The height and width must be set by the render function
|
||||
this.size_.height = Number(this.matrixHeight) * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN * 2 + FieldMatrix.BOTTOM_MARGIN + this.getXAxisHeight()
|
||||
this.size_.width = Number(this.matrixWidth) * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + this.getYAxisWidth();
|
||||
}
|
||||
|
||||
// The return value of this function is inserted in the code
|
||||
getValue() {
|
||||
// getText() returns the value that is set by calls to setValue()
|
||||
let text = removeQuotes(this.getText());
|
||||
return `\`\n${FieldMatrix.TAB}${text}\n${FieldMatrix.TAB}\``;
|
||||
}
|
||||
|
||||
// Restores the block state from the text value of the field
|
||||
private restoreStateFromString() {
|
||||
let r = this.getText();
|
||||
if (r) {
|
||||
const rows = r.split("\n").filter(r => rowRegex.test(r));
|
||||
|
||||
for (let y = 0; y < rows.length && y < this.matrixHeight; y++) {
|
||||
let x = 0;
|
||||
const row = rows[y];
|
||||
|
||||
for (let j = 0; j < row.length && x < this.matrixWidth; j++) {
|
||||
if (isNegativeCharacter(row[j])) {
|
||||
this.cellState[x][y] = false;
|
||||
x++;
|
||||
}
|
||||
else if (isPositiveCharacter(row[j])) {
|
||||
this.cellState[x][y] = true;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Composes the state into a string an updates the field's state
|
||||
private updateValue() {
|
||||
let res = "";
|
||||
for (let y = 0; y < this.matrixHeight; y++) {
|
||||
for (let x = 0; x < this.matrixWidth; x++) {
|
||||
res += (this.cellState[x][y] ? "#" : ".") + " "
|
||||
}
|
||||
res += "\n" + FieldMatrix.TAB
|
||||
}
|
||||
|
||||
// Blockly stores the state of the field as a string
|
||||
this.setValue(res);
|
||||
}
|
||||
|
||||
private getYAxisWidth() {
|
||||
return this.yAxisLabel === LabelMode.None ? 0 : FieldMatrix.Y_AXIS_WIDTH;
|
||||
}
|
||||
|
||||
private getXAxisHeight() {
|
||||
return this.xAxisLabel === LabelMode.None ? 0 : FieldMatrix.X_AXIS_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
function isPositiveCharacter(c: string) {
|
||||
return c === "#" || c === "*" || c === "1";
|
||||
}
|
||||
|
||||
function isNegativeCharacter(c: string) {
|
||||
return c === "." || c === "_" || c === "0";
|
||||
}
|
||||
|
||||
|
||||
const allQuotes = ["'", '"', "`"];
|
||||
|
||||
function removeQuotes(str: string) {
|
||||
str = str.trim();
|
||||
const start = str.charAt(0);
|
||||
if (start === str.charAt(str.length - 1) && allQuotes.indexOf(start) !== -1) {
|
||||
return str.substr(1, str.length - 2).trim();
|
||||
}
|
||||
return str;
|
||||
}
|
14
fieldeditors/tsconfig.json
Normal file
14
fieldeditors/tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"noImplicitReturns": true,
|
||||
"module": "commonjs",
|
||||
"outDir": "../built/fieldeditors",
|
||||
"rootDir": ".",
|
||||
"newLine": "LF",
|
||||
"sourceMap": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"declaration": true
|
||||
}
|
||||
}
|
6
libs/bluetooth/shims.d.ts
vendored
6
libs/bluetooth/shims.d.ts
vendored
@ -98,7 +98,7 @@ declare namespace bluetooth {
|
||||
//% blockId=eddystone_advertise_url block="bluetooth advertise url %url|with power %power|connectable %connectable"
|
||||
//% parts=bluetooth weight=11 blockGap=8
|
||||
//% help=bluetooth/advertise-url blockExternalInputs=1 shim=bluetooth::advertiseUrl
|
||||
function advertiseUrl(url: string, power: number, connectable: boolean): void;
|
||||
function advertiseUrl(url: string, power: int32, connectable: boolean): void;
|
||||
|
||||
/**
|
||||
* Advertise an Eddystone UID
|
||||
@ -107,7 +107,7 @@ declare namespace bluetooth {
|
||||
* @param connectable true to keep bluetooth connectable for other services, false otherwise.
|
||||
*/
|
||||
//% parts=bluetooth weight=12 advanced=true shim=bluetooth::advertiseUidBuffer
|
||||
function advertiseUidBuffer(nsAndInstance: Buffer, power: number, connectable: boolean): void;
|
||||
function advertiseUidBuffer(nsAndInstance: Buffer, power: int32, connectable: boolean): void;
|
||||
|
||||
/**
|
||||
* Sets the bluetooth transmit power between 0 (minimal) and 7 (maximum).
|
||||
@ -115,7 +115,7 @@ declare namespace bluetooth {
|
||||
*/
|
||||
//% parts=bluetooth weight=5 help=bluetooth/set-transmit-power advanced=true
|
||||
//% blockId=bluetooth_settransmitpower block="bluetooth set transmit power %power" shim=bluetooth::setTransmitPower
|
||||
function setTransmitPower(power: number): void;
|
||||
function setTransmitPower(power: int32): void;
|
||||
|
||||
/**
|
||||
* Stops advertising Eddystone end points
|
||||
|
@ -5,35 +5,32 @@
|
||||
"AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity",
|
||||
"Array": "Add, remove, and replace items in lists.\n\nAdd, remove, and replace items in lists.",
|
||||
"Array.every": "Tests whether all elements in the array pass the test implemented by the provided function.",
|
||||
"Array.every|param|callbackfn": "A function that accepts up to two arguments. The some method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.every|param|callbackfn": "A function that accepts up to two arguments. The every method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.filter": "Return the elements of an array that meet the condition specified in a callback function.",
|
||||
"Array.filter|param|callbackfn": "A function that accepts up to two arguments. The filter method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.forEach": "Call a defined callback function on each element of an array.",
|
||||
"Array.forEach|param|callbackfn": "A function that accepts up to two arguments. The forEach method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.get": "Get the value at a particular index.",
|
||||
"Array.get": "Get the value at a particular index",
|
||||
"Array.get|param|index": "the zero-based position in the list of the item, eg: 0",
|
||||
"Array.indexOf": "Return the index of the first occurrence of a value in an array.",
|
||||
"Array.indexOf|param|fromIndex": "The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.",
|
||||
"Array.indexOf|param|item": "The value to locate in the array.",
|
||||
"Array.insertAt": "Insert the value at a particular index, increase the array length by 1.",
|
||||
"Array.insertAt": "Insert the value at a particular index, increases length by 1",
|
||||
"Array.insertAt|param|index": "the zero-based position in the list to insert the value, eg: 0",
|
||||
"Array.insertAt|param|value": "to insert, eg: 0",
|
||||
"Array.join": "joins all elements of an array into a string and returns this string.",
|
||||
"Array.join|param|sep": "the string separator",
|
||||
"Array.length": "Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.",
|
||||
"Array.length": "Get or set the length of an array. This number is one more than the index of the last element the array.",
|
||||
"Array.map": "Call a defined callback function on each element of an array, and return an array containing the results.",
|
||||
"Array.map|param|callbackfn": "A function that accepts up to two arguments. The map method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.pop": "Remove the last element from an array and return it.",
|
||||
"Array.push": "Append a new elements to an array.",
|
||||
"Array.push|param|item": "to append to the Array.",
|
||||
"Array.push": "Append a new element to an array.",
|
||||
"Array.reduce": "Call the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.",
|
||||
"Array.reduce|param|callbackfn": "A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.reduce|param|initialValue": "Initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.",
|
||||
"Array.removeAt": "Remove the element at a certain index.",
|
||||
"Array.removeAt|param|index": "the zero-based position in the list to remove the value from, eg: 0",
|
||||
"Array.removeElement": "Remove the first occurence of an object. Return true if removed.",
|
||||
"Array.removeElement": "Remove the first occurence of an object. Returns true if removed.",
|
||||
"Array.reverse": "Reverse the elements in an array. The first array element becomes the last, and the last array element becomes the first.",
|
||||
"Array.set": "Store a value at a particular index.",
|
||||
"Array.set": "Store a value at a particular index",
|
||||
"Array.set|param|index": "the zero-based position in the list to store the value, eg: 0",
|
||||
"Array.shift": "Remove the first element from an array and return it. This method changes the length of the array.",
|
||||
"Array.slice": "Return a section of an array.",
|
||||
@ -46,7 +43,6 @@
|
||||
"Array.splice|param|deleteCount": "The number of elements to remove. eg: 0",
|
||||
"Array.splice|param|start": "The zero-based location in the array from which to start removing elements. eg: 0",
|
||||
"Array.unshift": "Add one element to the beginning of an array and return the new length of the array.",
|
||||
"Array.unshift|param|value": "to insert at the start of the Array.",
|
||||
"Boolean.toString": "Returns a string representation of an object.",
|
||||
"Buffer.fill": "Fill (a fragment) of the buffer with given value.",
|
||||
"Buffer.getNumber": "Read a number in specified format from the buffer.",
|
||||
@ -101,34 +97,69 @@
|
||||
"Math": "More complex operations with numbers.",
|
||||
"Math.abs": "Returns the absolute value of a number (the value without regard to whether it is positive or negative).\nFor example, the absolute value of -5 is the same as the absolute value of 5.",
|
||||
"Math.abs|param|x": "A numeric expression for which the absolute value is needed.",
|
||||
"Math.acos": "Returns the arccosine (in radians) of a number",
|
||||
"Math.acos|param|x": "A number",
|
||||
"Math.asin": "Returns the arcsine (in radians) of a number",
|
||||
"Math.asin|param|x": "A number",
|
||||
"Math.atan": "Returns the arctangent (in radians) of a number",
|
||||
"Math.atan2": "Returns the arctangent of the quotient of its arguments.",
|
||||
"Math.atan2|param|x": "A number",
|
||||
"Math.atan2|param|y": "A number",
|
||||
"Math.atan|param|x": "A number",
|
||||
"Math.ceil": "Returns the smallest number greater than or equal to its numeric argument.",
|
||||
"Math.ceil|param|x": "A numeric expression.",
|
||||
"Math.cos": "Returns the cosine of a number.",
|
||||
"Math.cos|param|x": "An angle in radians",
|
||||
"Math.exp": "Returns returns ``e^x``.",
|
||||
"Math.exp|param|x": "A number",
|
||||
"Math.floor": "Returns the greatest number less than or equal to its numeric argument.",
|
||||
"Math.floor|param|x": "A numeric expression.",
|
||||
"Math.idiv": "Returns the value of integer signed 32 bit division of two numbers.",
|
||||
"Math.idiv|param|x": "The first number",
|
||||
"Math.idiv|param|y": "The second number",
|
||||
"Math.imul": "Returns the value of integer signed 32 bit multiplication of two numbers.",
|
||||
"Math.imul|param|x": "The first number",
|
||||
"Math.imul|param|y": "The second number",
|
||||
"Math.log": "Returns the natural logarithm (base e) of a number.",
|
||||
"Math.log|param|x": "A number",
|
||||
"Math.max": "Returns the larger of two supplied numeric expressions.",
|
||||
"Math.min": "Returns the smaller of two supplied numeric expressions.",
|
||||
"Math.pow": "Return the value of a base expression taken to a specified power.",
|
||||
"Math.pow": "Returns the value of a base expression taken to a specified power.",
|
||||
"Math.pow|param|x": "The base value of the expression.",
|
||||
"Math.pow|param|y": "The exponent value of the expression.",
|
||||
"Math.random": "Return a pseudorandom number between 0 and `limit`.",
|
||||
"Math.random": "Returns a pseudorandom number between 0 and 1.",
|
||||
"Math.randomBoolean": "Generates a `true` or `false` value randomly, just like flipping a coin.",
|
||||
"Math.random|param|limit": "the upper bound of the number generated, eg: 4",
|
||||
"Math.randomRange": "Returns a pseudorandom number between min and max included.\nIf both numbers are integral, the result is integral.",
|
||||
"Math.randomRange|param|max": "the upper inclusive bound, eg: 10",
|
||||
"Math.randomRange|param|min": "the lower inclusive bound, eg: 0",
|
||||
"Math.round": "Returns a supplied numeric expression rounded to the nearest number.",
|
||||
"Math.round|param|x": "The value to be rounded to the nearest number.",
|
||||
"Math.sign": "Returns the sign of the x, indicating whether x is positive, negative or zero.",
|
||||
"Math.sign|param|x": "The numeric expression to test",
|
||||
"Math.sqrt": "Return the square root of a number.",
|
||||
"Math.sin": "Returns the sine of a number.",
|
||||
"Math.sin|param|x": "An angle in radians",
|
||||
"Math.sqrt": "Returns the square root of a number.",
|
||||
"Math.sqrt|param|x": "A numeric expression.",
|
||||
"Number.toString": "Return a string representation of a number.",
|
||||
"Math.tan": "Returns the tangent of a number.",
|
||||
"Math.tan|param|x": "An angle in radians",
|
||||
"Math.trunc": "Returns the number with the decimal part truncated.",
|
||||
"Math.trunc|param|x": "A numeric expression.",
|
||||
"Number.toString": "Returns a string representation of a number.",
|
||||
"String": "Combine, split, and search text strings.\n\nCombine, split, and search text strings.",
|
||||
"String.charAt": "Return the character at the specified index.",
|
||||
"String.charAt|param|index": "The zero-based index of the desired character, eg: 0",
|
||||
"String.charAt|param|index": "The zero-based index of the desired character.",
|
||||
"String.charCodeAt": "Return the Unicode value of the character at the specified location.",
|
||||
"String.charCodeAt|param|index": "The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.",
|
||||
"String.compare": "See how the order of characters in two strings is different (in ASCII encoding).",
|
||||
"String.compare|param|that": "String to compare to target string",
|
||||
"String.concat": "Returns a string that contains the concatenation of two or more strings.",
|
||||
"String.concat|param|other": "The string to append to the end of the string, eg: \"add me!\"",
|
||||
"String.concat|param|other": "The string to append to the end of the string.",
|
||||
"String.fromCharCode": "Make a string from the given ASCII character code.",
|
||||
"String.isEmpty": "Returns a value indicating if the string is empty",
|
||||
"String.length": "Return the length of a String object.",
|
||||
"String.length": "Returns the length of a String object.",
|
||||
"String.substr": "Return a substring of the current string.",
|
||||
"String.substr|param|length": "number of characters to extract, eg: 3",
|
||||
"String.substr|param|start": "first character index; can be negative from counting from the end, eg: 0",
|
||||
"String.substr|param|length": "number of characters to extract",
|
||||
"String.substr|param|start": "first character index; can be negative from counting from the end, eg:0",
|
||||
"basic": "Provides access to basic micro:bit functionality.",
|
||||
"basic.clearScreen": "Turn off all LEDs",
|
||||
"basic.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
|
||||
@ -337,7 +368,7 @@
|
||||
"music": "Generation of music tones.",
|
||||
"music.beat": "Returns the duration of a beat in milli-seconds",
|
||||
"music.beginMelody": "Starts playing a melody.\nNotes are expressed as a string of characters with this format: NOTE[octave][:duration]",
|
||||
"music.beginMelody|param|melodyArray": "the melody array to play, eg: ['g5:1']",
|
||||
"music.beginMelody|param|melodyArray": "the melody array to play, eg: Melodies.Dadadadum",
|
||||
"music.beginMelody|param|options": "melody options, once / forever, in the foreground / background",
|
||||
"music.builtInMelody": "Gets the melody array of a built-in melody.",
|
||||
"music.changeTempoBy": "Change the tempo by the specified amount",
|
||||
@ -346,17 +377,17 @@
|
||||
"music.noteFrequency|param|name": "the note name, eg: Note.C",
|
||||
"music.onEvent": "Registers code to run on various melody events",
|
||||
"music.playTone": "Plays a tone through pin ``P0`` for the given duration.",
|
||||
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
|
||||
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz), eg: Note.C",
|
||||
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
|
||||
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
|
||||
"music.rest|param|ms": "rest duration in milliseconds (ms)",
|
||||
"music.ringTone": "Plays a tone through pin ``P0``.",
|
||||
"music.ringTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
|
||||
"music.ringTone|param|frequency": "pitch of the tone to play in Hertz (Hz), eg: Note.C",
|
||||
"music.setPlayTone": "Sets a custom playTone function for playing melodies",
|
||||
"music.setTempo": "Sets the tempo to the specified amount",
|
||||
"music.setTempo|param|bpm": "The new tempo in beats per minute, eg: 120",
|
||||
"music.tempo": "Returns the tempo in beats per minute. Tempo is the speed (bpm = beats per minute) at which notes play. The larger the tempo value, the faster the notes will play.",
|
||||
"parseInt": "Convert A string to an integer.",
|
||||
"parseInt": "Convert a string to an integer.",
|
||||
"pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...",
|
||||
"pins.analogPitch": "Emits a Pulse-width modulation (PWM) signal to the current pitch pin. Use `analog set pitch pin` to define the pitch pin.",
|
||||
"pins.analogPitch|param|frequency": "frequency to modulate in Hz.",
|
||||
|
@ -144,7 +144,7 @@
|
||||
"LedSpriteProperty.X|block": "x",
|
||||
"LedSpriteProperty.Y|block": "y",
|
||||
"Math.randomBoolean|block": "pick random true or false",
|
||||
"Math.random|block": "pick random 0 to %limit",
|
||||
"Math.randomRange|block": "pick random %min|to %limit",
|
||||
"Math|block": "Math",
|
||||
"Melodies.BaDing|block": "ba ding",
|
||||
"Melodies.Baddy|block": "baddy",
|
||||
@ -230,7 +230,7 @@
|
||||
"basic.pause|block": "pause (ms) %pause",
|
||||
"basic.showArrow|block": "show arrow %i=device_arrow",
|
||||
"basic.showIcon|block": "show icon %i",
|
||||
"basic.showLeds|block": "show leds",
|
||||
"basic.showLeds|block": "show leds| %leds",
|
||||
"basic.showNumber|block": "show|number %number",
|
||||
"basic.showString|block": "show|string %text",
|
||||
"basic|block": "basic",
|
||||
@ -266,8 +266,8 @@
|
||||
"game|block": "game",
|
||||
"images.arrowImage|block": "arrow image %i=device_arrow",
|
||||
"images.arrowNumber|block": "%arrow",
|
||||
"images.createBigImage|block": "create big image",
|
||||
"images.createImage|block": "create image",
|
||||
"images.createBigImage|block": "create big image| %leds",
|
||||
"images.createImage|block": "create image| %leds",
|
||||
"images.iconImage|block": "icon image %i",
|
||||
"images|block": "images",
|
||||
"input.acceleration|block": "acceleration (mg)|%NAME",
|
||||
@ -289,7 +289,7 @@
|
||||
"input|block": "input",
|
||||
"led.brightness|block": "brightness",
|
||||
"led.enable|block": "led enable %on",
|
||||
"led.plotBarGraph|block": "plot bar graph of %value |up to %high",
|
||||
"led.plotBarGraph|block": "plot bar graph of %value up to %high",
|
||||
"led.plotBrightness|block": "plot|x %x|y %y|brightness %brightness",
|
||||
"led.plot|block": "plot|x %x|y %y",
|
||||
"led.point|block": "point|x %x|y %y",
|
||||
|
@ -34,10 +34,13 @@ namespace basic {
|
||||
*/
|
||||
//% help=basic/show-leds
|
||||
//% weight=95 blockGap=8
|
||||
//% imageLiteral=1 async
|
||||
//% imageLiteral=0 async
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% blockId=device_show_leds
|
||||
//% block="show leds" icon="\uf00a"
|
||||
//% parts="ledmatrix"
|
||||
//% block="show leds| %leds" icon="\uf00a"
|
||||
//% parts="ledmatrix" blockExternalInputs=1
|
||||
void showLeds(ImageLiteral leds, int interval = 400) {
|
||||
uBit.display.print(MicroBitImage(imageBytes(leds)), 0, 0, 0, interval);
|
||||
}
|
||||
@ -84,7 +87,10 @@ namespace basic {
|
||||
* @param leds pattern of LEDs to turn on/off
|
||||
* @param interval time in milliseconds between each redraw
|
||||
*/
|
||||
//% help=basic/show-animation imageLiteral=1 async
|
||||
//% help=basic/show-animation imageLiteral=0 async
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% parts="ledmatrix"
|
||||
void showAnimation(ImageLiteral leds, int interval = 400) {
|
||||
uBit.display.animate(MicroBitImage(imageBytes(leds)), interval, 5, 0, 0);
|
||||
|
@ -10,8 +10,8 @@ namespace Math {
|
||||
* Generates a `true` or `false` value randomly, just like flipping a coin.
|
||||
*/
|
||||
//% blockId=logic_random block="pick random true or false"
|
||||
//% help=math/random-boolean
|
||||
//% help=math/random-boolean weight=0
|
||||
export function randomBoolean(): boolean {
|
||||
return Math.random(2) == 0;
|
||||
return Math.random() >= 0.5;
|
||||
}
|
||||
}
|
@ -179,9 +179,8 @@ namespace basic {
|
||||
//% block="show icon %i" icon="\uf00a"
|
||||
//% parts="ledmatrix"
|
||||
//% help=basic/show-icon
|
||||
//% i.fieldEditor="gridpicker"
|
||||
//% i.fieldOptions.width="400" i.fieldOptions.columns="5"
|
||||
//% i.fieldOptions.itemColour="black" i.fieldOptions.tooltips="true"
|
||||
//% icon.fieldEditor="imagedropdown"
|
||||
//% icon.fieldOptions.columns="5"
|
||||
export function showIcon(icon: IconNames, interval = 600) {
|
||||
let res = images.iconImage(icon)
|
||||
res.showImage(0, interval)
|
||||
@ -274,9 +273,8 @@ namespace images {
|
||||
//% weight=50 blockGap=8
|
||||
//% help=images/icon-image
|
||||
//% blockId=builtin_image block="icon image %i"
|
||||
//% i.fieldEditor="gridpicker"
|
||||
//% i.fieldEditor="imagedropdown"
|
||||
//% i.fieldOptions.width="400" i.fieldOptions.columns="5"
|
||||
//% i.fieldOptions.itemColour="black" i.fieldOptions.tooltips="true"
|
||||
export function iconImage(i: IconNames): Image {
|
||||
switch (i) {
|
||||
case IconNames.Heart: return images.createImage(`
|
||||
|
@ -10,8 +10,11 @@ namespace images {
|
||||
* Creates an image that fits on the LED screen.
|
||||
*/
|
||||
//% weight=75 help=images/create-image
|
||||
//% blockId=device_build_image block="create image"
|
||||
//% parts="ledmatrix"
|
||||
//% blockId=device_build_image block="create image| %leds"
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% parts="ledmatrix" imageLiteral=0 blockExternalInput=1
|
||||
Image createImage(ImageLiteral leds) {
|
||||
return MicroBitImage(imageBytes(leds)).clone().leakData();
|
||||
}
|
||||
@ -20,7 +23,11 @@ namespace images {
|
||||
* Creates an image with 2 frames.
|
||||
*/
|
||||
//% weight=74 help=images/create-big-image
|
||||
//% blockId=device_build_big_image block="create big image" imageLiteral=2
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% blockId=device_build_big_image block="create big image| %leds"
|
||||
//% imageLiteral=0 blockExternalInput=1
|
||||
//% parts="ledmatrix"
|
||||
Image createBigImage(ImageLiteral leds) {
|
||||
return createImage(leds);
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @param high maximum value. If 0, maximum value adjusted automatically, eg: 0
|
||||
*/
|
||||
//% help=led/plot-bar-graph weight=20
|
||||
//% blockId=device_plot_bar_graph block="plot bar graph of %value |up to %high" icon="\uf080" blockExternalInputs=true
|
||||
//% blockId=device_plot_bar_graph block="plot bar graph of %value up to %high" icon="\uf080" blockExternalInputs=true
|
||||
//% parts="ledmatrix"
|
||||
export function plotBarGraph(value: number, high: number): void {
|
||||
let now = input.runningTime();
|
||||
|
@ -172,7 +172,7 @@ namespace music {
|
||||
|
||||
/**
|
||||
* Plays a tone through pin ``P0`` for the given duration.
|
||||
* @param frequency pitch of the tone to play in Hertz (Hz)
|
||||
* @param frequency pitch of the tone to play in Hertz (Hz), eg: Note.C
|
||||
* @param ms tone duration in milliseconds (ms)
|
||||
*/
|
||||
//% help=music/play-tone weight=90
|
||||
@ -186,7 +186,7 @@ namespace music {
|
||||
|
||||
/**
|
||||
* Plays a tone through pin ``P0``.
|
||||
* @param frequency pitch of the tone to play in Hertz (Hz)
|
||||
* @param frequency pitch of the tone to play in Hertz (Hz), eg: Note.C
|
||||
*/
|
||||
//% help=music/ring-tone weight=80
|
||||
//% blockId=device_ring block="ring tone (Hz)|%note=device_note" blockGap=8
|
||||
@ -214,8 +214,9 @@ namespace music {
|
||||
*/
|
||||
//% weight=50 help=music/note-frequency
|
||||
//% blockId=device_note block="%note"
|
||||
//% shim=TD_ID
|
||||
//% shim=TD_ID color="#FFFFFF" colorSecondary="#FFFFFF"
|
||||
//% note.fieldEditor="note" note.defl="262"
|
||||
//% note.fieldOptions.decompileLiterals=true
|
||||
//% useEnumVal=1
|
||||
export function noteFrequency(name: Note): number {
|
||||
return name;
|
||||
@ -307,7 +308,7 @@ namespace music {
|
||||
/**
|
||||
* Starts playing a melody.
|
||||
* Notes are expressed as a string of characters with this format: NOTE[octave][:duration]
|
||||
* @param melodyArray the melody array to play, eg: ['g5:1']
|
||||
* @param melodyArray the melody array to play, eg: Melodies.Dadadadum
|
||||
* @param options melody options, once / forever, in the foreground / background
|
||||
*/
|
||||
//% help=music/begin-melody weight=60 blockGap=8
|
||||
|
149
libs/core/shims.d.ts
vendored
149
libs/core/shims.d.ts
vendored
@ -12,15 +12,22 @@ declare namespace images {
|
||||
* Creates an image that fits on the LED screen.
|
||||
*/
|
||||
//% weight=75 help=images/create-image
|
||||
//% blockId=device_build_image block="create image"
|
||||
//% parts="ledmatrix" imageLiteral=1 shim=images::createImage
|
||||
//% blockId=device_build_image block="create image| %leds"
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% parts="ledmatrix" imageLiteral=0 blockExternalInput=1 shim=images::createImage
|
||||
function createImage(leds: string): Image;
|
||||
|
||||
/**
|
||||
* Creates an image with 2 frames.
|
||||
*/
|
||||
//% weight=74 help=images/create-big-image
|
||||
//% blockId=device_build_big_image block="create big image" imageLiteral=2
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% blockId=device_build_big_image block="create big image| %leds"
|
||||
//% imageLiteral=0 blockExternalInput=1
|
||||
//% parts="ledmatrix" shim=images::createBigImage
|
||||
function createBigImage(leds: string): Image;
|
||||
}
|
||||
@ -32,7 +39,7 @@ declare interface Image {
|
||||
*/
|
||||
//% help=images/plot-image
|
||||
//% parts="ledmatrix" xOffset.defl=0 shim=ImageMethods::plotImage
|
||||
plotImage(xOffset?: number): void;
|
||||
plotImage(xOffset?: int32): void;
|
||||
|
||||
/**
|
||||
* Shows an frame from the image at offset ``x offset``.
|
||||
@ -41,7 +48,7 @@ declare interface Image {
|
||||
//% help=images/show-image weight=80 blockNamespace=images
|
||||
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
|
||||
//% parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage
|
||||
showImage(xOffset: number, interval?: number): void;
|
||||
showImage(xOffset: int32, interval?: int32): void;
|
||||
|
||||
/**
|
||||
* Draws the ``index``-th frame of the image on the screen.
|
||||
@ -49,7 +56,7 @@ declare interface Image {
|
||||
*/
|
||||
//% help=images/plot-frame weight=80
|
||||
//% parts="ledmatrix" shim=ImageMethods::plotFrame
|
||||
plotFrame(xOffset: number): void;
|
||||
plotFrame(xOffset: int32): void;
|
||||
|
||||
/**
|
||||
* Scrolls an image .
|
||||
@ -59,7 +66,7 @@ declare interface Image {
|
||||
//% help=images/scroll-image weight=79 async blockNamespace=images
|
||||
//% blockId=device_scroll_image block="scroll image %sprite|with offset %frameoffset|and interval (ms) %delay" blockGap=8
|
||||
//% parts="ledmatrix" shim=ImageMethods::scrollImage
|
||||
scrollImage(frameOffset: number, interval: number): void;
|
||||
scrollImage(frameOffset: int32, interval: int32): void;
|
||||
|
||||
/**
|
||||
* Sets all pixels off.
|
||||
@ -73,26 +80,26 @@ declare interface Image {
|
||||
*/
|
||||
//%
|
||||
//% parts="ledmatrix" shim=ImageMethods::setPixelBrightness
|
||||
setPixelBrightness(x: number, y: number, value: number): void;
|
||||
setPixelBrightness(x: int32, y: int32, value: int32): void;
|
||||
|
||||
/**
|
||||
* Gets the pixel brightness ([0..255]) at a given position
|
||||
*/
|
||||
//%
|
||||
//% parts="ledmatrix" shim=ImageMethods::pixelBrightness
|
||||
pixelBrightness(x: number, y: number): number;
|
||||
pixelBrightness(x: int32, y: int32): int32;
|
||||
|
||||
/**
|
||||
* Gets the width in columns
|
||||
*/
|
||||
//% help=functions/width shim=ImageMethods::width
|
||||
width(): number;
|
||||
width(): int32;
|
||||
|
||||
/**
|
||||
* Gets the height in rows (always 5)
|
||||
*/
|
||||
//% shim=ImageMethods::height
|
||||
height(): number;
|
||||
height(): int32;
|
||||
|
||||
/**
|
||||
* Set a pixel state at position ``(x,y)``
|
||||
@ -102,7 +109,7 @@ declare interface Image {
|
||||
*/
|
||||
//% help=images/set-pixel
|
||||
//% parts="ledmatrix" shim=ImageMethods::setPixel
|
||||
setPixel(x: number, y: number, value: boolean): void;
|
||||
setPixel(x: int32, y: int32, value: boolean): void;
|
||||
|
||||
/**
|
||||
* Get the pixel state at position ``(x,y)``
|
||||
@ -111,7 +118,7 @@ declare interface Image {
|
||||
*/
|
||||
//% help=images/pixel
|
||||
//% parts="ledmatrix" shim=ImageMethods::pixel
|
||||
pixel(x: number, y: number): boolean;
|
||||
pixel(x: int32, y: int32): boolean;
|
||||
|
||||
/**
|
||||
* Shows a particular frame of the image strip.
|
||||
@ -119,7 +126,7 @@ declare interface Image {
|
||||
*/
|
||||
//% weight=70 help=images/show-frame
|
||||
//% parts="ledmatrix" interval.defl=400 shim=ImageMethods::showFrame
|
||||
showFrame(frame: number, interval?: number): void;
|
||||
showFrame(frame: int32, interval?: int32): void;
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +145,7 @@ declare namespace basic {
|
||||
//% blockId=device_show_number block="show|number %number" blockGap=8
|
||||
//% async
|
||||
//% parts="ledmatrix" interval.defl=150 shim=basic::showNumber
|
||||
function showNumber(value: number, interval?: number): void;
|
||||
function showNumber(value: int32, interval?: int32): void;
|
||||
|
||||
/**
|
||||
* Draws an image on the LED screen.
|
||||
@ -147,11 +154,14 @@ declare namespace basic {
|
||||
*/
|
||||
//% help=basic/show-leds
|
||||
//% weight=95 blockGap=8
|
||||
//% imageLiteral=1 async
|
||||
//% imageLiteral=0 async
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% blockId=device_show_leds
|
||||
//% block="show leds" icon="\uf00a"
|
||||
//% parts="ledmatrix" interval.defl=400 shim=basic::showLeds
|
||||
function showLeds(leds: string, interval?: number): void;
|
||||
//% block="show leds| %leds" icon="\uf00a"
|
||||
//% parts="ledmatrix" blockExternalInputs=1 interval.defl=400 shim=basic::showLeds
|
||||
function showLeds(leds: string, interval?: int32): void;
|
||||
|
||||
/**
|
||||
* Display text on the display, one character at a time. If the string fits on the screen (i.e. is one letter), does not scroll.
|
||||
@ -164,7 +174,7 @@ declare namespace basic {
|
||||
//% async
|
||||
//% blockId=device_print_message
|
||||
//% parts="ledmatrix" interval.defl=150 shim=basic::showString
|
||||
function showString(text: string, interval?: number): void;
|
||||
function showString(text: string, interval?: int32): void;
|
||||
|
||||
/**
|
||||
* Turn off all LEDs
|
||||
@ -180,9 +190,12 @@ declare namespace basic {
|
||||
* @param leds pattern of LEDs to turn on/off
|
||||
* @param interval time in milliseconds between each redraw
|
||||
*/
|
||||
//% help=basic/show-animation imageLiteral=1 async
|
||||
//% help=basic/show-animation imageLiteral=0 async
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% parts="ledmatrix" interval.defl=400 shim=basic::showAnimation
|
||||
function showAnimation(leds: string, interval?: number): void;
|
||||
function showAnimation(leds: string, interval?: int32): void;
|
||||
|
||||
/**
|
||||
* Draws an image on the LED screen.
|
||||
@ -207,7 +220,7 @@ declare namespace basic {
|
||||
//% help=basic/pause weight=54
|
||||
//% async block="pause (ms) %pause"
|
||||
//% blockId=device_pause icon="\uf110" shim=basic::pause
|
||||
function pause(ms: number): void;
|
||||
function pause(ms: int32): void;
|
||||
}
|
||||
|
||||
|
||||
@ -282,7 +295,7 @@ declare namespace input {
|
||||
//% help=input/acceleration weight=58
|
||||
//% blockId=device_acceleration block="acceleration (mg)|%NAME" blockGap=8
|
||||
//% parts="accelerometer" shim=input::acceleration
|
||||
function acceleration(dimension: Dimension): number;
|
||||
function acceleration(dimension: Dimension): int32;
|
||||
|
||||
/**
|
||||
* Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.
|
||||
@ -290,7 +303,7 @@ declare namespace input {
|
||||
//% help=input/light-level weight=57
|
||||
//% blockId=device_get_light_level block="light level" blockGap=8
|
||||
//% parts="ledmatrix" shim=input::lightLevel
|
||||
function lightLevel(): number;
|
||||
function lightLevel(): int32;
|
||||
|
||||
/**
|
||||
* Get the current compass heading in degrees.
|
||||
@ -299,7 +312,7 @@ declare namespace input {
|
||||
//% weight=56
|
||||
//% blockId=device_heading block="compass heading (°)" blockGap=8
|
||||
//% parts="compass" shim=input::compassHeading
|
||||
function compassHeading(): number;
|
||||
function compassHeading(): int32;
|
||||
|
||||
/**
|
||||
* Gets the temperature in Celsius degrees (°C).
|
||||
@ -308,7 +321,7 @@ declare namespace input {
|
||||
//% help=input/temperature
|
||||
//% blockId=device_temperature block="temperature (°C)" blockGap=8
|
||||
//% parts="thermometer" shim=input::temperature
|
||||
function temperature(): number;
|
||||
function temperature(): int32;
|
||||
|
||||
/**
|
||||
* The pitch or roll of the device, rotation along the ``x-axis`` or ``y-axis``, in degrees.
|
||||
@ -317,7 +330,7 @@ declare namespace input {
|
||||
//% help=input/rotation weight=52
|
||||
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8
|
||||
//% parts="accelerometer" advanced=true shim=input::rotation
|
||||
function rotation(kind: Rotation): number;
|
||||
function rotation(kind: Rotation): int32;
|
||||
|
||||
/**
|
||||
* Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator.
|
||||
@ -327,7 +340,7 @@ declare namespace input {
|
||||
//% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8
|
||||
//% parts="compass"
|
||||
//% advanced=true shim=input::magneticForce
|
||||
function magneticForce(dimension: Dimension): number;
|
||||
function magneticForce(dimension: Dimension): int32;
|
||||
|
||||
/**
|
||||
* Gets the number of milliseconds elapsed since power on.
|
||||
@ -335,7 +348,7 @@ declare namespace input {
|
||||
//% help=input/running-time weight=50 blockGap=8
|
||||
//% blockId=device_get_running_time block="running time (ms)"
|
||||
//% advanced=true shim=input::runningTime
|
||||
function runningTime(): number;
|
||||
function runningTime(): int32;
|
||||
|
||||
/**
|
||||
* Gets the number of microseconds elapsed since power on.
|
||||
@ -343,7 +356,7 @@ declare namespace input {
|
||||
//% help=input/running-time-micros weight=49
|
||||
//% blockId=device_get_running_time_micros block="running time (micros)"
|
||||
//% advanced=true shim=input::runningTimeMicros
|
||||
function runningTimeMicros(): number;
|
||||
function runningTimeMicros(): int32;
|
||||
|
||||
/**
|
||||
* Obsolete, compass calibration is automatic.
|
||||
@ -390,7 +403,7 @@ declare namespace control {
|
||||
*/
|
||||
//% help=control/wait-micros weight=29
|
||||
//% blockId="control_wait_us" block="wait (µs)%micros" shim=control::waitMicros
|
||||
function waitMicros(micros: number): void;
|
||||
function waitMicros(micros: int32): void;
|
||||
|
||||
/**
|
||||
* Raises an event in the event bus.
|
||||
@ -401,7 +414,7 @@ declare namespace control {
|
||||
//% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" blockExternalInputs=1
|
||||
//% help=control/raise-event
|
||||
//% mode.defl=1 shim=control::raiseEvent
|
||||
function raiseEvent(src: number, value: number, mode?: EventCreationMode): void;
|
||||
function raiseEvent(src: int32, value: int32, mode?: EventCreationMode): void;
|
||||
|
||||
/**
|
||||
* Registers an event handler.
|
||||
@ -409,7 +422,7 @@ declare namespace control {
|
||||
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source_id|with value %value=control_event_value_id"
|
||||
//% help=control/on-event
|
||||
//% blockExternalInputs=1 shim=control::onEvent
|
||||
function onEvent(src: number, value: number, handler: () => void): void;
|
||||
function onEvent(src: int32, value: int32, handler: () => void): void;
|
||||
|
||||
/**
|
||||
* Gets the value of the last event executed on the bus
|
||||
@ -417,7 +430,7 @@ declare namespace control {
|
||||
//% blockId=control_event_value" block="event value"
|
||||
//% help=control/event-value
|
||||
//% weight=18 shim=control::eventValue
|
||||
function eventValue(): number;
|
||||
function eventValue(): int32;
|
||||
|
||||
/**
|
||||
* Gets the timestamp of the last event executed on the bus
|
||||
@ -425,7 +438,7 @@ declare namespace control {
|
||||
//% blockId=control_event_timestamp" block="event timestamp"
|
||||
//% help=control/event-timestamp
|
||||
//% weight=19 blockGap=8 shim=control::eventTimestamp
|
||||
function eventTimestamp(): number;
|
||||
function eventTimestamp(): int32;
|
||||
|
||||
/**
|
||||
* Gets a friendly name for the device derived from the its serial number
|
||||
@ -439,7 +452,7 @@ declare namespace control {
|
||||
*/
|
||||
//% blockId="control_device_serial_number" block="device serial number" weight=9
|
||||
//% advanced=true shim=control::deviceSerialNumber
|
||||
function deviceSerialNumber(): number;
|
||||
function deviceSerialNumber(): int32;
|
||||
}
|
||||
|
||||
|
||||
@ -456,7 +469,7 @@ declare namespace led {
|
||||
//% blockId=device_plot block="plot|x %x|y %y" blockGap=8
|
||||
//% parts="ledmatrix"
|
||||
//% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::plot
|
||||
function plot(x: number, y: number): void;
|
||||
function plot(x: int32, y: int32): void;
|
||||
|
||||
/**
|
||||
* Turn on the specified LED with specific brightness using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.
|
||||
@ -469,7 +482,7 @@ declare namespace led {
|
||||
//% parts="ledmatrix"
|
||||
//% x.min=0 x.max=4 y.min=0 y.max=4 brightness.min=0 brightness.max=255
|
||||
//% advanced=true shim=led::plotBrightness
|
||||
function plotBrightness(x: number, y: number, brightness: number): void;
|
||||
function plotBrightness(x: int32, y: int32, brightness: int32): void;
|
||||
|
||||
/**
|
||||
* Turn off the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.
|
||||
@ -480,7 +493,7 @@ declare namespace led {
|
||||
//% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8
|
||||
//% parts="ledmatrix"
|
||||
//% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::unplot
|
||||
function unplot(x: number, y: number): void;
|
||||
function unplot(x: int32, y: int32): void;
|
||||
|
||||
/**
|
||||
* Get the on/off state of the specified LED using x, y coordinates. (0,0) is upper left.
|
||||
@ -491,7 +504,7 @@ declare namespace led {
|
||||
//% blockId=device_point block="point|x %x|y %y"
|
||||
//% parts="ledmatrix"
|
||||
//% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::point
|
||||
function point(x: number, y: number): boolean;
|
||||
function point(x: int32, y: int32): boolean;
|
||||
|
||||
/**
|
||||
* Get the screen brightness from 0 (off) to 255 (full bright).
|
||||
@ -500,7 +513,7 @@ declare namespace led {
|
||||
//% blockId=device_get_brightness block="brightness" blockGap=8
|
||||
//% parts="ledmatrix"
|
||||
//% advanced=true shim=led::brightness
|
||||
function brightness(): number;
|
||||
function brightness(): int32;
|
||||
|
||||
/**
|
||||
* Set the screen brightness from 0 (off) to 255 (full bright).
|
||||
@ -511,7 +524,7 @@ declare namespace led {
|
||||
//% parts="ledmatrix"
|
||||
//% advanced=true
|
||||
//% value.min=0 value.max=255 shim=led::setBrightness
|
||||
function setBrightness(value: number): void;
|
||||
function setBrightness(value: int32): void;
|
||||
|
||||
/**
|
||||
* Cancels the current animation and clears other pending animations.
|
||||
@ -560,7 +573,7 @@ declare namespace pins {
|
||||
//% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8
|
||||
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
||||
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" shim=pins::digitalReadPin
|
||||
function digitalReadPin(name: DigitalPin): number;
|
||||
function digitalReadPin(name: DigitalPin): int32;
|
||||
|
||||
/**
|
||||
* Set a pin or connector value to either 0 or 1.
|
||||
@ -572,7 +585,7 @@ declare namespace pins {
|
||||
//% value.min=0 value.max=1
|
||||
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
||||
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" shim=pins::digitalWritePin
|
||||
function digitalWritePin(name: DigitalPin, value: number): void;
|
||||
function digitalWritePin(name: DigitalPin, value: int32): void;
|
||||
|
||||
/**
|
||||
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
|
||||
@ -582,7 +595,7 @@ declare namespace pins {
|
||||
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
|
||||
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
||||
//% name.fieldOptions.tooltips="false" shim=pins::analogReadPin
|
||||
function analogReadPin(name: AnalogPin): number;
|
||||
function analogReadPin(name: AnalogPin): int32;
|
||||
|
||||
/**
|
||||
* Set the connector value as analog. Value must be comprised between 0 and 1023.
|
||||
@ -594,7 +607,7 @@ declare namespace pins {
|
||||
//% value.min=0 value.max=1023
|
||||
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
||||
//% name.fieldOptions.tooltips="false" shim=pins::analogWritePin
|
||||
function analogWritePin(name: AnalogPin, value: number): void;
|
||||
function analogWritePin(name: AnalogPin, value: int32): void;
|
||||
|
||||
/**
|
||||
* Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds.
|
||||
@ -606,7 +619,7 @@ declare namespace pins {
|
||||
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros"
|
||||
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
|
||||
//% pin.fieldOptions.tooltips="false" shim=pins::analogSetPeriod
|
||||
function analogSetPeriod(name: AnalogPin, micros: number): void;
|
||||
function analogSetPeriod(name: AnalogPin, micros: int32): void;
|
||||
|
||||
/**
|
||||
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
|
||||
@ -625,7 +638,7 @@ declare namespace pins {
|
||||
//% help=pins/pulse-duration advanced=true
|
||||
//% blockId=pins_pulse_duration block="pulse duration (µs)"
|
||||
//% weight=21 blockGap=8 shim=pins::pulseDuration
|
||||
function pulseDuration(): number;
|
||||
function pulseDuration(): int32;
|
||||
|
||||
/**
|
||||
* Returns the duration of a pulse in microseconds
|
||||
@ -638,7 +651,7 @@ declare namespace pins {
|
||||
//% help=pins/pulse-in
|
||||
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
||||
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" maxDuration.defl=2000000 shim=pins::pulseIn
|
||||
function pulseIn(name: DigitalPin, value: PulseValue, maxDuration?: number): number;
|
||||
function pulseIn(name: DigitalPin, value: PulseValue, maxDuration?: int32): int32;
|
||||
|
||||
/**
|
||||
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||
@ -651,7 +664,7 @@ declare namespace pins {
|
||||
//% value.min=0 value.max=180
|
||||
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
||||
//% name.fieldOptions.tooltips="false" shim=pins::servoWritePin
|
||||
function servoWritePin(name: AnalogPin, value: number): void;
|
||||
function servoWritePin(name: AnalogPin, value: int32): void;
|
||||
|
||||
/**
|
||||
* Configures this IO pin as an analog/pwm output, configures the period to be 20 ms, and sets the pulse width, based on the value it is given **microseconds** or `1/1000` milliseconds.
|
||||
@ -662,7 +675,7 @@ declare namespace pins {
|
||||
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros"
|
||||
//% value.fieldEditor="gridpicker" value.fieldOptions.columns=4
|
||||
//% value.fieldOptions.tooltips="false" shim=pins::servoSetPulse
|
||||
function servoSetPulse(name: AnalogPin, micros: number): void;
|
||||
function servoSetPulse(name: AnalogPin, micros: int32): void;
|
||||
|
||||
/**
|
||||
* Sets the pin used when using `analog pitch` or music.
|
||||
@ -681,7 +694,7 @@ declare namespace pins {
|
||||
*/
|
||||
//% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
|
||||
//% help=pins/analog-pitch weight=4 async advanced=true blockGap=8 shim=pins::analogPitch
|
||||
function analogPitch(frequency: number, ms: number): void;
|
||||
function analogPitch(frequency: int32, ms: int32): void;
|
||||
|
||||
/**
|
||||
* Configures the pull of this pin.
|
||||
@ -711,19 +724,19 @@ declare namespace pins {
|
||||
* @param size number of bytes in the buffer
|
||||
*/
|
||||
//% shim=pins::createBuffer
|
||||
function createBuffer(size: number): Buffer;
|
||||
function createBuffer(size: int32): Buffer;
|
||||
|
||||
/**
|
||||
* Read `size` bytes from a 7-bit I2C `address`.
|
||||
*/
|
||||
//% repeat.defl=0 shim=pins::i2cReadBuffer
|
||||
function i2cReadBuffer(address: number, size: number, repeat?: boolean): Buffer;
|
||||
function i2cReadBuffer(address: int32, size: int32, repeat?: boolean): Buffer;
|
||||
|
||||
/**
|
||||
* Write bytes to a 7-bit I2C `address`.
|
||||
*/
|
||||
//% repeat.defl=0 shim=pins::i2cWriteBuffer
|
||||
function i2cWriteBuffer(address: number, buf: Buffer, repeat?: boolean): void;
|
||||
function i2cWriteBuffer(address: int32, buf: Buffer, repeat?: boolean): void;
|
||||
|
||||
/**
|
||||
* Write to the SPI slave and return the response
|
||||
@ -731,7 +744,7 @@ declare namespace pins {
|
||||
*/
|
||||
//% help=pins/spi-write weight=5 advanced=true
|
||||
//% blockId=spi_write block="spi write %value" shim=pins::spiWrite
|
||||
function spiWrite(value: number): number;
|
||||
function spiWrite(value: int32): int32;
|
||||
|
||||
/**
|
||||
* Sets the SPI frequency
|
||||
@ -739,7 +752,7 @@ declare namespace pins {
|
||||
*/
|
||||
//% help=pins/spi-frequency weight=4 advanced=true
|
||||
//% blockId=spi_frequency block="spi frequency %frequency" shim=pins::spiFrequency
|
||||
function spiFrequency(frequency: number): void;
|
||||
function spiFrequency(frequency: int32): void;
|
||||
|
||||
/**
|
||||
* Sets the SPI bits and mode
|
||||
@ -748,7 +761,7 @@ declare namespace pins {
|
||||
*/
|
||||
//% help=pins/spi-format weight=3 advanced=true
|
||||
//% blockId=spi_format block="spi format|bits %bits|mode %mode" shim=pins::spiFormat
|
||||
function spiFormat(bits: number, mode: number): void;
|
||||
function spiFormat(bits: int32, mode: int32): void;
|
||||
|
||||
/**
|
||||
* Sets the MOSI, MISO, SCK pins used by the SPI instance
|
||||
@ -817,7 +830,7 @@ declare namespace serial {
|
||||
*/
|
||||
//% blockId=serial_readbuffer block="serial|read buffer %length"
|
||||
//% help=serial/read-buffer advanced=true weight=5 shim=serial::readBuffer
|
||||
function readBuffer(length: number): Buffer;
|
||||
function readBuffer(length: int32): Buffer;
|
||||
|
||||
/**
|
||||
* Set the serial input and output to use pins instead of the USB connection.
|
||||
@ -852,29 +865,29 @@ declare interface Buffer {
|
||||
* Write a number in specified format in the buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::setNumber
|
||||
setNumber(format: NumberFormat, offset: number, value: number): void;
|
||||
setNumber(format: NumberFormat, offset: int32, value: int32): void;
|
||||
|
||||
/**
|
||||
* Read a number in specified format from the buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::getNumber
|
||||
getNumber(format: NumberFormat, offset: number): number;
|
||||
getNumber(format: NumberFormat, offset: int32): int32;
|
||||
|
||||
/** Returns the length of a Buffer object. */
|
||||
//% property shim=BufferMethods::length
|
||||
length: number;
|
||||
length: int32;
|
||||
|
||||
/**
|
||||
* Fill (a fragment) of the buffer with given value.
|
||||
*/
|
||||
//% offset.defl=0 length.defl=-1 shim=BufferMethods::fill
|
||||
fill(value: number, offset?: number, length?: number): void;
|
||||
fill(value: int32, offset?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Return a copy of a fragment of a buffer.
|
||||
*/
|
||||
//% offset.defl=0 length.defl=-1 shim=BufferMethods::slice
|
||||
slice(offset?: number, length?: number): Buffer;
|
||||
slice(offset?: int32, length?: int32): Buffer;
|
||||
|
||||
/**
|
||||
* Shift buffer left in place, with zero padding.
|
||||
@ -883,7 +896,7 @@ declare interface Buffer {
|
||||
* @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1
|
||||
*/
|
||||
//% start.defl=0 length.defl=-1 shim=BufferMethods::shift
|
||||
shift(offset: number, start?: number, length?: number): void;
|
||||
shift(offset: int32, start?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Rotate buffer left in place.
|
||||
@ -892,13 +905,13 @@ declare interface Buffer {
|
||||
* @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1
|
||||
*/
|
||||
//% start.defl=0 length.defl=-1 shim=BufferMethods::rotate
|
||||
rotate(offset: number, start?: number, length?: number): void;
|
||||
rotate(offset: int32, start?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Write contents of `src` at `dstOffset` in current buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::write
|
||||
write(dstOffset: number, src: Buffer): void;
|
||||
write(dstOffset: int32, src: Buffer): void;
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
||||
|
2
libs/devices/shims.d.ts
vendored
2
libs/devices/shims.d.ts
vendored
@ -12,7 +12,7 @@ declare namespace devices {
|
||||
*/
|
||||
//% help=devices/signal-strength weight=24
|
||||
//% blockId=devices_signal_strength block="signal strength" blockGap=14 icon="\uf012" blockGap=14 shim=devices::signalStrength
|
||||
function signalStrength(): number;
|
||||
function signalStrength(): int32;
|
||||
|
||||
/**
|
||||
* Registers code to run when the device notifies about a change of signal strength.
|
||||
|
@ -7,13 +7,9 @@
|
||||
"radio.Packet.signal": "The received signal strength indicator (RSSI) of the packet.",
|
||||
"radio.Packet.time": "The system time of the sender of the packet at the time the packet was sent.",
|
||||
"radio.onDataPacketReceived": "Registers code to run when the radio receives a packet. Also takes the\nreceived packet from the radio queue.",
|
||||
"radio.onDataReceived": "Registers code to run when a packet is received over radio.",
|
||||
"radio.receiveNumber": "Reads the next packet from the radio queue and returns the packet's number\npayload or 0 if the packet did not contain a number.",
|
||||
"radio.receiveString": "Reads the next packet from the radio queue and returns the packet's string\npayload or the empty string if the packet did not contain a string.",
|
||||
"radio.receivedBuffer": "Returns the buffer payload from the last packet taken from the radio queue\n(via ``receiveNumber``, ``receiveString``, etc) or the empty string if that\npacket did not contain a string.",
|
||||
"radio.receivedNumber": "Returns the number payload from the last packet taken from the radio queue\n(via ``receiveNumber``, ``receiveString``, etc) or 0 if that packet did not\ncontain a number.",
|
||||
"radio.receivedSerial": "Returns the serial number of the sender micro:bit from the last packet taken\nfrom the radio queue (via ``receiveNumber``, ``receiveString``, etc) or 0 if\nthat packet did not send a serial number.",
|
||||
"radio.receivedSignalStrength": "Gets the received signal strength indicator (RSSI) from the last packet taken\nfrom the radio queue (via ``receiveNumber``, ``receiveString``, etc). Not supported in simulator.\nnamespace=radio",
|
||||
"radio.receivedString": "Returns the string payload from the last packet taken from the radio queue\n(via ``receiveNumber``, ``receiveString``, etc) or the empty string if that\npacket did not contain a string.",
|
||||
"radio.receivedTime": "Returns the system time of the sender micro:bit at the moment when it sent the\nlast packet taken from the radio queue (via ``receiveNumber``,\n``receiveString``, etc).",
|
||||
"radio.sendBuffer": "Broadcasts a buffer (up to 19 bytes long) along with the device serial number\nand running time to any connected micro:bit in the group.",
|
||||
@ -28,6 +24,5 @@
|
||||
"radio.setTransmitPower|param|power": "a value in the range 0..7, where 0 is the lowest power and 7 is the highest. eg: 7",
|
||||
"radio.setTransmitSerialNumber": "Set the radio to transmit the serial number in each message.",
|
||||
"radio.setTransmitSerialNumber|param|transmit": "value indicating if the serial number is transmitted, eg: true",
|
||||
"radio.writeReceivedPacketToSerial": "Writes the last received packet to serial as JSON. This should be called\nwithin an ``onDataPacketReceived`` callback.",
|
||||
"radio.writeValueToSerial": "Reads the next packet from the radio queue and and writes it to serial\nas JSON."
|
||||
"radio.writeReceivedPacketToSerial": "Writes the last received packet to serial as JSON. This should be called\nwithin an ``onDataPacketReceived`` callback."
|
||||
}
|
@ -1,9 +1,5 @@
|
||||
{
|
||||
"radio.onDataPacketReceived|block": "on radio received",
|
||||
"radio.onDataReceived|block": "radio on data received",
|
||||
"radio.receiveNumber|block": "radio receive number",
|
||||
"radio.receiveString|block": "radio receive string",
|
||||
"radio.receivedSignalStrength|block": "radio received signal strength",
|
||||
"radio.sendNumber|block": "radio send number %value",
|
||||
"radio.sendString|block": "radio send string %msg",
|
||||
"radio.sendValue|block": "radio send|value %name|= %value",
|
||||
@ -11,7 +7,6 @@
|
||||
"radio.setTransmitPower|block": "radio set transmit power %power",
|
||||
"radio.setTransmitSerialNumber|block": "radio set transmit serial number %transmit",
|
||||
"radio.writeReceivedPacketToSerial|block": "radio write received packet to serial",
|
||||
"radio.writeValueToSerial|block": "radio write value to serial",
|
||||
"radio|block": "radio",
|
||||
"{id:category}Radio": "Radio"
|
||||
}
|
18
libs/radio/shims.d.ts
vendored
18
libs/radio/shims.d.ts
vendored
@ -11,7 +11,7 @@ declare namespace radio {
|
||||
//% help=radio/send-number
|
||||
//% weight=60
|
||||
//% blockId=radio_datagram_send block="radio send number %value" blockGap=8 shim=radio::sendNumber
|
||||
function sendNumber(value: number): void;
|
||||
function sendNumber(value: int32): void;
|
||||
|
||||
/**
|
||||
* Broadcasts a name / value pair along with the device serial number
|
||||
@ -22,7 +22,7 @@ declare namespace radio {
|
||||
//% help=radio/send-value
|
||||
//% weight=59
|
||||
//% blockId=radio_datagram_send_value block="radio send|value %name|= %value" blockGap=8 shim=radio::sendValue
|
||||
function sendValue(name: string, value: number): void;
|
||||
function sendValue(name: string, value: int32): void;
|
||||
|
||||
/**
|
||||
* Broadcasts a string along with the device serial number
|
||||
@ -70,7 +70,7 @@ declare namespace radio {
|
||||
//% weight=46
|
||||
//% blockId=radio_datagram_receive block="radio receive number" blockGap=8
|
||||
//% deprecated=true shim=radio::receiveNumber
|
||||
function receiveNumber(): number;
|
||||
function receiveNumber(): int32;
|
||||
|
||||
/**
|
||||
* Registers code to run when a packet is received over radio.
|
||||
@ -100,7 +100,7 @@ declare namespace radio {
|
||||
//% weight=40
|
||||
//% blockId=radio_datagram_rssi block="radio received signal strength"
|
||||
//% deprecated=true shim=radio::receivedSignalStrength
|
||||
function receivedSignalStrength(): number;
|
||||
function receivedSignalStrength(): int32;
|
||||
|
||||
/**
|
||||
* Sets the group id for radio communications. A micro:bit can only listen to one group ID at any time.
|
||||
@ -110,7 +110,7 @@ declare namespace radio {
|
||||
//% weight=10 blockGap=8
|
||||
//% blockId=radio_set_group block="radio set group %ID"
|
||||
//% id.min=0 id.max=255 shim=radio::setGroup
|
||||
function setGroup(id: number): void;
|
||||
function setGroup(id: int32): void;
|
||||
|
||||
/**
|
||||
* Change the output power level of the transmitter to the given value.
|
||||
@ -121,7 +121,7 @@ declare namespace radio {
|
||||
//% blockId=radio_set_transmit_power block="radio set transmit power %power"
|
||||
//% power.min=0 power.max=7
|
||||
//% advanced=true shim=radio::setTransmitPower
|
||||
function setTransmitPower(power: number): void;
|
||||
function setTransmitPower(power: int32): void;
|
||||
|
||||
/**
|
||||
* Set the radio to transmit the serial number in each message.
|
||||
@ -139,7 +139,7 @@ declare namespace radio {
|
||||
* contain a number.
|
||||
*/
|
||||
//% help=radio/received-number shim=radio::receivedNumber
|
||||
function receivedNumber(): number;
|
||||
function receivedNumber(): int32;
|
||||
|
||||
/**
|
||||
* Returns the serial number of the sender micro:bit from the last packet taken
|
||||
@ -147,7 +147,7 @@ declare namespace radio {
|
||||
* that packet did not send a serial number.
|
||||
*/
|
||||
//% help=radio/received-serial shim=radio::receivedSerial
|
||||
function receivedSerial(): number;
|
||||
function receivedSerial(): uint32;
|
||||
|
||||
/**
|
||||
* Returns the string payload from the last packet taken from the radio queue
|
||||
@ -171,7 +171,7 @@ declare namespace radio {
|
||||
* ``receiveString``, etc).
|
||||
*/
|
||||
//% help=radio/received-time shim=radio::receivedTime
|
||||
function receivedTime(): number;
|
||||
function receivedTime(): uint32;
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
||||
|
3267
package-lock.json
generated
3267
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-microbit",
|
||||
"version": "0.14.31",
|
||||
"version": "1.0.0",
|
||||
"description": "micro:bit target for Microsoft MakeCode (PXT)",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
@ -34,13 +34,15 @@
|
||||
"main": "built/pxtrequire.js",
|
||||
"typings": "built/pxtrequire.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^1.8.7",
|
||||
"rtlcss": "^2.1.2",
|
||||
"autoprefixer": "^6.7.6",
|
||||
"typescript": "2.6.1",
|
||||
"less": "2.7.3",
|
||||
"semantic-ui-less": "2.2.14"
|
||||
"semantic-ui-less": "2.2.14",
|
||||
"@types/bluebird": "2.0.33",
|
||||
"@types/jquery": "3.2.16",
|
||||
"@types/marked": "0.3.0",
|
||||
"@types/node": "8.0.53"
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-core": "0.18.5"
|
||||
"pxt-core": "3.10.9"
|
||||
}
|
||||
}
|
||||
|
@ -237,6 +237,7 @@
|
||||
"organizationUrl": "https://makecode.com/",
|
||||
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray-square.png",
|
||||
"organizationWideLogo": "./static/Microsoft-logo_rgb_c-white.png",
|
||||
"homeScreenHero": "./static/hero.png",
|
||||
"homeUrl": "https://makecode.microbit.org/",
|
||||
"embedUrl": "https://makecode.microbit.org/",
|
||||
"shareUrl": "https://makecode.microbit.org/",
|
||||
@ -257,6 +258,7 @@
|
||||
"appStoreID": "1092687276",
|
||||
"mobileSafariDownloadProtocol": "microbithex://?data",
|
||||
"extendEditor": true,
|
||||
"extendFieldEditors": true,
|
||||
"docMenu": [
|
||||
{
|
||||
"name": "Support",
|
||||
|
@ -1,92 +0,0 @@
|
||||
/// <reference path="../node_modules/pxt-core/typings/globals/bluebird/index.d.ts"/>
|
||||
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||
/// <reference path="../node_modules/pxt-core/built/pxtrunner.d.ts"/>
|
||||
|
||||
//HACK: allows instructions.html to access pxtblocks without requiring simulator.html to import blocks as well
|
||||
if (!(<any>window).pxt) (<any>window).pxt = {};
|
||||
import pxtrunner = pxt.runner;
|
||||
import pxtdocs = pxt.docs;
|
||||
|
||||
namespace pxsim.instructions {
|
||||
export function drawInstructions() {
|
||||
pxsim.visuals.mkBoardView = (opts: pxsim.visuals.BoardViewOptions): pxsim.visuals.BoardView => {
|
||||
return new visuals.MicrobitBoardSvg({
|
||||
runtime: runtime,
|
||||
theme: visuals.randomTheme(),
|
||||
disableTilt: false,
|
||||
wireframe: opts.wireframe,
|
||||
});
|
||||
}
|
||||
|
||||
let getQsVal = parseQueryString();
|
||||
|
||||
//project name
|
||||
let name = getQsVal("name") || "Untitled";
|
||||
|
||||
// board def
|
||||
const boardDef = JSON.parse(getQsVal("board")) as pxsim.BoardDefinition;
|
||||
|
||||
//parts list
|
||||
let parts = (getQsVal("parts") || "").split(" ");
|
||||
parts.sort();
|
||||
|
||||
// parts definitions
|
||||
let partDefinitions = JSON.parse(getQsVal("partdefs") || "{}") as pxsim.Map<PartDefinition>
|
||||
|
||||
//fn args
|
||||
let fnArgs = JSON.parse((getQsVal("fnArgs") || "{}"));
|
||||
|
||||
//project code
|
||||
let tsCode = getQsVal("code");
|
||||
let tsPackage = getQsVal("package") || "";
|
||||
let codeSpinnerDiv = document.getElementById("proj-code-spinner");
|
||||
let codeContainerDiv = document.getElementById("proj-code-container");
|
||||
if (tsCode) {
|
||||
//we use the docs renderer to decompile the code to blocks and render it
|
||||
//TODO: render the blocks code directly
|
||||
let md =
|
||||
`\`\`\`blocks
|
||||
${tsCode}
|
||||
\`\`\`
|
||||
\`\`\`package
|
||||
${tsPackage}
|
||||
\`\`\`
|
||||
`
|
||||
|
||||
pxtdocs.requireMarked = function () { return (<any>window).marked; }
|
||||
pxtrunner.renderMarkdownAsync(codeContainerDiv, md)
|
||||
.done(function () {
|
||||
let codeSvg = $("#proj-code-container svg");
|
||||
if (codeSvg.length > 0) {
|
||||
//code rendered successfully as blocks
|
||||
codeSvg.css("width", "inherit");
|
||||
codeSvg.css("height", "inherit");
|
||||
//takes the svg out of the wrapper markdown
|
||||
codeContainerDiv.innerHTML = "";
|
||||
codeContainerDiv.appendChild(codeSvg[0]);
|
||||
} else {
|
||||
//code failed to convert to blocks, display as typescript instead
|
||||
codeContainerDiv.innerText = tsCode;
|
||||
}
|
||||
$(codeContainerDiv).show();
|
||||
$(codeSpinnerDiv).hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (name)
|
||||
$("#proj-title").text(name);
|
||||
|
||||
//init runtime
|
||||
if (!pxsim.initCurrentRuntime)
|
||||
pxsim.initCurrentRuntime = initRuntimeWithDalBoard;
|
||||
|
||||
renderParts({
|
||||
name,
|
||||
boardDef,
|
||||
parts,
|
||||
partDefinitions,
|
||||
fnArgs
|
||||
})
|
||||
}
|
||||
}
|
@ -31,7 +31,7 @@ namespace pxsim {
|
||||
namespace pxsim.pins {
|
||||
export function digitalReadPin(pinId: number): number {
|
||||
let pin = getPin(pinId);
|
||||
if (!pin) return;
|
||||
if (!pin) return -1;
|
||||
pin.mode = PinFlags.Digital | PinFlags.Input;
|
||||
return pin.value > 100 ? 1 : 0;
|
||||
}
|
||||
@ -52,7 +52,7 @@ namespace pxsim.pins {
|
||||
|
||||
export function analogReadPin(pinId: number): number {
|
||||
let pin = getPin(pinId);
|
||||
if (!pin) return;
|
||||
if (!pin) return -1;
|
||||
pin.mode = PinFlags.Analog | PinFlags.Input;
|
||||
return pin.value || 0;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace pxsim {
|
||||
this.data = data;
|
||||
}
|
||||
public print() {
|
||||
// console.debug(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`)
|
||||
console.debug(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`)
|
||||
}
|
||||
public get(x: number, y: number): number {
|
||||
if (x < 0 || x >= this.width || y < 0 || y >= 5) return 0;
|
||||
@ -66,7 +66,7 @@ namespace pxsim {
|
||||
|
||||
export function createInternalImage(width: number): Image {
|
||||
let img = createImage(width)
|
||||
pxsim.noLeakTracking(img)
|
||||
pxsim.runtime.unregisterLiveObject(img, true)
|
||||
return img
|
||||
}
|
||||
|
||||
|
@ -66,13 +66,15 @@ namespace pxsim.control {
|
||||
board().bus.queue(id, evid)
|
||||
}
|
||||
|
||||
export function eventTimestamp() {
|
||||
return board().bus.getLastEventTime()
|
||||
}
|
||||
// TODO: (microbit master)
|
||||
// export function eventTimestamp() {
|
||||
// return board().bus.getLastEventTime()
|
||||
// }
|
||||
|
||||
export function eventValue() {
|
||||
return board().bus.getLastEventValue()
|
||||
}
|
||||
// TODO: (microbit master)
|
||||
// export function eventValue() {
|
||||
// return board().bus.getLastEventValue()
|
||||
// }
|
||||
}
|
||||
|
||||
namespace pxsim.pxtcore {
|
||||
@ -86,9 +88,10 @@ namespace pxsim.input {
|
||||
return runtime.runningTime();
|
||||
}
|
||||
|
||||
export function runningTimeMicros(): number {
|
||||
return runtime.runningTimeUs();
|
||||
}
|
||||
// TODO: (microbit master)
|
||||
// export function runningTimeMicros(): number {
|
||||
// return runtime.runningTimeUs();
|
||||
// }
|
||||
|
||||
export function calibrateCompass() {
|
||||
// device calibrates...
|
||||
|
@ -154,7 +154,8 @@ namespace pxsim.radio {
|
||||
board().radioState.bus.datagram.send({
|
||||
type: PacketPayloadType.STRING,
|
||||
groupId: board().radioState.groupId,
|
||||
bufferData: data
|
||||
// TODO: (microbit master)
|
||||
//bufferData: data
|
||||
});
|
||||
}
|
||||
|
||||
@ -211,9 +212,10 @@ namespace pxsim.radio {
|
||||
return initString(board().radioState.bus.datagram.lastReceived.payload.stringData || "");
|
||||
}
|
||||
|
||||
export function receivedBuffer(): RefBuffer {
|
||||
return new RefBuffer(board().radioState.bus.datagram.lastReceived.payload.bufferData || new Uint8Array(0))
|
||||
}
|
||||
// TODO: (microbit master)
|
||||
// export function receivedBuffer(): RefBuffer {
|
||||
// return new RefBuffer(board().radioState.bus.datagram.lastReceived.payload.bufferData || new Uint8Array(0))
|
||||
// }
|
||||
|
||||
export function receivedTime(): number {
|
||||
return board().radioState.bus.datagram.lastReceived.time;
|
||||
@ -230,12 +232,13 @@ namespace pxsim.radio {
|
||||
case PacketPayloadType.STRING:
|
||||
b.writeSerial(`{"t":${p.time},"s":${p.serial},"n":"${p.payload.stringData}"}\r\n`)
|
||||
break;
|
||||
case PacketPayloadType.BUFFER:
|
||||
const buf = new Uint8Array(p.payload.bufferData.buffer);
|
||||
let res = "";
|
||||
for (let i = 0; i < buf.length; ++i)
|
||||
res += String.fromCharCode(buf[i]);
|
||||
b.writeSerial(`{"t":${p.time},"s":${p.serial},"b":"${res}"}\r\n`)
|
||||
// TODO: (microbit master)
|
||||
// case PacketPayloadType.BUFFER:
|
||||
// const buf = new Uint8Array(p.payload.bufferData.buffer);
|
||||
// let res = "";
|
||||
// for (let i = 0; i < buf.length; ++i)
|
||||
// res += String.fromCharCode(buf[i]);
|
||||
// b.writeSerial(`{"t":${p.time},"s":${p.serial},"b":"${res}"}\r\n`)
|
||||
default:
|
||||
// unknown type
|
||||
break;
|
||||
|
@ -7,6 +7,9 @@
|
||||
"out": "../built/sim.js",
|
||||
"rootDir": ".",
|
||||
"newLine": "LF",
|
||||
"sourceMap": false
|
||||
"sourceMap": false,
|
||||
"lib": ["dom", "dom.iterable", "scripthost", "es6"],
|
||||
"types": ["jquery", "bluebird"],
|
||||
"typeRoots": ["../node_modules/@types"]
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
/// <reference path="../../node_modules/pxt-core/typings/globals/bluebird/index.d.ts"/>
|
||||
/// <reference path="../../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||
|
||||
namespace pxsim.visuals {
|
||||
@ -40,7 +39,7 @@ namespace pxsim.visuals {
|
||||
svg.fills(result.ledsOuter, defaultLedMatrixTheme.ledOff);
|
||||
|
||||
//turn off LEDs
|
||||
result.leds.forEach(l => (<SVGStylable><any>l).style.opacity = 0 + "");
|
||||
result.leds.forEach(l => (<SVGStyleElement><any>l).style.opacity = 0 + "");
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -103,7 +102,7 @@ namespace pxsim.visuals {
|
||||
public updateState() {
|
||||
if (this.state.disabled) {
|
||||
this.leds.forEach((led, i) => {
|
||||
let sel = (<SVGStylable><any>led)
|
||||
let sel = (<SVGStyleElement><any>led)
|
||||
sel.style.opacity = 0 + "";
|
||||
});
|
||||
return;
|
||||
@ -112,7 +111,7 @@ namespace pxsim.visuals {
|
||||
const bw = this.state.displayMode == pxsim.DisplayMode.bw
|
||||
const img = this.state.image;
|
||||
this.leds.forEach((led, i) => {
|
||||
let sel = (<SVGStylable><any>led)
|
||||
let sel = (<SVGStyleElement><any>led)
|
||||
let dx = i % this.DRAW_SIZE;
|
||||
let dy = (i - dx) / this.DRAW_SIZE;
|
||||
if (dx < this.ACTIVE_SIZE && dy < this.ACTIVE_SIZE) {
|
||||
|
@ -381,7 +381,7 @@ namespace pxsim.visuals {
|
||||
|
||||
if (state.ledMatrixState.disabled) {
|
||||
this.leds.forEach((led, i) => {
|
||||
const sel = (<SVGStylable><any>led)
|
||||
const sel = (<SVGStyleElement><any>led)
|
||||
sel.style.opacity = "0";
|
||||
})
|
||||
} else {
|
||||
@ -389,7 +389,7 @@ namespace pxsim.visuals {
|
||||
const img = state.ledMatrixState.image;
|
||||
const br = state.ledMatrixState.brigthness != undefined ? state.ledMatrixState.brigthness : 255;
|
||||
this.leds.forEach((led, i) => {
|
||||
const sel = (<SVGStylable><any>led)
|
||||
const sel = (<SVGStyleElement><any>led)
|
||||
let imgbr = bw ? (img.data[i] > 0 ? br : 0) : img.data[i];
|
||||
// correct brightness
|
||||
const opacity = imgbr > 0 ? imgbr / 255 * 155 + 100 : 0;
|
||||
@ -420,10 +420,10 @@ namespace pxsim.visuals {
|
||||
this.shakeButton = svg.child(this.g, "circle", { cx: 380, cy: 100, r: 16.5, class: "sim-shake" }) as SVGCircleElement;
|
||||
accessibility.makeFocusable(this.shakeButton);
|
||||
svg.fill(this.shakeButton, this.props.theme.virtualButtonUp)
|
||||
this.shakeButton.addEventListener(pointerEvents.down, ev => {
|
||||
pointerEvents.down.forEach(evid => this.shakeButton.addEventListener(evid, ev => {
|
||||
let state = this.board;
|
||||
svg.fill(this.shakeButton, this.props.theme.buttonDown);
|
||||
})
|
||||
}));
|
||||
this.shakeButton.addEventListener(pointerEvents.leave, ev => {
|
||||
let state = this.board;
|
||||
svg.fill(this.shakeButton, this.props.theme.virtualButtonUp);
|
||||
@ -955,11 +955,11 @@ namespace pxsim.visuals {
|
||||
});
|
||||
})
|
||||
this.pins.slice(0, 3).forEach((btn, index) => {
|
||||
btn.addEventListener(pointerEvents.down, ev => {
|
||||
pointerEvents.down.forEach(evid => btn.addEventListener(evid, ev => {
|
||||
let state = this.board;
|
||||
state.edgeConnectorState.pins[index].touched = true;
|
||||
this.updatePin(state.edgeConnectorState.pins[index], index);
|
||||
})
|
||||
}));
|
||||
btn.addEventListener(pointerEvents.leave, ev => {
|
||||
let state = this.board;
|
||||
state.edgeConnectorState.pins[index].touched = false;
|
||||
@ -982,11 +982,11 @@ namespace pxsim.visuals {
|
||||
let bpState = this.board.buttonPairState;
|
||||
let stateButtons = [bpState.aBtn, bpState.bBtn, bpState.abBtn];
|
||||
this.buttonsOuter.slice(0, 2).forEach((btn, index) => {
|
||||
btn.addEventListener(pointerEvents.down, ev => {
|
||||
pointerEvents.down.forEach(evid => btn.addEventListener(evid, ev => {
|
||||
let state = this.board;
|
||||
stateButtons[index].pressed = true;
|
||||
svg.fill(this.buttons[index], this.props.theme.buttonDown);
|
||||
})
|
||||
}));
|
||||
btn.addEventListener(pointerEvents.leave, ev => {
|
||||
let state = this.board;
|
||||
stateButtons[index].pressed = false;
|
||||
@ -1004,7 +1004,7 @@ namespace pxsim.visuals {
|
||||
this.board.bus.queue(stateButtons[index].id, DAL.MICROBIT_BUTTON_EVT_CLICK);
|
||||
});
|
||||
})
|
||||
this.buttonsOuter[2].addEventListener(pointerEvents.down, ev => {
|
||||
pointerEvents.down.forEach(evid => this.buttonsOuter[2].addEventListener(evid, ev => {
|
||||
let state = this.board;
|
||||
stateButtons[0].pressed = true;
|
||||
stateButtons[1].pressed = true;
|
||||
@ -1012,7 +1012,7 @@ namespace pxsim.visuals {
|
||||
svg.fill(this.buttons[0], this.props.theme.buttonDown);
|
||||
svg.fill(this.buttons[1], this.props.theme.buttonDown);
|
||||
svg.fill(this.buttons[2], this.props.theme.buttonDown);
|
||||
})
|
||||
}));
|
||||
this.buttonsOuter[2].addEventListener(pointerEvents.leave, ev => {
|
||||
let state = this.board;
|
||||
stateButtons[0].pressed = false;
|
||||
|
47
theme/blockly-toolbox.less
Normal file
47
theme/blockly-toolbox.less
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
/*******************************
|
||||
Blockly toolbox
|
||||
*******************************/
|
||||
|
||||
div.blocklyTreeRow {
|
||||
box-shadow: inset 0 -1px 0 0 #ecf0f1;
|
||||
|
||||
margin-bottom: 0px !important;
|
||||
|
||||
-webkit-transition-property: background-color; /* Safari */
|
||||
-webkit-transition-duration: 1s; /* Safari */
|
||||
transition-property: background-color;
|
||||
transition-duration: 1s;
|
||||
}
|
||||
|
||||
/* Blockly toolbox font size same as the page font */
|
||||
span.blocklyTreeLabel {
|
||||
font-family: @pageFont !important;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
.blocklyToolboxDiv, .monacoToolboxDiv {
|
||||
background-color: white !important;
|
||||
border-left: 1px solid #ecf0f1 !important;
|
||||
box-shadow: 4px 0px 2px -4px rgba(0,0,0,0.12), 4px 0px 2px -4px rgba(0,0,0,0.24);
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-width: @largestMobileScreen) {
|
||||
.blocklyToolboxDiv, .monacoToolboxDiv {
|
||||
border-left: 0 !important;
|
||||
}
|
||||
div.blocklyTreeRoot {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tablet */
|
||||
@media only screen and (min-width: @tabletBreakpoint) and (max-width: @largestTabletScreen) {
|
||||
.blocklyToolboxDiv, .monacoToolboxDiv {
|
||||
border-left: 0 !important;
|
||||
}
|
||||
div.blocklyTreeRoot {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
@ -4,44 +4,12 @@
|
||||
|
||||
@import 'blockly-core';
|
||||
|
||||
/* Reference import */
|
||||
@import (reference) "semantic.less";
|
||||
|
||||
/*******************************
|
||||
Blockly
|
||||
Blockly CSS
|
||||
*******************************/
|
||||
|
||||
div.blocklyTreeRow {
|
||||
box-shadow: inset 0 -1px 0 0 #ecf0f1;
|
||||
|
||||
margin-bottom: 0px !important;
|
||||
|
||||
-webkit-transition-property: background-color; /* Safari */
|
||||
-webkit-transition-duration: 1s; /* Safari */
|
||||
transition-property: background-color;
|
||||
transition-duration: 1s;
|
||||
}
|
||||
|
||||
/* Blockly toolbox font size same as the page font */
|
||||
span.blocklyTreeLabel {
|
||||
font-family: @pageFont !important;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
.blocklyToolboxDiv, .monacoToolboxDiv {
|
||||
background-color: white !important;
|
||||
border-left: 1px solid #ecf0f1 !important;
|
||||
box-shadow: 4px 0px 2px -4px rgba(0,0,0,0.12), 4px 0px 2px -4px rgba(0,0,0,0.24);
|
||||
}
|
||||
|
||||
.blocklyFlyoutBackground {
|
||||
fill: #525A67 !important;
|
||||
}
|
||||
|
||||
/* Remove shadow around blockly blocks */
|
||||
.blocklyPathDark, .blocklyPathLight {
|
||||
display: none;
|
||||
}
|
||||
/* Reference import */
|
||||
@import (reference) "semantic.less";
|
||||
|
||||
/* Blockly Field: Grid picker */
|
||||
.blocklyGridPickerTooltip {
|
||||
@ -50,24 +18,4 @@ span.blocklyTreeLabel {
|
||||
border: black solid 3px;
|
||||
color: black;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-width: @largestMobileScreen) {
|
||||
.blocklyToolboxDiv, .monacoToolboxDiv {
|
||||
border-left: 0 !important;
|
||||
}
|
||||
div.blocklyTreeRoot {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tablet */
|
||||
@media only screen and (min-width: @tabletBreakpoint) and (max-width: @largestTabletScreen) {
|
||||
.blocklyToolboxDiv, .monacoToolboxDiv {
|
||||
border-left: 0 !important;
|
||||
}
|
||||
div.blocklyTreeRoot {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
@ -68,6 +68,16 @@
|
||||
@blocklyToolboxColor: rgba(0, 0, 0, 0.05);
|
||||
@trashIconColor: @primaryColor;
|
||||
|
||||
|
||||
/*-------------------
|
||||
Flyout
|
||||
--------------------*/
|
||||
|
||||
@flyoutLabelColor: white;
|
||||
@blocklyFlyoutColor: #3B3C3D;
|
||||
@blocklyFlyoutColorOpacity: 1.0;
|
||||
@monacoFlyoutColor: rgba(59, 60, 61, 1.0);
|
||||
|
||||
/*-------------------
|
||||
Serial
|
||||
--------------------*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* Import all components */
|
||||
@import 'pxtsemantic';
|
||||
@import 'pxt';
|
||||
@import 'blockly-toolbox';
|
||||
@import 'themes/default/globals/site.variables';
|
||||
@import 'themes/pxt/globals/site.variables';
|
||||
@import 'site/globals/site.variables';
|
||||
@ -53,10 +54,6 @@
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
.organization {
|
||||
top: 1.6em;
|
||||
}
|
||||
|
||||
/*******************************
|
||||
Monaco
|
||||
*******************************/
|
||||
@ -66,10 +63,6 @@
|
||||
border: solid 3px #ecf0f1;
|
||||
}
|
||||
|
||||
.monacoFlyout {
|
||||
background: rgba(82, 90, 103, 0.5);
|
||||
}
|
||||
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-width: @largestMobileScreen) {
|
||||
|
Loading…
Reference in New Issue
Block a user