chore: Post-merge fixits.

This commit is contained in:
Aaron Dodson
2024-12-04 12:15:19 -08:00
parent 9fcd5a3037
commit 389dd1a1cb
23 changed files with 63 additions and 72 deletions

View File

@@ -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';
/**

View File

@@ -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;

View File

@@ -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,

View File

@@ -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;
}

View File

@@ -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,
);

View File

@@ -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.
*

View File

@@ -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.

View File

@@ -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';
/**

View File

@@ -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();
}

View File

@@ -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);
}
/**

View File

@@ -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';

View File

@@ -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.

View File

@@ -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 {

View File

@@ -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;
}

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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;

View File

@@ -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.

View File

@@ -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';
/**

View File

@@ -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<IVariableState> {
state['id'],
);
workspace.getVariableMap().addVariable(variable);
eventUtils.fire(new (eventUtils.get(eventUtils.VAR_CREATE))(variable));
eventUtils.fire(new (eventUtils.get(EventType.VAR_CREATE))(variable));
}
}

View File

@@ -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';

View File

@@ -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';