Skip to main content

blockly v13.5.0

Classes​

ClassDescription
BlockClass for one block. Not normally called directly, workspace.newBlock() is preferred.
BlockFlyoutInflaterClass responsible for creating blocks for flyouts.
BlockSvgClass for a block's SVG representation. Not normally called directly, workspace.newBlock() is preferred.
ButtonFlyoutInflaterClass responsible for creating buttons for flyouts.
ComponentManagerManager for all items registered with the workspace.
ConnectionClass for a connection between blocks.
ConnectionCheckerClass for connection type checking logic.
ConnectionDBDatabase of connections. Connections are stored in order of their vertical component. This way connections in an area may be looked up quickly using a binary search.
ContextMenuRegistryClass for the registry of context menu items. This is intended to be a singleton. You should not create a new instance, and only access this class from ContextMenuRegistry.registry.
DeleteAreaAbstract class for a component that can delete a block or bubble that is dropped on top of it.
DragTargetAbstract class for a component with custom behaviour when a block or bubble is dragged over or dropped on top of it.
FieldAbstract class for an editable field.
UnattachedFieldErrorRepresents an error where the field is trying to access its block or information about its block before it has actually been attached to said block.
FieldCheckboxClass for a checkbox field.
FieldDropdownClass for an editable dropdown field.
FieldImageClass for an image on a block.
FieldLabelClass for a non-editable, non-serializable text field.
FieldLabelSerializableClass for a non-editable, serializable text field.
FieldNumberClass for an editable number field.
FieldTextInputClass for an editable text field.
FieldVariableClass for a variable's dropdown field.
FlyoutClass for a flyout.
FlyoutButtonClass for a button or label in the flyout.
HorizontalFlyoutClass for a flyout.
FlyoutItemRepresentation of an item displayed in a flyout.
FlyoutMetricsManagerCalculates metrics for a flyout's workspace. The metrics are mainly used to size scrollbars for the flyout.
FlyoutSeparatorRepresentation of a gap between elements in a flyout.
VerticalFlyoutClass for a flyout.
FocusManagerA per-page singleton that manages Blockly focus across one or more IFocusableTrees, and bidirectionally synchronizes this focus with the DOM.
CodeGeneratorClass for a code generator that translates the blocks into a language.
GestureClass for one gesture.
GridClass for a workspace's grid.
InputClass for an input with optional fields.
InsertionMarkerPreviewerDisplays visual "previews" of where a block will be connected if it is dropped.
KeyboardMoverClass responsible for coordinating keyboard-driven moves with the workspace and dragging system.
MoveIndicatorFour-way arrow indicator attached to a workspace element to indicate that it is being moved.
BlockNavigationPolicySet of rules controlling keyboard navigation from a block.
BubbleNavigationPolicySet of rules controlling keyboard navigation from a Bubble.
CommentBarButtonNavigationPolicySet of rules controlling keyboard navigation from a CommentBarButton.
CommentEditorNavigationPolicySet of rules controlling keyboard navigation from a comment editor. This is a no-op placeholder (other than isNavigable/isApplicable) since comment editors handle their own navigation when editing ends.
ConnectionNavigationPolicySet of rules controlling keyboard navigation from a connection.
FieldNavigationPolicySet of rules controlling keyboard navigation from a field.
FlyoutButtonNavigationPolicySet of rules controlling keyboard navigation from a flyout button.
FlyoutSeparatorNavigationPolicySet of rules controlling keyboard navigation from a flyout separator. This is a no-op placeholder, since flyout separators can't be navigated to.
IconNavigationPolicySet of rules controlling keyboard navigation from an icon.
ToolboxItemNavigationPolicySet of rules controlling keyboard navigation from a toolbox item.
WorkspaceCommentNavigationPolicySet of rules controlling keyboard navigation from an RenderedWorkspaceComment.
WorkspaceNavigationPolicySet of rules controlling keyboard navigation from a workspace.
FlyoutNavigatorNavigator that handles keyboard navigation within a flyout.
NavigatorClass responsible for determining where focus should move in response to keyboard navigation commands.
ToolboxNavigatorNavigator that handles keyboard navigation within a toolbox.
KeyboardNavigationControllerThe KeyboardNavigationController handles coordinating Blockly-wide keyboard navigation behavior, such as enabling/disabling full cursor visualization.
LabelFlyoutInflaterClass responsible for creating labels for flyouts.
MenuA basic menu class.
MenuItemClass representing an item in a menu.
MetricsManagerThe manager for all workspace metrics calculations.
NamesClass for a database of entity names (variables, procedures, etc).
OptionsParse the user-specified options, using reasonable defaults where behaviour is unspecified.
RenderedConnectionClass for a connection between blocks that may be rendered on screen.
ScrollbarClass for a pure SVG scrollbar. This technique offers a scrollbar that is guaranteed to work, but may not look or behave like the system's scrollbars.
ScrollbarPairClass for a pair of scrollbars. Horizontal and vertical.
SeparatorFlyoutInflaterClass responsible for creating separators for flyouts.
ShortcutRegistryClass for the registry of keyboard shortcuts. This is intended to be a singleton. You should not create a new instance, and only access this class from ShortcutRegistry.registry.
ThemeClass for a theme.
ThemeManagerClass for storing and updating a workspace's theme and UI components.
ToastClass that allows for showing and dismissing temporary notifications.
ToolboxCategoryClass for a category in a toolbox.
CollapsibleToolboxCategoryClass for a category in a toolbox that can be collapsed.
ToolboxSeparatorClass for a toolbox separator. This is the thin visual line that appears on the toolbox. This item is not interactable.
ToolboxClass for a Toolbox. Creates the toolbox's DOM.
ToolboxItemClass for an item in the toolbox.
TrashcanClass for a trash can.
FocusableTreeTraverserA helper utility for IFocusableTree implementations to aid with common tree traversals.
VariableMapClass for a variable map. This contains a dictionary data structure with variable types as keys and lists of variables as values. The list of variables are the type indicated by the key.
VariableModelClass for a variable model. Holds information for the variable including name, ID, and type.
WorkspaceClass for a workspace. This is a data structure that contains blocks. There is no UI, and can be created headlessly.
WorkspaceAudioClass for loading, storing, and playing audio for a workspace.
WorkspaceDraggerClass for a workspace dragger. It moves the workspace around when it is being dragged by a mouse or touch.
WorkspaceSvgClass for a workspace. This is an onscreen area with optional trashcan, scrollbars, bubbles, and dragging.
ZoomControlsClass for a zoom controls.

