refactor: convert some files to es classes (#5917)

* refactor: update several files to es6 classes

* refactor: update several files to es6 classes

* chore: add some type casts for specificity about event types

* chore: run formatter

* chore: rebuild
This commit is contained in:
Rachel Fenichel
2022-02-09 08:29:39 -08:00
committed by GitHub
parent e3f40a6abc
commit 9e8c5ea8ed
22 changed files with 2593 additions and 2539 deletions

View File

@@ -29,6 +29,8 @@ const parsing = goog.require('Blockly.utils.parsing');
const {Abstract} = goog.requireType('Blockly.Events.Abstract');
const {Align, Input} = goog.require('Blockly.Input');
const {ASTNode} = goog.require('Blockly.ASTNode');
/* eslint-disable-next-line no-unused-vars */
const {BlockMove} = goog.requireType('Blockly.Events.BlockMove');
const {Blocks} = goog.require('Blockly.blocks');
/* eslint-disable-next-line no-unused-vars */
const {Comment} = goog.requireType('Blockly.Comment');
@@ -2098,7 +2100,8 @@ Block.prototype.moveBy = function(dx, dy) {
if (this.parentBlock_) {
throw Error('Block has parent.');
}
const event = new (eventUtils.get(eventUtils.BLOCK_MOVE))(this);
const event = /** @type {!BlockMove} */ (
new (eventUtils.get(eventUtils.BLOCK_MOVE))(this));
this.xy_.translate(dx, dy);
event.recordNew();
eventUtils.fire(event);

View File

@@ -22,6 +22,8 @@ const dom = goog.require('Blockly.utils.dom');
const eventUtils = goog.require('Blockly.Events.utils');
const registry = goog.require('Blockly.registry');
/* eslint-disable-next-line no-unused-vars */
const {BlockMove} = goog.requireType('Blockly.Events.BlockMove');
/* eslint-disable-next-line no-unused-vars */
const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
const {Coordinate} = goog.require('Blockly.utils.Coordinate');
/* eslint-disable-next-line no-unused-vars */
@@ -376,8 +378,8 @@ const BlockDragger = class {
* @protected
*/
fireMoveEvent_() {
const event =
new (eventUtils.get(eventUtils.BLOCK_MOVE))(this.draggingBlock_);
const event = /** @type {!BlockMove} */
(new (eventUtils.get(eventUtils.BLOCK_MOVE))(this.draggingBlock_));
event.oldCoordinate = this.startXY_;
event.recordNew();
eventUtils.fire(event);

View File

@@ -31,6 +31,8 @@ const userAgent = goog.require('Blockly.utils.userAgent');
const {ASTNode} = goog.require('Blockly.ASTNode');
const {Block} = goog.require('Blockly.Block');
/* eslint-disable-next-line no-unused-vars */
const {BlockMove} = goog.requireType('Blockly.Events.BlockMove');
/* eslint-disable-next-line no-unused-vars */
const {Comment} = goog.requireType('Blockly.Comment');
const {ConnectionType} = goog.require('Blockly.ConnectionType');
/* eslint-disable-next-line no-unused-vars */
@@ -468,7 +470,8 @@ BlockSvg.prototype.moveBy = function(dx, dy) {
const eventsEnabled = eventUtils.isEnabled();
let event;
if (eventsEnabled) {
event = new (eventUtils.get(eventUtils.BLOCK_MOVE))(this);
event = /** @type {!BlockMove} */
(new (eventUtils.get(eventUtils.BLOCK_MOVE))(this));
}
const xy = this.getRelativeToSurfaceXY();
this.translate(xy.x + dx, xy.y + dy);

View File

@@ -19,6 +19,8 @@ const eventUtils = goog.require('Blockly.Events.utils');
const svgMath = goog.require('Blockly.utils.svgMath');
/* eslint-disable-next-line no-unused-vars */
const {BlockDragSurfaceSvg} = goog.requireType('Blockly.BlockDragSurfaceSvg');
/* eslint-disable-next-line no-unused-vars */
const {CommentMove} = goog.requireType('Blockly.Events.CommentMove');
const {ComponentManager} = goog.require('Blockly.ComponentManager');
const {Coordinate} = goog.require('Blockly.utils.Coordinate');
/* eslint-disable-next-line no-unused-vars */
@@ -244,8 +246,9 @@ const BubbleDragger = class {
if (this.draggingBubble_.isComment) {
// TODO (adodson): Resolve build errors when requiring
// WorkspaceCommentSvg.
const event = new (eventUtils.get(eventUtils.COMMENT_MOVE))(
/** @type {!WorkspaceCommentSvg} */ (this.draggingBubble_));
const event = /** @type {!CommentMove} */
(new (eventUtils.get(eventUtils.COMMENT_MOVE))(
/** @type {!WorkspaceCommentSvg} */ (this.draggingBubble_)));
event.setOldCoordinate(this.startXY_);
event.recordNew();
eventUtils.fire(event);

View File

@@ -31,24 +31,178 @@ const {IPositionable} = goog.requireType('Blockly.IPositionable');
/**
* Manager for all items registered with the workspace.
* @constructor
* @alias Blockly.ComponentManager
*/
const ComponentManager = function() {
class ComponentManager {
/**
* A map of the components registered with the workspace, mapped to id.
* @type {!Object<string, !ComponentManager.ComponentDatum>}
* @private
* @alias Blockly.ComponentManager
*/
this.componentData_ = Object.create(null);
constructor() {
/**
* A map of the components registered with the workspace, mapped to id.
* @type {!Object<string, !ComponentManager.ComponentDatum>}
* @private
*/
this.componentData_ = Object.create(null);
/**
* A map of capabilities to component IDs.
* @type {!Object<string, !Array<string>>}
* @private
*/
this.capabilityToComponentIds_ = Object.create(null);
}
/**
* A map of capabilities to component IDs.
* @type {!Object<string, !Array<string>>}
* @private
* Adds a component.
* @param {!ComponentManager.ComponentDatum} componentInfo The data for
* the component to register.
* @param {boolean=} opt_allowOverrides True to prevent an error when
* overriding an already registered item.
*/
this.capabilityToComponentIds_ = Object.create(null);
};
addComponent(componentInfo, opt_allowOverrides) {
// Don't throw an error if opt_allowOverrides is true.
const id = componentInfo.component.id;
if (!opt_allowOverrides && this.componentData_[id]) {
throw Error(
'Plugin "' + id + '" with capabilities "' +
this.componentData_[id].capabilities + '" already added.');
}
this.componentData_[id] = componentInfo;
const stringCapabilities = [];
for (let i = 0; i < componentInfo.capabilities.length; i++) {
const capability = String(componentInfo.capabilities[i]).toLowerCase();
stringCapabilities.push(capability);
if (this.capabilityToComponentIds_[capability] === undefined) {
this.capabilityToComponentIds_[capability] = [id];
} else {
this.capabilityToComponentIds_[capability].push(id);
}
}
this.componentData_[id].capabilities = stringCapabilities;
}
/**
* Removes a component.
* @param {string} id The ID of the component to remove.
*/
removeComponent(id) {
const componentInfo = this.componentData_[id];
if (!componentInfo) {
return;
}
for (let i = 0; i < componentInfo.capabilities.length; i++) {
const capability = String(componentInfo.capabilities[i]).toLowerCase();
arrayUtils.removeElem(this.capabilityToComponentIds_[capability], id);
}
delete this.componentData_[id];
}
/**
* Adds a capability to a existing registered component.
* @param {string} id The ID of the component to add the capability to.
* @param {string|!ComponentManager.Capability<T>} capability The
* capability to add.
* @template T
*/
addCapability(id, capability) {
if (!this.getComponent(id)) {
throw Error(
'Cannot add capability, "' + capability + '". Plugin "' + id +
'" has not been added to the ComponentManager');
}
if (this.hasCapability(id, capability)) {
console.warn(
'Plugin "' + id + 'already has capability "' + capability + '"');
return;
}
capability = String(capability).toLowerCase();
this.componentData_[id].capabilities.push(capability);
this.capabilityToComponentIds_[capability].push(id);
}
/**
* Removes a capability from an existing registered component.
* @param {string} id The ID of the component to remove the capability from.
* @param {string|!ComponentManager.Capability<T>} capability The
* capability to remove.
* @template T
*/
removeCapability(id, capability) {
if (!this.getComponent(id)) {
throw Error(
'Cannot remove capability, "' + capability + '". Plugin "' + id +
'" has not been added to the ComponentManager');
}
if (!this.hasCapability(id, capability)) {
console.warn(
'Plugin "' + id + 'doesn\'t have capability "' + capability +
'" to remove');
return;
}
capability = String(capability).toLowerCase();
arrayUtils.removeElem(this.componentData_[id].capabilities, capability);
arrayUtils.removeElem(this.capabilityToComponentIds_[capability], id);
}
/**
* Returns whether the component with this id has the specified capability.
* @param {string} id The ID of the component to check.
* @param {string|!ComponentManager.Capability<T>} capability The
* capability to check for.
* @return {boolean} Whether the component has the capability.
* @template T
*/
hasCapability(id, capability) {
capability = String(capability).toLowerCase();
return this.componentData_[id].capabilities.indexOf(capability) !== -1;
}
/**
* Gets the component with the given ID.
* @param {string} id The ID of the component to get.
* @return {!IComponent|undefined} The component with the given name
* or undefined if not found.
*/
getComponent(id) {
return this.componentData_[id] && this.componentData_[id].component;
}
/**
* Gets all the components with the specified capability.
* @param {string|!ComponentManager.Capability<T>
* } capability The capability of the component.
* @param {boolean} sorted Whether to return list ordered by weights.
* @return {!Array<T>} The components that match the specified capability.
* @template T
*/
getComponents(capability, sorted) {
capability = String(capability).toLowerCase();
const componentIds = this.capabilityToComponentIds_[capability];
if (!componentIds) {
return [];
}
const components = [];
if (sorted) {
const componentDataList = [];
const componentData = this.componentData_;
componentIds.forEach(function(id) {
componentDataList.push(componentData[id]);
});
componentDataList.sort(function(a, b) {
return a.weight - b.weight;
});
componentDataList.forEach(function(ComponentDatum) {
components.push(ComponentDatum.component);
});
} else {
const componentData = this.componentData_;
componentIds.forEach(function(id) {
components.push(componentData[id].component);
});
}
return components;
}
}
/**
* An object storing component information.
@@ -62,179 +216,30 @@ const ComponentManager = function() {
*/
ComponentManager.ComponentDatum;
/**
* Adds a component.
* @param {!ComponentManager.ComponentDatum} componentInfo The data for
* the component to register.
* @param {boolean=} opt_allowOverrides True to prevent an error when overriding
* an already registered item.
*/
ComponentManager.prototype.addComponent = function(
componentInfo, opt_allowOverrides) {
// Don't throw an error if opt_allowOverrides is true.
const id = componentInfo.component.id;
if (!opt_allowOverrides && this.componentData_[id]) {
throw Error(
'Plugin "' + id + '" with capabilities "' +
this.componentData_[id].capabilities + '" already added.');
}
this.componentData_[id] = componentInfo;
const stringCapabilities = [];
for (let i = 0; i < componentInfo.capabilities.length; i++) {
const capability = String(componentInfo.capabilities[i]).toLowerCase();
stringCapabilities.push(capability);
if (this.capabilityToComponentIds_[capability] === undefined) {
this.capabilityToComponentIds_[capability] = [id];
} else {
this.capabilityToComponentIds_[capability].push(id);
}
}
this.componentData_[id].capabilities = stringCapabilities;
};
/**
* Removes a component.
* @param {string} id The ID of the component to remove.
*/
ComponentManager.prototype.removeComponent = function(id) {
const componentInfo = this.componentData_[id];
if (!componentInfo) {
return;
}
for (let i = 0; i < componentInfo.capabilities.length; i++) {
const capability = String(componentInfo.capabilities[i]).toLowerCase();
arrayUtils.removeElem(this.capabilityToComponentIds_[capability], id);
}
delete this.componentData_[id];
};
/**
* Adds a capability to a existing registered component.
* @param {string} id The ID of the component to add the capability to.
* @param {string|!ComponentManager.Capability<T>} capability The
* capability to add.
* @template T
*/
ComponentManager.prototype.addCapability = function(id, capability) {
if (!this.getComponent(id)) {
throw Error(
'Cannot add capability, "' + capability + '". Plugin "' + id +
'" has not been added to the ComponentManager');
}
if (this.hasCapability(id, capability)) {
console.warn(
'Plugin "' + id + 'already has capability "' + capability + '"');
return;
}
capability = String(capability).toLowerCase();
this.componentData_[id].capabilities.push(capability);
this.capabilityToComponentIds_[capability].push(id);
};
/**
* Removes a capability from an existing registered component.
* @param {string} id The ID of the component to remove the capability from.
* @param {string|!ComponentManager.Capability<T>} capability The
* capability to remove.
* @template T
*/
ComponentManager.prototype.removeCapability = function(id, capability) {
if (!this.getComponent(id)) {
throw Error(
'Cannot remove capability, "' + capability + '". Plugin "' + id +
'" has not been added to the ComponentManager');
}
if (!this.hasCapability(id, capability)) {
console.warn(
'Plugin "' + id + 'doesn\'t have capability "' + capability +
'" to remove');
return;
}
capability = String(capability).toLowerCase();
arrayUtils.removeElem(this.componentData_[id].capabilities, capability);
arrayUtils.removeElem(this.capabilityToComponentIds_[capability], id);
};
/**
* Returns whether the component with this id has the specified capability.
* @param {string} id The ID of the component to check.
* @param {string|!ComponentManager.Capability<T>} capability The
* capability to check for.
* @return {boolean} Whether the component has the capability.
* @template T
*/
ComponentManager.prototype.hasCapability = function(id, capability) {
capability = String(capability).toLowerCase();
return this.componentData_[id].capabilities.indexOf(capability) !== -1;
};
/**
* Gets the component with the given ID.
* @param {string} id The ID of the component to get.
* @return {!IComponent|undefined} The component with the given name
* or undefined if not found.
*/
ComponentManager.prototype.getComponent = function(id) {
return this.componentData_[id] && this.componentData_[id].component;
};
/**
* Gets all the components with the specified capability.
* @param {string|!ComponentManager.Capability<T>
* } capability The capability of the component.
* @param {boolean} sorted Whether to return list ordered by weights.
* @return {!Array<T>} The components that match the specified capability.
* @template T
*/
ComponentManager.prototype.getComponents = function(capability, sorted) {
capability = String(capability).toLowerCase();
const componentIds = this.capabilityToComponentIds_[capability];
if (!componentIds) {
return [];
}
const components = [];
if (sorted) {
const componentDataList = [];
const componentData = this.componentData_;
componentIds.forEach(function(id) {
componentDataList.push(componentData[id]);
});
componentDataList.sort(function(a, b) {
return a.weight - b.weight;
});
componentDataList.forEach(function(ComponentDatum) {
components.push(ComponentDatum.component);
});
} else {
const componentData = this.componentData_;
componentIds.forEach(function(id) {
components.push(componentData[id].component);
});
}
return components;
};
/**
* A name with the capability of the element stored in the generic.
* @param {string} name The name of the component capability.
* @constructor
* @template T
*/
ComponentManager.Capability = function(name) {
ComponentManager.Capability = class {
/**
* @type {string}
* @private
* @param {string} name The name of the component capability.
*/
this.name_ = name;
};
constructor(name) {
/**
* @type {string}
* @private
*/
this.name_ = name;
}
/**
* Returns the name of the capability.
* @return {string} The name.
* @override
*/
ComponentManager.Capability.prototype.toString = function() {
return this.name_;
/**
* Returns the name of the capability.
* @return {string} The name.
* @override
*/
toString() {
return this.name_;
}
};
/** @type {!ComponentManager.Capability<!IPositionable>} */

View File

@@ -20,6 +20,8 @@ const blocks = goog.require('Blockly.serialization.blocks');
const eventUtils = goog.require('Blockly.Events.utils');
/* eslint-disable-next-line no-unused-vars */
const {Block} = goog.requireType('Blockly.Block');
/* eslint-disable-next-line no-unused-vars */
const {BlockMove} = goog.requireType('Blockly.Events.BlockMove');
const {ConnectionType} = goog.require('Blockly.ConnectionType');
/* eslint-disable-next-line no-unused-vars */
const {IASTNodeLocationWithBlock} = goog.require('Blockly.IASTNodeLocationWithBlock');
@@ -134,7 +136,8 @@ class Connection {
// Connect the new connection to the parent.
let event;
if (eventUtils.isEnabled()) {
event = new (eventUtils.get(eventUtils.BLOCK_MOVE))(childBlock);
event = /** @type {!BlockMove} */
(new (eventUtils.get(eventUtils.BLOCK_MOVE))(childBlock));
}
connectReciprocally(parentConnection, childConnection);
childBlock.setParent(parentBlock);
@@ -307,7 +310,8 @@ class Connection {
disconnectInternal_(parentBlock, childBlock) {
let event;
if (eventUtils.isEnabled()) {
event = new (eventUtils.get(eventUtils.BLOCK_MOVE))(childBlock);
event = /** @type {!BlockMove} */
(new (eventUtils.get(eventUtils.BLOCK_MOVE))(childBlock));
}
const otherConnection = this.targetConnection;
otherConnection.targetConnection = null;

View File

@@ -18,7 +18,6 @@
*/
goog.module('Blockly.DeleteArea');
const object = goog.require('Blockly.utils.object');
const {BlockSvg} = goog.require('Blockly.BlockSvg');
const {DragTarget} = goog.require('Blockly.DragTarget');
/* eslint-disable-next-line no-unused-vars */
@@ -32,53 +31,55 @@ const {IDraggable} = goog.requireType('Blockly.IDraggable');
* dropped on top of it.
* @extends {DragTarget}
* @implements {IDeleteArea}
* @constructor
* @alias Blockly.DeleteArea
*/
const DeleteArea = function() {
DeleteArea.superClass_.constructor.call(this);
class DeleteArea extends DragTarget {
/**
* @alias Blockly.DeleteArea
*/
constructor() {
super();
/**
* Whether the last block or bubble dragged over this delete area would be
* deleted if dropped on this component.
* This property is not updated after the block or bubble is deleted.
* @type {boolean}
* @protected
*/
this.wouldDelete_ = false;
}
/**
* Whether the last block or bubble dragged over this delete area would be
* deleted if dropped on this component.
* This property is not updated after the block or bubble is deleted.
* @type {boolean}
* Returns whether the provided block or bubble would be deleted if dropped on
* this area.
* This method should check if the element is deletable and is always called
* before onDragEnter/onDragOver/onDragExit.
* @param {!IDraggable} element The block or bubble currently being
* dragged.
* @param {boolean} couldConnect Whether the element could could connect to
* another.
* @return {boolean} Whether the element provided would be deleted if dropped
* on this area.
*/
wouldDelete(element, couldConnect) {
if (element instanceof BlockSvg) {
const block = /** @type {BlockSvg} */ (element);
const couldDeleteBlock = !block.getParent() && block.isDeletable();
this.updateWouldDelete_(couldDeleteBlock && !couldConnect);
} else {
this.updateWouldDelete_(element.isDeletable());
}
return this.wouldDelete_;
}
/**
* Updates the internal wouldDelete_ state.
* @param {boolean} wouldDelete The new value for the wouldDelete state.
* @protected
*/
this.wouldDelete_ = false;
};
object.inherits(DeleteArea, DragTarget);
/**
* Returns whether the provided block or bubble would be deleted if dropped on
* this area.
* This method should check if the element is deletable and is always called
* before onDragEnter/onDragOver/onDragExit.
* @param {!IDraggable} element The block or bubble currently being
* dragged.
* @param {boolean} couldConnect Whether the element could could connect to
* another.
* @return {boolean} Whether the element provided would be deleted if dropped on
* this area.
*/
DeleteArea.prototype.wouldDelete = function(element, couldConnect) {
if (element instanceof BlockSvg) {
const block = /** @type {BlockSvg} */ (element);
const couldDeleteBlock = !block.getParent() && block.isDeletable();
this.updateWouldDelete_(couldDeleteBlock && !couldConnect);
} else {
this.updateWouldDelete_(element.isDeletable());
updateWouldDelete_(wouldDelete) {
this.wouldDelete_ = wouldDelete;
}
return this.wouldDelete_;
};
/**
* Updates the internal wouldDelete_ state.
* @param {boolean} wouldDelete The new value for the wouldDelete state.
* @protected
*/
DeleteArea.prototype.updateWouldDelete_ = function(wouldDelete) {
this.wouldDelete_ = wouldDelete;
};
}
exports.DeleteArea = DeleteArea;

View File

@@ -30,68 +30,73 @@ const {Rect} = goog.requireType('Blockly.utils.Rect');
* Abstract class for a component with custom behaviour when a block or bubble
* is dragged over or dropped on top of it.
* @implements {IDragTarget}
* @constructor
* @alias Blockly.DragTarget
*/
const DragTarget = function() {};
class DragTarget {
/**
* @alias Blockly.DragTarget
*/
constructor() {}
/**
* Returns the bounding rectangle of the drag target area in pixel units
* relative to the Blockly injection div.
* @return {?Rect} The component's bounding box. Null if drag
* target area should be ignored.
*/
DragTarget.prototype.getClientRect;
/**
* Handles when a cursor with a block or bubble enters this drag target.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
*/
onDragEnter(_dragElement) {
// no-op
}
/**
* Handles when a cursor with a block or bubble enters this drag target.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
*/
DragTarget.prototype.onDragEnter = function(_dragElement) {
// no-op
};
/**
* Handles when a cursor with a block or bubble is dragged over this drag
* target.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
*/
onDragOver(_dragElement) {
// no-op
}
/**
* Handles when a cursor with a block or bubble is dragged over this drag
* target.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
*/
DragTarget.prototype.onDragOver = function(_dragElement) {
// no-op
};
/**
* Handles when a cursor with a block or bubble exits this drag target.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
*/
onDragExit(_dragElement) {
// no-op
}
/**
* Handles when a cursor with a block or bubble exits this drag target.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
*/
DragTarget.prototype.onDragExit = function(_dragElement) {
// no-op
};
/**
* Handles when a block or bubble is dropped on this component.
* Should not handle delete here.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
*/
onDrop(_dragElement) {
// no-op
}
/**
* Handles when a block or bubble is dropped on this component.
* Should not handle delete here.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
*/
DragTarget.prototype.onDrop = function(_dragElement) {
// no-op
};
/**
* Returns the bounding rectangle of the drag target area in pixel units
* relative to the Blockly injection div.
* @return {?Rect} The component's bounding box. Null if drag
* target area should be ignored.
*/
getClientRect() {
return null;
}
/**
* Returns whether the provided block or bubble should not be moved after being
* dropped on this component. If true, the element will return to where it was
* when the drag started.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
* @return {boolean} Whether the block or bubble provided should be returned to
* drag start.
*/
DragTarget.prototype.shouldPreventMove = function(_dragElement) {
return false;
};
/**
* Returns whether the provided block or bubble should not be moved after
* being dropped on this component. If true, the element will return to where
* it was when the drag started.
* @param {!IDraggable} _dragElement The block or bubble currently being
* dragged.
* @return {boolean} Whether the block or bubble provided should be returned
* to drag start.
*/
shouldPreventMove(_dragElement) {
return false;
}
}
exports.DragTarget = DragTarget;

View File

@@ -15,7 +15,6 @@
*/
goog.module('Blockly.Events.BlockBase');
const object = goog.require('Blockly.utils.object');
const {Abstract} = goog.require('Blockly.Events.Abstract');
/* eslint-disable-next-line no-unused-vars */
const {Block} = goog.requireType('Blockly.Block');
@@ -23,47 +22,49 @@ const {Block} = goog.requireType('Blockly.Block');
/**
* Abstract class for a block event.
* @param {!Block=} opt_block The block this event corresponds to.
* Undefined for a blank event.
* @extends {Abstract}
* @constructor
* @alias Blockly.Events.BlockBase
*/
const BlockBase = function(opt_block) {
BlockBase.superClass_.constructor.call(this);
this.isBlank = typeof opt_block === 'undefined';
class BlockBase extends Abstract {
/**
* @param {!Block=} opt_block The block this event corresponds to.
* Undefined for a blank event.
* @alias Blockly.Events.BlockBase
*/
constructor(opt_block) {
super();
this.isBlank = typeof opt_block === 'undefined';
/**
* The block ID for the block this event pertains to
* @type {string}
*/
this.blockId = this.isBlank ? '' : opt_block.id;
/**
* The workspace identifier for this event.
* @type {string}
*/
this.workspaceId = this.isBlank ? '' : opt_block.workspace.id;
}
/**
* The block ID for the block this event pertains to
* @type {string}
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
this.blockId = this.isBlank ? '' : opt_block.id;
toJson() {
const json = super.toJson();
json['blockId'] = this.blockId;
return json;
}
/**
* The workspace identifier for this event.
* @type {string}
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
this.workspaceId = this.isBlank ? '' : opt_block.workspace.id;
};
object.inherits(BlockBase, Abstract);
/**
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
BlockBase.prototype.toJson = function() {
const json = BlockBase.superClass_.toJson.call(this);
json['blockId'] = this.blockId;
return json;
};
/**
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
BlockBase.prototype.fromJson = function(json) {
BlockBase.superClass_.fromJson.call(this, json);
this.blockId = json['blockId'];
};
fromJson(json) {
super.fromJson(json);
this.blockId = json['blockId'];
}
}
exports.BlockBase = BlockBase;

View File

@@ -16,7 +16,6 @@
goog.module('Blockly.Events.BubbleOpen');
const eventUtils = goog.require('Blockly.Events.utils');
const object = goog.require('Blockly.utils.object');
const registry = goog.require('Blockly.registry');
/* eslint-disable-next-line no-unused-vars */
const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
@@ -25,64 +24,66 @@ const {UiBase} = goog.require('Blockly.Events.UiBase');
/**
* Class for a bubble open event.
* @param {BlockSvg} opt_block The associated block. Undefined for a
* blank event.
* @param {boolean=} opt_isOpen Whether the bubble is opening (false if
* closing). Undefined for a blank event.
* @param {string=} opt_bubbleType The type of bubble. One of 'mutator',
* 'comment'
* 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;
BubbleOpen.superClass_.constructor.call(this, workspaceId);
this.blockId = opt_block ? opt_block.id : null;
class BubbleOpen extends UiBase {
/**
* @param {BlockSvg} opt_block The associated block. Undefined for a
* blank event.
* @param {boolean=} opt_isOpen Whether the bubble is opening (false if
* closing). Undefined for a blank event.
* @param {string=} opt_bubbleType The type of bubble. One of 'mutator',
* 'comment'
* or 'warning'. Undefined for a blank event.
* @alias Blockly.Events.BubbleOpen
*/
constructor(opt_block, opt_isOpen, opt_bubbleType) {
const workspaceId = opt_block ? opt_block.workspace.id : undefined;
super(workspaceId);
this.blockId = opt_block ? opt_block.id : null;
/**
* Whether the bubble is opening (false if closing).
* @type {boolean|undefined}
*/
this.isOpen = opt_isOpen;
/**
* The type of bubble. One of 'mutator', 'comment', or 'warning'.
* @type {string|undefined}
*/
this.bubbleType = opt_bubbleType;
/**
* Type of this event.
* @type {string}
*/
this.type = eventUtils.BUBBLE_OPEN;
}
/**
* Whether the bubble is opening (false if closing).
* @type {boolean|undefined}
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
this.isOpen = opt_isOpen;
toJson() {
const json = super.toJson();
json['isOpen'] = this.isOpen;
json['bubbleType'] = this.bubbleType;
json['blockId'] = this.blockId;
return json;
}
/**
* The type of bubble. One of 'mutator', 'comment', or 'warning'.
* @type {string|undefined}
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
this.bubbleType = opt_bubbleType;
/**
* Type of this event.
* @type {string}
*/
this.type = eventUtils.BUBBLE_OPEN;
};
object.inherits(BubbleOpen, UiBase);
/**
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
BubbleOpen.prototype.toJson = function() {
const json = BubbleOpen.superClass_.toJson.call(this);
json['isOpen'] = this.isOpen;
json['bubbleType'] = this.bubbleType;
json['blockId'] = this.blockId;
return json;
};
/**
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
BubbleOpen.prototype.fromJson = function(json) {
BubbleOpen.superClass_.fromJson.call(this, json);
this.isOpen = json['isOpen'];
this.bubbleType = json['bubbleType'];
this.blockId = json['blockId'];
};
fromJson(json) {
super.fromJson(json);
this.isOpen = json['isOpen'];
this.bubbleType = json['bubbleType'];
this.blockId = json['blockId'];
}
}
registry.register(registry.Type.EVENT, eventUtils.BUBBLE_OPEN, BubbleOpen);

View File

@@ -17,7 +17,6 @@ goog.module('Blockly.Events.CommentBase');
const Xml = goog.require('Blockly.Xml');
const eventUtils = goog.require('Blockly.Events.utils');
const object = goog.require('Blockly.utils.object');
const utilsXml = goog.require('Blockly.utils.xml');
const {Abstract} = goog.require('Blockly.Events.Abstract');
/* eslint-disable-next-line no-unused-vars */
@@ -30,89 +29,93 @@ const {WorkspaceComment} = goog.requireType('Blockly.WorkspaceComment');
/**
* Abstract class for a comment event.
* @param {!WorkspaceComment=} opt_comment The comment this event
* corresponds to. Undefined for a blank event.
* @extends {Abstract}
* @constructor
* @alias Blockly.Events.CommentBase
*/
const CommentBase = function(opt_comment) {
class CommentBase extends Abstract {
/**
* Whether or not an event is blank.
* @type {boolean}
* @param {!WorkspaceComment=} opt_comment The comment this event
* corresponds to. Undefined for a blank event.
* @alias Blockly.Events.CommentBase
*/
this.isBlank = typeof opt_comment === 'undefined';
constructor(opt_comment) {
super();
/**
* Whether or not an event is blank.
* @type {boolean}
*/
this.isBlank = typeof opt_comment === 'undefined';
/**
* The ID of the comment this event pertains to.
* @type {string}
*/
this.commentId = this.isBlank ? '' : opt_comment.id;
/**
* The ID of the comment this event pertains to.
* @type {string}
*/
this.commentId = this.isBlank ? '' : opt_comment.id;
/**
* The workspace identifier for this event.
* @type {string}
*/
this.workspaceId = this.isBlank ? '' : opt_comment.workspace.id;
/**
* The workspace identifier for this event.
* @type {string}
*/
this.workspaceId = this.isBlank ? '' : opt_comment.workspace.id;
/**
* The event group id for the group this event belongs to. Groups define
* events that should be treated as an single action from the user's
* perspective, and should be undone together.
* @type {string}
*/
this.group = eventUtils.getGroup();
/**
* The event group id for the group this event belongs to. Groups define
* events that should be treated as an single action from the user's
* perspective, and should be undone together.
* @type {string}
*/
this.group = eventUtils.getGroup();
/**
* Sets whether the event should be added to the undo stack.
* @type {boolean}
*/
this.recordUndo = eventUtils.getRecordUndo();
};
object.inherits(CommentBase, Abstract);
/**
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
CommentBase.prototype.toJson = function() {
const json = CommentBase.superClass_.toJson.call(this);
if (this.commentId) {
json['commentId'] = this.commentId;
/**
* Sets whether the event should be added to the undo stack.
* @type {boolean}
*/
this.recordUndo = eventUtils.getRecordUndo();
}
return json;
};
/**
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
CommentBase.prototype.fromJson = function(json) {
CommentBase.superClass_.fromJson.call(this, json);
this.commentId = json['commentId'];
};
/**
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
toJson() {
const json = super.toJson();
if (this.commentId) {
json['commentId'] = this.commentId;
}
return json;
}
/**
* Helper function for Comment[Create|Delete]
* @param {!CommentCreate|!CommentDelete} event
* The event to run.
* @param {boolean} create if True then Create, if False then Delete
*/
CommentBase.CommentCreateDeleteHelper = function(event, create) {
const workspace = event.getEventWorkspace_();
if (create) {
const xmlElement = utilsXml.createElement('xml');
xmlElement.appendChild(event.xml);
Xml.domToWorkspace(xmlElement, workspace);
} else {
const comment = workspace.getCommentById(event.commentId);
if (comment) {
comment.dispose();
/**
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
fromJson(json) {
super.fromJson(json);
this.commentId = json['commentId'];
}
/**
* Helper function for Comment[Create|Delete]
* @param {!CommentCreate|!CommentDelete} event
* The event to run.
* @param {boolean} create if True then Create, if False then Delete
*/
static CommentCreateDeleteHelper(event, create) {
const workspace = event.getEventWorkspace_();
if (create) {
const xmlElement = utilsXml.createElement('xml');
xmlElement.appendChild(event.xml);
Xml.domToWorkspace(xmlElement, workspace);
} else {
// Only complain about root-level block.
console.warn('Can\'t uncreate non-existent comment: ' + event.commentId);
const comment = workspace.getCommentById(event.commentId);
if (comment) {
comment.dispose();
} else {
// Only complain about root-level block.
console.warn(
'Can\'t uncreate non-existent comment: ' + event.commentId);
}
}
}
};
}
exports.CommentBase = CommentBase;

View File

@@ -17,7 +17,6 @@
*/
goog.module('Blockly.Events.UiBase');
const object = goog.require('Blockly.utils.object');
const {Abstract} = goog.require('Blockly.Events.Abstract');
@@ -27,36 +26,38 @@ const {Abstract} = goog.require('Blockly.Events.Abstract');
* editing to work (e.g. scrolling the workspace, zooming, opening toolbox
* categories).
* UI events do not undo or redo.
* @param {string=} opt_workspaceId The workspace identifier for this event.
* Undefined for a blank event.
* @extends {Abstract}
* @constructor
* @alias Blockly.Events.UiBase
*/
const UiBase = function(opt_workspaceId) {
UiBase.superClass_.constructor.call(this);
class UiBase extends Abstract {
/**
* Whether or not the event is blank (to be populated by fromJson).
* @type {boolean}
* @param {string=} opt_workspaceId The workspace identifier for this event.
* Undefined for a blank event.
* @alias Blockly.Events.UiBase
*/
this.isBlank = typeof opt_workspaceId === 'undefined';
constructor(opt_workspaceId) {
super();
/**
* The workspace identifier for this event.
* @type {string}
*/
this.workspaceId = opt_workspaceId ? opt_workspaceId : '';
/**
* Whether or not the event is blank (to be populated by fromJson).
* @type {boolean}
*/
this.isBlank = typeof opt_workspaceId === 'undefined';
// UI events do not undo or redo.
this.recordUndo = false;
/**
* The workspace identifier for this event.
* @type {string}
*/
this.workspaceId = opt_workspaceId ? opt_workspaceId : '';
/**
* Whether or not the event is a UI event.
* @type {boolean}
*/
this.isUiEvent = true;
};
object.inherits(UiBase, Abstract);
// UI events do not undo or redo.
this.recordUndo = false;
/**
* Whether or not the event is a UI event.
* @type {boolean}
*/
this.isUiEvent = true;
}
}
exports.UiBase = UiBase;

View File

@@ -15,7 +15,6 @@
*/
goog.module('Blockly.Events.VarBase');
const object = goog.require('Blockly.utils.object');
const {Abstract} = goog.require('Blockly.Events.Abstract');
/* eslint-disable-next-line no-unused-vars */
const {VariableModel} = goog.requireType('Blockly.VariableModel');
@@ -23,47 +22,49 @@ const {VariableModel} = goog.requireType('Blockly.VariableModel');
/**
* Abstract class for a variable event.
* @param {!VariableModel=} opt_variable The variable this event
* corresponds to. Undefined for a blank event.
* @extends {Abstract}
* @constructor
* @alias Blockly.Events.VarBase
*/
const VarBase = function(opt_variable) {
VarBase.superClass_.constructor.call(this);
this.isBlank = typeof opt_variable === 'undefined';
class VarBase extends Abstract {
/**
* @param {!VariableModel=} opt_variable The variable this event
* corresponds to. Undefined for a blank event.
* @alias Blockly.Events.VarBase
*/
constructor(opt_variable) {
super();
this.isBlank = typeof opt_variable === 'undefined';
/**
* The variable id for the variable this event pertains to.
* @type {string}
*/
this.varId = this.isBlank ? '' : opt_variable.getId();
/**
* The workspace identifier for this event.
* @type {string}
*/
this.workspaceId = this.isBlank ? '' : opt_variable.workspace.id;
}
/**
* The variable id for the variable this event pertains to.
* @type {string}
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
this.varId = this.isBlank ? '' : opt_variable.getId();
toJson() {
const json = super.toJson();
json['varId'] = this.varId;
return json;
}
/**
* The workspace identifier for this event.
* @type {string}
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
this.workspaceId = this.isBlank ? '' : opt_variable.workspace.id;
};
object.inherits(VarBase, Abstract);
/**
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
VarBase.prototype.toJson = function() {
const json = VarBase.superClass_.toJson.call(this);
json['varId'] = this.varId;
return json;
};
/**
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
VarBase.prototype.fromJson = function(json) {
VarBase.superClass_.toJson.call(this);
this.varId = json['varId'];
};
fromJson(json) {
super.fromJson(json);
this.varId = json['varId'];
}
}
exports.VarBase = VarBase;

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,6 @@
*/
goog.module('Blockly.BasicCursor');
const object = goog.require('Blockly.utils.object');
const registry = goog.require('Blockly.registry');
const {ASTNode} = goog.require('Blockly.ASTNode');
const {Cursor} = goog.require('Blockly.Cursor');
@@ -27,14 +26,191 @@ const {Cursor} = goog.require('Blockly.Cursor');
* Class for a basic cursor.
* This will allow the user to get to all nodes in the AST by hitting next or
* previous.
* @constructor
* @extends {Cursor}
* @alias Blockly.BasicCursor
*/
const BasicCursor = function() {
BasicCursor.superClass_.constructor.call(this);
};
object.inherits(BasicCursor, Cursor);
class BasicCursor extends Cursor {
/**
* @alias Blockly.BasicCursor
*/
constructor() {
super();
}
/**
* Find the next node in the pre order traversal.
* @return {?ASTNode} The next node, or null if the current node is
* not set or there is no next value.
* @override
*/
next() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
const newNode = this.getNextNode_(curNode, this.validNode_);
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
}
/**
* For a basic cursor we only have the ability to go next and previous, so
* in will also allow the user to get to the next node in the pre order
* traversal.
* @return {?ASTNode} The next node, or null if the current node is
* not set or there is no next value.
* @override
*/
in() {
return this.next();
}
/**
* Find the previous node in the pre order traversal.
* @return {?ASTNode} The previous node, or null if the current node
* is not set or there is no previous value.
* @override
*/
prev() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
const newNode = this.getPreviousNode_(curNode, this.validNode_);
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
}
/**
* For a basic cursor we only have the ability to go next and previous, so
* out will allow the user to get to the previous node in the pre order
* traversal.
* @return {?ASTNode} The previous node, or null if the current node is
* not set or there is no previous value.
* @override
*/
out() {
return this.prev();
}
/**
* Uses pre order traversal to navigate the Blockly AST. This will allow
* a user to easily navigate the entire Blockly AST without having to go in
* and out levels on the tree.
* @param {?ASTNode} node The current position in the AST.
* @param {!function(ASTNode) : boolean} isValid A function true/false
* depending on whether the given node should be traversed.
* @return {?ASTNode} The next node in the traversal.
* @protected
*/
getNextNode_(node, isValid) {
if (!node) {
return null;
}
const newNode = node.in() || node.next();
if (isValid(newNode)) {
return newNode;
} else if (newNode) {
return this.getNextNode_(newNode, isValid);
}
const siblingOrParent = this.findSiblingOrParent_(node.out());
if (isValid(siblingOrParent)) {
return siblingOrParent;
} else if (siblingOrParent) {
return this.getNextNode_(siblingOrParent, isValid);
}
return null;
}
/**
* Reverses the pre order traversal in order to find the previous node. This
* will allow a user to easily navigate the entire Blockly AST without having
* to go in and out levels on the tree.
* @param {?ASTNode} node The current position in the AST.
* @param {!function(ASTNode) : boolean} isValid A function true/false
* depending on whether the given node should be traversed.
* @return {?ASTNode} The previous node in the traversal or null if no
* previous node exists.
* @protected
*/
getPreviousNode_(node, isValid) {
if (!node) {
return null;
}
let newNode = node.prev();
if (newNode) {
newNode = this.getRightMostChild_(newNode);
} else {
newNode = node.out();
}
if (isValid(newNode)) {
return newNode;
} else if (newNode) {
return this.getPreviousNode_(newNode, isValid);
}
return null;
}
/**
* Decides what nodes to traverse and which ones to skip. Currently, it
* skips output, stack and workspace nodes.
* @param {?ASTNode} node The AST node to check whether it is valid.
* @return {boolean} True if the node should be visited, false otherwise.
* @protected
*/
validNode_(node) {
let isValid = false;
const type = node && node.getType();
if (type === ASTNode.types.OUTPUT || type === ASTNode.types.INPUT ||
type === ASTNode.types.FIELD || type === ASTNode.types.NEXT ||
type === ASTNode.types.PREVIOUS || type === ASTNode.types.WORKSPACE) {
isValid = true;
}
return isValid;
}
/**
* From the given node find either the next valid sibling or parent.
* @param {?ASTNode} node The current position in the AST.
* @return {?ASTNode} The parent AST node or null if there are no
* valid parents.
* @private
*/
findSiblingOrParent_(node) {
if (!node) {
return null;
}
const nextNode = node.next();
if (nextNode) {
return nextNode;
}
return this.findSiblingOrParent_(node.out());
}
/**
* Get the right most child of a node.
* @param {?ASTNode} node The node to find the right most child of.
* @return {?ASTNode} The right most child of the given node, or the node
* if no child exists.
* @private
*/
getRightMostChild_(node) {
if (!node.in()) {
return node;
}
let newNode = node.in();
while (newNode.next()) {
newNode = newNode.next();
}
return this.getRightMostChild_(newNode);
}
}
/**
* Name used for registering a basic cursor.
@@ -42,182 +218,6 @@ object.inherits(BasicCursor, Cursor);
*/
BasicCursor.registrationName = 'basicCursor';
/**
* Find the next node in the pre order traversal.
* @return {?ASTNode} The next node, or null if the current node is
* not set or there is no next value.
* @override
*/
BasicCursor.prototype.next = function() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
const newNode = this.getNextNode_(curNode, this.validNode_);
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
};
/**
* For a basic cursor we only have the ability to go next and previous, so
* in will also allow the user to get to the next node in the pre order
* traversal.
* @return {?ASTNode} The next node, or null if the current node is
* not set or there is no next value.
* @override
*/
BasicCursor.prototype.in = function() {
return this.next();
};
/**
* Find the previous node in the pre order traversal.
* @return {?ASTNode} The previous node, or null if the current node
* is not set or there is no previous value.
* @override
*/
BasicCursor.prototype.prev = function() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
const newNode = this.getPreviousNode_(curNode, this.validNode_);
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
};
/**
* For a basic cursor we only have the ability to go next and previous, so
* out will allow the user to get to the previous node in the pre order
* traversal.
* @return {?ASTNode} The previous node, or null if the current node is
* not set or there is no previous value.
* @override
*/
BasicCursor.prototype.out = function() {
return this.prev();
};
/**
* Uses pre order traversal to navigate the Blockly AST. This will allow
* a user to easily navigate the entire Blockly AST without having to go in
* and out levels on the tree.
* @param {?ASTNode} node The current position in the AST.
* @param {!function(ASTNode) : boolean} isValid A function true/false
* depending on whether the given node should be traversed.
* @return {?ASTNode} The next node in the traversal.
* @protected
*/
BasicCursor.prototype.getNextNode_ = function(node, isValid) {
if (!node) {
return null;
}
const newNode = node.in() || node.next();
if (isValid(newNode)) {
return newNode;
} else if (newNode) {
return this.getNextNode_(newNode, isValid);
}
const siblingOrParent = this.findSiblingOrParent_(node.out());
if (isValid(siblingOrParent)) {
return siblingOrParent;
} else if (siblingOrParent) {
return this.getNextNode_(siblingOrParent, isValid);
}
return null;
};
/**
* Reverses the pre order traversal in order to find the previous node. This
* will allow a user to easily navigate the entire Blockly AST without having to
* go in and out levels on the tree.
* @param {?ASTNode} node The current position in the AST.
* @param {!function(ASTNode) : boolean} isValid A function true/false
* depending on whether the given node should be traversed.
* @return {?ASTNode} The previous node in the traversal or null if no
* previous node exists.
* @protected
*/
BasicCursor.prototype.getPreviousNode_ = function(node, isValid) {
if (!node) {
return null;
}
let newNode = node.prev();
if (newNode) {
newNode = this.getRightMostChild_(newNode);
} else {
newNode = node.out();
}
if (isValid(newNode)) {
return newNode;
} else if (newNode) {
return this.getPreviousNode_(newNode, isValid);
}
return null;
};
/**
* Decides what nodes to traverse and which ones to skip. Currently, it
* skips output, stack and workspace nodes.
* @param {?ASTNode} node The AST node to check whether it is valid.
* @return {boolean} True if the node should be visited, false otherwise.
* @protected
*/
BasicCursor.prototype.validNode_ = function(node) {
let isValid = false;
const type = node && node.getType();
if (type === ASTNode.types.OUTPUT || type === ASTNode.types.INPUT ||
type === ASTNode.types.FIELD || type === ASTNode.types.NEXT ||
type === ASTNode.types.PREVIOUS || type === ASTNode.types.WORKSPACE) {
isValid = true;
}
return isValid;
};
/**
* From the given node find either the next valid sibling or parent.
* @param {?ASTNode} node The current position in the AST.
* @return {?ASTNode} The parent AST node or null if there are no
* valid parents.
* @private
*/
BasicCursor.prototype.findSiblingOrParent_ = function(node) {
if (!node) {
return null;
}
const nextNode = node.next();
if (nextNode) {
return nextNode;
}
return this.findSiblingOrParent_(node.out());
};
/**
* Get the right most child of a node.
* @param {?ASTNode} node The node to find the right most child of.
* @return {?ASTNode} The right most child of the given node, or the node
* if no child exists.
* @private
*/
BasicCursor.prototype.getRightMostChild_ = function(node) {
if (!node.in()) {
return node;
}
let newNode = node.in();
while (newNode.next()) {
newNode = newNode.next();
}
return this.getRightMostChild_(newNode);
};
registry.register(
registry.Type.CURSOR, BasicCursor.registrationName, BasicCursor);

View File

@@ -17,7 +17,6 @@
*/
goog.module('Blockly.Cursor');
const object = goog.require('Blockly.utils.object');
const registry = goog.require('Blockly.registry');
const {ASTNode} = goog.require('Blockly.ASTNode');
const {Marker} = goog.require('Blockly.Marker');
@@ -25,117 +24,119 @@ const {Marker} = goog.require('Blockly.Marker');
/**
* Class for a cursor.
* A cursor controls how a user navigates the Blockly AST.
* @constructor
* @extends {Marker}
* @alias Blockly.Cursor
*/
const Cursor = function() {
Cursor.superClass_.constructor.call(this);
class Cursor extends Marker {
/**
* @alias Blockly.Cursor
*/
constructor() {
super();
/**
* @override
*/
this.type = 'cursor';
}
/**
* @override
* Find the next connection, field, or block.
* @return {ASTNode} The next element, or null if the current node is
* not set or there is no next value.
* @public
*/
this.type = 'cursor';
};
object.inherits(Cursor, Marker);
next() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
/**
* Find the next connection, field, or block.
* @return {ASTNode} The next element, or null if the current node is
* not set or there is no next value.
* @public
*/
Cursor.prototype.next = function() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
let newNode = curNode.next();
while (newNode && newNode.next() &&
(newNode.getType() === ASTNode.types.NEXT ||
newNode.getType() === ASTNode.types.BLOCK)) {
newNode = newNode.next();
}
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
}
let newNode = curNode.next();
while (newNode && newNode.next() &&
(newNode.getType() === ASTNode.types.NEXT ||
newNode.getType() === ASTNode.types.BLOCK)) {
newNode = newNode.next();
/**
* Find the in connection or field.
* @return {ASTNode} The in element, or null if the current node is
* not set or there is no in value.
* @public
*/
in() {
let curNode = this.getCurNode();
if (!curNode) {
return null;
}
// If we are on a previous or output connection, go to the block level
// before performing next operation.
if (curNode.getType() === ASTNode.types.PREVIOUS ||
curNode.getType() === ASTNode.types.OUTPUT) {
curNode = curNode.next();
}
const newNode = curNode.in();
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
}
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
};
/**
* Find the previous connection, field, or block.
* @return {ASTNode} The previous element, or null if the current node
* is not set or there is no previous value.
* @public
*/
prev() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
let newNode = curNode.prev();
/**
* Find the in connection or field.
* @return {ASTNode} The in element, or null if the current node is
* not set or there is no in value.
* @public
*/
Cursor.prototype.in = function() {
let curNode = this.getCurNode();
if (!curNode) {
return null;
}
// If we are on a previous or output connection, go to the block level before
// performing next operation.
if (curNode.getType() === ASTNode.types.PREVIOUS ||
curNode.getType() === ASTNode.types.OUTPUT) {
curNode = curNode.next();
}
const newNode = curNode.in();
while (newNode && newNode.prev() &&
(newNode.getType() === ASTNode.types.NEXT ||
newNode.getType() === ASTNode.types.BLOCK)) {
newNode = newNode.prev();
}
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
};
/**
* Find the previous connection, field, or block.
* @return {ASTNode} The previous element, or null if the current node
* is not set or there is no previous value.
* @public
*/
Cursor.prototype.prev = function() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
let newNode = curNode.prev();
while (newNode && newNode.prev() &&
(newNode.getType() === ASTNode.types.NEXT ||
newNode.getType() === ASTNode.types.BLOCK)) {
newNode = newNode.prev();
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
}
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
};
/**
* Find the out connection, field, or block.
* @return {ASTNode} The out element, or null if the current node is
* not set or there is no out value.
* @public
*/
out() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
let newNode = curNode.out();
/**
* Find the out connection, field, or block.
* @return {ASTNode} The out element, or null if the current node is
* not set or there is no out value.
* @public
*/
Cursor.prototype.out = function() {
const curNode = this.getCurNode();
if (!curNode) {
return null;
}
let newNode = curNode.out();
if (newNode && newNode.getType() === ASTNode.types.BLOCK) {
newNode = newNode.prev() || newNode;
}
if (newNode && newNode.getType() === ASTNode.types.BLOCK) {
newNode = newNode.prev() || newNode;
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
}
if (newNode) {
this.setCurNode(newNode);
}
return newNode;
};
}
registry.register(registry.Type.CURSOR, registry.DEFAULT, Cursor);

View File

@@ -26,105 +26,108 @@ const {MarkerSvg} = goog.requireType('Blockly.blockRendering.MarkerSvg');
/**
* Class for a marker.
* This is used in keyboard navigation to save a location in the Blockly AST.
* @constructor
* @alias Blockly.Marker
*/
const Marker = function() {
class Marker {
/**
* The colour of the marker.
* @type {?string}
* @alias Blockly.Marker
*/
this.colour = null;
constructor() {
/**
* The colour of the marker.
* @type {?string}
*/
this.colour = null;
/**
* The current location of the marker.
* @type {ASTNode}
* @private
*/
this.curNode_ = null;
/**
* The object in charge of drawing the visual representation of the current
* node.
* @type {MarkerSvg}
* @private
*/
this.drawer_ = null;
/**
* The type of the marker.
* @type {string}
*/
this.type = 'marker';
}
/**
* The current location of the marker.
* @type {ASTNode}
* @private
* Sets the object in charge of drawing the marker.
* @param {MarkerSvg} drawer The object in charge of
* drawing the marker.
*/
this.curNode_ = null;
setDrawer(drawer) {
this.drawer_ = drawer;
}
/**
* The object in charge of drawing the visual representation of the current
* node.
* @type {MarkerSvg}
* @private
* Get the current drawer for the marker.
* @return {MarkerSvg} The object in charge of drawing
* the marker.
*/
this.drawer_ = null;
getDrawer() {
return this.drawer_;
}
/**
* The type of the marker.
* @type {string}
* Gets the current location of the marker.
* @return {ASTNode} The current field, connection, or block the marker
* is on.
*/
this.type = 'marker';
};
/**
* Sets the object in charge of drawing the marker.
* @param {MarkerSvg} drawer The object in charge of
* drawing the marker.
*/
Marker.prototype.setDrawer = function(drawer) {
this.drawer_ = drawer;
};
/**
* Get the current drawer for the marker.
* @return {MarkerSvg} The object in charge of drawing
* the marker.
*/
Marker.prototype.getDrawer = function() {
return this.drawer_;
};
/**
* Gets the current location of the marker.
* @return {ASTNode} The current field, connection, or block the marker
* is on.
*/
Marker.prototype.getCurNode = function() {
return this.curNode_;
};
/**
* Set the location of the marker and call the update method.
* Setting isStack to true will only work if the newLocation is the top most
* output or previous connection on a stack.
* @param {ASTNode} newNode The new location of the marker.
*/
Marker.prototype.setCurNode = function(newNode) {
const oldNode = this.curNode_;
this.curNode_ = newNode;
if (this.drawer_) {
this.drawer_.draw(oldNode, this.curNode_);
getCurNode() {
return this.curNode_;
}
};
/**
* Redraw the current marker.
* @package
*/
Marker.prototype.draw = function() {
if (this.drawer_) {
this.drawer_.draw(this.curNode_, this.curNode_);
/**
* Set the location of the marker and call the update method.
* Setting isStack to true will only work if the newLocation is the top most
* output or previous connection on a stack.
* @param {ASTNode} newNode The new location of the marker.
*/
setCurNode(newNode) {
const oldNode = this.curNode_;
this.curNode_ = newNode;
if (this.drawer_) {
this.drawer_.draw(oldNode, this.curNode_);
}
}
};
/**
* Hide the marker SVG.
*/
Marker.prototype.hide = function() {
if (this.drawer_) {
this.drawer_.hide();
/**
* Redraw the current marker.
* @package
*/
draw() {
if (this.drawer_) {
this.drawer_.draw(this.curNode_, this.curNode_);
}
}
};
/**
* Dispose of this marker.
*/
Marker.prototype.dispose = function() {
if (this.getDrawer()) {
this.getDrawer().dispose();
/**
* Hide the marker SVG.
*/
hide() {
if (this.drawer_) {
this.drawer_.hide();
}
}
};
/**
* Dispose of this marker.
*/
dispose() {
if (this.getDrawer()) {
this.getDrawer().dispose();
}
}
}
exports.Marker = Marker;

View File

@@ -17,7 +17,6 @@
*/
goog.module('Blockly.TabNavigateCursor');
const object = goog.require('Blockly.utils.object');
const {ASTNode} = goog.require('Blockly.ASTNode');
const {BasicCursor} = goog.require('Blockly.BasicCursor');
/* eslint-disable-next-line no-unused-vars */
@@ -26,32 +25,34 @@ const {Field} = goog.requireType('Blockly.Field');
/**
* A cursor for navigating between tab navigable fields.
* @constructor
* @extends {BasicCursor}
* @alias Blockly.TabNavigateCursor
*/
const TabNavigateCursor = function() {
TabNavigateCursor.superClass_.constructor.call(this);
};
object.inherits(TabNavigateCursor, BasicCursor);
/**
* Skip all nodes except for tab navigable fields.
* @param {?ASTNode} node The AST node to check whether it is valid.
* @return {boolean} True if the node should be visited, false otherwise.
* @override
*/
TabNavigateCursor.prototype.validNode_ = function(node) {
let isValid = false;
const type = node && node.getType();
if (node) {
const location = /** @type {Field} */ (node.getLocation());
if (type === ASTNode.types.FIELD && location && location.isTabNavigable() &&
location.isClickable()) {
isValid = true;
}
class TabNavigateCursor extends BasicCursor {
/**
* @alias Blockly.TabNavigateCursor
*/
constructor() {
super();
}
return isValid;
};
/**
* Skip all nodes except for tab navigable fields.
* @param {?ASTNode} node The AST node to check whether it is valid.
* @return {boolean} True if the node should be visited, false otherwise.
* @override
*/
validNode_(node) {
let isValid = false;
const type = node && node.getType();
if (node) {
const location = /** @type {Field} */ (node.getLocation());
if (type === ASTNode.types.FIELD && location &&
location.isTabNavigable() && location.isClickable()) {
isValid = true;
}
}
return isValid;
}
}
exports.TabNavigateCursor = TabNavigateCursor;

File diff suppressed because it is too large Load Diff

View File

@@ -20,28 +20,30 @@ goog.module('Blockly.utils.Svg');
/**
* A name with the type of the SVG element stored in the generic.
* @param {string} tagName The SVG element tag name.
* @constructor
* @template T
* @private
* @alias Blockly.utils.Svg
*/
const Svg = function(tagName) {
class Svg {
/**
* @type {string}
* @private
* @param {string} tagName The SVG element tag name.
* @package
* @alias Blockly.utils.Svg
*/
this.tagName_ = tagName;
};
constructor(tagName) {
/**
* @type {string}
* @private
*/
this.tagName_ = tagName;
}
/**
* Returns the SVG element tag name.
* @return {string} The name.
* @override
*/
Svg.prototype.toString = function() {
return this.tagName_;
};
/**
* Returns the SVG element tag name.
* @return {string} The name.
*/
toString() {
return this.tagName_;
}
}
/**
* @type {!Svg<!SVGAnimateElement>}

View File

@@ -81,8 +81,8 @@
"./core/warning.js",
"./core/events/events_bubble_open.js",
"./core/comment.js",
"./core/events/events_block_move.js",
"./core/events/events_block_drag.js",
"./core/events/events_block_move.js",
"./core/bump_objects.js",
"./core/block_dragger.js",
"./core/workspace_dragger.js",
@@ -258,6 +258,7 @@
"./core/events/events_var_create.js",
"./core/variable_model.js",
"./core/variables.js",
"./core/utils/object.js",
"./core/events/events_abstract.js",
"./core/events/utils.js",
"./core/xml.js",

View File

@@ -33,21 +33,21 @@ goog.addDependency('../../core/contextmenu.js', ['Blockly.ContextMenu'], ['Block
goog.addDependency('../../core/contextmenu_items.js', ['Blockly.ContextMenuItems'], ['Blockly.ContextMenuRegistry', 'Blockly.Events', 'Blockly.Events.utils', 'Blockly.Msg', 'Blockly.clipboard', 'Blockly.dialog', 'Blockly.inputTypes', 'Blockly.utils.idGenerator', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/contextmenu_registry.js', ['Blockly.ContextMenuRegistry'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/css.js', ['Blockly.Css'], ['Blockly.utils.deprecation'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/delete_area.js', ['Blockly.DeleteArea'], ['Blockly.BlockSvg', 'Blockly.DragTarget', 'Blockly.IDeleteArea', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/delete_area.js', ['Blockly.DeleteArea'], ['Blockly.BlockSvg', 'Blockly.DragTarget', 'Blockly.IDeleteArea'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/dialog.js', ['Blockly.dialog'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/drag_target.js', ['Blockly.DragTarget'], ['Blockly.IDragTarget'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/dropdowndiv.js', ['Blockly.DropDownDiv'], ['Blockly.common', 'Blockly.utils.Rect', 'Blockly.utils.dom', 'Blockly.utils.math', 'Blockly.utils.style'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events.js', ['Blockly.Events'], ['Blockly.Events.Abstract', 'Blockly.Events.BlockBase', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockDrag', 'Blockly.Events.BlockMove', 'Blockly.Events.BubbleOpen', 'Blockly.Events.Click', 'Blockly.Events.CommentBase', 'Blockly.Events.CommentChange', 'Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove', 'Blockly.Events.FinishedLoading', 'Blockly.Events.MarkerMove', 'Blockly.Events.Selected', 'Blockly.Events.ThemeChange', 'Blockly.Events.ToolboxItemSelect', 'Blockly.Events.TrashcanOpen', 'Blockly.Events.Ui', 'Blockly.Events.UiBase', 'Blockly.Events.VarBase', 'Blockly.Events.VarCreate', 'Blockly.Events.VarDelete', 'Blockly.Events.VarRename', 'Blockly.Events.ViewportChange', 'Blockly.Events.utils', 'Blockly.utils.deprecation'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_abstract.js', ['Blockly.Events.Abstract'], ['Blockly.Events.utils'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_block_base.js', ['Blockly.Events.BlockBase'], ['Blockly.Events.Abstract', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_block_base.js', ['Blockly.Events.BlockBase'], ['Blockly.Events.Abstract'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_block_change.js', ['Blockly.Events.BlockChange'], ['Blockly.Events.BlockBase', 'Blockly.Events.utils', 'Blockly.Xml', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_block_create.js', ['Blockly.Events.BlockCreate'], ['Blockly.Events.BlockBase', 'Blockly.Events.utils', 'Blockly.Xml', 'Blockly.registry', 'Blockly.serialization.blocks'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_block_delete.js', ['Blockly.Events.BlockDelete'], ['Blockly.Events.BlockBase', 'Blockly.Events.utils', 'Blockly.Xml', 'Blockly.registry', 'Blockly.serialization.blocks'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_block_drag.js', ['Blockly.Events.BlockDrag'], ['Blockly.Events.UiBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_block_move.js', ['Blockly.Events.BlockMove'], ['Blockly.ConnectionType', 'Blockly.Events.BlockBase', 'Blockly.Events.utils', 'Blockly.registry', 'Blockly.utils.Coordinate'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_bubble_open.js', ['Blockly.Events.BubbleOpen'], ['Blockly.Events.UiBase', 'Blockly.Events.utils', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_bubble_open.js', ['Blockly.Events.BubbleOpen'], ['Blockly.Events.UiBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_click.js', ['Blockly.Events.Click'], ['Blockly.Events.UiBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_comment_base.js', ['Blockly.Events.CommentBase'], ['Blockly.Events.Abstract', 'Blockly.Events.utils', 'Blockly.Xml', 'Blockly.utils.object', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_comment_base.js', ['Blockly.Events.CommentBase'], ['Blockly.Events.Abstract', 'Blockly.Events.utils', 'Blockly.Xml', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_comment_change.js', ['Blockly.Events.CommentChange'], ['Blockly.Events.CommentBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_comment_create.js', ['Blockly.Events.CommentCreate'], ['Blockly.Events.CommentBase', 'Blockly.Events.utils', 'Blockly.Xml', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_comment_delete.js', ['Blockly.Events.CommentDelete'], ['Blockly.Events.CommentBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
@@ -58,8 +58,8 @@ goog.addDependency('../../core/events/events_theme_change.js', ['Blockly.Events.
goog.addDependency('../../core/events/events_toolbox_item_select.js', ['Blockly.Events.ToolboxItemSelect'], ['Blockly.Events.UiBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_trashcan_open.js', ['Blockly.Events.TrashcanOpen'], ['Blockly.Events.UiBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_ui.js', ['Blockly.Events.Ui'], ['Blockly.Events.UiBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_ui_base.js', ['Blockly.Events.UiBase'], ['Blockly.Events.Abstract', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_var_base.js', ['Blockly.Events.VarBase'], ['Blockly.Events.Abstract', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_ui_base.js', ['Blockly.Events.UiBase'], ['Blockly.Events.Abstract'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_var_base.js', ['Blockly.Events.VarBase'], ['Blockly.Events.Abstract'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_var_create.js', ['Blockly.Events.VarCreate'], ['Blockly.Events.VarBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_var_delete.js', ['Blockly.Events.VarDelete'], ['Blockly.Events.VarBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_var_rename.js', ['Blockly.Events.VarRename'], ['Blockly.Events.VarBase', 'Blockly.Events.utils', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
@@ -124,10 +124,10 @@ goog.addDependency('../../core/interfaces/i_toolbox.js', ['Blockly.IToolbox'], [
goog.addDependency('../../core/interfaces/i_toolbox_item.js', ['Blockly.IToolboxItem'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/internal_constants.js', ['Blockly.internalConstants'], ['Blockly.ConnectionType'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/ast_node.js', ['Blockly.ASTNode'], ['Blockly.ConnectionType', 'Blockly.utils.Coordinate'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/basic_cursor.js', ['Blockly.BasicCursor'], ['Blockly.ASTNode', 'Blockly.Cursor', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/cursor.js', ['Blockly.Cursor'], ['Blockly.ASTNode', 'Blockly.Marker', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/basic_cursor.js', ['Blockly.BasicCursor'], ['Blockly.ASTNode', 'Blockly.Cursor', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/cursor.js', ['Blockly.Cursor'], ['Blockly.ASTNode', 'Blockly.Marker', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/marker.js', ['Blockly.Marker'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/tab_navigate_cursor.js', ['Blockly.TabNavigateCursor'], ['Blockly.ASTNode', 'Blockly.BasicCursor', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/tab_navigate_cursor.js', ['Blockly.TabNavigateCursor'], ['Blockly.ASTNode', 'Blockly.BasicCursor'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/marker_manager.js', ['Blockly.MarkerManager'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/menu.js', ['Blockly.Menu'], ['Blockly.browserEvents', 'Blockly.utils.Coordinate', 'Blockly.utils.KeyCodes', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.style'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/menuitem.js', ['Blockly.MenuItem'], ['Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.idGenerator'], {'lang': 'es6', 'module': 'goog'});
@@ -219,7 +219,7 @@ goog.addDependency('../../core/theme_manager.js', ['Blockly.ThemeManager'], ['Bl
goog.addDependency('../../core/toolbox/category.js', ['Blockly.ToolboxCategory'], ['Blockly.Css', 'Blockly.ISelectableToolboxItem', 'Blockly.ToolboxItem', 'Blockly.registry', 'Blockly.utils.aria', 'Blockly.utils.colour', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.parsing', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/collapsible_category.js', ['Blockly.CollapsibleToolboxCategory'], ['Blockly.ICollapsibleToolboxItem', 'Blockly.ToolboxCategory', 'Blockly.ToolboxSeparator', 'Blockly.registry', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/separator.js', ['Blockly.ToolboxSeparator'], ['Blockly.Css', 'Blockly.ToolboxItem', 'Blockly.registry', 'Blockly.utils.dom', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/toolbox.js', ['Blockly.Toolbox'], ['Blockly.BlockSvg', 'Blockly.CollapsibleToolboxCategory', 'Blockly.ComponentManager', 'Blockly.Css', 'Blockly.DeleteArea', 'Blockly.Events.ToolboxItemSelect', 'Blockly.Events.utils', 'Blockly.IAutoHideable', 'Blockly.IKeyboardAccessible', 'Blockly.IStyleable', 'Blockly.IToolbox', 'Blockly.Options', 'Blockly.Touch', 'Blockly.browserEvents', 'Blockly.common', 'Blockly.registry', 'Blockly.utils.KeyCodes', 'Blockly.utils.Rect', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/toolbox.js', ['Blockly.Toolbox'], ['Blockly.BlockSvg', 'Blockly.CollapsibleToolboxCategory', 'Blockly.ComponentManager', 'Blockly.Css', 'Blockly.DeleteArea', 'Blockly.Events.ToolboxItemSelect', 'Blockly.Events.utils', 'Blockly.IAutoHideable', 'Blockly.IKeyboardAccessible', 'Blockly.IStyleable', 'Blockly.IToolbox', 'Blockly.Options', 'Blockly.Touch', 'Blockly.browserEvents', 'Blockly.common', 'Blockly.registry', 'Blockly.utils.KeyCodes', 'Blockly.utils.Rect', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/toolbox_item.js', ['Blockly.ToolboxItem'], ['Blockly.IToolboxItem', 'Blockly.utils.idGenerator'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/tooltip.js', ['Blockly.Tooltip'], ['Blockly.browserEvents', 'Blockly.common', 'Blockly.utils.deprecation', 'Blockly.utils.string'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/touch.js', ['Blockly.Touch'], ['Blockly.utils.global', 'Blockly.utils.string'], {'lang': 'es6', 'module': 'goog'});