fix!: Update deprecations for the new release. (#6470)

* chore: bump early deprecations to v10

* fixup

* fixup

* chore: remove deprecated properties

* chore: add missing @deprecated tags

* chore: format

* chore: format

* chore: fix import
This commit is contained in:
Beka Westberg
2022-10-03 11:21:52 -07:00
committed by GitHub
parent 12ffd2302c
commit d3447ea565
13 changed files with 34 additions and 216 deletions

View File

@@ -21,11 +21,11 @@ import * as deprecation from './deprecation.js';
* @param childCtor Child class.
* @param parentCtor Parent class.
* @suppress {strictMissingProperties} superClass_ is not defined on Function.
* @deprecated No longer provided by Blockly.
* @alias Blockly.utils.object.inherits
*/
export function inherits(childCtor: Function, parentCtor: Function) {
deprecation.warn(
'Blockly.utils.object.inherits', 'version 9.0.0', 'version 10.0.0');
deprecation.warn('Blockly.utils.object.inherits', 'version 9', 'version 10');
// Set a .superClass_ property so that methods can call parent methods
// without hard-coding the parent class name.
// Could be replaced by ES6's super().
@@ -49,6 +49,7 @@ export function inherits(childCtor: Function, parentCtor: Function) {
*
* @param target Target.
* @param source Source.
* @deprecated Use the built-in **Object.assign** instead.
* @alias Blockly.utils.object.mixin
*/
export function mixin(target: AnyDuringMigration, source: AnyDuringMigration) {
@@ -85,11 +86,12 @@ export function deepMerge(
*
* @param obj Object containing values.
* @returns Array of values.
* @deprecated Use the built-in **Object.values** instead.
* @alias Blockly.utils.object.values
*/
export function values(obj: AnyDuringMigration): AnyDuringMigration[] {
deprecation.warn(
'Blockly.utils.object.values', 'version 9.0.0', 'version 10.0.0',
'Blockly.utils.object.values', 'version 9', 'version 10',
'Object.values');
return Object.values(obj);
}

View File

@@ -25,7 +25,7 @@ import * as deprecation from './deprecation.js';
* @param prefix A string to look for at the start of `str`.
* @returns True if `str` begins with `prefix`.
* @alias Blockly.utils.string.startsWith
* @deprecated April 2022. Use built-in string.startsWith.
* @deprecated Use built-in **string.startsWith** instead.
*/
export function startsWith(str: string, prefix: string): boolean {
deprecation.warn(

View File

@@ -103,12 +103,12 @@ export function getComputedStyle(element: Element, property: string): string {
* @param element Element to get style of.
* @param style Property to get (camel-case).
* @returns Style value.
* @deprecated No longer provided by Blockly.
* @alias Blockly.utils.style.getCascadedStyle
*/
export function getCascadedStyle(element: Element, style: string): string {
deprecation.warn(
'Blockly.utils.style.getCascadedStyle', 'version 9.0.0',
'version 10.0.0');
'Blockly.utils.style.getCascadedStyle', 'version 9', 'version 10');
// AnyDuringMigration because: Property 'currentStyle' does not exist on type
// 'Element'. AnyDuringMigration because: Property 'currentStyle' does not
// exist on type 'Element'.

View File

@@ -17,7 +17,6 @@ import type {WorkspaceSvg} from '../workspace_svg.js';
import {Coordinate} from './coordinate.js';
import * as deprecation from './deprecation.js';
import {Rect} from './rect.js';
import {Size} from './size.js';
import * as style from './style.js';
@@ -114,12 +113,13 @@ export function getInjectionDivXY(element: Element): Coordinate {
* and attempting to set the property.
*
* @returns True if 3D transforms are supported.
* @deprecated No longer provided by Blockly.
* @alias Blockly.utils.svgMath.is3dSupported
*/
export function is3dSupported(): boolean {
// All browsers support translate3d in 2022.
deprecation.warn(
'Blockly.utils.svgMath.is3dSupported', 'version 9.0.0', 'version 10.0.0');
'Blockly.utils.svgMath.is3dSupported', 'version 9', 'version 10');
return true;
}
@@ -191,28 +191,6 @@ export function screenToWsCoordinates(
return finalOffsetMainWs;
}
/**
* Returns the dimensions of the specified SVG image.
*
* @param svg SVG image.
* @returns Contains width and height properties.
* @deprecated Use workspace.getCachedParentSvgSize. (2021 March 5)
* @alias Blockly.utils.svgMath.svgSize
*/
export function svgSize(svg: SVGElement): Size {
// When removing this function, remove svg.cachedWidth_ and svg.cachedHeight_
// from setCachedParentSvgSize.
// The deprecated name is `Blockly.svgSize` because this function used to be
// declared in Blockly.js.
deprecation.warn(
'Blockly.svgSize', 'March 2021', 'March 2022',
'workspace.getCachedParentSvgSize');
svg = svg as AnyDuringMigration;
return new Size(
Number(svg.getAttribute('data-cached-width')),
Number(svg.getAttribute('data-cached-height')));
}
export const TEST_ONLY = {
XY_REGEX,
XY_STYLE_REGEX,