diff --git a/core/block.ts b/core/block.ts index c3dc037c5..9c68bc4cd 100644 --- a/core/block.ts +++ b/core/block.ts @@ -43,6 +43,10 @@ import {ValueInput} from './inputs/value_input.js'; import type {IASTNodeLocation} from './interfaces/i_ast_node_location.js'; import {isCommentIcon} from './interfaces/i_comment_icon.js'; import {type IIcon} from './interfaces/i_icon.js'; +import type { + IVariableModel, + IVariableState, +} from './interfaces/i_variable_model.js'; import * as registry from './registry.js'; import * as Tooltip from './tooltip.js'; import * as arrayUtils from './utils/array.js'; @@ -51,10 +55,6 @@ import * as deprecation from './utils/deprecation.js'; import * as idGenerator from './utils/idgenerator.js'; import * as parsing from './utils/parsing.js'; import {Size} from './utils/size.js'; -import type { - IVariableModel, - IVariableState, -} from './interfaces/i_variable_model.js'; import type {Workspace} from './workspace.js'; /** diff --git a/core/block_flyout_inflater.ts b/core/block_flyout_inflater.ts index b22d2a821..b888e5f3a 100644 --- a/core/block_flyout_inflater.ts +++ b/core/block_flyout_inflater.ts @@ -4,21 +4,21 @@ * SPDX-License-Identifier: Apache-2.0 */ -import type {IFlyout} from './interfaces/i_flyout.js'; -import type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js'; -import type {IBoundedElement} from './interfaces/i_bounded_element.js'; import {BlockSvg} from './block_svg.js'; -import type {WorkspaceSvg} from './workspace_svg.js'; -import * as utilsXml from './utils/xml.js'; -import * as eventUtils from './events/utils.js'; -import * as Xml from './xml.js'; -import * as blocks from './serialization/blocks.js'; +import * as browserEvents from './browser_events.js'; import * as common from './common.js'; -import * as registry from './registry.js'; import {MANUALLY_DISABLED} from './constants.js'; import type {Abstract as AbstractEvent} from './events/events_abstract.js'; +import {EventType} from './events/type.js'; +import type {IBoundedElement} from './interfaces/i_bounded_element.js'; +import type {IFlyout} from './interfaces/i_flyout.js'; +import type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js'; +import * as registry from './registry.js'; +import * as blocks from './serialization/blocks.js'; import type {BlockInfo} from './utils/toolbox.js'; -import * as browserEvents from './browser_events.js'; +import * as utilsXml from './utils/xml.js'; +import type {WorkspaceSvg} from './workspace_svg.js'; +import * as Xml from './xml.js'; /** * The language-neutral ID for when the reason why a block is disabled is @@ -51,7 +51,7 @@ export class BlockFlyoutInflater implements IFlyoutInflater { * @param flyoutWorkspace The workspace to create the block on. * @returns A newly created block. */ - load(state: Object, flyoutWorkspace: WorkspaceSvg): IBoundedElement { + load(state: object, flyoutWorkspace: WorkspaceSvg): IBoundedElement { this.setFlyoutWorkspace(flyoutWorkspace); this.flyout = flyoutWorkspace.targetWorkspace?.getFlyout() ?? undefined; const block = this.createBlock(state as BlockInfo, flyoutWorkspace); @@ -114,7 +114,7 @@ export class BlockFlyoutInflater implements IFlyoutInflater { * @param defaultGap The default spacing for flyout items. * @returns The amount of space that should follow this block. */ - gapForElement(state: Object, defaultGap: number): number { + gapForElement(state: object, defaultGap: number): number { const blockState = state as BlockInfo; let gap; if (blockState['gap']) { @@ -245,8 +245,8 @@ export class BlockFlyoutInflater implements IFlyoutInflater { !this.flyoutWorkspace || (event && !( - event.type === eventUtils.BLOCK_CREATE || - event.type === eventUtils.BLOCK_DELETE + event.type === EventType.BLOCK_CREATE || + event.type === EventType.BLOCK_DELETE )) ) return; diff --git a/core/blockly.ts b/core/blockly.ts index 5d0a9ae15..d0543abbe 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -483,7 +483,6 @@ export { BlockFlyoutInflater, ButtonFlyoutInflater, CodeGenerator, - CodeGenerator, Field, FieldCheckbox, FieldCheckboxConfig, @@ -495,18 +494,11 @@ export { FieldDropdownFromJsonConfig, FieldDropdownValidator, FieldImage, - FieldImage, - FieldImageConfig, FieldImageConfig, FieldImageFromJsonConfig, - FieldImageFromJsonConfig, - FieldLabel, FieldLabel, FieldLabelConfig, - FieldLabelConfig, FieldLabelFromJsonConfig, - FieldLabelFromJsonConfig, - FieldLabelSerializable, FieldLabelSerializable, FieldNumber, FieldNumberConfig, diff --git a/core/button_flyout_inflater.ts b/core/button_flyout_inflater.ts index 703dc6069..fc788ea5b 100644 --- a/core/button_flyout_inflater.ts +++ b/core/button_flyout_inflater.ts @@ -4,12 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js'; -import type {IBoundedElement} from './interfaces/i_bounded_element.js'; -import type {WorkspaceSvg} from './workspace_svg.js'; import {FlyoutButton} from './flyout_button.js'; -import {ButtonOrLabelInfo} from './utils/toolbox.js'; +import type {IBoundedElement} from './interfaces/i_bounded_element.js'; +import type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js'; import * as registry from './registry.js'; +import {ButtonOrLabelInfo} from './utils/toolbox.js'; +import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class responsible for creating buttons for flyouts. @@ -22,7 +22,7 @@ export class ButtonFlyoutInflater implements IFlyoutInflater { * @param flyoutWorkspace The workspace to create the button on. * @returns A newly created FlyoutButton. */ - load(state: Object, flyoutWorkspace: WorkspaceSvg): IBoundedElement { + load(state: object, flyoutWorkspace: WorkspaceSvg): IBoundedElement { const button = new FlyoutButton( flyoutWorkspace, flyoutWorkspace.targetWorkspace!, @@ -40,7 +40,7 @@ export class ButtonFlyoutInflater implements IFlyoutInflater { * @param defaultGap The default spacing for flyout items. * @returns The amount of space that should follow this button. */ - gapForElement(state: Object, defaultGap: number): number { + gapForElement(state: object, defaultGap: number): number { return defaultGap; } diff --git a/core/events/events_var_type_change.ts b/core/events/events_var_type_change.ts index ab8686620..c02a7e454 100644 --- a/core/events/events_var_type_change.ts +++ b/core/events/events_var_type_change.ts @@ -10,21 +10,21 @@ * @class */ -import * as registry from '../registry.js'; import type { IVariableModel, IVariableState, } from '../interfaces/i_variable_model.js'; +import * as registry from '../registry.js'; -import {VarBase, VarBaseJson} from './events_var_base.js'; -import * as eventUtils from './utils.js'; import type {Workspace} from '../workspace.js'; +import {VarBase, VarBaseJson} from './events_var_base.js'; +import {EventType} from './type.js'; /** * Notifies listeners that a variable's type has changed. */ export class VarTypeChange extends VarBase { - override type = eventUtils.VAR_TYPE_CHANGE; + override type = EventType.VAR_TYPE_CHANGE; /** * @param variable The variable whose type changed. Undefined for a blank event. @@ -117,6 +117,6 @@ export interface VarTypeChangeJson extends VarBaseJson { registry.register( registry.Type.EVENT, - eventUtils.VAR_TYPE_CHANGE, + EventType.VAR_TYPE_CHANGE, VarTypeChange, ); diff --git a/core/events/type.ts b/core/events/type.ts index db9ad6c96..0928b8ff0 100644 --- a/core/events/type.ts +++ b/core/events/type.ts @@ -28,6 +28,8 @@ export enum EventType { VAR_DELETE = 'var_delete', /** Type of event that renames a variable. */ VAR_RENAME = 'var_rename', + /** Type of event that changes the type of a variable. */ + VAR_TYPE_CHANGE = 'var_type_change', /** * Type of generic event that records a UI change. * diff --git a/core/field_textinput.ts b/core/field_textinput.ts index 5b754624a..2b896ad47 100644 --- a/core/field_textinput.ts +++ b/core/field_textinput.ts @@ -21,8 +21,8 @@ import { FieldInputValidator, } from './field_input.js'; import * as fieldRegistry from './field_registry.js'; -import * as parsing from './utils/parsing.js'; import * as dom from './utils/dom.js'; +import * as parsing from './utils/parsing.js'; /** * Class for an editable text field. diff --git a/core/field_variable.ts b/core/field_variable.ts index 0c890f4d7..ad9037e96 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -22,17 +22,17 @@ import { MenuGenerator, MenuOption, } from './field_dropdown.js'; -import * as dom from './utils/dom.js'; import * as fieldRegistry from './field_registry.js'; +import {IVariableModel, IVariableState} from './interfaces/i_variable_model.js'; import * as internalConstants from './internal_constants.js'; import type {Menu} from './menu.js'; import type {MenuItem} from './menuitem.js'; -import {WorkspaceSvg} from './workspace_svg.js'; import {Msg} from './msg.js'; +import * as dom from './utils/dom.js'; import * as parsing from './utils/parsing.js'; import {Size} from './utils/size.js'; -import {IVariableModel, IVariableState} from './interfaces/i_variable_model.js'; import * as Variables from './variables.js'; +import {WorkspaceSvg} from './workspace_svg.js'; import * as Xml from './xml.js'; /** diff --git a/core/flyout_base.ts b/core/flyout_base.ts index 5b41a8004..54248edfd 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -642,8 +642,8 @@ export abstract class Flyout // user typing long strings into fields on the blocks in the flyout. this.reflowWrapper = (event) => { if ( - event.type === eventUtils.BLOCK_CHANGE || - event.type === eventUtils.BLOCK_FIELD_INTERMEDIATE_CHANGE + event.type === EventType.BLOCK_CHANGE || + event.type === EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE ) { this.reflow(); } diff --git a/core/icons/comment_icon.ts b/core/icons/comment_icon.ts index f252c4f59..78bf601f7 100644 --- a/core/icons/comment_icon.ts +++ b/core/icons/comment_icon.ts @@ -199,7 +199,6 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { setBubbleLocation(location: Coordinate) { this.bubbleLocation = location; this.textInputBubble?.moveDuringDrag(location); - this.textBubble?.moveDuringDrag(location); } /** diff --git a/core/interfaces/i_comment_icon.ts b/core/interfaces/i_comment_icon.ts index 52e550290..05f86f40f 100644 --- a/core/interfaces/i_comment_icon.ts +++ b/core/interfaces/i_comment_icon.ts @@ -6,8 +6,8 @@ import {CommentState} from '../icons/comment_icon.js'; import {IconType} from '../icons/icon_types.js'; -import {Size} from '../utils/size.js'; import {Coordinate} from '../utils/coordinate.js'; +import {Size} from '../utils/size.js'; import {IHasBubble, hasBubble} from './i_has_bubble.js'; import {IIcon, isIcon} from './i_icon.js'; import {ISerializable, isSerializable} from './i_serializable.js'; diff --git a/core/interfaces/i_flyout_inflater.ts b/core/interfaces/i_flyout_inflater.ts index f4a3b6ee9..31f4c23fc 100644 --- a/core/interfaces/i_flyout_inflater.ts +++ b/core/interfaces/i_flyout_inflater.ts @@ -1,5 +1,5 @@ -import type {IBoundedElement} from './i_bounded_element.js'; import type {WorkspaceSvg} from '../workspace_svg.js'; +import type {IBoundedElement} from './i_bounded_element.js'; export interface IFlyoutInflater { /** @@ -16,7 +16,7 @@ export interface IFlyoutInflater { * element, however. * @returns The newly inflated flyout element. */ - load(state: Object, flyoutWorkspace: WorkspaceSvg): IBoundedElement; + load(state: object, flyoutWorkspace: WorkspaceSvg): IBoundedElement; /** * Returns the amount of spacing that should follow the element corresponding @@ -26,7 +26,7 @@ export interface IFlyoutInflater { * @param defaultGap The default gap for elements in this flyout. * @returns The gap that should follow the given element. */ - gapForElement(state: Object, defaultGap: number): number; + gapForElement(state: object, defaultGap: number): number; /** * Disposes of the given element. diff --git a/core/interfaces/i_variable_backed_parameter_model.ts b/core/interfaces/i_variable_backed_parameter_model.ts index 4fda2df46..444deb601 100644 --- a/core/interfaces/i_variable_backed_parameter_model.ts +++ b/core/interfaces/i_variable_backed_parameter_model.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import type {IVariableModel, IVariableState} from './i_variable_model.js'; import {IParameterModel} from './i_parameter_model.js'; +import type {IVariableModel, IVariableState} from './i_variable_model.js'; /** Interface for a parameter model that holds a variable model. */ export interface IVariableBackedParameterModel extends IParameterModel { diff --git a/core/label_flyout_inflater.ts b/core/label_flyout_inflater.ts index 67b02857a..ad304a9a6 100644 --- a/core/label_flyout_inflater.ts +++ b/core/label_flyout_inflater.ts @@ -4,12 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js'; -import type {IBoundedElement} from './interfaces/i_bounded_element.js'; -import type {WorkspaceSvg} from './workspace_svg.js'; import {FlyoutButton} from './flyout_button.js'; -import {ButtonOrLabelInfo} from './utils/toolbox.js'; +import type {IBoundedElement} from './interfaces/i_bounded_element.js'; +import type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js'; import * as registry from './registry.js'; +import {ButtonOrLabelInfo} from './utils/toolbox.js'; +import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class responsible for creating labels for flyouts. @@ -22,7 +22,7 @@ export class LabelFlyoutInflater implements IFlyoutInflater { * @param flyoutWorkspace The workspace to create the label on. * @returns A FlyoutButton configured as a label. */ - load(state: Object, flyoutWorkspace: WorkspaceSvg): IBoundedElement { + load(state: object, flyoutWorkspace: WorkspaceSvg): IBoundedElement { const label = new FlyoutButton( flyoutWorkspace, flyoutWorkspace.targetWorkspace!, @@ -40,7 +40,7 @@ export class LabelFlyoutInflater implements IFlyoutInflater { * @param defaultGap The default spacing for flyout items. * @returns The amount of space that should follow this label. */ - gapForElement(state: Object, defaultGap: number): number { + gapForElement(state: object, defaultGap: number): number { return defaultGap; } diff --git a/core/names.ts b/core/names.ts index 9976da224..db7486f71 100644 --- a/core/names.ts +++ b/core/names.ts @@ -11,12 +11,12 @@ */ // Former goog.module ID: Blockly.Names -import {Msg} from './msg.js'; import type {IVariableMap} from './interfaces/i_variable_map.js'; import type { IVariableModel, IVariableState, } from './interfaces/i_variable_model.js'; +import {Msg} from './msg.js'; import * as Variables from './variables.js'; import type {Workspace} from './workspace.js'; diff --git a/core/renderers/common/renderer.ts b/core/renderers/common/renderer.ts index f223cffa0..01de1f877 100644 --- a/core/renderers/common/renderer.ts +++ b/core/renderers/common/renderer.ts @@ -13,7 +13,6 @@ import {ConnectionType} from '../../connection_type.js'; import type {IRegistrable} from '../../interfaces/i_registrable.js'; import type {Marker} from '../../keyboard_nav/marker.js'; import type {BlockStyle, Theme} from '../../theme.js'; -import * as deprecation from '../../utils/deprecation.js'; import type {WorkspaceSvg} from '../../workspace_svg.js'; import {ConstantProvider} from './constants.js'; import {Drawer} from './drawer.js'; diff --git a/core/renderers/zelos/renderer.ts b/core/renderers/zelos/renderer.ts index fb46921d6..c880ce9f8 100644 --- a/core/renderers/zelos/renderer.ts +++ b/core/renderers/zelos/renderer.ts @@ -9,7 +9,6 @@ import type {BlockSvg} from '../../block_svg.js'; import type {Marker} from '../../keyboard_nav/marker.js'; import type {BlockStyle} from '../../theme.js'; -import * as deprecation from '../../utils/deprecation.js'; import type {WorkspaceSvg} from '../../workspace_svg.js'; import * as blockRendering from '../common/block_rendering.js'; import type {RenderInfo as BaseRenderInfo} from '../common/info.js'; diff --git a/core/separator_flyout_inflater.ts b/core/separator_flyout_inflater.ts index 5ed02aeb9..8c0acf2f5 100644 --- a/core/separator_flyout_inflater.ts +++ b/core/separator_flyout_inflater.ts @@ -4,12 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js'; -import type {IBoundedElement} from './interfaces/i_bounded_element.js'; -import type {WorkspaceSvg} from './workspace_svg.js'; import {FlyoutSeparator, SeparatorAxis} from './flyout_separator.js'; -import type {SeparatorInfo} from './utils/toolbox.js'; +import type {IBoundedElement} from './interfaces/i_bounded_element.js'; +import type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js'; import * as registry from './registry.js'; +import type {SeparatorInfo} from './utils/toolbox.js'; +import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class responsible for creating separators for flyouts. @@ -33,7 +33,7 @@ export class SeparatorFlyoutInflater implements IFlyoutInflater { * @param flyoutWorkspace The workspace the separator belongs to. * @returns A newly created FlyoutSeparator. */ - load(_state: Object, flyoutWorkspace: WorkspaceSvg): IBoundedElement { + load(_state: object, flyoutWorkspace: WorkspaceSvg): IBoundedElement { const flyoutAxis = flyoutWorkspace.targetWorkspace?.getFlyout() ?.horizontalLayout ? SeparatorAxis.X @@ -48,7 +48,7 @@ export class SeparatorFlyoutInflater implements IFlyoutInflater { * @param defaultGap The default spacing for flyout items. * @returns The desired size of the separator. */ - gapForElement(state: Object, defaultGap: number): number { + gapForElement(state: object, defaultGap: number): number { const separatorState = state as SeparatorInfo; const newGap = parseInt(String(separatorState['gap'])); return newGap ?? defaultGap; diff --git a/core/serialization/blocks.ts b/core/serialization/blocks.ts index e729f6826..0c4f06c59 100644 --- a/core/serialization/blocks.ts +++ b/core/serialization/blocks.ts @@ -36,7 +36,6 @@ import * as priorities from './priorities.js'; import * as serializationRegistry from './registry.js'; // TODO(#5160): Remove this once lint is fixed. -/* eslint-disable no-use-before-define */ /** * Represents the state of a connection. diff --git a/core/serialization/variables.ts b/core/serialization/variables.ts index 31c5eb1de..d9c266fb8 100644 --- a/core/serialization/variables.ts +++ b/core/serialization/variables.ts @@ -8,9 +8,9 @@ import type {ISerializer} from '../interfaces/i_serializer.js'; import type {IVariableState} from '../interfaces/i_variable_model.js'; +import * as registry from '../registry.js'; import type {Workspace} from '../workspace.js'; import * as priorities from './priorities.js'; -import * as registry from '../registry.js'; import * as serializationRegistry from './registry.js'; /** diff --git a/core/variable_model.ts b/core/variable_model.ts index 9c959f4f3..4cd16a9c3 100644 --- a/core/variable_model.ts +++ b/core/variable_model.ts @@ -14,6 +14,7 @@ // Unused import preserved for side-effects. Remove if unneeded. import './events/events_var_create.js'; +import {EventType} from './events/type.js'; import * as eventUtils from './events/utils.js'; import {IVariableModel, IVariableState} from './interfaces/i_variable_model.js'; import * as registry from './registry.js'; @@ -138,7 +139,7 @@ export class VariableModel implements IVariableModel { state['id'], ); workspace.getVariableMap().addVariable(variable); - eventUtils.fire(new (eventUtils.get(eventUtils.VAR_CREATE))(variable)); + eventUtils.fire(new (eventUtils.get(EventType.VAR_CREATE))(variable)); } } diff --git a/core/variables.ts b/core/variables.ts index a7f571fa4..75f0c3cf8 100644 --- a/core/variables.ts +++ b/core/variables.ts @@ -11,9 +11,9 @@ import {Blocks} from './blocks.js'; import * as dialog from './dialog.js'; import {isLegacyProcedureDefBlock} from './interfaces/i_legacy_procedure_blocks.js'; import {isVariableBackedParameterModel} from './interfaces/i_variable_backed_parameter_model.js'; +import {IVariableModel, IVariableState} from './interfaces/i_variable_model.js'; import {Msg} from './msg.js'; import * as utilsXml from './utils/xml.js'; -import {IVariableModel, IVariableState} from './interfaces/i_variable_model.js'; import type {Workspace} from './workspace.js'; import type {WorkspaceSvg} from './workspace_svg.js'; diff --git a/core/xml.ts b/core/xml.ts index dad3116c9..a1aaa8114 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -17,15 +17,15 @@ import * as eventUtils from './events/utils.js'; import type {Field} from './field.js'; import {IconType} from './icons/icon_types.js'; import {inputTypes} from './inputs/input_types.js'; +import type { + IVariableModel, + IVariableState, +} from './interfaces/i_variable_model.js'; import * as renderManagement from './render_management.js'; import {Coordinate} from './utils/coordinate.js'; import * as dom from './utils/dom.js'; import {Size} from './utils/size.js'; import * as utilsXml from './utils/xml.js'; -import type { - IVariableModel, - IVariableState, -} from './interfaces/i_variable_model.js'; import * as Variables from './variables.js'; import type {Workspace} from './workspace.js'; import {WorkspaceSvg} from './workspace_svg.js';