Skip to content

Commit

Permalink
chore: release v7.8.0
Browse files Browse the repository at this point in the history
* (klein0r) Added block for multiple or conditions
* (klein0r) Raised supported ecmaVersion from es2018 to es2021
* (klein0r) Fixed getIdByName (returned the same id as array)
  • Loading branch information
klein0r committed Jan 29, 2024
1 parent ae19ef5 commit 55cd5f7
Show file tree
Hide file tree
Showing 74 changed files with 300 additions and 111 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.5.1 (2023-12-18)

* (klein0r) Added option for calendar week to Blockly
* (klein0r) Fixed inpaired round brackets of getMinutes (Blockly)

## 7.5.0 (2023-12-15)

* (klein0r) Blockly: Day of week as number always returns 1 (monday) to 7 (sunday)
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.8.0 (2024-01-29)

* (klein0r) Added block for multiple or conditions
* (klein0r) Raised supported ecmaVersion from es2018 to es2021
Expand All @@ -71,11 +71,6 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the

* (klein0r) Added schedules by state value (scheduleById)

### 7.5.1 (2023-12-18)

* (klein0r) Added option for calendar week to Blockly
* (klein0r) Fixed inpaired round brackets of getMinutes (Blockly)

## License
The MIT License (MIT)

Expand Down
66 changes: 33 additions & 33 deletions admin/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
{
"files": {
"main.js": "/static/js/main.8c1c081e.js",
"main.js": "/static/js/main.f67be889.js",
"static/css/864.42bfc5f3.chunk.css": "/static/css/864.42bfc5f3.chunk.css",
"static/js/864.8c5abf54.chunk.js": "/static/js/864.8c5abf54.chunk.js",
"static/js/864.511501bb.chunk.js": "/static/js/864.511501bb.chunk.js",
"static/js/805.7c367e53.chunk.js": "/static/js/805.7c367e53.chunk.js",
"static/js/723.a75610c2.chunk.js": "/static/js/723.a75610c2.chunk.js",
"static/js/66.ebb5d6fe.chunk.js": "/static/js/66.ebb5d6fe.chunk.js",
"static/js/723.c39332d7.chunk.js": "/static/js/723.c39332d7.chunk.js",
"static/js/66.65480213.chunk.js": "/static/js/66.65480213.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/666.f676e7ac.chunk.js": "/static/js/666.f676e7ac.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/147.ab44d2ab.chunk.js": "/static/js/147.ab44d2ab.chunk.js",
"static/js/110.89ad9606.chunk.js": "/static/js/110.89ad9606.chunk.js",
"static/js/110.622aba0f.chunk.js": "/static/js/110.622aba0f.chunk.js",
"static/js/610.1561417c.chunk.js": "/static/js/610.1561417c.chunk.js",
"static/js/715.7c0e8344.chunk.js": "/static/js/715.7c0e8344.chunk.js",
"static/js/880.62623dec.chunk.js": "/static/js/880.62623dec.chunk.js",
"static/js/662.fec2a802.chunk.js": "/static/js/662.fec2a802.chunk.js",
"static/js/86.c5b90f52.chunk.js": "/static/js/86.c5b90f52.chunk.js",
"static/js/399.f713c6bc.chunk.js": "/static/js/399.f713c6bc.chunk.js",
"static/js/238.b904fead.chunk.js": "/static/js/238.b904fead.chunk.js",
"static/js/77.9fe70d7d.chunk.js": "/static/js/77.9fe70d7d.chunk.js",
"static/js/85.3afe2022.chunk.js": "/static/js/85.3afe2022.chunk.js",
"static/js/238.33fc8eb6.chunk.js": "/static/js/238.33fc8eb6.chunk.js",
"static/js/77.629f62ea.chunk.js": "/static/js/77.629f62ea.chunk.js",
"static/js/85.bd234575.chunk.js": "/static/js/85.bd234575.chunk.js",
"static/js/983.3f5b808f.chunk.js": "/static/js/983.3f5b808f.chunk.js",
"static/js/888.f2162868.chunk.js": "/static/js/888.f2162868.chunk.js",
"static/js/223.2ce55a07.chunk.js": "/static/js/223.2ce55a07.chunk.js",
"static/js/895.9237a1ad.chunk.js": "/static/js/895.9237a1ad.chunk.js",
"static/js/888.42b62921.chunk.js": "/static/js/888.42b62921.chunk.js",
"static/js/223.c9ffe7a1.chunk.js": "/static/js/223.c9ffe7a1.chunk.js",
"static/js/895.a56a5733.chunk.js": "/static/js/895.a56a5733.chunk.js",
"static/js/419.daaba277.chunk.js": "/static/js/419.daaba277.chunk.js",
"static/js/562.8a3aa23b.chunk.js": "/static/js/562.8a3aa23b.chunk.js",
"static/js/774.a3bcb017.chunk.js": "/static/js/774.a3bcb017.chunk.js",
"static/js/181.8780595a.chunk.js": "/static/js/181.8780595a.chunk.js",
"static/js/774.ca498df3.chunk.js": "/static/js/774.ca498df3.chunk.js",
"static/js/956.8456a0f8.chunk.js": "/static/js/956.8456a0f8.chunk.js",
"static/js/377.2f585ccd.chunk.js": "/static/js/377.2f585ccd.chunk.js",
"static/js/838.b6d6870a.chunk.js": "/static/js/838.b6d6870a.chunk.js",
"static/js/838.b2f46849.chunk.js": "/static/js/838.b2f46849.chunk.js",
"static/js/17.ec756001.chunk.js": "/static/js/17.ec756001.chunk.js",
"static/js/917.05d2dfa0.chunk.js": "/static/js/917.05d2dfa0.chunk.js",
"static/js/344.d013b164.chunk.js": "/static/js/344.d013b164.chunk.js",
"static/media/tileRules.png": "/static/media/tileRules.7ed5885a66686cc288b1.png",
"static/media/docs.md": "/static/media/docs.1f96bec81cf08933d921.md",
"static/media/back.jpg": "/static/media/back.bda2bbe51be338a0f657.jpg",
Expand Down Expand Up @@ -161,42 +161,42 @@
"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.8c1c081e.js.map": "/static/js/main.8c1c081e.js.map",
"main.f67be889.js.map": "/static/js/main.f67be889.js.map",
"864.42bfc5f3.chunk.css.map": "/static/css/864.42bfc5f3.chunk.css.map",
"864.8c5abf54.chunk.js.map": "/static/js/864.8c5abf54.chunk.js.map",
"864.511501bb.chunk.js.map": "/static/js/864.511501bb.chunk.js.map",
"805.7c367e53.chunk.js.map": "/static/js/805.7c367e53.chunk.js.map",
"723.a75610c2.chunk.js.map": "/static/js/723.a75610c2.chunk.js.map",
"66.ebb5d6fe.chunk.js.map": "/static/js/66.ebb5d6fe.chunk.js.map",
"723.c39332d7.chunk.js.map": "/static/js/723.c39332d7.chunk.js.map",
"66.65480213.chunk.js.map": "/static/js/66.65480213.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",
"666.f676e7ac.chunk.js.map": "/static/js/666.f676e7ac.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",
"147.ab44d2ab.chunk.js.map": "/static/js/147.ab44d2ab.chunk.js.map",
"110.89ad9606.chunk.js.map": "/static/js/110.89ad9606.chunk.js.map",
"110.622aba0f.chunk.js.map": "/static/js/110.622aba0f.chunk.js.map",
"610.1561417c.chunk.js.map": "/static/js/610.1561417c.chunk.js.map",
"715.7c0e8344.chunk.js.map": "/static/js/715.7c0e8344.chunk.js.map",
"880.62623dec.chunk.js.map": "/static/js/880.62623dec.chunk.js.map",
"662.fec2a802.chunk.js.map": "/static/js/662.fec2a802.chunk.js.map",
"86.c5b90f52.chunk.js.map": "/static/js/86.c5b90f52.chunk.js.map",
"399.f713c6bc.chunk.js.map": "/static/js/399.f713c6bc.chunk.js.map",
"238.b904fead.chunk.js.map": "/static/js/238.b904fead.chunk.js.map",
"77.9fe70d7d.chunk.js.map": "/static/js/77.9fe70d7d.chunk.js.map",
"85.3afe2022.chunk.js.map": "/static/js/85.3afe2022.chunk.js.map",
"238.33fc8eb6.chunk.js.map": "/static/js/238.33fc8eb6.chunk.js.map",
"77.629f62ea.chunk.js.map": "/static/js/77.629f62ea.chunk.js.map",
"85.bd234575.chunk.js.map": "/static/js/85.bd234575.chunk.js.map",
"983.3f5b808f.chunk.js.map": "/static/js/983.3f5b808f.chunk.js.map",
"888.f2162868.chunk.js.map": "/static/js/888.f2162868.chunk.js.map",
"223.2ce55a07.chunk.js.map": "/static/js/223.2ce55a07.chunk.js.map",
"895.9237a1ad.chunk.js.map": "/static/js/895.9237a1ad.chunk.js.map",
"888.42b62921.chunk.js.map": "/static/js/888.42b62921.chunk.js.map",
"223.c9ffe7a1.chunk.js.map": "/static/js/223.c9ffe7a1.chunk.js.map",
"895.a56a5733.chunk.js.map": "/static/js/895.a56a5733.chunk.js.map",
"419.daaba277.chunk.js.map": "/static/js/419.daaba277.chunk.js.map",
"562.8a3aa23b.chunk.js.map": "/static/js/562.8a3aa23b.chunk.js.map",
"774.a3bcb017.chunk.js.map": "/static/js/774.a3bcb017.chunk.js.map",
"181.8780595a.chunk.js.map": "/static/js/181.8780595a.chunk.js.map",
"774.ca498df3.chunk.js.map": "/static/js/774.ca498df3.chunk.js.map",
"956.8456a0f8.chunk.js.map": "/static/js/956.8456a0f8.chunk.js.map",
"377.2f585ccd.chunk.js.map": "/static/js/377.2f585ccd.chunk.js.map",
"838.b6d6870a.chunk.js.map": "/static/js/838.b6d6870a.chunk.js.map",
"838.b2f46849.chunk.js.map": "/static/js/838.b2f46849.chunk.js.map",
"17.ec756001.chunk.js.map": "/static/js/17.ec756001.chunk.js.map",
"917.05d2dfa0.chunk.js.map": "/static/js/917.05d2dfa0.chunk.js.map"
"344.d013b164.chunk.js.map": "/static/js/344.d013b164.chunk.js.map"
},
"entrypoints": [
"static/js/main.8c1c081e.js"
"static/js/main.f67be889.js"
]
}
186 changes: 185 additions & 1 deletion admin/google-blockly/own/blocks_logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,191 @@ Blockly.JavaScript['logic_multi_and'] = function(block) {
}
}

