Skip to content

Commit

Permalink
chore: release v7.2.0
Browse files Browse the repository at this point in the history
NodeJS 16.x is required

* (klein0r) Added function to format time difference `formatTimeDiff`
* (klein0r) Added blockly blocks for `formatTimeDiff`
* (klein0r) messageToAsync was not working without options
* (klein0r) Added timeout and custom options for sendToAsync
* (klein0r) Fixed valid switch statement expressions
* (klein0r) Added text replacement, cound and reverse blocks
* (klein0r) Added list reverse block
  • Loading branch information
klein0r committed Dec 4, 2023
1 parent 165c265 commit bd8624f
Show file tree
Hide file tree
Showing 156 changed files with 331 additions and 345 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG_OLD.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
The newest change log is in README.md
## 7.1.0 (2023-06-13)
* (klein0r) Added new blocks: new line, random number, value between min and max, if empty
* (klein0r) Updated blockly core to v9.3.3
* (bluefox) corrected blockly

## 7.0.8 (2023-06-12)
* (klein0r) Corrected trigger block
* (klein0r) Corrected typescript V5
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the
<!--
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
### 7.2.0 (2023-12-04)
NodeJS 16.x is required

* (klein0r) Added function to format time difference `formatTimeDiff`
Expand All @@ -70,11 +70,6 @@ NodeJS 16.x is required
### 7.1.1 (2023-06-20)
* (bluefox) corrected the script export

### 7.1.0 (2023-06-13)
* (klein0r) Added new blocks: new line, random number, value between min and max, if empty
* (klein0r) Updated blockly core to v9.3.3
* (bluefox) corrected blockly

## License
The MIT License (MIT)

