UNPKG

pxt-core

Version:

Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors

61 lines (60 loc) 2.47 kB
import * as Blockly from "blockly"; import { InlineSvgsExtensionBlock } from "../functions"; declare type IfElseMixinType = typeof IF_ELSE_MIXIN; interface IfElseMixin extends IfElseMixinType { } export declare type IfElseBlock = InlineSvgsExtensionBlock & IfElseMixin; declare const IF_ELSE_MIXIN: { elseifCount_: number; elseCount_: number; valueConnections_: Blockly.Connection[]; statementConnections_: Blockly.Connection[]; elseStatementConnection_: Blockly.Connection; /** * Create XML to represent the number of else-if and else inputs. * @return {Element} XML storage element. * @this Blockly.Block */ mutationToDom: (this: IfElseBlock) => Element; /** * Parse XML to restore the else-if and else inputs. * @param {!Element} xmlElement XML storage element. * @this Blockly.Block */ domToMutation: (this: IfElseBlock, xmlElement: Element) => void; /** * Store pointers to any connected child blocks. */ storeConnections_: (this: IfElseBlock, arg?: number) => void; /** * Restore pointers to any connected child blocks. */ restoreConnections_: (this: IfElseBlock) => void; addElse_: (this: IfElseBlock) => void; removeElse_: (this: IfElseBlock) => void; addElseIf_: (this: IfElseBlock) => void; removeElseIf_: (this: IfElseBlock, arg: number) => void; update_: (this: IfElseBlock, update: () => void, arg?: number) => void; /** * Modify this block to have the correct number of inputs. * @this Blockly.Block * @private */ updateShape_: (this: IfElseBlock) => void; /** * Reconstructs the block with all child blocks attached. */ rebuildShape_: (this: IfElseBlock) => void; /** * Reconnects child blocks. * @param {!Array<?Blockly.RenderedConnection>} valueConnections List of value * connectsions for if input. * @param {!Array<?Blockly.RenderedConnection>} statementConnections List of * statement connections for do input. * @param {?Blockly.RenderedConnection} elseStatementConnection Statement * connection for else input. */ reconnectChildBlocks_: (this: IfElseBlock, valueConnections: Blockly.Connection[], statementConnections: Blockly.Connection[], elseStatementConnection: Blockly.Connection) => void; reconnectValueConnection_: (this: IfElseBlock, i: number, valueConnections: Blockly.Connection[]) => void; }; export {};