mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
* feat: Add interfaces for keyboard navigation. * feat: Add the Navigator. * feat: Make core types conform to INavigable. * feat: Require FlyoutItems elements to be INavigable. * feat: Add navigation policies for built-in types. * refactor: Convert Marker and LineCursor to operate on INavigables instead of ASTNodes. * chore: Delete dead code in ASTNode. * fix: Fix the tests. * chore: Assuage the linter. * fix: Fix advanced build/tests. * chore: Restore ASTNode tests. * refactor: Move isNavigable() validation into Navigator. * refactor: Exercise navigation instead of ASTNode. * chore: Rename astnode_test.js to navigation_test.js. * chore: Enable the navigation tests. * fix: Fix bug when retrieving the first child of an empty workspace.
33 lines
793 B
TypeScript
33 lines
793 B
TypeScript
import type {IBoundedElement} from './interfaces/i_bounded_element.js';
|
|
import type {INavigable} from './interfaces/i_navigable.js';
|
|
/**
|
|
* Representation of an item displayed in a flyout.
|
|
*/
|
|
export class FlyoutItem {
|
|
/**
|
|
* Creates a new FlyoutItem.
|
|
*
|
|
* @param element The element that will be displayed in the flyout.
|
|
* @param type The type of element. Should correspond to the type of the
|
|
* flyout inflater that created this object.
|
|
*/
|
|
constructor(
|
|
private element: IBoundedElement & INavigable<any>,
|
|
private type: string,
|
|
) {}
|
|
|
|
/**
|
|
* Returns the element displayed in the flyout.
|
|
*/
|
|
getElement() {
|
|
return this.element;
|
|
}
|
|
|
|
/**
|
|
* Returns the type of flyout element this item represents.
|
|
*/
|
|
getType() {
|
|
return this.type;
|
|
}
|
|
}
|