Skip to content

Commit 75007a0

Browse files
committed
chore!: delete deprecations for v11. (#7732)
* chore: delete basic deprecations * chore: remove deprecated align enum * chore: remove generator deprecation * chore: format
1 parent 2e1297e commit 75007a0

File tree

22 files changed

+6
-782
lines changed

22 files changed

+6
-782
lines changed

blocks/procedures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import * as Xml from '../core/xml.js';
1414
import * as fieldRegistry from '../core/field_registry.js';
1515
import * as xmlUtils from '../core/utils/xml.js';
1616
import type {Abstract as AbstractEvent} from '../core/events/events_abstract.js';
17-
import {Align} from '../core/inputs/input.js';
17+
import {Align} from '../core/inputs/align.js';
1818
import type {Block} from '../core/block.js';
1919
import type {BlockSvg} from '../core/block_svg.js';
2020
import type {BlockCreate} from '../core/events/events_block_create.js';

core/block_dragger.ts

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import * as registry from './registry.js';
2828
import {Coordinate} from './utils/coordinate.js';
2929
import * as dom from './utils/dom.js';
3030
import type {WorkspaceSvg} from './workspace_svg.js';
31-
import {hasBubble} from './interfaces/i_has_bubble.js';
32-
import * as deprecation from './utils/deprecation.js';
3331
import * as layers from './layers.js';
3432

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

54-
/**
55-
* @deprecated To be removed in v11. Updating icons is now handled by the
56-
* block's `moveDuringDrag` method.
57-
*/
58-
protected dragIconData_: IconPositionData[] = [];
59-
6052
/**
6153
* @param block The block to drag.
6254
* @param workspace The workspace to drag on.
@@ -76,8 +68,6 @@ export class BlockDragger implements IBlockDragger {
7668
* beginning of the drag in workspace coordinates.
7769
*/
7870
this.startXY_ = this.draggingBlock_.getRelativeToSurfaceXY();
79-
80-
this.dragIconData_ = initIconData(block, this.startXY_);
8171
}
8272

8373
/**
@@ -86,7 +76,6 @@ export class BlockDragger implements IBlockDragger {
8676
* @internal
8777
*/
8878
dispose() {
89-
this.dragIconData_.length = 0;
9079
if (this.draggedConnectionManager_) {
9180
this.draggedConnectionManager_.dispose();
9281
}
@@ -398,16 +387,6 @@ export class BlockDragger implements IBlockDragger {
398387
return result;
399388
}
400389

401-
/**
402-
* Move all of the icons connected to this drag.
403-
*
404-
* @deprecated To be removed in v11. This is now handled by the block's
405-
* `moveDuringDrag` method.
406-
*/
407-
protected dragIcons_() {
408-
deprecation.warn('Blockly.BlockDragger.prototype.dragIcons_', 'v10', 'v11');
409-
}
410-
411390
/**
412391
* Get a list of the insertion markers that currently exist. Drags have 0, 1,
413392
* or 2 insertion markers.
@@ -432,38 +411,4 @@ export interface IconPositionData {
432411
icon: Icon;
433412
}
434413

435-
/**
436-
* Make a list of all of the icons (comment, warning, and mutator) that are
437-
* on this block and its descendants. Moving an icon moves the bubble that
438-
* extends from it if that bubble is open.
439-
*
440-
* @param block The root block that is being dragged.
441-
* @param blockOrigin The top left of the given block in workspace coordinates.
442-
* @returns The list of all icons and their locations.
443-
*/
444-
function initIconData(
445-
block: BlockSvg,
446-
blockOrigin: Coordinate,
447-
): IconPositionData[] {
448-
// Build a list of icons that need to be moved and where they started.
449-
const dragIconData = [];
450-
451-
for (const icon of block.getIcons()) {
452-
// Only bother to track icons whose bubble is visible.
453-
if (hasBubble(icon) && !icon.bubbleIsVisible()) continue;
454-
455-
dragIconData.push({location: blockOrigin, icon: icon});
456-
icon.onLocationChange(blockOrigin);
457-
}
458-
459-
for (const child of block.getChildren(false)) {
460-
dragIconData.push(
461-
...initIconData(child, Coordinate.sum(blockOrigin, child.relativeCoords)),
462-
);
463-
}
464-
// AnyDuringMigration because: Type '{ location: Coordinate | null; icon:
465-
// Icon; }[]' is not assignable to type 'IconPositionData[]'.
466-
return dragIconData as AnyDuringMigration;
467-
}
468-
469414
registry.register(registry.Type.BLOCK_DRAGGER, registry.DEFAULT, BlockDragger);

core/block_svg.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import './events/events_selected.js';
1717
import {Block} from './block.js';
1818
import * as blockAnimations from './block_animations.js';
1919
import * as browserEvents from './browser_events.js';
20-
import {CommentIcon} from './icons/comment_icon.js';
2120
import * as common from './common.js';
2221
import {config} from './config.js';
2322
import type {Connection} from './connection.js';
@@ -59,7 +58,6 @@ import {WarningIcon} from './icons/warning_icon.js';
5958
import type {Workspace} from './workspace.js';
6059
import type {WorkspaceSvg} from './workspace_svg.js';
6160
import * as renderManagement from './render_management.js';
62-
import * as deprecation from './utils/deprecation.js';
6361
import {IconType} from './icons/icon_types.js';
6462
import {BlockCopyData, BlockPaster} from './clipboard/block_paster.js';
6563

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

118-
/**
119-
* Block's warning icon (if any).
120-
*
121-
* @deprecated Use `setWarningText` to modify warnings on this block.
122-
*/
123-
warning: WarningIcon | null = null;
124-
125116
private svgGroup_: SVGGElement;
126117
style: BlockStyle;
127118
/** @internal */
@@ -911,18 +902,6 @@ export class BlockSvg
911902
}
912903
}
913904

914-
/**
915-
* Get the comment icon attached to this block, or null if the block has no
916-
* comment.
917-
*
918-
* @returns The comment icon attached to this block, or null.
919-
* @deprecated Use getIcon. To be remove in v11.
920-
*/
921-
getCommentIcon(): CommentIcon | null {
922-
deprecation.warn('getCommentIcon', 'v10', 'v11', 'getIcon');
923-
return (this.getIcon(CommentIcon.TYPE) ?? null) as CommentIcon | null;
924-
}
925-
926905
/**
927906
* Set this block's warning text.
928907
*
@@ -1010,7 +989,6 @@ export class BlockSvg
1010989
override addIcon<T extends IIcon>(icon: T): T {
1011990
super.addIcon(icon);
1012991

1013-
if (icon instanceof WarningIcon) this.warning = icon;
1014992
if (icon instanceof MutatorIcon) this.mutator = icon;
1015993

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

1044-
if (type.equals(WarningIcon.TYPE)) this.warning = null;
10451022
if (type.equals(MutatorIcon.TYPE)) this.mutator = null;
10461023

10471024
if (this.rendered) {

core/blockly.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {BlockSvg} from './block_svg.js';
2222
import {BlocklyOptions} from './blockly_options.js';
2323
import {Blocks} from './blocks.js';
2424
import * as browserEvents from './browser_events.js';
25-
import {Bubble} from './bubbles/bubble.js';
2625
import * as bubbles from './bubbles.js';
2726
import {BubbleDragger} from './bubble_dragger.js';
2827
import * as bumpObjects from './bump_objects.js';
@@ -123,9 +122,7 @@ import {Gesture} from './gesture.js';
123122
import {Grid} from './grid.js';
124123
import * as icons from './icons.js';
125124
import {inject} from './inject.js';
126-
import {Align} from './inputs/align.js';
127125
import {Input} from './inputs/input.js';
128-
import {inputTypes} from './inputs/input_types.js';
129126
import * as inputs from './inputs.js';
130127
import {InsertionMarkerManager} from './insertion_marker_manager.js';
131128
import {IASTNodeLocation} from './interfaces/i_ast_node_location.js';
@@ -186,7 +183,6 @@ import * as renderManagement from './render_management.js';
186183
import * as blockRendering from './renderers/common/block_rendering.js';
187184
import * as constants from './constants.js';
188185
import * as geras from './renderers/geras/geras.js';
189-
import * as minimalist from './renderers/minimalist/minimalist.js';
190186
import * as thrasos from './renderers/thrasos/thrasos.js';
191187
import * as zelos from './renderers/zelos/zelos.js';
192188
import {Scrollbar} from './scrollbar.js';
@@ -241,27 +237,6 @@ export const VERSION = 'uncompiled';
241237
* namespace to put new functions on.
242238
*/
243239

