Commit Graph

45 Commits

Author SHA1 Message Date
Neil Fraser
c929b3015b chore: Convert == to === and != to !== where possible. (#5599) 2021-10-15 09:17:04 -07:00
Monica Kozbial
49bc2b1ae4 Replace namespace annotation with class annotation in files that define a class (#5566) 2021-09-28 15:57:09 -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
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
Aaron Dodson
4e3bfee2aa clang-format core/theme.js 2021-07-26 11:42:17 -07:00
Aaron Dodson
9cf50a61c1 Migrate core/theme.js to named requires 2021-07-26 11:39:57 -07:00
Aaron Dodson
367b94dfdd Migrate core/theme.js to goog.module 2021-07-26 11:36:48 -07:00
Aaron Dodson
a106f37cbb Migrate core/theme.js to ES6 const/let 2021-07-26 11:33:46 -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
alschmiedt
5c4677010c Fix theme and add example (#3988) 2020-06-29 11:00:22 -07:00
Sam El-Husseini
d6ad7c488b Add theme registry: 2020-06-04 17:56:56 -07: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
Monica Kozbial
b64028521f Fix jsdoc typing in theme. (#3798) 2020-04-03 17:09:08 -07:00
Sam El-Husseini
7e1f81cf11 Insertion marker properties in theme (#3752)
* Pipe inseriton marker colour and opacity from theme
2020-03-18 10:15:30 -07:00
Sam El-Husseini
1d3a1655c6 Support multiple renderer / theme combos on the same page. (#3732)
* Support multiple renderer / theme combos on the same page.
2020-03-11 20:09:00 -07:00
Sam El-Husseini
29dc7bd7f7 Adjust marker and cursor colours from the theme (#3735)
* Support adjusting marker and cursor colours from the theme
2020-03-11 11:23:29 -07:00
Sam El-Husseini
a9e10807ca Support extending themes with a base theme property. (#3731)
* Support extending themes with a base theme property.
2020-03-10 10:30:13 -07:00
Sam El-Husseini
21763b7e00 Support enabling start hats from themes (#3722)
* Support themes configuring the start hats of blocks. Add test themes
2020-03-05 17:34:31 -08:00
Sam El-Husseini
eb40ca44ba Dynamic fonts (#3698)
* Piping themes into the renderer and ensuring fields update their size information when constants change.
2020-02-20 17:16:01 -08: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
alschmiedt
e1bb1d667e Add back setters for theme (#3674) 2020-02-07 09:20:21 -08:00
alschmiedt
88ad660c51 Remove check for same theme when refreshing (#3672)
* Remove check for same theme when refreshing
2020-01-30 16:05:24 -08:00
Sam El-Husseini
55997784ca Move blockStyles into constants (#3485)
* Move blockStyles into constants.
2019-12-06 10:51:36 -08:00
Sam El-Husseini
fdc50f2cd0 Add the theme name to the injection div (#3413)
* Set the theme name as a class on the injection div.
2019-11-07 15:19:58 -08:00
Sam El-Husseini
43224afbf7 Move parseBlockColour into Blockly.utils (#3399)
* Move parseBlockColour into utils and add missing require.
2019-11-04 22:39:18 -08:00
Sam El-Husseini
0aea33d8a6 Make theme validate style method work with advanced compilation (#3384) 2019-11-01 12:21:05 -07:00
Sam El-Husseini
0f659b25fa Support workspace theme option as JSON (#3379)
* Allow passing in a theme as JSON
2019-10-31 15:49:48 -07:00
Sam El-Husseini
93755fef53 Treat compiler warnings as errors and run on travis (#3378)
* Enable compiler warnings as errors and run on travis
2019-10-31 15:49:28 -07:00
Rachel Fenichel
207e0ebe7b Add tests and better validation for block styles 2019-10-30 17:24:03 -07:00
Rachel Fenichel
46fad66ab1 Review feedback. 2019-10-30 15:58:53 -07:00
Rachel Fenichel
5ef08fc0d4 Switch to using the style object in the path object. 2019-10-30 14:47:23 -07:00
Sam El-Husseini
986e965be8 Private/protected visibility cleanup (#3263)
* Fix a number of private visibility issues
2019-10-16 11:48:09 -05: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
870824bc3e Workspace theme (#3093)
* Move the theme object so it's on the workspace.

* Add support for subscribing UI elements to theme component styles and changes.
2019-09-26 16:52:17 -07:00
Sam El-Husseini
cb564053b3 Merge toolbox navigation (#3054)
* Merge both types of keyboard navigation (with and without accessibility mode).
2019-09-19 16:36:39 -07:00
Sam El-Husseini
c1b49a1da7 Fix some jsdoc types (#2701)
* Fix JSDoc regarding type inconsistencies. Make image field src required and update image field tests.
2019-07-25 12:24:36 -07:00
Neil Fraser
dce0b77424 Fix 19 warnings in theme-related code. (#2523)
* Fix 19 warnings in theme-related code.

Resolves #2414

* Remove suppressPrefixSuffix property definition

The mixin code throws an error if property exists on both objects.

* eslint has strange ideas about indentation.
2019-05-30 10:05:06 -07:00
Neil Fraser
9f528922a7 Fix some dependencies 2019-05-24 15:45:05 -07:00
Neil Fraser
f118d33855 Corrections to JSDoc comments 2019-03-29 15:24:37 -07:00
Neil Fraser
e9de083361 Fix @return JSDocs. 2019-03-29 15:24:37 -07:00
Andrew n marshall
570eecbff8 Correcting jsdoc tag spacing (PR #2303) 2019-02-20 11:33:16 -08:00
alschmiedt
caf664db04 Small fixes 2019-01-09 15:38:30 -08:00
alschmiedt
40a1ae752b Adds support for category styles 2019-01-09 11:18:44 -08:00
alschmiedt
f480b1ff79 Changes Blockly style to be Blockly theme. 2019-01-08 11:40:57 -08:00