update blockly version

This commit is contained in:
Mario Pesch 2021-12-21 12:13:13 +01:00
parent 13ce43072d
commit 85dc4d7fc9
4 changed files with 97 additions and 102 deletions

92
package-lock.json generated
View File

@ -8,11 +8,11 @@
"name": "blockly-react",
"version": "0.1.0",
"dependencies": {
"@blockly/block-plus-minus": "^2.0.10",
"@blockly/field-slider": "^2.1.1",
"@blockly/plugin-scroll-options": "^1.0.2",
"@blockly/plugin-typed-variable-modal": "^3.1.26",
"@blockly/zoom-to-fit": "^2.0.7",
"@blockly/block-plus-minus": "^2.0.39",
"@blockly/field-slider": "^2.1.30",
"@blockly/plugin-scroll-options": "^1.0.4",
"@blockly/plugin-typed-variable-modal": "^3.1.29",
"@blockly/zoom-to-fit": "^2.0.9",
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/react-fontawesome": "^0.1.11",
@ -23,7 +23,7 @@
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.22.0",
"blockly": "^6.20210701.0",
"blockly": "^7.20211209.0",
"file-saver": "^2.0.2",
"mnemonic-id": "^3.2.7",
"moment": "^2.28.0",
@ -1456,19 +1456,25 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw=="
},
"node_modules/@blockly/block-plus-minus": {
"version": "2.0.10",
"resolved": "https://registry.npmjs.org/@blockly/block-plus-minus/-/block-plus-minus-2.0.10.tgz",
"integrity": "sha512-YWEQd9xHAAn1aJgIuZsAdx2t9ZSjinaSEzbN1c43iU584TvaiPsGq5JcnLpoDIyGgJI90Nk+o4erWyQR+kqLyQ==",
"version": "2.0.39",
"resolved": "https://registry.npmjs.org/@blockly/block-plus-minus/-/block-plus-minus-2.0.39.tgz",
"integrity": "sha512-kOMW+d8Ll6W01zG7ft5Mo7vQyFOGSuP5NUgxQArwT2mX9gqqL5ptKdPnxx5VINKe60pJ/TrqPsGmOMk7JjrRhQ==",
"engines": {
"node": ">=8.17.0"
},
"peerDependencies": {
"blockly": "3.20202625.1 - 6"
}
},
"node_modules/@blockly/field-slider": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-2.1.1.tgz",
"integrity": "sha512-VclXqKRs94iHl7yhFNCK+a1uyiHtPHgoAYXugr7hbZ6BZWGdI9tV1iMeiILz4pNlhy6llM+QvbJopjYA+4oCFQ==",
"version": "2.1.30",
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-2.1.30.tgz",
"integrity": "sha512-1Dt/Y0va5gd6k2P94X+PuvqJb78Fi9MNcI2u8oJ0/QBUv1YkZA6ngDQYJSmeWXMg+T+tohNEVjX7d7PQsEkd0g==",
"engines": {
"node": ">=8.0.0"
},
"peerDependencies": {
"blockly": "3.20200924.1 - 6"
}
},
"node_modules/@blockly/plugin-modal": {
@ -1480,9 +1486,9 @@
}
},
"node_modules/@blockly/plugin-scroll-options": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@blockly/plugin-scroll-options/-/plugin-scroll-options-1.0.2.tgz",
"integrity": "sha512-j0ehQlHv/0EWPw8UQEplGs4jCxfo45yp6ZzxYxReMirM0/j4EXXFvgXTZoruPgRYgMl+pCwya32Z6Dkv19sURA==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@blockly/plugin-scroll-options/-/plugin-scroll-options-1.0.4.tgz",
"integrity": "sha512-Aex5zpSmWDvTBRGNJWwI12qYWhXG+u0bnb74LD917EdE94tsz4P2p7B/tby3NZdsE4DvNHjUG0dxCwxTbcitHg==",
"engines": {
"node": ">=8.17.0"
},
@ -1491,9 +1497,9 @@
}
},
"node_modules/@blockly/plugin-typed-variable-modal": {
"version": "3.1.26",
"resolved": "https://registry.npmjs.org/@blockly/plugin-typed-variable-modal/-/plugin-typed-variable-modal-3.1.26.tgz",
"integrity": "sha512-3aKdr/NkcyH93zt0etnmR+urZ3csHbhqyUBn9Q8r/w6GNm54S8s916B921YnGFUBtnWnUEzieMHRAt5KveSKug==",
"version": "3.1.29",
"resolved": "https://registry.npmjs.org/@blockly/plugin-typed-variable-modal/-/plugin-typed-variable-modal-3.1.29.tgz",
"integrity": "sha512-mTgkXAZUikzUfduQSIOGOooepJvfwElUBD28m+90WApGvUzw8eNB8ijE3myulnbz1QBBCgeFMu6g708WumtWhg==",
"dependencies": {
"@blockly/plugin-modal": "^1.20200427.4"
},
@ -1505,9 +1511,9 @@
}
},
"node_modules/@blockly/zoom-to-fit": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@blockly/zoom-to-fit/-/zoom-to-fit-2.0.7.tgz",
"integrity": "sha512-ZMY6k1V97B3IwBWcbxFlpKwKtfWg2vmJuLfmdIymrJQZtswRyY303F1JOl1G1+zsCKeyW/FVo/ysrSDZTIaRCQ==",
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/@blockly/zoom-to-fit/-/zoom-to-fit-2.0.9.tgz",
"integrity": "sha512-yfv7Y0QCcEkiZJKI7o4EzV1pqebk/gIyKugYUaszZh/4sRvtmyfIF7fGrqcuqRc+JQHJy07SI3yvdo7bJW/nQg==",
"engines": {
"node": ">=8.17.0"
},
@ -5893,9 +5899,9 @@
}
},
"node_modules/blockly": {
"version": "6.20210701.0",
"resolved": "https://registry.npmjs.org/blockly/-/blockly-6.20210701.0.tgz",
"integrity": "sha512-cNrwFOAxXE5Pbs1FJAyLTlSRzpNW/C+0gPT2rGQDOJVVKcyF3vhFC1StgnxvQNsv//ueuksKWIXxDuSWh1VI4w==",
"version": "7.20211209.0",
"resolved": "https://registry.npmjs.org/blockly/-/blockly-7.20211209.0.tgz",
"integrity": "sha512-6dti2yvn5tiSQZv45PtHCjdQ53dYjruG8xgCSULExsrIGAx/Yp+tD3glid7pk5DXdoFU3ck01wwEVPMoZ3JbGw==",
"dependencies": {
"jsdom": "15.2.1"
}
@ -26241,14 +26247,16 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw=="
},
"@blockly/block-plus-minus": {
"version": "2.0.10",
"resolved": "https://registry.npmjs.org/@blockly/block-plus-minus/-/block-plus-minus-2.0.10.tgz",
"integrity": "sha512-YWEQd9xHAAn1aJgIuZsAdx2t9ZSjinaSEzbN1c43iU584TvaiPsGq5JcnLpoDIyGgJI90Nk+o4erWyQR+kqLyQ=="
"version": "2.0.39",
"resolved": "https://registry.npmjs.org/@blockly/block-plus-minus/-/block-plus-minus-2.0.39.tgz",
"integrity": "sha512-kOMW+d8Ll6W01zG7ft5Mo7vQyFOGSuP5NUgxQArwT2mX9gqqL5ptKdPnxx5VINKe60pJ/TrqPsGmOMk7JjrRhQ==",
"requires": {}
},
"@blockly/field-slider": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-2.1.1.tgz",
"integrity": "sha512-VclXqKRs94iHl7yhFNCK+a1uyiHtPHgoAYXugr7hbZ6BZWGdI9tV1iMeiILz4pNlhy6llM+QvbJopjYA+4oCFQ=="
"version": "2.1.30",
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-2.1.30.tgz",
"integrity": "sha512-1Dt/Y0va5gd6k2P94X+PuvqJb78Fi9MNcI2u8oJ0/QBUv1YkZA6ngDQYJSmeWXMg+T+tohNEVjX7d7PQsEkd0g==",
"requires": {}
},
"@blockly/plugin-modal": {
"version": "1.20200427.4",
@ -26256,23 +26264,23 @@
"integrity": "sha512-eA9p+W3mtcWLJQZ23D0Le/Uw3JdxFxwJqTUYtAiRlVON4qnuDXrHQLlvxEiWctNXJZGUTh57zqbvO6ZxNRQPrA=="
},
"@blockly/plugin-scroll-options": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@blockly/plugin-scroll-options/-/plugin-scroll-options-1.0.2.tgz",
"integrity": "sha512-j0ehQlHv/0EWPw8UQEplGs4jCxfo45yp6ZzxYxReMirM0/j4EXXFvgXTZoruPgRYgMl+pCwya32Z6Dkv19sURA==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@blockly/plugin-scroll-options/-/plugin-scroll-options-1.0.4.tgz",
"integrity": "sha512-Aex5zpSmWDvTBRGNJWwI12qYWhXG+u0bnb74LD917EdE94tsz4P2p7B/tby3NZdsE4DvNHjUG0dxCwxTbcitHg==",
"requires": {}
},
"@blockly/plugin-typed-variable-modal": {
"version": "3.1.26",
"resolved": "https://registry.npmjs.org/@blockly/plugin-typed-variable-modal/-/plugin-typed-variable-modal-3.1.26.tgz",
"integrity": "sha512-3aKdr/NkcyH93zt0etnmR+urZ3csHbhqyUBn9Q8r/w6GNm54S8s916B921YnGFUBtnWnUEzieMHRAt5KveSKug==",
"version": "3.1.29",
"resolved": "https://registry.npmjs.org/@blockly/plugin-typed-variable-modal/-/plugin-typed-variable-modal-3.1.29.tgz",
"integrity": "sha512-mTgkXAZUikzUfduQSIOGOooepJvfwElUBD28m+90WApGvUzw8eNB8ijE3myulnbz1QBBCgeFMu6g708WumtWhg==",
"requires": {
"@blockly/plugin-modal": "^1.20200427.4"
}
},
"@blockly/zoom-to-fit": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@blockly/zoom-to-fit/-/zoom-to-fit-2.0.7.tgz",
"integrity": "sha512-ZMY6k1V97B3IwBWcbxFlpKwKtfWg2vmJuLfmdIymrJQZtswRyY303F1JOl1G1+zsCKeyW/FVo/ysrSDZTIaRCQ==",
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/@blockly/zoom-to-fit/-/zoom-to-fit-2.0.9.tgz",
"integrity": "sha512-yfv7Y0QCcEkiZJKI7o4EzV1pqebk/gIyKugYUaszZh/4sRvtmyfIF7fGrqcuqRc+JQHJy07SI3yvdo7bJW/nQg==",
"requires": {}
},
"@cnakazawa/watch": {
@ -29685,9 +29693,9 @@
}
},
"blockly": {
"version": "6.20210701.0",
"resolved": "https://registry.npmjs.org/blockly/-/blockly-6.20210701.0.tgz",
"integrity": "sha512-cNrwFOAxXE5Pbs1FJAyLTlSRzpNW/C+0gPT2rGQDOJVVKcyF3vhFC1StgnxvQNsv//ueuksKWIXxDuSWh1VI4w==",
"version": "7.20211209.0",
"resolved": "https://registry.npmjs.org/blockly/-/blockly-7.20211209.0.tgz",
"integrity": "sha512-6dti2yvn5tiSQZv45PtHCjdQ53dYjruG8xgCSULExsrIGAx/Yp+tD3glid7pk5DXdoFU3ck01wwEVPMoZ3JbGw==",
"requires": {
"jsdom": "15.2.1"
},

View File

@ -1,13 +1,13 @@
{
"name": "blockly-react",
"version": "0.1.0",
"version": "1.0.0",
"private": true,
"dependencies": {
"@blockly/block-plus-minus": "^2.0.10",
"@blockly/field-slider": "^2.1.1",
"@blockly/plugin-scroll-options": "^1.0.2",
"@blockly/plugin-typed-variable-modal": "^3.1.26",
"@blockly/zoom-to-fit": "^2.0.7",
"@blockly/block-plus-minus": "^2.0.39",
"@blockly/field-slider": "^2.1.30",
"@blockly/plugin-scroll-options": "^1.0.4",
"@blockly/plugin-typed-variable-modal": "^3.1.29",
"@blockly/zoom-to-fit": "^2.0.9",
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/react-fontawesome": "^0.1.11",
@ -18,7 +18,7 @@
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.22.0",
"blockly": "^6.20210701.0",
"blockly": "^7.20211209.0",
"file-saver": "^2.0.2",
"mnemonic-id": "^3.2.7",
"moment": "^2.28.0",

View File

@ -2,10 +2,17 @@ import Blockly from "blockly";
const setVariableFunction = function (defaultValue) {
return function (block) {
const variableName = Blockly["Arduino"].nameDB_.getName(
block.getFieldValue("VAR"),
Blockly.Variables.NAME_TYPE
);
var id = block.getFieldValue("VAR");
const variableName = Blockly.Variables.getVariable(
Blockly.getMainWorkspace(),
id
).name;
// const variableName = Blockly["Arduino"].nameDB_.getName(
// id,
// Blockly.Variables.NAME_TYPE
// );
const variableValue = Blockly["Arduino"].valueToCode(
block,
"VALUE",
@ -16,32 +23,12 @@ const setVariableFunction = function (defaultValue) {
.getVariableMap()
.getAllVariables();
const myVar = allVars.filter((v) => v.name === variableName)[0];
console.log(myVar);
var code = "";
switch (myVar.type) {
default:
Blockly.Arduino.variables_[variableName + myVar.type] =
myVar.type + " " + myVar.name + ";\n";
code = variableName + " = " + (variableValue || defaultValue) + ";\n";
break;
case "Array":
var arrayType;
var number;
if (this.getChildren().length > 0) {
if (this.getChildren()[0].type === "lists_create_empty") {
arrayType = this.getChildren()[0].getFieldValue("type");
number = Blockly.Arduino.valueToCode(
this.getChildren()[0],
"NUMBER",
Blockly["Arduino"].ORDER_ATOMIC
);
Blockly.Arduino.variables_[
myVar + myVar.type
] = `${arrayType} ${myVar.name} [${number}];\n`;
}
}
break;
if (myVar !== undefined) {
Blockly.Arduino.variables_[variableName + myVar.type] =
myVar.type + " " + myVar.name + ";\n";
code = variableName + " = " + (variableValue || defaultValue) + ";\n";
}
return code;
};

View File

@ -1127,37 +1127,37 @@
"resolved" "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
"version" "0.2.3"
"@blockly/block-plus-minus@^2.0.10":
"integrity" "sha512-YWEQd9xHAAn1aJgIuZsAdx2t9ZSjinaSEzbN1c43iU584TvaiPsGq5JcnLpoDIyGgJI90Nk+o4erWyQR+kqLyQ=="
"resolved" "https://registry.npmjs.org/@blockly/block-plus-minus/-/block-plus-minus-2.0.10.tgz"
"version" "2.0.10"
"@blockly/block-plus-minus@^2.0.39":
"integrity" "sha512-kOMW+d8Ll6W01zG7ft5Mo7vQyFOGSuP5NUgxQArwT2mX9gqqL5ptKdPnxx5VINKe60pJ/TrqPsGmOMk7JjrRhQ=="
"resolved" "https://registry.npmjs.org/@blockly/block-plus-minus/-/block-plus-minus-2.0.39.tgz"
"version" "2.0.39"
"@blockly/field-slider@^2.1.1":
"integrity" "sha512-VclXqKRs94iHl7yhFNCK+a1uyiHtPHgoAYXugr7hbZ6BZWGdI9tV1iMeiILz4pNlhy6llM+QvbJopjYA+4oCFQ=="
"resolved" "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-2.1.1.tgz"
"version" "2.1.1"
"@blockly/field-slider@^2.1.30":
"integrity" "sha512-1Dt/Y0va5gd6k2P94X+PuvqJb78Fi9MNcI2u8oJ0/QBUv1YkZA6ngDQYJSmeWXMg+T+tohNEVjX7d7PQsEkd0g=="
"resolved" "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-2.1.30.tgz"
"version" "2.1.30"
"@blockly/plugin-modal@^1.20200427.4":
"integrity" "sha512-eA9p+W3mtcWLJQZ23D0Le/Uw3JdxFxwJqTUYtAiRlVON4qnuDXrHQLlvxEiWctNXJZGUTh57zqbvO6ZxNRQPrA=="
"resolved" "https://registry.npmjs.org/@blockly/plugin-modal/-/plugin-modal-1.20200427.4.tgz"
"version" "1.20200427.4"
"@blockly/plugin-scroll-options@^1.0.2":
"integrity" "sha512-j0ehQlHv/0EWPw8UQEplGs4jCxfo45yp6ZzxYxReMirM0/j4EXXFvgXTZoruPgRYgMl+pCwya32Z6Dkv19sURA=="
"resolved" "https://registry.npmjs.org/@blockly/plugin-scroll-options/-/plugin-scroll-options-1.0.2.tgz"
"version" "1.0.2"
"@blockly/plugin-scroll-options@^1.0.4":
"integrity" "sha512-Aex5zpSmWDvTBRGNJWwI12qYWhXG+u0bnb74LD917EdE94tsz4P2p7B/tby3NZdsE4DvNHjUG0dxCwxTbcitHg=="
"resolved" "https://registry.npmjs.org/@blockly/plugin-scroll-options/-/plugin-scroll-options-1.0.4.tgz"
"version" "1.0.4"
"@blockly/plugin-typed-variable-modal@^3.1.26":
"integrity" "sha512-3aKdr/NkcyH93zt0etnmR+urZ3csHbhqyUBn9Q8r/w6GNm54S8s916B921YnGFUBtnWnUEzieMHRAt5KveSKug=="
"resolved" "https://registry.npmjs.org/@blockly/plugin-typed-variable-modal/-/plugin-typed-variable-modal-3.1.26.tgz"
"version" "3.1.26"
"@blockly/plugin-typed-variable-modal@^3.1.29":
"integrity" "sha512-mTgkXAZUikzUfduQSIOGOooepJvfwElUBD28m+90WApGvUzw8eNB8ijE3myulnbz1QBBCgeFMu6g708WumtWhg=="
"resolved" "https://registry.npmjs.org/@blockly/plugin-typed-variable-modal/-/plugin-typed-variable-modal-3.1.29.tgz"
"version" "3.1.29"
dependencies:
"@blockly/plugin-modal" "^1.20200427.4"
"@blockly/zoom-to-fit@^2.0.7":
"integrity" "sha512-ZMY6k1V97B3IwBWcbxFlpKwKtfWg2vmJuLfmdIymrJQZtswRyY303F1JOl1G1+zsCKeyW/FVo/ysrSDZTIaRCQ=="
"resolved" "https://registry.npmjs.org/@blockly/zoom-to-fit/-/zoom-to-fit-2.0.7.tgz"
"version" "2.0.7"
"@blockly/zoom-to-fit@^2.0.9":
"integrity" "sha512-yfv7Y0QCcEkiZJKI7o4EzV1pqebk/gIyKugYUaszZh/4sRvtmyfIF7fGrqcuqRc+JQHJy07SI3yvdo7bJW/nQg=="
"resolved" "https://registry.npmjs.org/@blockly/zoom-to-fit/-/zoom-to-fit-2.0.9.tgz"
"version" "2.0.9"
"@cnakazawa/watch@^1.0.3":
"integrity" "sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ=="
@ -3134,10 +3134,10 @@
dependencies:
"file-uri-to-path" "1.0.0"
"blockly@^6.20210701.0", "blockly@3.20200625.0 - 6":
"integrity" "sha512-cNrwFOAxXE5Pbs1FJAyLTlSRzpNW/C+0gPT2rGQDOJVVKcyF3vhFC1StgnxvQNsv//ueuksKWIXxDuSWh1VI4w=="
"resolved" "https://registry.npmjs.org/blockly/-/blockly-6.20210701.0.tgz"
"version" "6.20210701.0"
"blockly@^6.20210701.0", "blockly@^7.20211209.0", "blockly@3.20200625.0 - 6", "blockly@3.20200924.1 - 6", "blockly@3.20202625.1 - 6":
"integrity" "sha512-6dti2yvn5tiSQZv45PtHCjdQ53dYjruG8xgCSULExsrIGAx/Yp+tD3glid7pk5DXdoFU3ck01wwEVPMoZ3JbGw=="
"resolved" "https://registry.npmjs.org/blockly/-/blockly-7.20211209.0.tgz"
"version" "7.20211209.0"
dependencies:
"jsdom" "15.2.1"