gobstones-blockly 0.18.1 → 0.19.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: f16c1d9e0f8d7d1c45571bf145bee056a35f937074d518da0ec2e7acbb4d3763
4
- data.tar.gz: ae42b6ed27a22e0b2c4f4aa38eb1e3da75dc5fd46b483e6031e64761c76416c7
3
+ metadata.gz: 22e54e57e3a61cd5f0694f56ec03ed2ec210d7d5c70fe698aee60565b58cfd03
4
+ data.tar.gz: c4d7409ce025087cc072521a1486554122a87d761142c9e7c5c3247958764d35
5
5
  SHA512:
6
- metadata.gz: 8b813b850a0e7d8d98f08f1b8f4af3b721977f66193992d47ebf5b91c87eb46af34995646ae7470328527df0e02bbf604d1371b8434f38d0d28ca1dcc7f9b387
7
- data.tar.gz: 12e3a730263d9360d216fe9c8fbbc932feb42ede7892f5d9ebae0378238a7e78a9c1eff9446c85781d7c5c9293998e5f0f73787ec12aaf2f7c16f74c00c3e241
6
+ metadata.gz: 528d0a0d53dbe5bbd51d3c642377639bc0486332b5a568455e1e57c85a22307b03b46626ffb7a38ee575afe45f2107a620e4732712bde8ed8667c47bd8622988
7
+ data.tar.gz: 69388948401273c9e95739d6ad4178555f8bfdd3d4be79fde6ddf983c4e164e03f70e46ae801fb146794b8ec9261a2190f5e9da80cd846da0c07d30e92464e07
@@ -4035,14 +4035,17 @@ window.initProcedsBlockly = function(customStatementType) {
4035
4035
  }
4036
4036
  </script>
4037
4037
  <script>initProcedsBlockly("Statement");</script>
4038
- <script>var PLUS = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAQAAAD2e2DtAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQfhDAUCCjFLV0NqAAAC60lEQVR42u3dQW7a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QWYyoIwPSJIYwGQOxAGmG8vqhT/uBUl6+yr1Fw7WpjvU4pNUo2ipIAoozJ1wEQOoslvC3AwyuqTbwJwMN9neoBMcDGMFXUS4DRaFCyWkCwQzxbXAkIO8SuQhqgasxHyLn05V5SFWJJ7RhJEF6GBqNAMShHwF1APO4/jEjidIY8ycDjW4jXPIi0N8tiHfBWzvyV2OYTMOrW8DXWxf86HXA6YL7CK2mVI+V4haX4hyhXuotkgfq42lc00wG5l90XplyATbLY6YsBvZvBnd8NWDzZfeJqwFZpu43yBjrv9/paxTxcsW/0gc39W+cRB22r7dnoGudBdraBU2HgsIdDt0G0xHFyUx/rfvTAFgxiTk5ODqr4+efP1NYAZvP9Ze355vKfGvltrMnUrj5OfMTTCGJd3FvSmwu0GrsDgiP8CSRFxspO2N9jigFKY/Kx1AP9Z9Sk8Bigv6CbypwCZF7ydH4n0CRpbmSn/ETvL/lujilh7wX1D6aPAaqaO89znJqdnCwdh98MArOe63f9IoGfBVM/iFYJHO4izLgNSM48fyy4DoHeZaOUflvxw/iUYEnAcpstcVrHSCetoNq/lLzGEnSI7Ku78Xc6TPfodKd2F75ovnS13OCYI0wkU09/WvlPzasb571/4kCWqbR4EifMgTvhMYNoHuBOvpJDzohFxgmMe4qBx3WYC+rSIPKXc72I66+7PWd3GLDJCC3y+RF7naY5NssqSHunjZYF5gh2CY/vonCs4Du4vcsv56cTUyXlNaduTqP8yypOrrsxEqldb3EGlnECuW/BYs2tf8clcpDTcxy/sR6N3GrO/+L/Tox4h3vfxfVSrs/mUMmtGzm8yq0/GpXkn/E8tf4Dx6D38eIbrrQAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMDQtMDlUMjA6MDc6MDUtMDc6MDDtLVEkAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTA0LTA5VDIwOjA3OjA1LTA3OjAwnHDpmAAAAABJRU5ErkJggg==";
4042
-
4043
- /* global Blockly */
4038
+ <script>/* global Blockly */
4044
4039
 
