Commit Graph

334 Commits

Author SHA1 Message Date
Rachel Fenichel
0951b5e613 Update eslintrc for eslint v7, and resolve new lint errors 2020-08-10 15:10:48 -07:00
Rachel Fenichel
7288c66294 Rename connectionTypeChecker->connectionChecker 2020-07-16 17:40:13 -06:00
Rachel Fenichel
e24f3cef9b Add isDragging to canConnectWithReason and delete newly unused code paths. 2020-07-16 17:40:13 -06:00
Rachel Fenichel
450aed0aa2 More work on connection type checks 2020-07-16 17:40:12 -06: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
Sam El-Husseini
d6ad7c488b Add theme registry: 2020-06-04 17:56:56 -07:00
alschmiedt
6bc60894db Toolbox interface (#3918)
* Add toolbox interface
2020-05-27 10:06:18 -07:00
alschmiedt
61054ee55a Registry (#3914)
Create a global registry that fields, renderers and future objects can use
2020-05-26 11:21:42 -07:00
Sam El-Husseini
317834ff59 Add accessibility interfaces and fix navigation types (#3908)
* Add accessibility interfaces and fix navigation types
2020-05-21 11:18:10 -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
alschmiedt
3a902ee970 Update ast node (#3808)
* Update ast node
2020-04-15 10:10:21 -07:00
Sam El-Husseini
acb5d895f8 Move flyout label css into the renderer (#3780)
* Move flyout label css into the renderer and add theme options
2020-04-01 15:29:34 -07:00
Monica Kozbial
a9223b0b22 Typo fixes. (#3769) 2020-03-25 15:47:27 -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
9b071ff7f7 [Zelos] Value to stack block support (#3741)
* Zelos value to stack block support
2020-03-12 11:47:47 -07: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
Sam El-Husseini
21c7626c16 Position the zeros circle marker in the middle on top of the connection point. (#3739) 2020-03-12 09:42:10 -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
13ac939b91 Support passing renderer overrides in options (#3734)
* Support passing in renderer options through workspace options.
2020-03-10 18:36:29 -07:00
Sam El-Husseini
f96d1c9768 Fix warning text color. Make it black. (#3730) 2020-03-09 17:58:15 -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
8c5c33902b Flash on render (#3721)
* Flash a block when it's renderered in debug mode
2020-03-05 13:26:10 -08:00
Sam El-Husseini
97eb86f988 Configure zelos selected glow properties in theme (#3715)
* Configure selected and replacement glow size and colour in zelos from the theme.
2020-02-25 14:29:45 -08:00
Beka Westberg
868d3cf30f Fix geras collapsed rendering incorrect in RTL (#3709) 2020-02-24 11:13:05 -08:00
Sam El-Husseini
56ca1e4330 [zelos] Fix centered textinputs (#3703)
* Fix bug in centering text inputs. Shouldn't add right corner element for output only blocks.
2020-02-21 12:03:28 -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
Sam El-Husseini
8524da903b Support renderers that are ES6 classes (#3702) 2020-02-20 15:03:24 -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
Sam El-Husseini
33e082414d Adjust what the spacers at after the top and before the bottom rows depend on. Make them depend on the top row's minHeight and desired height. (#3686) 2020-02-10 08:58:07 -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
Beka Westberg
025d087e6a fix: Fixed insertion preview logic. And fixed markers not handling typed statements. (#3526)
* Added planned functions.

* Added default getConnectionPreviewMethod method.

* Moved show preview logic into their new functions.

* Fixed default getConnectinPreviewMethod logic.

* Reverted to lastConnectionInRow call (for output connections) for behavioral backwards-compat.

* Added zelos logic.

* Removed unused functions, and added docs.
2020-01-24 07:49:31 -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
26a11faf49 Update CSS rules for cursor. (#3627) 2020-01-22 11:41:59 -08:00
Sam El-Husseini
af84e6a40c Zelos rename highlightfilter (#3630)
* Rename highlight filter to selected filter

* Update comment
2020-01-22 11:07:45 -08:00
Monica Kozbial
1afff3c439 Use baseline for positioning rendered connection. (#3609) 2020-01-16 16:07:38 -08:00
Sam El-Husseini
6a4251b11a Add constant for field dropdown arrow padding (#3581)
* Add constants for field dropdown arrow padding for more control over where the arrow shows up.
2020-01-14 13:27:47 -08:00
Sam El-Husseini
899162c420 Fix zelos top row spacer height when it precedes a statement input. (#3587) 2020-01-13 18:39:24 -08:00
Sam El-Husseini
4f80bd6cbf Simplify zelos tight nesting logic (#3583) 2020-01-13 15:47:54 -08:00
alschmiedt
7e34d94610 Fixes blockly games blocks being black (#3579)
* Fixes blockly games blocks being black
2020-01-13 13:34:29 -08:00
Sam El-Husseini
8013f80251 Start hat support in zelos. (#3580)
* Start hat support in zelos.
2020-01-13 13:22:49 -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
8b50df01c0 Fix zelos statement input alignment for spacers (#3578) 2020-01-13 10:32:49 -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
Monica Kozbial
c2087e61f5 Using shapeFor to determine connections shape for marker_svg. (#3573) 2020-01-10 13:32:44 -08:00
Monica Kozbial
9b8fa7a177 Using shapeFor for notch and tab paths. (#3572) 2020-01-10 13:31:49 -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