Commit Graph

104 Commits

Author SHA1 Message Date
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
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
6b07ccab96 chore: Remove declareLegacyNamespace from renderers (#5528)
* chore: Remove declareLegacyNamespace from Geras renderer

* chore: Remove declareLegacyNamespace from minimalist renderer

* chore: Remove declareLegacyNamespace from thrasos renderer

* chore: Remove declareLegacyNamespace from zelos renderer

* fix: Move debugger functionality out of Blockly.blockRendering to avoid dependency cycle when re-exporting submodules

* chore: Remove declareLegacyNamespace from Blockly.blockRendering.*
2021-09-24 08:33:35 -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
kozbial
bdf16d88e0 clang-format core/renderers/geras/measurables/input.js 2021-08-11 13:51:05 -07:00
kozbial
8f83073cdb Migrate core/renderers/geras/measurables/input.js named requires 2021-08-11 13:51:05 -07:00
kozbial
26d4431ae5 Migrate core/renderers/geras/measurables/input.js to goog.module 2021-08-11 13:51:05 -07:00
kozbial
87568c5869 Split classes from core/renderers/geras/measurables/input.js into multiple files 2021-08-11 13:51:05 -07:00
Aaron Dodson
228ecb0f2d Migrate core/renderers/geras/renderer.js to goog.module syntax (#5307)
* Migrate core/renderers/geras/renderer.js to goog.module

* Migrate core/renderers/geras/renderer.js to named requires

* clang-format core/renderers/geras/renderer.js
2021-08-11 08:30:05 -07:00
Aaron Dodson
0f7f597758 Migrate core/renderers/geras/drawer.js to goog.module syntax (#5300)
* Migrate core/renderers/geras/drawer.js to ES6 const/let

* Migrate core/renderers/geras/drawer.js to goog.module

* Migrate core/renderers/geras/drawer.js to named requires

* clang-format core/renderers/geras/drawer.js

* Remove Blockly prefix on call to blockRendering in core/renderers/geras/drawer.js
2021-08-11 08:26:04 -07:00
kozbial
a4a3b6a068 Migrate core/renderers/common/block_rendering.js to goog.module 2021-08-09 18:23:07 -07:00
Aaron Dodson
b5444b4e89 Migrate core/renderers/geras/path_object.js to goog.module syntax (#5306)
* Migrate core/renderers/geras/path_object.js to goog.module

* Migrate core/renderers/geras/path_object.js to named requires

* clang-format core/renderers/geras/path_object.js
2021-08-09 12:30:07 -07:00
Aaron Dodson
d0b5f6db8b Migrate core/renderers/geras/highlight_constants.js to goog.module syntax (#5303)
* Migrate core/renderers/geras/highlight_constants.js to ES6 const/let

* Migrate core/renderers/geras/highlight_constants.js to goog.module

* Migrate core/renderers/geras/highlight_constants.js to named requires

* clang-format core/renderers/geras/highlight_constants.js
2021-08-05 10:13:03 -07:00
Aaron Dodson
80b521e8d7 Migrate core/renderers/geras/info.js to goog.module syntax (#5305)
* Migrate core/renderers/geras/info.js to ES6 const/let

* Migrate core/renderers/geras/info.js to goog.module

* Migrate core/renderers/geras/info.js to named requires

* clang-format core/renderers/geras/info.js
2021-08-05 08:09:10 -07:00
Aaron Dodson
fba87c93c4 Migrate core/renderers/geras/highlighter.js to goog.module syntax (#5304)
* Migrate core/renderers/geras/highlighter.js to ES6 const/let

* Migrate core/renderers/geras/highlighter.js to goog.module

* Migrate core/renderers/geras/highlighter.js to named requires

* clang-format core/renderers/geras/highlighter.js
2021-08-04 12:12:53 -07:00
Aaron Dodson
87ccee7843 clang-format core/renderers/geras/constants.js 2021-08-03 10:42:26 -07:00
Aaron Dodson
0203eec8c7 Migrate core/renderers/geras/constants.js to named requires 2021-08-03 10:40:25 -07:00
Aaron Dodson
8e30d9ebd1 Migrate core/renderers/geras/constants.js to goog.module 2021-08-03 10:37:17 -07:00
Rachel Fenichel
cf7a8b95b8 Remove extra requires of Blockly.constants 2021-07-21 15:35:19 -07:00
Christopher Allen
1197afcee7 Fix JSDoc type annotations causing closure-make-deps warnings
Some type annotations were missing curly brackets, which makes
closure-make-deps emit uninteresting warnings.  Now any output
from the command will be informative and related to whatever
one is presently working on.
2021-07-12 03:17:14 +01:00
Neil Fraser
cff7b359f4 Make comments more consistent. 2021-06-09 11:41:42 -07:00
Laura Harker
5ff76ae32d Stop overriding @protected methods with @private (#4760)
An upcoming change to emit private properties in Google's internal version of
https://github.com/angular/clutz will otherwise break any
TypeScript depending on these types. This is because TypeScript errors
on overriding protected with private (Closure Compiler does not).
2021-04-06 11:05:41 -07:00
Sam El-Husseini
63d26dc186 Add extra requires check (#4677)
* Add extra requires check
2021-03-05 09:50:51 -08:00
Rachel Fenichel
750b62030b First pass at creating connectionTypes and inputTYpes 2021-03-04 10:22:24 -08:00
Sam El-Husseini
f97730e83c Sort requires (#4658)
* Cleanup gulp method to sort requires
2021-02-25 17:17:42 -08:00
Rachel Fenichel
52c77c70d6 Fix missing require and requireTypes in geras 2021-02-02 11:38:08 -08:00
alschmiedt
ded97db12e Fix statement input height bug (#4486) 2020-12-01 10:26:46 -08:00
Sam El-Husseini
fba35d342c Add missing require Blockly.constants (#4366) 2020-10-12 17:56:42 -04:00
Sam El-Husseini
db40e44b7c Move Blockly.utils.dom.SvgElementType to Blockly.utils.Svg (#4285)
* Move SVGElementType to its own file shaving off 2.7KB
2020-09-16 14:42:58 -07:00
Sam El-Husseini
0f3db47fa5 Use generics to derive SVG element type (#4036)
* Encapsulate type in a generic to automatically derive type of SVG element when using createSvgElement
2020-07-13 10:40:31 -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
Sam El-Husseini
0230a4c192 Update IPathObject to include properties (#3822)
* Update IPathObject to include properties

* Fix ipathobject svgpath
2020-04-15 19:46:11 -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
13ac939b91 Support passing renderer overrides in options (#3734)
* Support passing in renderer options through workspace options.
2020-03-10 18:36:29 -07:00
Beka Westberg
868d3cf30f Fix geras collapsed rendering incorrect in RTL (#3709) 2020-02-24 11:13:05 -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
Monica Kozbial
fdb1d71e88 Editable field spacing (#3635)
* Substituting checks for isEditable.

* Add isField checks.

* Add parentheses for casting.

* Update value of isEditable and use for spacing.

* Changing to double equals.
2020-01-23 13:10:33 -08:00
Monica Kozbial
1afff3c439 Use baseline for positioning rendered connection. (#3609) 2020-01-16 16:07:38 -08:00
Sam El-Husseini
1661d640d6 Geras inline alignment of rows + max bottom row width (#3575)
* Add a desired width getter method for input rows. Override in geras to fix the width of the bottom row and statement input to a max width.
2020-01-13 10:40:52 -08:00
Sam El-Husseini
1924b2674a Treat a statement input as the end of the statement row. (#3577)
* Reduce spacing for editable fields when they appear right before a statement input.
2020-01-11 17:34:45 -08:00
Sam El-Husseini
e1472a3600 Detect undefined elements in the debugger and remove undefined elem if a row has no elements when adding spacers. (#3576) 2020-01-11 17:33:20 -08:00
Sam El-Husseini
fe555d9021 Rename input connection to connectionModel (#3571)
* Remove input measurable's connection property and rename references to connectionModel.
2020-01-09 18:09:15 -08:00
Sam El-Husseini
c3867443f5 Fix value to stack width measurement (#3559)
* Include width of connected block in value to stack width measurement.
2020-01-07 16:05:34 -08:00
Sam El-Husseini
2b335dcb6b Make alignment common renderer behaviour (#3498)
* Make alignment common
2019-12-11 13:42:10 -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
f4431b3361 [Zelos] apply Colour (#3465)
* Only apply colour from a single entry point. Zelos rendering apply colour
2019-11-25 14:18:10 -08:00