diff --git a/core/blockly.js b/core/blockly.js index 391e123ed49..0b4d356223a 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -348,135 +348,6 @@ exports.setParentContainer = common.setParentContainer; * Anything in this section may be removed in a future version of Blockly. */ -// Add accessors for properties on Blockly that have now been deprecated. -Object.defineProperties(exports, { - /** - * Wrapper to window.alert() that app developers may override to - * provide alternatives to the modal browser window. - * @name Blockly.alert - * @type {!function(string, function()=)} - * @deprecated Use Blockly.dialog.alert / .setAlert() instead. - * (December 2021) - * @suppress {checkTypes} - */ - alert: { - set: function(newAlert) { - deprecation.warn('Blockly.alert', 'December 2021', 'December 2022'); - dialog.setAlert(newAlert); - }, - get: function() { - deprecation.warn( - 'Blockly.alert', 'December 2021', 'December 2022', - 'Blockly.dialog.alert()'); - return dialog.alert; - }, - }, - /** - * Wrapper to window.confirm() that app developers may override to - * provide alternatives to the modal browser window. - * @name Blockly.confirm - * @type {!function(string, function()=)} - * @deprecated Use Blockly.dialog.confirm / .setConfirm() instead. - * (December 2021) - * @suppress {checkTypes} - */ - confirm: { - set: function(newConfirm) { - deprecation.warn('Blockly.confirm', 'December 2021', 'December 2022'); - dialog.setConfirm(newConfirm); - }, - get: function() { - deprecation.warn( - 'Blockly.confirm', 'December 2021', 'December 2022', - 'Blockly.dialog.confirm()'); - return dialog.confirm; - }, - }, - /** - * The main workspace most recently used. - * Set by Blockly.WorkspaceSvg.prototype.markFocused - * @name Blockly.mainWorkspace - * @type {Workspace} - * @suppress {checkTypes} - */ - mainWorkspace: { - set: function(x) { - common.setMainWorkspace(x); - }, - get: function() { - return common.getMainWorkspace(); - }, - }, - /** - * Wrapper to window.prompt() that app developers may override to - * provide alternatives to the modal browser window. Built-in - * browser prompts are often used for better text input experience - * on mobile device. We strongly recommend testing mobile when - * overriding this. - * @name Blockly.prompt - * @type {!function(string, string, function()=)} - * @deprecated Use Blockly.dialog.prompt / .setPrompt() instead. - * (December 2021) - * @suppress {checkTypes} - */ - prompt: { - set: function(newPrompt) { - deprecation.warn('Blockly.prompt', 'December 2021', 'December 2022'); - dialog.setPrompt(newPrompt); - }, - get: function() { - deprecation.warn( - 'Blockly.prompt', 'December 2021', 'December 2022', - 'Blockly.dialog.prompt()'); - return dialog.prompt; - }, - }, - /** - * Currently selected block. - * @name Blockly.selected - * @type {?ICopyable} - * @suppress {checkTypes} - */ - selected: { - get: function() { - return common.getSelected(); - }, - set: function(newSelection) { - common.setSelected(newSelection); - }, - }, - /** - * The richness of block colours, regardless of the hue. - * Must be in the range of 0 (inclusive) to 1 (exclusive). - * @name Blockly.HSV_SATURATION - * @type {number} - * @suppress {checkTypes} - */ - HSV_SATURATION: { - get: function() { - return utils.colour.getHsvSaturation(); - }, - set: function(newValue) { - utils.colour.setHsvSaturation(newValue); - }, - }, - /** - * The intensity of block colours, regardless of the hue. - * Must be in the range of 0 (inclusive) to 1 (exclusive). - * @name Blockly.HSV_VALUE - * @type {number} - * @suppress {checkTypes} - */ - HSV_VALUE: { - get: function() { - return utils.colour.getHsvValue(); - }, - set: function(newValue) { - utils.colour.setHsvValue(newValue); - }, - }, -}); - /** * Returns the dimensions of the specified SVG image. * @param {!SVGElement} svg SVG image. diff --git a/core/contextmenu.js b/core/contextmenu.js index 715e8a2e2b3..76d9e279b96 100644 --- a/core/contextmenu.js +++ b/core/contextmenu.js @@ -20,7 +20,6 @@ const Xml = goog.require('Blockly.Xml'); const aria = goog.require('Blockly.utils.aria'); const browserEvents = goog.require('Blockly.browserEvents'); const clipboard = goog.require('Blockly.clipboard'); -const deprecation = goog.require('Blockly.utils.deprecation'); const dom = goog.require('Blockly.utils.dom'); const eventUtils = goog.require('Blockly.Events.utils'); const userAgent = goog.require('Blockly.utils.userAgent'); @@ -71,32 +70,6 @@ const setCurrentBlock = function(block) { }; exports.setCurrentBlock = setCurrentBlock; -// Add JS accessors for backwards compatibility. -Object.defineProperties(exports, { - /** - * Which block is the context menu attached to? - * @name Blockly.ContextMenu.currentBlock - * @type {Block} - * @deprecated Use Blockly.Tooltip.getCurrentBlock() / - * .setCurrentBlock() instead. (September 2021) - * @suppress {checkTypes} - */ - currentBlock: { - get: function() { - deprecation.warn( - 'Blockly.ContextMenu.currentBlock', 'September 2021', - 'September 2022', 'Blockly.Tooltip.getCurrentBlock()'); - return getCurrentBlock(); - }, - set: function(block) { - deprecation.warn( - 'Blockly.ContextMenu.currentBlock', 'September 2021', - 'September 2022', 'Blockly.Tooltip.setCurrentBlock(block)'); - setCurrentBlock(block); - }, - }, -}); - /** * Menu object. * @type {Menu} diff --git a/core/events/events.js b/core/events/events.js index cd393c30946..247c8bdda49 100644 --- a/core/events/events.js +++ b/core/events/events.js @@ -15,7 +15,6 @@ */ goog.module('Blockly.Events'); -const deprecation = goog.require('Blockly.utils.deprecation'); const eventUtils = goog.require('Blockly.Events.utils'); const {Abstract: AbstractEvent} = goog.require('Blockly.Events.Abstract'); const {BlockBase} = goog.require('Blockly.Events.BlockBase'); @@ -120,28 +119,3 @@ exports.isEnabled = eventUtils.isEnabled; exports.setGroup = eventUtils.setGroup; exports.setRecordUndo = eventUtils.setRecordUndo; exports.disableOrphans = eventUtils.disableOrphans; - -Object.defineProperties(exports, { - /** - * Sets whether the next event should be added to the undo stack. - * @name Blockly.Evenents.recordUndo - * @type {boolean} - * @deprecated Use Blockly.Events.getRecordUndo() and - * .setRecordUndo(). (September 2021) - * @suppress {checkTypes} - */ - recordUndo: { - get: function() { - deprecation.warn( - 'Blockly.Events.recordUndo', 'September 2021', 'September 2022', - 'Blockly.Events.getRecordUndo()'); - return eventUtils.getRecordUndo(); - }, - set: function(record) { - deprecation.warn( - 'Blockly.Events.recordUndo', 'September 2021', 'September 2022', - 'Blockly.Events.setRecordUndo()'); - eventUtils.setRecordUndo(record); - }, - }, -}); diff --git a/core/generator.js b/core/generator.js index 42cbaf48396..666d06b77f3 100644 --- a/core/generator.js +++ b/core/generator.js @@ -547,7 +547,7 @@ Object.defineProperties(Generator.prototype, { * @return {!Names|undefined} Name database. */ get: function() { - deprecation.warn('variableDB_', 'May 2021', 'May 2026', 'nameDB_'); + deprecation.warn('variableDB_', 'May 2021', 'September 2022', 'nameDB_'); return this.nameDB_; }, /** @@ -555,7 +555,7 @@ Object.defineProperties(Generator.prototype, { * @param {!Names|undefined} nameDb New name database. */ set: function(nameDb) { - deprecation.warn('variableDB_', 'May 2021', 'May 2026', 'nameDB_'); + deprecation.warn('variableDB_', 'May 2021', 'September 2022', 'nameDB_'); this.nameDB_ = nameDb; }, }, diff --git a/core/tooltip.js b/core/tooltip.js index e3436ed0f92..e208ea61313 100644 --- a/core/tooltip.js +++ b/core/tooltip.js @@ -20,7 +20,6 @@ goog.module('Blockly.Tooltip'); const blocklyString = goog.require('Blockly.utils.string'); const browserEvents = goog.require('Blockly.browserEvents'); const common = goog.require('Blockly.common'); -const deprecation = goog.require('Blockly.utils.deprecation'); /** @@ -90,25 +89,6 @@ const isVisible = function() { }; exports.isVisible = isVisible; -Object.defineProperties(exports, { - /** - * Is a tooltip currently showing? - * @name Blockly.Tooltip.visible - * @type {boolean} - * @deprecated Use Blockly.Tooltip.isVisible() instead. (September - * 2021) - * @suppress {checkTypes} - */ - visible: { - get: function() { - deprecation.warn( - 'Blockly.Tooltip.visible', 'September 2021', 'September 2022', - 'Blockly.Tooltip.isVisible()'); - return isVisible(); - }, - }, -}); - /** * Is someone else blocking the tooltip from being shown? * @type {boolean} @@ -206,25 +186,6 @@ const getDiv = function() { }; exports.getDiv = getDiv; -Object.defineProperties(exports, { - /** - * The HTML container. Set once by createDom. - * @name Blockly.Tooltip.DIV - * @type {HTMLDivElement} - * @deprecated Use Blockly.Tooltip.getDiv() and .setDiv(). - * (September 2021) - * @suppress {checkTypes} - */ - DIV: { - get: function() { - deprecation.warn( - 'Blockly.Tooltip.DIV', 'September 2021', 'September 2022', - 'Blockly.Tooltip.getDiv()'); - return getDiv(); - }, - }, -}); - /** * Returns the tooltip text for the given element. * @param {?Object} object The object to get the tooltip text of. diff --git a/core/widgetdiv.js b/core/widgetdiv.js index b7fe045b5be..3471b4aea1f 100644 --- a/core/widgetdiv.js +++ b/core/widgetdiv.js @@ -20,7 +20,6 @@ goog.module('Blockly.WidgetDiv'); const common = goog.require('Blockly.common'); -const deprecation = goog.require('Blockly.utils.deprecation'); const dom = goog.require('Blockly.utils.dom'); /* eslint-disable-next-line no-unused-vars */ const {Rect} = goog.requireType('Blockly.utils.Rect'); @@ -81,25 +80,6 @@ const testOnly_setDiv = function(newDiv) { }; exports.testOnly_setDiv = testOnly_setDiv; -Object.defineProperties(exports, { - /** - * The HTML container for popup overlays (e.g. editor widgets). - * @name Blockly.WidgetDiv.DIV - * @type {?Element} - * @deprecated Use Blockly.WidgetDiv.getDiv() and .setDiv(). - * (September 2021) - * @suppress {checkTypes} - */ - DIV: { - get: function() { - deprecation.warn( - 'Blockly.WidgetDiv.DIV', 'September 2021', 'September 2022', - 'Blockly.WidgetDiv.getDiv()'); - return getDiv(); - }, - }, -}); - /** * Create the widget div and inject it onto the page. * @alias Blockly.WidgetDiv.createDom diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index 507d195a308..2a79cda388b 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1332,5 +1332,21 @@ }, ], - 'develop': [ ], + 'develop': [ + { + oldName: 'Blockly', + exports: { + HSV_SATURATION: { + newModule: 'Blockly.utils.colour', + getMethod: 'getHsvSaturation', + setMethod: 'setHsvSaturation', + }, + HSV_Value: { + newModule: 'Blockly.utils.colour', + getMethod: 'getHsvValue', + setMethod: 'setHsvValue', + }, + } + }, + ], }