Enumerations​

EnumerationDescription
ConnectionTypeEnum for the type of a connection or input.
DragDisposition-
DirectionCardinal directions in which a move can proceed.
NavigationDirectionRepresentation of the direction of travel within a navigation context.

Functions​

FunctionDescription
hideChaffClose tooltips, context menus, dropdown selections, etc.
getFocusManagerConvenience function for FocusManager.getFocusManager.
injectInject a Blockly editor into the specified container element (usually a div).
isBoundedElementReturns whether or not the given object conforms to IBoundedElement.
isCopyableReturns true if the given object is an ICopyable.
isDeletableReturns whether the given object is an IDeletable.
isDraggableReturns whether the given object is an IDraggable or not.
hasBubbleType guard that checks whether the given object is a IHasBubble.
isIconType guard that checks whether the given object is an IIcon.
isPasterReturns true if the given object is a paster.
isRenderedElementReturns true if the given object is an IRenderedElement.
isSelectableChecks whether the given object is an ISelectable.
isSerializableType guard that checks whether the given object is a ISerializable.
isVariableBackedParameterModelReturns whether the given object is a variable holder or not.
navigateBlockReturns the next navigable item relative to the provided block child.
setLocaleSets the locale (i.e. the localized messages/block-text/etc) to the given locale.

Interfaces​

InterfaceDescription
BlocklyOptionsBlockly options.
FieldConfigExtra configuration options for the base field.
FieldCheckboxConfigConfig options for the checkbox field.
FieldCheckboxFromJsonConfigfromJson config options for the checkbox field.
ImagePropertiesDefinition of a human-readable image dropdown option.
FieldDropdownFromJsonConfigfromJson config for the dropdown field.
FieldImageConfigConfig options for the image field.
FieldImageFromJsonConfigfromJson config options for the image field.
FieldLabelConfigConfig options for the label field.
FieldLabelFromJsonConfigfromJson config options for the label field.
FieldNumberConfigConfig options for the number field.
FieldNumberFromJsonConfigfromJson config options for the number field.
FieldTextInputFromJsonConfigfromJson config options for the text input field.
FieldVariableConfigConfig options for the variable field.
FieldVariableFromJsonConfigfromJson config options for the variable field.
IAutoHideableInterface for a component that can be automatically hidden.
IBoundedElementA bounded element interface.
IBubbleA bubble interface.
ICollapsibleToolboxItemInterface for an item in the toolbox that can be collapsed.
IComponentThe interface for a workspace component that can be registered with the ComponentManager.
IConnectionCheckerClass for connection type checking logic.
IConnectionPreviewerDisplays visual "previews" of where a block will be connected if it is dropped.
IContextMenu-
ICopyableThe interface for an object that is selectable.
IDeletableThe interface for an object that can be deleted.
IDeleteAreaInterface for a component that can delete a block or bubble that is dropped on top of it.
IDragTargetInterface for a component with custom behaviour when a block or bubble is dragged over or dropped on top of it.
IDraggableRepresents an object that can be dragged.
IDragStrategy-
IDragger-
IFlyoutInterface for a flyout.
IFlyoutInflater-
IFocusableNodeRepresents anything that can have input focus.
IFocusableTreeRepresents a tree of focusable elements with its own active/passive focus context.
IHasBubble-
IIconRepresents anything that can have input focus.
JsonBlockDefinitionDefines the JSON structure for a block definition.
IKeyboardAccessibleAn interface for an object that handles keyboard shortcuts.
IMetricsManagerInterface for a metrics manager.
IMovableThe interface for an object that is movable.
INavigationPolicyA set of rules that specify where keyboard navigation should proceed.
IPasterAn object that can paste data into a workspace.
IPositionableInterface for a component that is positioned on top of the workspace.
IRegistrableThe interface for a Blockly component that can be registered.
IRenderedElement-
ISelectableThe interface for an object that is selectable.
ISelectableToolboxItemInterface for an item in the toolbox that can be selected.
ISerializable-
IStyleableInterface for an object that a style can be added to.
IToolboxInterface for a toolbox.
IToolboxItemInterface for an item in the toolbox.
IVariableBackedParameterModelInterface for a parameter model that holds a variable model.
IVariableMapVariable maps are container objects responsible for storing and managing the set of variables referenced on a workspace.
IVariableModel-
IVariableStateRepresents the state of a given variable.
ToastOptionsDisplay/configuration options for a toast notification.

Namespaces​

NamespaceDescription
Block-
browserEvents-
bubbles-
bumpObjects-
clipboard-
comments-
common-
ComponentManager-
constants-
ContextMenu-
ContextMenuItems-
ContextMenuRegistry-
Css-
dialog-
dragging-
Events-
Extensions-
fieldRegistry-
icons-
inputs-
ICopyable-
layers-
MetricsManager-
Names-
Options-
Procedures-
registry-
renderManagement-
RenderedConnection-
blockRendering-
geras-
thrasos-
zelos-
serialization-
ShortcutItems-
ShortcutRegistry-
Theme-
Themes-
ThemeManager-
ToolboxCategory-
CollapsibleToolboxCategory-
ToolboxSeparator-
Tooltip-
Touch-
utils-
Variables-
VariablesDynamic-
WidgetDiv-
Xml-

Variables​

VariableDescription
VERSIONBlockly core version. This constant is overridden by the build script (npm run build) to the value of the version in package.json. This is done by the Closure Compiler in the buildCompiled task.
INPUT_VALUE-
OUTPUT_VALUE-
NEXT_STATEMENT-
PREVIOUS_STATEMENT-
TOOLBOX_AT_TOP-
TOOLBOX_AT_BOTTOM-
TOOLBOX_AT_LEFT-
TOOLBOX_AT_RIGHT-
svgResizeSize the SVG image to completely fill its container. Call this when the view actually changes sizes (e.g. on a window resize/device orientation change). See workspace.resizeContents to resize the workspace when the contents change (e.g. when a block is added or removed). Record the height/width of the SVG image.
getMainWorkspaceReturns the main workspace. Returns the last used main workspace (based on focus). Try not to use this function, particularly if there are multiple Blockly instances on a page.
getSelectedReturns the currently selected copyable object.
defineBlocksWithJsonArrayDefine blocks from an array of JSON block definitions, as might be generated by the Blockly Developer Tools.
setParentContainerSet the parent container. This is the container element that the WidgetDiv, dropDownDiv, and Tooltip are rendered into the first time Blockly.inject is called. This method is a NOP if called after the first Blockly.inject.
COLLAPSE_CHARS-
OPPOSITE_TYPE-
RENAME_VARIABLE_ID-
DELETE_VARIABLE_ID-
COLLAPSED_INPUT_NAME-
COLLAPSED_FIELD_NAME-
VARIABLE_CATEGORY_NAMEString for use in the "custom" attribute of a category in toolbox XML. This string indicates that the category should be dynamically populated with variable blocks.
VARIABLE_DYNAMIC_CATEGORY_NAMEString for use in the "custom" attribute of a category in toolbox XML. This string indicates that the category should be dynamically populated with variable blocks.
PROCEDURE_CATEGORY_NAMEString for use in the "custom" attribute of a category in toolbox XML. This string indicates that the category should be dynamically populated with procedure blocks.
DropDownDiv-
BlocksA mapping of block type names to block prototype objects.
configObject holding all the values on Blockly that we expect developers to be able to change.
keyboardNavigationControllerSingleton instance of the keyboard navigation controller.
MsgA dictionary of localised messages.

Type Aliases​

Type AliasDescription
FieldValidatorA function that is called to validate changes to the field's value before they are set.
FieldCheckboxValidatorA function that is called to validate changes to the field's value before they are set.
MenuOptionAn individual option in the dropdown menu. Can be either the string literal separator for a menu separator item, or an array for normal action menu items. In the latter case, the first element is the human-readable value (text, ImageProperties object, or HTML element), and the second element is the language-neutral value.
MenuGeneratorFunctionA function that generates an array of menu options for FieldDropdown or its descendants.
MenuGeneratorEither an array of menu options or a function that generates an array of menu options for FieldDropdown or its descendants.
FieldDropdownConfigConfig options for the dropdown field.
FieldDropdownValidatorA function that is called to validate changes to the field's value before they are set.
FieldNumberValidatorA function that is called to validate changes to the field's value before they are set.
FieldTextInputConfigConfig options for the text input field.
FieldTextInputValidatorA function that is called to validate changes to the field's value before they are set.
FieldVariableValidatorA function that is called to validate changes to the field's value before they are set.
ReturnEphemeralFocusType declaration for returning focus to FocusManager upon completing an ephemeral UI flow (such as a dialog). Normally, the FocusManager will refocus the previously-focused element. If callers do not wish for the FocusManager to do so, they may call this method with restoreFocus set to false to prevent automatic refocusing and leave focus where it is.
ICopyData-
JsonBlockArg-

References​

procedures​

Renames and re-exports Procedures


Generator​

Renames and re-exports CodeGenerator