Expand Down
134 changes: 62 additions & 72 deletions admin/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,41 @@
{
"files": {
"main.js": "/static/js/main.5835fe2e.js",
"static/css/487.c44034b2.chunk.css": "/static/css/487.c44034b2.chunk.css",
"static/js/487.cdbad626.chunk.js": "/static/js/487.cdbad626.chunk.js",
"static/js/90.30165444.chunk.js": "/static/js/90.30165444.chunk.js",
"static/js/184.c77b5f58.chunk.js": "/static/js/184.c77b5f58.chunk.js",
"static/js/536.cd22fe6f.chunk.js": "/static/js/536.cd22fe6f.chunk.js",
"static/js/711.cca79cc5.chunk.js": "/static/js/711.cca79cc5.chunk.js",
"static/js/273.7ab1b85a.chunk.js": "/static/js/273.7ab1b85a.chunk.js",
"static/js/281.6af18b40.chunk.js": "/static/js/281.6af18b40.chunk.js",
"static/js/7.647eff54.chunk.js": "/static/js/7.647eff54.chunk.js",
"static/js/666.a71c4c86.chunk.js": "/static/js/666.a71c4c86.chunk.js",
"static/js/791.58c8138c.chunk.js": "/static/js/791.58c8138c.chunk.js",
"static/js/164.d2d05c2a.chunk.js": "/static/js/164.d2d05c2a.chunk.js",
"static/js/365.44786227.chunk.js": "/static/js/365.44786227.chunk.js",
"static/js/147.2004630a.chunk.js": "/static/js/147.2004630a.chunk.js",
"static/js/599.9f12dcda.chunk.js": "/static/js/599.9f12dcda.chunk.js",
"static/js/691.26ff76ce.chunk.js": "/static/js/691.26ff76ce.chunk.js",
"static/js/715.f66d4e9f.chunk.js": "/static/js/715.f66d4e9f.chunk.js",
"static/js/815.5bc63a3b.chunk.js": "/static/js/815.5bc63a3b.chunk.js",
"static/js/580.07d2b943.chunk.js": "/static/js/580.07d2b943.chunk.js",
"static/js/227.d7fff110.chunk.js": "/static/js/227.d7fff110.chunk.js",
"static/js/712.f17de40c.chunk.js": "/static/js/712.f17de40c.chunk.js",
"static/js/859.ab41b4f5.chunk.js": "/static/js/859.ab41b4f5.chunk.js",
"static/js/149.2197f5fc.chunk.js": "/static/js/149.2197f5fc.chunk.js",
"static/js/304.efa6f664.chunk.js": "/static/js/304.efa6f664.chunk.js",
"static/js/677.69ec119b.chunk.js": "/static/js/677.69ec119b.chunk.js",
"static/js/419.6bdb5b75.chunk.js": "/static/js/419.6bdb5b75.chunk.js",
"static/js/378.3b49e7cd.chunk.js": "/static/js/378.3b49e7cd.chunk.js",
"static/js/223.880cd611.chunk.js": "/static/js/223.880cd611.chunk.js",
"static/js/610.d3cce782.chunk.js": "/static/js/610.d3cce782.chunk.js",
"static/js/838.25b28a1b.chunk.js": "/static/js/838.25b28a1b.chunk.js",
"static/js/826.0315df68.chunk.js": "/static/js/826.0315df68.chunk.js",
"static/js/448.85be54c4.chunk.js": "/static/js/448.85be54c4.chunk.js",
"static/js/377.b42dcc2d.chunk.js": "/static/js/377.b42dcc2d.chunk.js",
"static/js/500.52414135.chunk.js": "/static/js/500.52414135.chunk.js",
"main.js": "/static/js/main.affc7ec6.js",
"static/css/487.9934873c.chunk.css": "/static/css/487.9934873c.chunk.css",
"static/js/487.d623930c.chunk.js": "/static/js/487.d623930c.chunk.js",
"static/js/90.356ce273.chunk.js": "/static/js/90.356ce273.chunk.js",
"static/js/750.cbf4f684.chunk.js": "/static/js/750.cbf4f684.chunk.js",
"static/js/723.6006b5e8.chunk.js": "/static/js/723.6006b5e8.chunk.js",
"static/js/66.d1abe60e.chunk.js": "/static/js/66.d1abe60e.chunk.js",
"static/js/281.fe2096fc.chunk.js": "/static/js/281.fe2096fc.chunk.js",
"static/js/7.1d9b7afb.chunk.js": "/static/js/7.1d9b7afb.chunk.js",
"static/js/791.258dd609.chunk.js": "/static/js/791.258dd609.chunk.js",
"static/js/164.2c2b1075.chunk.js": "/static/js/164.2c2b1075.chunk.js",
"static/js/365.ca66a412.chunk.js": "/static/js/365.ca66a412.chunk.js",
"static/js/531.eceebccc.chunk.js": "/static/js/531.eceebccc.chunk.js",
"static/js/610.387670d8.chunk.js": "/static/js/610.387670d8.chunk.js",
"static/js/715.e43e7502.chunk.js": "/static/js/715.e43e7502.chunk.js",
"static/js/815.a724f988.chunk.js": "/static/js/815.a724f988.chunk.js",
"static/js/593.ce4678ac.chunk.js": "/static/js/593.ce4678ac.chunk.js",
"static/js/238.c2010836.chunk.js": "/static/js/238.c2010836.chunk.js",
"static/js/653.16a4ceb0.chunk.js": "/static/js/653.16a4ceb0.chunk.js",
"static/js/801.692f530f.chunk.js": "/static/js/801.692f530f.chunk.js",
"static/js/983.6d21e150.chunk.js": "/static/js/983.6d21e150.chunk.js",
"static/js/223.9d200641.chunk.js": "/static/js/223.9d200641.chunk.js",
"static/js/677.2b2e7051.chunk.js": "/static/js/677.2b2e7051.chunk.js",
"static/js/419.e33ac3f8.chunk.js": "/static/js/419.e33ac3f8.chunk.js",
"static/js/790.5b04e18a.chunk.js": "/static/js/790.5b04e18a.chunk.js",
"static/js/838.e7f4b756.chunk.js": "/static/js/838.e7f4b756.chunk.js",
"static/js/694.cc9747de.chunk.js": "/static/js/694.cc9747de.chunk.js",
"static/js/882.2c8933e3.chunk.js": "/static/js/882.2c8933e3.chunk.js",
"static/js/377.2f585ccd.chunk.js": "/static/js/377.2f585ccd.chunk.js",
"static/js/360.59624b85.chunk.js": "/static/js/360.59624b85.chunk.js",
"static/media/docs.md": "/static/media/docs.1f96bec81cf08933d921.md",
"static/media/back.jpg": "/static/media/back.bda2bbe51be338a0f657.jpg",
"static/media/hysteresis.png": "/static/media/hysteresis.04ebd02c6062432f891d.png",
"index.html": "/index.html",
"static/media/Ground Floor.svg": "/static/media/Ground Floor.2b7c5c91db7f070935a2.svg",
"static/media/Second Floor.svg": "/static/media/Second Floor.a2d5ed32df336591c06b.svg",
"index.html": "/index.html",
"static/media/Cellar.svg": "/static/media/Cellar.7ec1b1803a2437c8b78c.svg",
"static/media/Anteroom.svg": "/static/media/Anteroom.93a742135f2c060ad619.svg",
"static/media/Corridor.svg": "/static/media/Corridor.93a742135f2c060ad619.svg",
Expand Down Expand Up @@ -158,43 +153,38 @@
"static/media/Garage Doors.svg": "/static/media/Garage Doors.0c2a1cfca7ad1ea59625.svg",
"static/media/Outdoor Blinds.svg": "/static/media/Outdoor Blinds.37b85a9c060a4af48da9.svg",
"static/media/Upstairs.svg": "/static/media/Upstairs.441813e54e0daca0882d.svg",
"main.5835fe2e.js.map": "/static/js/main.5835fe2e.js.map",
"487.c44034b2.chunk.css.map": "/static/css/487.c44034b2.chunk.css.map",
"487.cdbad626.chunk.js.map": "/static/js/487.cdbad626.chunk.js.map",
"90.30165444.chunk.js.map": "/static/js/90.30165444.chunk.js.map",
"184.c77b5f58.chunk.js.map": "/static/js/184.c77b5f58.chunk.js.map",
"536.cd22fe6f.chunk.js.map": "/static/js/536.cd22fe6f.chunk.js.map",
"711.cca79cc5.chunk.js.map": "/static/js/711.cca79cc5.chunk.js.map",
"273.7ab1b85a.chunk.js.map": "/static/js/273.7ab1b85a.chunk.js.map",
"281.6af18b40.chunk.js.map": "/static/js/281.6af18b40.chunk.js.map",
"7.647eff54.chunk.js.map": "/static/js/7.647eff54.chunk.js.map",
"666.a71c4c86.chunk.js.map": "/static/js/666.a71c4c86.chunk.js.map",
"791.58c8138c.chunk.js.map": "/static/js/791.58c8138c.chunk.js.map",
"164.d2d05c2a.chunk.js.map": "/static/js/164.d2d05c2a.chunk.js.map",
"365.44786227.chunk.js.map": "/static/js/365.44786227.chunk.js.map",
"147.2004630a.chunk.js.map": "/static/js/147.2004630a.chunk.js.map",
"599.9f12dcda.chunk.js.map": "/static/js/599.9f12dcda.chunk.js.map",
"691.26ff76ce.chunk.js.map": "/static/js/691.26ff76ce.chunk.js.map",
"715.f66d4e9f.chunk.js.map": "/static/js/715.f66d4e9f.chunk.js.map",
"815.5bc63a3b.chunk.js.map": "/static/js/815.5bc63a3b.chunk.js.map",
"580.07d2b943.chunk.js.map": "/static/js/580.07d2b943.chunk.js.map",
"227.d7fff110.chunk.js.map": "/static/js/227.d7fff110.chunk.js.map",
"712.f17de40c.chunk.js.map": "/static/js/712.f17de40c.chunk.js.map",
"859.ab41b4f5.chunk.js.map": "/static/js/859.ab41b4f5.chunk.js.map",
"149.2197f5fc.chunk.js.map": "/static/js/149.2197f5fc.chunk.js.map",
"304.efa6f664.chunk.js.map": "/static/js/304.efa6f664.chunk.js.map",
"677.69ec119b.chunk.js.map": "/static/js/677.69ec119b.chunk.js.map",
"419.6bdb5b75.chunk.js.map": "/static/js/419.6bdb5b75.chunk.js.map",
"378.3b49e7cd.chunk.js.map": "/static/js/378.3b49e7cd.chunk.js.map",
"223.880cd611.chunk.js.map": "/static/js/223.880cd611.chunk.js.map",
"610.d3cce782.chunk.js.map": "/static/js/610.d3cce782.chunk.js.map",
"838.25b28a1b.chunk.js.map": "/static/js/838.25b28a1b.chunk.js.map",
"826.0315df68.chunk.js.map": "/static/js/826.0315df68.chunk.js.map",
"448.85be54c4.chunk.js.map": "/static/js/448.85be54c4.chunk.js.map",
"377.b42dcc2d.chunk.js.map": "/static/js/377.b42dcc2d.chunk.js.map",
"500.52414135.chunk.js.map": "/static/js/500.52414135.chunk.js.map"
"main.affc7ec6.js.map": "/static/js/main.affc7ec6.js.map",
"487.9934873c.chunk.css.map": "/static/css/487.9934873c.chunk.css.map",
"487.d623930c.chunk.js.map": "/static/js/487.d623930c.chunk.js.map",
"90.356ce273.chunk.js.map": "/static/js/90.356ce273.chunk.js.map",
"750.cbf4f684.chunk.js.map": "/static/js/750.cbf4f684.chunk.js.map",
"723.6006b5e8.chunk.js.map": "/static/js/723.6006b5e8.chunk.js.map",
"66.d1abe60e.chunk.js.map": "/static/js/66.d1abe60e.chunk.js.map",
"281.fe2096fc.chunk.js.map": "/static/js/281.fe2096fc.chunk.js.map",
"7.1d9b7afb.chunk.js.map": "/static/js/7.1d9b7afb.chunk.js.map",
"791.258dd609.chunk.js.map": "/static/js/791.258dd609.chunk.js.map",
"164.2c2b1075.chunk.js.map": "/static/js/164.2c2b1075.chunk.js.map",
"365.ca66a412.chunk.js.map": "/static/js/365.ca66a412.chunk.js.map",
"531.eceebccc.chunk.js.map": "/static/js/531.eceebccc.chunk.js.map",
"610.387670d8.chunk.js.map": "/static/js/610.387670d8.chunk.js.map",
"715.e43e7502.chunk.js.map": "/static/js/715.e43e7502.chunk.js.map",
"815.a724f988.chunk.js.map": "/static/js/815.a724f988.chunk.js.map",
"593.ce4678ac.chunk.js.map": "/static/js/593.ce4678ac.chunk.js.map",
"238.c2010836.chunk.js.map": "/static/js/238.c2010836.chunk.js.map",
"653.16a4ceb0.chunk.js.map": "/static/js/653.16a4ceb0.chunk.js.map",
"801.692f530f.chunk.js.map": "/static/js/801.692f530f.chunk.js.map",
"983.6d21e150.chunk.js.map": "/static/js/983.6d21e150.chunk.js.map",
"223.9d200641.chunk.js.map": "/static/js/223.9d200641.chunk.js.map",
"677.2b2e7051.chunk.js.map": "/static/js/677.2b2e7051.chunk.js.map",
"419.e33ac3f8.chunk.js.map": "/static/js/419.e33ac3f8.chunk.js.map",
"790.5b04e18a.chunk.js.map": "/static/js/790.5b04e18a.chunk.js.map",
"838.e7f4b756.chunk.js.map": "/static/js/838.e7f4b756.chunk.js.map",
"694.cc9747de.chunk.js.map": "/static/js/694.cc9747de.chunk.js.map",
"882.2c8933e3.chunk.js.map": "/static/js/882.2c8933e3.chunk.js.map",
"377.2f585ccd.chunk.js.map": "/static/js/377.2f585ccd.chunk.js.map",
"360.59624b85.chunk.js.map": "/static/js/360.59624b85.chunk.js.map"
},
"entrypoints": [
"static/js/main.5835fe2e.js"
"static/js/main.affc7ec6.js"
]
}
80 changes: 80 additions & 0 deletions admin/google-blockly/own/blocks_convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,86 @@ Blockly.JavaScript.convert_from_date = function (block) {
return [code, Blockly.JavaScript.ORDER_ATOMIC];
};