4045
4040
  Blockly.CUSTOM_COLORS = {"globalHsvSaturation":0.45,"globalHsvValue":0.65,"primitiveCommand":"#1d3c99","assignation":"#051d66","controlStructure":"#0f2b80","literalExpression":"#1d992c","primitiveExpression":"#1d992c","operator":"#0f801c","program":"#8d1bb3","interactiveProgram":"#6e158c","interactiveBinding":"#a11fcc","procedure":"#935ba6","function":"#745380","primitiveProcedure":"#2e4fb3","primitiveFunction":"#2eb33e","procedure_call":"#355bcc","function_call":"#35cc47","variable":"#056610","parameter":"#056610","complete":"#ff0000","H":{"commands":225,"expressions":127,"definitions":285},"S":{"assignation":95,"variable":95,"parameter":95,"primitiveCommand":81,"literalExpression":81,"primitiveExpression":81,"controlStructure":88,"operator":88,"procedure_call":74,"function_call":74,"primitiveProcedure":74,"primitiveFunction":74,"program":85,"interactiveProgram":85,"interactiveBinding":85,"procedure":45,"function":35,"complete":99},"V":{"assignation":40,"variable":40,"parameter":40,"primitiveCommand":60,"literalExpression":60,"primitiveExpression":60,"controlStructure":50,"operator":50,"procedure_call":80,"function_call":80,"primitiveProcedure":70,"primitiveFunction":70,"program":70,"interactiveProgram":55,"interactiveBinding":80,"procedure":65,"function":50,"complete":99}};
4041
+ Blockly.AVAILABLE_ICONS = ["bool-false.svg","bool-true.svg","clean.png","color-azul.svg","color-negro.svg","color-rojo.svg","color-verde.svg","direccion-este.svg","direccion-norte.svg","direccion-oeste.svg","direccion-sur.svg","hand.png","minus.png","plus.png"];
4042
+
4043
+ const getOptions = (block) => {
4044
+ const parentWorkspace = block.workspace.options.parentWorkspace;
4045
+ return parentWorkspace && parentWorkspace.options || block.workspace.options
4046
+ }
4047
+ const getLocalMediaUrl = (block, name) => getOptions(block).localMedia + name;
4048
+ const getLocalMediaSize = (name) => Blockly.AVAILABLE_ICONS.includes(name) ? 16 : 0;
4046
4049
 
