Add PluginManager (#4672)

* Add PluginManager.
This commit is contained in:
Monica Kozbial
2021-03-04 16:51:06 -08:00
committed by GitHub
parent 4e5cecf90c
commit ef8a5a1fe1
9 changed files with 247 additions and 55 deletions

View File

@@ -0,0 +1,22 @@
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Interface for a plugin.
* @author kozbial@google.com (Monica Kozbial)
*/
'use strict';
goog.provide('Blockly.IPlugin');
/**
* The interface for a workspace plugin.
* @interface
*/
Blockly.IPlugin = function() {};

View File

@@ -13,21 +13,19 @@
goog.provide('Blockly.IPositionable');
goog.require('Blockly.IPlugin');
/**
* Interface for a component that is positioned on top of the workspace.
* @extends {Blockly.IPlugin}
* @interface
*/
Blockly.IPositionable = function() {};
/**
* Positions the element. Called when the window is resized.
* @param {!Blockly.MetricsManager.ContainerRegion} viewMetrics The workspace
* viewMetrics.
* @param {!Blockly.MetricsManager.AbsoluteMetrics} absoluteMetrics The absolute
* metrics for the workspace.
* @param {!Blockly.MetricsManager.ToolboxMetrics} toolboxMetrics The toolbox
* metrics for the workspace.
* @param {!Blockly.MetricsManager.UiMetrics} metrics The workspace metrics.
* @param {!Array<Blockly.utils.Rect>} savedPositions List of rectangles that
* are already on the workspace.
*/
@@ -39,5 +37,3 @@ Blockly.IPositionable.prototype.position;
* @returns {!Blockly.utils.Rect} The plugins bounding box.
*/
Blockly.IPositionable.prototype.getBoundingRectangle;

View File

@@ -0,0 +1,20 @@
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Interface for plugins that can be registered on the workspace.
* @author kozbial@google.com (Monica Kozbial)
*/
'use strict';
goog.provide('Blockly.IWorkspacePlugin');
/**
* Base interface for a plugin that can be registered on the workspace.
* @interface
*/
Blockly.IWorkspacePlugin = function() {};