Add namespace and alias annotations to jsdoc (#5550)

* Add annotations to files under core/events

* Add annotations to files under core/interfaces

* Add annotations to files under core/keyboard_nav

* Add annotations to files under core/renderers

* Add annotations to files under core/serialization

* Add annotations to files under core/theme

* Add annotations to files under core/toolbox

* Add annotations to files under core/utils

* Add annotations to files under core
This commit is contained in:
Monica Kozbial
2021-09-27 14:42:54 -07:00
committed by GitHub
parent 839cb7bef1
commit d8fbe1b05b
252 changed files with 1533 additions and 129 deletions

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* The class representing one block.
* @namespace Blockly.Block
*/
goog.module('Blockly.Block');
/* eslint-disable-next-line no-unused-vars */
@@ -67,6 +71,7 @@ goog.require('Blockly.Events.BlockMove');
* @implements {IASTNodeLocation}
* @implements {IDeletable}
* @throws When the prototypeName is not valid or not allowed.
* @alias Blockly.Block
*/
const Block = function(workspace, prototypeName, opt_id) {
const Generator = goog.module.get('Blockly.Generator');

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Methods animating a block on connection and disconnection.
* @namespace Blockly.blockAnimations
*/
goog.module('Blockly.blockAnimations');
const Svg = goog.require('Blockly.utils.Svg');
@@ -33,6 +37,7 @@ let disconnectGroup = null;
/**
* Play some UI effects (sound, animation) when disposing of a block.
* @param {!BlockSvg} block The block being disposed of.
* @alias Blockly.blockAnimations.disposeUiEffect
*/
const disposeUiEffect = function(block) {
const workspace = block.workspace;
@@ -83,6 +88,7 @@ const disposeUiStep = function(clone, rtl, start, workspaceScale) {
/**
* Play some UI effects (sound, ripple) after a connection has been established.
* @param {!BlockSvg} block The block being connected.
* @alias Blockly.blockAnimations.connectionUiEffect
*/
const connectionUiEffect = function(block) {
const workspace = block.workspace;
@@ -138,6 +144,7 @@ const connectionUiStep = function(ripple, start, scale) {
/**
* Play some UI effects (sound, animation) when disconnecting a block.
* @param {!BlockSvg} block The block being disconnected.
* @alias Blockly.blockAnimations.disconnectUiEffect
*/
const disconnectUiEffect = function(block) {
block.workspace.getAudioManager().play('disconnect');
@@ -185,6 +192,7 @@ const disconnectUiStep = function(group, magnitude, start) {
/**
* Stop the disconnect UI animation immediately.
* @alias Blockly.blockAnimations.disconnectUiStop
*/
const disconnectUiStop = function() {
if (disconnectGroup) {

View File

@@ -16,6 +16,15 @@
'use strict';
/**
* A class that manages a surface for dragging blocks. When a
* block drag is started, we move the block (and children) to a separate DOM
* element that we move around using translate3d. At the end of the drag, the
* blocks are put back in into the SVG they came from. This helps
* performance by avoiding repainting the entire SVG on every mouse move
* while dragging blocks.
* @namespace Blockly.BlockDragSurfaceSvg
*/
goog.module('Blockly.BlockDragSurfaceSvg');
const Coordinate = goog.require('Blockly.utils.Coordinate');
@@ -29,6 +38,7 @@ const utils = goog.require('Blockly.utils');
* SVG that contains only the currently moving block, or nothing.
* @param {!Element} container Containing element.
* @constructor
* @alias Blockly.BlockDragSurfaceSvg
*/
const BlockDragSurfaceSvg = function(container) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Methods for dragging a block visually.
* @namespace Blockly.BlockDragger
*/
goog.module('Blockly.BlockDragger');
const Coordinate = goog.require('Blockly.utils.Coordinate');
@@ -41,6 +45,7 @@ goog.require('Blockly.Events.BlockMove');
* @param {!WorkspaceSvg} workspace The workspace to drag on.
* @constructor
* @implements {IBlockDragger}
* @alias Blockly.BlockDragger
*/
const BlockDragger = function(block, workspace) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Methods for graphically rendering a block as SVG.
* @namespace Blockly.BlockSvg
*/
goog.module('Blockly.BlockSvg');
/* eslint-disable-next-line no-unused-vars */
@@ -89,6 +93,7 @@ goog.require('Blockly.Touch');
* @implements {ICopyable}
* @implements {IDraggable}
* @constructor
* @alias Blockly.BlockSvg
*/
const BlockSvg = function(workspace, prototypeName, opt_id) {
// Create core elements for the block.

View File

@@ -5,7 +5,7 @@
*/
/**
* @fileoverview Core JavaScript library for Blockly.
* @fileoverview The top level namespace used to access the Blockly library.
* @author fraser@google.com (Neil Fraser)
*/
'use strict';

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Object that defines user-specified options for the workspace.
* @namespace Blockly.BlocklyOptions
*/
goog.module('Blockly.BlocklyOptions');
@@ -18,6 +22,7 @@ goog.module('Blockly.BlocklyOptions');
* This interface is further described in
* `typings/parts/blockly-interfaces.d.ts`.
* @interface
* @alias Blockly.BlocklyOptions
*/
const BlocklyOptions = function() {};

View File

@@ -12,7 +12,7 @@
/**
* A mapping of block type names to block prototype objects.
* @name Blockly.Blocks
* @namespace Blockly.blocks
*/
goog.module('Blockly.blocks');
@@ -20,6 +20,7 @@ goog.module('Blockly.blocks');
/**
* A mapping of block type names to block prototype objects.
* @type {!Object<string,!Object>}
* @alias Blockly.blocks.Blocks
*/
const Blocks = Object.create(null);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Browser event handling.
* @namespace Blockly.browserEvents
*/
goog.module('Blockly.browserEvents');
const Touch = goog.require('Blockly.Touch');
@@ -22,6 +26,7 @@ const userAgent = goog.require('Blockly.utils.userAgent');
* Blockly opaque event data used to unbind events when using
* `bind` and `conditionalBind`.
* @typedef {!Array<!Array>}
* @alias Blockly.browserEvents.Data
*/
let Data;
exports.Data = Data;
@@ -44,6 +49,7 @@ exports.Data = Data;
* provided.
* @return {!Data} Opaque data that can be passed to
* unbindEvent_.
* @alias Blockly.browserEvents.conditionalBind
*/
const conditionalBind = function(
node, name, thisObject, func, opt_noCaptureIdentifier,
@@ -114,6 +120,7 @@ exports.conditionalBind = conditionalBind;
* @param {!Function} func Function to call when event is triggered.
* @return {!Data} Opaque data that can be passed to
* unbindEvent_.
* @alias Blockly.browserEvents.bind
*/
const bind = function(node, name, thisObject, func) {
const wrapFunc = function(e) {
@@ -166,6 +173,7 @@ exports.bind = bind;
* @param {!Data} bindData Opaque data from bindEvent_.
* This list is emptied during the course of calling this function.
* @return {!Function} The function call.
* @alias Blockly.browserEvents.unbind
*/
const unbind = function(bindData) {
let func;
@@ -184,6 +192,7 @@ exports.unbind = unbind;
* Returns true if this event is targeting a text input widget?
* @param {!Event} e An event.
* @return {boolean} True if text input.
* @alias Blockly.browserEvents.isTargetInput
*/
const isTargetInput = function(e) {
return e.target.type == 'textarea' || e.target.type == 'text' ||
@@ -199,6 +208,7 @@ exports.isTargetInput = isTargetInput;
* Returns true this event is a right-click.
* @param {!Event} e Mouse event.
* @return {boolean} True if right-click.
* @alias Blockly.browserEvents.isRightButton
*/
const isRightButton = function(e) {
if (e.ctrlKey && userAgent.MAC) {
@@ -217,6 +227,7 @@ exports.isRightButton = isRightButton;
* @param {!Element} svg SVG element.
* @param {?SVGMatrix} matrix Inverted screen CTM to use.
* @return {!SVGPoint} Object with .x and .y properties.
* @alias Blockly.browserEvents.mouseToSvg
*/
const mouseToSvg = function(e, svg, matrix) {
const svgPoint = svg.createSVGPoint();
@@ -235,6 +246,7 @@ exports.mouseToSvg = mouseToSvg;
* @param {!Event} e Mouse event.
* @return {{x: number, y: number}} Scroll delta object with .x and .y
* properties.
* @alias Blockly.browserEvents.getScrollDeltaPixels
*/
const getScrollDeltaPixels = function(e) {
switch (e.deltaMode) {

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Object representing a UI bubble.
* @namespace Blockly.Bubble
*/
goog.module('Blockly.Bubble');
const Coordinate = goog.require('Blockly.utils.Coordinate');
@@ -47,6 +51,7 @@ goog.require('Blockly.Workspace');
* @param {?number} bubbleHeight Height of bubble, or null if not resizable.
* @implements {IBubble}
* @constructor
* @alias Blockly.Bubble
*/
const Bubble = function(
workspace, content, shape, anchorXY, bubbleWidth, bubbleHeight) {

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Methods for dragging a bubble visually.
* @namespace Blockly.BubbleDragger
*/
goog.module('Blockly.BubbleDragger');
const ComponentManager = goog.require('Blockly.ComponentManager');
@@ -43,6 +47,7 @@ goog.require('Blockly.constants');
* @param {!IBubble} bubble The item on the bubble canvas to drag.
* @param {!WorkspaceSvg} workspace The workspace to drag on.
* @constructor
* @alias Blockly.BubbleDragger
*/
const BubbleDragger = function(bubble, workspace) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Utilities for bumping objects back into worksapce bounds.
* @namespace Blockly.bumpObjects
*/
goog.module('Blockly.bumpObjects');
/* eslint-disable-next-line no-unused-vars */
@@ -37,6 +41,7 @@ const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
* in workspace coordinates.
* @param {!IBoundedElement} object The object to bump.
* @return {boolean} True if block was bumped.
* @alias Blockly.bumpObjects.bumpIntoBounds
*/
const bumpObjectIntoBounds = function(workspace, scrollMetrics, object) {
// Compute new top/left position for object.
@@ -85,6 +90,7 @@ exports.bumpIntoBounds = bumpObjectIntoBounds;
* Creates a handler for bumping objects when they cross fixed bounds.
* @param {!WorkspaceSvg} workspace The workspace to handle.
* @return {function(Abstract)} The event handler.
* @alias Blockly.bumpObjects.bumpIntoBoundsHandler
*/
const bumpIntoBoundsHandler = function(workspace) {
return function(e) {
@@ -158,6 +164,7 @@ const extractObjectFromEvent = function(workspace, e) {
/**
* Bumps the top objects in the given workspace into bounds.
* @param {!WorkspaceSvg} workspace The workspace.
* @alias Blockly.bumpObjects.bumpTopObjectsIntoBounds
*/
const bumpTopObjectsIntoBounds = function(workspace) {
const metricsManager = workspace.getMetricsManager();

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Blockly's internal clipboard for managing copy-paste.
* @namespace Blockly.clipboard
*/
goog.module('Blockly.clipboard');
/* eslint-disable-next-line no-unused-vars */
@@ -26,6 +30,7 @@ let copyData = null;
/**
* Copy a block or workspace comment onto the local clipboard.
* @param {!ICopyable} toCopy Block or Workspace Comment to be copied.
* @alias Blockly.clipboard.copy
*/
const copy = function(toCopy) {
copyData = toCopy.toCopyData();
@@ -36,6 +41,7 @@ exports.copy = copy;
/**
* Paste a block or workspace comment on to the main workspace.
* @return {boolean} True if the paste was successful, false otherwise.
* @alias Blockly.clipboard.paste
*/
const paste = function() {
if (!copyData) {
@@ -63,6 +69,7 @@ exports.paste = paste;
* Duplicate this block and its children, or a workspace comment.
* @param {!ICopyable} toDuplicate Block or Workspace Comment to be
* duplicated.
* @alias Blockly.clipboard.duplicate
*/
const duplicate = function(toDuplicate) {
const oldCopyData = copyData;

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Object representing a code comment.
* @namespace Blockly.Comment
*/
goog.module('Blockly.Comment');
const Bubble = goog.require('Blockly.Bubble');
@@ -44,6 +48,7 @@ goog.require('Blockly.Warning');
* @param {!Block} block The block associated with this comment.
* @extends {Icon}
* @constructor
* @alias Blockly.Comment
*/
const Comment = function(block) {
Comment.superClass_.constructor.call(this, block);

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* Common functions used both internally and externally, but which
* must not be at the top level to avoid circular dependencies.
* @namespace Blockly.common
*/
goog.module('Blockly.common');
/* eslint-disable-next-line no-unused-vars */
@@ -35,6 +40,7 @@ let mainWorkspace;
* this function, particularly if there are multiple Blockly instances on a
* page.
* @return {!Workspace} The main workspace.
* @alias Blockly.common.getMainWorkspace
*/
const getMainWorkspace = function() {
return mainWorkspace;
@@ -44,6 +50,7 @@ exports.getMainWorkspace = getMainWorkspace;
/**
* Sets last used main workspace.
* @param {!Workspace} workspace The most recently used top level workspace.
* @alias Blockly.common.setMainWorkspace
*/
const setMainWorkspace = function(workspace) {
mainWorkspace = workspace;
@@ -59,6 +66,7 @@ let selected = null;
/**
* Returns the currently selected block.
* @return {?ICopyable} The currently selected block.
* @alias Blockly.common.getSelected
*/
const getSelected = function() {
return selected;
@@ -68,6 +76,7 @@ exports.getSelected = getSelected;
/**
* Sets the currently selected block.
* @param {?ICopyable} newSelection The newly selected block.
* @alias Blockly.common.setSelected
*/
const setSelected = function(newSelection) {
selected = newSelection;
@@ -84,6 +93,7 @@ let parentContainer;
* Get the container element in which to render the WidgetDiv, DropDownDiv and\
* Tooltip.
* @return {?Element} The parent container.
* @alias Blockly.common.getParentContainer
*/
const getParentContainer = function() {
return parentContainer;
@@ -96,6 +106,7 @@ exports.getParentContainer = getParentContainer;
* is called.
* This method is a NOP if called after the first ``Blockly.inject``.
* @param {!Element} newParent The container element.
* @alias Blockly.common.setParentContainer
*/
const setParentContainer = function(newParent) {
parentContainer = newParent;
@@ -109,6 +120,7 @@ exports.setParentContainer = setParentContainer;
* change (e.g. when a block is added or removed).
* Record the height/width of the SVG image.
* @param {!WorkspaceSvg} workspace Any workspace in the SVG.
* @alias Blockly.common.svgResize
*/
const svgResize = function(workspace) {
let mainWorkspace = workspace;

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* Manager for all items registered with the workspace.
* @namespace Blockly.ComponentManager
*/
goog.module('Blockly.ComponentManager');
/* eslint-disable-next-line no-unused-vars */
@@ -29,6 +33,7 @@ const utils = goog.require('Blockly.utils');
/**
* Manager for all items registered with the workspace.
* @constructor
* @alias Blockly.ComponentManager
*/
const ComponentManager = function() {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Components for creating connections between blocks.
* @namespace Blockly.Connection
*/
goog.module('Blockly.Connection');
/* eslint-disable-next-line no-unused-vars */
@@ -37,6 +41,7 @@ goog.require('Blockly.Events.BlockMove');
* @param {number} type The type of the connection.
* @constructor
* @implements {IASTNodeLocationWithBlock}
* @alias Blockly.Connection
*/
const Connection = function(source, type) {
/**

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* An object that encapsulates logic for checking whether a
* potential connection is safe and valid.
* @namespace Blockly.ConnectionChecker
*/
goog.module('Blockly.ConnectionChecker');
const Connection = goog.require('Blockly.Connection');
@@ -28,6 +33,7 @@ const {ConnectionType} = goog.require('Blockly.ConnectionType');
* Class for connection type checking logic.
* @implements {IConnectionChecker}
* @constructor
* @alias Blockly.ConnectionChecker
*/
const ConnectionChecker = function() {};

View File

@@ -12,6 +12,12 @@
*/
'use strict';
/**
* A database of all the rendered connections that could
* possibly be connected to (i.e. not collapsed, etc).
* Sorted by y coordinate.
* @namespace Blockly.ConnectionDB
*/
goog.module('Blockly.ConnectionDB');
/* eslint-disable-next-line no-unused-vars */
@@ -33,6 +39,7 @@ goog.require('Blockly.constants');
* connection type checker, used to decide if connections are valid during a
* drag.
* @constructor
* @alias Blockly.ConnectionDB
*/
const ConnectionDB = function(checker) {
/**

View File

@@ -11,12 +11,17 @@
'use strict';
/**
* An enum for the possible types of connections.
* @namespace Blockly.ConnectionType
*/
goog.module('Blockly.ConnectionType');
/**
* Enum for the type of a connection or input.
* @enum {number}
* @alias Blockly.ConnectionType
*/
const ConnectionType = {
// A right-facing value input. E.g. 'set item to' or 'return'.

View File

@@ -10,12 +10,17 @@
*/
'use strict';
/**
* Blockly constants.
* @namespace Blockly.constants
*/
goog.module('Blockly.constants');
/**
* Enum for alignment of inputs.
* @enum {number}
* @alias Blockly.constants.ALIGN
*/
const ALIGN = {
LEFT: -1,
@@ -27,6 +32,7 @@ exports.ALIGN = ALIGN;
/**
* The language-neutral ID given to the collapsed input.
* @const {string}
* @alias Blockly.constants.COLLAPSED_INPUT_NAME
*/
const COLLAPSED_INPUT_NAME = '_TEMP_COLLAPSED_INPUT';
exports.COLLAPSED_INPUT_NAME = COLLAPSED_INPUT_NAME;
@@ -34,6 +40,7 @@ exports.COLLAPSED_INPUT_NAME = COLLAPSED_INPUT_NAME;
/**
* The language-neutral ID given to the collapsed field.
* @const {string}
* @alias Blockly.constants.COLLAPSED_FIELD_NAME
*/
const COLLAPSED_FIELD_NAME = '_TEMP_COLLAPSED_FIELD';
exports.COLLAPSED_FIELD_NAME = COLLAPSED_FIELD_NAME;

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Functionality for the right-click context menus.
* @namespace Blockly.ContextMenu
*/
goog.module('Blockly.ContextMenu');
/* eslint-disable-next-line no-unused-vars */
@@ -47,6 +51,7 @@ let currentBlock = null;
/**
* Gets the block the context menu is currently attached to.
* @return {?Block} The block the context menu is attached to.
* @alias Blockly.ContextMenu.getCurrentBlock
*/
const getCurrentBlock = function() {
return currentBlock;
@@ -56,6 +61,7 @@ exports.getCurrentBlock = getCurrentBlock;
/**
* Sets the block the context menu is currently attached to.
* @param {?Block} block The block the context menu is attached to.
* @alias Blockly.ContextMenu.setCurrentBlock
*/
const setCurrentBlock = function(block) {
currentBlock = block;
@@ -91,6 +97,7 @@ let menu_ = null;
* @param {!Event} e Mouse event.
* @param {!Array<!Object>} options Array of menu options.
* @param {boolean} rtl True if RTL, false if LTR.
* @alias Blockly.ContextMenu.show
*/
const show = function(e, options, rtl) {
WidgetDiv.show(exports, rtl, dispose);
@@ -215,6 +222,7 @@ const haltPropagation = function(e) {
/**
* Hide the context menu.
* @alias Blockly.ContextMenu.hide
*/
const hide = function() {
WidgetDiv.hideIfOwner(exports);
@@ -224,6 +232,7 @@ exports.hide = hide;
/**
* Dispose of the menu.
* @alias Blockly.ContextMenu.dispose
*/
const dispose = function() {
if (menu_) {
@@ -239,6 +248,7 @@ exports.dispose = dispose;
* @param {!Block} block Original block.
* @param {!Element} xml XML representation of new block.
* @return {!Function} Function that creates a block.
* @alias Blockly.ContextMenu.callbackFactory
*/
const callbackFactory = function(block, xml) {
return function() {
@@ -273,6 +283,7 @@ exports.callbackFactory = callbackFactory;
* @param {!WorkspaceCommentSvg} comment The workspace comment where the
* right-click originated.
* @return {!Object} A menu option, containing text, enabled, and a callback.
* @alias Blockly.ContextMenu.commentDeleteOption
*/
const commentDeleteOption = function(comment) {
const deleteOption = {
@@ -294,6 +305,7 @@ exports.commentDeleteOption = commentDeleteOption;
* @param {!WorkspaceCommentSvg} comment The workspace comment where the
* right-click originated.
* @return {!Object} A menu option, containing text, enabled, and a callback.
* @alias Blockly.ContextMenu.commentDuplicateOption
*/
const commentDuplicateOption = function(comment) {
const duplicateOption = {
@@ -317,6 +329,7 @@ exports.commentDuplicateOption = commentDuplicateOption;
* @package
* @suppress {strictModuleDepCheck,checkTypes} Suppress checks while workspace
* comments are not bundled in.
* @alias Blockly.ContextMenu.workspaceCommentOption
*/
const workspaceCommentOption = function(ws, e) {
const WorkspaceCommentSvg = goog.module.get('Blockly.WorkspaceCommentSvg');

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Registers default context menu items.
* @namespace Blockly.ContextMenuItems
*/
goog.module('Blockly.ContextMenuItems');
const ContextMenuRegistry = goog.require('Blockly.ContextMenuRegistry');
@@ -26,7 +30,10 @@ const userAgent = goog.require('Blockly.utils.userAgent');
const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
/** Option to undo previous action. */
/**
* Option to undo previous action.
* @alias Blockly.ContextMenuItems.registerUndo
*/
const registerUndo = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const undoOption = {
@@ -52,7 +59,10 @@ const registerUndo = function() {
};
exports.registerUndo = registerUndo;
/** Option to redo previous action. */
/**
* Option to redo previous action.
* @alias Blockly.ContextMenuItems.registerRedo
*/
const registerRedo = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const redoOption = {
@@ -78,7 +88,10 @@ const registerRedo = function() {
};
exports.registerRedo = registerRedo;
/** Option to clean up blocks. */
/**
* Option to clean up blocks.
* @alias Blockly.ContextMenuItems.registerCleanup
*/
const registerCleanup = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const cleanOption = {
@@ -126,7 +139,10 @@ const toggleOption_ = function(shouldCollapse, topBlocks) {
}
};
/** Option to collapse all blocks. */
/**
* Option to collapse all blocks.
* @alias Blockly.ContextMenuItems.registerCollapse
*/
const registerCollapse = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const collapseOption = {
@@ -162,7 +178,10 @@ const registerCollapse = function() {
};
exports.registerCollapse = registerCollapse;
/** Option to expand all blocks. */
/**
* Option to expand all blocks.
* @alias Blockly.ContextMenuItems.registerExpand
*/
const registerExpand = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const expandOption = {
@@ -255,7 +274,10 @@ const deleteNext_ = function(deleteList, eventGroup) {
eventUtils.setGroup(false);
};
/** Option to delete all blocks. */
/**
* Option to delete all blocks.
* @alias Blockly.ContextMenuItems.registerDeleteAll
*/
const registerDeleteAll = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const deleteOption = {
@@ -321,7 +343,10 @@ const registerWorkspaceOptions_ = function() {
registerDeleteAll();
};
/** Option to duplicate a block. */
/**
* Option to duplicate a block.
* @alias Blockly.ContextMenuItems.registerDuplicate
*/
const registerDuplicate = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const duplicateOption = {
@@ -353,7 +378,10 @@ const registerDuplicate = function() {
};
exports.registerDuplicate = registerDuplicate;
/** Option to add or remove block-level comment. */
/**
* Option to add or remove block-level comment.
* @alias Blockly.ContextMenuItems.registerComment
*/
const registerComment = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const commentOption = {
@@ -394,7 +422,10 @@ const registerComment = function() {
};
exports.registerComment = registerComment;
/** Option to inline variables. */
/**
* Option to inline variables.
* @alias Blockly.ContextMenuItems.registerInline
*/
const registerInline = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const inlineOption = {
@@ -430,7 +461,10 @@ const registerInline = function() {
};
exports.registerInline = registerInline;
/** Option to collapse or expand a block. */
/**
* Option to collapse or expand a block.
* @alias Blockly.ContextMenuItems.registerCollapseExpandBlock
*/
const registerCollapseExpandBlock = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const collapseExpandOption = {
@@ -460,7 +494,10 @@ const registerCollapseExpandBlock = function() {
};
exports.registerCollapseExpandBlock = registerCollapseExpandBlock;
/** Option to disable or enable a block. */
/**
* Option to disable or enable a block.
* @alias Blockly.ContextMenuItems.registerDisable
*/
const registerDisable = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const disableOption = {
@@ -501,7 +538,10 @@ const registerDisable = function() {
};
exports.registerDisable = registerDisable;
/** Option to delete a block. */
/**
* Option to delete a block.
* @alias Blockly.ContextMenuItems.registerDelete
*/
const registerDelete = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const deleteOption = {
@@ -540,7 +580,10 @@ const registerDelete = function() {
};
exports.registerDelete = registerDelete;
/** Option to open help for a block. */
/**
* Option to open help for a block.
* @alias Blockly.ContextMenuItems.registerHelp
*/
const registerHelp = function() {
/** @type {!ContextMenuRegistry.RegistryItem} */
const helpOption = {
@@ -587,6 +630,7 @@ const registerBlockOptions_ = function() {
* Registers all default context menu items. This should be called once per
* instance of ContextMenuRegistry.
* @package
* @alias Blockly.ContextMenuItems.registerDefaultOptions
*/
const registerDefaultOptions = function() {
registerWorkspaceOptions_();

View File

@@ -11,8 +11,8 @@
'use strict';
/**
* @name ContextMenuRegistry
* @namespace
* Registry for context menu option items.
* @namespace Blockly.ContextMenuRegistry
*/
goog.module('Blockly.ContextMenuRegistry');
@@ -28,6 +28,7 @@ const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
* from ContextMenuRegistry.registry.
* @constructor
* @private
* @alias Blockly.ContextMenuRegistry
*/
const ContextMenuRegistry = function() {
// Singleton instance should be registered once.

View File

@@ -11,8 +11,8 @@
'use strict';
/**
* @name Blockly.Css
* @namespace
* Inject Blockly's CSS synchronously.
* @namespace Blockly.Css
*/
goog.module('Blockly.Css');

View File

@@ -12,6 +12,11 @@
'use strict';
/**
* The abstract class for a component that can delete a block or
* bubble that is dropped on top of it.
* @namespace Blockly.DeleteArea
*/
goog.module('Blockly.DeleteArea');
const DragTarget = goog.require('Blockly.DragTarget');
@@ -29,6 +34,7 @@ const {BlockSvg} = goog.require('Blockly.BlockSvg');
* @extends {DragTarget}
* @implements {IDeleteArea}
* @constructor
* @alias Blockly.DeleteArea
*/
const DeleteArea = function() {
DeleteArea.superClass_.constructor.call(this);

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* Wrapper functions around JS functions for showing alert/confirmation dialogs.
* @namespace Blockly.dialog
*/
goog.module('Blockly.dialog');
let alertImplementation = function(message, opt_callback) {
@@ -33,6 +37,7 @@ let promptImplementation = function(message, defaultValue, callback) {
* provide alternatives to the modal browser window.
* @param {string} message The message to display to the user.
* @param {function()=} opt_callback The callback when the alert is dismissed.
* @alias Blockly.dialog.alert
*/
const alert = function(message, opt_callback) {
alertImplementation(message, opt_callback);
@@ -43,6 +48,7 @@ exports.alert = alert;
* Sets the function to be run when Blockly.dialog.alert() is called.
* @param {!function(string, function()=)} alertFunction The function to be run.
* @see Blockly.dialog.alert
* @alias Blockly.dialog.setAlert
*/
const setAlert = function(alertFunction) {
alertImplementation = alertFunction;
@@ -54,6 +60,7 @@ exports.setAlert = setAlert;
* to provide alternatives to the modal browser window.
* @param {string} message The message to display to the user.
* @param {!function(boolean)} callback The callback for handling user response.
* @alias Blockly.dialog.confirm
*/
const confirm = function(message, callback) {
confirmImplementation(message, callback);
@@ -65,6 +72,7 @@ exports.confirm = confirm;
* @param {!function(string, !function(boolean))} confirmFunction The function
* to be run.
* @see Blockly.dialog.confirm
* @alias Blockly.dialog.setConfirm
*/
const setConfirm = function(confirmFunction) {
confirmImplementation = confirmFunction;
@@ -79,6 +87,7 @@ exports.setConfirm = setConfirm;
* @param {string} message The message to display to the user.
* @param {string} defaultValue The value to initialize the prompt with.
* @param {!function(?string)} callback The callback for handling user response.
* @alias Blockly.dialog.prompt
*/
const prompt = function(message, defaultValue, callback) {
promptImplementation(message, defaultValue, callback);
@@ -90,6 +99,7 @@ exports.prompt = prompt;
* @param {!function(string, string, !function(?string))} promptFunction The
* function to be run.
* @see Blockly.dialog.prompt
* @alias Blockly.dialog.setPrompt
*/
const setPrompt = function(promptFunction) {
promptImplementation = promptFunction;

View File

@@ -12,6 +12,11 @@
'use strict';
/**
* The abstract class for a component with custom behaviour when a
* block or bubble is dragged over or dropped on top of it.
* @namespace Blockly.DragTarget
*/
goog.module('Blockly.DragTarget');
/* eslint-disable-next-line no-unused-vars */
@@ -27,6 +32,7 @@ const Rect = goog.requireType('Blockly.utils.Rect');
* is dragged over or dropped on top of it.
* @implements {IDragTarget}
* @constructor
* @alias Blockly.DragTarget
*/
const DragTarget = function() {};

View File

@@ -13,6 +13,10 @@
'use strict';
/**
* A div that floats on top of the workspace, for drop-down menus.
* @namespace Blockly.DropDownDiv
*/
goog.module('Blockly.DropDownDiv');
const Rect = goog.require('Blockly.utils.Rect');
@@ -34,6 +38,7 @@ const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
* Class for drop-down div.
* @constructor
* @package
* @alias Blockly.DropDownDiv
*/
const DropDownDiv = function() {};

View File

@@ -6,11 +6,16 @@
/**
* @fileoverview Abstract class for events fired as a result of actions in
* Blockly's editor.
* Blockly's editor.
* @author fraser@google.com (Neil Fraser)
*/
'use strict';
/**
* Abstract class for events fired as a result of actions in
* Blockly's editor.
* @namespace Blockly.Events.Abstract
*/
goog.module('Blockly.Events.Abstract');
const eventUtils = goog.require('Blockly.Events.utils');
@@ -21,6 +26,7 @@ const Workspace = goog.requireType('Blockly.Workspace');
/**
* Abstract class for an event.
* @constructor
* @alias Blockly.Events.Abstract
*/
const Abstract = function() {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Base class for all types of block events.
* @namespace Blockly.Events.BlockBase
*/
goog.module('Blockly.Events.BlockBase');
const Abstract = goog.require('Blockly.Events.Abstract');
@@ -24,6 +28,7 @@ const {Block} = goog.requireType('Blockly.Block');
* Undefined for a blank event.
* @extends {Abstract}
* @constructor
* @alias Blockly.Events.BlockBase
*/
const BlockBase = function(opt_block) {
BlockBase.superClass_.constructor.call(this);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for a block change event.
* @namespace Blockly.Events.BlockChange
*/
goog.module('Blockly.Events.BlockChange');
const BlockBase = goog.require('Blockly.Events.BlockBase');
@@ -33,6 +37,7 @@ const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
* @param {*=} opt_newValue New value of element.
* @extends {BlockBase}
* @constructor
* @alias Blockly.Events.BlockChange
*/
const BlockChange = function(
opt_block, opt_element, opt_name, opt_oldValue, opt_newValue) {

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for a block creation event.
* @namespace Blockly.Events.BlockCreate
*/
goog.module('Blockly.Events.BlockCreate');
const BlockBase = goog.require('Blockly.Events.BlockBase');
@@ -28,6 +32,7 @@ const {Block} = goog.requireType('Blockly.Block');
* event.
* @extends {BlockBase}
* @constructor
* @alias Blockly.Events.BlockCreate
*/
const BlockCreate = function(opt_block) {
BlockCreate.superClass_.constructor.call(this, opt_block);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for a block delete event.
* @namespace Blockly.Events.BlockDelete
*/
goog.module('Blockly.Events.BlockDelete');
const BlockBase = goog.require('Blockly.Events.BlockBase');
@@ -28,6 +32,7 @@ const {Block} = goog.requireType('Blockly.Block');
* event.
* @extends {BlockBase}
* @constructor
* @alias Blockly.Events.BlockDelete
*/
const BlockDelete = function(opt_block) {
BlockDelete.superClass_.constructor.call(this, opt_block);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a block drag.
* @namespace Blockly.Events.BlockDrag
*/
goog.module('Blockly.Events.BlockDrag');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -30,6 +34,7 @@ const {Block} = goog.requireType('Blockly.Block');
* drag. Undefined for a blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.BlockDrag
*/
const BlockDrag = function(opt_block, opt_isStart, opt_blocks) {
const workspaceId = opt_block ? opt_block.workspace.id : undefined;

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for a block move event.
* @namespace Blockly.Events.BlockMove
*/
goog.module('Blockly.Events.BlockMove');
const BlockBase = goog.require('Blockly.Events.BlockBase');
@@ -28,6 +32,7 @@ const {ConnectionType} = goog.require('Blockly.ConnectionType');
* event.
* @extends {BlockBase}
* @constructor
* @alias Blockly.Events.BlockMove
*/
const BlockMove = function(opt_block) {
BlockMove.superClass_.constructor.call(this, opt_block);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a result of bubble open.
* @namespace Blockly.Events.BubbleOpen
*/
goog.module('Blockly.Events.BubbleOpen');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -31,6 +35,7 @@ const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
* or 'warning'. Undefined for a blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.BubbleOpen
*/
const BubbleOpen = function(opt_block, opt_isOpen, opt_bubbleType) {
const workspaceId = opt_block ? opt_block.workspace.id : undefined;

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a result of UI click in Blockly's editor.
* @namespace Blockly.Events.Click
*/
goog.module('Blockly.Events.Click');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -31,6 +35,7 @@ const {Block} = goog.requireType('Blockly.Block');
* event. Undefined for a blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.Click
*/
const Click = function(opt_block, opt_workspaceId, opt_targetType) {
const workspaceId = opt_block ? opt_block.workspace.id : opt_workspaceId;

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Base class for comment events.
* @namespace Blockly.Events.CommentBase
*/
goog.module('Blockly.Events.CommentBase');
const AbstractEvents = goog.require('Blockly.Events.Abstract');
@@ -31,6 +35,7 @@ const utilsXml = goog.require('Blockly.utils.xml');
* corresponds to. Undefined for a blank event.
* @extends {AbstractEvents}
* @constructor
* @alias Blockly.Events.CommentBase
*/
const CommentBase = function(opt_comment) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for comment change event.
* @namespace Blockly.Events.CommentChange
*/
goog.module('Blockly.Events.CommentChange');
const CommentBase = goog.require('Blockly.Events.CommentBase');
@@ -28,6 +32,7 @@ const registry = goog.require('Blockly.registry');
* @param {string=} opt_newContents New contents of the comment.
* @extends {CommentBase}
* @constructor
* @alias Blockly.Events.CommentChange
*/
const CommentChange = function(opt_comment, opt_oldContents, opt_newContents) {
CommentChange.superClass_.constructor.call(this, opt_comment);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for comment creation event.
* @namespace Blockly.Events.CommentCreate
*/
goog.module('Blockly.Events.CommentCreate');
const CommentBase = goog.require('Blockly.Events.CommentBase');
@@ -27,6 +31,7 @@ const registry = goog.require('Blockly.registry');
* Undefined for a blank event.
* @extends {CommentBase}
* @constructor
* @alias Blockly.Events.CommentCreate
*/
const CommentCreate = function(opt_comment) {
CommentCreate.superClass_.constructor.call(this, opt_comment);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for comment deletion event.
* @namespace Blockly.Events.CommentDelete
*/
goog.module('Blockly.Events.CommentDelete');
const CommentBase = goog.require('Blockly.Events.CommentBase');
@@ -26,6 +30,7 @@ const registry = goog.require('Blockly.registry');
* Undefined for a blank event.
* @extends {CommentBase}
* @constructor
* @alias Blockly.Events.CommentDelete
*/
const CommentDelete = function(opt_comment) {
CommentDelete.superClass_.constructor.call(this, opt_comment);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for comment move event.
* @namespace Blockly.Events.CommentMove
*/
goog.module('Blockly.Events.CommentMove');
const CommentBase = goog.require('Blockly.Events.CommentBase');
@@ -27,6 +31,7 @@ const registry = goog.require('Blockly.registry');
* moved. Undefined for a blank event.
* @extends {CommentBase}
* @constructor
* @alias Blockly.Events.CommentMove
*/
const CommentMove = function(opt_comment) {
CommentMove.superClass_.constructor.call(this, opt_comment);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a result of a marker move.
* @namespace Blockly.Events.MarkerMove
*/
goog.module('Blockly.Events.MarkerMove');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -35,6 +39,7 @@ const {Block} = goog.requireType('Blockly.Block');
* Undefined for a blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.MarkerMove
*/
const MarkerMove = function(opt_block, isCursor, opt_oldNode, opt_newNode) {
let workspaceId = opt_block ? opt_block.workspace.id : undefined;

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a result of element select action.
* @namespace Blockly.Events.Selected
*/
goog.module('Blockly.Events.Selected');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -28,6 +32,7 @@ const registry = goog.require('Blockly.registry');
* Null if no element previously selected. Undefined for a blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.Selected
*/
const Selected = function(opt_oldElementId, opt_newElementId, opt_workspaceId) {
Selected.superClass_.constructor.call(this, opt_workspaceId);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a result of a theme update.
* @namespace Blockly.Events.ThemeChange
*/
goog.module('Blockly.Events.ThemeChange');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -25,6 +29,7 @@ const registry = goog.require('Blockly.registry');
* event. Undefined for a blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.ThemeChange
*/
const ThemeChange = function(opt_themeName, opt_workspaceId) {
ThemeChange.superClass_.constructor.call(this, opt_workspaceId);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a result of selecting an item on the toolbox.
* @namespace Blockly.Events.ToolboxItemSelect
*/
goog.module('Blockly.Events.ToolboxItemSelect');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -28,6 +32,7 @@ const registry = goog.require('Blockly.registry');
* Undefined for a blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.ToolboxItemSelect
*/
const ToolboxItemSelect = function(opt_oldItem, opt_newItem, opt_workspaceId) {
ToolboxItemSelect.superClass_.constructor.call(this, opt_workspaceId);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a result of trashcan flyout open and close.
* @namespace Blockly.Events.TrashcanOpen
*/
goog.module('Blockly.Events.TrashcanOpen');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -26,6 +30,7 @@ const registry = goog.require('Blockly.registry');
* Undefined for a blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.TrashcanOpen
*/
const TrashcanOpen = function(opt_isOpen, opt_workspaceId) {
TrashcanOpen.superClass_.constructor.call(this, opt_workspaceId);

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* (Deprecated) Events fired as a result of UI actions in
* Blockly's editor.
* @namespace Blockly.Events.Ui
*/
goog.module('Blockly.Events.Ui');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -32,6 +37,7 @@ const {Block} = goog.requireType('Blockly.Block');
* @extends {UiBase}
* @deprecated December 2020. Instead use a more specific UI event.
* @constructor
* @alias Blockly.Events.Ui
*/
const Ui = function(opt_block, opt_element, opt_oldValue, opt_newValue) {
const workspaceId = opt_block ? opt_block.workspace.id : undefined;

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* Base class for events fired as a result of UI actions in
* Blockly's editor.
* @namespace Blockly.Events.UiBase
*/
goog.module('Blockly.Events.UiBase');
const Abstract = goog.require('Blockly.Events.Abstract');
@@ -27,6 +32,7 @@ const object = goog.require('Blockly.utils.object');
* Undefined for a blank event.
* @extends {Abstract}
* @constructor
* @alias Blockly.Events.UiBase
*/
const UiBase = function(opt_workspaceId) {
UiBase.superClass_.constructor.call(this);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Abstract class for a variable event.
* @namespace Blockly.Events.VarBase
*/
goog.module('Blockly.Events.VarBase');
const Abstract = goog.require('Blockly.Events.Abstract');
@@ -24,6 +28,7 @@ const object = goog.require('Blockly.utils.object');
* corresponds to. Undefined for a blank event.
* @extends {Abstract}
* @constructor
* @alias Blockly.Events.VarBase
*/
const VarBase = function(opt_variable) {
VarBase.superClass_.constructor.call(this);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for a variable creation event.
* @namespace Blockly.Events.VarCreate
*/
goog.module('Blockly.Events.VarCreate');
const VarBase = goog.require('Blockly.Events.VarBase');
@@ -26,6 +30,7 @@ const registry = goog.require('Blockly.registry');
* for a blank event.
* @extends {VarBase}
* @constructor
* @alias Blockly.Events.VarCreate
*/
const VarCreate = function(opt_variable) {
VarCreate.superClass_.constructor.call(this, opt_variable);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Classes for all types of variable events.
* @namespace Blockly.Events.VarDelete
*/
goog.module('Blockly.Events.VarDelete');
const VarBase = goog.require('Blockly.Events.VarBase');
@@ -26,6 +30,7 @@ const registry = goog.require('Blockly.registry');
* for a blank event.
* @extends {VarBase}
* @constructor
* @alias Blockly.Events.VarDelete
*/
const VarDelete = function(opt_variable) {
VarDelete.superClass_.constructor.call(this, opt_variable);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for a variable rename event.
* @namespace Blockly.Events.VarRename
*/
goog.module('Blockly.Events.VarRename');
const VarBase = goog.require('Blockly.Events.VarBase');
@@ -27,6 +31,7 @@ const registry = goog.require('Blockly.registry');
* @param {string=} newName The new name the variable will be changed to.
* @extends {VarBase}
* @constructor
* @alias Blockly.Events.VarRename
*/
const VarRename = function(opt_variable, newName) {
VarRename.superClass_.constructor.call(this, opt_variable);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Events fired as a result of a viewport change.
* @namespace Blockly.Events.ViewportChange
*/
goog.module('Blockly.Events.ViewportChange');
const UiBase = goog.require('Blockly.Events.UiBase');
@@ -32,6 +36,7 @@ const registry = goog.require('Blockly.registry');
* blank event.
* @extends {UiBase}
* @constructor
* @alias Blockly.Events.ViewportChange
*/
const ViewportChange = function(
opt_top, opt_left, opt_scale, opt_workspaceId, opt_oldScale) {

View File

@@ -10,6 +10,11 @@
*/
'use strict';
/**
* Helper methods for events that are fired as a result of
* actions in Blockly's editor.
* @namespace Blockly.Events.utils
*/
goog.module('Blockly.Events.utils');
/* eslint-disable-next-line no-unused-vars */
@@ -44,7 +49,7 @@ let recordUndo = true;
/**
* Sets whether events should be added to the undo stack.
* @param {boolean} newValue True if events should be added to the undo stack.
* @alias Blockly.Events.setRecordUndo
* @alias Blockly.Events.utils.setRecordUndo
*/
const setRecordUndo = function(newValue) {
recordUndo = newValue;
@@ -54,7 +59,7 @@ exports.setRecordUndo = setRecordUndo;
/**
* Returns whether or not events will be added to the undo stack.
* @returns {boolean} True if events will be added to the undo stack.
* @alias Blockly.Events.getRecordUndo
* @alias Blockly.Events.utils.getRecordUndo
*/
const getRecordUndo = function() {
return recordUndo;
@@ -70,7 +75,7 @@ let disabled = 0;
/**
* Name of event that creates a block. Will be deprecated for BLOCK_CREATE.
* @const
* @alias Blockly.Events.CREATE
* @alias Blockly.Events.utils.CREATE
*/
const CREATE = 'create';
exports.CREATE = CREATE;
@@ -78,7 +83,7 @@ exports.CREATE = CREATE;
/**
* Name of event that creates a block.
* @const
* @alias Blockly.Events.BLOCK_CREATE
* @alias Blockly.Events.utils.BLOCK_CREATE
*/
const BLOCK_CREATE = CREATE;
exports.BLOCK_CREATE = BLOCK_CREATE;
@@ -86,7 +91,7 @@ exports.BLOCK_CREATE = BLOCK_CREATE;
/**
* Name of event that deletes a block. Will be deprecated for BLOCK_DELETE.
* @const
* @alias Blockly.Events.DELETE
* @alias Blockly.Events.utils.DELETE
*/
const DELETE = 'delete';
exports.DELETE = DELETE;
@@ -94,7 +99,7 @@ exports.DELETE = DELETE;
/**
* Name of event that deletes a block.
* @const
* @alias Blockly.Events.BLOCK_DELETE
* @alias Blockly.Events.utils.BLOCK_DELETE
*/
const BLOCK_DELETE = DELETE;
exports.BLOCK_DELETE = BLOCK_DELETE;
@@ -102,7 +107,7 @@ exports.BLOCK_DELETE = BLOCK_DELETE;
/**
* Name of event that changes a block. Will be deprecated for BLOCK_CHANGE.
* @const
* @alias Blockly.Events.CHANGE
* @alias Blockly.Events.utils.CHANGE
*/
const CHANGE = 'change';
exports.CHANGE = CHANGE;
@@ -110,7 +115,7 @@ exports.CHANGE = CHANGE;
/**
* Name of event that changes a block.
* @const
* @alias Blockly.Events.BLOCK_CHANGE
* @alias Blockly.Events.utils.BLOCK_CHANGE
*/
const BLOCK_CHANGE = CHANGE;
exports.BLOCK_CHANGE = BLOCK_CHANGE;
@@ -118,7 +123,7 @@ exports.BLOCK_CHANGE = BLOCK_CHANGE;
/**
* Name of event that moves a block. Will be deprecated for BLOCK_MOVE.
* @const
* @alias Blockly.Events.MOVE
* @alias Blockly.Events.utils.MOVE
*/
const MOVE = 'move';
exports.MOVE = MOVE;
@@ -126,7 +131,7 @@ exports.MOVE = MOVE;
/**
* Name of event that moves a block.
* @const
* @alias Blockly.Events.BLOCK_MOVE
* @alias Blockly.Events.utils.BLOCK_MOVE
*/
const BLOCK_MOVE = MOVE;
exports.BLOCK_MOVE = BLOCK_MOVE;
@@ -134,7 +139,7 @@ exports.BLOCK_MOVE = BLOCK_MOVE;
/**
* Name of event that creates a variable.
* @const
* @alias Blockly.Events.VAR_CREATE
* @alias Blockly.Events.utils.VAR_CREATE
*/
const VAR_CREATE = 'var_create';
exports.VAR_CREATE = VAR_CREATE;
@@ -142,7 +147,7 @@ exports.VAR_CREATE = VAR_CREATE;
/**
* Name of event that deletes a variable.
* @const
* @alias Blockly.Events.VAR_DELETE
* @alias Blockly.Events.utils.VAR_DELETE
*/
const VAR_DELETE = 'var_delete';
exports.VAR_DELETE = VAR_DELETE;
@@ -150,7 +155,7 @@ exports.VAR_DELETE = VAR_DELETE;
/**
* Name of event that renames a variable.
* @const
* @alias Blockly.Events.VAR_RENAME
* @alias Blockly.Events.utils.VAR_RENAME
*/
const VAR_RENAME = 'var_rename';
exports.VAR_RENAME = VAR_RENAME;
@@ -158,7 +163,7 @@ exports.VAR_RENAME = VAR_RENAME;
/**
* Name of generic event that records a UI change.
* @const
* @alias Blockly.Events.UI
* @alias Blockly.Events.utils.UI
*/
const UI = 'ui';
exports.UI = UI;
@@ -166,7 +171,7 @@ exports.UI = UI;
/**
* Name of event that record a block drags a block.
* @const
* @alias Blockly.Events.BLOCK_DRAG
* @alias Blockly.Events.utils.BLOCK_DRAG
*/
const BLOCK_DRAG = 'drag';
exports.BLOCK_DRAG = BLOCK_DRAG;
@@ -174,7 +179,7 @@ exports.BLOCK_DRAG = BLOCK_DRAG;
/**
* Name of event that records a change in selected element.
* @const
* @alias Blockly.Events.SELECTED
* @alias Blockly.Events.utils.SELECTED
*/
const SELECTED = 'selected';
exports.SELECTED = SELECTED;
@@ -182,7 +187,7 @@ exports.SELECTED = SELECTED;
/**
* Name of event that records a click.
* @const
* @alias Blockly.Events.CLICK
* @alias Blockly.Events.utils.CLICK
*/
const CLICK = 'click';
exports.CLICK = CLICK;
@@ -190,7 +195,7 @@ exports.CLICK = CLICK;
/**
* Name of event that records a marker move.
* @const
* @alias Blockly.Events.MARKER_MOVE
* @alias Blockly.Events.utils.MARKER_MOVE
*/
const MARKER_MOVE = 'marker_move';
exports.MARKER_MOVE = MARKER_MOVE;
@@ -198,7 +203,7 @@ exports.MARKER_MOVE = MARKER_MOVE;
/**
* Name of event that records a bubble open.
* @const
* @alias Blockly.Events.BUBBLE_OPEN
* @alias Blockly.Events.utils.BUBBLE_OPEN
*/
const BUBBLE_OPEN = 'bubble_open';
exports.BUBBLE_OPEN = BUBBLE_OPEN;
@@ -206,7 +211,7 @@ exports.BUBBLE_OPEN = BUBBLE_OPEN;
/**
* Name of event that records a trashcan open.
* @const
* @alias Blockly.Events.TRASHCAN_OPEN
* @alias Blockly.Events.utils.TRASHCAN_OPEN
*/
const TRASHCAN_OPEN = 'trashcan_open';
exports.TRASHCAN_OPEN = TRASHCAN_OPEN;
@@ -214,7 +219,7 @@ exports.TRASHCAN_OPEN = TRASHCAN_OPEN;
/**
* Name of event that records a toolbox item select.
* @const
* @alias Blockly.Events.TOOLBOX_ITEM_SELECT
* @alias Blockly.Events.utils.TOOLBOX_ITEM_SELECT
*/
const TOOLBOX_ITEM_SELECT = 'toolbox_item_select';
exports.TOOLBOX_ITEM_SELECT = TOOLBOX_ITEM_SELECT;
@@ -222,7 +227,7 @@ exports.TOOLBOX_ITEM_SELECT = TOOLBOX_ITEM_SELECT;
/**
* Name of event that records a theme change.
* @const
* @alias Blockly.Events.THEME_CHANGE
* @alias Blockly.Events.utils.THEME_CHANGE
*/
const THEME_CHANGE = 'theme_change';
exports.THEME_CHANGE = THEME_CHANGE;
@@ -230,7 +235,7 @@ exports.THEME_CHANGE = THEME_CHANGE;
/**
* Name of event that records a viewport change.
* @const
* @alias Blockly.Events.VIEWPORT_CHANGE
* @alias Blockly.Events.utils.VIEWPORT_CHANGE
*/
const VIEWPORT_CHANGE = 'viewport_change';
exports.VIEWPORT_CHANGE = VIEWPORT_CHANGE;
@@ -238,7 +243,7 @@ exports.VIEWPORT_CHANGE = VIEWPORT_CHANGE;
/**
* Name of event that creates a comment.
* @const
* @alias Blockly.Events.COMMENT_CREATE
* @alias Blockly.Events.utils.COMMENT_CREATE
*/
const COMMENT_CREATE = 'comment_create';
exports.COMMENT_CREATE = COMMENT_CREATE;
@@ -246,7 +251,7 @@ exports.COMMENT_CREATE = COMMENT_CREATE;
/**
* Name of event that deletes a comment.
* @const
* @alias Blockly.Events.COMMENT_DELETE
* @alias Blockly.Events.utils.COMMENT_DELETE
*/
const COMMENT_DELETE = 'comment_delete';
exports.COMMENT_DELETE = COMMENT_DELETE;
@@ -254,7 +259,7 @@ exports.COMMENT_DELETE = COMMENT_DELETE;
/**
* Name of event that changes a comment.
* @const
* @alias Blockly.Events.COMMENT_CHANGE
* @alias Blockly.Events.utils.COMMENT_CHANGE
*/
const COMMENT_CHANGE = 'comment_change';
exports.COMMENT_CHANGE = COMMENT_CHANGE;
@@ -262,14 +267,14 @@ exports.COMMENT_CHANGE = COMMENT_CHANGE;
/**
* Name of event that moves a comment.
* @const
* @alias Blockly.Events.COMMENT_MOVE
* @alias Blockly.Events.utils.COMMENT_MOVE
*/
const COMMENT_MOVE = 'comment_move';
exports.COMMENT_MOVE = COMMENT_MOVE;
/**
* Name of event that records a workspace load.
* @alias Blockly.Events.FINISHED_LOADING
* @alias Blockly.Events.utils.FINISHED_LOADING
*/
const FINISHED_LOADING = 'finished_loading';
exports.FINISHED_LOADING = FINISHED_LOADING;
@@ -282,7 +287,7 @@ exports.FINISHED_LOADING = FINISHED_LOADING;
* appear connected.
* @typedef {!BlockCreate|!BlockMove|
* !CommentCreate|!CommentMove}
* @alias Blockly.Events.BumpEvent
* @alias Blockly.Events.utils.BumpEvent
*/
let BumpEvent;
exports.BumpEvent = BumpEvent;
@@ -294,7 +299,7 @@ exports.BumpEvent = BumpEvent;
* Not to be confused with bumping so that disconnected connections do not
* appear connected.
* @const
* @alias Blockly.Events.BUMP_EVENTS
* @alias Blockly.Events.utils.BUMP_EVENTS
*/
const BUMP_EVENTS = [BLOCK_CREATE, BLOCK_MOVE, COMMENT_CREATE, COMMENT_MOVE];
exports.BUMP_EVENTS = BUMP_EVENTS;
@@ -307,7 +312,7 @@ const FIRE_QUEUE = [];
/**
* Create a custom event and fire it.
* @param {!Abstract} event Custom data for event.
* @alias Blockly.Events.fire
* @alias Blockly.Events.utils.fire
*/
const fire = function(event) {
if (!isEnabled()) {
@@ -344,7 +349,7 @@ const fireNow = function() {
* @param {!Array<!Abstract>} queueIn Array of events.
* @param {boolean} forward True if forward (redo), false if backward (undo).
* @return {!Array<!Abstract>} Array of filtered events.
* @alias Blockly.Events.filter
* @alias Blockly.Events.utils.filter
*/
const filter = function(queueIn, forward) {
let queue = queueIn.slice(); // Shallow copy of queue.
@@ -418,7 +423,7 @@ exports.filter = filter;
/**
* Modify pending undo events so that when they are fired they don't land
* in the undo stack. Called by Workspace.clearUndo.
* @alias Blockly.Events.clearPendingUndo
* @alias Blockly.Events.utils.clearPendingUndo
*/
const clearPendingUndo = function() {
for (let i = 0, event; (event = FIRE_QUEUE[i]); i++) {
@@ -429,7 +434,7 @@ exports.clearPendingUndo = clearPendingUndo;
/**
* Stop sending events. Every call to this function MUST also call enable.
* @alias Blockly.Events.disable
* @alias Blockly.Events.utils.disable
*/
const disable = function() {
disabled++;
@@ -439,7 +444,7 @@ exports.disable = disable;
/**
* Start sending events. Unless events were already disabled when the
* corresponding call to disable was made.
* @alias Blockly.Events.enable
* @alias Blockly.Events.utils.enable
*/
const enable = function() {
disabled--;
@@ -449,7 +454,7 @@ exports.enable = enable;
/**
* Returns whether events may be fired or not.
* @return {boolean} True if enabled.
* @alias Blockly.Events.isEnabled
* @alias Blockly.Events.utils.isEnabled
*/
const isEnabled = function() {
return disabled == 0;
@@ -459,7 +464,7 @@ exports.isEnabled = isEnabled;
/**
* Current group.
* @return {string} ID string.
* @alias Blockly.Events.getGroup
* @alias Blockly.Events.utils.getGroup
*/
const getGroup = function() {
return group;
@@ -470,7 +475,7 @@ exports.getGroup = getGroup;
* Start or stop a group.
* @param {boolean|string} state True to start new group, false to end group.
* String to set group explicitly.
* @alias Blockly.Events.setGroup
* @alias Blockly.Events.utils.setGroup
*/
const setGroup = function(state) {
if (typeof state == 'boolean') {
@@ -485,7 +490,7 @@ exports.setGroup = setGroup;
* Compute a list of the IDs of the specified block and all its descendants.
* @param {!Block} block The root block.
* @return {!Array<string>} List of block IDs.
* @alias Blockly.Events.getDescendantIds
* @alias Blockly.Events.utils.getDescendantIds
*/
const getDescendantIds = function(block) {
const ids = [];
@@ -504,7 +509,7 @@ exports.getDescendantIds = getDescendantIds;
* @param {!Workspace} workspace Target workspace for event.
* @return {!Abstract} The event represented by the JSON.
* @throws {Error} if an event type is not found in the registry.
* @alias Blockly.Events.fromJson
* @alias Blockly.Events.utils.fromJson
*/
const fromJson = function(json, workspace) {
const eventClass = get(json.type);
@@ -523,7 +528,7 @@ exports.fromJson = fromJson;
* @param {string} eventType The type of the event to get.
* @return {?function(new:Abstract, ...?)} The event class with
* the given type or null if none exists.
* @alias Blockly.Events.get
* @alias Blockly.Events.utils.get
*/
const get = function(eventType) {
return registry.getClass(registry.Type.EVENT, eventType);
@@ -536,7 +541,7 @@ exports.get = get;
* Recommend setting the 'disable' option to 'false' in the config so that
* users don't try to re-enable disabled orphan blocks.
* @param {!Abstract} event Custom data for event.
* @alias Blockly.Events.disableOrphans
* @alias Blockly.Events.utils.disableOrphans
*/
const disableOrphans = function(event) {
if (event.type == MOVE || event.type == CREATE) {

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for a finished loading workspace event.
* @namespace Blockly.Events.FinishedLoading
*/
goog.module('Blockly.Events.FinishedLoading');
const Abstract = goog.require('Blockly.Events.Abstract');
@@ -29,6 +33,7 @@ const registry = goog.require('Blockly.registry');
* loading. Undefined for a blank event.
* @extends {Abstract}
* @constructor
* @alias Blockly.Events.FinishedLoading
*/
const FinishedLoading = function(opt_workspace) {
/**

View File

@@ -14,8 +14,11 @@
'use strict';
/**
* @name Blockly.Extensions
* @namespace
* Extensions are functions that help initialize blocks, usually
* adding dynamic behavior such as onchange handlers and mutators. These
* are applied using Block.applyExtension(), or the JSON "extensions"
* array attribute.
* @namespace Blockly.Extensions
*/
goog.module('Blockly.Extensions');

View File

@@ -12,6 +12,12 @@
*/
'use strict';
/**
* Field. Used for editable titles, variables, etc.
* This is an abstract class that defines the UI on the block. Actual
* instances would be FieldTextInput, FieldDropdown, etc.
* @namespace Blockly.Field
*/
goog.module('Blockly.Field');
/* eslint-disable-next-line no-unused-vars */
@@ -72,6 +78,7 @@ goog.require('Blockly.Gesture');
* @implements {IASTNodeLocationWithBlock}
* @implements {IKeyboardAccessible}
* @implements {IRegistrable}
* @alias Blockly.Field
*/
const Field = function(value, opt_validator, opt_config) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Angle input field.
* @namespace Blockly.FieldAngle
*/
goog.module('Blockly.FieldAngle');
const Css = goog.require('Blockly.Css');
@@ -38,6 +42,7 @@ const userAgent = goog.require('Blockly.utils.userAgent');
* for a list of properties this parameter supports.
* @extends {FieldTextInput}
* @constructor
* @alias Blockly.FieldAngle
*/
const FieldAngle = function(opt_value, opt_validator, opt_config) {

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Checkbox field. Checked or not checked.
* @namespace Blockly.FieldCheckbox
*/
goog.module('Blockly.FieldCheckbox');
const Field = goog.require('Blockly.Field');
@@ -34,6 +38,7 @@ goog.require('Blockly.Events.BlockChange');
* for a list of properties this parameter supports.
* @extends {Field}
* @constructor
* @alias Blockly.FieldCheckbox
*/
const FieldCheckbox = function(opt_value, opt_validator, opt_config) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Colour input field.
* @namespace Blockly.FieldColour
*/
goog.module('Blockly.FieldColour');
const Css = goog.require('Blockly.Css');
@@ -42,6 +46,7 @@ goog.require('Blockly.Events.BlockChange');
* for a list of properties this parameter supports.
* @extends {Field}
* @constructor
* @alias Blockly.FieldColour
*/
const FieldColour = function(opt_value, opt_validator, opt_config) {
FieldColour.superClass_.constructor.call(

View File

@@ -12,6 +12,12 @@
*/
'use strict';
/**
* Dropdown input field. Used for editable titles and variables.
* In the interests of a consistent UI, the toolbox shares some functions and
* properties with the context menu.
* @namespace Blockly.FieldDropdown
*/
goog.module('Blockly.FieldDropdown');
const Coordinate = goog.require('Blockly.utils.Coordinate');
@@ -44,6 +50,7 @@ const utilsString = goog.require('Blockly.utils.string');
* @extends {Field}
* @constructor
* @throws {TypeError} If `menuGenerator` options are incorrectly structured.
* @alias Blockly.FieldDropdown
*/
const FieldDropdown = function(menuGenerator, opt_validator, opt_config) {
if (typeof menuGenerator != 'function') {

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Image field. Used for pictures, icons, etc.
* @namespace Blockly.FieldImage
*/
goog.module('Blockly.FieldImage');
const Field = goog.require('Blockly.Field');
@@ -37,6 +41,7 @@ const utils = goog.require('Blockly.utils');
* for a list of properties this parameter supports.
* @extends {Field}
* @constructor
* @alias Blockly.FieldImage
*/
const FieldImage = function(
src, width, height, opt_alt, opt_onClick, opt_flipRtl, opt_config) {

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* Non-editable, non-serializable text field. Used for titles,
* labels, etc.
* @namespace Blockly.FieldLabel
*/
goog.module('Blockly.FieldLabel');
const Field = goog.require('Blockly.Field');
@@ -31,6 +36,7 @@ const utils = goog.require('Blockly.utils');
* for a list of properties this parameter supports.
* @extends {Field}
* @constructor
* @alias Blockly.FieldLabel
*/
const FieldLabel = function(opt_value, opt_class, opt_config) {
/**

View File

@@ -11,6 +11,12 @@
*/
'use strict';
/**
* Non-editable, serializable text field. Behaves like a
* normal label but is serialized to XML. It may only be
* edited programmatically.
* @namespace Blockly.FieldLabelSerializable
*/
goog.module('Blockly.FieldLabelSerializable');
const FieldLabel = goog.require('Blockly.FieldLabel');
@@ -31,6 +37,7 @@ const utils = goog.require('Blockly.utils');
* @extends {FieldLabel}
* @constructor
*
* @alias Blockly.FieldLabelSerializable
*/
const FieldLabelSerializable = function(opt_value, opt_class, opt_config) {
FieldLabelSerializable.superClass_.constructor.call(

View File

@@ -12,6 +12,10 @@
*/
'use strict';
/**
* Text Area field.
* @namespace Blockly.FieldMultilineInput
*/
goog.module('Blockly.FieldMultilineInput');
const Css = goog.require('Blockly.Css');
@@ -42,6 +46,7 @@ const utils = goog.require('Blockly.utils');
* for a list of properties this parameter supports.
* @extends {FieldTextInput}
* @constructor
* @alias Blockly.FieldMultilineInput
*/
const FieldMultilineInput = function(opt_value, opt_validator, opt_config) {
FieldMultilineInput.superClass_.constructor.call(

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Number input field
* @namespace Blockly.FieldNumber
*/
goog.module('Blockly.FieldNumber');
const FieldTextInput = goog.require('Blockly.FieldTextInput');
@@ -34,6 +38,7 @@ const object = goog.require('Blockly.utils.object');
* for a list of properties this parameter supports.
* @extends {FieldTextInput}
* @constructor
* @alias Blockly.FieldNumber
*/
const FieldNumber = function(
opt_value, opt_min, opt_max, opt_precision, opt_validator, opt_config) {

View File

@@ -12,6 +12,12 @@
*/
'use strict';
/**
* Fields can be created based on a JSON definition. This file
* contains methods for registering those JSON definitions, and building the
* fields based on JSON.
* @namespace Blockly.fieldRegistry
*/
goog.module('Blockly.fieldRegistry');
/* eslint-disable-next-line no-unused-vars */
@@ -31,6 +37,7 @@ const registry = goog.require('Blockly.registry');
* @throws {Error} if the type name is empty, the field is already
* registered, or the fieldClass is not an object containing a fromJson
* function.
* @alias Blockly.fieldRegistry.register
*/
const register = function(type, fieldClass) {
registry.register(registry.Type.FIELD, type, fieldClass);
@@ -40,6 +47,7 @@ exports.register = register;
/**
* Unregisters the field registered with the given type.
* @param {string} type The field type name as used in the JSON definition.
* @alias Blockly.fieldRegistry.unregister
*/
const unregister = function(type) {
registry.unregister(registry.Type.FIELD, type);
@@ -54,6 +62,7 @@ exports.unregister = unregister;
* to the field type.
* @return {?Field} The new field instance or null if a field wasn't
* found with the given type name
* @alias Blockly.fieldRegistry.fromJson
*/
const fromJson = function(options) {
const fieldObject = /** @type {?IRegistrableField} */ (

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Text input field.
* @namespace Blockly.FieldTextInput
*/
goog.module('Blockly.FieldTextInput');
const Coordinate = goog.require('Blockly.utils.Coordinate');
@@ -48,6 +52,7 @@ goog.require('Blockly.Events.BlockChange');
* for a list of properties this parameter supports.
* @extends {Field}
* @constructor
* @alias Blockly.FieldTextInput
*/
const FieldTextInput = function(opt_value, opt_validator, opt_config) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Variable input field.
* @namespace Blockly.FieldVariable
*/
goog.module('Blockly.FieldVariable');
const FieldDropdown = goog.require('Blockly.FieldDropdown');
@@ -49,6 +53,7 @@ goog.require('Blockly.Events.BlockChange');
* for a list of properties this parameter supports.
* @extends {FieldDropdown}
* @constructor
* @alias Blockly.FieldVariable
*/
const FieldVariable = function(
varName, opt_validator, opt_variableTypes, opt_defaultType, opt_config) {

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Flyout tray containing blocks which may be created.
* @namespace Blockly.Flyout
*/
goog.module('Blockly.Flyout');
const ComponentManager = goog.require('Blockly.ComponentManager');
@@ -60,6 +64,7 @@ goog.require('Blockly.Touch');
* @abstract
* @implements {IFlyout}
* @extends {DeleteArea}
* @alias Blockly.Flyout
*/
const Flyout = function(workspaceOptions) {
Flyout.superClass_.constructor.call(this);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class for a button in the flyout.
* @namespace Blockly.FlyoutButton
*/
goog.module('Blockly.FlyoutButton');
const Coordinate = goog.require('Blockly.utils.Coordinate');
@@ -35,6 +39,7 @@ const utils = goog.require('Blockly.utils');
* @param {boolean} isLabel Whether this button should be styled as a label.
* @constructor
* @package
* @alias Blockly.FlyoutButton
*/
const FlyoutButton = function(workspace, targetWorkspace, json, isLabel) {
// Labels behave the same as buttons, but are styled differently.

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Horizontal flyout tray containing blocks which may be created.
* @namespace Blockly.HorizontalFlyout
*/
goog.module('Blockly.HorizontalFlyout');
/* eslint-disable-next-line no-unused-vars */
@@ -33,6 +37,7 @@ const toolbox = goog.require('Blockly.utils.toolbox');
* workspace.
* @extends {Flyout}
* @constructor
* @alias Blockly.HorizontalFlyout
*/
const HorizontalFlyout = function(workspaceOptions) {
HorizontalFlyout.superClass_.constructor.call(this, workspaceOptions);

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Calculates and reports flyout workspace metrics.
* @namespace Blockly.FlyoutMetricsManager
*/
goog.module('Blockly.FlyoutMetricsManager');
/* eslint-disable-next-line no-unused-vars */
@@ -27,6 +31,7 @@ const object = goog.require('Blockly.utils.object');
* @param {!IFlyout} flyout The flyout.
* @extends {MetricsManager}
* @constructor
* @alias Blockly.FlyoutMetricsManager
*/
const FlyoutMetricsManager = function(workspace, flyout) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Layout code for a vertical variant of the flyout.
* @namespace Blockly.VerticalFlyout
*/
goog.module('Blockly.VerticalFlyout');
/* eslint-disable-next-line no-unused-vars */
@@ -37,6 +41,7 @@ goog.require('Blockly.constants');
* workspace.
* @extends {Flyout}
* @constructor
* @alias Blockly.VerticalFlyout
*/
const VerticalFlyout = function(workspaceOptions) {
VerticalFlyout.superClass_.constructor.call(this, workspaceOptions);

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* Utility functions for generating executable code from
* Blockly code.
* @namespace Blockly.Generator
*/
goog.module('Blockly.Generator');
/* eslint-disable-next-line no-unused-vars */
@@ -28,6 +33,7 @@ const {Block} = goog.requireType('Blockly.Block');
* Class for a code generator that translates the blocks into a language.
* @param {string} name Language name of this generator.
* @constructor
* @alias Blockly.Generator
*/
const Generator = function(name) {
this.name_ = name;

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* The class representing an in-progress gesture, usually a drag
* or a tap.
* @namespace Blockly.Gesture
*/
goog.module('Blockly.Gesture');
const BubbleDragger = goog.require('Blockly.BubbleDragger');
@@ -55,6 +60,7 @@ goog.require('Blockly.Events.Click');
* @param {!WorkspaceSvg} creatorWorkspace The workspace that created
* this gesture and has a reference to it.
* @constructor
* @alias Blockly.Gesture
*/
const Gesture = function(e, creatorWorkspace) {
/**

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* Object for configuring and updating a workspace grid in
* Blockly.
* @namespace Blockly.Grid
*/
goog.module('Blockly.Grid');
const Svg = goog.require('Blockly.utils.Svg');
@@ -26,6 +31,7 @@ const userAgent = goog.require('Blockly.utils.userAgent');
* See grid documentation:
* https://developers.google.com/blockly/guides/configure/web/grid
* @constructor
* @alias Blockly.Grid
*/
const Grid = function(pattern, options) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Object representing an icon on a block.
* @namespace Blockly.Icon
*/
goog.module('Blockly.Icon');
/* eslint-disable-next-line no-unused-vars */
@@ -29,6 +33,7 @@ const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
* @param {BlockSvg} block The block associated with this icon.
* @constructor
* @abstract
* @alias Blockly.Icon
*/
const Icon = function(block) {
/**

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Functions for injecting Blockly into a web page.
* @namespace Blockly.inject
*/
goog.module('Blockly.inject');
/* eslint-disable-next-line no-unused-vars */
@@ -43,6 +47,7 @@ const {BlockDragSurfaceSvg} = goog.require('Blockly.BlockDragSurfaceSvg');
* or a CSS selector.
* @param {BlocklyOptions=} opt_options Optional dictionary of options.
* @return {!WorkspaceSvg} Newly created main workspace.
* @alias Blockly.inject
*/
const inject = function(container, opt_options) {
if (typeof container == 'string') {

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Object representing an input (value, statement, or dummy).
* @namespace Blockly.Input
*/
goog.module('Blockly.Input');
/* eslint-disable-next-line no-unused-vars */
@@ -36,6 +40,7 @@ goog.require('Blockly.FieldLabel');
* @param {!Block} block The block containing this input.
* @param {Connection} connection Optional connection for this input.
* @constructor
* @alias Blockly.Input
*/
const Input = function(type, name, block, connection) {
if (type != inputTypes.DUMMY && !name) {

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* An enum for the possible types of inputs.
* @namespace Blockly.inputTypes
*/
goog.module('Blockly.inputTypes');
const {ConnectionType} = goog.require('Blockly.ConnectionType');
@@ -19,6 +23,7 @@ const {ConnectionType} = goog.require('Blockly.ConnectionType');
/**
* Enum for the type of a connection or input.
* @enum {number}
* @alias Blockly.inputTypes
*/
const inputTypes = {
// A right-facing value input. E.g. 'set item to' or 'return'.

View File

@@ -10,6 +10,10 @@
*/
'use strict';
/**
* Class that controls updates to connections during drags.
* @namespace Blockly.InsertionMarkerManager
*/
goog.module('Blockly.InsertionMarkerManager');
const ComponentManager = goog.require('Blockly.ComponentManager');
@@ -39,6 +43,7 @@ const {ConnectionType} = goog.require('Blockly.ConnectionType');
* unhiglighting it as needed during a drag.
* @param {!BlockSvg} block The top block in the stack being dragged.
* @constructor
* @alias Blockly.InsertionMarkerManager
*/
const InsertionMarkerManager = function(block) {
common.setSelected(block);

View File

@@ -11,11 +11,16 @@
'use strict';
/**
* The interface for an AST node location.
* @namespace Blockly.IASTNodeLocation
*/
goog.module('Blockly.IASTNodeLocation');
/**
* An AST node location interface.
* @interface
* @alias Blockly.IASTNodeLocation
*/
const IASTNodeLocation = function() {};

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* The interface for an AST node location SVG.
* @namespace Blockly.IASTNodeLocationSvg
*/
goog.module('Blockly.IASTNodeLocationSvg');
/* eslint-disable-next-line no-unused-vars */
@@ -21,6 +25,7 @@ const IASTNodeLocation = goog.requireType('Blockly.IASTNodeLocation');
* An AST node location SVG interface.
* @interface
* @extends {IASTNodeLocation}
* @alias Blockly.IASTNodeLocationSvg
*/
const IASTNodeLocationSvg = function() {};

View File

@@ -12,6 +12,11 @@
'use strict';
/**
* The interface for an AST node location that has an associated
* block.
* @namespace Blockly.IASTNodeLocationWithBlock
*/
goog.module('Blockly.IASTNodeLocationWithBlock');
/* eslint-disable-next-line no-unused-vars */
@@ -24,6 +29,7 @@ const {Block} = goog.requireType('Blockly.Block');
* An AST node location that has an associated block.
* @interface
* @extends {IASTNodeLocation}
* @alias Blockly.IASTNodeLocationWithBlock
*/
const IASTNodeLocationWithBlock = function() {};

View File

@@ -12,6 +12,11 @@
'use strict';
/**
* The interface for a component that is automatically hidden
* when WorkspaceSvg.hideChaff is called.
* @namespace Blockly.IAutoHideable
*/
goog.module('Blockly.IAutoHideable');
/* eslint-disable-next-line no-unused-vars */
@@ -22,6 +27,7 @@ const IComponent = goog.requireType('Blockly.IComponent');
* Interface for a component that can be automatically hidden.
* @extends {IComponent}
* @interface
* @alias Blockly.IAutoHideable
*/
const IAutoHideable = function() {};

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* The interface for a block dragger.
* @namespace Blockly.IBlockDragger
*/
goog.module('Blockly.IBlockDragger');
/* eslint-disable-next-line no-unused-vars */
@@ -22,6 +26,7 @@ const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
/**
* A block dragger interface.
* @interface
* @alias Blockly.IBlockDragger
*/
const IBlockDragger = function() {};

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* The interface for a bounded element.
* @namespace Blockly.IBoundedElement
*/
goog.module('Blockly.IBoundedElement');
/* eslint-disable-next-line no-unused-vars */
@@ -20,6 +24,7 @@ const Rect = goog.requireType('Blockly.utils.Rect');
/**
* A bounded element interface.
* @interface
* @alias Blockly.IBoundedElement
*/
const IBoundedElement = function() {};

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* The interface for a bubble.
* @namespace Blockly.IBubble
*/
goog.module('Blockly.IBubble');
/* eslint-disable-next-line no-unused-vars */
@@ -28,6 +32,7 @@ const {BlockDragSurfaceSvg} = goog.requireType('Blockly.BlockDragSurfaceSvg');
* @interface
* @extends {IDraggable}
* @extends {IContextMenu}
* @alias Blockly.IBubble
*/
const IBubble = function() {};

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* The interface for a collapsible toolbox item.
* @namespace Blockly.ICollapsibleToolboxItem
*/
goog.module('Blockly.ICollapsibleToolboxItem');
/* eslint-disable-next-line no-unused-vars */
@@ -23,6 +27,7 @@ const IToolboxItem = goog.requireType('Blockly.IToolboxItem');
* Interface for an item in the toolbox that can be collapsed.
* @extends {ISelectableToolboxItem}
* @interface
* @alias Blockly.ICollapsibleToolboxItem
*/
const ICollapsibleToolboxItem = function() {};

View File

@@ -12,6 +12,11 @@
'use strict';
/**
* Interface for a workspace component that can be registered with
* the ComponentManager.
* @namespace Blockly.IComponent
*/
goog.module('Blockly.IComponent');
@@ -19,6 +24,7 @@ goog.module('Blockly.IComponent');
* The interface for a workspace component that can be registered with the
* ComponentManager.
* @interface
* @alias Blockly.IComponent
*/
const IComponent = function() {};

View File

@@ -11,6 +11,11 @@
*/
'use strict';
/**
* The interface for an object that encapsulates logic for
* checking whether a potential connection is safe and valid.
* @namespace Blockly.IConnectionChecker
*/
goog.module('Blockly.IConnectionChecker');
/* eslint-disable-next-line no-unused-vars */
@@ -22,6 +27,7 @@ const RenderedConnection = goog.requireType('Blockly.RenderedConnection');
/**
* Class for connection type checking logic.
* @interface
* @alias Blockly.IConnectionChecker
*/
const IConnectionChecker = function() {};

View File

@@ -11,11 +11,16 @@
'use strict';
/**
* The interface for an object that supports a right-click.
* @namespace Blockly.IContextMenu
*/
goog.module('Blockly.IContextMenu');
/**
* @interface
* @alias Blockly.IContextMenu
*/
const IContextMenu = function() {};

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* The interface for an object that is copyable.
* @namespace Blockly.ICopyable
*/
goog.module('Blockly.ICopyable');
/* eslint-disable-next-line no-unused-vars */
@@ -22,6 +26,7 @@ const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
/**
* @extends {ISelectable}
* @interface
* @alias Blockly.ICopyable
*/
const ICopyable = function() {};

View File

@@ -11,12 +11,17 @@
'use strict';
/**
* The interface for an object that is deletable.
* @namespace Blockly.IDeletable
*/
goog.module('Blockly.IDeletable');
/**
* The interface for an object that can be deleted.
* @interface
* @alias Blockly.IDeletable
*/
const IDeletable = function() {};

View File

@@ -12,6 +12,11 @@
'use strict';
/**
* The interface for a component that can delete a block or bubble
* that is dropped on top of it.
* @namespace Blockly.IDeleteArea
*/
goog.module('Blockly.IDeleteArea');
/* eslint-disable-next-line no-unused-vars */
@@ -25,6 +30,7 @@ const IDragTarget = goog.requireType('Blockly.IDragTarget');
* on top of it.
* @extends {IDragTarget}
* @interface
* @alias Blockly.IDeleteArea
*/
const IDeleteArea = function() {};

View File

@@ -12,6 +12,11 @@
'use strict';
/**
* The interface for a component that has a handler for when a
* block is dropped on top of it.
* @namespace Blockly.IDragTarget
*/
goog.module('Blockly.IDragTarget');
/* eslint-disable-next-line no-unused-vars */
@@ -27,6 +32,7 @@ const Rect = goog.requireType('Blockly.utils.Rect');
* dragged over or dropped on top of it.
* @extends {IComponent}
* @interface
* @alias Blockly.IDragTarget
*/
const IDragTarget = function() {};

View File

@@ -11,6 +11,10 @@
'use strict';
/**
* The interface for an object that is draggable.
* @namespace Blockly.IDraggable
*/
goog.module('Blockly.IDraggable');
/* eslint-disable-next-line no-unused-vars */
@@ -21,6 +25,7 @@ const IDeletable = goog.requireType('Blockly.IDeletable');
* The interface for an object that can be dragged.
* @extends {IDeletable}
* @interface
* @alias Blockly.IDraggable
*/
const IDraggable = function() {};

Some files were not shown because too many files have changed in this diff Show More