Minor
- Unhide right panel when choosing "Two panels" layout option
- Refactor focusing
- Correctly focus next room when closing currently active room
- Correctly focus room when joining new room
- Use strict mode on all compiled files
- Fix router when started on `/` (it previously required starting on a
non-empty room ID, which wasn't noticeable back when the URL needed
to be `/preactalpha`)
- Update teambuilder sidebar CSS, to make it easier to add regular text
- This is mainly for the "Tournaments" button in the main menu,
which shares the CSS
- Fix new tournament elim tree text in Safari
- Update new tournament elim tree highlighted links to reliably
link every still-playing game
- Remove latest gen from format name displays everywhere
- Previously, they would only be removed from the format dropdown,
but now they're also gone from the Ladder tab, battle tabs, and
`/rank`
- Support async d3 loading
- This allows chatrooms to be loaded way before all our dependencies
are fully downloaded
- Remove "[Gen 9]" from format names everywhere (previously it was only
removed from the format dropdown)
- Also add "[Gen 6]" to unlabeled formats in `/rank` (Gen 6 was the
last time we didn't have format generation as part of format names)
Trivial
- Stricter JSX linting
- (unfortunately, most of the JSX style enforcement I actually want
isn't possible in @stylistic)
- Make room.subscribeTo's second parameter optional
- Rearrange and comment loading order
- Rename hiddenInit -> focusNextUpdate (clarity)
- Rename PSMain -> PSView (clarity)
- Fix button spacing in Change Password
- Add `touch-action: manipulation` to <a> tags
- Refactor `nodeSize` in elim tour trees
The new Babel version gives us access to transforming `||=` and `??`,
and removes the need for a lot of dependencies that are now included in
`@babel/preset-env` thanks to them being released rather than proposals.
This also adds a new Babel plugin to simply remove import/export when
building, which seems to be the best way to make `import` and `export`
usable on the client.
This is something I probably wouldn't have rushed nearly as much,
except I have a serious use-case coming up; specifically
```js
foo = document.querySelector('foo')?.bar;
```
in a class property.
`document.querySelector('foo') && document.querySelector('foo').bar`
is incredibly inefficient here, but TypeScript doesn't consider
`(document.querySelector('foo') || {}).bar` to be valid because `{}`
doesn't have the `.bar` property. Creating a temporary variable
would have been a huge mess because this was a class property
initializer.
In hindsight, `(document.querySelector('foo')! || {}).bar` would
probably have worked, but too late now.
This doesn't change debuggability and saves a bit of bandwidth.
But most importantly, it might help Windows users who are having
trouble compiling because Babel runs out of memory.
This is only a first step and doesn't pass strictNullChecks.
I'm committing now because skipping straight to refactoring will be
easier than trying to make it pass strictNullChecks as-is.
TypeScript found at least a few bugs here, which is nice.
This is the first step of moving the entire client over to
TypeScript + Preact!!!!
The main change here is that battledata.js has been split into three
files:
- `src/battle-dex.ts`
- `src/battle-dex-data.ts`
- `src/battle-dex-misc.js`
These are concatenated back into `battledata.js` in the client, so
third parties (and specifically, old replay files) should be
unaffected. Also, this makes sure that we don't have more than two
dependencies right now.
The compilation is done with Babel 7 beta, because no stable version
of Babel supports TypeScript. We're not using `tsc` because it can't
compile to ES3 and it doesn't support preserving line numbers.
`toRoomid` has been moved from client.js to battle-dex.ts.