Migrate core/interfaces/i_collapsible_toolbox_item.js, core/interfaces/i_selectable_toolbox_item.js, and core/interfaces/i_toolbox_item.js to goog.module

This commit is contained in:
kozbial
2021-07-19 11:09:51 -07:00
committed by Monica Kozbial
parent 599385891a
commit 1b09c8d8b7
4 changed files with 36 additions and 27 deletions

View File

@@ -11,10 +11,11 @@
'use strict';
goog.provide('Blockly.ICollapsibleToolboxItem');
goog.module('Blockly.ICollapsibleToolboxItem');
goog.module.declareLegacyNamespace();
goog.require('Blockly.IToolboxItem');
goog.requireType('Blockly.utils.toolbox');
goog.require('Blockly.ISelectableToolboxItem');
goog.requireType('Blockly.IToolboxItem');
/**
@@ -22,13 +23,13 @@ goog.requireType('Blockly.utils.toolbox');
* @extends {Blockly.ISelectableToolboxItem}
* @interface
*/
Blockly.ICollapsibleToolboxItem = function() {};
const ICollapsibleToolboxItem = function() {};
/**
* Gets any children toolbox items. (ex. Gets the subcategories)
* @return {!Array<!Blockly.IToolboxItem>} The child toolbox items.
*/
Blockly.ICollapsibleToolboxItem.prototype.getChildToolboxItems;
ICollapsibleToolboxItem.prototype.getChildToolboxItems;
/**
* Whether the toolbox item is expanded to show its child subcategories.
@@ -36,10 +37,12 @@ Blockly.ICollapsibleToolboxItem.prototype.getChildToolboxItems;
* is collapsed.
* @public
*/
Blockly.ICollapsibleToolboxItem.prototype.isExpanded;
ICollapsibleToolboxItem.prototype.isExpanded;
/**
* Toggles whether or not the toolbox item is expanded.
* @public
*/
Blockly.ICollapsibleToolboxItem.prototype.toggleExpanded;
ICollapsibleToolboxItem.prototype.toggleExpanded;
exports = ICollapsibleToolboxItem;

View File

@@ -11,7 +11,8 @@
'use strict';
goog.provide('Blockly.ISelectableToolboxItem');
goog.module('Blockly.ISelectableToolboxItem');
goog.module.declareLegacyNamespace();
goog.require('Blockly.IToolboxItem');
goog.requireType('Blockly.utils.toolbox');
@@ -22,14 +23,14 @@ goog.requireType('Blockly.utils.toolbox');
* @extends {Blockly.IToolboxItem}
* @interface
*/
Blockly.ISelectableToolboxItem = function() {};
const ISelectableToolboxItem = function() {};
/**
* Gets the name of the toolbox item. Used for emitting events.
* @return {string} The name of the toolbox item.
* @public
*/
Blockly.ISelectableToolboxItem.prototype.getName;
ISelectableToolboxItem.prototype.getName;
/**
* Gets the contents of the toolbox item. These are items that are meant to be
@@ -38,7 +39,7 @@ Blockly.ISelectableToolboxItem.prototype.getName;
* of items to be displayed in the flyout.
* @public
*/
Blockly.ISelectableToolboxItem.prototype.getContents;
ISelectableToolboxItem.prototype.getContents;
/**
* Sets the current toolbox item as selected.
@@ -46,7 +47,7 @@ Blockly.ISelectableToolboxItem.prototype.getContents;
* otherwise.
* @public
*/
Blockly.ISelectableToolboxItem.prototype.setSelected;
ISelectableToolboxItem.prototype.setSelected;
/**
* Gets the HTML element that is clickable.
@@ -55,11 +56,13 @@ Blockly.ISelectableToolboxItem.prototype.setSelected;
* @return {!Element} The HTML element that receives clicks.
* @public
*/
Blockly.ISelectableToolboxItem.prototype.getClickTarget;
ISelectableToolboxItem.prototype.getClickTarget;
/**
* Handles when the toolbox item is clicked.
* @param {!Event} _e Click event to handle.
* @public
*/
Blockly.ISelectableToolboxItem.prototype.onClick;
ISelectableToolboxItem.prototype.onClick;
exports = ISelectableToolboxItem;

View File

@@ -11,16 +11,15 @@
'use strict';
goog.provide('Blockly.IToolboxItem');
goog.requireType('Blockly.utils.toolbox');
goog.module('Blockly.IToolboxItem');
goog.module.declareLegacyNamespace();
/**
* Interface for an item in the toolbox.
* @interface
*/
Blockly.IToolboxItem = function() {};
const IToolboxItem = function() {};
/**
* Initializes the toolbox item.
@@ -29,21 +28,21 @@ Blockly.IToolboxItem = function() {};
* @return {void}
* @public
*/
Blockly.IToolboxItem.prototype.init;
IToolboxItem.prototype.init;
/**
* Gets the div for the toolbox item.
* @return {?Element} The div for the toolbox item.
* @public
*/
Blockly.IToolboxItem.prototype.getDiv;
IToolboxItem.prototype.getDiv;
/**
* Gets a unique identifier for this toolbox item.
* @return {string} The ID for the toolbox item.
* @public
*/
Blockly.IToolboxItem.prototype.getId;
IToolboxItem.prototype.getId;
/**
* Gets the parent if the toolbox item is nested.
@@ -51,31 +50,33 @@ Blockly.IToolboxItem.prototype.getId;
* this toolbox item is not nested.
* @public
*/
Blockly.IToolboxItem.prototype.getParent;
IToolboxItem.prototype.getParent;
/**
* Gets the nested level of the category.
* @return {number} The nested level of the category.
* @package
*/
Blockly.IToolboxItem.prototype.getLevel;
IToolboxItem.prototype.getLevel;
/**
* Whether the toolbox item is selectable.
* @return {boolean} True if the toolbox item can be selected.
* @public
*/
Blockly.IToolboxItem.prototype.isSelectable;
IToolboxItem.prototype.isSelectable;
/**
* Whether the toolbox item is collapsible.
* @return {boolean} True if the toolbox item is collapsible.
* @public
*/
Blockly.IToolboxItem.prototype.isCollapsible;
IToolboxItem.prototype.isCollapsible;
/**
* Dispose of this toolbox item. No-op by default.
* @public
*/
Blockly.IToolboxItem.prototype.dispose;
IToolboxItem.prototype.dispose;
exports = IToolboxItem;