return [`(${ands.length > 0 ? ands.join(' && ') : 'false'})`, Blockly.JavaScript.ORDER_ATOMIC];
return [`(${ands.length > 0 ? ands.join(' && ') : 'false'})`, Blockly.JavaScript.ORDER_LOGICAL_AND];
};

// --- logic multi or --------------------------------------------------

Blockly.Blocks['logic_multi_or_container'] = {
/**
* Mutator block for container.
* @this Blockly.Block
*/
init: function() {
this.setColour("%{BKY_LOGIC_HUE}");

this.appendDummyInput()
.appendField(Blockly.Translate('logic_multi_or'));

this.appendStatementInput('STACK');
this.setTooltip(Blockly.Translate('logic_multi_or_tooltip'));

this.contextMenu = false;
}
};

Blockly.Blocks['logic_multi_or_mutator'] = {
/**
* Mutator block for add items.
* @this Blockly.Block
*/
init: function() {
this.setColour("%{BKY_LOGIC_HUE}");

this.appendDummyInput('OR')
.appendField(Blockly.Translate('logic_multi_or_or'));

this.setPreviousStatement(true);
this.setNextStatement(true);

this.setTooltip(Blockly.Translate('logic_multi_or_tooltip'));

this.contextMenu = false;
}
};

Blockly.Blocks['logic_multi_or'] = {
init: function() {
this.itemCount_ = 2;
this.setMutator(new Blockly.Mutator(['logic_multi_or_mutator']));

this.setInputsInline(false);
this.setOutput(true, 'Boolean');

this.setColour("%{BKY_LOGIC_HUE}");
this.setTooltip(Blockly.Translate('logic_multi_or_tooltip'));
// this.setHelpUrl(getHelp('logic_multi_or_help'));
},
/**
* Create XML to represent number of text inputs.
* @return {!Element} XML storage element.
* @this Blockly.Block
*/
mutationToDom: function () {
const container = document.createElement('mutation');
container.setAttribute('items', this.itemCount_);

return container;
},
/**
* Parse XML to restore the text inputs.
* @param {!Element} xmlElement XML storage element.
* @this Blockly.Block
*/
domToMutation: function (xmlElement) {
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
this.updateShape_();
},
/**
* Populate the mutator's dialog with this block's components.
* @param {!Blockly.Workspace} workspace Mutator's workspace.
* @return {!Blockly.Block} Root block in mutator.
* @this Blockly.Block
*/
decompose: function (workspace) {
const containerBlock = workspace.newBlock('logic_multi_or_container');
containerBlock.initSvg();

let connection = containerBlock.getInput('STACK').connection;
for (let i = 0; i < this.itemCount_; i++) {
const itemBlock = workspace.newBlock('logic_multi_or_mutator');
itemBlock.initSvg();
connection.connect(itemBlock.previousConnection);
connection = itemBlock.nextConnection;
}

return containerBlock;
},
/**
* Reconfigure this block based on the mutator dialog's components.
* @param {!Blockly.Block} containerBlock Root block in mutator.
* @this Blockly.Block
*/
compose: function (containerBlock) {
let itemBlock = containerBlock.getInputTargetBlock('STACK');
// Count number of inputs.
const connections = [];
while (itemBlock) {
connections.push(itemBlock.valueConnection_);
itemBlock = itemBlock.nextConnection &&
itemBlock.nextConnection.targetBlock();
}

// Disconnect any children that don't belong.
for (let k = 0; k < this.itemCount_; k++) {
const connection = this.getInput('OR' + k).connection.targetConnection;
if (connection && connections.indexOf(connection) === -1) {
connection.disconnect();
}
}

this.itemCount_ = connections.length;
if (this.itemCount_ < 2) {
this.itemCount_ = 2;
}
this.updateShape_();

// Reconnect any child blocks.
for (let i = 0; i < this.itemCount_; i++) {
Blockly.Mutator.reconnect(connections[i], this, 'OR' + i);
}
},
/**
* Store pointers to any connected child blocks.
* @param {!Blockly.Block} containerBlock Root block in mutator.
* @this Blockly.Block
*/
saveConnections: function(containerBlock) {
let itemBlock = containerBlock.getInputTargetBlock('STACK');
let i = 0;

while (itemBlock) {
const input = this.getInput('OR' + i);
itemBlock.valueConnection_ = input && input.connection.targetConnection;
i++;
itemBlock = itemBlock.nextConnection &&
itemBlock.nextConnection.targetBlock();
}
},
/**
* Modify this block to have the correct number of inputs.
* @private
* @this Blockly.Block
*/
updateShape_: function() {
if (this.itemCount_ && this.getInput('EMPTY')) {
this.removeInput('EMPTY');
} else if (!this.itemCount_ && !this.getInput('EMPTY')) {
this.appendDummyInput('EMPTY')
.appendField(this.newQuote_(true))
.appendField(this.newQuote_(false));
}
// Add new inputs.
for (let i = 0; i < this.itemCount_; i++) {
if (!this.getInput('OR' + i)) {
const input = this.appendValueInput('OR' + i).setAlign(Blockly.ALIGN_RIGHT);
if (i > 0) {
input.appendField(Blockly.Translate('logic_multi_or_or'));
}
}
}
// Remove deleted inputs.
for (let i = this.itemCount_; this.getInput('OR' + i); i++) {
this.removeInput('OR' + i);
}
}
};

Blockly.JavaScript['logic_multi_or'] = function(block) {
const ors = [];
for (let n = 0; n < block.itemCount_; n++) {
const condition = Blockly.JavaScript.valueToCode(block, 'OR' + n, Blockly.JavaScript.ORDER_COMMA);
if (condition) {
ors.push(condition);
}
}

return [`(${ors.length > 0 ? ors.join(' || ') : 'false'})`, Blockly.JavaScript.ORDER_LOGICAL_OR];
};

// --- logic between --------------------------------------------------
Expand Down
Loading

0 comments on commit 55cd5f7

Please sign in to comment.