@blockly/continuous-toolbox
Version:
A Blockly plugin that adds a continous-scrolling style toolbox and flyout
89 lines • 3.08 kB
TypeScript
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Toolbox that uses a continuous scrolling flyout.
*/
import * as Blockly from 'blockly/core';
import { ContinuousFlyout } from './ContinuousFlyout';
/**
* Class for continuous toolbox.
*/
export declare class ContinuousToolbox extends Blockly.Toolbox {
/**
* Timeout ID used to prevent refreshing the flyout during extensive block
* changes.
*/
private refreshDebouncer?;
/**
* Initializes the continuous toolbox.
*/
init(): void;
/**
* Returns the continuous toolbox's flyout.
*
* @returns The toolbox's flyout.
*/
getFlyout(): ContinuousFlyout;
/**
* Gets the contents that should be shown in the flyout immediately.
* This includes all blocks and labels for each category of block.
*
* @returns Flyout contents.
*/
private getInitialFlyoutContents;
/**
* Converts a given toolbox item to an array of flyout items, generally a
* label followed by the category's blocks.
*
* @param toolboxItem The toolbox item/category to convert.
* @returns An array of flyout items contained in the given toolbox item.
*/
protected convertToolboxItemToFlyoutItems(toolboxItem: Blockly.IToolboxItem): Blockly.utils.toolbox.FlyoutItemInfoArray;
/**
* Updates the flyout's contents if it is visible.
*/
refreshSelection(): void;
/**
* Scrolls the flyout to display the newly selected category's contents.
*
* @param oldItem The previously selected toolbox category.
* @param newItem The newly selected toolbox category.
*/
updateFlyout_(oldItem: Blockly.ISelectableToolboxItem | null, newItem: Blockly.ISelectableToolboxItem | null): void;
/**
* Returns whether or not the toolbox should deselect the old category.
*
* @param oldItem The previously selected toolbox category.
* @param newItem The newly selected toolbox category.
*/
shouldDeselectItem_(oldItem: Blockly.ISelectableToolboxItem | null, newItem: Blockly.ISelectableToolboxItem | null): boolean;
/**
* Gets a category by name.
*
* @param name Name of category to get.
* @returns Category, or null if not found.
* @internal
*/
getCategoryByName(name: string): Blockly.ISelectableToolboxItem | null;
/**
* Selects the category with the given name.
* Similar to setSelectedItem, but importantly, does not call updateFlyout
* because this is called while the flyout is being scrolled.
*
* @param name Name of category to select.
* @internal
*/
selectCategoryByName(name: string): void;
/**
* Returns the bounding rectangle of the drag target/deletion area in pixels
* relative to the viewport.
*
* @returns The toolbox's bounding box. Null if drag target area should be
* ignored.
*/
getClientRect(): Blockly.utils.Rect | null;
}
//# sourceMappingURL=ContinuousToolbox.d.ts.map