mirror of
https://github.com/google/blockly.git
synced 2025-12-16 06:10:12 +01:00
fix: input exports (#7165)
* fix: input exports * chore: fix build * chore: attempt to fix build * chore: attempt to fix build * chore: create new align enum to replace old one * chore: format * fix: Tweak renamings entries It appears that the goal is to map: Blockly.Input.Align -> Blockly.inputs.Align Blockly.Align -> Blockly.inputs.Align Blockly.ALIGN_* -> Blockly.inputs.Align.* I believe this commit achieves that in a more minimal (and correct) way—but if I have misunderstood the intention then this will not be a useful correction. --------- Co-authored-by: Christopher Allen <cpcallen+git@google.com>
This commit is contained in:
@@ -130,6 +130,7 @@ function buildTSOverride({files, tsconfig}) {
|
||||
'remarks',
|
||||
'define',
|
||||
'nocollapse',
|
||||
'suppress',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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};
|
||||
|
||||
14
core/inputs.ts
Normal file
14
core/inputs.ts
Normal file
@@ -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};
|
||||
14
core/inputs/align.ts
Normal file
14
core/inputs/align.ts
Normal file
@@ -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,
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user