Skip to content

Commit

Permalink
fix: readd the operator blocks and dependencies (#19)
Browse files Browse the repository at this point in the history
* fix: readd the operator blocks and dependencies

* fix: only import core Blockly blocks_common/math.js

Co-authored-by: Beka Westberg <bwestberg@google.com>

* fix: only import core Blockly in vertical_extensions.js

---------

Co-authored-by: Beka Westberg <bwestberg@google.com>
  • Loading branch information
gonfunko and BeksOmega authored Apr 17, 2024
1 parent 3125c37 commit 8024e9f
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 98 deletions.
61 changes: 27 additions & 34 deletions blocks_common/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,8 @@
* @fileoverview Math blocks for Blockly.
* @author q.neutron@gmail.com (Quynh Neutron)
*/
'use strict';

goog.provide('Blockly.Blocks.math');

goog.require('Blockly.Blocks');

goog.require('Blockly.Colours');

goog.require('Blockly.constants');
import * as Blockly from 'blockly/core';
import {Colours} from '../core/colours.js';

Blockly.Blocks['math_number'] = {
/**
Expand All @@ -48,11 +41,11 @@ Blockly.Blocks['math_number'] = {
}
],
"output": "Number",
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Blockly.Colours.textField,
"colourSecondary": Blockly.Colours.textField,
"colourTertiary": Blockly.Colours.textField,
"colourQuaternary": Blockly.Colours.textField
// "outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Colours.textField,
"colourSecondary": Colours.textField,
"colourTertiary": Colours.textField,
"colourQuaternary": Colours.textField
});
}
};
Expand All @@ -73,11 +66,11 @@ Blockly.Blocks['math_integer'] = {
}
],
"output": "Number",
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Blockly.Colours.textField,
"colourSecondary": Blockly.Colours.textField,
"colourTertiary": Blockly.Colours.textField,
"colourQuaternary": Blockly.Colours.textField
// "outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Colours.textField,
"colourSecondary": Colours.textField,
"colourTertiary": Colours.textField,
"colourQuaternary": Colours.textField
});
}
};
Expand All @@ -99,11 +92,11 @@ Blockly.Blocks['math_whole_number'] = {
}
],
"output": "Number",
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Blockly.Colours.textField,
"colourSecondary": Blockly.Colours.textField,
"colourTertiary": Blockly.Colours.textField,
"colourQuaternary": Blockly.Colours.textField
// "outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Colours.textField,
"colourSecondary": Colours.textField,
"colourTertiary": Colours.textField,
"colourQuaternary": Colours.textField
});
}
};
Expand All @@ -124,11 +117,11 @@ Blockly.Blocks['math_positive_number'] = {
}
],
"output": "Number",
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Blockly.Colours.textField,
"colourSecondary": Blockly.Colours.textField,
"colourTertiary": Blockly.Colours.textField,
"colourQuaternary": Blockly.Colours.textField
// "outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Colours.textField,
"colourSecondary": Colours.textField,
"colourTertiary": Colours.textField,
"colourQuaternary": Colours.textField
});
}
};
Expand All @@ -149,11 +142,11 @@ Blockly.Blocks['math_angle'] = {
}
],
"output": "Number",
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Blockly.Colours.textField,
"colourSecondary": Blockly.Colours.textField,
"colourTertiary": Blockly.Colours.textField,
"colourQuaternary": Blockly.Colours.textField
// "outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"colour": Colours.textField,
"colourSecondary": Colours.textField,
"colourTertiary": Colours.textField,
"colourQuaternary": Colours.textField
});
}
};
47 changes: 20 additions & 27 deletions blocks_vertical/operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@
* limitations under the License.
*/

'use strict';

goog.provide('Blockly.Blocks.operators');

goog.require('Blockly.Blocks');
goog.require('Blockly.Colours');
goog.require('Blockly.constants');
goog.require('Blockly.ScratchBlocks.VerticalExtensions');

import * as Blockly from 'blockly';
import {Categories} from '../src/categories.js';

Blockly.Blocks['operator_add'] = {
/**
Expand All @@ -46,7 +39,7 @@ Blockly.Blocks['operator_add'] = {
"name": "NUM2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
Expand All @@ -70,7 +63,7 @@ Blockly.Blocks['operator_subtract'] = {
"name": "NUM2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
Expand All @@ -94,7 +87,7 @@ Blockly.Blocks['operator_multiply'] = {
"name": "NUM2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
Expand All @@ -118,7 +111,7 @@ Blockly.Blocks['operator_divide'] = {
"name": "NUM2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
Expand All @@ -142,7 +135,7 @@ Blockly.Blocks['operator_random'] = {
"name": "TO"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
Expand All @@ -166,7 +159,7 @@ Blockly.Blocks['operator_lt'] = {
"name": "OPERAND2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_boolean"]
});
}
Expand All @@ -190,7 +183,7 @@ Blockly.Blocks['operator_equals'] = {
"name": "OPERAND2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_boolean"]
});
}
Expand All @@ -214,7 +207,7 @@ Blockly.Blocks['operator_gt'] = {
"name": "OPERAND2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_boolean"]
});
}
Expand All @@ -240,7 +233,7 @@ Blockly.Blocks['operator_and'] = {
"check": "Boolean"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_boolean"]
});
}
Expand All @@ -266,7 +259,7 @@ Blockly.Blocks['operator_or'] = {
"check": "Boolean"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_boolean"]
});
}
Expand All @@ -287,7 +280,7 @@ Blockly.Blocks['operator_not'] = {
"check": "Boolean"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_boolean"]
});
}
Expand All @@ -311,7 +304,7 @@ Blockly.Blocks['operator_join'] = {
"name": "STRING2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_string"]
});
}
Expand All @@ -335,7 +328,7 @@ Blockly.Blocks['operator_letter_of'] = {
"name": "STRING"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_string"]
});
}
Expand All @@ -355,7 +348,7 @@ Blockly.Blocks['operator_length'] = {
"name": "STRING"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_string"]
});
}
Expand All @@ -379,7 +372,7 @@ Blockly.Blocks['operator_contains'] = {
"name": "STRING2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_boolean"]
});
}
Expand All @@ -403,7 +396,7 @@ Blockly.Blocks['operator_mod'] = {
"name": "NUM2"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
Expand All @@ -423,7 +416,7 @@ Blockly.Blocks['operator_round'] = {
"name": "NUM"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
Expand Down Expand Up @@ -463,7 +456,7 @@ Blockly.Blocks['operator_mathop'] = {
"name": "NUM"
}
],
"category": Blockly.Categories.operators,
"category": Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
Expand Down
Loading

0 comments on commit 8024e9f

Please sign in to comment.