gobstones-blockly 0.28.1 → 0.29.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 +144 -5
- 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: e5463872ab87a752ec1f0061775e4e9dddb1943a1497ca1696ec82338e9eb3b7
|
4
|
+
data.tar.gz: ef29461291eff352fcfc20632d047c8d894c9478fab08e90e1587d8c40474f48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 901c46fb4bf1d2011b99646d7c11498edc7012a3f55675cac812a74a413c9aeddd06be90f7f31980c67c75ce444c58b0a501eb7fa5fac943c1bc9d5e730f44ce
|
7
|
+
data.tar.gz: c56fc598356c69a59b9474b87156969fa4dae66c873221e7a038dc2d632c941562272726a1543ab7f616e639ad839412d9f0b8160a8eed6e4f59ba0f4c962aa0
|
@@ -3314,7 +3314,7 @@ Blockly.Blocks['procedures_ifreturn'] = {
|
|
3314
3314
|
var MINUS = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAQAAAD2e2DtAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQfhDAUCCi+xWH4JAAABcUlEQVR42u3c7ZGCMBSG0etuYcTKls7AyrSEVWd4+bjnUECMeSbhD6kCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIBzu4XHm2rUvPekD2yutR57/4itTLXU0/Pvs9SUW5TcDrDUyE3r9Na6ZwZKBWD5PxVKIBPAV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mO95OqiacS+QBH9gAFDlOZnYbrimWOixSZCwUlK+vZd7bXiPldyi0yqX1OtkfCBS/9XAtDKAAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMDQtMDVUMDQ6NDQ6NDItMDM6MDD+uUN1AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTA0LTA1VDA0OjQwOjIzLTAzOjAw5hdZgAAAAABJRU5ErkJggg==";
|
3316
3316
|
|
3317
|
-
window.initProcedsBlockly = function(customStatementType) {
|
3317
|
+
window.initProcedsBlockly = function(customStatementType, initialize = () => {}) {
|
3318
3318
|
Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT = 'Describe el procedimiento...';
|
3319
3319
|
Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE = "Hacer algo";
|
3320
3320
|
Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE = "Definir";
|
@@ -3536,7 +3536,17 @@ window.initProcedsBlockly = function(customStatementType) {
|
|
3536
3536
|
};
|
3537
3537
|
}
|
3538
3538
|
|
3539
|
-
var makeProcedureInit = function(
|
3539
|
+
var makeProcedureInit = function(
|
3540
|
+
withReturn,
|
3541
|
+
withStatements = true,
|
3542
|
+
withParameters = false,
|
3543
|
+
defaultName,
|
3544
|
+
title,
|
3545
|
+
comment,
|
3546
|
+
tooltip,
|
3547
|
+
helpUrl,
|
3548
|
+
returnMsg = Blockly.Msg.PROCEDURES_DEFRETURN_RETURN
|
3549
|
+
) {
|
3540
3550
|
return function() {
|
3541
3551
|
var defaultLegalName = Blockly.Procedures.findLegalName(defaultName, this);
|
3542
3552
|
var nameField = new Blockly.FieldTextInput(defaultLegalName, Blockly.Procedures.rename);
|
@@ -3564,7 +3574,7 @@ window.initProcedsBlockly = function(customStatementType) {
|
|
3564
3574
|
if (withReturn)
|
3565
3575
|
this.appendValueInput('RETURN')
|
3566
3576
|
.setAlign(Blockly.ALIGN_RIGHT)
|
3567
|
-
.appendField(
|
3577
|
+
.appendField(returnMsg);
|
3568
3578
|
|
3569
3579
|
// if (withParametersMutator)
|
3570
3580
|
// this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
@@ -3866,7 +3876,17 @@ window.initProcedsBlockly = function(customStatementType) {
|
|
3866
3876
|
defType_: 'procedures_defreturnsimple'
|
3867
3877
|
};
|
3868
3878
|
|
3869
|
-
//
|
3879
|
+
// ---------------------------------------------------------------
|
3880
|
+
// [!] Calling `initialize` to support another types of procedures
|
3881
|
+
// ---------------------------------------------------------------
|
3882
|
+
initialize(
|
3883
|
+
makeProcedureInit,
|
3884
|
+
makeUpdateParams,
|
3885
|
+
makeProcedureDomToMutation,
|
3886
|
+
makeProcedureCustomMenu
|
3887
|
+
);
|
3888
|
+
|
3889
|
+
// -------------------------------------------------------------------
|
3870
3890
|
// [!] Adding two flyoutCategories: PROCEDURE_CALLS and FUNCTION_CALLS
|
3871
3891
|
// -------------------------------------------------------------------
|
3872
3892
|
|
@@ -4035,9 +4055,122 @@ window.initProcedsBlockly = function(customStatementType) {
|
|
4035
4055
|
|
4036
4056
|
}
|
4037
4057
|
</script>
|
4038
|
-
<script>initProcedsBlockly("Statement");</script>
|
4039
4058
|
<script>/* global Blockly */
|
4040
4059
|
|
4060
|
+
// Initialize proceds-blockly creating new custom functions
|
4061
|
+
initProcedsBlockly("Statement", (makeProcedureInit, makeUpdateParams, makeProcedureDomToMutation, makeProcedureCustomMenu) => {
|
4062
|
+
Blockly.Blocks['DefinicionDeFuncionDeclarativa'] = {
|
4063
|
+
init: makeProcedureInit(
|
4064
|
+
true, true, true,
|
4065
|
+
"algo",
|
4066
|
+
"Definir que",
|
4067
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT,
|
4068
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP,
|
4069
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL,
|
4070
|
+
"es igual a"
|
4071
|
+
),
|
4072
|
+
setStatements_: Blockly.Blocks['procedures_defreturn'].setStatements_,
|
4073
|
+
updateParams_: makeUpdateParams(),
|
4074
|
+
mutationToDom: Blockly.Blocks['procedures_defreturn'].mutationToDom,
|
4075
|
+
domToMutation: makeProcedureDomToMutation(),
|
4076
|
+
decompose: Blockly.Blocks['procedures_defreturn'].decompose,
|
4077
|
+
compose: Blockly.Blocks['procedures_defreturn'].compose,
|
4078
|
+
getProcedureDef: Blockly.Blocks['procedures_defreturn'].getProcedureDef,
|
4079
|
+
getVars: Blockly.Blocks['procedures_defreturn'].getVars,
|
4080
|
+
renameVar: Blockly.Blocks['procedures_defreturn'].renameVar,
|
4081
|
+
customContextMenu: makeProcedureCustomMenu(true),
|
4082
|
+
callType_: 'procedures_callreturndeclarative'
|
4083
|
+
};
|
4084
|
+
|
4085
|
+
Blockly.Blocks['procedures_callreturndeclarative'] = {
|
4086
|
+
init: Blockly.Blocks['procedures_callreturn'].init,
|
4087
|
+
getProcedureCall: Blockly.Blocks['procedures_callreturn'].getProcedureCall,
|
4088
|
+
renameProcedure: Blockly.Blocks['procedures_callreturn'].renameProcedure,
|
4089
|
+
setProcedureParameters_: Blockly.Blocks['procedures_callreturn'].setProcedureParameters_,
|
4090
|
+
updateShape_: Blockly.Blocks['procedures_callreturn'].updateShape_,
|
4091
|
+
mutationToDom: Blockly.Blocks['procedures_callreturn'].mutationToDom,
|
4092
|
+
domToMutation: Blockly.Blocks['procedures_callreturn'].domToMutation,
|
4093
|
+
renameVar: Blockly.Blocks['procedures_callreturn'].renameVar,
|
4094
|
+
onchange: Blockly.Blocks['procedures_callreturn'].onchange,
|
4095
|
+
customContextMenu: Blockly.Blocks['procedures_callreturn'].customContextMenu,
|
4096
|
+
defType_: 'DefinicionDeFuncionDeclarativa'
|
4097
|
+
};
|
4098
|
+
|
4099
|
+
Blockly.Blocks['DefinicionDeFuncionSimpleConParametrosDeclarativa'] = {
|
4100
|
+
init: makeProcedureInit(
|
4101
|
+
true, false, true,
|
4102
|
+
"algo",
|
4103
|
+
"Definir que",
|
4104
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT,
|
4105
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP,
|
4106
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL,
|
4107
|
+
"es igual a"
|
4108
|
+
),
|
4109
|
+
setStatements_: Blockly.Blocks['procedures_defreturn'].setStatements_,
|
4110
|
+
updateParams_: makeUpdateParams(),
|
4111
|
+
mutationToDom: Blockly.Blocks['procedures_defreturn'].mutationToDom,
|
4112
|
+
domToMutation: makeProcedureDomToMutation(),
|
4113
|
+
decompose: Blockly.Blocks['procedures_defreturn'].decompose,
|
4114
|
+
compose: Blockly.Blocks['procedures_defreturn'].compose,
|
4115
|
+
getProcedureDef: Blockly.Blocks['procedures_defreturn'].getProcedureDef,
|
4116
|
+
getVars: Blockly.Blocks['procedures_defreturn'].getVars,
|
4117
|
+
renameVar: Blockly.Blocks['procedures_defreturn'].renameVar,
|
4118
|
+
customContextMenu: makeProcedureCustomMenu(true),
|
4119
|
+
callType_: 'procedures_callreturndeclarativesimplewithparams'
|
4120
|
+
};
|
4121
|
+
|
4122
|
+
Blockly.Blocks['procedures_callreturndeclarativesimplewithparams'] = {
|
4123
|
+
init: Blockly.Blocks['procedures_callreturn'].init,
|
4124
|
+
getProcedureCall: Blockly.Blocks['procedures_callreturn'].getProcedureCall,
|
4125
|
+
renameProcedure: Blockly.Blocks['procedures_callreturn'].renameProcedure,
|
4126
|
+
setProcedureParameters_: Blockly.Blocks['procedures_callreturn'].setProcedureParameters_,
|
4127
|
+
updateShape_: Blockly.Blocks['procedures_callreturn'].updateShape_,
|
4128
|
+
mutationToDom: Blockly.Blocks['procedures_callreturn'].mutationToDom,
|
4129
|
+
domToMutation: Blockly.Blocks['procedures_callreturn'].domToMutation,
|
4130
|
+
renameVar: Blockly.Blocks['procedures_callreturn'].renameVar,
|
4131
|
+
onchange: Blockly.Blocks['procedures_callreturn'].onchange,
|
4132
|
+
customContextMenu: Blockly.Blocks['procedures_callreturn'].customContextMenu,
|
4133
|
+
defType_: 'DefinicionDeFuncionSimpleConParametrosDeclarativa'
|
4134
|
+
};
|
4135
|
+
|
4136
|
+
Blockly.Blocks['DefinicionDeFuncionSimpleDeclarativa'] = {
|
4137
|
+
init: makeProcedureInit(
|
4138
|
+
true, false, false,
|
4139
|
+
"algo",
|
4140
|
+
"Definir que",
|
4141
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT,
|
4142
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP,
|
4143
|
+
Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL,
|
4144
|
+
"es igual a"
|
4145
|
+
),
|
4146
|
+
setStatements_: Blockly.Blocks['procedures_defreturn'].setStatements_,
|
4147
|
+
updateParams_: makeUpdateParams(),
|
4148
|
+
mutationToDom: Blockly.Blocks['procedures_defreturn'].mutationToDom,
|
4149
|
+
domToMutation: makeProcedureDomToMutation(),
|
4150
|
+
decompose: Blockly.Blocks['procedures_defreturn'].decompose,
|
4151
|
+
compose: Blockly.Blocks['procedures_defreturn'].compose,
|
4152
|
+
getProcedureDef: Blockly.Blocks['procedures_defreturn'].getProcedureDef,
|
4153
|
+
getVars: Blockly.Blocks['procedures_defreturn'].getVars,
|
4154
|
+
renameVar: Blockly.Blocks['procedures_defreturn'].renameVar,
|
4155
|
+
customContextMenu: makeProcedureCustomMenu(false),
|
4156
|
+
callType_: 'procedures_callreturndeclarativesimple'
|
4157
|
+
};
|
4158
|
+
|
4159
|
+
Blockly.Blocks['procedures_callreturndeclarativesimple'] = {
|
4160
|
+
init: Blockly.Blocks['procedures_callreturn'].init,
|
4161
|
+
getProcedureCall: Blockly.Blocks['procedures_callreturn'].getProcedureCall,
|
4162
|
+
renameProcedure: Blockly.Blocks['procedures_callreturn'].renameProcedure,
|
4163
|
+
setProcedureParameters_: Blockly.Blocks['procedures_callreturn'].setProcedureParameters_,
|
4164
|
+
updateShape_: Blockly.Blocks['procedures_callreturn'].updateShape_,
|
4165
|
+
mutationToDom: Blockly.Blocks['procedures_callreturn'].mutationToDom,
|
4166
|
+
domToMutation: Blockly.Blocks['procedures_callreturn'].domToMutation,
|
4167
|
+
renameVar: Blockly.Blocks['procedures_callreturn'].renameVar,
|
4168
|
+
onchange: Blockly.Blocks['procedures_callreturn'].onchange,
|
4169
|
+
customContextMenu: Blockly.Blocks['procedures_callreturn'].customContextMenu,
|
4170
|
+
defType_: 'DefinicionDeFuncionSimpleDeclarativa'
|
4171
|
+
};
|
4172
|
+
});
|
4173
|
+
|
4041
4174
|
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}};
|
4042
4175
|
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"];
|
4043
4176
|
const EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
@@ -5898,6 +6031,9 @@ Blockly.GobstonesLanguage.procedures_defreturn = function (block) {
|
|
5898
6031
|
Blockly.GobstonesLanguage.procedures_defnoreturnnoparams = Blockly.GobstonesLanguage.procedures_defnoreturn;
|
5899
6032
|
Blockly.GobstonesLanguage.procedures_defreturnsimplewithparams = Blockly.GobstonesLanguage.procedures_defreturn;
|
5900
6033
|
Blockly.GobstonesLanguage.procedures_defreturnsimple = Blockly.GobstonesLanguage.procedures_defreturn;
|
6034
|
+
Blockly.GobstonesLanguage.DefinicionDeFuncionDeclarativa = Blockly.GobstonesLanguage.procedures_defreturn;
|
6035
|
+
Blockly.GobstonesLanguage.DefinicionDeFuncionSimpleConParametrosDeclarativa = Blockly.GobstonesLanguage.procedures_defreturn;
|
6036
|
+
Blockly.GobstonesLanguage.DefinicionDeFuncionSimpleDeclarativa = Blockly.GobstonesLanguage.procedures_defreturn;
|
5901
6037
|
|
5902
6038
|
var procedureCall = function(block, capitalizeFirst, newLine) {
|
5903
6039
|
var procName = formatCallName(block.getFieldValue('NAME'),capitalizeFirst);
|
@@ -5920,6 +6056,9 @@ Blockly.GobstonesLanguage.procedures_callreturn = function (block) {
|
|
5920
6056
|
Blockly.GobstonesLanguage.procedures_callnoreturnnoparams = Blockly.GobstonesLanguage.procedures_callnoreturn;
|
5921
6057
|
Blockly.GobstonesLanguage.procedures_callreturnsimplewithparams = Blockly.GobstonesLanguage.procedures_callreturn;
|
5922
6058
|
Blockly.GobstonesLanguage.procedures_callreturnsimple = Blockly.GobstonesLanguage.procedures_callreturn;
|
6059
|
+
Blockly.GobstonesLanguage.procedures_callreturndeclarative = Blockly.GobstonesLanguage.procedures_callreturn;
|
6060
|
+
Blockly.GobstonesLanguage.procedures_callreturndeclarativesimplewithparams = Blockly.GobstonesLanguage.procedures_callreturn;
|
6061
|
+
Blockly.GobstonesLanguage.procedures_callreturndeclarativesimple = Blockly.GobstonesLanguage.procedures_callreturn;
|
5923
6062
|
|
5924
6063
|
Blockly.GobstonesLanguage.variables_get = function (block) {
|
5925
6064
|
var code = formatCallName(block.getFieldValue('VAR'),false,Blockly.VARIABLE_CATEGORY_NAME);
|
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.
|
4
|
+
version: 0.29.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: 2019-
|
11
|
+
date: 2019-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|