gobstones-blockly 0.20.1 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d834cafb1356d468fe307783723614b9ef8db3be07ae267f011ae215b1614c54
4
- data.tar.gz: d65d548fa59105f4e5de68d2ff079dee92fccda2721e892bda2bb970496a358c
3
+ metadata.gz: 21365b9498ea4a6da0c2a37f0710fcf460aa9a355c3f448eb42a68007001438c
4
+ data.tar.gz: 28e559e14998d514efcbcefecebec2da03899b3a47cb0b2a3ac27df098d6626e
5
5
  SHA512:
6
- metadata.gz: 8c6dc0d33dc86fc6ee032f939d8b0dcb0bbcdb2d270bad4ba22ec9ce9fcdb5acdfe440377b21bd05964704554f38fd9c082435f30c8574337a1d0a99e42db1cb
7
- data.tar.gz: fff24587bacd1a71c80990f66af1ed8e928d08f54c0d5dd59d85f82c3d4caccc99a01b43265df99eba61ba922e2e3a7f29437c5977c79fad412835c2c631209b
6
+ metadata.gz: 5b7c1b456d0abfd81a2f985a6fcf4b80ce7f7ef52ac17ee6e46bef876afe89eec3da10d8b1cc7e96c8940f58636a070f634230007b84769250d1dac181e345bf
7
+ data.tar.gz: d96e514841bd423e7ea96447256a795d4c06f7ff53005ac92e890ae088e3f9fdb6d3c1ffc9a59fc828450f9e878f59b06866179ad0c4f41356306a1d40343a29
@@ -5081,6 +5081,28 @@ Blockly.Blocks.variables_get = {
5081
5081
  }
5082
5082
  };
5083
5083
 
5084
+ Blockly.Blocks.OperadoresDeEnumeracion = {
5085
+ init: function () {
5086
+ this.jsonInit({
5087
+ message0: '%1 %2',
5088
+ args0: [
5089
+ {
5090
+ type: 'field_dropdown',
5091
+ name: 'OPERATOR',
5092
+ options: [['siguiente', 'siguiente'], ['previo', 'previo'], ['opuesto', 'opuesto']]
5093
+ },
5094
+ {
5095
+ type: 'input_value',
5096
+ name: 'VALUE'
5097
+ }
5098
+ ],
5099
+ colour: Blockly.CUSTOM_COLORS.OperadoresDeEnumeracion || Blockly.CUSTOM_COLORS.operator,
5100
+ inputsInline: true,
5101
+ output: "*"
5102
+ })
5103
+ }
5104
+ };
5105
+
5084
5106
  Blockly.Blocks.not = createSingleParameterExpressionBlock('no','Bool');
5085
5107
  Blockly.Blocks.siguiente = createSingleParameterExpressionBlock('siguiente','*');
5086
5108
  Blockly.Blocks.previo = createSingleParameterExpressionBlock('previo','*');
@@ -5504,6 +5526,10 @@ Blockly.GobstonesLanguage.OperadorLogico = function(block) {
5504
5526
  return [code, order];
5505
5527
  };
5506
5528
 
5529
+ Blockly.GobstonesLanguage.OperadoresDeEnumeracion = function(block) {
5530
+ return exprParamsBlockCodeGenerator(block.getFieldValue('OPERATOR'), ['VALUE'])(block);
5531
+ };
5532
+
5507
5533
  Blockly.GobstonesLanguage.not = exprParamsBlockCodeGenerator('not',['VALUE']);
5508
5534
  Blockly.GobstonesLanguage.siguiente = exprParamsBlockCodeGenerator('siguiente',['VALUE']);
5509
5535
  Blockly.GobstonesLanguage.previo = exprParamsBlockCodeGenerator('previo',['VALUE']);
@@ -6051,6 +6077,9 @@ Blockly.ErrorInforming.CssContent = [
6051
6077
  let xml = toolboxXML || this.$$('#toolbox').innerHTML;
6052
6078
 
6053
6079
  this._processCustomCategories(xml);
6080
+ setTimeout(() => {
6081
+ this._processCustomCategoryStyles(xml);
6082
+ });
6054
6083
 
6055
6084
  // TODO: Este parseo por strings es tremendo, y esa property `xml` de los nodos se usa en _toolboxBlockXML, _toolboxBlockXML, etc. Hay que hacer de vuelta todo lo de acciones primitivas.
6056
6085
 
@@ -6642,6 +6671,35 @@ Blockly.ErrorInforming.CssContent = [
6642
6671
  });
6643
6672
  },
6644
6673
 
6674
+ _processCustomCategoryStyles(xml) {
6675
+ const parsedXml = Blockly.Xml.textToDom(`<xml>${xml}</xml>`);
6676
+
6677
+ const forEachNode = (node, action) => {
6678
+ action(node);
6679
+ node.childNodes.forEach((node) => forEachNode(node, action));
6680
+ }
6681
+
6682
+ forEachNode(parsedXml, (node) => {
6683
+ if (!node.getAttribute) return;
6684
+
6685
+ const name = node.getAttribute("name");
6686
+ const custom = node.getAttribute("gbs_custom");
6687
+
6688
+ if (custom === "SEPARATOR") {
6689
+ const toolbar = document.querySelector("#blocklyDiv div div div").childNodes[1];
6690
+
6691
+ forEachNode(toolbar, (toolbarNode) => {
6692
+ const isLabel = toolbarNode.classList && toolbarNode.classList[0] === "blocklyTreeLabel";
6693
+ const isTheRightCategory = toolbarNode.textContent === name;
6694
+
6695
+ if (isLabel && isTheRightCategory) {
6696
+ toolbarNode.innerHTML = `<strong>${toolbarNode.innerText}</strong>`;
6697
+ }
6698
+ });
6699
+ }
6700
+ });
6701
+ },
6702
+
6645
6703
  _mapToolboxTree: function(toolboxTree, f){
6646
6704
  var resultingList = [];
6647
6705
  for (var i in toolboxTree){
@@ -1,5 +1,5 @@
1
1
  module Gobstones
2
2
  module Blockly
3
- VERSION = "0.20.1"
3
+ VERSION = "0.21.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobstones-blockly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-10 00:00:00.000000000 Z
11
+ date: 2018-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler