mumuki-gobstones-blockly 0.37.1 → 0.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/htmls/gs-element-blockly.html +152 -38
- data/lib/gobstones/blockly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb09d894eb7af40df20691a51e1fa10ffebce851b12f0cf9eafe23a31c64afee
|
4
|
+
data.tar.gz: 6340da945036f240c1ee72755c5e8e985e99610ea8d727f1f6f4e7c8a4a0754c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e088dd6494bbe4f717bfad1db51e56b48a1212aa29f6fe313d4ef4bff1281e80e3e07f405dc09eb6934dc0a89d7c69003f2b0d14fba9e3a6f29ae18cf7b584e
|
7
|
+
data.tar.gz: 50e07a3cf78731c4aa1e5c155b79b23d4c2e6d1f17bc672479b18af9971a329935c1ec0933ebb1711de48cd4913e21ac99fbb64ea3b8e23f86afb9c2d31fd7b8
|
@@ -3561,11 +3561,41 @@ window.initProcedsBlockly = function(customStatementType, initialize = () => {})
|
|
3561
3561
|
returnMsg = Blockly.Msg.PROCEDURES_DEFRETURN_RETURN
|
3562
3562
|
) {
|
3563
3563
|
return function() {
|
3564
|
+
var self = this;
|
3565
|
+
|
3566
|
+
if ((this.workspace.options.comments ||
|
3567
|
+
(this.workspace.options.parentWorkspace &&
|
3568
|
+
this.workspace.options.parentWorkspace.options.comments)) &&
|
3569
|
+
comment) {
|
3570
|
+
this.setCommentText(comment);
|
3571
|
+
}
|
3572
|
+
this.setCommentText(null);
|
3573
|
+
this.setColour((
|
3574
|
+
Blockly.CUSTOM_COLORS && (
|
3575
|
+
Blockly.CUSTOM_COLORS[this.type] ||
|
3576
|
+
Blockly.CUSTOM_COLORS[withReturn ? "function" : "procedure"]
|
3577
|
+
)) || Blockly.Blocks.procedures.HUE);
|
3578
|
+
this.setTooltip(tooltip);
|
3579
|
+
this.setHelpUrl(helpUrl);
|
3580
|
+
this.arguments_ = [];
|
3581
|
+
this.statementConnection_ = null;
|
3582
|
+
|
3564
3583
|
var defaultLegalName = Blockly.Procedures.findLegalName(defaultName, this);
|
3565
3584
|
var nameField = new Blockly.FieldTextInput(defaultLegalName, Blockly.Procedures.rename);
|
3566
3585
|
nameField.setSpellcheck(false);
|
3567
3586
|
|
3568
|
-
|
3587
|
+
if (Blockly.currentDisplayMode && !Blockly.currentDisplayMode().showText) {
|
3588
|
+
nameField.setVisible(false);
|
3589
|
+
const imageField = new Blockly.FieldImage(
|
3590
|
+
Blockly.currentDisplayMode().procedureDefIcon,
|
3591
|
+
Blockly.currentDisplayMode().iconSize,
|
3592
|
+
Blockly.currentDisplayMode().iconSize
|
3593
|
+
);
|
3594
|
+
this.appendDummyInput().appendField(nameField, 'NAME').appendField(imageField);
|
3595
|
+
this.setStatements_(withStatements);
|
3596
|
+
|
3597
|
+
return;
|
3598
|
+
}
|
3569
3599
|
|
3570
3600
|
// [!]
|
3571
3601
|
var addParameterButton = new Blockly.FieldImage(
|
@@ -3592,24 +3622,7 @@ window.initProcedsBlockly = function(customStatementType, initialize = () => {})
|
|
3592
3622
|
// if (withParametersMutator)
|
3593
3623
|
// this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
3594
3624
|
|
3595
|
-
if ((this.workspace.options.comments ||
|
3596
|
-
(this.workspace.options.parentWorkspace &&
|
3597
|
-
this.workspace.options.parentWorkspace.options.comments)) &&
|
3598
|
-
comment) {
|
3599
|
-
this.setCommentText(comment);
|
3600
|
-
}
|
3601
|
-
this.setCommentText(null);
|
3602
|
-
this.setColour((
|
3603
|
-
Blockly.CUSTOM_COLORS && (
|
3604
|
-
Blockly.CUSTOM_COLORS[this.type] ||
|
3605
|
-
Blockly.CUSTOM_COLORS[withReturn ? "function" : "procedure"]
|
3606
|
-
)) || Blockly.Blocks.procedures.HUE);
|
3607
|
-
this.setTooltip(tooltip);
|
3608
|
-
this.setHelpUrl(helpUrl);
|
3609
|
-
this.arguments_ = [];
|
3610
3625
|
this.setStatements_(withStatements);
|
3611
|
-
this.statementConnection_ = null;
|
3612
|
-
|
3613
3626
|
// if (!withParametersMutator) this.updateParams_();
|
3614
3627
|
|
3615
3628
|
// [!] adding create call button
|
@@ -4085,6 +4098,8 @@ window.initProcedsBlockly = function(customStatementType, initialize = () => {})
|
|
4085
4098
|
</script>
|
4086
4099
|
<script>/* global initProcedsBlockly */
|
4087
4100
|
|
4101
|
+
const EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
4102
|
+
|
4088
4103
|
Blockly.displayMode = 'text';
|
4089
4104
|
|
4090
4105
|
Blockly.displayModes = {
|
@@ -4094,12 +4109,109 @@ Blockly.displayModes = {
|
|
4094
4109
|
},
|
4095
4110
|
iconic: {
|
4096
4111
|
iconSize: 32,
|
4097
|
-
showText: false
|
4112
|
+
showText: false,
|
4113
|
+
procedureDefIcon: EMPTY_GIF
|
4098
4114
|
},
|
4099
4115
|
};
|
4100
4116
|
|
4101
4117
|
Blockly.currentDisplayMode = () => Blockly.displayModes[Blockly.displayMode];
|
4102
4118
|
|
4119
|
+
Blockly.CUSTOM_COLORS = {
|
4120
|
+
globalHsvSaturation: 0.45,
|
4121
|
+
globalHsvValue: 0.65,
|
4122
|
+
primitiveCommand: "#1d3c99",
|
4123
|
+
assignation: "#051d66",
|
4124
|
+
controlStructure: "#0f2b80",
|
4125
|
+
literalExpression: "#1d992c",
|
4126
|
+
primitiveExpression: "#1d992c",
|
4127
|
+
operator: "#0f801c",
|
4128
|
+
program: "#8d1bb3",
|
4129
|
+
interactiveProgram: "#6e158c",
|
4130
|
+
interactiveBinding: "#a11fcc",
|
4131
|
+
procedure: "#935ba6",
|
4132
|
+
function: "#745380",
|
4133
|
+
primitiveProcedure: "#2e4fb3",
|
4134
|
+
primitiveFunction: "#2eb33e",
|
4135
|
+
procedure_call: "#355bcc",
|
4136
|
+
function_call: "#35cc47",
|
4137
|
+
variable: "#056610",
|
4138
|
+
parameter: "#056610",
|
4139
|
+
complete: "#ff0000",
|
4140
|
+
H: { commands: 225, expressions: 127, definitions: 285 },
|
4141
|
+
S: {
|
4142
|
+
assignation: 95,
|
4143
|
+
variable: 95,
|
4144
|
+
parameter: 95,
|
4145
|
+
primitiveCommand: 81,
|
4146
|
+
literalExpression: 81,
|
4147
|
+
primitiveExpression: 81,
|
4148
|
+
controlStructure: 88,
|
4149
|
+
operator: 88,
|
4150
|
+
procedure_call: 74,
|
4151
|
+
function_call: 74,
|
4152
|
+
primitiveProcedure: 74,
|
4153
|
+
primitiveFunction: 74,
|
4154
|
+
program: 85,
|
4155
|
+
interactiveProgram: 85,
|
4156
|
+
interactiveBinding: 85,
|
4157
|
+
procedure: 45,
|
4158
|
+
function: 35,
|
4159
|
+
complete: 99,
|
4160
|
+
},
|
4161
|
+
V: {
|
4162
|
+
assignation: 40,
|
4163
|
+
variable: 40,
|
4164
|
+
parameter: 40,
|
4165
|
+
primitiveCommand: 60,
|
4166
|
+
literalExpression: 60,
|
4167
|
+
primitiveExpression: 60,
|
4168
|
+
controlStructure: 50,
|
4169
|
+
operator: 50,
|
4170
|
+
procedure_call: 80,
|
4171
|
+
function_call: 80,
|
4172
|
+
primitiveProcedure: 70,
|
4173
|
+
primitiveFunction: 70,
|
4174
|
+
program: 70,
|
4175
|
+
interactiveProgram: 55,
|
4176
|
+
interactiveBinding: 80,
|
4177
|
+
procedure: 65,
|
4178
|
+
function: 50,
|
4179
|
+
complete: 99,
|
4180
|
+
},
|
4181
|
+
};
|
4182
|
+
|
4183
|
+
Blockly.AVAILABLE_ICONS = [
|
4184
|
+
"bool-false.svg",
|
4185
|
+
"bool-true.svg",
|
4186
|
+
"clean.png",
|
4187
|
+
"color-azul.svg",
|
4188
|
+
"color-negro.svg",
|
4189
|
+
"color-rojo.svg",
|
4190
|
+
"color-verde.svg",
|
4191
|
+
"direccion-este.svg",
|
4192
|
+
"direccion-norte.svg",
|
4193
|
+
"direccion-oeste.svg",
|
4194
|
+
"direccion-sur.svg",
|
4195
|
+
"hand.png",
|
4196
|
+
"minus.png",
|
4197
|
+
"plus.png",
|
4198
|
+
"repeticion-simple.png",
|
4199
|
+
"program.png",
|
4200
|
+
"procedure-def.png",
|
4201
|
+
];
|
4202
|
+
|
4203
|
+
const getOptions = (block) => {
|
4204
|
+
const parentWorkspace = block.workspace.options.parentWorkspace;
|
4205
|
+
return parentWorkspace && parentWorkspace.options || block.workspace.options
|
4206
|
+
}
|
4207
|
+
const hasLocalMedia = (name) => Blockly.AVAILABLE_ICONS.includes(name)
|
4208
|
+
const getLocalMediaUrl = (block, name) =>
|
4209
|
+
hasLocalMedia(name)
|
4210
|
+
? getOptions(block).localMedia + name + (getOptions(block).localMediaSuffix || "")
|
4211
|
+
: EMPTY_GIF;
|
4212
|
+
const getLocalMediaSize = (name) =>
|
4213
|
+
hasLocalMedia(name) ? Blockly.currentDisplayMode().iconSize : 0;
|
4214
|
+
|
4103
4215
|
// Initialize proceds-blockly creating new custom functions
|
4104
4216
|
initProcedsBlockly("Statement", (makeProcedureInit, makeUpdateParams, makeProcedureDomToMutation, makeProcedureCustomMenu) => {
|
4105
4217
|
Blockly.Blocks['DefinicionDeFuncionDeclarativa'] = {
|
@@ -4214,10 +4326,6 @@ initProcedsBlockly("Statement", (makeProcedureInit, makeUpdateParams, makeProced
|
|
4214
4326
|
};
|
4215
4327
|
});
|
4216
4328
|
|
4217
|
-
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}};
|
4218
|
-
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", "repeticion-simple.png", "program.png"];
|
4219
|
-
const EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
4220
|
-
|
4221
4329
|
const ATOMICALLY = (action) => {
|
4222
4330
|
try {
|
4223
4331
|
Blockly.Events.disabled_ = 1;
|
@@ -4227,18 +4335,6 @@ const ATOMICALLY = (action) => {
|
|
4227
4335
|
}
|
4228
4336
|
}
|
4229
4337
|
|
4230
|
-
const getOptions = (block) => {
|
4231
|
-
const parentWorkspace = block.workspace.options.parentWorkspace;
|
4232
|
-
return parentWorkspace && parentWorkspace.options || block.workspace.options
|
4233
|
-
}
|
4234
|
-
const hasLocalMedia = (name) => Blockly.AVAILABLE_ICONS.includes(name)
|
4235
|
-
const getLocalMediaUrl = (block, name) =>
|
4236
|
-
hasLocalMedia(name)
|
4237
|
-
? getOptions(block).localMedia + name + (getOptions(block).localMediaSuffix || "")
|
4238
|
-
: EMPTY_GIF;
|
4239
|
-
const getLocalMediaSize = (name) =>
|
4240
|
-
hasLocalMedia(name) ? Blockly.currentDisplayMode().iconSize : 0;
|
4241
|
-
|
4242
4338
|
/**
|
4243
4339
|
* Create the svg representation of a block and render
|
4244
4340
|
* @name {!string} name of the parameter.
|
@@ -4651,14 +4747,14 @@ Blockly.Blocks.RepeticionSimple = {
|
|
4651
4747
|
if (Blockly.currentDisplayMode().showText) {
|
4652
4748
|
this.appendValueInput("count").appendField("repetir");
|
4653
4749
|
this.appendDummyInput().appendField("veces");
|
4750
|
+
this.setInputsInline(true);
|
4654
4751
|
} else {
|
4655
4752
|
const icon = "repeticion-simple.png";
|
4656
|
-
const imageField = this.
|
4753
|
+
const imageField = this.appendValueInput("count").appendField(new Blockly.FieldImage(
|
4657
4754
|
'',
|
4658
4755
|
getLocalMediaSize(icon),
|
4659
4756
|
getLocalMediaSize(icon)
|
4660
4757
|
));
|
4661
|
-
this.appendValueInput("count");
|
4662
4758
|
|
4663
4759
|
// El atributo localMedia recién va a estar disponible cuando termine de cargar el toolbox,
|
4664
4760
|
// por eso la imagen se carga en el evento y no directamente más arriba.
|
@@ -4666,7 +4762,6 @@ Blockly.Blocks.RepeticionSimple = {
|
|
4666
4762
|
}
|
4667
4763
|
|
4668
4764
|
this.appendStatementInput('block').setCheck(["Statement"]);
|
4669
|
-
this.setInputsInline(true);
|
4670
4765
|
}
|
4671
4766
|
};
|
4672
4767
|
|
@@ -6721,6 +6816,14 @@ Blockly.ErrorInforming.CssContent = [
|
|
6721
6816
|
value: false
|
6722
6817
|
},
|
6723
6818
|
|
6819
|
+
/*
|
6820
|
+
* Cantidad máxima de bloques permitidos en el workspace. Si no se le da ningún valor, se admiten infinitos bloques.
|
6821
|
+
*/
|
6822
|
+
maxBlocks: {
|
6823
|
+
type: Number,
|
6824
|
+
value: null
|
6825
|
+
},
|
6826
|
+
|
6724
6827
|
/*
|
6725
6828
|
* Si el valor es `false`, "aplana" las categorías dejando todos los bloques sueltos en el toolbox.
|
6726
6829
|
*/
|
@@ -7316,6 +7419,16 @@ Blockly.ErrorInforming.CssContent = [
|
|
7316
7419
|
}
|
7317
7420
|
},
|
7318
7421
|
|
7422
|
+
/**
|
7423
|
+
* Agrega un listener que se ejecutará cada vez que los bloques del workspace cambien
|
7424
|
+
*/
|
7425
|
+
onBlocksChanged(action) {
|
7426
|
+
this.workspace.addChangeListener(() => action({
|
7427
|
+
remainingCapacity: this.workspace.remainingCapacity(),
|
7428
|
+
workspace: this.workspace
|
7429
|
+
}));
|
7430
|
+
},
|
7431
|
+
|
7319
7432
|
/**
|
7320
7433
|
* Reinicializa el workspace, dejando solo el bloque programa
|
7321
7434
|
*/
|
@@ -7491,6 +7604,7 @@ Blockly.ErrorInforming.CssContent = [
|
|
7491
7604
|
collapse: true,
|
7492
7605
|
css: true,
|
7493
7606
|
readOnly: this.readOnly,
|
7607
|
+
maxBlocks: this.maxBlocks,
|
7494
7608
|
zoom: {
|
7495
7609
|
controls: true,
|
7496
7610
|
wheel: true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-gobstones-blockly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.38.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Alfonso
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|