4047
4050
  /**
4048
4051
  * Create the svg representation of a block and render
@@ -4169,10 +4172,11 @@ Blockly.Blocks.InteractiveProgram = {
4169
4172
  _addInit() {
4170
4173
  this.$init = true;
4171
4174
 
4175
+ const icon = "minnus.png";
4172
4176
  var removeButton = new Blockly.FieldImage(
4173
- MINUS,
4174
- 16,
4175
- 16,
4177
+ getLocalMediaUrl(this, icon),
4178
+ getLocalMediaSize(icon),
4179
+ getLocalMediaSize(icon),
4176
4180
  "Eliminar",
4177
4181
  function() {
4178
4182
  this.$init = false;
@@ -4193,10 +4197,11 @@ Blockly.Blocks.InteractiveProgram = {
4193
4197
  _addTimeout(timeout) {
4194
4198
  this.$timeout = timeout;
4195
4199
 
4200
+ const icon = "minus.png";
4196
4201
  var removeButton = new Blockly.FieldImage(
4197
- MINUS,
4198
- 16,
4199
- 16,
4202
+ getLocalMediaUrl(this, icon),
4203
+ getLocalMediaSize(icon),
4204
+ getLocalMediaSize(icon),
4200
4205
  "Eliminar",
4201
4206
  function() {
4202
4207
  this.$timeout = undefined;
@@ -4276,10 +4281,12 @@ createInteractiveBinding = (name, keys) => {
4276
4281
 
4277
4282
  const self = this;
4278
4283
  const input = this.inputList[0];
4284
+ const plusIcon = "plus.png";
4285
+ const cleanIcon = "clean.png";
4279
4286
  input.appendField(new Blockly.FieldImage(
4280
- PLUS,
4281
- 16,
4282
- 16,
4287
+ getLocalMediaUrl(this, plusIcon),
4288
+ getLocalMediaSize(plusIcon),
4289
+ getLocalMediaSize(plusIcon),
4283
4290
  "Agregar modificador",
4284
4291
  function() {
4285
4292
  const modifiersCount = getModifierFields(self).length / 2;
@@ -4289,9 +4296,9 @@ createInteractiveBinding = (name, keys) => {
4289
4296
  }
4290
4297
  ));
4291
4298
  input.appendField(new Blockly.FieldImage(
4292
- CLEAN,
4293
- 16,
4294
- 16,
4299
+ getLocalMediaUrl(this, cleanIcon),
4300
+ getLocalMediaSize(cleanIcon),
4301
+ getLocalMediaSize(cleanIcon),
4295
4302
  "Limpiar modificadores",
4296
4303
  function() {
4297
4304
  self._cleanModifiers();
@@ -4425,7 +4432,7 @@ Blockly.Blocks.AlternativaSimple = {
4425
4432
  this.jsonInit({
4426
4433
  type: "Statement",
4427
4434
  previousStatement: "Statement",
4428
- nextStatement: "Statement",
4435
+ nextStatement: "Statement"
4429
4436
  });
4430
4437
 
4431
4438
  this.setColour(Blockly.CUSTOM_COLORS.AlternativaSimple || Blockly.CUSTOM_COLORS.controlStructure);
@@ -4552,12 +4559,20 @@ Blockly.Blocks.AlternativaCompleta = {
4552
4559
 
4553
4560
  Blockly.Blocks.Poner = {
4554
4561
  init: function () {
4562
+ const icon = "putStone.png";
4563
+
4555
4564
  this.jsonInit({
4556
- message0: 'Poner %1',
4565
+ message0: '%1 Poner %2',
4557
4566
  type: "Statement",
4558
4567
  previousStatement: "Statement",
4559
4568
  nextStatement: "Statement",
4560
4569
  args0: [
4570
+ {
4571
+ "type": "field_image",
4572
+ "src": getLocalMediaUrl(this, icon),
4573
+ "width": getLocalMediaSize(icon),
4574
+ "height": getLocalMediaSize(icon)
4575
+ },
4561
4576
  {
4562
4577
  type: 'input_value',
4563
4578
  name: 'COLOR'
@@ -4572,12 +4587,20 @@ Blockly.Blocks.Poner = {
4572
4587
 
4573
4588
  Blockly.Blocks.Sacar = {
4574
4589
  init: function () {
4590
+ const icon = "removeStone.png";
4591
+
4575
4592
  this.jsonInit({
4576
4593
  type: "Statement",
4577
4594
  previousStatement: "Statement",
4578
4595
  nextStatement: "Statement",
4579
- message0: 'Sacar %1',
4596
+ message0: '%1 Sacar %2',
4580
4597
  args0: [
4598
+ {
4599
+ "type": "field_image",
4600
+ "src": getLocalMediaUrl(this, icon),
4601
+ "width": getLocalMediaSize(icon),
4602
+ "height": getLocalMediaSize(icon)
4603
+ },
4581
4604
  {
4582
4605
  type: 'input_value',
4583
4606
  name: 'COLOR'
@@ -4592,12 +4615,20 @@ Blockly.Blocks.Sacar = {
4592
4615
 
4593
4616
  Blockly.Blocks.Mover = {
4594
4617
  init: function () {
4618
+ const icon = "move.png";
4619
+
4595
4620
  this.jsonInit({
4596
4621
  type: "Statement",
4597
4622
  previousStatement: "Statement",
4598
4623
  nextStatement: "Statement",
4599
- message0: 'Mover %1',
4624
+ message0: '%1 Mover %2',
4600
4625
  args0: [
4626
+ {
4627
+ "type": "field_image",
4628
+ "src": getLocalMediaUrl(this, icon),
4629
+ "width": getLocalMediaSize(icon),
4630
+ "height": getLocalMediaSize(icon)
4631
+ },
4601
4632
  {
4602
4633
  type: 'input_value',
4603
4634
  name: 'DIRECCION'
@@ -4612,12 +4643,20 @@ Blockly.Blocks.Mover = {
4612
4643
 
4613
4644
  Blockly.Blocks.IrAlBorde = {
4614
4645
  init: function () {
4646
+ const icon = "goToEdge.png";
4647
+
4615
4648
  this.jsonInit({
4616
4649
  type: "Statement",
4617
4650
  previousStatement: "Statement",
4618
4651
  nextStatement: "Statement",
4619
- message0: 'Ir al borde %1',
4652
+ message0: '%1 Ir al borde %2',
4620
4653
  args0: [
4654
+ {
4655
+ "type": "field_image",
4656
+ "src": getLocalMediaUrl(this, icon),
4657
+ "width": getLocalMediaSize(icon),
4658
+ "height": getLocalMediaSize(icon)
4659
+ },
4621
4660
  {
4622
4661
  type: 'input_value',
4623
4662
  name: 'DIRECCION'
@@ -4632,11 +4671,21 @@ Blockly.Blocks.IrAlBorde = {
4632
4671
 
4633
4672
  Blockly.Blocks.VaciarTablero = {
4634
4673
  init: function () {
4674
+ const icon = "emptyBoard.png";
4675
+
4635
4676
  this.jsonInit({
4636
4677
  type: "Statement",
4637
4678
  previousStatement: "Statement",
4638
4679
  nextStatement: "Statement",
4639
- message0: 'Vaciar tablero',
4680
+ message0: '%1 Vaciar tablero',
4681
+ args0: [
4682
+ {
4683
+ "type": "field_image",
4684
+ "src": getLocalMediaUrl(this, icon),
4685
+ "width": getLocalMediaSize(icon),
4686
+ "height": getLocalMediaSize(icon)
4687
+ },
4688
+ ],
4640
4689
  colour: Blockly.CUSTOM_COLORS.VaciarTablero || Blockly.CUSTOM_COLORS.primitiveCommand,
4641
4690
  tooltip: 'Vaciar el tablero.',
4642
4691
  inputsInline: true
@@ -4646,13 +4695,21 @@ Blockly.Blocks.VaciarTablero = {
4646
4695
 
4647
4696
  Blockly.Blocks.BOOM = {
4648
4697
  init: function () {
4698
+ const icon = "boom.png";
4699
+
4649
4700
  this.jsonInit({
4650
4701
  "type": "Statement",
4651
4702
  "previousStatement": "Statement",
4652
4703
  "nextStatement": "Statement",
4653
4704
  "lastDummyAlign0": "RIGHT",
4654
- "message0": "Hacer ¡BOOM! porque: %1 %2",
4705
+ "message0": "%1 Hacer ¡BOOM! porque: %2 %3",
4655
4706
  "args0": [
4707
+ {
4708
+ "type": "field_image",
4709
+ "src": getLocalMediaUrl(this, icon),
4710
+ "width": getLocalMediaSize(icon),
4711
+ "height": getLocalMediaSize(icon)
4712
+ },
4656
4713
  {
4657
4714
  "type": "input_dummy"
4658
4715
  },
@@ -4725,6 +4782,14 @@ const oldMathNumber = Blockly.Blocks.math_number;
4725
4782
  Blockly.Blocks.math_number = deepCopyObj(Blockly.Blocks.math_number);
4726
4783
  Blockly.Blocks.math_number.init = function() {
4727
4784
  oldMathNumber.init.call(this);
4785
+
4786
+ const icon = "number.png";
4787
+ var iconField = new Blockly.FieldImage(
4788
+ getLocalMediaUrl(this, icon),
4789
+ getLocalMediaSize(icon),
4790
+ getLocalMediaSize(icon)
4791
+ );
4792
+ this.inputList[0].insertFieldAt(0, iconField);
4728
4793
  this.setColour(Blockly.CUSTOM_COLORS.math_number || Blockly.CUSTOM_COLORS.literalExpression);
4729
4794
  }
4730
4795
 
@@ -4747,17 +4812,32 @@ function createLiteralSelectorBlock(type,values){
4747
4812
  init: function () {
4748
4813
  this.jsonInit({
4749
4814
  type: type,
4750
- message0: "%1",
4751
- args0: [{
4752
- type: "field_dropdown",
4753
- name: type + "Dropdown",
4754
- options: values.map(value => [value,value]),
4755
- }],
4815
+ message0: "%1 %2",
4816
+ args0: [
4817
+ {
4818
+ "type": "field_image",
4819
+ "src": "",
4820
+ "width": 16,
4821
+ "height": 16
4822
+ },
4823
+ {
4824
+ type: "field_dropdown",
4825
+ name: type + "Dropdown",
4826
+ options: values.map(value => [value,value])
4827
+ }
4828
+ ],
4756
4829
  output: type,
4757
4830
  colour: Blockly.CUSTOM_COLORS[`${type}Selector`] || Blockly.CUSTOM_COLORS.literalExpression,
4758
4831
  tooltip: "Escoger " + type,
4759
4832
  });
4760
- }
4833
+ },
4834
+
4835
+ onchange: function(event) {
4836
+ const [image, dropdown] = this.inputList[0].fieldRow;
4837
+ const value = dropdown.getValue();
4838
+
4839
+ image.setValue(getLocalMediaUrl(this, `${type.toLowerCase()}-${value.toLowerCase()}.svg`));
4840
+ }
4761
4841
  };
4762
4842
  }
4763
4843
 
@@ -4881,10 +4961,18 @@ Blockly.Blocks.OperadorLogico = {
4881
4961
 
4882
4962
  Blockly.Blocks.Asignacion = {
4883
4963
  init: function () {
4964
+ const icon = "assignation.png";
4965
+
4884
4966
  this.jsonInit({
4885
4967
  "type": "asignacion",
4886
- "message0": "Recordar que %1 %2 vale %3 %4",
4968
+ "message0": "%1 Recordar que %2 %3 vale %4 %5",
4887
4969
  "args0": [
4970
+ {
4971
+ "type": "field_image",
4972
+ "src": getLocalMediaUrl(this, icon),
4973
+ "width": getLocalMediaSize(icon),
4974
+ "height": getLocalMediaSize(icon)
4975
+ },
4888
4976
  {
4889
4977
  "type": "field_input",
4890
4978
  "name": "varName",
@@ -4911,10 +4999,12 @@ Blockly.Blocks.Asignacion = {
4911
4999
  });
4912
5000
 
4913
5001
  var self = this;
5002
+
5003
+ const handIcon = "hand.png";
4914
5004
  var createGetterButton = new Blockly.FieldImage(
4915
- HAND,
4916
- 16,
4917
- 16,
5005
+ getLocalMediaUrl(this, handIcon),
5006
+ getLocalMediaSize(handIcon),
5007
+ getLocalMediaSize(handIcon),
4918
5008
  "Obtener variable",
4919
5009
  function() {
4920
5010
  var name = self.getFieldValue('varName');
@@ -5866,6 +5956,14 @@ Blockly.ErrorInforming.CssContent = [
5866
5956
  value: "../bower_components/blockly-package/media/"
5867
5957
  },
5868
5958
 
5959
+ /*
5960
+ * `media` path a media de gs-element-blockly.
5961
+ */
5962
+ localMedia: {
5963
+ type: String,
5964
+ value: "../media/"
5965
+ },
5966
+
5869
5967
  /*
5870
5968
  * `readOnly` Use blockly in readOnly mode.
5871
5969
  */
@@ -6523,14 +6621,15 @@ Blockly.ErrorInforming.CssContent = [
6523
6621
  attached: function() {
6524
6622
  this._definePrimitiveProcedures();
6525
6623
  this._definePrimitiveFunctions();
6526
- // create workspace
6624
+
6625
+ // create workspace
6527
6626
  var blocklyDiv = this.$$('#blocklyDiv');
6528
6627
  this.blocklyDiv = blocklyDiv;
6529
6628
  this._fixSize();
6530
6629
  this._fixScroll();
6531
6630
  this.workspace = Blockly.inject(blocklyDiv, {
6532
6631
  toolbox: this._createToolbox(),
6533
- media: this.get("media"),
6632
+ media: this.media,
6534
6633
  toolboxPosition: "start",
6535
6634
  scrollbars: true,
6536
6635
  horizontalLayout: false,
@@ -6542,6 +6641,8 @@ Blockly.ErrorInforming.CssContent = [
6542
6641
  wheel: true
6543
6642
  }
6544
6643
  });
6644
+ this.workspace.options.localMedia = this.localMedia;
6645
+
6545
6646
  var _this = this;
6546
6647
  this.workspace.addChangeListener(function (a, b, c) {
6547
6648
  Blockly.Events.disableOrphans(a, b, c);
@@ -1,5 +1,5 @@
1
1
  module Gobstones
2
2
  module Blockly
3
- VERSION = "0.18.1"
3
+ VERSION = "0.19.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.18.1
4
+ version: 0.19.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-08-03 00:00:00.000000000 Z
11
+ date: 2018-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler