diff --git a/examples/backpack-demo/index.js b/examples/backpack-demo/index.js index 99a5dd64cf..18183987b7 100644 --- a/examples/backpack-demo/index.js +++ b/examples/backpack-demo/index.js @@ -135,10 +135,6 @@ const toolbox = { kind: 'block', type: 'text', }, - { - kind: 'block', - type: 'text_multiline', - }, { 'kind': 'label', 'text': 'Input/Output:', diff --git a/examples/custom-renderer-codelab/src/toolbox.js b/examples/custom-renderer-codelab/src/toolbox.js index 0da9795cbb..7d88fba326 100644 --- a/examples/custom-renderer-codelab/src/toolbox.js +++ b/examples/custom-renderer-codelab/src/toolbox.js @@ -328,10 +328,6 @@ export const toolbox = { kind: 'block', type: 'text', }, - { - kind: 'block', - type: 'text_multiline', - }, { kind: 'block', type: 'text_join', @@ -495,28 +491,6 @@ export const toolbox = { }, }, }, - { - kind: 'block', - type: 'add_text', - inputs: { - TEXT: { - shadow: { - type: 'text', - fields: { - TEXT: 'abc', - }, - }, - }, - COLOR: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#aa00cc', - }, - }, - }, - }, - }, ], }, { @@ -622,84 +596,6 @@ export const toolbox = { }, ], }, - { - kind: 'category', - name: 'Color', - categorystyle: 'colour_category', - contents: [ - { - kind: 'block', - type: 'colour_picker', - }, - { - kind: 'block', - type: 'colour_random', - }, - { - kind: 'block', - type: 'colour_rgb', - inputs: { - RED: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - GREEN: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - BLUE: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - }, - }, - { - kind: 'block', - type: 'colour_blend', - inputs: { - COLOUR1: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#ff0000', - }, - }, - }, - COLOUR2: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#3333ff', - }, - }, - }, - RATIO: { - shadow: { - type: 'math_number', - fields: { - NUM: 0.5, - }, - }, - }, - }, - }, - ], - }, - { - kind: 'sep', - }, { kind: 'category', name: 'Variables', diff --git a/examples/custom-toolbox-codelab/complete-code/index.html b/examples/custom-toolbox-codelab/complete-code/index.html index 3635b1fb28..ddd57a89a9 100644 --- a/examples/custom-toolbox-codelab/complete-code/index.html +++ b/examples/custom-toolbox-codelab/complete-code/index.html @@ -193,7 +193,6 @@

Toolbox Customization Codelab

- @@ -346,44 +345,6 @@

Toolbox Customization Codelab

- - - - - - - 100 - - - - - 50 - - - - - 0 - - - - - - - #ff0000 - - - - - #3333ff - - - - - 0.5 - - - - Toolbox Customization Codelab - @@ -336,44 +335,6 @@

Toolbox Customization Codelab

- - - - - - - 100 - - - - - 50 - - - - - 0 - - - - - - - #ff0000 - - - - - #3333ff - - - - - 0.5 - - - - null') - .appendField(colourField, 'INPUT'); - this.setColour(230); - this.setCommentText( - 'If the input does not have full red, the input will validate to' + - ' null (invalid). Otherwise it will return the input value', - ); - }, - - validate: function (newValue) { - if (newValue.substr(1, 2) != 'ff') { - return null; - } - return newValue; - }, -}; - Blockly.Blocks['test_validators_dropdown_null'] = { init: function () { this.appendDummyInput() @@ -627,26 +522,6 @@ export const category = { kind: 'SEP', gap: '12', }, - { - kind: 'BLOCK', - type: 'test_validators_colour_null', - }, - { - kind: 'SEP', - gap: '12', - }, - { - kind: 'BLOCK', - type: 'test_validators_colour_force_red', - }, - { - kind: 'SEP', - gap: '12', - }, - { - kind: 'BLOCK', - type: 'test_validators_colour_red_null', - }, { kind: 'LABEL', text: 'Dropdowns', diff --git a/plugins/block-test/src/mutators.js b/plugins/block-test/src/mutators.js index 48e8123e69..76316f9cc6 100644 --- a/plugins/block-test/src/mutators.js +++ b/plugins/block-test/src/mutators.js @@ -14,13 +14,13 @@ import * as Blockly from 'blockly/core'; Blockly.defineBlocksWithJsonArray([ { - type: 'test_mutator_colorChange', - message0: 'colour %1', + type: 'test_mutator_textChange', + message0: 'mutator text: %1', args0: [ { - type: 'field_colour', - name: 'COLOUR', - colour: '#ff0000', + type: 'field_input', + name: 'MUTATOR_TEXT', + text: 'a label', }, ], style: 'colour_blocks', @@ -41,7 +41,7 @@ const COLOR_CHANGE_MUTATOR = { */ mutationToDom: function () { const container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('colour', this.getColour()); + container.setAttribute('arbitrary', this.getFieldValue('LABEL')); return container; }, /** @@ -50,23 +50,23 @@ const COLOR_CHANGE_MUTATOR = { * @this {Blockly.Block} */ domToMutation: function (xmlElement) { - this.setColour(xmlElement.getAttribute('colour')); + this.setFieldValue(xmlElement.getAttribute('arbitrary'), 'LABEL'); }, /** * Returns the state of this block as a json serializable object. - * @returns {{colour: string}} The state of this block. + * @returns {{arbitrary: string}} The state of this block. * @this {Blockly.Block} */ saveExtraState: function () { - return {colour: this.getColour()}; + return {arbitrary: this.getFieldValue('LABEL')}; }, /** * Applies the state to this block. - * @param {{color: string}} state The state to apply. + * @param {{arbitrary: string}} state The state to apply. * @this {Blockly.Block} */ loadExtraState: function (state) { - this.setColour(state['colour']); + this.setFieldValue(state['arbitrary'], 'LABEL'); }, /** * Populate the mutator's dialog with this block's components. @@ -76,10 +76,12 @@ const COLOR_CHANGE_MUTATOR = { */ decompose: function (workspace) { const containerBlock = Blockly.serialization.blocks.append( - {type: 'test_mutator_colorChange'}, + {type: 'test_mutator_textChange'}, workspace, ); - containerBlock.getField('COLOUR').setValue(this.getColour()); + containerBlock + .getField('MUTATOR_TEXT') + .setValue(this.getFieldValue('LABEL')); return containerBlock; }, /** @@ -88,7 +90,7 @@ const COLOR_CHANGE_MUTATOR = { * @this {Blockly.Block} */ compose: function (containerBlock) { - this.setColour(containerBlock.getFieldValue('COLOUR')); + this.setFieldValue(containerBlock.getFieldValue('MUTATOR_TEXT'), 'LABEL'); }, }; @@ -100,12 +102,12 @@ for (let i = 0; i < n; i++) { const defineBlocks = blocksIds.map((t) => ({ type: t, - message0: 'colour %1', + message0: 'mutator text: %1', args0: [ { - type: 'field_colour', - name: 'COLOUR', - colour: '#ff0000', + type: 'field_input', + name: 'MUTATOR_TEXT', + text: 'a label', }, ], style: 'colour_blocks', @@ -114,7 +116,14 @@ const defineBlocks = blocksIds.map((t) => ({ Blockly.defineBlocksWithJsonArray([ { type: 'test_mutators_many', - message0: 'test many blocks mutator', + message0: 'test many blocks mutator %1', + args0: [ + { + type: 'field_label', + name: 'LABEL', + text: 'changeable label', + }, + ], mutator: 'test_many_blocks_mutator', colour: '#000000', }, @@ -132,7 +141,14 @@ Blockly.Extensions.registerMutator( Blockly.defineBlocksWithJsonArray([ { type: 'test_mutators_noflyout', - message0: 'noflyout mutator', + message0: 'noflyout mutator %1', + args0: [ + { + type: 'field_label', + name: 'LABEL', + text: 'changeable label', + }, + ], mutator: 'test_noflyout_mutator', colour: '#000000', }, @@ -149,7 +165,14 @@ Blockly.Extensions.registerMutator( Blockly.defineBlocksWithJsonArray([ { type: 'test_mutators_changeableFlyout', - message0: 'changeable flyout mutator', + message0: 'changeable flyout mutator %1', + args0: [ + { + type: 'field_label', + name: 'LABEL', + text: 'changeable label', + }, + ], mutator: 'test_changeableFlyout_mutator', colour: '#000000', }, diff --git a/plugins/dev-tools/src/toolboxCategories.js b/plugins/dev-tools/src/toolboxCategories.js index 6da9ce7781..62eb490178 100644 --- a/plugins/dev-tools/src/toolboxCategories.js +++ b/plugins/dev-tools/src/toolboxCategories.js @@ -367,13 +367,6 @@ export default { TEXT: '', }, }, - { - type: 'text_multiline', - kind: 'block', - fields: { - TEXT: '', - }, - }, { type: 'text_join', kind: 'block', @@ -771,84 +764,6 @@ export default { }, ], }, - { - kind: 'category', - categorystyle: 'colour_category', - name: 'Colour', - contents: [ - { - type: 'colour_picker', - kind: 'block', - fields: { - COLOUR: '#ff0000', - }, - }, - { - type: 'colour_random', - kind: 'block', - }, - { - type: 'colour_rgb', - kind: 'block', - inputs: { - RED: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - GREEN: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - BLUE: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - }, - }, - { - type: 'colour_blend', - kind: 'block', - inputs: { - COLOUR1: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#ff0000', - }, - }, - }, - COLOUR2: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#3333ff', - }, - }, - }, - RATIO: { - shadow: { - type: 'math_number', - fields: { - NUM: 0.5, - }, - }, - }, - }, - }, - ], - }, { kind: 'sep', }, diff --git a/plugins/shadow-block-converter/test/index.ts b/plugins/shadow-block-converter/test/index.ts index 13cf0aa7c9..876360d9f7 100644 --- a/plugins/shadow-block-converter/test/index.ts +++ b/plugins/shadow-block-converter/test/index.ts @@ -25,28 +25,6 @@ const toolbox: Blockly.utils.toolbox.ToolboxDefinition = { }, }, }, - { - kind: 'block', - type: 'colour_blend', - inputs: { - COLOUR1: { - shadow: {type: 'colour_picker', fields: {COLOUR: '#ff0000'}}, - block: undefined, - }, - COLOUR2: { - shadow: {type: 'colour_picker', fields: {COLOUR: '#3333ff'}}, - block: undefined, - }, - RATIO: { - shadow: {type: 'math_number', fields: {NUM: 0.5}}, - block: undefined, - }, - }, - }, - { - kind: 'block', - type: 'colour_picker', - }, { kind: 'block', type: 'text_print', diff --git a/plugins/strict-connection-checker/src/toolboxCategories.js b/plugins/strict-connection-checker/src/toolboxCategories.js index 90e1880b14..5ce25a88b1 100644 --- a/plugins/strict-connection-checker/src/toolboxCategories.js +++ b/plugins/strict-connection-checker/src/toolboxCategories.js @@ -367,13 +367,6 @@ export default { TEXT: '', }, }, - { - type: 'text_multiline', - kind: 'block', - fields: { - TEXT: '', - }, - }, { type: 'text_join', kind: 'block', @@ -642,84 +635,6 @@ export default { }, ], }, - { - kind: 'category', - categorystyle: 'colour_category', - name: 'Colour', - contents: [ - { - type: 'colour_picker', - kind: 'block', - fields: { - COLOUR: '#ff0000', - }, - }, - { - type: 'colour_random', - kind: 'block', - }, - { - type: 'colour_rgb', - kind: 'block', - inputs: { - RED: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - GREEN: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - BLUE: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - }, - }, - { - type: 'colour_blend', - kind: 'block', - inputs: { - COLOUR1: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#ff0000', - }, - }, - }, - COLOUR2: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#3333ff', - }, - }, - }, - RATIO: { - shadow: { - type: 'math_number', - fields: { - NUM: 0.5, - }, - }, - }, - }, - }, - ], - }, { kind: 'sep', }, diff --git a/plugins/theme-dark/test/index.js b/plugins/theme-dark/test/index.js index 575c2d8a68..c3f824bbad 100644 --- a/plugins/theme-dark/test/index.js +++ b/plugins/theme-dark/test/index.js @@ -380,13 +380,6 @@ const toolbox = { TEXT: '', }, }, - { - type: 'text_multiline', - kind: 'block', - fields: { - TEXT: '', - }, - }, { type: 'text_join', kind: 'block', @@ -780,84 +773,6 @@ const toolbox = { }, ], }, - { - kind: 'category', - categorystyle: 'colour_category', - name: 'Colour', - contents: [ - { - type: 'colour_picker', - kind: 'block', - fields: { - COLOUR: '#ff0000', - }, - }, - { - type: 'colour_random', - kind: 'block', - }, - { - type: 'colour_rgb', - kind: 'block', - inputs: { - RED: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - GREEN: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - BLUE: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - }, - }, - { - type: 'colour_blend', - kind: 'block', - inputs: { - COLOUR1: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#ff0000', - }, - }, - }, - COLOUR2: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#3333ff', - }, - }, - }, - RATIO: { - shadow: { - type: 'math_number', - fields: { - NUM: 0.5, - }, - }, - }, - }, - }, - ], - }, { kind: 'sep', }, diff --git a/plugins/theme-deuteranopia/test/index.js b/plugins/theme-deuteranopia/test/index.js index 6dbc15f55c..5244caf43a 100644 --- a/plugins/theme-deuteranopia/test/index.js +++ b/plugins/theme-deuteranopia/test/index.js @@ -380,13 +380,6 @@ const toolbox = { TEXT: '', }, }, - { - type: 'text_multiline', - kind: 'block', - fields: { - TEXT: '', - }, - }, { type: 'text_join', kind: 'block', @@ -780,84 +773,6 @@ const toolbox = { }, ], }, - { - kind: 'category', - categorystyle: 'colour_category', - name: 'Colour', - contents: [ - { - type: 'colour_picker', - kind: 'block', - fields: { - COLOUR: '#ff0000', - }, - }, - { - type: 'colour_random', - kind: 'block', - }, - { - type: 'colour_rgb', - kind: 'block', - inputs: { - RED: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - GREEN: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - BLUE: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - }, - }, - { - type: 'colour_blend', - kind: 'block', - inputs: { - COLOUR1: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#ff0000', - }, - }, - }, - COLOUR2: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#3333ff', - }, - }, - }, - RATIO: { - shadow: { - type: 'math_number', - fields: { - NUM: 0.5, - }, - }, - }, - }, - }, - ], - }, { kind: 'sep', }, diff --git a/plugins/theme-highcontrast/test/index.js b/plugins/theme-highcontrast/test/index.js index 1c2a919db9..aca4e423f1 100644 --- a/plugins/theme-highcontrast/test/index.js +++ b/plugins/theme-highcontrast/test/index.js @@ -380,13 +380,6 @@ const toolbox = { TEXT: '', }, }, - { - type: 'text_multiline', - kind: 'block', - fields: { - TEXT: '', - }, - }, { type: 'text_join', kind: 'block', @@ -780,84 +773,6 @@ const toolbox = { }, ], }, - { - kind: 'category', - categorystyle: 'colour_category', - name: 'Colour', - contents: [ - { - type: 'colour_picker', - kind: 'block', - fields: { - COLOUR: '#ff0000', - }, - }, - { - type: 'colour_random', - kind: 'block', - }, - { - type: 'colour_rgb', - kind: 'block', - inputs: { - RED: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - GREEN: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - BLUE: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - }, - }, - { - type: 'colour_blend', - kind: 'block', - inputs: { - COLOUR1: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#ff0000', - }, - }, - }, - COLOUR2: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#3333ff', - }, - }, - }, - RATIO: { - shadow: { - type: 'math_number', - fields: { - NUM: 0.5, - }, - }, - }, - }, - }, - ], - }, { kind: 'sep', }, diff --git a/plugins/theme-modern/test/index.js b/plugins/theme-modern/test/index.js index 6b1824f203..db9844e955 100644 --- a/plugins/theme-modern/test/index.js +++ b/plugins/theme-modern/test/index.js @@ -380,13 +380,6 @@ const toolbox = { TEXT: '', }, }, - { - type: 'text_multiline', - kind: 'block', - fields: { - TEXT: '', - }, - }, { type: 'text_join', kind: 'block', @@ -780,84 +773,6 @@ const toolbox = { }, ], }, - { - kind: 'category', - categorystyle: 'colour_category', - name: 'Colour', - contents: [ - { - type: 'colour_picker', - kind: 'block', - fields: { - COLOUR: '#ff0000', - }, - }, - { - type: 'colour_random', - kind: 'block', - }, - { - type: 'colour_rgb', - kind: 'block', - inputs: { - RED: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - GREEN: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - BLUE: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - }, - }, - { - type: 'colour_blend', - kind: 'block', - inputs: { - COLOUR1: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#ff0000', - }, - }, - }, - COLOUR2: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#3333ff', - }, - }, - }, - RATIO: { - shadow: { - type: 'math_number', - fields: { - NUM: 0.5, - }, - }, - }, - }, - }, - ], - }, { kind: 'sep', }, diff --git a/plugins/theme-tritanopia/test/index.js b/plugins/theme-tritanopia/test/index.js index 3e6fc496cf..a5ac03c718 100644 --- a/plugins/theme-tritanopia/test/index.js +++ b/plugins/theme-tritanopia/test/index.js @@ -380,13 +380,6 @@ const toolbox = { TEXT: '', }, }, - { - type: 'text_multiline', - kind: 'block', - fields: { - TEXT: '', - }, - }, { type: 'text_join', kind: 'block', @@ -780,84 +773,6 @@ const toolbox = { }, ], }, - { - kind: 'category', - categorystyle: 'colour_category', - name: 'Colour', - contents: [ - { - type: 'colour_picker', - kind: 'block', - fields: { - COLOUR: '#ff0000', - }, - }, - { - type: 'colour_random', - kind: 'block', - }, - { - type: 'colour_rgb', - kind: 'block', - inputs: { - RED: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - GREEN: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - BLUE: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - }, - }, - { - type: 'colour_blend', - kind: 'block', - inputs: { - COLOUR1: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#ff0000', - }, - }, - }, - COLOUR2: { - shadow: { - type: 'colour_picker', - fields: { - COLOUR: '#3333ff', - }, - }, - }, - RATIO: { - shadow: { - type: 'math_number', - fields: { - NUM: 0.5, - }, - }, - }, - }, - }, - ], - }, { kind: 'sep', },