mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Break up interfaces in core/i_toolbox_item.js into separate files
This commit is contained in:
45
core/interfaces/i_collapsible_toolbox_item.js
Normal file
45
core/interfaces/i_collapsible_toolbox_item.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview The interface for a collapsible toolbox item.
|
||||
* @author kozbial@google.com (Monica Kozbial)
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.ICollapsibleToolboxItem');
|
||||
|
||||
goog.require('Blockly.IToolboxItem');
|
||||
goog.requireType('Blockly.utils.toolbox');
|
||||
|
||||
|
||||
/**
|
||||
* Interface for an item in the toolbox that can be collapsed.
|
||||
* @extends {Blockly.ISelectableToolboxItem}
|
||||
* @interface
|
||||
*/
|
||||
Blockly.ICollapsibleToolboxItem = function() {};
|
||||
|
||||
/**
|
||||
* Gets any children toolbox items. (ex. Gets the subcategories)
|
||||
* @return {!Array<!Blockly.IToolboxItem>} The child toolbox items.
|
||||
*/
|
||||
Blockly.ICollapsibleToolboxItem.prototype.getChildToolboxItems;
|
||||
|
||||
/**
|
||||
* Whether the toolbox item is expanded to show its child subcategories.
|
||||
* @return {boolean} True if the toolbox item shows its children, false if it
|
||||
* is collapsed.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ICollapsibleToolboxItem.prototype.isExpanded;
|
||||
|
||||
/**
|
||||
* Toggles whether or not the toolbox item is expanded.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ICollapsibleToolboxItem.prototype.toggleExpanded;
|
||||
65
core/interfaces/i_selectable_toolbox_item.js
Normal file
65
core/interfaces/i_selectable_toolbox_item.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview The interface for a selectable toolbox item.
|
||||
* @author aschmiedt@google.com (Abby Schmiedt)
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.ISelectableToolboxItem');
|
||||
|
||||
goog.require('Blockly.IToolboxItem');
|
||||
goog.requireType('Blockly.utils.toolbox');
|
||||
|
||||
|
||||
/**
|
||||
* Interface for an item in the toolbox that can be selected.
|
||||
* @extends {Blockly.IToolboxItem}
|
||||
* @interface
|
||||
*/
|
||||
Blockly.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;
|
||||
|
||||
/**
|
||||
* Gets the contents of the toolbox item. These are items that are meant to be
|
||||
* displayed in the flyout.
|
||||
* @return {!Blockly.utils.toolbox.FlyoutItemInfoArray|string} The definition
|
||||
* of items to be displayed in the flyout.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.getContents;
|
||||
|
||||
/**
|
||||
* Sets the current toolbox item as selected.
|
||||
* @param {boolean} _isSelected True if this category is selected, false
|
||||
* otherwise.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.setSelected;
|
||||
|
||||
/**
|
||||
* Gets the HTML element that is clickable.
|
||||
* The parent toolbox element receives clicks. The parent toolbox will add an ID
|
||||
* to this element so it can pass the onClick event to the correct toolboxItem.
|
||||
* @return {!Element} The HTML element that receives clicks.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.getClickTarget;
|
||||
|
||||
/**
|
||||
* Handles when the toolbox item is clicked.
|
||||
* @param {!Event} _e Click event to handle.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.onClick;
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.ICollapsibleToolboxItem');
|
||||
goog.provide('Blockly.ISelectableToolboxItem');
|
||||
goog.provide('Blockly.IToolboxItem');
|
||||
|
||||
goog.requireType('Blockly.utils.toolbox');
|
||||
@@ -81,77 +79,3 @@ Blockly.IToolboxItem.prototype.isCollapsible;
|
||||
* @public
|
||||
*/
|
||||
Blockly.IToolboxItem.prototype.dispose;
|
||||
|
||||
/**
|
||||
* Interface for an item in the toolbox that can be selected.
|
||||
* @extends {Blockly.IToolboxItem}
|
||||
* @interface
|
||||
*/
|
||||
Blockly.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;
|
||||
|
||||
/**
|
||||
* Gets the contents of the toolbox item. These are items that are meant to be
|
||||
* displayed in the flyout.
|
||||
* @return {!Blockly.utils.toolbox.FlyoutItemInfoArray|string} The definition
|
||||
* of items to be displayed in the flyout.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.getContents;
|
||||
|
||||
/**
|
||||
* Sets the current toolbox item as selected.
|
||||
* @param {boolean} _isSelected True if this category is selected, false
|
||||
* otherwise.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.setSelected;
|
||||
|
||||
/**
|
||||
* Gets the HTML element that is clickable.
|
||||
* The parent toolbox element receives clicks. The parent toolbox will add an ID
|
||||
* to this element so it can pass the onClick event to the correct toolboxItem.
|
||||
* @return {!Element} The HTML element that receives clicks.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.getClickTarget;
|
||||
|
||||
/**
|
||||
* Handles when the toolbox item is clicked.
|
||||
* @param {!Event} _e Click event to handle.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.onClick;
|
||||
|
||||
/**
|
||||
* Interface for an item in the toolbox that can be collapsed.
|
||||
* @extends {Blockly.ISelectableToolboxItem}
|
||||
* @interface
|
||||
*/
|
||||
Blockly.ICollapsibleToolboxItem = function() {};
|
||||
|
||||
/**
|
||||
* Gets any children toolbox items. (ex. Gets the subcategories)
|
||||
* @return {!Array<!Blockly.IToolboxItem>} The child toolbox items.
|
||||
*/
|
||||
Blockly.ICollapsibleToolboxItem.prototype.getChildToolboxItems;
|
||||
|
||||
/**
|
||||
* Whether the toolbox item is expanded to show its child subcategories.
|
||||
* @return {boolean} True if the toolbox item shows its children, false if it
|
||||
* is collapsed.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ICollapsibleToolboxItem.prototype.isExpanded;
|
||||
|
||||
/**
|
||||
* Toggles whether or not the toolbox item is expanded.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ICollapsibleToolboxItem.prototype.toggleExpanded;
|
||||
|
||||
Reference in New Issue
Block a user