We now have components.toggle simply return an object, without
putting the object into a lookup table. The consumers of the
objects have all been changed to just store the object in their
own module scope.
The diff is a bit hard to read here, but it's mostly de-denting
code and removing these things:
- we don't have opts.name
- we don't have __toggle.lookup
- we don't have keys
- we don't create a sibling object to the prototype object
This is a recent regression where we I refactored the toggle
component. For some reason the old code was waiting until
after the callback to set some of its state, and I did the
same thing when I simplified how the state was stored.
Under the old code, this didn't manifest as a bug, although
the old code was problematic for other reasons.
This "fix" doesn't actually change anything user facing, as the
follow up commit fixes the proximal problem more directly. And
the toggle component is still prone to people writing code that
tries to inspect the state of the widget as it's being built.
This is a pretty thin abstraction to prevent having to put
magic numbers in code, doing the which/keyCode hack, and remembering
to all preventDefault.
Hopefully we'll expand it to handle things like shift/alt keys
for components that want their own keyboard handlers (vs. going
through hotkey.js).
This adds some helpers to avoid some duplication, and we also
now track the selected idx directly, since it's all under our
control.
The main addition is `select_tab`, which we now use for some
things that used to simulate clicks.