This fixes a soft crash that can happen on room join if you keep the right panel
open (which is the default). The `MainSplit` component was not properly testing
for the edge cases of when the resize container would be mounted.
Fixes https://github.com/vector-im/riot-web/issues/10997
before, we'd only normalize the sublists that had already been
sized manually. As non-sized items still have flex-basis: auto,
they would claim all the space, and mixing sized and unsized items
would be badly broken.
Now, on the first click, all items are sized to their rendered size
which means they won't flex anymore, but at least the resizing works
this way
Another downside is that when resizing while a sublist is
collapsed, it's reverted to 100px and if a size had been set before,
it's forgotten. No way around this with this approach I'm afraid.
- move some methods to ResizeItem subclass
- allow distributor to instanciate sizer and resizeitem it needs
through static factory methods, instead of passing in another ctor
a distributor can only function with the right item and sizer anyways.
- use consistent import/export style
- remove obsolete code
Last friday a child <div> was added inside the ResizeHandle component,
which made the parentElement/classList checks fail on the event.target
here. This would only fail (and select all the text) when dragging exactly on
the grey line (the div), not the transparent margin around it.
use closest to make sure we have the root element of the handle.
up till now, resize received the offset of the resize handle
within the container upon resizing, and would then calculate
it's new size. For this first item in the container, this is
the same, and has therefor not been a problem yet.
Now however, we'll need to be able to programatically
(from localStorage) set the size of any roomsublist,
so need a method we can call with just the size and not an offset
within the container. The resizer calls the new method,
which subsequently calls resize.
This also has the nice side-effect that you can now easily
call super.resize after having transformed the new item size