244-
/*
245-
* Aliases for input alignments used in block defintions.
246-
*/
247-
248-
/**
249-
* @see Blockly.Input.Align.LEFT
250-
* @deprecated Use `Blockly.inputs.Align.LEFT`. To be removed in v11.
251-
*/
252-
export const ALIGN_LEFT = Align.LEFT;
253-
254-
/**
255-
* @see Blockly.Input.Align.CENTRE
256-
* @deprecated Use `Blockly.inputs.Align.CENTER`. To be removed in v11.
257-
*/
258-
export const ALIGN_CENTRE = Align.CENTRE;
259-
260-
/**
261-
* @see Blockly.Input.Align.RIGHT
262-
* @deprecated Use `Blockly.inputs.Align.RIGHT`. To be removed in v11.
263-
*/
264-
export const ALIGN_RIGHT = Align.RIGHT;
265240
/*
266241
* Aliases for constants used for connection and input types.
267242
*/
@@ -286,12 +261,6 @@ export const NEXT_STATEMENT = ConnectionType.NEXT_STATEMENT;
286261
*/
287262
export const PREVIOUS_STATEMENT = ConnectionType.PREVIOUS_STATEMENT;
288263

289-
/**
290-
* @see inputTypes.DUMMY_INPUT
291-
* @deprecated Use `Blockly.inputs.inputTypes.DUMMY`. To be removed in v11.
292-
*/
293-
export const DUMMY_INPUT = inputTypes.DUMMY;
294-
295264
/** Aliases for toolbox positions. */
296265

297266
/**
@@ -488,7 +457,6 @@ export {constants};
488457
export {dialog};
489458
export {fieldRegistry};
490459
export {geras};
491-
export {minimalist};
492460
export {registry};
493461
export {thrasos};
494462
export {uiPosition};
@@ -502,8 +470,6 @@ export {BlockDragger};
502470
export {BlockSvg};
503471
export {Blocks};
504472
export {bubbles};
505-
/** @deprecated Use Blockly.bubbles.Bubble instead. To be removed in v11. */
506-
export {Bubble};
507473
export {BubbleDragger};
508474
export {CollapsibleToolboxCategory};
509475
export {ComponentManager};
@@ -648,9 +614,5 @@ export {WorkspaceDragger};
648614
export {WorkspaceSvg};
649615
export {ZoomControls};
650616
export {config};
651-
/** @deprecated Use Blockly.ConnectionType instead. */
652-
export const connectionTypes = ConnectionType;
653617
export {inject};
654-
/** @deprecated Use Blockly.inputs.inputTypes instead. To be removed in v11. */
655-
export {inputTypes};
656618
export {serialization};

core/clipboard.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,12 @@ import * as globalRegistry from './registry.js';
1212
import {WorkspaceSvg} from './workspace_svg.js';
1313
import * as registry from './clipboard/registry.js';
1414
import {Coordinate} from './utils/coordinate.js';
15-
import * as deprecation from './utils/deprecation.js';
1615

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

