Commit Graph

455 Commits

Author SHA1 Message Date
Bruce Mitchener 66e141ab8f
ci: Update stable Rust. (#317) 2024-05-26 15:22:32 +00:00
Bruce Mitchener b85a511140
clippy: Fix `doc_lazy_continuation` lint (#316) 2024-05-26 15:22:19 +00:00
Aaron Muir Hamilton 73fe4e6c2e
Add basic translation of Touch to PointerEvent. (#313)
https://github.com/linebender/xilem/assets/1272018/6e9aeefb-f324-4738-9aa2-f54d643631e2
2024-05-24 13:33:25 +00:00
Daniel McNab 866d416cef
Make execution on Android work properly (#309)
```
cargo apk run --example mason_android -p xilem
```


![image](https://github.com/linebender/xilem/assets/36049421/40cec14e-ce27-4bb8-ba46-8e6bd902852d)

There will some followup needed here, of course. But some of that will
want to come after xilem#235, when the way to do multiple windows has
become clearer
2024-05-23 08:13:30 +00:00
Philipp Mildenberger c6f6c78f52
xilem: Add Memoization views (`Memoize` and `Arc<impl View>`) (#267)
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.
2024-05-20 15:51:58 +00:00
Jonas Platte 9c1eb3b2fe
Check for typos in CI (#306)
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>
2024-05-17 06:39:32 +00:00
Bram Hoendervangers 380d39dea4
Update xilem-architecture.svg to have a white background (#308)
The architecture diagram is very hard to read on the dark theme of
github

<img width="1312" alt="image"
src="https://github.com/linebender/xilem/assets/9047770/90b5d68e-a14e-43ac-a625-c9696540df0c">
2024-05-16 16:44:25 +00:00
Aaron Muir Hamilton 0ef12a7fb6
Ignore synthetic keyinput events for now (#307)
They are unused (and rarely useful), and they cause unwanted behavior.
2024-05-16 14:18:16 +00:00
Olivier FAURE a8cf86772c
Add rustfmt config (#305)
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>
2024-05-14 09:46:59 +00:00
Daniel McNab eef5a23905
Actually use the druid backspace logic (#303)
This is followup to #273.

This code originally came from
https://github.com/xi-editor/xi-editor/pull/837

I've also brought the tests back

---------

Co-authored-by: Yang Keao <keao.yang@yahoo.com>
2024-05-12 07:49:26 +00:00
Alex Pyattaev c12aa851bf
fix invalid HTML in examples (#304)
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>
2024-05-12 06:03:24 +00:00
Bruce Mitchener 99688a6eef
`masonry`: Use `cursor_icon` crate directly. (#300)
`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.
2024-05-12 05:53:53 +00:00
Olivier FAURE ef5d36e8fc
Move crates to the repository root (#302)
Follows the convention proposed in this discussion:

https://xi.zulipchat.com/#narrow/stream/419691-linebender/topic/Standardizing.20multi-package.20repos
2024-05-11 21:59:03 +00:00
Daniel McNab 9e697cc06f
Handle IME in a way which winit expects (#298)
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.
2024-05-11 14:01:06 +00:00
Pearce Keesling aaeeadbbd7
Additional flex view options (#285)
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.
2024-05-09 05:07:49 +00:00
Philipp Mildenberger 43bd4ef090
xilem_web: Fix mathml example (use `style` method instead of untyped `attr`) (#296)
Fixes #295

Also implements `IntoStyles` for `[impl IntoStyles; N]`
2024-05-09 00:03:27 +00:00
Bruce Mitchener 300b22ce74
xilem_web: Remove unused direct dep on `kurbo`. (#293)
This is always used via `peniko`.
2024-05-08 14:45:26 +00:00
Bruce Mitchener 139395bb67
Remove `xilem_classic` (#290)
This can be accessed in the git history and has been replaced by the
version using `masonry`.
2024-05-08 09:09:49 +00:00
John Skottis 3ef6efa8ce
First draft of ARCHITECTURE.md (#277) 2024-05-08 09:04:45 +00:00
Bruce Mitchener 1c17e9c38a
xilem_classic: deps: Require current `futures-task` (#289)
Previously, this depended only on version `0.3`, which had a advisory
issued for it.
2024-05-08 07:11:07 +00:00
Bruce Mitchener a9dc625472
masonry: Fix typos (#288) 2024-05-08 07:10:41 +00:00
Bruce Mitchener 620b4041f8
masonry: docs: Don't `deny(rustdoc::broken_intra_doc_links)`. (#287)
Having this denied means we can't generate docs locally. We can
re-enable this once the issues are fixed.
2024-05-08 05:57:32 +00:00
Matt Hunzinger e8d88c6610
Add crates.io and docs.rs links to README.md (#286)
Congrats everyone on v0.1!

Not sure if this is the best styling to go for, but I think it'd be
great to link to the new releases
2024-05-08 05:41:48 +00:00
Daniel McNab a0b0842093
Implement underlining for IME areas (#284)
![image](https://github.com/linebender/xilem/assets/36049421/5378dc8c-bb2a-4dba-bbb1-352d827a617b)
2024-05-07 20:56:58 +00:00
Kaur Kuut 392c3c1fc9
Update dependencies. (#283)
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.
2024-05-07 19:38:40 +00:00
Daniel McNab 738e4b213b
Make the default label colour white (#282)
We should be following the system theme here, probably.

And doing a lot of other things. But this is a saner default with a
black default "background"
2024-05-07 19:01:15 +00:00
Daniel McNab 72164fcf33
Fix incorrect handling of the margin in textbox selection (#281)
Previously, click-and-drag selection in the textbox would select the
wrong characters (among other issues with clicking)
2024-05-07 13:55:01 +00:00
Aaron Muir Hamilton 786963e302
Implement basic IME interaction, backspace, and delete. (#273) 2024-05-07 13:30:52 +00:00
Bruce Mitchener 8829daa39f
deps: Update `image`, make workspace, turn off default features. (#279)
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.
2024-05-07 12:57:55 +00:00
Bruce Mitchener f6930242b8
deps: Update `float-cmp` (#280) 2024-05-07 11:37:41 +00:00
Daniel McNab 47804206b4
Fix the handling of textbox width (#275)
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>
2024-05-07 05:08:50 +00:00
Philipp Mildenberger c3783ae693
masonry: Require `ParentWindowOrigin` lifecycle when origin of child has changed (#278)
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`).
2024-05-06 19:53:14 +00:00
Daniel McNab 44f45fe171
Implement underlining and strikethrough for Masonry (#276)
This will be needed to follow on from #273 (showing the pre-edit region
visually)

![underline on Lorem
Ipsum.](https://github.com/linebender/xilem/assets/36049421/eee27c4f-4029-45a1-8a4b-a853a61f5d6b)

and

![stikethrough on Lorem
Ipsum](https://github.com/linebender/xilem/assets/36049421/c7a0efdb-3ddf-4bd1-b837-64a0ee538914)

cc @dfrg for awareness, I'm not certain on the maths (but that doesn't
need to block merging)
2024-05-06 17:25:15 +00:00
Kaur Kuut 1ef39fc562
Add `README.md` for `xilem`. (#268)
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.
2024-05-06 06:51:06 +00:00
Kaur Kuut 3e508716a8
Convert Masonry `README.md` to the Linebender standard. (#271)
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.
2024-05-06 06:50:12 +00:00
Kaur Kuut ceb7f06b51
Sync Masonry's `.gitignore` with the repo's `.gitignore`. (#272)
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.
2024-05-06 06:25:39 +00:00
Kaur Kuut 2ce4ac5845
Remove stale Masonry CI script. (#269)
This is a stale unused CI script left over from the migration.
Everything relevant has already been merged to the main CI script.
2024-05-06 06:12:45 +00:00
Philipp Mildenberger 85e5e463ec
xilem_masonry: Fix Flex splice (increment ix by 2 because of spacer widget) (#264)
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)
2024-05-05 18:03:16 +00:00
Olivier FAURE 8c6eca09e0
Remove ChangeFlags from xilem_masonry (#262) 2024-05-05 17:59:21 +00:00
Daniel McNab ca04bb7ff6
Unbreak text rendering (#263)
Previously, we were rendering the first line `n` times, the second line
`n-1` times, etc.

(Because the copy was in the loop)

See [#xilem > ✔ Text rendering when using nested
Scenes](https://xi.zulipchat.com/#narrow/stream/197075-gpu/topic/.E2.9C.94.20Text.20rendering.20when.20using.20nested.20Scenes)
2024-05-05 16:02:21 +00:00
Daniel McNab 9542aaf2d8
Cleanup the text widgets to not be generic (#260)
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
2024-05-05 13:24:38 +00:00
Olivier FAURE 2c1fa8acea
Create TodoMVC example (#257) 2024-05-05 12:30:32 +00:00
Matt Campbell 1e37164f51
Return the correct accessibility role in DynWidget (#259)
This fixes the problem where the container widget had the same role as
its child, leading to, for example, nested buttons in the mason example.
2024-05-05 07:22:29 +00:00
Olivier FAURE 91fce7dfff
Fix bugs in the accessibility tree created by Masonry (#256)
Fix the layout values set in the accessibility tree.
2024-05-04 17:00:36 +00:00
Olivier FAURE b3540a0453
Improve formatting of logs (#254) 2024-05-04 12:39:35 +00:00
Olivier FAURE 2fbfd412ad
Fix accessibility-related crash with Checkbox and Button (#255) 2024-05-04 12:09:45 +00:00
Olivier FAURE 6880515b95
Add initial accessibility support (#244)
Add AccessKit dependency.
Add accesskit_winit dependency.
Add methods to the Widget trait which create the accessibility tree and
react to accessibility events.
2024-05-04 10:17:49 +00:00
Bruce Mitchener 392dbf5338
docs: Start fixing links and formatting. (#251) 2024-05-04 07:05:33 +00:00
Olivier FAURE df761959e5
Add default subscriber to Masonry (#252)
This subscriber uses EnvFilter to change its value depending on the
RUST_LOG env variable, so log levels can be changed without recompiling
the app.
2024-05-03 22:42:47 +00:00
Kaur Kuut 294bb441b0
Prepare `Cargo.toml` files for release. (#249)
* 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.
2024-05-03 20:07:12 +00:00