mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00: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
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of actions in Blockly's editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of actions in Blockly's editor.
|
||||
*
|
||||
* @namespace Blockly.Events
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Abstract class for events fired as a result of actions in
|
||||
* Blockly's editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract class for events fired as a result of actions in
|
||||
* Blockly's editor.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -25,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Abstract class for an event.
|
||||
*
|
||||
* @alias Blockly.Events.Abstract
|
||||
*/
|
||||
export abstract class Abstract {
|
||||
@@ -57,7 +54,8 @@ export abstract class Abstract {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
toJson(): AnyDuringMigration {
|
||||
const json = {'type': this.type};
|
||||
@@ -69,6 +67,7 @@ export abstract class Abstract {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
fromJson(json: AnyDuringMigration) {
|
||||
@@ -78,7 +77,8 @@ export abstract class Abstract {
|
||||
|
||||
/**
|
||||
* Does this event record any change of state?
|
||||
* @return True if null, false if something changed.
|
||||
*
|
||||
* @returns True if null, false if something changed.
|
||||
*/
|
||||
isNull(): boolean {
|
||||
return false;
|
||||
@@ -86,6 +86,7 @@ export abstract class Abstract {
|
||||
|
||||
/**
|
||||
* Run an event.
|
||||
*
|
||||
* @param _forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
run(_forward: boolean) {}
|
||||
@@ -93,7 +94,8 @@ export abstract class Abstract {
|
||||
|
||||
/**
|
||||
* Get workspace the event belongs to.
|
||||
* @return The workspace the event belongs to.
|
||||
*
|
||||
* @returns The workspace the event belongs to.
|
||||
* @throws {Error} if workspace is null.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Base class for all types of block events.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for all types of block events.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -22,6 +19,7 @@ import {Abstract as AbstractEvent} from './events_abstract.js';
|
||||
|
||||
/**
|
||||
* Abstract class for a block event.
|
||||
*
|
||||
* @alias Blockly.Events.BlockBase
|
||||
*/
|
||||
export class BlockBase extends AbstractEvent {
|
||||
@@ -46,7 +44,8 @@ export class BlockBase extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -56,6 +55,7 @@ export class BlockBase extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for a block change event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for a block change event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -26,6 +23,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a block change event.
|
||||
*
|
||||
* @alias Blockly.Events.BlockChange
|
||||
*/
|
||||
export class BlockChange extends BlockBase {
|
||||
@@ -63,7 +61,8 @@ export class BlockChange extends BlockBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -78,6 +77,7 @@ export class BlockChange extends BlockBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -90,7 +90,8 @@ export class BlockChange extends BlockBase {
|
||||
|
||||
/**
|
||||
* Does this event record any change of state?
|
||||
* @return False if something changed.
|
||||
*
|
||||
* @returns False if something changed.
|
||||
*/
|
||||
override isNull(): boolean {
|
||||
return this.oldValue === this.newValue;
|
||||
@@ -98,6 +99,7 @@ export class BlockChange extends BlockBase {
|
||||
|
||||
/**
|
||||
* Run a change event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
@@ -157,8 +159,9 @@ export class BlockChange extends BlockBase {
|
||||
/**
|
||||
* Returns the extra state of the given block (either as XML or a JSO,
|
||||
* depending on the block's definition).
|
||||
*
|
||||
* @param block The block to get the extra state of.
|
||||
* @return A stringified version of the extra state of the given block.
|
||||
* @returns A stringified version of the extra state of the given block.
|
||||
* @internal
|
||||
*/
|
||||
static getExtraBlockState_(block: BlockSvg): string {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for a block creation event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for a block creation event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -26,6 +23,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a block creation event.
|
||||
*
|
||||
* @alias Blockly.Events.BlockCreate
|
||||
*/
|
||||
export class BlockCreate extends BlockBase {
|
||||
@@ -61,7 +59,8 @@ export class BlockCreate extends BlockBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -76,6 +75,7 @@ export class BlockCreate extends BlockBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -90,6 +90,7 @@ export class BlockCreate extends BlockBase {
|
||||
|
||||
/**
|
||||
* Run a creation event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for a block delete event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for a block delete event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -26,6 +23,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a block deletion event.
|
||||
*
|
||||
* @alias Blockly.Events.BlockDelete
|
||||
*/
|
||||
export class BlockDelete extends BlockBase {
|
||||
@@ -70,7 +68,8 @@ export class BlockDelete extends BlockBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -86,6 +85,7 @@ export class BlockDelete extends BlockBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -102,6 +102,7 @@ export class BlockDelete extends BlockBase {
|
||||
|
||||
/**
|
||||
* Run a deletion event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a block drag.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a block drag.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a block drag event.
|
||||
*
|
||||
* @alias Blockly.Events.BlockDrag
|
||||
*/
|
||||
export class BlockDrag extends UiBase {
|
||||
@@ -57,7 +55,8 @@ export class BlockDrag extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -69,6 +68,7 @@ export class BlockDrag extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for a block move event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for a block move event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -32,6 +29,7 @@ interface BlockLocation {
|
||||
|
||||
/**
|
||||
* Class for a block move event. Created before the move.
|
||||
*
|
||||
* @alias Blockly.Events.BlockMove
|
||||
*/
|
||||
export class BlockMove extends BlockBase {
|
||||
@@ -71,7 +69,8 @@ export class BlockMove extends BlockBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -93,6 +92,7 @@ export class BlockMove extends BlockBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -119,7 +119,8 @@ export class BlockMove extends BlockBase {
|
||||
/**
|
||||
* Returns the parentId and input if the block is connected,
|
||||
* or the XY location if disconnected.
|
||||
* @return Collection of location info.
|
||||
*
|
||||
* @returns Collection of location info.
|
||||
*/
|
||||
private currentLocation_(): BlockLocation {
|
||||
const workspace = this.getEventWorkspace_();
|
||||
@@ -142,7 +143,8 @@ export class BlockMove extends BlockBase {
|
||||
|
||||
/**
|
||||
* Does this event record any change of state?
|
||||
* @return False if something changed.
|
||||
*
|
||||
* @returns False if something changed.
|
||||
*/
|
||||
override isNull(): boolean {
|
||||
return this.oldParentId === this.newParentId &&
|
||||
@@ -152,6 +154,7 @@ export class BlockMove extends BlockBase {
|
||||
|
||||
/**
|
||||
* Run a move event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of bubble open.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of bubble open.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a bubble open event.
|
||||
*
|
||||
* @alias Blockly.Events.BubbleOpen
|
||||
*/
|
||||
export class BubbleOpen extends UiBase {
|
||||
@@ -57,7 +55,8 @@ export class BubbleOpen extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -69,6 +68,7 @@ export class BubbleOpen extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of UI click in Blockly's editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of UI click in Blockly's editor.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a click event.
|
||||
*
|
||||
* @alias Blockly.Events.Click
|
||||
*/
|
||||
export class Click extends UiBase {
|
||||
@@ -59,7 +57,8 @@ export class Click extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -72,6 +71,7 @@ export class Click extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Base class for comment events.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for comment events.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -27,6 +24,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Abstract class for a comment event.
|
||||
*
|
||||
* @alias Blockly.Events.CommentBase
|
||||
*/
|
||||
export class CommentBase extends AbstractEvent {
|
||||
@@ -62,7 +60,8 @@ export class CommentBase extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -74,6 +73,7 @@ export class CommentBase extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -83,6 +83,7 @@ export class CommentBase extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Helper function for Comment[Create|Delete]
|
||||
*
|
||||
* @param event The event to run.
|
||||
* @param create if True then Create, if False then Delete
|
||||
*/
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for comment change event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for comment change event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a comment change event.
|
||||
*
|
||||
* @alias Blockly.Events.CommentChange
|
||||
*/
|
||||
export class CommentChange extends CommentBase {
|
||||
@@ -60,7 +58,8 @@ export class CommentChange extends CommentBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -71,6 +70,7 @@ export class CommentChange extends CommentBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -81,7 +81,8 @@ export class CommentChange extends CommentBase {
|
||||
|
||||
/**
|
||||
* Does this event record any change of state?
|
||||
* @return False if something changed.
|
||||
*
|
||||
* @returns False if something changed.
|
||||
*/
|
||||
override isNull(): boolean {
|
||||
return this.oldContents_ === this.newContents_;
|
||||
@@ -89,6 +90,7 @@ export class CommentChange extends CommentBase {
|
||||
|
||||
/**
|
||||
* Run a change event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for comment creation event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for comment creation event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -25,6 +22,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a comment creation event.
|
||||
*
|
||||
* @alias Blockly.Events.CommentCreate
|
||||
*/
|
||||
export class CommentCreate extends CommentBase {
|
||||
@@ -52,7 +50,8 @@ export class CommentCreate extends CommentBase {
|
||||
// TODO (#1266): "Full" and "minimal" serialization.
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -62,6 +61,7 @@ export class CommentCreate extends CommentBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -71,6 +71,7 @@ export class CommentCreate extends CommentBase {
|
||||
|
||||
/**
|
||||
* Run a creation event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for comment deletion event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for comment deletion event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a comment deletion event.
|
||||
*
|
||||
* @alias Blockly.Events.CommentDelete
|
||||
*/
|
||||
export class CommentDelete extends CommentBase {
|
||||
@@ -49,7 +47,8 @@ export class CommentDelete extends CommentBase {
|
||||
// TODO (#1266): "Full" and "minimal" serialization.
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -58,6 +57,7 @@ export class CommentDelete extends CommentBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -66,6 +66,7 @@ export class CommentDelete extends CommentBase {
|
||||
|
||||
/**
|
||||
* Run a creation event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for comment move event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for comment move event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -25,6 +22,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a comment move event. Created before the move.
|
||||
*
|
||||
* @alias Blockly.Events.CommentMove
|
||||
*/
|
||||
export class CommentMove extends CommentBase {
|
||||
@@ -83,6 +81,7 @@ export class CommentMove extends CommentBase {
|
||||
/**
|
||||
* Override the location before the move. Use this if you don't create the
|
||||
* event until the end of the move, but you know the original location.
|
||||
*
|
||||
* @param xy The location before the move, in workspace coordinates.
|
||||
*/
|
||||
setOldCoordinate(xy: Coordinate) {
|
||||
@@ -92,7 +91,8 @@ export class CommentMove extends CommentBase {
|
||||
// TODO (#1266): "Full" and "minimal" serialization.
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -109,6 +109,7 @@ export class CommentMove extends CommentBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -126,7 +127,8 @@ export class CommentMove extends CommentBase {
|
||||
|
||||
/**
|
||||
* Does this event record any change of state?
|
||||
* @return False if something changed.
|
||||
*
|
||||
* @returns False if something changed.
|
||||
*/
|
||||
override isNull(): boolean {
|
||||
return Coordinate.equals(this.oldCoordinate_, this.newCoordinate_);
|
||||
@@ -134,6 +136,7 @@ export class CommentMove extends CommentBase {
|
||||
|
||||
/**
|
||||
* Run a move event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of a marker move.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of a marker move.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -26,6 +23,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a marker move event.
|
||||
*
|
||||
* @alias Blockly.Events.MarkerMove
|
||||
*/
|
||||
export class MarkerMove extends UiBase {
|
||||
@@ -72,7 +70,8 @@ export class MarkerMove extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -85,6 +84,7 @@ export class MarkerMove extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of element select action.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of element select action.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -23,6 +20,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a selected event.
|
||||
*
|
||||
* @alias Blockly.Events.Selected
|
||||
*/
|
||||
export class Selected extends UiBase {
|
||||
@@ -55,7 +53,8 @@ export class Selected extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -66,6 +65,7 @@ export class Selected extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of a theme update.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of a theme update.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -23,6 +20,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a theme change event.
|
||||
*
|
||||
* @alias Blockly.Events.ThemeChange
|
||||
*/
|
||||
export class ThemeChange extends UiBase {
|
||||
@@ -46,7 +44,8 @@ export class ThemeChange extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -56,6 +55,7 @@ export class ThemeChange extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of selecting an item on the toolbox.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of selecting an item on the toolbox.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -23,6 +20,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a toolbox item select event.
|
||||
*
|
||||
* @alias Blockly.Events.ToolboxItemSelect
|
||||
*/
|
||||
export class ToolboxItemSelect extends UiBase {
|
||||
@@ -55,7 +53,8 @@ export class ToolboxItemSelect extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -66,6 +65,7 @@ export class ToolboxItemSelect extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of trashcan flyout open and close.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of trashcan flyout open and close.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -23,6 +20,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a trashcan open event.
|
||||
*
|
||||
* @alias Blockly.Events.TrashcanOpen
|
||||
*/
|
||||
export class TrashcanOpen extends UiBase {
|
||||
@@ -47,7 +45,8 @@ export class TrashcanOpen extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -57,6 +56,7 @@ export class TrashcanOpen extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview (Deprecated) Events fired as a result of UI actions in
|
||||
* Blockly's editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Deprecated) Events fired as a result of UI actions in
|
||||
* Blockly's editor.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -26,6 +22,7 @@ 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
|
||||
*/
|
||||
@@ -60,7 +57,8 @@ export class Ui extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -76,6 +74,7 @@ export class Ui extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Base class for events fired as a result of UI actions in
|
||||
* Blockly's editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for events fired as a result of UI actions in
|
||||
* Blockly's editor.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -26,6 +22,7 @@ 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 {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Abstract class for a variable event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract class for a variable event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -22,6 +19,7 @@ import {Abstract as AbstractEvent} from './events_abstract.js';
|
||||
|
||||
/**
|
||||
* Abstract class for a variable event.
|
||||
*
|
||||
* @alias Blockly.Events.VarBase
|
||||
*/
|
||||
export class VarBase extends AbstractEvent {
|
||||
@@ -46,7 +44,8 @@ export class VarBase extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -56,6 +55,7 @@ export class VarBase extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for a variable creation event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for a variable creation event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a variable creation event.
|
||||
*
|
||||
* @alias Blockly.Events.VarCreate
|
||||
*/
|
||||
export class VarCreate extends VarBase {
|
||||
@@ -52,7 +50,8 @@ export class VarCreate extends VarBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -63,6 +62,7 @@ export class VarCreate extends VarBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -73,6 +73,7 @@ export class VarCreate extends VarBase {
|
||||
|
||||
/**
|
||||
* Run a variable creation event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Classes for all types of variable events.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Classes for all types of variable events.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a variable deletion event.
|
||||
*
|
||||
* @alias Blockly.Events.VarDelete
|
||||
*/
|
||||
export class VarDelete extends VarBase {
|
||||
@@ -52,7 +50,8 @@ export class VarDelete extends VarBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -63,6 +62,7 @@ export class VarDelete extends VarBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -73,6 +73,7 @@ export class VarDelete extends VarBase {
|
||||
|
||||
/**
|
||||
* Run a variable deletion event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for a variable rename event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for a variable rename event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a variable rename event.
|
||||
*
|
||||
* @alias Blockly.Events.VarRename
|
||||
*/
|
||||
export class VarRename extends VarBase {
|
||||
@@ -53,7 +51,8 @@ export class VarRename extends VarBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -64,6 +63,7 @@ export class VarRename extends VarBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
@@ -74,6 +74,7 @@ export class VarRename extends VarBase {
|
||||
|
||||
/**
|
||||
* Run a variable rename event.
|
||||
*
|
||||
* @param forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
override run(forward: boolean) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Events fired as a result of a viewport change.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events fired as a result of a viewport change.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -23,6 +20,7 @@ import * as eventUtils from './utils.js';
|
||||
|
||||
/**
|
||||
* Class for a viewport change event.
|
||||
*
|
||||
* @alias Blockly.Events.ViewportChange
|
||||
*/
|
||||
export class ViewportChange extends UiBase {
|
||||
@@ -72,7 +70,8 @@ export class ViewportChange extends UiBase {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = super.toJson();
|
||||
@@ -85,6 +84,7 @@ export class ViewportChange extends UiBase {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Helper methods for events that are fired as a result of
|
||||
* actions in Blockly's editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Helper methods for events that are fired as a result of
|
||||
* actions in Blockly's editor.
|
||||
*
|
||||
* @namespace Blockly.Events.utils
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -41,6 +37,7 @@ 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
|
||||
*/
|
||||
@@ -50,6 +47,7 @@ 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
|
||||
*/
|
||||
@@ -62,156 +60,182 @@ 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';
|
||||
@@ -222,6 +246,7 @@ 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;
|
||||
@@ -232,6 +257,7 @@ 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[] =
|
||||
@@ -242,6 +268,7 @@ const FIRE_QUEUE: Abstract[] = [];
|
||||
|
||||
/**
|
||||
* Create a custom event and fire it.
|
||||
*
|
||||
* @param event Custom data for event.
|
||||
* @alias Blockly.Events.utils.fire
|
||||
*/
|
||||
@@ -281,9 +308,10 @@ function fireNow() {
|
||||
|
||||
/**
|
||||
* Filter the queued events and merge duplicates.
|
||||
*
|
||||
* @param queueIn Array of events.
|
||||
* @param forward True if forward (redo), false if backward (undo).
|
||||
* @return Array of filtered events.
|
||||
* @returns Array of filtered events.
|
||||
* @alias Blockly.Events.utils.filter
|
||||
*/
|
||||
export function filter(queueIn: Abstract[], forward: boolean): Abstract[] {
|
||||
@@ -367,6 +395,7 @@ 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() {
|
||||
@@ -377,6 +406,7 @@ export function clearPendingUndo() {
|
||||
|
||||
/**
|
||||
* Stop sending events. Every call to this function MUST also call enable.
|
||||
*
|
||||
* @alias Blockly.Events.utils.disable
|
||||
*/
|
||||
export function disable() {
|
||||
@@ -386,6 +416,7 @@ 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() {
|
||||
@@ -394,7 +425,8 @@ export function enable() {
|
||||
|
||||
/**
|
||||
* Returns whether events may be fired or not.
|
||||
* @return True if enabled.
|
||||
*
|
||||
* @returns True if enabled.
|
||||
* @alias Blockly.Events.utils.isEnabled
|
||||
*/
|
||||
export function isEnabled(): boolean {
|
||||
@@ -403,7 +435,8 @@ export function isEnabled(): boolean {
|
||||
|
||||
/**
|
||||
* Current group.
|
||||
* @return ID string.
|
||||
*
|
||||
* @returns ID string.
|
||||
* @alias Blockly.Events.utils.getGroup
|
||||
*/
|
||||
export function getGroup(): string {
|
||||
@@ -412,6 +445,7 @@ export function getGroup(): string {
|
||||
|
||||
/**
|
||||
* Start or stop a group.
|
||||
*
|
||||
* @param state True to start new group, false to end group.
|
||||
* String to set group explicitly.
|
||||
* @alias Blockly.Events.utils.setGroup
|
||||
@@ -433,8 +467,9 @@ function setGroupInternal(state: boolean|string) {
|
||||
|
||||
/**
|
||||
* Compute a list of the IDs of the specified block and all its descendants.
|
||||
*
|
||||
* @param block The root block.
|
||||
* @return List of block IDs.
|
||||
* @returns List of block IDs.
|
||||
* @alias Blockly.Events.utils.getDescendantIds
|
||||
* @internal
|
||||
*/
|
||||
@@ -449,9 +484,10 @@ export function getDescendantIds(block: Block): string[] {
|
||||
|
||||
/**
|
||||
* Decode the JSON into an event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
* @param workspace Target workspace for event.
|
||||
* @return The event represented by the JSON.
|
||||
* @returns The event represented by the JSON.
|
||||
* @throws {Error} if an event type is not found in the registry.
|
||||
* @alias Blockly.Events.utils.fromJson
|
||||
*/
|
||||
@@ -469,8 +505,9 @@ export function fromJson(
|
||||
|
||||
/**
|
||||
* Gets the class for a specific event type from the registry.
|
||||
*
|
||||
* @param eventType The type of the event to get.
|
||||
* @return The event class with the given type or null if none exists.
|
||||
* @returns The event class with the given type or null if none exists.
|
||||
* @alias Blockly.Events.utils.get
|
||||
*/
|
||||
export function get(eventType: string):
|
||||
@@ -483,6 +520,7 @@ export function get(eventType: string):
|
||||
* Use this on applications where all blocks should be connected to a top block.
|
||||
* Recommend setting the 'disable' option to 'false' in the config so that
|
||||
* users don't try to re-enable disabled orphan blocks.
|
||||
*
|
||||
* @param event Custom data for event.
|
||||
* @alias Blockly.Events.utils.disableOrphans
|
||||
*/
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class for a finished loading workspace event.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for a finished loading workspace event.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
@@ -27,6 +24,7 @@ import * as eventUtils from './utils.js';
|
||||
* Used to notify the developer when the workspace has finished loading (i.e
|
||||
* domToWorkspace).
|
||||
* Finished loading events do not record undo or redo.
|
||||
*
|
||||
* @alias Blockly.Events.FinishedLoading
|
||||
*/
|
||||
export class FinishedLoading extends AbstractEvent {
|
||||
@@ -56,7 +54,8 @@ export class FinishedLoading extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return JSON representation.
|
||||
*
|
||||
* @returns JSON representation.
|
||||
*/
|
||||
override toJson(): AnyDuringMigration {
|
||||
const json = {
|
||||
@@ -73,6 +72,7 @@ export class FinishedLoading extends AbstractEvent {
|
||||
|
||||
/**
|
||||
* Decode the JSON event.
|
||||
*
|
||||
* @param json JSON representation.
|
||||
*/
|
||||
override fromJson(json: AnyDuringMigration) {
|
||||
|
||||
Reference in New Issue
Block a user