Commit Graph

93 Commits

Author SHA1 Message Date
Rachel Fenichel
5deed5a194 chore: fix or ignore remaining lint (#5709)
* chore: fix or ignore remaining lint

* chore: fix bad annotations

* chore: use push for array concatenation

* chore: revert use of spread for array operations
2021-11-17 08:39:00 -08:00
Rachel Fenichel
969fcac455 chore: Move functions from utils (#5706)
* 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
2021-11-15 15:59:27 -08:00
Rachel Fenichel
e8d6f7f408 chore: auto-fix violations of comma-dangle rule (#5625) 2021-10-21 09:01:51 -07:00
Aaron Dodson
3851b14627 refactor: Migrate to named exports (#5623)
* refactor: Migrate to named exports

* fix: Sort requires

* fix: Remove duplicate deps
2021-10-20 15:53:23 -07:00
Neil Fraser
90b3f75d82 Remove @author tags (#5601)
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.
2021-10-15 09:50:46 -07:00
Rachel Fenichel
b25e24fd02 chore: Run clang-format on core/*.js (#5589)
* Run clang-format on core/*.js

* Revert changes for css formatting
2021-10-07 10:32:02 -07:00
Christopher Allen
c5ffd036ca fix: JSDoc improvments for accessors, etc. (#5567)
* 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
2021-09-29 01:57:28 +01:00
Monica Kozbial
f67214dac5 Update @package annotations (#5558) 2021-09-28 08:55:49 -07:00
Monica Kozbial
d8fbe1b05b Add namespace and alias annotations to jsdoc (#5550)
* 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
2021-09-27 14:42:54 -07:00
alschmiedt
2b34748e0e chore: remove declareLegacyNamespace from events (#5532)
- Adds an extra events/utils.js file to hold helper methods related to events.
2021-09-24 14:20:32 -07:00
Aaron Dodson
e0693a65d2 chore: Remove declareLegacyNamespace() from files in core (#5525)
* chore: Remove declareLegacyNamespace() from files in core

* fix: Update missing/errant re-exports in blockly.js
2021-09-23 14:48:52 -07:00
Rachel Fenichel
3adfaaf6d9 chore: named exports for block* files (#5512)
* 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
2021-09-22 08:46:19 -07:00
Christopher Allen
e7955084ae refactor: Remove remaining references to Blockly.* from goog.modules (#5505) 2021-09-21 17:51:35 +01:00
Beka Westberg
f77526e558 Move browser event utils from utils.js to browser_events.js (#5464)
* fix: move browser event utils to browserEvents

* fix: mark browser event utils in utils as deprecated

* fix: move uses of browser event funcs to browserEvents

* fix: remove browserEvents definition of noEvent

* fix: add renames for browser event utils

* docs: add suggested alternatives for browser event utils

* fix: change deprecations to stubs

* fix: PR comments
2021-09-17 14:49:01 -07:00
Christopher Allen
dbf10cf167 Clean up get/set accessor definitions (#5488)
* 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.)
2021-09-17 19:30:21 +01:00
Aaron Dodson
9046ce165b Migrate core/widgetdiv.js to goog.module syntax (#5331)
* 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
2021-08-16 10:23:50 -07:00
kozbial
b834d9026b Add requireType calls for Blockly.WorkspaceComment and Blockly.WorkspaceCommentSvg 2021-08-06 18:05:53 -07:00
kozbial
eea23e24f6 clang-format core/contextmenu.js 2021-08-04 09:57:18 -07:00
kozbial
fe29e1cb9d Migrate core/contextmenu.js named requires 2021-08-04 09:57:18 -07:00
kozbial
19722e508f Migrate core/contextmenu.js to goog.module 2021-08-04 09:57:18 -07:00
kozbial
fae0c2ac6d Migrate core/contextmenu.js to ES6 const/let 2021-08-04 09:57:18 -07:00
Rachel Fenichel
ad5836b26d Convert more names to use internalConstants 2021-07-21 15:33:55 -07:00
Neil Fraser
d919b0af21 Update JSDoc from Array.<> to Array<>
Same with Object.
2021-05-27 21:30:26 -07:00
Sam El-Husseini
63d26dc186 Add extra requires check (#4677)
* Add extra requires check
2021-03-05 09:50:51 -08:00
Sam El-Husseini
ab8a11784d Fix event related missing requires (#4656)
* Fix event related missing requires
2021-02-25 14:28:11 -08:00
Rachel Fenichel
1d8c234d33 Update uses of bindEvent_, bindEventWithChecks_, and unbindEvent_. Add missing requires for Blockly.browserEvents. 2021-02-23 11:23:28 -08:00
Rachel Fenichel
84446215c0 Update more missing requireTypes 2021-02-10 14:59:05 -08:00
Sam El-Husseini
fba35d342c Add missing require Blockly.constants (#4366) 2020-10-12 17:56:42 -04:00
Maribeth Bottorff
e4bbd451a3 Use Context Menu registry for block-level menu options (#4032)
Use registry for block-level context menu items.
2020-07-10 19:11:48 -07:00
Maribeth Bottorff
5e55d89d3b Context menu registry, initial version. (#3930)
* initial version of registry for context menu options
* Registers workspace-level context menu options
2020-07-07 10:41:53 -07:00
Sam El-Husseini
acfc335870 Type fixes for Dropdown / Widget divs (#3911)
* Stricter typechecks in dropdown and widget div
2020-05-28 08:42:26 -07:00
Neil Fraser
b9ce29843e Move Menu + MenuItem out of components to utils (#3893)
* 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.
2020-05-07 13:13:45 -04:00
Neil Fraser
a65afdc189 Simplify Closure-sourced code for menus (#3880)
* 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.
2020-05-06 23:55:17 -04:00
Neil Fraser
4e2f8e6e02 Use SPDX licences.
This is a followup to #3127.
At the time, SPDX licenses were pending approval by Google.
2020-02-11 13:27:20 -08:00
Beka Westberg
dad8738e75 Cleaned up unbindEvent_ calls (#3429)
* Cleaned up unbindEvent_ calls.
2019-11-12 10:14:31 -08:00
Neil Fraser
123f436e04 Add parens around inline assignments (#3381) 2019-10-31 15:17:35 -07:00
Sam El-Husseini
7d174727b0 Fix warnings for code used by blocks (#3362) 2019-10-30 08:11:18 -07:00
Sam El-Husseini
759875a6c0 Resolve remaining compiler type warnings (#3334)
* Resolve remaining compiler warnings with inconsistent types.
2019-10-25 19:07:17 -04:00
Sam El-Husseini
d387841db2 Resolve remaining compiler warnings with visibility issues (#3335) 2019-10-24 19:13:51 -04:00
Sam El-Husseini
36d7e4ff8c Suppress workspace comment module not included while Workspace comments are not bundled in. (#3303) 2019-10-22 08:49:17 -04:00
Neil Fraser
b46a4fe286 Bring our license format up to date (#3127)
* 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.
2019-10-02 14:46:56 -07:00
Sam El-Husseini
fc2c730e44 Make workspace comments an optional module, remove from this release. (#3115) 2019-09-27 11:15:11 -07:00
Neil Fraser
a03660243e Code cleanup, drop some CSS.
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.
2019-09-25 10:34:34 -07:00
Sam El-Husseini
8cfb67187f Contextmenu with Blockly.Menu (#2834)
* Switch contextmenu  from using goog.ui.Menu to Blockly.Menu
2019-08-16 17:25:56 -07:00
Neil Fraser
a9fdf7844a Fix ordering of requires
Search and replace of a name strikes again.
2019-06-07 10:32:57 -07:00
Neil Fraser
3dfac9a2ba Alphabetize require statements.
Search and replace for userAgent didn’t take into account alphabetic ordering.
Also some line wraping.
2019-06-07 10:32:57 -07:00
Neil Fraser
566f182fa8 Move Blockly.userAgent to Blockly.utils.userAgent 2019-06-07 10:32:57 -07:00
Neil Fraser
d1a29739d8 Move utilities into own directory.
TODO: There are more functions which may be migrated into dom and string.
2019-06-07 10:32:57 -07:00
Neil Fraser
5bf7069a2f Remove goog.math.Coordinate 2019-06-07 10:32:57 -07:00
Neil Fraser
9f528922a7 Fix some dependencies 2019-05-24 15:45:05 -07:00