Commit graph

20 commits

Author SHA1 Message Date
Damien Elmes
5d7eb8c425 update to latest rules_nodejs & switch to ts_project
ts_library() is deprecated and will presumably be dropped from a
future rules_nodejs, and it wasn't working with the jest tests
after updating, so we switch over to ts_project().

There are some downsides:

- It's a bit slower, as the worker mode doesn't appear to function
at the moment.
- Getting it working with a mix of source files and generated files
was quite tricky, especially as things behave differently on Windows,
and differently when editing with VS Code. Solved with a small patch
to the rules, and a wrapper script that copies everything into the
bin folder first. To keep VS Code working correctly as well, the built
files are symlinked into the source folder.
- TS libraries are not implicitly linked to node_modules, so they
can't be imported with an absolute name like "lib/proto" - we need
to use relative paths like "../lib/proto" instead. Adjusting "paths"
in tsconfig.json makes it work for TS compilation, but then it fails
at the esbuild stage. We could resolve it by wrapping the TS
libraries in a subsequent js_library() call, but that has the downside
of losing the transient dependencies, meaning they need to be listed
again.  Alternatively we might be able to solve it in the future by
adjusting esbuild, but for now the paths have been made relative to
keep things simple.

Upsides:

- Along with updates to the Svelte tooling, Svelte typing has improved.
All exports made in a Svelte file are now visible to other files that
import them, and we no longer rebuild the Svelte files when TS files
are updated, as the Svelte files do no type checking themselves, and
are just a simple transpilation. Svelte-check now works on Windows again,
and there should be no errors when editing in VS Code after you've
built the project. The only downside seems to be that cmd+clicking
on a Svelte imports jumps to the .d.ts file instead of the original now;
presumably they'll fix that in a future plugin update.
- Each subfolder now has its own tsconfig.json, and tsc can be called
directly for testing purposes (but beware it will place build products
in the source tree): ts/node_modules/.bin/tsc -b ts
- We can drop the custom esbuild_toolchain, as it's included in the
latest rules_nodejs.

Other changes:

- "image_module_support" is moved into lib/, and imported with
<reference types=...>
- Images are now imported directly from their npm package; the
extra copy step has been removed.

Windows users may need to use "bazel clean" before building this,
due to old files lying around in the build folder.
2021-10-01 12:52:53 +10:00
Henrik Giesel
80898d1954 Align suggestions with start of tag 2021-09-09 19:03:06 +02:00
Henrik Giesel
f7a69e5e9a Scroll suggestion tag into view 2021-09-09 18:32:58 +02:00
Henrik Giesel
71d4b4d9f7 Remove unused import 2021-09-09 15:38:12 +02:00
Henrik Giesel
8bbc001273 Fix bug where sometimes Autocomplete menu would not show even though suggestions exist 2021-09-09 15:38:11 +02:00
Henrik Giesel
bbba7307b3 Use noSuggestions 2021-09-09 15:38:11 +02:00
Henrik Giesel
500619d5cc Update Autocomplete position when suggestion selection makes it move to the next row 2021-09-09 15:38:10 +02:00
Henrik Giesel
9755b25fb1 Set disabled class on TagInput from WithAutocomplete 2021-09-09 15:38:10 +02:00
Henrik Giesel
3fed669c45 Take most recent input as basis for suggestions 2021-09-09 15:38:09 +02:00
Henrik Giesel
39a1f6199e Split when no autocomplete item is selected 2021-09-09 15:37:59 +02:00
Henrik Giesel
5a41409f54 Do not open autocomplete on clicking input 2021-09-09 15:37:55 +02:00
Henrik Giesel
b91db34aec Allow clicking on suggestion items 2021-09-09 15:37:54 +02:00
Henrik Giesel
e3be5972b8 Switch WithAutocomplete to WithDropdown and fix SelectedTagBadge 2021-09-09 15:37:53 +02:00
Henrik Giesel
8d8dd4fca0 Disable toggle on clicking element (toggle) for WithAutocomplete 2021-09-09 15:37:51 +02:00
Henrik Giesel
8a648a4bcf Implement accepting suggestions via Enter 2021-09-09 15:37:50 +02:00
Henrik Giesel
b6ffc4d071 Introduce AutocompleteItem
* needs too much custom styling / behavior to be done with DropdownItem
2021-09-09 15:37:50 +02:00
Henrik Giesel
d2d6623788 suggestions -> suggestionsPromise, so it works with external APIs 2021-09-09 15:37:50 +02:00
Henrik Giesel
d5eff3b75c Don't allow Enter/Tab/Arrows for Autocomplete, if not active
Don't show Autocomplete, if there are no items available
2021-09-09 15:37:49 +02:00
Henrik Giesel
c18c0dd5b9 Have WithAutocomplete export its API
allows it to be used in more contexts
2021-09-09 15:37:49 +02:00
Henrik Giesel
85a5f627be Rename TagAutocomplete to WithAutocomplete
It's general enough to be used in other cases too
2021-09-09 15:37:49 +02:00
Renamed from ts/editor/TagAutocomplete.svelte (Browse further)