This change exposes functionality of already existing internal API
that all renderers use to obtain pixels for upload to the screen - so
it's rather well tested.
This also exposes the `SharedImageBuffer` API, an enum that represents
different SharedPixelBuffer encodings.
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"
Refactor the code in the compiler a bit to allow using the
`TypeLoader` for the root document itself and use that in the
interpreter.
You need to run passes *before* the `TypeLoader` takes ownership
of the Document, so the `load_file` in `TypeLoader` needed a bit of
changing.
We need to decorate an Element so we can interact with it. I want
to decorate only *one* instance of a repeated element to avoid
cluttering up the screen. So pick one good candidate for decoration:
Ideally the one the user clicked on, got for the first one
otherwise.
Store this information so we can get it back after re-rendering,
and so that we can actually mark newly added elements for selection
after they get rendered.
They are not commonly used so no need to use semi-public api for that
and it's really easy to similate with ust two clicks anyway
The previous test function were added before there was public way to
send events
The preview can not leave it up to the interpreter to handle element selection
and highlighting. So add new functions to the interpreter (behind the
"highlight" feature-gate) to query positions of elements.
This exposes some of the code that is used by the existing highlighting code
and extends it where needed.
Two use-cases need to be covered:
1. Query the positions of a component (given by source file path and offset).
This is then used to highlight all occurences of a component as the
cursor position in a source file changes.
2. Query the position of an element (given as `ElementRc`).
This is used when selecting elements in the UI. We need to work at
the element level for this, not at the component level.
Also make the `highlight` module public but feature-gated, so that we
can put helper-types there.
A None value means the file on disk is the golden version.
We have an editor, the LSP and the preview that all need to at least
notice when they have newer data then their peers. So IMHO it makes
sense to have an optional document version around.
The language server protocol makes use of a version number already. This
patch moves that code into the compiler so that it is stored with the
actual data getting versioned.
... 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 is used in slintpad to map relative image URLs to their real
download locations.
This has the side-effect of removing the service worker.
Fixes: #2905
and their related name.
Also move the component module in the item_Tree module
register_component -> register_item_tree
ComponentItemTree -> ItemTreeNodeArray
For #3323
Rationale from that issue:
Right now, we use the term `component` in the Slint language and in the compiler to be a a tree of elements that can be used as an element in a .slint file.
The term is also currently used in the runtime as a tree of runtime Items that are allocated together. (declared in ComponentVTable)
But there are no 1 to 1 mapping between a `component` in the slint language, and a runtime Component.
(for example, the items behind a `if` or `for` or `PopupMenu` are in a different runtime component. And `component` declared in Slint are often inlined)
So we should rename the internal runtime `Component` to `ItemTree`
The currently public `slint::ComponentHandle` wraps the "root" of the ItemTree, but that's ok because it is generated from a .slint `component`, so it doesn't change name
```
warning: private item shadows public glob re-export
--> internal/interpreter/api.rs:9:37
|
9 | use i_slint_core::{Brush, PathData, SharedString, SharedVector};
| ^^^^^^^^^^^^
|
note: the name `SharedString` in the type namespace is supposed to be publicly re-exported here
--> internal/interpreter/api.rs:19:9
|
19 | pub use i_slint_core::api::*;
| ^^^^^^^^^^^^^^^^^^^^
note: but the private item here shadows it
--> internal/interpreter/api.rs:9:37
|
9 | use i_slint_core::{Brush, PathData, SharedString, SharedVector};
| ^^^^^^^^^^^^
= note: `#[warn(hidden_glob_reexports)]` on by default
```
* Configure clippy to not report about type complexity until *much*
later
* Configure clippy to only complain about more than 10 function
arguments
* Properly format safety sections
* Allow unnecessary main functions in doctests in the slint API crate
* AccessKit: Move big block of code before if condition
The main change is that the window adapter is not copied into
sub-components anymore - instead it is accessed through the root. This
is especially important for globals.
In order to add the root, a little extra dance had to be performance on
instantiation: The self_rc/self_weak is created first and the
ComponentExtraData's fields are populated via once_cells.
Consume the Rc in the function signature where the implementation would clone it anyway.
This is also needed in preparation for InstanceRef::window_adapter()
walking up the tree of components,
by which it's not possible to return a reference anymore as
parent_instance() returns a new lifetime that's shorter than &self
inside window_adapter().