mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
chore: Lint TsDoc. (#6353)
* chore: add linting for tsdoc * chore: don't require types on return * chore: remove redundant fileoverview from ts * chore: change return to returns and add some newlines * chore: remove license tag * chore: don't require params/return docs * chore: remove spurious struct tags * Revert "chore: change return to returns and add some newlines" This reverts commitd6d8656a45. * chore: don't auto-add param names * chore: disable require-param bc it breaks on this * return to returns and add line breaks * chore: configure additional jsdoc rules * chore: run format * Revert "chore: remove license tag" This reverts commit173455588a. * chore: allow license tag format * chore: only require jsdoc on exported items * chore: add missing jsdoc or silence where needed * chore: run format * chore: lint fixes
This commit is contained in:
committed by
GitHub
parent
bb37d1b7aa
commit
037eb59b89
28
core/menu.ts
28
core/menu.ts
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Blockly menu similar to Closure's goog.ui.Menu
|
||||
*/
|
||||
|
||||
/**
|
||||
* Blockly menu similar to Closure's goog.ui.Menu
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../closure/goog/goog.js';
|
||||
@@ -27,6 +24,7 @@ import * as style from './utils/style.js';
|
||||
|
||||
/**
|
||||
* A basic menu class.
|
||||
*
|
||||
* @alias Blockly.Menu
|
||||
*/
|
||||
export class Menu {
|
||||
@@ -76,6 +74,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Add a new menu item to the bottom of this menu.
|
||||
*
|
||||
* @param menuItem Menu item to append.
|
||||
* @internal
|
||||
*/
|
||||
@@ -85,6 +84,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Creates the menu DOM.
|
||||
*
|
||||
* @param container Element upon which to append this menu.
|
||||
*/
|
||||
render(container: Element) {
|
||||
@@ -119,7 +119,8 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Gets the menu's element.
|
||||
* @return The DOM element.
|
||||
*
|
||||
* @returns The DOM element.
|
||||
* @internal
|
||||
*/
|
||||
getElement(): Element|null {
|
||||
@@ -128,6 +129,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Focus the menu element.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
focus() {
|
||||
@@ -153,6 +155,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Set the menu accessibility role.
|
||||
*
|
||||
* @param roleName role name.
|
||||
* @internal
|
||||
*/
|
||||
@@ -196,8 +199,9 @@ export class Menu {
|
||||
/**
|
||||
* Returns the child menu item that owns the given DOM element,
|
||||
* or null if no such menu item is found.
|
||||
*
|
||||
* @param elem DOM element whose owner is to be returned.
|
||||
* @return Menu item for which the DOM element belongs to.
|
||||
* @returns Menu item for which the DOM element belongs to.
|
||||
*/
|
||||
private getMenuItem_(elem: Element): MenuItem|null {
|
||||
const menuElem = this.getElement();
|
||||
@@ -225,6 +229,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Highlights the given menu item, or clears highlighting if null.
|
||||
*
|
||||
* @param item Item to highlight, or null.
|
||||
* @internal
|
||||
*/
|
||||
@@ -249,6 +254,7 @@ export class Menu {
|
||||
/**
|
||||
* Highlights the next highlightable item (or the first if nothing is
|
||||
* currently highlighted).
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
highlightNext() {
|
||||
@@ -262,6 +268,7 @@ export class Menu {
|
||||
/**
|
||||
* Highlights the previous highlightable item (or the last if nothing is
|
||||
* currently highlighted).
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
highlightPrevious() {
|
||||
@@ -285,6 +292,7 @@ export class Menu {
|
||||
/**
|
||||
* Helper function that manages the details of moving the highlight among
|
||||
* child menuitems in response to keyboard events.
|
||||
*
|
||||
* @param startIndex Start index.
|
||||
* @param delta Step direction: 1 to go down, -1 to go up.
|
||||
*/
|
||||
@@ -304,6 +312,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Handles mouseover events. Highlight menuitems as the user hovers over them.
|
||||
*
|
||||
* @param e Mouse event to handle.
|
||||
*/
|
||||
private handleMouseOver_(e: Event) {
|
||||
@@ -322,6 +331,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Handles click events. Pass the event onto the child menuitem to handle.
|
||||
*
|
||||
* @param e Click event to handle.
|
||||
*/
|
||||
private handleClick_(e: Event) {
|
||||
@@ -354,6 +364,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Handles mouse enter events. Focus the element.
|
||||
*
|
||||
* @param _e Mouse event to handle.
|
||||
*/
|
||||
private handleMouseEnter_(_e: Event) {
|
||||
@@ -362,6 +373,7 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Handles mouse leave events. Blur and clear highlight.
|
||||
*
|
||||
* @param _e Mouse event to handle.
|
||||
*/
|
||||
private handleMouseLeave_(_e: Event) {
|
||||
@@ -377,6 +389,7 @@ export class Menu {
|
||||
* Attempts to handle a keyboard event, if the menu item is enabled, by
|
||||
* calling
|
||||
* {@link handleKeyEventInternal_}.
|
||||
*
|
||||
* @param e Key event to handle.
|
||||
*/
|
||||
private handleKeyEvent_(e: Event) {
|
||||
@@ -436,7 +449,8 @@ export class Menu {
|
||||
|
||||
/**
|
||||
* Get the size of a rendered menu.
|
||||
* @return Object with width and height properties.
|
||||
*
|
||||
* @returns Object with width and height properties.
|
||||
* @internal
|
||||
*/
|
||||
getSize(): Size {
|
||||
|
||||
Reference in New Issue
Block a user