// --- time difference --------------------------------------------------
Blockly.Convert.blocks['convert_time_difference'] =
'<block type="convert_time_difference">'
+ ' <value name="VALUE">'
+ ' </value>'
+ ' <value name="OPTION">'
+ ' </value>'
+ ' <mutation format="false"></mutation>'
+ ' <value name="FORMAT">'
+ ' </value>'
+ '</block>';

Blockly.Blocks.convert_time_difference = {
init: function () {
this.setColour(Blockly.Convert.HUE);
this.appendValueInput('VALUE')
.appendField(Blockly.Translate('convert_time_difference'));

this.appendDummyInput('OPTION')
.appendField(Blockly.Translate('convert_to'))
.appendField(new Blockly.FieldDropdown([
[Blockly.Translate('time_difference_hh:mm:ss') , 'hh:mm:ss'],
[Blockly.Translate('time_difference_h:m:s') , 'h:m:s'],
[Blockly.Translate('time_difference_hh:mm') , 'hh:mm'],
[Blockly.Translate('time_difference_h:m') , 'h:m'],
[Blockly.Translate('time_difference_mm:ss') , 'mm:ss'],
[Blockly.Translate('time_difference_m:s') , 'm:s'],
[Blockly.Translate('time_difference_custom') , 'custom'],
], function (option) {
this.sourceBlock_.updateShape_(option === 'custom');
}), 'OPTION');

this.setInputsInline(true);
this.setOutput(true);
this.setTooltip(Blockly.Translate('convert_time_difference_tooltip'))
},
mutationToDom: function() {
const container = document.createElement('mutation');
const option = this.getFieldValue('OPTION');

container.setAttribute('format', option === 'custom' ? 'true' : 'false');

return container;
},
domToMutation: function(xmlElement) {
const format = xmlElement.getAttribute('format');

this.updateShape_(format === true || format === 'true' || format === 'TRUE');
},
updateShape_: function(isFormat, isLanguage) {
let inputExists = this.getInput('FORMAT');

if (isFormat) {
if (!inputExists) {
this.appendDummyInput('FORMAT')
.appendField(' ')
.appendField(new Blockly.FieldTextInput(Blockly.Translate('time_difference_default_format')), 'FORMAT');
}
} else if (inputExists) {
this.removeInput('FORMAT');
}
}
};

