From e722097c1bac2e658e5dedbfa9c2b9c0df66cef3 Mon Sep 17 00:00:00 2001 From: kozbial Date: Fri, 16 Jul 2021 11:21:47 -0700 Subject: [PATCH] Break up interfaces in core/i_accessibility.js into separate files --- core/interfaces/i_accessibility.js | 75 ------------------- core/interfaces/i_ast_node_location.js | 20 +++++ core/interfaces/i_ast_node_location_svg.js | 38 ++++++++++ .../i_ast_node_location_with_block.js | 32 ++++++++ core/interfaces/i_keyboard_accessible.js | 30 ++++++++ 5 files changed, 120 insertions(+), 75 deletions(-) delete mode 100644 core/interfaces/i_accessibility.js create mode 100644 core/interfaces/i_ast_node_location.js create mode 100644 core/interfaces/i_ast_node_location_svg.js create mode 100644 core/interfaces/i_ast_node_location_with_block.js create mode 100644 core/interfaces/i_keyboard_accessible.js diff --git a/core/interfaces/i_accessibility.js b/core/interfaces/i_accessibility.js deleted file mode 100644 index 30d724959..000000000 --- a/core/interfaces/i_accessibility.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @fileoverview AST Node and keyboard navigation interfaces. - * @author samelh@google.com (Sam El-Husseini) - */ - -'use strict'; - -goog.provide('Blockly.IASTNodeLocation'); -goog.provide('Blockly.IASTNodeLocationSvg'); -goog.provide('Blockly.IASTNodeLocationWithBlock'); -goog.provide('Blockly.IKeyboardAccessible'); - -goog.requireType('Blockly.Block'); -goog.requireType('Blockly.ShortcutRegistry'); - - -/** - * An AST node location interface. - * @interface - */ -Blockly.IASTNodeLocation = function() {}; - -/** - * An AST node location SVG interface. - * @interface - * @extends {Blockly.IASTNodeLocation} - */ -Blockly.IASTNodeLocationSvg = function() {}; - -/** - * Add the marker SVG to this node's SVG group. - * @param {SVGElement} markerSvg The SVG root of the marker to be added to the - * SVG group. - */ -Blockly.IASTNodeLocationSvg.prototype.setMarkerSvg; - -/** - * Add the cursor SVG to this node's SVG group. - * @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the - * SVG group. - */ -Blockly.IASTNodeLocationSvg.prototype.setCursorSvg; - -/** - * An AST node location that has an associated block. - * @interface - * @extends {Blockly.IASTNodeLocation} - */ -Blockly.IASTNodeLocationWithBlock = function() {}; - -/** - * Get the source block associated with this node. - * @return {Blockly.Block} The source block. - */ -Blockly.IASTNodeLocationWithBlock.prototype.getSourceBlock; - - -/** - * An interface for an object that handles keyboard shortcuts. - * @interface - */ -Blockly.IKeyboardAccessible = function() {}; - -/** - * Handles the given keyboard shortcut. - * @param {!Blockly.ShortcutRegistry.KeyboardShortcut} shortcut The shortcut to be handled. - * @return {boolean} True if the shortcut has been handled, false otherwise. - */ -Blockly.IKeyboardAccessible.prototype.onShortcut; diff --git a/core/interfaces/i_ast_node_location.js b/core/interfaces/i_ast_node_location.js new file mode 100644 index 000000000..8d3d8cb97 --- /dev/null +++ b/core/interfaces/i_ast_node_location.js @@ -0,0 +1,20 @@ +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview The interface for an AST node location. + * @author samelh@google.com (Sam El-Husseini) + */ + +'use strict'; + +goog.provide('Blockly.IASTNodeLocation'); + +/** + * An AST node location interface. + * @interface + */ +Blockly.IASTNodeLocation = function() {}; diff --git a/core/interfaces/i_ast_node_location_svg.js b/core/interfaces/i_ast_node_location_svg.js new file mode 100644 index 000000000..7711289b1 --- /dev/null +++ b/core/interfaces/i_ast_node_location_svg.js @@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview The interface for an AST node location SVG. + * @author samelh@google.com (Sam El-Husseini) + */ + +'use strict'; + +goog.provide('Blockly.IASTNodeLocationSvg'); + +goog.require('Blockly.IASTNodeLocation'); + + +/** + * An AST node location SVG interface. + * @interface + * @extends {Blockly.IASTNodeLocation} + */ +Blockly.IASTNodeLocationSvg = function() {}; + +/** + * Add the marker SVG to this node's SVG group. + * @param {SVGElement} markerSvg The SVG root of the marker to be added to the + * SVG group. + */ +Blockly.IASTNodeLocationSvg.prototype.setMarkerSvg; + +/** + * Add the cursor SVG to this node's SVG group. + * @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the + * SVG group. + */ +Blockly.IASTNodeLocationSvg.prototype.setCursorSvg; diff --git a/core/interfaces/i_ast_node_location_with_block.js b/core/interfaces/i_ast_node_location_with_block.js new file mode 100644 index 000000000..612ef0e73 --- /dev/null +++ b/core/interfaces/i_ast_node_location_with_block.js @@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview The interface for an AST node location that has an associated + * block. + * @author samelh@google.com (Sam El-Husseini) + */ + +'use strict'; + +goog.provide('Blockly.IASTNodeLocationWithBlock'); + +goog.require('Blockly.IASTNodeLocation'); +goog.requireType('Blockly.Block'); + + +/** + * An AST node location that has an associated block. + * @interface + * @extends {Blockly.IASTNodeLocation} + */ +Blockly.IASTNodeLocationWithBlock = function() {}; + +/** + * Get the source block associated with this node. + * @return {Blockly.Block} The source block. + */ +Blockly.IASTNodeLocationWithBlock.prototype.getSourceBlock; diff --git a/core/interfaces/i_keyboard_accessible.js b/core/interfaces/i_keyboard_accessible.js new file mode 100644 index 000000000..5807e47bf --- /dev/null +++ b/core/interfaces/i_keyboard_accessible.js @@ -0,0 +1,30 @@ +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview The interface for objects that handle keyboard shortcuts. + * @author samelh@google.com (Sam El-Husseini) + */ + +'use strict'; + +goog.provide('Blockly.IKeyboardAccessible'); + +goog.requireType('Blockly.ShortcutRegistry'); + + +/** + * An interface for an object that handles keyboard shortcuts. + * @interface + */ +Blockly.IKeyboardAccessible = function() {}; + +/** + * Handles the given keyboard shortcut. + * @param {!Blockly.ShortcutRegistry.KeyboardShortcut} shortcut The shortcut to be handled. + * @return {boolean} True if the shortcut has been handled, false otherwise. + */ +Blockly.IKeyboardAccessible.prototype.onShortcut;