From 7eb56ea715cc6f14705fdff6dade252955e73a42 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 29 Jun 2022 16:18:29 +0000 Subject: [PATCH] fix: remaining enums that weren't properly exported (#6251) * fix: remaining enums that weren't properly exported * chore: format * fix: add enum value exports * chore: format --- core/insertion_marker_manager.ts | 26 +++++++++++--------- core/rendered_connection.ts | 41 +++++++++++++++++--------------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index bd1bc9a1a50..c509cd08807 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -52,12 +52,6 @@ const DUPLICATE_BLOCK_ERROR = 'The insertion marker ' + 'you are using a mutator, make sure your domToMutation method is ' + 'properly defined.'; -export enum PreviewType { - INSERTION_MARKER = 0, - INPUT_OUTLINE = 1, - REPLACEMENT_FADE = 2, -} - /** * Class that controls updates to connections during drags. It is primarily * responsible for finding the closest eligible connection and highlighting or @@ -65,11 +59,6 @@ export enum PreviewType { * @alias Blockly.InsertionMarkerManager */ export class InsertionMarkerManager { - /** - * An enum describing different kinds of previews the InsertionMarkerManager - * could display. - */ - static PREVIEW_TYPE = PreviewType; private readonly topBlock_: BlockSvg; private readonly workspace_: WorkspaceSvg; @@ -788,3 +777,18 @@ export class InsertionMarkerManager { return result; } } + +export namespace InsertionMarkerManager { + /** + * An enum describing different kinds of previews the InsertionMarkerManager + * could display. + */ + export enum PREVIEW_TYPE { + INSERTION_MARKER = 0, + INPUT_OUTLINE = 1, + REPLACEMENT_FADE = 2, + } +} + +export type PreviewType = InsertionMarkerManager.PREVIEW_TYPE; +export const PreviewType = InsertionMarkerManager.PREVIEW_TYPE; diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index 9adf8eecf18..25155ec73dd 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -47,30 +47,11 @@ interface PathLeftShape { /** Maximum randomness in workspace units for bumping a block. */ const BUMP_RANDOMNESS = 10; -enum TrackedState { - WILL_TRACK = -1, - UNTRACKED = 0, - TRACKED = 1, -} - /** * Class for a connection between blocks that may be rendered on screen. * @alias Blockly.RenderedConnection */ export class RenderedConnection extends Connection { - /** - * Enum for different kinds of tracked states. - * - * WILL_TRACK means that this connection will add itself to - * the db on the next moveTo call it receives. - * - * UNTRACKED means that this connection will not add - * itself to the database until setTracking(true) is explicitly called. - * - * TRACKED means that this connection is currently being tracked. - */ - static TrackedState = TrackedState; - // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. sourceBlock_!: BlockSvg; private readonly db_: ConnectionDB; @@ -566,3 +547,25 @@ export class RenderedConnection extends Connection { } } } + +export namespace RenderedConnection { + /** + * Enum for different kinds of tracked states. + * + * WILL_TRACK means that this connection will add itself to + * the db on the next moveTo call it receives. + * + * UNTRACKED means that this connection will not add + * itself to the database until setTracking(true) is explicitly called. + * + * TRACKED means that this connection is currently being tracked. + */ + export enum TrackedState { + WILL_TRACK = -1, + UNTRACKED = 0, + TRACKED = 1, + } +} + +export type TrackedState = RenderedConnection.TrackedState; +export const TrackedState = RenderedConnection.TrackedState;