mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00:11 +01:00
chore: remove alias comments (#6816)
* chore: remove alias comments * chore: format * chore: remove extra newlines * chore: fix bad replaces
This commit is contained in:
@@ -22,8 +22,6 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Abstract class for an event.
|
||||
*
|
||||
* @alias Blockly.Events.Abstract
|
||||
*/
|
||||
export abstract class Abstract {
|
||||
/**
|
||||
@@ -52,7 +50,6 @@ export abstract class Abstract {
|
||||
/** Type of this event. */
|
||||
type = '';
|
||||
|
||||
/** @alias Blockly.Events.Abstract */
|
||||
constructor() {
|
||||
this.group = eventUtils.getGroup();
|
||||
this.recordUndo = eventUtils.getRecordUndo();
|
||||
|
||||
@@ -21,8 +21,6 @@ import {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js
|
||||
|
||||
/**
|
||||
* Abstract class for any event related to blocks.
|
||||
*
|
||||
* @alias Blockly.Events.BlockBase
|
||||
*/
|
||||
export class BlockBase extends AbstractEvent {
|
||||
override isBlank = true;
|
||||
|
||||
@@ -26,8 +26,6 @@ import * as eventUtils from './utils.js';
|
||||
/**
|
||||
* Notifies listeners when some element of a block has changed (e.g.
|
||||
* field values, comments, etc).
|
||||
*
|
||||
* @alias Blockly.Events.BlockChange
|
||||
*/
|
||||
export class BlockChange extends BlockBase {
|
||||
override type = eventUtils.BLOCK_CHANGE;
|
||||
|
||||
@@ -26,8 +26,6 @@ import {Workspace} from '../workspace.js';
|
||||
/**
|
||||
* Notifies listeners when a block (or connected stack of blocks) is
|
||||
* created.
|
||||
*
|
||||
* @alias Blockly.Events.BlockCreate
|
||||
*/
|
||||
export class BlockCreate extends BlockBase {
|
||||
override type = eventUtils.BLOCK_CREATE;
|
||||
|
||||
@@ -26,8 +26,6 @@ import {Workspace} from '../workspace.js';
|
||||
/**
|
||||
* Notifies listeners when a block (or connected stack of blocks) is
|
||||
* deleted.
|
||||
*
|
||||
* @alias Blockly.Events.BlockDelete
|
||||
*/
|
||||
export class BlockDelete extends BlockBase {
|
||||
/** The XML representation of the deleted block(s). */
|
||||
|
||||
@@ -23,8 +23,6 @@ import {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners when a block is being manually dragged/dropped.
|
||||
*
|
||||
* @alias Blockly.Events.BlockDrag
|
||||
*/
|
||||
export class BlockDrag extends UiBase {
|
||||
/** The ID of the top-level block being dragged. */
|
||||
|
||||
@@ -32,8 +32,6 @@ interface BlockLocation {
|
||||
/**
|
||||
* Notifies listeners when a block is moved. This could be from one
|
||||
* connection to another, or from one location on the workspace to another.
|
||||
*
|
||||
* @alias Blockly.Events.BlockMove
|
||||
*/
|
||||
export class BlockMove extends BlockBase {
|
||||
override type = eventUtils.BLOCK_MOVE;
|
||||
|
||||
@@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Class for a bubble open event.
|
||||
*
|
||||
* @alias Blockly.Events.BubbleOpen
|
||||
*/
|
||||
export class BubbleOpen extends UiBase {
|
||||
/** The ID of the block the bubble is attached to. */
|
||||
|
||||
@@ -24,8 +24,6 @@ import {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners that ome blockly element was clicked.
|
||||
*
|
||||
* @alias Blockly.Events.Click
|
||||
*/
|
||||
export class Click extends UiBase {
|
||||
/** The ID of the block that was clicked, if a block was clicked. */
|
||||
|
||||
@@ -26,8 +26,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Abstract class for a comment event.
|
||||
*
|
||||
* @alias Blockly.Events.CommentBase
|
||||
*/
|
||||
export class CommentBase extends AbstractEvent {
|
||||
override isBlank = true;
|
||||
|
||||
@@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners that the contents of a workspace comment has changed.
|
||||
*
|
||||
* @alias Blockly.Events.CommentChange
|
||||
*/
|
||||
export class CommentChange extends CommentBase {
|
||||
override type = eventUtils.COMMENT_CHANGE;
|
||||
|
||||
@@ -24,8 +24,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners that a workspace comment was created.
|
||||
*
|
||||
* @alias Blockly.Events.CommentCreate
|
||||
*/
|
||||
export class CommentCreate extends CommentBase {
|
||||
override type = eventUtils.COMMENT_CREATE;
|
||||
|
||||
@@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners that a workspace comment has been deleted.
|
||||
*
|
||||
* @alias Blockly.Events.CommentDelete
|
||||
*/
|
||||
export class CommentDelete extends CommentBase {
|
||||
override type = eventUtils.COMMENT_DELETE;
|
||||
|
||||
@@ -24,8 +24,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners that a workspace comment has moved.
|
||||
*
|
||||
* @alias Blockly.Events.CommentMove
|
||||
*/
|
||||
export class CommentMove extends CommentBase {
|
||||
override type = eventUtils.COMMENT_MOVE;
|
||||
|
||||
@@ -26,8 +26,6 @@ import * as eventUtils from './utils.js';
|
||||
/**
|
||||
* Notifies listeners that a marker (used for keyboard navigation) has
|
||||
* moved.
|
||||
*
|
||||
* @alias Blockly.Events.MarkerMove
|
||||
*/
|
||||
export class MarkerMove extends UiBase {
|
||||
/** The ID of the block the marker is now on, if any. */
|
||||
|
||||
@@ -24,8 +24,6 @@ import type {Workspace} from '../workspace.js';
|
||||
/**
|
||||
* Class for a selected event.
|
||||
* Notifies listeners that a new element has been selected.
|
||||
*
|
||||
* @alias Blockly.Events.Selected
|
||||
*/
|
||||
export class Selected extends UiBase {
|
||||
/** The id of the last selected selectable element. */
|
||||
|
||||
@@ -22,8 +22,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners that the workspace theme has changed.
|
||||
*
|
||||
* @alias Blockly.Events.ThemeChange
|
||||
*/
|
||||
export class ThemeChange extends UiBase {
|
||||
/** The name of the new theme that has been set. */
|
||||
|
||||
@@ -22,8 +22,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners that a toolbox item has been selected.
|
||||
*
|
||||
* @alias Blockly.Events.ToolboxItemSelect
|
||||
*/
|
||||
export class ToolboxItemSelect extends UiBase {
|
||||
/** The previously selected toolbox item. */
|
||||
|
||||
@@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners when the trashcan is opening or closing.
|
||||
*
|
||||
* @alias Blockly.Events.TrashcanOpen
|
||||
*/
|
||||
export class TrashcanOpen extends UiBase {
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,6 @@ import * as eventUtils from './utils.js';
|
||||
* Class for a UI event.
|
||||
*
|
||||
* @deprecated December 2020. Instead use a more specific UI event.
|
||||
* @alias Blockly.Events.Ui
|
||||
*/
|
||||
export class Ui extends UiBase {
|
||||
blockId: AnyDuringMigration;
|
||||
|
||||
@@ -22,8 +22,6 @@ import {Abstract as AbstractEvent} from './events_abstract.js';
|
||||
* editing to work (e.g. scrolling the workspace, zooming, opening toolbox
|
||||
* categories).
|
||||
* UI events do not undo or redo.
|
||||
*
|
||||
* @alias Blockly.Events.UiBase
|
||||
*/
|
||||
export class UiBase extends AbstractEvent {
|
||||
override isBlank = true;
|
||||
|
||||
@@ -21,8 +21,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Abstract class for a variable event.
|
||||
*
|
||||
* @alias Blockly.Events.VarBase
|
||||
*/
|
||||
export class VarBase extends AbstractEvent {
|
||||
override isBlank = true;
|
||||
|
||||
@@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js';
|
||||
|
||||
/**
|
||||
* Notifies listeners that a variable model has been created.
|
||||
*
|
||||
* @alias Blockly.Events.VarCreate
|
||||
*/
|
||||
export class VarCreate extends VarBase {
|
||||
override type = eventUtils.VAR_CREATE;
|
||||
|
||||
@@ -25,8 +25,6 @@ import type {Workspace} from '../workspace.js';
|
||||
* changed.
|
||||
*
|
||||
* Does not notify when the workspace itself resizes.
|
||||
*
|
||||
* @alias Blockly.Events.ViewportChange
|
||||
*/
|
||||
export class ViewportChange extends UiBase {
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,6 @@ let recordUndo = true;
|
||||
* Sets whether events should be added to the undo stack.
|
||||
*
|
||||
* @param newValue True if events should be added to the undo stack.
|
||||
* @alias Blockly.Events.utils.setRecordUndo
|
||||
*/
|
||||
export function setRecordUndo(newValue: boolean) {
|
||||
recordUndo = newValue;
|
||||
@@ -49,7 +48,6 @@ export function setRecordUndo(newValue: boolean) {
|
||||
* Returns whether or not events will be added to the undo stack.
|
||||
*
|
||||
* @returns True if events will be added to the undo stack.
|
||||
* @alias Blockly.Events.utils.getRecordUndo
|
||||
*/
|
||||
export function getRecordUndo(): boolean {
|
||||
return recordUndo;
|
||||
@@ -60,183 +58,131 @@ let disabled = 0;
|
||||
|
||||
/**
|
||||
* Name of event that creates a block. Will be deprecated for BLOCK_CREATE.
|
||||
*
|
||||
* @alias Blockly.Events.utils.CREATE
|
||||
*/
|
||||
export const CREATE = 'create';
|
||||
|
||||
/**
|
||||
* Name of event that creates a block.
|
||||
*
|
||||
* @alias Blockly.Events.utils.BLOCK_CREATE
|
||||
*/
|
||||
export const BLOCK_CREATE = CREATE;
|
||||
|
||||
/**
|
||||
* Name of event that deletes a block. Will be deprecated for BLOCK_DELETE.
|
||||
*
|
||||
* @alias Blockly.Events.utils.DELETE
|
||||
*/
|
||||
export const DELETE = 'delete';
|
||||
|
||||
/**
|
||||
* Name of event that deletes a block.
|
||||
*
|
||||
* @alias Blockly.Events.utils.BLOCK_DELETE
|
||||
*/
|
||||
export const BLOCK_DELETE = DELETE;
|
||||
|
||||
/**
|
||||
* Name of event that changes a block. Will be deprecated for BLOCK_CHANGE.
|
||||
*
|
||||
* @alias Blockly.Events.utils.CHANGE
|
||||
*/
|
||||
export const CHANGE = 'change';
|
||||
|
||||
/**
|
||||
* Name of event that changes a block.
|
||||
*
|
||||
* @alias Blockly.Events.utils.BLOCK_CHANGE
|
||||
*/
|
||||
export const BLOCK_CHANGE = CHANGE;
|
||||
|
||||
/**
|
||||
* Name of event that moves a block. Will be deprecated for BLOCK_MOVE.
|
||||
*
|
||||
* @alias Blockly.Events.utils.MOVE
|
||||
*/
|
||||
export const MOVE = 'move';
|
||||
|
||||
/**
|
||||
* Name of event that moves a block.
|
||||
*
|
||||
* @alias Blockly.Events.utils.BLOCK_MOVE
|
||||
*/
|
||||
export const BLOCK_MOVE = MOVE;
|
||||
|
||||
/**
|
||||
* Name of event that creates a variable.
|
||||
*
|
||||
* @alias Blockly.Events.utils.VAR_CREATE
|
||||
*/
|
||||
export const VAR_CREATE = 'var_create';
|
||||
|
||||
/**
|
||||
* Name of event that deletes a variable.
|
||||
*
|
||||
* @alias Blockly.Events.utils.VAR_DELETE
|
||||
*/
|
||||
export const VAR_DELETE = 'var_delete';
|
||||
|
||||
/**
|
||||
* Name of event that renames a variable.
|
||||
*
|
||||
* @alias Blockly.Events.utils.VAR_RENAME
|
||||
*/
|
||||
export const VAR_RENAME = 'var_rename';
|
||||
|
||||
/**
|
||||
* Name of generic event that records a UI change.
|
||||
*
|
||||
* @alias Blockly.Events.utils.UI
|
||||
*/
|
||||
export const UI = 'ui';
|
||||
|
||||
/**
|
||||
* Name of event that record a block drags a block.
|
||||
*
|
||||
* @alias Blockly.Events.utils.BLOCK_DRAG
|
||||
*/
|
||||
export const BLOCK_DRAG = 'drag';
|
||||
|
||||
/**
|
||||
* Name of event that records a change in selected element.
|
||||
*
|
||||
* @alias Blockly.Events.utils.SELECTED
|
||||
*/
|
||||
export const SELECTED = 'selected';
|
||||
|
||||
/**
|
||||
* Name of event that records a click.
|
||||
*
|
||||
* @alias Blockly.Events.utils.CLICK
|
||||
*/
|
||||
export const CLICK = 'click';
|
||||
|
||||
/**
|
||||
* Name of event that records a marker move.
|
||||
*
|
||||
* @alias Blockly.Events.utils.MARKER_MOVE
|
||||
*/
|
||||
export const MARKER_MOVE = 'marker_move';
|
||||
|
||||
/**
|
||||
* Name of event that records a bubble open.
|
||||
*
|
||||
* @alias Blockly.Events.utils.BUBBLE_OPEN
|
||||
*/
|
||||
export const BUBBLE_OPEN = 'bubble_open';
|
||||
|
||||
/**
|
||||
* Name of event that records a trashcan open.
|
||||
*
|
||||
* @alias Blockly.Events.utils.TRASHCAN_OPEN
|
||||
*/
|
||||
export const TRASHCAN_OPEN = 'trashcan_open';
|
||||
|
||||
/**
|
||||
* Name of event that records a toolbox item select.
|
||||
*
|
||||
* @alias Blockly.Events.utils.TOOLBOX_ITEM_SELECT
|
||||
*/
|
||||
export const TOOLBOX_ITEM_SELECT = 'toolbox_item_select';
|
||||
|
||||
/**
|
||||
* Name of event that records a theme change.
|
||||
*
|
||||
* @alias Blockly.Events.utils.THEME_CHANGE
|
||||
*/
|
||||
export const THEME_CHANGE = 'theme_change';
|
||||
|
||||
/**
|
||||
* Name of event that records a viewport change.
|
||||
*
|
||||
* @alias Blockly.Events.utils.VIEWPORT_CHANGE
|
||||
*/
|
||||
export const VIEWPORT_CHANGE = 'viewport_change';
|
||||
|
||||
/**
|
||||
* Name of event that creates a comment.
|
||||
*
|
||||
* @alias Blockly.Events.utils.COMMENT_CREATE
|
||||
*/
|
||||
export const COMMENT_CREATE = 'comment_create';
|
||||
|
||||
/**
|
||||
* Name of event that deletes a comment.
|
||||
*
|
||||
* @alias Blockly.Events.utils.COMMENT_DELETE
|
||||
*/
|
||||
export const COMMENT_DELETE = 'comment_delete';
|
||||
|
||||
/**
|
||||
* Name of event that changes a comment.
|
||||
*
|
||||
* @alias Blockly.Events.utils.COMMENT_CHANGE
|
||||
*/
|
||||
export const COMMENT_CHANGE = 'comment_change';
|
||||
|
||||
/**
|
||||
* Name of event that moves a comment.
|
||||
*
|
||||
* @alias Blockly.Events.utils.COMMENT_MOVE
|
||||
*/
|
||||
export const COMMENT_MOVE = 'comment_move';
|
||||
|
||||
/**
|
||||
* Name of event that records a workspace load.
|
||||
*
|
||||
* @alias Blockly.Events.utils.FINISHED_LOADING
|
||||
*/
|
||||
export const FINISHED_LOADING = 'finished_loading';
|
||||
|
||||
@@ -246,8 +192,6 @@ export const FINISHED_LOADING = 'finished_loading';
|
||||
*
|
||||
* Not to be confused with bumping so that disconnected connections do not
|
||||
* appear connected.
|
||||
*
|
||||
* @alias Blockly.Events.utils.BumpEvent
|
||||
*/
|
||||
export type BumpEvent = BlockCreate|BlockMove|CommentCreate|CommentMove;
|
||||
|
||||
@@ -257,8 +201,6 @@ export type BumpEvent = BlockCreate|BlockMove|CommentCreate|CommentMove;
|
||||
*
|
||||
* Not to be confused with bumping so that disconnected connections do not
|
||||
* appear connected.
|
||||
*
|
||||
* @alias Blockly.Events.utils.BUMP_EVENTS
|
||||
*/
|
||||
export const BUMP_EVENTS: string[] =
|
||||
[BLOCK_CREATE, BLOCK_MOVE, COMMENT_CREATE, COMMENT_MOVE];
|
||||
@@ -270,7 +212,6 @@ const FIRE_QUEUE: Abstract[] = [];
|
||||
* Create a custom event and fire it.
|
||||
*
|
||||
* @param event Custom data for event.
|
||||
* @alias Blockly.Events.utils.fire
|
||||
*/
|
||||
export function fire(event: Abstract) {
|
||||
TEST_ONLY.fireInternal(event);
|
||||
@@ -312,7 +253,6 @@ function fireNow() {
|
||||
* @param queueIn Array of events.
|
||||
* @param forward True if forward (redo), false if backward (undo).
|
||||
* @returns Array of filtered events.
|
||||
* @alias Blockly.Events.utils.filter
|
||||
*/
|
||||
export function filter(queueIn: Abstract[], forward: boolean): Abstract[] {
|
||||
let queue = queueIn.slice();
|
||||
@@ -395,8 +335,6 @@ export function filter(queueIn: Abstract[], forward: boolean): Abstract[] {
|
||||
/**
|
||||
* Modify pending undo events so that when they are fired they don't land
|
||||
* in the undo stack. Called by Workspace.clearUndo.
|
||||
*
|
||||
* @alias Blockly.Events.utils.clearPendingUndo
|
||||
*/
|
||||
export function clearPendingUndo() {
|
||||
for (let i = 0, event; event = FIRE_QUEUE[i]; i++) {
|
||||
@@ -406,8 +344,6 @@ export function clearPendingUndo() {
|
||||
|
||||
/**
|
||||
* Stop sending events. Every call to this function MUST also call enable.
|
||||
*
|
||||
* @alias Blockly.Events.utils.disable
|
||||
*/
|
||||
export function disable() {
|
||||
disabled++;
|
||||
@@ -416,8 +352,6 @@ export function disable() {
|
||||
/**
|
||||
* Start sending events. Unless events were already disabled when the
|
||||
* corresponding call to disable was made.
|
||||
*
|
||||
* @alias Blockly.Events.utils.enable
|
||||
*/
|
||||
export function enable() {
|
||||
disabled--;
|
||||
@@ -427,7 +361,6 @@ export function enable() {
|
||||
* Returns whether events may be fired or not.
|
||||
*
|
||||
* @returns True if enabled.
|
||||
* @alias Blockly.Events.utils.isEnabled
|
||||
*/
|
||||
export function isEnabled(): boolean {
|
||||
return disabled === 0;
|
||||
@@ -437,7 +370,6 @@ export function isEnabled(): boolean {
|
||||
* Current group.
|
||||
*
|
||||
* @returns ID string.
|
||||
* @alias Blockly.Events.utils.getGroup
|
||||
*/
|
||||
export function getGroup(): string {
|
||||
return group;
|
||||
@@ -448,7 +380,6 @@ export function getGroup(): string {
|
||||
*
|
||||
* @param state True to start new group, false to end group.
|
||||
* String to set group explicitly.
|
||||
* @alias Blockly.Events.utils.setGroup
|
||||
*/
|
||||
export function setGroup(state: boolean|string) {
|
||||
TEST_ONLY.setGroupInternal(state);
|
||||
@@ -470,7 +401,6 @@ function setGroupInternal(state: boolean|string) {
|
||||
*
|
||||
* @param block The root block.
|
||||
* @returns List of block IDs.
|
||||
* @alias Blockly.Events.utils.getDescendantIds
|
||||
* @internal
|
||||
*/
|
||||
export function getDescendantIds(block: Block): string[] {
|
||||
@@ -489,7 +419,6 @@ export function getDescendantIds(block: Block): string[] {
|
||||
* @param workspace Target workspace for event.
|
||||
* @returns The event represented by the JSON.
|
||||
* @throws {Error} if an event type is not found in the registry.
|
||||
* @alias Blockly.Events.utils.fromJson
|
||||
*/
|
||||
export function fromJson(
|
||||
json: AnyDuringMigration, workspace: Workspace): Abstract {
|
||||
@@ -526,7 +455,6 @@ function eventClassHasStaticFromJson(eventClass: new (...p: any[]) => Abstract):
|
||||
*
|
||||
* @param eventType The type of the event to get.
|
||||
* @returns The event class with the given type.
|
||||
* @alias Blockly.Events.utils.get
|
||||
*/
|
||||
export function get(eventType: string):
|
||||
(new (...p1: AnyDuringMigration[]) => Abstract) {
|
||||
@@ -544,7 +472,6 @@ export function get(eventType: string):
|
||||
* users don't try to re-enable disabled orphan blocks.
|
||||
*
|
||||
* @param event Custom data for event.
|
||||
* @alias Blockly.Events.utils.disableOrphans
|
||||
*/
|
||||
export function disableOrphans(event: Abstract) {
|
||||
if (event.type === MOVE || event.type === CREATE) {
|
||||
|
||||
@@ -21,8 +21,6 @@ import * as eventUtils from './utils.js';
|
||||
/**
|
||||
* Notifies listeners when the workspace has finished deserializing from
|
||||
* JSON/XML.
|
||||
*
|
||||
* @alias Blockly.Events.FinishedLoading
|
||||
*/
|
||||
export class FinishedLoading extends AbstractEvent {
|
||||
override isBlank = true;
|
||||
|
||||
Reference in New Issue
Block a user