gobstones-blockly 0.25.4 → 0.28.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: 0f1724c6b0a4a16cd5c195c49f8522ce2d767c399f763b76b33a374030166b61
4
- data.tar.gz: da6e64d1f72c97205348d784c00ce25fe58e18f669a0cec8f64ce6f223c896a7
3
+ metadata.gz: 29902334f56b93fd4cef18ef000f6503f536f50db2367928e8d89bea3aaf0876
4
+ data.tar.gz: 7370abf521aa0634c477ad8a267e725e4d253c3165221f1ae1c3d5f61b2c89c1
5
5
  SHA512:
6
- metadata.gz: a9151bc2d8418ef276fd330a93f84843c9aa6fbd8b18cc1ff8ea57183867c4128b5f0082d465812d9f17980c6e0482509bc5268512084e8401cd3a1faac5d19c
7
- data.tar.gz: d01bd53765fe70ee268376909540c64da93b79880c4e5b690a23063f0255aa0bd301cee2a309b432423ec0f5ec6eebda9edf7450c86d53d441532dcb9ed61c6c
6
+ metadata.gz: cfd32117eb21e74db5ce2610c2df787c444b0a7bbfd5a5fa5473f00e859cdbbb293d599a0577a6298f9acfd3414735ee1e0e6fab2515b1c5caaf1b890efb1134
7
+ data.tar.gz: d10e980e304acbd0966921c63228790159c037fc6d5d44ed13274c62918bed40237818158b1f9c6323eba8275e9e7b76bd1731eb89ba29a1fd35ffa05acf097f
@@ -80,9 +80,7 @@ Example:
80
80
  <block type="OperadorDeComparacion"></block>
81
81
  <block type="OperadorLogico"></block>
82
82
  <block type="not"></block>
83
- <block type="siguiente"></block>
84
- <block type="previo"></block>
85
- <block type="opuesto"></block>
83
+ <block type="OperadoresDeEnumeracion"></block>
86
84
  </category>
87
85
  </category>
88
86
  <category name="Definiciones">
@@ -90,7 +88,7 @@ Example:
90
88
  <block type="Program"></block>
91
89
  <block type="InteractiveProgram"></block>
92
90
  </category>
93
- <category name="Asociaciones">
91
+ <category name="Eventos">
94
92
  <block type="InteractiveLetterBinding"></block>
95
93
  <block type="InteractiveNumberBinding"></block>
96
94
  <block type="InteractiveKeyBinding"></block>
@@ -105,7 +103,7 @@ Example:
105
103
  <block type="procedures_defreturn"></block>
106
104
  </category>
107
105
  </category>
108
- <category name="Auxiliares Docente">
106
+ <category name="Auxiliares Docente" gbs_visible="teacher">
109
107
  <block type="ComandoCompletar"></block>
110
108
  <block type="ExpresionCompletar"></block>
111
109
  <block type="AsociacionDeTeclaCompletar"></block>
@@ -5280,14 +5278,12 @@ Blockly.Blocks.siguiente = createSingleParameterExpressionBlock('siguiente','*')
5280
5278
  Blockly.Blocks.previo = createSingleParameterExpressionBlock('previo','*');
5281
5279
  Blockly.Blocks.opuesto = createSingleParameterExpressionBlock('opuesto','*');
5282
5280
 
5283
-
5284
5281
  // Necesario para sanitizar nombres de procedimientos.
5285
5282
  // En la interfaz de bloques de gobstones por ahora vamos a dejar pasar sólo espacios y letras con tilde
5286
5283
  Blockly.Blocks.GobstonesSanitizer = function(name){
5287
5284
  return name.replace(/[^A-Za-z0-9ÁÉÍÓÚÑáéíóúñ_ ]/g,'');
5288
5285
  };
5289
5286
 
5290
-
5291
5287
  Blockly.Procedures.OldRename = Blockly.Procedures.rename;
