Commit Graph

151 Commits

Author SHA1 Message Date
Neil Fraser
1f6a1bd8d9 chore: Use ES6 template strings in CSS and code generators (#5902)
* Unindent CSS, save 3 kb of code.
* Convert generator functions to template strings. 
This resolves #5761.
2022-01-28 17:58:43 -08:00
Rachel Fenichel
f14a1c8034 chore: fix more lint (#5676)
* chore: fix assorted lint

* chore: clang-format

* chore: clang-format
2021-11-08 16:41:52 -08:00
alschmiedt
0f3c06306f chore: runs clang format on all files (#5627) 2021-10-21 15:22:24 -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
Sandeep Dubey
ec9092fd67 Changes Css.register API to accept string param (#5472)
* Chnages Css.register API to accept string param

* Address self review comments and nits

* Fix code-comment

* Address minor review comments and nits

* Allow passing an array of strings when registering CSS

* Fix lint errors

Co-authored-by: Aaron Dodson <adodson@google.com>
2021-10-14 15:47:10 -07:00
Monica Kozbial
ca61d8cbc6 fix: Fix errors in injected CSS (#5587) 2021-10-07 09:58:18 -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
e1310b6464 fix: JSDoc generation for modules without classes 2021-09-22 14:37:55 -07:00
Aaron Dodson
0e6258ca1a Migrated to inline exports 2021-07-21 08:17:13 -07:00
kozbial
7aae731a52 clang-format core/css.js 2021-07-16 10:46:23 -07:00
kozbial
7c23985d30 Migrate core/css.js to goog.module 2021-07-16 10:46:23 -07:00
kozbial
902112be3d Use ES6 template strings in core/css.js 2021-07-16 10:46:23 -07:00
kozbial
80d953d5b9 Migrate core/css.js to ES6 const/let 2021-07-16 10:46:23 -07:00
Neil Fraser
cff7b359f4 Make comments more consistent. 2021-06-09 11:41:42 -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
d782e2f4af Fix conflict in background CSS for dropdown div (#4431)
* Fix conflict in background CSS for dropdown div

* Fix comment
2020-11-04 14:05:36 -08:00
Sam El-Husseini
363095a7e5 Fix graph demo (#4406)
* Fix graph demo by resetting a couple of CSS fields
2020-10-26 14:55:10 -07:00
alschmiedt
16980cd303 Fixes problem with dropdown scroll (#4287) 2020-09-17 11:57:24 -07:00
Rachel Fenichel
c9c8af12a7 Remove some old deprecated functions 2020-07-08 17:31:16 -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
alschmiedt
877063b5bd Fix marker css (#3745)
* Fix marker css

* Move to css.js file
2020-03-12 15:03:02 -07:00
Sam El-Husseini
f96d1c9768 Fix warning text color. Make it black. (#3730) 2020-03-09 17:58:15 -07: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
Monica Kozbial
26a11faf49 Update CSS rules for cursor. (#3627) 2020-01-22 11:41:59 -08:00
Sam El-Husseini
c1ff28fcd2 Rename arrowTop and arrowBottom css classes to blocklyArrowTop and blocklyArrowBottom (#3548) 2020-01-06 16:09:23 -08:00
alschmiedt
10b3a9aa9a Refactor marker and cursor (#3484)
* Refactor marker and cursor
2019-12-04 14:50:58 -08:00
Mustafa Jebara
d99d913600 Fix #3386 - Warning Bubble Dragging (#3479)
* Set no-pointer events on the warning text svg element.
2019-12-04 14:49:18 -08:00
Sam El-Husseini
b038c1cef5 [zelos] Set dropdown div colour to match block colour (#3462)
* Set dropdown div colour to match block colour
2019-11-27 09:30:29 -08:00
Sam El-Husseini
9fcc532977 [zelos] Cross browser pixel perfect text input (#3466)
* Align text and widget div text input pixel perfect on all browsers
2019-11-25 15:54:24 -08:00
Sam El-Husseini
9fc995425a Support adjusting dropdowndiv default colours through CSS (#3469)
* Support setting the dropdown theme default colours through CSS. Update dark theme.
2019-11-25 14:18:28 -08:00
Sam El-Husseini
426e17a06d Move more CSS into renderers. (#3455)
* Move more CSS into renderers.
2019-11-20 11:57:37 -08:00
Sam El-Husseini
329a21c572 Add theme and renderer classnames onto the widget and dropdown div. (#3456)
* Add theme and renderer classnames onto the widget and dropdown div.
2019-11-20 11:07:39 -08:00
Sam El-Husseini
70c24cf94e CSS in renderers (#3446)
* Have each renderer declare some CSS that is specific to the renderer.
2019-11-18 16:14:19 -08:00
Sam El-Husseini
139382e009 Field textinput pixel perfect input (#3443)
* Fix sizing of text input field in zelos, pixel perfect input in other browsers
2019-11-14 16:13:22 -08:00
Sam El-Husseini
f9dcb60f82 Zelos replacement highlight (#3431)
* Zelos replacement highlight
2019-11-13 17:14:28 -08:00
Neil Fraser
a9acd532f0 Pull comment CSS into comment modules. 2019-11-12 13:15:06 -08:00
Sam El-Husseini
d49b3400e6 Add zelos selection highlight. (#3390)
* zelos selection highlight
2019-11-06 13:47:30 -08:00
Sam El-Husseini
f79740c087 Use zero height / width for compute canvas (#3369)
* Make the blockly compute canvas have no height or width
2019-10-30 10:59:24 -07:00
Sam El-Husseini
267deceb82 Dropdowndiv positioning (#3212)
* Fix positioning of the dropdown div
2019-10-16 10:20:40 -05:00
Sam El-Husseini
fba98fca5b Move the dropdown field into the dropdown div. (#3122)
* Move the dropdown field into the dropdown div.
2019-10-03 14:35:28 -07: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
Neil Fraser
b701475984 Simplify trashcan code (#3110)
Also delete unused props in CSS.
2019-09-27 11:43:56 -07:00
Neil Fraser
4ed3295ad9 Make generator an optional module (#3105) 2019-09-27 10:47:10 -07:00
Neil Fraser
75cf614104 Break CSS into modules. (#3084)
* Break CSS into modules.

Drops the compile test by 3 KB.
Remove obsolete .blocklyDraggable class stub (it used to be dynamically changed).
Remove unused menuseparator CSS.
2019-09-25 18:01:19 -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
Neil Fraser
b84cda2c76 Strip out more bloat from toolbox (#3068)
Also removes three private accesses from workspaceSvg into toolbox tree.

The strategy for workspace.updateToolbox is no longer to clear and repopulate the toolbox, but rather to throw away the old toolbox and rebuild a new one.  This is simpler and more reliable.

This commit trims off another KB from the compiled code.
2019-09-23 15:18:32 -07:00
Neil Fraser
fb17b0276d Remove unused CSS classes. 2019-09-20 10:36:06 -07:00
Rachel Fenichel
6f4476c962 Textarea Field, Multiline Block (from acbart) (#2663)
* Field Textarea, text_multiline block, generators
2019-09-11 17:57:46 -07:00
Sam El-Husseini
cd56a0c0b2 No Edge/IE close input icon (#2912)
* Don't show close icon in widgetdiv input in edge and IE
2019-08-26 10:38:44 -07:00