/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file Object representing a map of modules. * @author dev@varwin.com (Varwin Developers) */ /** * Class for a module management. * * @class */ import { ModuleModel } from './module_model.js'; import { WorkspaceSvg } from './workspace_svg.js'; import { BlockSvg } from './block_svg.js'; import * as Events from './events/events.js'; /** * Class for a module management. */ export declare class ModuleManager { private readonly defaultModule_; private moduleMap_; private activeModuleId_; private readonly workspace; private onWorkspaceChangeWrapper; constructor(workspace: WorkspaceSvg); onViewportChangeListener(event: Events.Abstract): void; /** * Dispose ModuleManager */ dispose(): void; /** * Clear the module map. */ clear(): void; /** * Create default module if empty modules. */ createDefaultModuleIfNeed(): void; /** * Rename a module by updating its name in the module map. Identify the * module to rename with the given ID. * * @param {ModuleModel} module Module to rename. * @param {string} newName New module name. */ renameModule(module: ModuleModel, newName: string): void; /** * Move a module to position. * * @param {ModuleModel} module Module to move. * @param {number} newOrder New module order. */ moveModule(module: ModuleModel, newOrder: number): void; /** * Create a module with a given name, optional type, and optional ID. * * @param {string} name The name of the module. It can be verbose name or key of Blockly.Msg * @param {?string=} opt_id The unique ID of the module. This will default to * a UUID. * @param {?number=} scrollX WS horizontal scrolling offset in pixel units. * @param {?number=} scrollY WS vertical scrolling offset in pixel units. * @param {?number=} scale WS scale. * @returns {!ModuleModel} The newly created module. */ createModule(name: string, opt_id?: string, scrollX?: number, scrollY?: number, scale?: number): ModuleModel | null; /** * Fire a create event for module. * * @param {!ModuleModel} module The module that was just created. */ private fireCreateEvent_; /** * Move block to module. * * @param {Blockly.BlockSvg} block The block. * @param {ModuleModel} module Target module. */ moveBlockToModule(block: BlockSvg, module: ModuleModel): void; /** * Fire a delete event for module. * * Null for a blank event. * * @param block * @param {string} newModuleId The new module id. * @param {string} previousModuleId The previous module id. * @augments {Events.ModuleBase} * @private */ private fireMoveBlockToModule_; /** * Delete a module and all its top blocks. * * @param {ModuleModel} module Module to delete. * @returns {ModuleModel} previous sibling module */ deleteModule(module: ModuleModel): ModuleModel | undefined; /** * Fire a delete event for module. * * @param {!ModuleModel} module The module that was just deleted. * @private */ private fireDeleteEvent_; /** * Activate a module, switch top blocks visibility. * * @param {ModuleModel} module Module to activate. */ activateModule(module: ModuleModel): void; /** * Set active module id. * * @param {string} id Module. */ setActiveModuleId(id: string): void; /** * Returns active module. * * @returns {!ModuleModel} current active module. */ getActiveModule(): ModuleModel; /** * Find the module by the given ID and return it. Return null if it is not found. * * @param {string} id The ID to check for. * @returns {ModuleModel} The module with the given ID. */ getModuleById(id: string): ModuleModel | null; /** * Get module order by ID. * * @param {string} id The ID to check for. * @returns {int} The module order. */ getModuleOrder(id: string): number; /** * Return all modules of all types. * * @returns {!Array.} List of module models. */ getAllModules(): ModuleModel[]; } //# sourceMappingURL=module_manager.d.ts.map