Commit graph

20 commits

Author SHA1 Message Date
Tobias Hunger
b33fd32002 online_editor: Fix firefox
Firefox does not handle modules in web workers yet, but that is what we
asked vite to build (to work around a compatibility issue after
upgrading to vite 4). So Chrome worked, but Firefox did not.

This PR adds a pretty ugly work around to that problem.

The good news is: Firefox will apparently be able to handle modules in
web workers starting with 111, so let's hope we do not need this for too
long!
2023-02-14 20:53:36 +01:00
Simon Hausmann
a7eaf5a8bb Fix loading of the LSP worker script in the online editor
The update to vite 4 triggered the vite 3 bug vitejs/vite#9879
for us, where the wasm-pack generated .js is included as iife and
therefore the use of import.meta.url gets transpiled to some shim that
tries to access the document, assuming that the JS is running in the
browser instead of in a worker environment.

Explicitly set the output type for the worker to ES modules, so that no
changes are needed and import.meta.url remains in use. This matches the
worker invocation anyway, as we pass "type": "module" to the Worker
constructor.
2023-02-03 15:08:28 +01:00
Simon Hausmann
e430716adb Fix the online editor not loading the wasm-interpreter anymore
The upgrade of vite from 2 to 4 in commit
5951ae6272 also brought an update of
rollup to version three. That one documents that relative externals are
resolved to absolute paths by default, which explains the symptom that
the online editor tried to load /some/absolute/path/wasm_interpreter.js.

Resolving back to resolve paths fixes it.
2023-02-02 17:52:06 +01:00
Tobias Hunger
5951ae6272 online editor: Update tooling and dependencies
We bundle everything with vite, so treat all dependencies as
dev-dependencies.
2023-01-26 15:04:59 +01:00
Tobias Hunger
c237144400 chore: Configure prettier and reformat the online_editor 2022-11-03 10:51:07 +01:00
Olivier Goffart
9f0aa96e91 online_editor: fix build 2022-10-28 11:47:05 +02:00
Tobias Hunger
865d663352
Redo online_editor (#1593)
* Rework the online editor

Implement something that looks more like an application and e.g. allows
to have dockable widgets, a menu bar and keyboard shortcuts.

* xtask: Handle .css files license information

* xtask: Simplify xtask file regexps

No need for many of the .+/.*, we can group them better with the most
specific matches first and then getting more and more general
afterwards.

* reuse: Add .css files for the online_editor
2022-09-07 17:08:55 +02:00
Tobias Hunger
d506c9d553 Fix CI and deploy to website 2022-08-24 10:35:32 +02:00
Tobias Hunger
9e7eacf263 online_editor: Build WASM LSP for the online editor in CI 2022-08-24 10:35:32 +02:00
Tobias Hunger
8c6d103cae online_editor: Add LSP support
Enable the Slint LSP in the online editor.

The approach is modeled after the Slint Web extension for VSCode, using
the `monaco-languageclient` packet from NPM.
2022-08-24 10:35:32 +02:00
Tobias Hunger
fb97a24375 online_editor: Restructure the project
Use the typical src/ setup used in TS projects and split out the code
for the workers into src/worker so that this can get its own
configuration for the typescript compiler. This is necessary as the
web workers run in a more restricted environment as the rest of the
code and because `dom` and `webworker` can not be used together.
2022-08-24 10:35:32 +02:00
Tobias Hunger
1884497308 FIX building with @prefix
Also drop monaco_worker.js as entry point: That is picked up
automatically.
2022-08-16 12:13:16 +02:00
Tobias Hunger
d6bea150d8 online_editor: Make monaco worker work 2022-08-16 12:13:16 +02:00
Tobias Hunger
a645895644 online_editor: Follow JS suggestions in vite.config.js 2022-08-16 12:13:16 +02:00
Tobias Hunger
244bef7990 online_editor: Define @preview to point to the preview WASM code 2022-08-16 12:13:16 +02:00
Tobias Hunger
e9b8a245ce online_editor: Reformat files and make cspell happy (no code change!) 2022-08-16 12:13:16 +02:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Olivier Goffart
f4a824cf61 Rename the wasm-interpreter and the online_editor 2022-02-02 12:26:55 +01:00
Simon Hausmann
bf865d4036 Further trim the dist build of the online editor
Re-use the wasm interpreter from the web site when building for the web
site. It's built & copied in the CI at the same time, and we can
convince rollup to preserve the relative link for production builds,
while aliasing to the local directory for dev builds.

This brings down the editor to ~2.3MB on my machine.
2022-01-06 09:55:34 +01:00
Simon Hausmann
0df394a389 Make it faster to develop the online editor
Switch from webpack to vite. The dev mode is practically instant.
2022-01-06 09:55:34 +01:00