mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
* fix(build): Restore erroneously-deleted filter function This was deleted in PR #7406 as it was mainly being used to filter core/ vs. test/mocha/ deps into separate deps files - but it turns out also to be used for filtering error messages too. Oops. * refactor(tests): Migrate advanced compilation test to ES Modules * refactor(build): Migrate main.js to TypeScript This turns out to be pretty straight forward, even if it would cause crashing if one actually tried to import this module instead of just feeding it to Closure Compiler. * chore(build): Remove goog.declareModuleId calls Replace goog.declareModuleId calls with a comment recording the former module ID for posterity (or at least until we decide how to reformat the renamings file. * chore(tests): Delete closure/goog/* For the moment we still need something to serve as base.js for the benefit of closure-make-deps, so we keep a vestigial base.js around, containing only the @provideGoog declaration. * refactor(build): Remove vestigial base.js By changing slightly the command line arguments to closure-make-deps and closure-calculate-chunks the need to have any base.js is eliminated. * chore: Typo fix for PR #7415
113 lines
2.6 KiB
TypeScript
113 lines
2.6 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2020 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
// Former goog.module ID: Blockly.IToolbox
|
|
|
|
import type {IRegistrable} from './i_registrable.js';
|
|
import type {IToolboxItem} from './i_toolbox_item.js';
|
|
import type {ToolboxInfo} from '../utils/toolbox.js';
|
|
import type {IFlyout} from './i_flyout.js';
|
|
import type {WorkspaceSvg} from '../workspace_svg.js';
|
|
|
|
/**
|
|
* Interface for a toolbox.
|
|
*/
|
|
export interface IToolbox extends IRegistrable {
|
|
/** Initializes the toolbox. */
|
|
init(): void;
|
|
|
|
/**
|
|
* Fills the toolbox with new toolbox items and removes any old contents.
|
|
*
|
|
* @param toolboxDef Object holding information for creating a toolbox.
|
|
*/
|
|
render(toolboxDef: ToolboxInfo): void;
|
|
|
|
/**
|
|
* Gets the width of the toolbox.
|
|
*
|
|
* @returns The width of the toolbox.
|
|
*/
|
|
getWidth(): number;
|
|
|
|
/**
|
|
* Gets the height of the toolbox.
|
|
*
|
|
* @returns The height of the toolbox.
|
|
*/
|
|
getHeight(): number;
|
|
|
|
/**
|
|
* Gets the toolbox flyout.
|
|
*
|
|
* @returns The toolbox flyout.
|
|
*/
|
|
getFlyout(): IFlyout | null;
|
|
|
|
/**
|
|
* Gets the workspace for the toolbox.
|
|
*
|
|
* @returns The parent workspace for the toolbox.
|
|
*/
|
|
getWorkspace(): WorkspaceSvg;
|
|
|
|
/**
|
|
* Gets whether or not the toolbox is horizontal.
|
|
*
|
|
* @returns True if the toolbox is horizontal, false if the toolbox is
|
|
* vertical.
|
|
*/
|
|
isHorizontal(): boolean;
|
|
|
|
/**
|
|
* Positions the toolbox based on whether it is a horizontal toolbox and
|
|
* whether the workspace is in rtl.
|
|
*/
|
|
position(): void;
|
|
|
|
/** Handles resizing the toolbox when a toolbox item resizes. */
|
|
handleToolboxItemResize(): void;
|
|
|
|
/** Unhighlights any previously selected item. */
|
|
clearSelection(): void;
|
|
|
|
/**
|
|
* Updates the category colours and background colour of selected categories.
|
|
*/
|
|
refreshTheme(): void;
|
|
|
|
/**
|
|
* Updates the flyout's content without closing it. Should be used in
|
|
* response to a change in one of the dynamic categories, such as variables or
|
|
* procedures.
|
|
*/
|
|
refreshSelection(): void;
|
|
|
|
/**
|
|
* Sets the visibility of the toolbox.
|
|
*
|
|
* @param isVisible True if toolbox should be visible.
|
|
*/
|
|
setVisible(isVisible: boolean): void;
|
|
|
|
/**
|
|
* Selects the toolbox item by it's position in the list of toolbox items.
|
|
*
|
|
* @param position The position of the item to select.
|
|
*/
|
|
selectItemByPosition(position: number): void;
|
|
|
|
/**
|
|
* Gets the selected item.
|
|
*
|
|
* @returns The selected item, or null if no item is currently selected.
|
|
*/
|
|
getSelectedItem(): IToolboxItem | null;
|
|
|
|
/** Disposes of this toolbox. */
|
|
dispose(): void;
|
|
}
|