* Add getSelected/setSelected to core/common.js
* Migrate core to use Blockly.common.getSelected/setSelected instead of Blockly.selected
* Migrate demos to use Blockly.common.getSelected/setSelected instead of Blockly.selected
* Remove Blockly.selected
* Use variable instead of calling common.getSelected() multiple times
* Add accessor for selected on Blockly
* Add renaming record for Blockly.selected -> Blockly.common.getSelected/setSelected
* Use Object.defineProperties instead of .defineProperty when
installing get and set accessors for previously-mutable exports.
* Add entries to renamings.js where feasible (i.e., for static rather
than instance properties).
(Don't do blockly.js yet, to avoid merge conflicts.)
* Use goog.module in mocha tests
* Fix compiler warnings
* Make test helpers a module
* Name test modules Blockly.test.*
This is to be more consistent with how non-test modules are named.
Also remove top-level goog.require of TestHelpers (now
Blockly.test.helpers) since requiring a side-effect-less module does
nothing.
* Convert block_test.js and comment_test.js to goog.module syntax
* Address PR comments
* Goog modulify tests
* Goog modulify toolbox helpers
* Fixes imports and moves common tests from workspace_test.js to a helper file.
* Update test deps after rebase
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
* Reexport Blockly.utils.* modules from Blockly.utils
* Update metadata (file sizes) again
blockly_compressed.js has gotten too big for the second time this
quarter. Update the expected file sizes for it so that tests
will continue to pass.
* Add hideChaff() to core/workspace_svg.js
* Mark Blockly.hideChaff as deprecated
* Update uses of Blockly.hideChaff() to WorkspaceSvg.hideChaff() in core
* Update uses of Blockly.hideChaff() to WorkspaceSvg.hideChaff() in demos
* Style and formatting fixes
* Switch from accessor to stub wrapper for Blockly.hideChaff
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* Move bump objects function into a separate module
* Fix types
* Migrate core/inject.js to ES6 const/let
* Migrate core/inject.js to goog.module and move more functions to bump_objects.js
* Migrate core/inject.js named requires
* clang-format core/inject.js
* Rename private functions
* Move hueToHex to core/utils/colour.js
* Mark Blockly.hueToHex as deprecated and pass calls through to Blockly.utils.colour.hueToHex
* Migrate core to use Blockly.utils.colour.hueToHex
* Migrate demos to use Blockly.utils.colour.hueToHex
* Move bump objects function into a separate module
* Fix types
* Update core/bump_objects.js
Fix missing newline.
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* Migrate prompt/alert/confirm to dedicated module
* Update core/blockly.js to pass through calls to prompt/alert/confirm to core/dialog.js
* Update calls to Blockly.prompt/alert/confirm to dialog.prompt/alert/confirm
* Fix typo and errant redeclaration of Blockly.prompt
* Clarify JSDoc on customizing Blockly.dialog.alert/confirm/prompt
* Migrate core/utils/xml.js to ES6 const/let
* Migrate core/utils/xml.js to goog.module
The document() function is renamed to getDocument() so as to avoid
shadowing the global of the same name.
* clang-format core/utils/xml.js
* Call monkey-patchable exports.global internally too
This fixes Node test failures due to the monkey-patching of
Blockly.utils.xml.global in scripts/package/node/core.js not being
able to affect the target calls in createElement and createTextNode.
This is part of #5153 but is being prioritised because we want remove
the declareLegacyNamespace calls from the core/utils/*.js modules and
then reexport them explicitly via utils.js, and it turns out that
doing so results in the exports object of this module being passed to
Object.freeze - which fails on the global object, which can't be made
non-extensible!
The new name chosen for the former default export is globalThis, since
it is intended to have the same value as the global variable of that
name; see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
Running npm run build:deps in goog_module makes a change to tests/deps.js that was previously committed by PR #5441 but which appears to have been inadvertently undone by #5222.
* Migrate core/tooltip.js to ES6 const/let
* Migrate core/tooltip.js to goog.module
* Migrate core/tooltip.js to named requires
* clang-format core/tooltip.js
* Fix exports of mutable fields in core/tooltip.js
* Don't assign a value when exporting visible in core/tooltip.js
Some files were using Blockly.utils.object.inherits (or .mixin) without
having imported Blockly.utils.object.
Similarly, trashcan.js tried to use utils.Size as a constructor
instead of importing Size from Blockly.utils.Size.
Create a file scripts/migration/renamings.js to collect information about renamed API entries. Start by filling it with the renamings already done to blockly.js.
* Migrate core/events/events.js to ES6 const/let
* Migrate core/events/events.js to goog.module
* Migrate core/events/events.js to named requires
* clang-format core/events/events.js
* Migrate Blockly core to use getRecordUndo/setRecordUndo
* Update core/events.js to reflect latest guidance around exporting mutable fields