diff --git a/.eslintrc.js b/.eslintrc.js index c090b6041..14d27ca1a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -130,6 +130,7 @@ function buildTSOverride({files, tsconfig}) { 'remarks', 'define', 'nocollapse', + 'suppress', ], }, ], diff --git a/blocks/lists.ts b/blocks/lists.ts index fab4871d8..3c2b101b8 100644 --- a/blocks/lists.ts +++ b/blocks/lists.ts @@ -9,7 +9,7 @@ goog.declareModuleId('Blockly.libraryBlocks.lists'); import * as fieldRegistry from '../core/field_registry.js'; import * as xmlUtils from '../core/utils/xml.js'; -import {Align} from '../core/inputs/input.js'; +import {Align} from '../core/inputs/align.js'; import type {Block} from '../core/block.js'; import type {Connection} from '../core/connection.js'; import type {BlockSvg} from '../core/block_svg.js'; diff --git a/blocks/text.ts b/blocks/text.ts index d33a4dda4..37e09b714 100644 --- a/blocks/text.ts +++ b/blocks/text.ts @@ -10,7 +10,7 @@ goog.declareModuleId('Blockly.libraryBlocks.texts'); import * as Extensions from '../core/extensions.js'; import * as fieldRegistry from '../core/field_registry.js'; import * as xmlUtils from '../core/utils/xml.js'; -import {Align} from '../core/inputs/input.js'; +import {Align} from '../core/inputs/align.js'; import type {Block} from '../core/block.js'; import type {BlockSvg} from '../core/block_svg.js'; import {Connection} from '../core/connection.js'; diff --git a/core/block.ts b/core/block.ts index 25d1d39d1..a4627e3ad 100644 --- a/core/block.ts +++ b/core/block.ts @@ -31,7 +31,8 @@ import * as eventUtils from './events/utils.js'; import * as Extensions from './extensions.js'; import type {Field} from './field.js'; import * as fieldRegistry from './field_registry.js'; -import {Align, Input} from './inputs/input.js'; +import {Input} from './inputs/input.js'; +import {Align} from './inputs/align.js'; import type {IASTNodeLocation} from './interfaces/i_ast_node_location.js'; import type {IDeletable} from './interfaces/i_deletable.js'; import type {IIcon} from './interfaces/i_icon.js'; diff --git a/core/blockly.ts b/core/blockly.ts index bd24c2c6f..2ab584c7e 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -123,11 +123,10 @@ import {Gesture} from './gesture.js'; import {Grid} from './grid.js'; import * as icons from './icons.js'; import {inject} from './inject.js'; -import {Align, Input} from './inputs/input.js'; +import {Align} from './inputs/align.js'; +import {Input} from './inputs/input.js'; import {inputTypes} from './inputs/input_types.js'; -import {DummyInput} from './inputs/dummy_input.js'; -import {StatementInput} from './inputs/statement_input.js'; -import {ValueInput} from './inputs/value_input.js'; +import * as inputs from './inputs.js'; import {InsertionMarkerManager} from './insertion_marker_manager.js'; import {IASTNodeLocation} from './interfaces/i_ast_node_location.js'; import {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js'; @@ -244,16 +243,19 @@ export const VERSION = 'uncompiled'; /** * @see Blockly.Input.Align.LEFT + * @deprecated Use `Blockly.inputs.Align.LEFT`. To be removed in v11. */ export const ALIGN_LEFT = Align.LEFT; /** * @see Blockly.Input.Align.CENTRE + * @deprecated Use `Blockly.inputs.Align.CENTER`. To be removed in v11. */ export const ALIGN_CENTRE = Align.CENTRE; /** * @see Blockly.Input.Align.RIGHT + * @deprecated Use `Blockly.inputs.Align.RIGHT`. To be removed in v11. */ export const ALIGN_RIGHT = Align.RIGHT; /* @@ -282,6 +284,7 @@ export const PREVIOUS_STATEMENT = ConnectionType.PREVIOUS_STATEMENT; /** * @see inputTypes.DUMMY_INPUT + * @deprecated Use `Blockly.inputs.inputTypes.DUMMY`. To be removed in v11. */ export const DUMMY_INPUT = inputTypes.DUMMY; @@ -592,13 +595,7 @@ export {IKeyboardAccessible}; export {IMetricsManager}; export {IMovable}; export {Input}; -export const inputs = { - Input, - inputTypes, - DummyInput, - StatementInput, - ValueInput, -}; +export {inputs}; export {InsertionMarkerManager}; export {IObservable, isObservable}; export {IPositionable}; @@ -644,5 +641,6 @@ export {config}; /** @deprecated Use Blockly.ConnectionType instead. */ export const connectionTypes = ConnectionType; export {inject}; +/** @deprecated Use Blockly.inputs.inputTypes instead. To be removed in v11. */ export {inputTypes}; export {serialization}; diff --git a/core/inputs.ts b/core/inputs.ts new file mode 100644 index 000000000..8bd23d790 --- /dev/null +++ b/core/inputs.ts @@ -0,0 +1,14 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import {Align} from './inputs/align.js'; +import {Input} from './inputs/input.js'; +import {DummyInput} from './inputs/dummy_input.js'; +import {StatementInput} from './inputs/statement_input.js'; +import {ValueInput} from './inputs/value_input.js'; +import {inputTypes} from './inputs/input_types.js'; + +export {Align, Input, DummyInput, StatementInput, ValueInput, inputTypes}; diff --git a/core/inputs/align.ts b/core/inputs/align.ts new file mode 100644 index 000000000..b62846f5d --- /dev/null +++ b/core/inputs/align.ts @@ -0,0 +1,14 @@ +/** + * @license + * Copyright 2012 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * Enum for alignment of inputs. + */ +export enum Align { + LEFT = -1, + CENTRE = 0, + RIGHT = 1, +} diff --git a/core/inputs/input.ts b/core/inputs/input.ts index abfa274c4..6828f958e 100644 --- a/core/inputs/input.ts +++ b/core/inputs/input.ts @@ -307,9 +307,12 @@ export class Input { } export namespace Input { + // TODO(v11): When this is removed in v11, also re-enable errors on access + // of deprecated things (in build_tasks.js). /** * Enum for alignment of inputs. * + * @deprecated Use Blockly.inputs.Align. To be removed in v11. */ export enum Align { LEFT = -1, @@ -318,5 +321,9 @@ export namespace Input { } } +/** @deprecated Use Blockly.inputs.Align. To be removed in v11. */ +/** @suppress {deprecated} */ export type Align = Input.Align; +/** @deprecated Use Blockly.inputs.Align. To be removed in v11. */ +/** @suppress {deprecated} */ export const Align = Input.Align; diff --git a/core/renderers/common/info.ts b/core/renderers/common/info.ts index 7f53e178d..6b5511ad2 100644 --- a/core/renderers/common/info.ts +++ b/core/renderers/common/info.ts @@ -8,7 +8,8 @@ import * as goog from '../../../closure/goog/goog.js'; goog.declareModuleId('Blockly.blockRendering.RenderInfo'); import type {BlockSvg} from '../../block_svg.js'; -import {Align, Input} from '../../inputs/input.js'; +import {Input} from '../../inputs/input.js'; +import {Align} from '../../inputs/align.js'; import type {RenderedConnection} from '../../rendered_connection.js'; import type {Measurable} from '../measurables/base.js'; import {BottomRow} from '../measurables/bottom_row.js'; diff --git a/core/renderers/zelos/info.ts b/core/renderers/zelos/info.ts index 3c905ef9f..a6a4cfe8f 100644 --- a/core/renderers/zelos/info.ts +++ b/core/renderers/zelos/info.ts @@ -12,7 +12,8 @@ import {DummyInput} from '../../inputs/dummy_input.js'; import {FieldImage} from '../../field_image.js'; import {FieldLabel} from '../../field_label.js'; import {FieldTextInput} from '../../field_textinput.js'; -import {Align, Input} from '../../inputs/input.js'; +import {Input} from '../../inputs/input.js'; +import {Align} from '../../inputs/align.js'; import {RenderInfo as BaseRenderInfo} from '../common/info.js'; import type {Measurable} from '../measurables/base.js'; import {Field} from '../measurables/field.js'; diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 3f3e8cfd9..67a2697b1 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -186,8 +186,6 @@ const JSCOMP_ERROR = [ 'conformanceViolations', 'const', 'constantProperty', - 'deprecated', - 'deprecatedAnnotations', 'duplicateMessage', 'es5Strict', 'externsValidation', @@ -234,6 +232,8 @@ const JSCOMP_ERROR = [ * it's generally sufficient to remove them from JSCOMP_ERROR. */ const JSCOMP_WARNING = [ + 'deprecated', + 'deprecatedAnnotations', ]; /** diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index 156f17018..d01907939 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1482,5 +1482,33 @@ oldName: 'Blockly.Icon', newName: 'Blockly.icons.Icon', }, + { + oldName: 'Blockly.Input', + exports: { + 'Align': { + newPath: 'Blockly.inputs.Align', + }, + }, + }, + { + oldName: 'Blockly', + exports: { + 'Align': { + newPath: 'Blockly.inputs.Align', + }, + 'ALIGN_LEFT': { + newPath: 'Blockly.inputs.Align.LEFT', + }, + 'ALIGN_CENTER': { + newPath: 'Blockly.inputs.Align.CENTER', + }, + 'ALIGN_RIGHT': { + newPath: 'Blockly.inputs.Align.RIGHT', + }, + 'inputTypes': { + newModule: 'Blockly.inputs', + }, + }, + }, ], } diff --git a/tests/mocha/block_json_test.js b/tests/mocha/block_json_test.js index 01d3991ad..4f678b5b1 100644 --- a/tests/mocha/block_json_test.js +++ b/tests/mocha/block_json_test.js @@ -6,7 +6,7 @@ goog.declareModuleId('Blockly.test.blockJson'); -import {Align} from '../../build/src/core/inputs/input.js'; +import {Align} from '../../build/src/core/inputs/align.js'; import { sharedTestSetup, sharedTestTeardown, diff --git a/tsdoc.json b/tsdoc.json index da690ca08..51900e7c3 100644 --- a/tsdoc.json +++ b/tsdoc.json @@ -18,6 +18,10 @@ { "tagName": "@nocollapse", "syntaxKind": "modifier" + }, + { + "tagName": "@suppress", + "syntaxKind": "modifier" } ], @@ -26,7 +30,6 @@ "@define": true, "@license": true, "@nocollapse": true, - "@suppress": true, - "@unrestricted": true + "@suppress": true } }