mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
chore(deps): Bump prettier from 2.8.8 to 3.0.0 (#7322)
* chore(deps): Bump prettier from 2.8.8 to 3.0.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore: Reformat using Prettier v3.0 defaults The main change is to add trailing commas to the last line of block-formatted function calls. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Christopher Allen <cpcallen+git@google.com>
This commit is contained in:
@@ -42,5 +42,5 @@ export const blocks: {[key: string]: BlockDefinition} = Object.assign(
|
||||
math.blocks,
|
||||
procedures.blocks,
|
||||
variables.blocks,
|
||||
variablesDynamic.blocks
|
||||
variablesDynamic.blocks,
|
||||
);
|
||||
|
||||
@@ -130,7 +130,7 @@ const LISTS_CREATE_WITH = {
|
||||
this.updateShape_();
|
||||
this.setOutput(true, 'Array');
|
||||
this.setMutator(
|
||||
new MutatorIcon(['lists_create_with_item'], this as unknown as BlockSvg)
|
||||
new MutatorIcon(['lists_create_with_item'], this as unknown as BlockSvg),
|
||||
); // BUG(#6905)
|
||||
this.setTooltip(Msg['LISTS_CREATE_WITH_TOOLTIP']);
|
||||
},
|
||||
@@ -182,16 +182,16 @@ const LISTS_CREATE_WITH = {
|
||||
*/
|
||||
decompose: function (
|
||||
this: CreateWithBlock,
|
||||
workspace: Workspace
|
||||
workspace: Workspace,
|
||||
): ContainerBlock {
|
||||
const containerBlock = workspace.newBlock(
|
||||
'lists_create_with_container'
|
||||
'lists_create_with_container',
|
||||
) as ContainerBlock;
|
||||
(containerBlock as BlockSvg).initSvg();
|
||||
let connection = containerBlock.getInput('STACK')!.connection;
|
||||
for (let i = 0; i < this.itemCount_; i++) {
|
||||
const itemBlock = workspace.newBlock(
|
||||
'lists_create_with_item'
|
||||
'lists_create_with_item',
|
||||
) as ItemBlock;
|
||||
(itemBlock as BlockSvg).initSvg();
|
||||
if (!itemBlock.previousConnection) {
|
||||
@@ -209,7 +209,7 @@ const LISTS_CREATE_WITH = {
|
||||
*/
|
||||
compose: function (this: CreateWithBlock, containerBlock: Block) {
|
||||
let itemBlock: ItemBlock | null = containerBlock.getInputTargetBlock(
|
||||
'STACK'
|
||||
'STACK',
|
||||
) as ItemBlock;
|
||||
// Count number of inputs.
|
||||
const connections: Connection[] = [];
|
||||
@@ -242,7 +242,7 @@ const LISTS_CREATE_WITH = {
|
||||
*/
|
||||
saveConnections: function (this: CreateWithBlock, containerBlock: Block) {
|
||||
let itemBlock: ItemBlock | null = containerBlock.getInputTargetBlock(
|
||||
'STACK'
|
||||
'STACK',
|
||||
) as ItemBlock;
|
||||
let i = 0;
|
||||
while (itemBlock) {
|
||||
@@ -265,7 +265,7 @@ const LISTS_CREATE_WITH = {
|
||||
this.removeInput('EMPTY');
|
||||
} else if (!this.itemCount_ && !this.getInput('EMPTY')) {
|
||||
this.appendDummyInput('EMPTY').appendField(
|
||||
Msg['LISTS_CREATE_EMPTY_TITLE']
|
||||
Msg['LISTS_CREATE_EMPTY_TITLE'],
|
||||
);
|
||||
}
|
||||
// Add new inputs.
|
||||
@@ -297,7 +297,7 @@ const LISTS_CREATE_WITH_CONTAINER = {
|
||||
init: function (this: ContainerBlock) {
|
||||
this.setStyle('list_blocks');
|
||||
this.appendDummyInput().appendField(
|
||||
Msg['LISTS_CREATE_WITH_CONTAINER_TITLE_ADD']
|
||||
Msg['LISTS_CREATE_WITH_CONTAINER_TITLE_ADD'],
|
||||
);
|
||||
this.appendStatementInput('STACK');
|
||||
this.setTooltip(Msg['LISTS_CREATE_WITH_CONTAINER_TOOLTIP']);
|
||||
@@ -358,7 +358,7 @@ const LISTS_INDEXOF = {
|
||||
this.setTooltip(() => {
|
||||
return Msg['LISTS_INDEX_OF_TOOLTIP'].replace(
|
||||
'%1',
|
||||
this.workspace.options.oneBasedIndex ? '0' : '-1'
|
||||
this.workspace.options.oneBasedIndex ? '0' : '-1',
|
||||
);
|
||||
});
|
||||
},
|
||||
@@ -401,7 +401,7 @@ const LISTS_GETINDEX = {
|
||||
const isStatement = value === 'REMOVE';
|
||||
(this.getSourceBlock() as GetIndexBlock).updateStatement_(isStatement);
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
);
|
||||
this.appendValueInput('VALUE')
|
||||
.setCheck('Array')
|
||||
@@ -568,7 +568,7 @@ const LISTS_GETINDEX = {
|
||||
this.appendValueInput('AT').setCheck('Number');
|
||||
if (Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||
this.appendDummyInput('ORDINAL').appendField(
|
||||
Msg['ORDINAL_NUMBER_SUFFIX']
|
||||
Msg['ORDINAL_NUMBER_SUFFIX'],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -596,7 +596,7 @@ const LISTS_GETINDEX = {
|
||||
return null;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
);
|
||||
this.getInput('AT')!.appendField(menu, 'WHERE');
|
||||
if (Msg['LISTS_GET_INDEX_TAIL']) {
|
||||
@@ -685,7 +685,7 @@ const LISTS_SETINDEX = {
|
||||
' ' +
|
||||
Msg['LISTS_INDEX_FROM_START_TOOLTIP'].replace(
|
||||
'%1',
|
||||
this.workspace.options.oneBasedIndex ? '#1' : '#0'
|
||||
this.workspace.options.oneBasedIndex ? '#1' : '#0',
|
||||
);
|
||||
}
|
||||
return tooltip;
|
||||
@@ -747,7 +747,7 @@ const LISTS_SETINDEX = {
|
||||
this.appendValueInput('AT').setCheck('Number');
|
||||
if (Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||
this.appendDummyInput('ORDINAL').appendField(
|
||||
Msg['ORDINAL_NUMBER_SUFFIX']
|
||||
Msg['ORDINAL_NUMBER_SUFFIX'],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -775,7 +775,7 @@ const LISTS_SETINDEX = {
|
||||
return null;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
);
|
||||
this.moveInputBefore('AT', 'TO');
|
||||
if (this.getInput('ORDINAL')) {
|
||||
@@ -887,7 +887,7 @@ const LISTS_GETSUBLIST = {
|
||||
this.appendValueInput('AT' + n).setCheck('Number');
|
||||
if (Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||
this.appendDummyInput('ORDINAL' + n).appendField(
|
||||
Msg['ORDINAL_NUMBER_SUFFIX']
|
||||
Msg['ORDINAL_NUMBER_SUFFIX'],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -915,7 +915,7 @@ const LISTS_GETSUBLIST = {
|
||||
block.setFieldValue(value, 'WHERE' + n);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
this.getInput('AT' + n)!.appendField(menu, 'WHERE' + n);
|
||||
if (n === 1) {
|
||||
|
||||
@@ -276,7 +276,7 @@ const TOOLTIPS_BY_OP = {
|
||||
|
||||
Extensions.register(
|
||||
'logic_op_tooltip',
|
||||
Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP)
|
||||
Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP),
|
||||
);
|
||||
|
||||
/** Type of a block that has CONTROLS_IF_MUTATOR_MIXIN */
|
||||
@@ -417,10 +417,10 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
|
||||
this.elseifCount_++;
|
||||
// TODO(#6920): null valid, undefined not.
|
||||
valueConnections.push(
|
||||
clauseBlock.valueConnection_ as Connection | null
|
||||
clauseBlock.valueConnection_ as Connection | null,
|
||||
);
|
||||
statementConnections.push(
|
||||
clauseBlock.statementConnection_ as Connection | null
|
||||
clauseBlock.statementConnection_ as Connection | null,
|
||||
);
|
||||
break;
|
||||
case 'controls_if_else':
|
||||
@@ -438,7 +438,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
|
||||
this.reconnectChildBlocks_(
|
||||
valueConnections,
|
||||
statementConnections,
|
||||
elseStatementConnection
|
||||
elseStatementConnection,
|
||||
);
|
||||
},
|
||||
/**
|
||||
@@ -500,7 +500,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
|
||||
this.reconnectChildBlocks_(
|
||||
valueConnections,
|
||||
statementConnections,
|
||||
elseStatementConnection
|
||||
elseStatementConnection,
|
||||
);
|
||||
},
|
||||
/**
|
||||
@@ -523,12 +523,12 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
|
||||
.setCheck('Boolean')
|
||||
.appendField(Msg['CONTROLS_IF_MSG_ELSEIF']);
|
||||
this.appendStatementInput('DO' + i).appendField(
|
||||
Msg['CONTROLS_IF_MSG_THEN']
|
||||
Msg['CONTROLS_IF_MSG_THEN'],
|
||||
);
|
||||
}
|
||||
if (this.elseCount_) {
|
||||
this.appendStatementInput('ELSE').appendField(
|
||||
Msg['CONTROLS_IF_MSG_ELSE']
|
||||
Msg['CONTROLS_IF_MSG_ELSE'],
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -545,7 +545,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
|
||||
this: IfBlock,
|
||||
valueConnections: Array<Connection | null>,
|
||||
statementConnections: Array<Connection | null>,
|
||||
elseStatementConnection: Connection | null
|
||||
elseStatementConnection: Connection | null,
|
||||
) {
|
||||
for (let i = 1; i <= this.elseifCount_; i++) {
|
||||
valueConnections[i]?.reconnect(this, 'IF' + i);
|
||||
@@ -559,7 +559,7 @@ Extensions.registerMutator(
|
||||
'controls_if_mutator',
|
||||
CONTROLS_IF_MUTATOR_MIXIN,
|
||||
null as unknown as undefined, // TODO(#6920)
|
||||
['controls_if_elseif', 'controls_if_else']
|
||||
['controls_if_elseif', 'controls_if_else'],
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -579,7 +579,7 @@ const CONTROLS_IF_TOOLTIP_EXTENSION = function (this: IfBlock) {
|
||||
return Msg['CONTROLS_IF_TOOLTIP_4'];
|
||||
}
|
||||
return '';
|
||||
}.bind(this)
|
||||
}.bind(this),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -617,7 +617,7 @@ const LOGIC_COMPARE_ONCHANGE_MIXIN = {
|
||||
blockB &&
|
||||
!this.workspace.connectionChecker.doTypeChecks(
|
||||
blockA.outputConnection!,
|
||||
blockB.outputConnection!
|
||||
blockB.outputConnection!,
|
||||
)
|
||||
) {
|
||||
// Mismatch between two inputs. Revert the block connections,
|
||||
@@ -686,7 +686,7 @@ const LOGIC_TERNARY_ONCHANGE_MIXIN = {
|
||||
block &&
|
||||
!block.workspace.connectionChecker.doTypeChecks(
|
||||
block.outputConnection!,
|
||||
parentConnection
|
||||
parentConnection,
|
||||
)
|
||||
) {
|
||||
// Ensure that any disconnections are grouped with the causing
|
||||
|
||||
@@ -227,7 +227,7 @@ const WHILE_UNTIL_TOOLTIPS = {
|
||||
|
||||
Extensions.register(
|
||||
'controls_whileUntil_tooltip',
|
||||
Extensions.buildTooltipForDropdown('MODE', WHILE_UNTIL_TOOLTIPS)
|
||||
Extensions.buildTooltipForDropdown('MODE', WHILE_UNTIL_TOOLTIPS),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -242,7 +242,7 @@ const BREAK_CONTINUE_TOOLTIPS = {
|
||||
|
||||
Extensions.register(
|
||||
'controls_flow_tooltip',
|
||||
Extensions.buildTooltipForDropdown('FLOW', BREAK_CONTINUE_TOOLTIPS)
|
||||
Extensions.buildTooltipForDropdown('FLOW', BREAK_CONTINUE_TOOLTIPS),
|
||||
);
|
||||
|
||||
/** Type of a block that has CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN */
|
||||
@@ -264,7 +264,7 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = {
|
||||
*/
|
||||
customContextMenu: function (
|
||||
this: CustomContextMenuBlock,
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>,
|
||||
) {
|
||||
if (this.isInFlyout) {
|
||||
return;
|
||||
@@ -289,17 +289,20 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = {
|
||||
|
||||
Extensions.registerMixin(
|
||||
'contextMenu_newGetVariableBlock',
|
||||
CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN
|
||||
CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN,
|
||||
);
|
||||
|
||||
Extensions.register(
|
||||
'controls_for_tooltip',
|
||||
Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR')
|
||||
Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR'),
|
||||
);
|
||||
|
||||
Extensions.register(
|
||||
'controls_forEach_tooltip',
|
||||
Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOREACH_TOOLTIP}', 'VAR')
|
||||
Extensions.buildTooltipWithFieldText(
|
||||
'%{BKY_CONTROLS_FOREACH_TOOLTIP}',
|
||||
'VAR',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -366,7 +369,7 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = {
|
||||
}
|
||||
const enabled = !!this.getSurroundLoop();
|
||||
this.setWarningText(
|
||||
enabled ? null : Msg['CONTROLS_FLOW_STATEMENTS_WARNING']
|
||||
enabled ? null : Msg['CONTROLS_FLOW_STATEMENTS_WARNING'],
|
||||
);
|
||||
if (!this.isInFlyout) {
|
||||
const group = Events.getGroup();
|
||||
@@ -380,7 +383,7 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = {
|
||||
|
||||
Extensions.registerMixin(
|
||||
'controls_flow_in_loop_check',
|
||||
CONTROL_FLOW_IN_LOOP_CHECK_MIXIN
|
||||
CONTROL_FLOW_IN_LOOP_CHECK_MIXIN,
|
||||
);
|
||||
|
||||
// Register provided blocks.
|
||||
|
||||
@@ -427,7 +427,7 @@ const TOOLTIPS_BY_OP = {
|
||||
|
||||
Extensions.register(
|
||||
'math_op_tooltip',
|
||||
Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP)
|
||||
Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP),
|
||||
);
|
||||
|
||||
/** Type of a block that has IS_DIVISBLEBY_MUTATOR_MIXIN */
|
||||
@@ -502,20 +502,20 @@ const IS_DIVISIBLE_MUTATOR_EXTENSION = function (this: DivisiblebyBlock) {
|
||||
const divisorInput = option === 'DIVISIBLE_BY';
|
||||
(this.getSourceBlock() as DivisiblebyBlock).updateShape_(divisorInput);
|
||||
return undefined; // FieldValidators can't be void. Use option as-is.
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
Extensions.registerMutator(
|
||||
'math_is_divisibleby_mutator',
|
||||
IS_DIVISIBLEBY_MUTATOR_MIXIN,
|
||||
IS_DIVISIBLE_MUTATOR_EXTENSION
|
||||
IS_DIVISIBLE_MUTATOR_EXTENSION,
|
||||
);
|
||||
|
||||
// Update the tooltip of 'math_change' block to reference the variable.
|
||||
Extensions.register(
|
||||
'math_change_tooltip',
|
||||
Extensions.buildTooltipWithFieldText('%{BKY_MATH_CHANGE_TOOLTIP}', 'VAR')
|
||||
Extensions.buildTooltipWithFieldText('%{BKY_MATH_CHANGE_TOOLTIP}', 'VAR'),
|
||||
);
|
||||
|
||||
/** Type of a block that has LIST_MODES_MUTATOR_MIXIN */
|
||||
@@ -578,14 +578,14 @@ const LIST_MODES_MUTATOR_EXTENSION = function (this: ListModesBlock) {
|
||||
function (this: ListModesBlock, newOp: string) {
|
||||
this.updateType_(newOp);
|
||||
return undefined;
|
||||
}.bind(this)
|
||||
}.bind(this),
|
||||
);
|
||||
};
|
||||
|
||||
Extensions.registerMutator(
|
||||
'math_modes_of_list_mutator',
|
||||
LIST_MODES_MUTATOR_MIXIN,
|
||||
LIST_MODES_MUTATOR_EXTENSION
|
||||
LIST_MODES_MUTATOR_EXTENSION,
|
||||
);
|
||||
|
||||
// Register provided blocks.
|
||||
|
||||
@@ -77,7 +77,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
}
|
||||
if (hasStatements) {
|
||||
this.appendStatementInput('STACK').appendField(
|
||||
Msg['PROCEDURES_DEFNORETURN_DO']
|
||||
Msg['PROCEDURES_DEFNORETURN_DO'],
|
||||
);
|
||||
if (this.getInput('RETURN')) {
|
||||
this.moveInputBefore('STACK', 'RETURN');
|
||||
@@ -118,7 +118,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
*/
|
||||
mutationToDom: function (
|
||||
this: ProcedureBlock,
|
||||
opt_paramIds: boolean
|
||||
opt_paramIds: boolean,
|
||||
): Element {
|
||||
const container = xmlUtils.createElement('mutation');
|
||||
if (opt_paramIds) {
|
||||
@@ -162,13 +162,13 @@ const PROCEDURE_DEF_COMMON = {
|
||||
this.workspace,
|
||||
varId,
|
||||
varName,
|
||||
''
|
||||
'',
|
||||
);
|
||||
if (variable !== null) {
|
||||
this.argumentVarModels_.push(variable);
|
||||
} else {
|
||||
console.log(
|
||||
`Failed to create a variable named "${varName}", ignoring.`
|
||||
`Failed to create a variable named "${varName}", ignoring.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
this.workspace,
|
||||
param['id'],
|
||||
param['name'],
|
||||
''
|
||||
'',
|
||||
);
|
||||
this.arguments_.push(variable.name);
|
||||
this.argumentVarModels_.push(variable);
|
||||
@@ -239,7 +239,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
*/
|
||||
decompose: function (
|
||||
this: ProcedureBlock,
|
||||
workspace: Workspace
|
||||
workspace: Workspace,
|
||||
): ContainerBlock {
|
||||
/*
|
||||
* Creates the following XML:
|
||||
@@ -277,7 +277,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
|
||||
const containerBlock = Xml.domToBlock(
|
||||
containerBlockNode,
|
||||
workspace
|
||||
workspace,
|
||||
) as ContainerBlock;
|
||||
|
||||
if (this.type === 'procedures_defreturn') {
|
||||
@@ -366,7 +366,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
renameVarById: function (
|
||||
this: ProcedureBlock & BlockSvg,
|
||||
oldId: string,
|
||||
newId: string
|
||||
newId: string,
|
||||
) {
|
||||
const oldVariable = this.workspace.getVariableById(oldId)!;
|
||||
if (oldVariable.type !== '') {
|
||||
@@ -397,7 +397,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
*/
|
||||
updateVarName: function (
|
||||
this: ProcedureBlock & BlockSvg,
|
||||
variable: VariableModel
|
||||
variable: VariableModel,
|
||||
) {
|
||||
const newName = variable.name;
|
||||
let change = false;
|
||||
@@ -424,7 +424,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
displayRenamedVar_: function (
|
||||
this: ProcedureBlock & BlockSvg,
|
||||
oldName: string,
|
||||
newName: string
|
||||
newName: string,
|
||||
) {
|
||||
this.updateParams_();
|
||||
// Update the mutator's variables if the mutator is open.
|
||||
@@ -448,7 +448,7 @@ const PROCEDURE_DEF_COMMON = {
|
||||
*/
|
||||
customContextMenu: function (
|
||||
this: ProcedureBlock,
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>,
|
||||
) {
|
||||
if (this.isInFlyout) {
|
||||
return;
|
||||
@@ -599,7 +599,7 @@ const PROCEDURES_MUTATORCONTAINER = {
|
||||
*/
|
||||
init: function (this: ContainerBlock) {
|
||||
this.appendDummyInput().appendField(
|
||||
Msg['PROCEDURES_MUTATORCONTAINER_TITLE']
|
||||
Msg['PROCEDURES_MUTATORCONTAINER_TITLE'],
|
||||
);
|
||||
this.appendStatementInput('STACK');
|
||||
this.appendDummyInput('STATEMENT_INPUT')
|
||||
@@ -609,7 +609,7 @@ const PROCEDURES_MUTATORCONTAINER = {
|
||||
type: 'field_checkbox',
|
||||
checked: true,
|
||||
}) as FieldCheckbox,
|
||||
'STATEMENTS'
|
||||
'STATEMENTS',
|
||||
);
|
||||
this.setStyle('procedure_blocks');
|
||||
this.setTooltip(Msg['PROCEDURES_MUTATORCONTAINER_TOOLTIP']);
|
||||
@@ -678,7 +678,7 @@ const PROCEDURES_MUTATORARGUMENT = {
|
||||
*/
|
||||
validator_: function (
|
||||
this: FieldTextInputForArgument,
|
||||
varName: string
|
||||
varName: string,
|
||||
): string | null {
|
||||
const sourceBlock = this.getSourceBlock()!;
|
||||
const outerWs = sourceBlock!.workspace.getRootWorkspace()!;
|
||||
@@ -734,7 +734,7 @@ const PROCEDURES_MUTATORARGUMENT = {
|
||||
*/
|
||||
deleteIntermediateVars_: function (
|
||||
this: FieldTextInputForArgument,
|
||||
newText: string
|
||||
newText: string,
|
||||
) {
|
||||
const outerWs = this.getSourceBlock()!.workspace.getRootWorkspace();
|
||||
if (!outerWs) {
|
||||
@@ -792,7 +792,7 @@ const PROCEDURE_CALL_COMMON = {
|
||||
renameProcedure: function (
|
||||
this: CallBlock,
|
||||
oldName: string,
|
||||
newName: string
|
||||
newName: string,
|
||||
) {
|
||||
if (Names.equals(oldName, this.getProcedureCall())) {
|
||||
this.setFieldValue(newName, 'NAME');
|
||||
@@ -814,7 +814,7 @@ const PROCEDURE_CALL_COMMON = {
|
||||
setProcedureParameters_: function (
|
||||
this: CallBlock,
|
||||
paramNames: string[],
|
||||
paramIds: string[]
|
||||
paramIds: string[],
|
||||
) {
|
||||
// Data structures:
|
||||
// this.arguments = ['x', 'y']
|
||||
@@ -827,7 +827,7 @@ const PROCEDURE_CALL_COMMON = {
|
||||
// which might reappear if a param is reattached in the mutator.
|
||||
const defBlock = Procedures.getDefinition(
|
||||
this.getProcedureCall(),
|
||||
this.workspace
|
||||
this.workspace,
|
||||
);
|
||||
const mutatorIcon = defBlock && defBlock.getIcon(Mutator.TYPE);
|
||||
const mutatorOpen = mutatorIcon && mutatorIcon.bubbleIsVisible();
|
||||
@@ -880,7 +880,7 @@ const PROCEDURE_CALL_COMMON = {
|
||||
this.workspace,
|
||||
null,
|
||||
this.arguments_[i],
|
||||
''
|
||||
'',
|
||||
);
|
||||
this.argumentVarModels_.push(variable);
|
||||
}
|
||||
@@ -1126,7 +1126,7 @@ const PROCEDURE_CALL_COMMON = {
|
||||
// investigate. If the use ends up being valid we may need to reorder
|
||||
// events in the undo stack.
|
||||
console.log(
|
||||
'Saw an existing group while responding to a definition change'
|
||||
'Saw an existing group while responding to a definition change',
|
||||
);
|
||||
}
|
||||
Events.setGroup(event.group);
|
||||
@@ -1147,7 +1147,7 @@ const PROCEDURE_CALL_COMMON = {
|
||||
*/
|
||||
customContextMenu: function (
|
||||
this: CallBlock,
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>,
|
||||
) {
|
||||
if (!(this.workspace as WorkspaceSvg).isMovable()) {
|
||||
// If we center on the block and the workspace isn't movable we could
|
||||
@@ -1230,7 +1230,7 @@ const PROCEDURES_IFRETURN = {
|
||||
.setCheck('Boolean')
|
||||
.appendField(Msg['CONTROLS_IF_MSG_IF']);
|
||||
this.appendValueInput('VALUE').appendField(
|
||||
Msg['PROCEDURES_DEFRETURN_RETURN']
|
||||
Msg['PROCEDURES_DEFRETURN_RETURN'],
|
||||
);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
@@ -1261,7 +1261,7 @@ const PROCEDURES_IFRETURN = {
|
||||
if (!this.hasReturnValue_) {
|
||||
this.removeInput('VALUE');
|
||||
this.appendDummyInput('VALUE').appendField(
|
||||
Msg['PROCEDURES_DEFRETURN_RETURN']
|
||||
Msg['PROCEDURES_DEFRETURN_RETURN'],
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -1300,7 +1300,7 @@ const PROCEDURES_IFRETURN = {
|
||||
if (block.type === 'procedures_defnoreturn' && this.hasReturnValue_) {
|
||||
this.removeInput('VALUE');
|
||||
this.appendDummyInput('VALUE').appendField(
|
||||
Msg['PROCEDURES_DEFRETURN_RETURN']
|
||||
Msg['PROCEDURES_DEFRETURN_RETURN'],
|
||||
);
|
||||
this.hasReturnValue_ = false;
|
||||
} else if (
|
||||
@@ -1309,7 +1309,7 @@ const PROCEDURES_IFRETURN = {
|
||||
) {
|
||||
this.removeInput('VALUE');
|
||||
this.appendValueInput('VALUE').appendField(
|
||||
Msg['PROCEDURES_DEFRETURN_RETURN']
|
||||
Msg['PROCEDURES_DEFRETURN_RETURN'],
|
||||
);
|
||||
this.hasReturnValue_ = true;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ const GET_SUBSTRING_BLOCK = {
|
||||
this.appendValueInput('AT' + n).setCheck('Number');
|
||||
if (Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||
this.appendDummyInput('ORDINAL' + n).appendField(
|
||||
Msg['ORDINAL_NUMBER_SUFFIX']
|
||||
Msg['ORDINAL_NUMBER_SUFFIX'],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -345,7 +345,7 @@ const GET_SUBSTRING_BLOCK = {
|
||||
return null;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
this.getInput('AT' + n)!.appendField(menu, 'WHERE' + n);
|
||||
@@ -379,7 +379,7 @@ blocks['text_changeCase'] = {
|
||||
type: 'field_dropdown',
|
||||
options: OPERATORS,
|
||||
}) as FieldDropdown,
|
||||
'CASE'
|
||||
'CASE',
|
||||
);
|
||||
this.setOutput(true, 'String');
|
||||
this.setTooltip(Msg['TEXT_CHANGECASE_TOOLTIP']);
|
||||
@@ -405,7 +405,7 @@ blocks['text_trim'] = {
|
||||
type: 'field_dropdown',
|
||||
options: OPERATORS,
|
||||
}) as FieldDropdown,
|
||||
'MODE'
|
||||
'MODE',
|
||||
);
|
||||
this.setOutput(true, 'String');
|
||||
this.setTooltip(Msg['TEXT_TRIM_TOOLTIP']);
|
||||
@@ -542,7 +542,7 @@ const TEXT_PROMPT_BLOCK = {
|
||||
type: 'field_input',
|
||||
text: '',
|
||||
}) as FieldTextInput,
|
||||
'TEXT'
|
||||
'TEXT',
|
||||
)
|
||||
.appendField(this.newQuote_(false));
|
||||
this.setOutput(true, 'String');
|
||||
@@ -691,7 +691,7 @@ const QUOTE_IMAGE_MIXIN = {
|
||||
}
|
||||
}
|
||||
console.warn(
|
||||
'field named "' + fieldName + '" not found in ' + this.toDevString()
|
||||
'field named "' + fieldName + '" not found in ' + this.toDevString(),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -790,13 +790,13 @@ const JOIN_MUTATOR_MIXIN = {
|
||||
*/
|
||||
decompose: function (this: JoinMutatorBlock, workspace: Workspace): Block {
|
||||
const containerBlock = workspace.newBlock(
|
||||
'text_create_join_container'
|
||||
'text_create_join_container',
|
||||
) as BlockSvg;
|
||||
containerBlock.initSvg();
|
||||
let connection = containerBlock.getInput('STACK')!.connection!;
|
||||
for (let i = 0; i < this.itemCount_; i++) {
|
||||
const itemBlock = workspace.newBlock(
|
||||
'text_create_join_item'
|
||||
'text_create_join_item',
|
||||
) as JoinItemBlock;
|
||||
itemBlock.initSvg();
|
||||
connection.connect(itemBlock.previousConnection);
|
||||
@@ -811,7 +811,7 @@ const JOIN_MUTATOR_MIXIN = {
|
||||
*/
|
||||
compose: function (this: JoinMutatorBlock, containerBlock: Block) {
|
||||
let itemBlock = containerBlock.getInputTargetBlock(
|
||||
'STACK'
|
||||
'STACK',
|
||||
) as JoinItemBlock;
|
||||
// Count number of inputs.
|
||||
const connections = [];
|
||||
@@ -901,7 +901,7 @@ const JOIN_EXTENSION = function (this: JoinMutatorBlock) {
|
||||
// Update the tooltip of 'text_append' block to reference the variable.
|
||||
Extensions.register(
|
||||
'text_append_tooltip',
|
||||
Extensions.buildTooltipWithFieldText('%{BKY_TEXT_APPEND_TOOLTIP}', 'VAR')
|
||||
Extensions.buildTooltipWithFieldText('%{BKY_TEXT_APPEND_TOOLTIP}', 'VAR'),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -911,7 +911,7 @@ const INDEXOF_TOOLTIP_EXTENSION = function (this: Block) {
|
||||
this.setTooltip(() => {
|
||||
return Msg['TEXT_INDEXOF_TOOLTIP'].replace(
|
||||
'%1',
|
||||
this.workspace.options.oneBasedIndex ? '0' : '-1'
|
||||
this.workspace.options.oneBasedIndex ? '0' : '-1',
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -970,7 +970,7 @@ const CHARAT_MUTATOR_MIXIN = {
|
||||
this.appendValueInput('AT').setCheck('Number');
|
||||
if (Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||
this.appendDummyInput('ORDINAL').appendField(
|
||||
Msg['ORDINAL_NUMBER_SUFFIX']
|
||||
Msg['ORDINAL_NUMBER_SUFFIX'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1022,13 +1022,13 @@ Extensions.register('text_quotes', QUOTES_EXTENSION);
|
||||
Extensions.registerMutator(
|
||||
'text_join_mutator',
|
||||
JOIN_MUTATOR_MIXIN,
|
||||
JOIN_EXTENSION
|
||||
JOIN_EXTENSION,
|
||||
);
|
||||
|
||||
Extensions.registerMutator(
|
||||
'text_charAt_mutator',
|
||||
CHARAT_MUTATOR_MIXIN,
|
||||
CHARAT_EXTENSION
|
||||
CHARAT_EXTENSION,
|
||||
);
|
||||
|
||||
// Register provided blocks.
|
||||
|
||||
@@ -89,7 +89,7 @@ const CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = {
|
||||
*/
|
||||
customContextMenu: function (
|
||||
this: VariableBlock,
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>,
|
||||
) {
|
||||
if (!this.isInFlyout) {
|
||||
let oppositeType;
|
||||
@@ -148,7 +148,7 @@ const CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = {
|
||||
* @returns A function that renames the variable.
|
||||
*/
|
||||
const renameOptionCallbackFactory = function (
|
||||
block: VariableBlock
|
||||
block: VariableBlock,
|
||||
): () => void {
|
||||
return function () {
|
||||
const workspace = block.workspace;
|
||||
@@ -166,7 +166,7 @@ const renameOptionCallbackFactory = function (
|
||||
* @returns A function that deletes the variable.
|
||||
*/
|
||||
const deleteOptionCallbackFactory = function (
|
||||
block: VariableBlock
|
||||
block: VariableBlock,
|
||||
): () => void {
|
||||
return function () {
|
||||
const workspace = block.workspace;
|
||||
@@ -179,7 +179,7 @@ const deleteOptionCallbackFactory = function (
|
||||
|
||||
Extensions.registerMixin(
|
||||
'contextMenu_variableSetterGetter',
|
||||
CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN
|
||||
CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN,
|
||||
);
|
||||
|
||||
// Register provided blocks.
|
||||
|
||||
@@ -90,7 +90,7 @@ const CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = {
|
||||
*/
|
||||
customContextMenu: function (
|
||||
this: VariableBlock,
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>
|
||||
options: Array<ContextMenuOption | LegacyContextMenuOption>,
|
||||
) {
|
||||
// Getter blocks have the option to create a setter block, and vice versa.
|
||||
if (!this.isInFlyout) {
|
||||
@@ -194,7 +194,7 @@ const deleteOptionCallbackFactory = function (block: VariableBlock) {
|
||||
|
||||
Extensions.registerMixin(
|
||||
'contextMenu_variableDynamicSetterGetter',
|
||||
CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN
|
||||
CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN,
|
||||
);
|
||||
|
||||
// Register provided blocks.
|
||||
|
||||
Reference in New Issue
Block a user