Skip to content

Commit

Permalink
chore!: delete deprecations for v11. (#7732)
Browse files Browse the repository at this point in the history
* chore: delete basic deprecations

* chore: remove deprecated align enum

* chore: remove generator deprecation

* chore: format
  • Loading branch information
BeksOmega authored Jan 10, 2024
1 parent 1e5ff14 commit 4f1a442
Show file tree
Hide file tree
Showing 22 changed files with 6 additions and 782 deletions.
2 changes: 1 addition & 1 deletion blocks/procedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import * as Xml from '../core/xml.js';
import * as fieldRegistry from '../core/field_registry.js';
import * as xmlUtils from '../core/utils/xml.js';
import type {Abstract as AbstractEvent} from '../core/events/events_abstract.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 type {BlockCreate} from '../core/events/events_block_create.js';
Expand Down
55 changes: 0 additions & 55 deletions core/block_dragger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import * as registry from './registry.js';
import {Coordinate} from './utils/coordinate.js';
import * as dom from './utils/dom.js';
import type {WorkspaceSvg} from './workspace_svg.js';
import {hasBubble} from './interfaces/i_has_bubble.js';
import * as deprecation from './utils/deprecation.js';
import * as layers from './layers.js';

/**
Expand All @@ -51,12 +49,6 @@ export class BlockDragger implements IBlockDragger {
protected wouldDeleteBlock_ = false;
protected startXY_: Coordinate;

/**
* @deprecated To be removed in v11. Updating icons is now handled by the
* block's `moveDuringDrag` method.
*/
protected dragIconData_: IconPositionData[] = [];

/**
* @param block The block to drag.
* @param workspace The workspace to drag on.
Expand All @@ -76,8 +68,6 @@ export class BlockDragger implements IBlockDragger {
* beginning of the drag in workspace coordinates.
*/
this.startXY_ = this.draggingBlock_.getRelativeToSurfaceXY();

this.dragIconData_ = initIconData(block, this.startXY_);
}

/**
Expand All @@ -86,7 +76,6 @@ export class BlockDragger implements IBlockDragger {
* @internal
*/
dispose() {
this.dragIconData_.length = 0;
if (this.draggedConnectionManager_) {
this.draggedConnectionManager_.dispose();
}
Expand Down Expand Up @@ -398,16 +387,6 @@ export class BlockDragger implements IBlockDragger {
return result;
}

/**
* Move all of the icons connected to this drag.
*
* @deprecated To be removed in v11. This is now handled by the block's
* `moveDuringDrag` method.
*/
protected dragIcons_() {
deprecation.warn('Blockly.BlockDragger.prototype.dragIcons_', 'v10', 'v11');
}

/**
* Get a list of the insertion markers that currently exist. Drags have 0, 1,
* or 2 insertion markers.
Expand All @@ -432,38 +411,4 @@ export interface IconPositionData {
icon: Icon;
}

/**
* Make a list of all of the icons (comment, warning, and mutator) that are
* on this block and its descendants. Moving an icon moves the bubble that
* extends from it if that bubble is open.
*
* @param block The root block that is being dragged.
* @param blockOrigin The top left of the given block in workspace coordinates.
* @returns The list of all icons and their locations.
*/
function initIconData(
block: BlockSvg,
blockOrigin: Coordinate,
): IconPositionData[] {
// Build a list of icons that need to be moved and where they started.
const dragIconData = [];

for (const icon of block.getIcons()) {
// Only bother to track icons whose bubble is visible.
if (hasBubble(icon) && !icon.bubbleIsVisible()) continue;

dragIconData.push({location: blockOrigin, icon: icon});
icon.onLocationChange(blockOrigin);
}

for (const child of block.getChildren(false)) {
dragIconData.push(
...initIconData(child, Coordinate.sum(blockOrigin, child.relativeCoords)),
);
}
// AnyDuringMigration because: Type '{ location: Coordinate | null; icon:
// Icon; }[]' is not assignable to type 'IconPositionData[]'.
return dragIconData as AnyDuringMigration;
}

registry.register(registry.Type.BLOCK_DRAGGER, registry.DEFAULT, BlockDragger);
23 changes: 0 additions & 23 deletions core/block_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import './events/events_selected.js';
import {Block} from './block.js';
import * as blockAnimations from './block_animations.js';
import * as browserEvents from './browser_events.js';
import {CommentIcon} from './icons/comment_icon.js';
import * as common from './common.js';
import {config} from './config.js';
import type {Connection} from './connection.js';
Expand Down Expand Up @@ -59,7 +58,6 @@ import {WarningIcon} from './icons/warning_icon.js';
import type {Workspace} from './workspace.js';
import type {WorkspaceSvg} from './workspace_svg.js';
import * as renderManagement from './render_management.js';
import * as deprecation from './utils/deprecation.js';
import {IconType} from './icons/icon_types.js';
import {BlockCopyData, BlockPaster} from './clipboard/block_paster.js';

Expand Down Expand Up @@ -115,13 +113,6 @@ export class BlockSvg
/** Block's mutator icon (if any). */
mutator: MutatorIcon | null = null;

/**
* Block's warning icon (if any).
*
* @deprecated Use `setWarningText` to modify warnings on this block.
*/
warning: WarningIcon | null = null;

private svgGroup_: SVGGElement;
style: BlockStyle;
/** @internal */
Expand Down Expand Up @@ -911,18 +902,6 @@ export class BlockSvg
}
}

