Commit Graph

56 Commits

Author SHA1 Message Date
Sam El-Husseini
f97730e83c Sort requires (#4658)
* Cleanup gulp method to sort requires
2021-02-25 17:17:42 -08:00
Rachel Fenichel
107181d6f5 Missing requires, r through v 2021-02-17 14:52:06 -08:00
Rachel Fenichel
b2052aeff4 Add requireTypes for renderers/common 2021-02-02 11:38:08 -08:00
Sam El-Husseini
fba35d342c Add missing require Blockly.constants (#4366) 2020-10-12 17:56:42 -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
Sam El-Husseini
0db1f418ab Fix block connected bounds for Zelos and minimalist renderers. (#3740)
* Fix block connected bounds for zelos and minimalist renderers.
2020-03-12 11:04:29 -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
Sam El-Husseini
95aadbffb1 [zelos] Set a maximum width for dynamic connection shapes. (#3685)
* Set a maximum width for dynamic connection shapes.

* Only render the left side connection if a block has a statement input
2020-02-07 15:13:51 -08:00
Sam El-Husseini
8475976103 Fix start hats (#3651) 2020-01-24 13:02:27 -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
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
Monica Kozbial
26db9167db Move of render contant START_HAT into ConstantProvider. (#3563)
* Move of render contant START_HAT into ConstantProvider.
2020-01-07 16:18:05 -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
c892496668 Update zelos constants to use GRID UNIT, add shadow dummy input height (#3515) 2019-12-15 02:34:39 -08:00
Sam El-Husseini
595bc5270f Remove BEFORE/AFTER statement input spacer measurable (#3506)
* Remove before / after statement input measurable and use spacer properties instead.
2019-12-11 19:29:31 -08:00
Sam El-Husseini
bb5939f77c [zelos] Multi-line rendering (#3501)
* Add isMultiRow property and computation for padding with multirow blocks.
2019-12-11 14:12:36 -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
4eb791bd70 [zelos] Add right connection shape element. (#3488)
* Add right connection shape element
2019-12-05 17:51:39 -08:00
Sam El-Husseini
30a49c3225 Statement inputs have minimum widths. (#3463) 2019-11-22 13:53:49 -08:00
Sam El-Husseini
d8476306f4 Fix up more zelos spacing (#3445)
* Fix up more of zelos spacing
2019-11-14 16:04:46 -08:00
Sam El-Husseini
9dc46ce292 Set statement input height to be the max of the default statement input and the row height. (#3436) 2019-11-12 16:46:33 -08:00
Sam El-Husseini
36cc9a2e89 Zelos constants (#3419) 2019-11-08 10:59:10 -08:00
Sam El-Husseini
942068314f Accept lowercase alignment (#3359)
* Accept lowercase alignment
2019-10-29 11:45:30 -07:00
Sam El-Husseini
e7752e6ea2 Dummy input right alignment (#3342)
* Fix dummy input alignment in geras.
2019-10-28 16:20:54 -07:00
Sam El-Husseini
100da4a66c Revert "Wrap dummy inputs in a measurable so that it can be aligned appropriately. (#3337)"
This reverts commit 7fc733b81f.
2019-10-24 21:53:30 -07:00
Sam El-Husseini
7fc733b81f Wrap dummy inputs in a measurable so that it can be aligned appropriately. (#3337) 2019-10-24 21:42:44 -04:00
Sam El-Husseini
06b5bb1945 Might right corner support to common. Making it so there's always a right corner element, square by default. (#3311) 2019-10-23 21:58:43 -04:00
Sam El-Husseini
3d6eb48937 Render a notch after a statement input in zelos (#3326) 2019-10-23 21:58:18 -04:00
Rachel Fenichel
3c64deceec Merge pull request #3297 from rachel-fenichel/bugfix/3228
Fix #3228 by only using the dark path offset in Geras.
2019-10-23 11:17:09 -07:00
Rachel Fenichel
d11b7228c2 Fix #3228 by only using the dark path offset in Geras. 2019-10-23 11:06:12 -07:00
Sam El-Husseini
ad2c5f69ce Fix for #3313 (#3316)
* Account for output connection with when aligning statement row
2019-10-23 13:07:04 -04:00
Rachel Fenichel
d48859e338 Fix #3191 2019-10-21 15:35:53 -07:00
Sam El-Husseini
42552b5b22 Fix 6 warnings related to rendering. (#3292) 2019-10-21 17:49:38 -04:00
Sam El-Husseini
36524a3b4a Only add a hat if there's no output connection or previous connection (#3280)
* Only add a hat if there's no output connection or previous connection
2019-10-17 14:08:06 -05:00
alschmiedt
a9420154a2 Update todos so they are no longer in jsdocs (#3250) (#3257) 2019-10-15 10:14:39 -07:00
Rachel Fenichel
9ce41598c0 Clean up todos. 2019-10-07 13:25:47 -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
Sam El-Husseini
99ce193b1f Base renderer next / prev connection fixes. (#3135) 2019-10-02 12:35:00 -07:00
Rachel Fenichel
ecf69d851d Use row height for spacer height. 2019-10-01 16:41:58 -07:00
Neil Fraser
872aa45fae More straightening out of dependencies. 2019-09-27 10:48:14 -07:00
Monica Kozbial
303a841685 Adding check for pushing last row with only empty dummy input. (#3081) 2019-09-24 13:41:26 -07:00
Monica Kozbial
a14ac351b5 Adding checks for whether to add elem spacer on row ends (#3060)
* Adding checks for whether elem spacer shouldbe added to start and end of row.

* Fix eslint and add package visibility.
2019-09-20 14:20:14 -07:00
Monica Kozbial
a8af9fea21 Move populate for topRow and bottomRow to info (#3057)
* Move populate for topRow and bottomRow from measurable definition to info.

* Fix local variable and circular dependency.
2019-09-20 13:24:46 -07:00
Rachel Fenichel
77185906d8 Renderers define which paths a block has. (#2981)
* Move render elements into a path object.
2019-09-16 12:13:32 -07:00
Sam El-Husseini
e339ae26bc Move the rendering object to live on the workspace_svg (#3016)
* Move the rendering object onto the workspace allowing the various workspaces to have different renderers.
2019-09-13 14:20:34 -07:00
kozbial
8a00ed9eb2 Remove duplicate check and undo changes in debugger render. 2019-09-12 13:36:45 -07:00
kozbial
90a10e5f44 Fix logic in shouldStartNewRow_ and between row padding in geras. 2019-09-12 11:34:08 -07:00
Rachel Fenichel
4b17234cba Alphabetize requires 2019-09-10 13:01:13 -07:00
Rachel Fenichel
135ab7993e Use ascender/descender naming for top and bottom rows; tweak position calculation. 2019-09-04 16:26:53 -07:00
Sam El-Husseini
73d0b70c22 Add a spacer before and after a statement input and place use it to render a right corner before and after the statement input. (#2967) 2019-09-04 15:38:23 -07:00