/**
* @license
* Blockly Demos: Block Factory
*
* Copyright 2016 Google Inc.
* https://developers.google.com/blockly/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Contains a map of standard Blockly categories used to load
* standard Blockly categories into the user's toolbox. The map is keyed by
* the lower case name of the category, and contains the Category object for
* that particular category. Also has a list of core block types provided
* by Blockly.
*
* @author Emma Dauterman (evd2014)
*/
'use strict';
/**
* Namespace for StandardCategories
*/
goog.provide('StandardCategories');
// Map of standard category information necessary to add a standard category
// to the toolbox.
StandardCategories.categoryMap = Object.create(null);
StandardCategories.categoryMap['logic'] =
new ListElement(ListElement.TYPE_CATEGORY, 'Logic');
StandardCategories.categoryMap['logic'].xml =
Blockly.Xml.textToDom(
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'');
StandardCategories.categoryMap['logic'].color ='#5C81A6';
StandardCategories.categoryMap['loops'] =
new ListElement(ListElement.TYPE_CATEGORY, 'Loops');
StandardCategories.categoryMap['loops'].xml =
Blockly.Xml.textToDom(
'' +
'' +
'' +
'' +
'10' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'1' +
'' +
'' +
'' +
'' +
'10' +
'' +
'' +
'' +
'' +
'1' +
'' +
'' +
'' +
'' +
'' +
'');
StandardCategories.categoryMap['loops'].color = '#5CA65C';
StandardCategories.categoryMap['math'] =
new ListElement(ListElement.TYPE_CATEGORY, 'Math');
StandardCategories.categoryMap['math'].xml =
Blockly.Xml.textToDom(
'' +
'' +
'' +
'' +
'' +
'1' +
'' +
'' +
'' +
'' +
'1' +
'' +
'' +
'' +
'' +
'' +
'' +
'9' +
'' +
'' +
'' +
'' +
'' +
'' +
'45' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'0' +
'' +
'' +
'' +
'' +
'' +
'' +
'3.1' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'64' +
'' +
'' +
'' +
'' +
'10'+
'' +
'' +
'' +
'' +
'' +
'' +
'50' +
'' +
'' +
'' +
'' +
'1' +
'' +
'' +
'' +
'' +
'100' +
'' +
'' +
'' +
'' +
'' +
'' +
'1' +
'' +
'' +
'' +
'' +
'100' +
'' +
'' +
'' +
'' +
'');
StandardCategories.categoryMap['math'].color = '#5C68A6';
StandardCategories.categoryMap['text'] =
new ListElement(ListElement.TYPE_CATEGORY, 'Text');
StandardCategories.categoryMap['text'].xml =
Blockly.Xml.textToDom(
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'abc' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'text' +
'' +
'' +
'' +
'' +
'abc' +
'' +
'' +
'' +
'' +
'' +
'' +
'text' +
'' +
'' +
'' +
'' +
'' +
'' +
'text' +
'' +
'' +
'' +
'' +
'' +
'' +
'abc' +
'' +
'' +
'' +
'' +
'' +
'' +
'abc' +
'' +
'' +
'' +
'' +
'' +
'' +
'abc' +
'' +
'' +
'' +
'' +
'' +
'' +
'abc' +
'' +
'' +
'' +
'');
StandardCategories.categoryMap['text'].color = '#5CA68D';
StandardCategories.categoryMap['lists'] =
new ListElement(ListElement.TYPE_CATEGORY, 'Lists');
StandardCategories.categoryMap['lists'].xml =
Blockly.Xml.textToDom(
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'5' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'list' +
'' +
'' +
'' +
'' +
'' +
'' +
'list' +
'' +
'' +
'' +
'' +
'' +
'' +
'list' +
'' +
'' +
'' +
'' +
'' +
'' +
'list' +
'' +
'' +
'' +
'' +
'' +
'' +
',' +
'' +
'' +
'' +
'' +
'');
StandardCategories.categoryMap['lists'].color = '#745CA6';
StandardCategories.categoryMap['colour'] =
new ListElement(ListElement.TYPE_CATEGORY, 'Colour');
StandardCategories.categoryMap['colour'].xml =
Blockly.Xml.textToDom(
'' +
'' +
'' +
'' +
'' +
'' +
'100' +
'' +
'' +
'' +
'' +
'50' +
'' +
'' +
'' +
'' +
'0' +
'' +
'' +
'' +
'' +
'' +
'' +
'#ff0000' +
'' +
'' +
'' +
'' +
'#3333ff' +
'' +
'' +
'' +
'' +
'0.5' +
'' +
'' +
'' +
'');
StandardCategories.categoryMap['colour'].color = '#A6745C';
StandardCategories.categoryMap['functions'] =
new ListElement(ListElement.TYPE_CATEGORY, 'Functions');
StandardCategories.categoryMap['functions'].color = '#9A5CA6'
StandardCategories.categoryMap['functions'].custom = 'PROCEDURE';
StandardCategories.categoryMap['variables'] =
new ListElement(ListElement.TYPE_CATEGORY, 'Variables');
StandardCategories.categoryMap['variables'].color = '#A65C81';
StandardCategories.categoryMap['variables'].custom = 'VARIABLE';
// All standard block types in provided in Blockly core.
StandardCategories.coreBlockTypes = ["controls_if", "logic_compare",
"logic_operation", "logic_negate", "logic_boolean", "logic_null",
"logic_ternary", "controls_repeat_ext", "controls_whileUntil",
"controls_for", "controls_forEach", "controls_flow_statements",
"math_number", "math_arithmetic", "math_single", "math_trig",
"math_constant", "math_number_property", "math_change", "math_round",
"math_on_list", "math_modulo", "math_constrain", "math_random_int",
"math_random_float", "text", "text_join", "text_append", "text_length",
"text_isEmpty", "text_indexOf", "variables_get", "text_charAt",
"text_getSubstring", "text_changeCase", "text_trim", "text_print",
"text_prompt_ext", "colour_picker", "colour_random", "colour_rgb",
"colour_blend", "lists_create_with", "lists_repeat", "lists_length",
"lists_isEmpty", "lists_indexOf", "lists_getIndex", "lists_setIndex",
"lists_getSublist", "lists_split", "lists_sort", "variables_set",
"procedures_defreturn", "procedures_ifreturn", "procedures_defnoreturn",
"procedures_callreturn"];