This ports the `Memoize` view from old xilem, slightly enhances it, by
checking whether the given view callback is a non-capturing closure and
not a function pointer (by asserting `std::mem::size_of::<F>() == 0`)
It also ports the `Arc<impl View>` and `Arc<dyn AnyMasonryView>` from
#164 including the example there to show how these two forms of
memoization can be used.
Currently, the only legit typo being found is `seeked` but I'm not sure
what to do about that.
Would be nice to check for new typos in CI anyways, right?
---------
Co-authored-by: Kaur Kuut <strom@nevermore.ee>
These standardized options can make code a little nicer. Right now they
don't change anything, though they include an implicit commitment to
adopt the # `imports_granularity = "Module"` and `group_imports =
"StdExternalCrate"` settings.
While these settings are unstable, we can apply them with rustfmt
nightly without actually committing to using nightly in CI. We should
progressively move parts of the codebase towards that format in future
PRs.
---------
Co-authored-by: Kaur Kuut <strom@nevermore.ee>
For some reason the recent version of Trunk refused to serve some of the
examples due to them missing the <html> tags. Adding the tags calms it
down and allows it to work again. Trivial change, but would save someone
the pain of having to fix examples before running them with trunk serve.
Co-authored-by: Alex Pyattaev <me@example.com>
`cursor_icon` is a crate that is used by `winit` to provide its
`CursorIcon` type separately from the `winit` crate.
This re-exports the `CursorIcon` from `masonry` and then uses that
rather than via `winit:🪟:CursorIcon`, allowing the use of the
`CursorIcon` without having to independently discover its provenance.
This is also one step towards not requiring `winit` within the `masonry`
internals apart from the actual window / event loop management.
Doing some investigation, the issues I'm seeing is that ibus is a bit/a
lot broken around compose keys
But this has correct behaviour for me. This matches the documentation of
the `winit`
[`Ime`](https://docs.rs/winit/latest/winit/event/enum.Ime.html) event.
Wired up some more existing masonry flex properties so they can be set
on the flex view.
I was messing around with a dummy example to try out the v0.1 and
noticed I couldn't easily center something because flex was only
exposing direction not alignment/cross-alignment. It looked like all the
logic already exists in masonry so it was just a matter of wiring it up.
This is my first contribution so sorry if I missed some steps.
Sidenote: I didn't see any examples of testing that a view updates the
underlying element so I am guessing that is still tbd. If someone has a
suggestion for a good way to do that I am happy to try it out.
I'm also not sure what the etiquette is on adding/editing examples so I
just included the example I was using to verify it worked but no stress
if you want to remove it.
These are the results of running
```sh
cargo upgrade --ignore-rust-version
cargo update
```
in preparation for the upcoming release.
These are semver compatible updates.
The `image` crate has a number of dependencies which aren't needed in
the core masonry crate, so we can turn off the default image format
support and only enable "png" when used as a dev dependency.
Also, make it a workspace dependency at the same time so that the
version is only stated in a single location.
Previously, filling up the line would overflow the right border of the
box, because the `max_advance` was too big.
This improves the margin hack, and also fixes the resultant issue.
---------
Co-authored-by: Bruce Mitchener <bruce.mitchener@gmail.com>
Fixes the issue described in #265.
I *think* this is the proper fix, it seems to be similar as in previous
xilem (where I think that pass is called `ViewContextChanged`).
This is a basic skeleton based on the latest Linebender standards.
I also added a paragraph about the reactive layer's origins.
Plus a section describing the modularity of our stack.
Additional sections describing more of the actual new state of things
are welcome in follow-up PRs, but are not a goal of this PR.
This is a basic skeleton based on the latest Linebender standards.
The installation instructions were stale, based on `druid-shell`. The
example code and roadmap were also stale, not reflective of the recent
barrage of changes. Thus I removed these stale sections.
I removed `CONTRIBUTING.md` because the new readme has a section about
that as standard, and a more thorough `CONTRIBUTING.md` will eventually
live in the repo root.
I moved `ARCHITECTURE.md` and `ROADMAP.md` to a new `doc` sub-directory,
as is standard for Linebender. These are actually also stale, but won't
be immortalized by publishing so changing/deleting them isn't as urgent.
The general editor/OS ignore filters are useful across the repo.
Fixees one of the Masonry specific snapshot filters, which was broken
due to a copy-paste accident.
While adding filters to the TodoMVC example, I produced a crash. Which
seems to originate because there was a spacer added, which also
increments the underlying element child count.
So in case we want to have that spacer, we need to increment by 2
instead...
(Since `mutate` and `delete` skip spacers, because `child_mut` returns
none, and the index is only incremented for concrete children it's not
necessary to change the index incrementation code there)
This is fallout from #241. As discussed on Zulip, using different
underlying text types here is a very advanced feature, which will not be
needed by any real consumers. It also creates some footguns
Probably conflicts with #257, so that should land first
Add AccessKit dependency.
Add accesskit_winit dependency.
Add methods to the Widget trait which create the accessibility tree and
react to accessibility events.
* Rename classic `xilem` to `xilem_classic` and the new `xilem_masonry`
to `xilem`.
No directory structure changes yet to avoid merge conflicts before
RustNL.
* Base common dependencies on workspace dependencies.
* Bump `masonry` version to `0.2.0`.
* Remove some legacy docs.rs configuration inherited from Druid/Glazier
that is no longer needed.
* Unify ordering of properties.