Blockly.JavaScript.convert_time_difference = function (block) {
const option = block.getFieldValue('OPTION');
const format = block.getFieldValue('FORMAT');

const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);

let code;
if (option === 'custom') {
code = `formatTimeDiff(getDateObject(${value}), '${format}')`;
} else {
code = `formatTimeDiff(getDateObject(${value}), '${option}')`;
}

return [code, Blockly.JavaScript.ORDER_ATOMIC];
};

// --- json2object --------------------------------------------------
Blockly.Convert.blocks['convert_json2object'] =
'<block type="convert_json2object">'
Expand Down
5 changes: 3 additions & 2 deletions admin/google-blockly/own/blocks_switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ Blockly.JavaScript['logic_switch_case'] = function (block) {
let case_n;
const switchVariable = Blockly.JavaScript.valueToCode(block, 'CONDITION', Blockly.JavaScript.ORDER_NONE) || null;

if (switchVariable){
const pattern = /^\(?([._$\d\w"?: \(\)])*\)?$/g;
if (switchVariable) {
const pattern = /^\(?([._$\d\w"'?: \(\)])*\)?$/g;

if (pattern.test(switchVariable)) { // Check to see if the switch is a kind of variable type
code = '\nswitch (' + switchVariable + ') {\n';
Expand Down Expand Up @@ -224,5 +224,6 @@ Blockly.JavaScript['logic_switch_case'] = function (block) {
alert('logic_switch_case: ' + switchVariable + ' is not a variable name');
}
}

return code;
};
4 changes: 2 additions & 2 deletions admin/google-blockly/own/blocks_text.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Blockly.Blocks['text_newline'] = {
};

Blockly.JavaScript['text_newline'] = function(block) {
const dropdown_type = block.getFieldValue('Type');
return ['\'' + dropdown_type + '\'', Blockly.JavaScript.ORDER_ATOMIC];
const dropdownType = block.getFieldValue('Type');
return [`'${dropdownType}'`, Blockly.JavaScript.ORDER_ATOMIC];
};
Loading

0 comments on commit bd8624f

Please sign in to comment.