/**
* Get the comment icon attached to this block, or null if the block has no
* comment.
*
* @returns The comment icon attached to this block, or null.
* @deprecated Use getIcon. To be remove in v11.
*/
getCommentIcon(): CommentIcon | null {
deprecation.warn('getCommentIcon', 'v10', 'v11', 'getIcon');
return (this.getIcon(CommentIcon.TYPE) ?? null) as CommentIcon | null;
}

/**
* Set this block's warning text.
*
Expand Down Expand Up @@ -1010,7 +989,6 @@ export class BlockSvg
override addIcon<T extends IIcon>(icon: T): T {
super.addIcon(icon);

if (icon instanceof WarningIcon) this.warning = icon;
if (icon instanceof MutatorIcon) this.mutator = icon;

if (this.rendered) {
Expand Down Expand Up @@ -1041,7 +1019,6 @@ export class BlockSvg
override removeIcon(type: IconType<IIcon>): boolean {
const removed = super.removeIcon(type);

if (type.equals(WarningIcon.TYPE)) this.warning = null;
if (type.equals(MutatorIcon.TYPE)) this.mutator = null;

if (this.rendered) {
Expand Down
38 changes: 0 additions & 38 deletions core/blockly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {BlockSvg} from './block_svg.js';
import {BlocklyOptions} from './blockly_options.js';
import {Blocks} from './blocks.js';
import * as browserEvents from './browser_events.js';
import {Bubble} from './bubbles/bubble.js';
import * as bubbles from './bubbles.js';
import {BubbleDragger} from './bubble_dragger.js';
import * as bumpObjects from './bump_objects.js';
Expand Down Expand Up @@ -123,9 +122,7 @@ import {Gesture} from './gesture.js';
import {Grid} from './grid.js';
import * as icons from './icons.js';
import {inject} from './inject.js';
import {Align} from './inputs/align.js';
import {Input} from './inputs/input.js';
import {inputTypes} from './inputs/input_types.js';
import * as inputs from './inputs.js';
import {InsertionMarkerManager} from './insertion_marker_manager.js';
import {IASTNodeLocation} from './interfaces/i_ast_node_location.js';
Expand Down Expand Up @@ -186,7 +183,6 @@ import * as renderManagement from './render_management.js';
import * as blockRendering from './renderers/common/block_rendering.js';
import * as constants from './constants.js';
import * as geras from './renderers/geras/geras.js';
import * as minimalist from './renderers/minimalist/minimalist.js';
import * as thrasos from './renderers/thrasos/thrasos.js';
import * as zelos from './renderers/zelos/zelos.js';
import {Scrollbar} from './scrollbar.js';
Expand Down Expand Up @@ -241,27 +237,6 @@ export const VERSION = 'uncompiled';
* namespace to put new functions on.
*/

/*
* Aliases for input alignments used in block defintions.
*/

/**
* @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;
/*
* Aliases for constants used for connection and input types.
*/
Expand All @@ -286,12 +261,6 @@ export const NEXT_STATEMENT = ConnectionType.NEXT_STATEMENT;
*/
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;

/** Aliases for toolbox positions. */

