Updated the version from 1.1 to 1.2
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
... and use it to hide internal functionality so users will notice that
they depend on fucntionality we do not provide any guarantees for.
Make the lsp and viewer request the internal feature when building the
interpreter.
This moves most of the version information we need to update into one
place.
Note that the workplace dependency features are in *addition* to any
feature set when using the workspace dependency. So we have all
workspace dependencies defined with `no-default-features = true`.
Turn the instance variable into a Promise itself, where the first
promise that's assigned to it creates the component and shows
it, before resolving the promise with it.
Some associated helper functions that use this.#instance - which is now a Promise - are also async.
In some call sites it doesn't matter, in others an await was added.
With the following snippet there was a race:
```
if (instance === null) {
instance = await create();
await instance.show();
} else {
instance.create_with_existing_window(...);
}
```
When awaiting for the promise that show() returns to settle, we would re-enter
this function (due to a broken recursion guard, that's now removed).
When re-entering, create_with_existing_window() is called, which - in order to
access the slint::Window to re-use - must create the window adapter.
Since that didn't happen from within an event loop invocation, winit would panic.
Consequently, this patch set also makes create_with_existing_window() return
a promise, as well as hide() (for the sake of it).
The broken recursion guard is easy to fix (with a .finally() handler setting
the boolean back), but that would mean we end up not always rendering
the very latest sources. Plus, the same issue exists in wasm_preview.ts.
Now, in case of subsequent re-entrancy in this code, we end up creating
a bunch of create_with_exiting_window() promises, which will eventually
settle and then we go back to the original show() call that will show the canvas.
The interpreter now creates the window typically in show(), so similar
to commit a8fcb5acd6 make show() return a
promise and invoke show() from within the event loop.
Amends d98c6773e1
After commit 7df902b53c, the winit window
is not created when calling show() anymore but it's now created at
component creation time. That means the event loop workaround removed
in 459f810bd8 is now needed at
construction time.
Since this is a winit and wasm specific issue, it's now dealt with in
the wasm interpreter implementation, by invoking the creation from the
event loop from there and returning a promise in the API.
This changes the API therefore: create() can only be called after the
event loop is running.
* compiler: Make mapping from source offset to line/column more reusable
* compiler: Improve mapping of offset to line/column
* Fix unit tests after line mapping update
* interpreter: Add code to have a element picker mode
* slintpad: Add picker mode to the preview
* slintpad: Do not try to highlight "empty" highlight requests
* Slintpad: Cycle through all the possible elements in design mode
* Slintpad: Ignore builtins and eat less clicks
* Slintpad: Highlight the element selected in design mode
* Slintpad: Do not use static mut variable in design mode
* slintpad: Rename `set_current_element_information_callback`
* Interpreter: Do not use unsafe in design mode code
Done with: @ogoffart and @tronical
crates.io won't let us upload a feature with dots in it:
```
Uploading slint-interpreter v0.3.0 (/home/olivier/slint/internal/interpreter)
error: failed to publish to registry at https://crates.io
Caused by:
the remote server responded with an error: invalid upload request: invalid value: string "compat-0.3.0", expected a valid feature name at line 1 column 2254
```
There's a memory leak that causes the created canvas elements not be
deleted. I've tried a few thing such as explicitly hiding the window
(destroying the canvas element instance refs and gl resources we keep in
Rust), but it's not enough - somewhere there remains a circular
reference. Possibly between some of the closures installed in Rust and
DOM elements they are installed on as event handlers.
I also tried using the wasm-bindgen support for weak refs, but no luck.
So instead, to plug the leak, this patch introduces the re-use of the
HTML canvas element in a way that is similar to how the preview works in
vs code's live preview.
I verified that no GL resources or new canvas elements are leaked in
Chrome's heap profiler via snapshot comparison and filtering for the
corresponding DOM element types.