refactor: Rename ALIGN to Align and move from constants.js to input.js (#5742)

This constant is used to specify the alignment of
an Input, so it should live in the same file as the Input class.

I've done this as a separate named export, but it could alternatively
be made a static member of Input (i.e., Input.Align with only Input
being exported by name).

Where mocha tests were referring to Blockly.constants.ALIGN.*
without actually requiring Blockly.constants, I have reverted
them to refer to Blockly.ALIGN_* instead (pending conversion
to named requries).

Part of #5073.
This commit is contained in:
Christopher Allen
2021-11-29 21:59:48 +00:00
committed by GitHub
parent 985af10f6e
commit c0d22f2002
9 changed files with 56 additions and 42 deletions

View File

@@ -52,6 +52,7 @@ const toolbox = goog.require('Blockly.utils.toolbox');
const uiPosition = goog.require('Blockly.uiPosition');
const utils = goog.require('Blockly.utils');
const zelos = goog.require('Blockly.zelos');
const {Align, Input} = goog.require('Blockly.Input');
const {ASTNode} = goog.require('Blockly.ASTNode');
const {BasicCursor} = goog.require('Blockly.BasicCursor');
const {BlockDragSurfaceSvg} = goog.require('Blockly.BlockDragSurfaceSvg');
@@ -122,7 +123,6 @@ const {IStyleable} = goog.require('Blockly.IStyleable');
const {IToolboxItem} = goog.require('Blockly.IToolboxItem');
const {IToolbox} = goog.require('Blockly.IToolbox');
const {Icon} = goog.require('Blockly.Icon');
const {Input} = goog.require('Blockly.Input');
const {InsertionMarkerManager} = goog.require('Blockly.InsertionMarkerManager');
const {Marker} = goog.require('Blockly.Marker');
const {MarkerManager} = goog.require('Blockly.MarkerManager');
@@ -438,22 +438,22 @@ exports.unbindEvent_ = browserEvents.unbind;
exports.bindEventWithChecks_ = browserEvents.conditionalBind;
/**
* @see constants.ALIGN.LEFT
* @see Blockly.Input.Align.LEFT
* @alias Blockly.ALIGN_LEFT
*/
exports.ALIGN_LEFT = constants.ALIGN.LEFT;
exports.ALIGN_LEFT = Align.LEFT;
/**
* @see constants.ALIGN.CENTRE
* @see Blockly.Input.Align.CENTRE
* @alias Blockly.ALIGN_CENTRE
*/
exports.ALIGN_CENTRE = constants.ALIGN.CENTRE;
exports.ALIGN_CENTRE = Align.CENTRE;
/**
* @see constants.ALIGN.RIGHT
* @see Blockly.Input.Align.RIGHT
* @alias Blockly.ALIGN_RIGHT
*/
exports.ALIGN_RIGHT = constants.ALIGN.RIGHT;
exports.ALIGN_RIGHT = Align.RIGHT;
/**
* @see common.svgResize