5292
5288
  Blockly.Procedures.rename = function(name){
5293
5289
  return Blockly.Procedures.OldRename.call(this,
@@ -5302,6 +5298,35 @@ Blockly.Blocks.procedures_mutatorarg.validator_ = function(name){
5302
5298
  return Blockly.Blocks.procedures_mutatorarg.validator_old.call(this,
5303
5299
  Blockly.Blocks.GobstonesSanitizer(name));
5304
5300
  };
5301
+
5302
+ // Enable/Disable atomic
5303
+ const oldProceduresCustomContextMenu = Blockly.Blocks.procedures_defnoreturn.customContextMenu
5304
+ Blockly.Blocks.procedures_defnoreturn.customContextMenu = function(options) {
5305
+ oldProceduresCustomContextMenu.call(this, options);
5306
+
5307
+ const block = this;
5308
+ options.splice(1, 0, {
5309
+ enabled: true,
5310
+ text: block.$isAtomic ? "✗ Mostrar paso a paso" : "✓ Mostrar paso a paso",
5311
+ callback: function() {
5312
+ block.$isAtomic = !block.$isAtomic;
5313
+ triggerRefresh(block);
5314
+ }
5315
+ })
5316
+ }
5317
+ const oldProceduresMutationToDom = Blockly.Blocks['procedures_defnoreturn'].mutationToDom;
5318
+ Blockly.Blocks.procedures_defnoreturn.mutationToDom = function() {
5319
+ const container = oldProceduresMutationToDom.call(this);
5320
+ container.setAttribute("isatomic", this.$isAtomic ? "true" : "false");
5321
+ return container;
5322
+ }
5323
+ const oldProceduresDomToMutation = Blockly.Blocks['procedures_defnoreturn'].domToMutation;
5324
+ Blockly.Blocks.procedures_defnoreturn.domToMutation = function(xmlElement) {
5325
+ const isAtomic = xmlElement.getAttribute("isatomic");
5326
+ this.$isAtomic = isAtomic === "true";
5327
+
5328
+ return oldProceduresDomToMutation.call(this, xmlElement);
5329
+ }
5305
5330
  </script>
5306
5331
  <script>/* global Blockly, goog */
5307
5332
  /* eslint camelcase: "off" */
@@ -5844,11 +5869,11 @@ var makeParameterList = function (block) {
5844
5869
  };
5845
5870
 
5846
5871
  Blockly.GobstonesLanguage.procedures_defnoreturn = function (block) {
5847
- var name = formatCallName(block.getFieldValue('NAME'),true);
5848
- var body = Blockly.GobstonesLanguage.statementToCode(block, 'STACK');
5872
+ var name = formatCallName(block.getFieldValue('NAME'),true);
5873
+ var body = Blockly.GobstonesLanguage.statementToCode(block, 'STACK');
5849
5874
 
5850
- var code = 'procedure ' + name + '(' + makeParameterList(block) + ') {\n' +
5851
- body + '}\n';
5875
+ var code = 'procedure ' + name + '(' + makeParameterList(block) + ') {\n' + body + '}\n';
5876
+ if (block.$isAtomic) code = "/*@ATTRIBUTE@atomic@*/" + "\n" + code;
5852
5877
 
5853
5878
  code = Blockly.GobstonesLanguage.scrub_(block, code);
5854
5879
  Blockly.GobstonesLanguage.definitions_[name] = code;
@@ -6161,6 +6186,14 @@ Blockly.ErrorInforming.CssContent = [
6161
6186
  type: Boolean,
6162
6187
  },
6163
6188
 
6189
+ /*
6190
+ * `role` Indica el role del usuario ("teacher" || "student").
6191
+ */
6192
+ role: {
6193
+ type: String,
6194
+ value: "teacher"
6195
+ },
6196
+
6164
6197
  /*
6165
6198
  * `width` Ancho del elemento.
6166
6199
  */
@@ -6869,8 +6902,9 @@ Blockly.ErrorInforming.CssContent = [
6869
6902
 
6870
6903
  const name = node.getAttribute("name");
6871
6904
  const custom = node.getAttribute("gbs_custom");
6905
+ const visible = node.getAttribute("gbs_visible");
6872
6906
 
6873
- if (custom === "SEPARATOR") {
6907
+ if (custom === "SEPARATOR" || visible !== null) {
6874
6908
  const toolbar = document.querySelector("#blocklyDiv div div div").childNodes[1];
6875
6909
 
6876
6910
  forEachNode(toolbar, (toolbarNode) => {
@@ -6878,23 +6912,27 @@ Blockly.ErrorInforming.CssContent = [
6878
6912
  const isTheRightCategory = toolbarNode.textContent === name;
6879
6913
 
6880
6914
  if (isLabel && isTheRightCategory) {
6881
- const row = toolbarNode.parentElement;
6882
- row.style["pointer-elements"] = "none";
6883
- row.style["background"] = "#15546f";
6884
- row.style["color"] = "#ffffff";
6885
- row.style["margin-top"] = "8px";
6886
- row.style["margin-bottom"] = "8px";
6887
- row.style["pointer-events"] = "none";
6888
- row.style["user-select"] = "none";
6889
-
6890
- if (toolbarNode.innerHTML.startsWith("*")) {
6891
- row.style["margin-top"] = "0";
6892
- row.style["margin-bottom"] = "-8px";
6893
- row.style["font-weight"] = "900";
6894
- toolbarNode.innerHTML = toolbarNode.innerHTML.replace("*", "");
6915
+ if (custom === "SEPARATOR") {
6916
+ const row = toolbarNode.parentElement;
6917
+ row.style["pointer-elements"] = "none";
6918
+ row.style["background-image"] = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4wEVFRcgIqOIVAAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAADUlEQVQI12MQDcn/DwADMgHYjceGPAAAAABJRU5ErkJggg==)";
6919
+ row.style["color"] = "#ffffff";
6920
+ row.style["margin-top"] = "8px";
6921
+ row.style["margin-bottom"] = "8px";
6922
+ row.style["pointer-events"] = "none";
6923
+ row.style["user-select"] = "none";
6924
+
6925
+ if (toolbarNode.innerHTML.startsWith("*")) {
6926
+ row.style["margin-top"] = "0";
6927
+ row.style["margin-bottom"] = "-8px";
6928
+ row.style["font-weight"] = "900";
6929
+ toolbarNode.innerHTML = toolbarNode.innerHTML.replace("*", "");
6930
+ }
6931
+
6932
+ toolbarNode.innerHTML = `<span>${toolbarNode.innerHTML}</span>`;
6933
+ } else if (visible !== null && visible !== this.role) {
6934
+ toolbarNode.remove();
6895
6935
  }
6896
-
6897
- toolbarNode.innerHTML = `<span>${toolbarNode.innerHTML}</span>`;
6898
6936
  }
6899
6937
  });
6900
6938
  }
@@ -1,5 +1,5 @@
1
1
  module Gobstones
2
2
  module Blockly
3
- VERSION = "0.25.4"
3
+ VERSION = "0.28.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.25.4
4
+ version: 0.28.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-11-15 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 2.7.8
90
+ rubygems_version: 3.0.2
92
91
  signing_key:
93
92
  specification_version: 4
94
93
  summary: Gobstones Blockly