/**
Expand Down Expand Up @@ -488,7 +457,6 @@ export {constants};
export {dialog};
export {fieldRegistry};
export {geras};
export {minimalist};
export {registry};
export {thrasos};
export {uiPosition};
Expand All @@ -502,8 +470,6 @@ export {BlockDragger};
export {BlockSvg};
export {Blocks};
export {bubbles};
/** @deprecated Use Blockly.bubbles.Bubble instead. To be removed in v11. */
export {Bubble};
export {BubbleDragger};
export {CollapsibleToolboxCategory};
export {ComponentManager};
Expand Down Expand Up @@ -648,9 +614,5 @@ export {WorkspaceDragger};
export {WorkspaceSvg};
export {ZoomControls};
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};
41 changes: 0 additions & 41 deletions core/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,12 @@ import * as globalRegistry from './registry.js';
import {WorkspaceSvg} from './workspace_svg.js';
import * as registry from './clipboard/registry.js';
import {Coordinate} from './utils/coordinate.js';
import * as deprecation from './utils/deprecation.js';

/** Metadata about the object that is currently on the clipboard. */
let stashedCopyData: ICopyData | null = null;

let stashedWorkspace: WorkspaceSvg | null = null;

/**
* Copy a copyable element onto the local clipboard.
*
* @param toCopy The copyable element to be copied.
* @deprecated v11. Use `myCopyable.toCopyData()` instead. To be removed v12.
* @internal
*/
export function copy<T extends ICopyData>(toCopy: ICopyable<T>): T | null {
deprecation.warn(
'Blockly.clipboard.copy',
'v11',
'v12',
'myCopyable.toCopyData()',
);
return TEST_ONLY.copyInternal(toCopy);
}

/**
* Private version of copy for stubbing in tests.
*/
Expand Down Expand Up @@ -107,29 +89,6 @@ function pasteFromData<T extends ICopyData>(
?.paste(copyData, workspace, coordinate) ?? null) as ICopyable<T> | null;
}

/**
* Duplicate this copy-paste-able element.
*
* @param toDuplicate The element to be duplicated.
* @returns The element that was duplicated, or null if the duplication failed.
* @deprecated v11. Use
* `Blockly.clipboard.paste(myCopyable.toCopyData(), myWorkspace)` instead.
* To be removed v12.
* @internal
*/
export function duplicate<
U extends ICopyData,
T extends ICopyable<U> & IHasWorkspace,
>(toDuplicate: T): T | null {
deprecation.warn(
'Blockly.clipboard.duplicate',
'v11',
'v12',
'Blockly.clipboard.paste(myCopyable.toCopyData(), myWorkspace)',
);
return TEST_ONLY.duplicateInternal(toDuplicate);
}

/**
* Private version of duplicate for stubbing in tests.
*/
Expand Down
12 changes: 1 addition & 11 deletions core/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import type {Block} from './block.js';
import * as common from './common.js';
import {Names, NameType} from './names.js';
import type {Workspace} from './workspace.js';
import {warn} from './utils/deprecation.js';

/**
* Deprecated, no-longer used type declaration for per-block-type generator
Expand Down Expand Up @@ -255,16 +254,7 @@ export class CodeGenerator {

// Look up block generator function in dictionary - but fall back
// to looking up on this if not found, for backwards compatibility.
let func = this.forBlock[block.type];
if (!func && (this as any)[block.type]) {
warn(
'block generator functions on CodeGenerator objects',
'10.0',
'11.0',
'the .forBlock[blockType] dictionary',
);
func = (this as any)[block.type];
}
const func = this.forBlock[block.type];
if (typeof func !== 'function') {
throw Error(
`${this.name_} generator does not know how to generate code ` +
Expand Down
11 changes: 0 additions & 11 deletions core/icons/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import * as dom from '../utils/dom.js';
import {Size} from '../utils/size.js';
import {Svg} from '../utils/svg.js';
import type {IconType} from './icon_types.js';
import * as deprecation from '../utils/deprecation.js';
import * as tooltip from '../tooltip.js';

/**
Expand Down Expand Up @@ -145,14 +144,4 @@ export abstract class Icon implements IIcon {
isClickableInFlyout(autoClosingFlyout: boolean): boolean {
return true;
}

/**
* Sets the visibility of the icon's bubble if one exists.
*
* @deprecated Use `setBubbleVisible` instead. To be removed in v11.
*/
setVisible(visibility: boolean): void {
deprecation.warn('setVisible', 'v10', 'v11', 'setBubbleVisible');
if (hasBubble(this)) this.setBubbleVisible(visibility);
}
}
Loading

0 comments on commit 4f1a442

Please sign in to comment.