* chore: fix or ignore remaining lint
* chore: fix bad annotations
* chore: use push for array concatenation
* chore: revert use of spread for array operations
* chore: move functions from utils to more specific files
* chore: use new names for utils functions
* chore: run clang-format
* chore: add deprecation warnings back to utils.js
Our files are up to a decade old, and have churned so much, that the initial author of the file no longer has much meaning.
Furthermore, this will encourage developers to post to the developer group, rather than emailing Googlers (usually me) directly.
* fix: Revert removal of documentation for get/set accessors.
This partially reverts commit 839cb7b,
"fix: infinite loop when using defineProperties (#5549)"
* docs: Use @name to attach JSDocs to accessors
Reintroduce documentation for deprecated properties where it was
removed when converting them to accessors.
* docs: Remove duplicate @package declarations
* fix: Fix eslint and compiler errors/warnings
* fix: Minor JSDoc tweaks to address comments on PR #5567
* Add annotations to files under core/events
* Add annotations to files under core/interfaces
* Add annotations to files under core/keyboard_nav
* Add annotations to files under core/renderers
* Add annotations to files under core/serialization
* Add annotations to files under core/theme
* Add annotations to files under core/toolbox
* Add annotations to files under core/utils
* Add annotations to files under core
* chore: named export for block.js
* chore: named export for block_drag_surface.js
* chore: named export for block_dragger.js
* chore: named export for block_svg.js
* Fix import ordering
* chore: fix imports using requireType
* Remove extra require
* 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.)
* Migrate core/widgetdiv.js to ES6 const/let
* Migrate core/widgetdiv.js to goog.module
* Migrate core/widgetdiv.js to named requires
* clang-format core/widgetdiv.js
* Mark WidgetDiv.DIV as deprecated and refactor callers to use setters/getters
* Fix deprecation date
* Refactor tests to make setDiv() in core/widgetdiv.js test-only
* Fix type annotations for WidgetDiv.DIV and move test cleanup into sharedTestTeardown
* Move Menu + MenuItem out of /core/components to /core
Blockly.Menu and Blockly.MenuItem no longer depend on Blockly.Component and thus should not be in /core/component.
Also delete Blockly.utils.uiMenu in the process.
* Remove cargo-culted bloat from CSS
The `goog-menuitem-icon` and `goog-menuitem-noicon` classes are not present in Blockly. Blockly doesn’t support the CSS compiler, so #noflip has no effect. Shorten uncompressible warning string.
Also remove the “Copied from Closure” notes. These were intended so that the CSS could be easily updated as the Closure Library evolved. We are no longer linked to the Closure Library.
* Fix bug (in prod) where menu highlighting is lost
Previously, open playground. Right-click on workspace. Mouse-over “Add comment” (it highlights). Mouse over “Download screenshot” (disabled option). Mouse over “Add comment” (highlighting is lost).
Also remove `canHighlightItem` helper function. In theory this helps abstract the concept of non-highlightable options. But in practice it was only called in one of the several places that it should have been. This was a false abstraction.
* Add support for Space/PgUp/PgDn/Home/End to menus
* Eliminate calls to clearHighlighted
The JSDoc for `setHighlightedIndex` specifically states, “If another item was previously highlighted, it is un-highlighted.” This is not what was implemented, but it should be. This commit adds the un-highlighting, and removes all the calls previously required to correct this bug.
* Stop wrapping at top or bottom of menu.
Real OS menus don’t wrap when one cursors off the top or bottom.
Also, replace the overly complicated helper function with a simple 1/-1 step value.
* Remove unused menu code
* Simplify menu roles
Remove unneeded sets to RTL on Menu (only MenuItem cares).
* Fix lack of disposal for context menus.
Context menus only disposed properly when an option was clicked. If they were dismissed by clicking outside the menu there was no disposal. This might result in a memory leak.
Also un-extract (inject?) several now trivial functions.
* Remove Component dependency from Menu & MenuItem
Component is now only used by the category tree.
* Remove unused functions in Component
These were used by Menu/MenuItem.
* Fix dependencies.
* Record highlighted menu item by object, not index
Less code, simpler.
* Rename CSS classes goog-menu* to blocklyMenu*
Old classes remain in DOM and are deprecated so that any custom CSS will continue to function.
* Remove unused focus tracker in tree.
* Add support for space/enter to toggle tree cats
* Delete unsettable .isUserCollapsible_ from tree
* Change visibility tags throughout menus.
The previous tags were inherited from Closure and don’t reflect current usage in the Blockly codebase.
The core/components/tree files are non-compliant in this regard, but I’m not going to update them since they need to be replaced and there’s no need to create an interim API change.
* Remove property on DOM element linking to JS obj
Performance is slower (O(n) rather than (O(1)), but ’n’ is the number of entries on the menu, so shouldn’t be more than a dozen or so.
* Fixes a compile error (node != element)
Usually we avoid parentElement in Blockly. That’s because it has very spotty behaviour with SVG. But in this case we are in pure HTML.
* Google changed from an Inc to an LLC.
This happened back in 2017 but we didn’t notice. Officially we should update files from Inc to LLC when they are changed as part of regular edits, but this is a nightmare to remember for the next decade.
* Remove project description/titles from licenses
This is no longer part of Google’s header requirements. Our existing descriptions were useless (“Visual Blocks Editor”) or grossly obselete (“Visual Blocks Language”).
* License no longer requires URL.
* Fix license regexps.
Random improvements to require statements.
Removal of some obviously dead CSS.
.blocklyDropDownDiv no longer supresses text selection (see comment in PR).
This PR drops the compiled size by 4 KB, which is larger than I was expecting.