2019
let stashedWorkspace: WorkspaceSvg | null = null;
2120

22-
/**
23-
* Copy a copyable element onto the local clipboard.
24-
*
25-
* @param toCopy The copyable element to be copied.
26-
* @deprecated v11. Use `myCopyable.toCopyData()` instead. To be removed v12.
27-
* @internal
28-
*/
29-
export function copy<T extends ICopyData>(toCopy: ICopyable<T>): T | null {
30-
deprecation.warn(
31-
'Blockly.clipboard.copy',
32-
'v11',
33-
'v12',
34-
'myCopyable.toCopyData()',
35-
);
36-
return TEST_ONLY.copyInternal(toCopy);
37-
}
38-
3921
/**
4022
* Private version of copy for stubbing in tests.
4123
*/
@@ -107,29 +89,6 @@ function pasteFromData<T extends ICopyData>(
10789
?.paste(copyData, workspace, coordinate) ?? null) as ICopyable<T> | null;
10890
}
10991

110-
/**
111-
* Duplicate this copy-paste-able element.
112-
*
113-
* @param toDuplicate The element to be duplicated.
114-
* @returns The element that was duplicated, or null if the duplication failed.
115-
* @deprecated v11. Use
116-
* `Blockly.clipboard.paste(myCopyable.toCopyData(), myWorkspace)` instead.
117-
* To be removed v12.
118-
* @internal
119-
*/
120-
export function duplicate<
121-
U extends ICopyData,
122-
T extends ICopyable<U> & IHasWorkspace,
123-
>(toDuplicate: T): T | null {
124-
deprecation.warn(
125-
'Blockly.clipboard.duplicate',
126-
'v11',
127-
'v12',
128-
'Blockly.clipboard.paste(myCopyable.toCopyData(), myWorkspace)',
129-
);
130-
return TEST_ONLY.duplicateInternal(toDuplicate);
131-
}
132-
13392
/**
13493
* Private version of duplicate for stubbing in tests.
13594
*/

core/generator.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import type {Block} from './block.js';
1616
import * as common from './common.js';
1717
import {Names, NameType} from './names.js';
1818
import type {Workspace} from './workspace.js';
19-
import {warn} from './utils/deprecation.js';
2019

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

256255
// Look up block generator function in dictionary - but fall back
257256
// to looking up on this if not found, for backwards compatibility.
258-
let func = this.forBlock[block.type];
259-
if (!func && (this as any)[block.type]) {
260-
warn(
261-
'block generator functions on CodeGenerator objects',
262-
'10.0',
263-
'11.0',
264-
'the .forBlock[blockType] dictionary',
265-
);
266-
func = (this as any)[block.type];
267-
}
257+
const func = this.forBlock[block.type];
268258
if (typeof func !== 'function') {
269259
throw Error(
270260
`${this.name_} generator does not know how to generate code ` +

core/icons/icon.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import * as dom from '../utils/dom.js';
1414
import {Size} from '../utils/size.js';
1515
import {Svg} from '../utils/svg.js';
1616
import type {IconType} from './icon_types.js';
17-
import * as deprecation from '../utils/deprecation.js';
1817
import * as tooltip from '../tooltip.js';
1918

2019
/**
@@ -145,14 +144,4 @@ export abstract class Icon implements IIcon {
145144
isClickableInFlyout(autoClosingFlyout: boolean): boolean {
146145
return true;
147146
}
148-
149-
/**
150-
* Sets the visibility of the icon's bubble if one exists.
151-
*
152-
* @deprecated Use `setBubbleVisible` instead. To be removed in v11.
153-
*/
154-
setVisible(visibility: boolean): void {
155-
deprecation.warn('setVisible', 'v10', 'v11', 'setBubbleVisible');
156-
if (hasBubble(this)) this.setBubbleVisible(visibility);
157-
}
158147
}

0 commit comments

Comments
 (0)