Commit Graph

393 Commits

Author SHA1 Message Date
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
Daniel McNab 52bbfa047e
A foundation for text editing and selection in Masonry (#241)
This brings in a lot of the old work from Druid and Masonry (prior to
linebender/masonry#56) on text, as well as some types from Glazier.

Needed work:
- [X] Text display using abstract types
- [x] Text selection with mouse
- [x] Text input with keyboard
- [ ] IME integration (of the kind winit understands)

Follow up work:
- [ ] Keyboard control of the selection area (hard-coded hotkeys)
- [ ] [Proper
placement](https://raphlinus.github.io/text/2020/10/26/text-layout.html#shaping-cluster)
of cursor
- [ ] Input methods
- [ ] Proper hotkey handling
- [ ] Copy and/or paste
2024-05-03 15:53:52 +00:00
Kaur Kuut 205a9a28a4
Revert to `vello` v0.1.0. (#248)
As discussed at office hours we're going with Vello v0.1.0 for now, as
using the git dependency blocks publishing and Vello 0.2 isn't ready.
2024-05-03 15:43:42 +00:00
Raph Levien 69b995b271
Wire up scale factor (#245)
Generally prefer use of LogicalPosition to PhysicalPosition for layout,
events, etc. Use scale factor to convert to logical position. Apply
scale factor as final transform before Vello rendering.

This PR also makes physical_position available in PointerState.

There is a TODO for handling WindowEvent::Rescale, which remains and is
not addressed. It should be at some future point.
2024-05-03 14:11:45 +00:00
Philipp Mildenberger 3c371b7a84
masonry: Fix non-resetting visual active state when releasing active button outside of its area (#247)
When pressing the button and releasing it outside of its active area,
the visual pressed state (background gradient) stays "pressed". This
should fix this.

(Not related to that PR) I'm not sure, if there's a case, where the
disabled state could change while pressing the button and trigger a
similar behavior.
2024-05-03 10:01:24 +00:00
Kaur Kuut 76e96dc8f5
Standardize copyright headers. (#246)
* Add the Linebender standard copyright header to all Rust source files.
    - Copyright year is based on the original file creation date.
- Files that are based on other projects, mostly Druid, get the correct
credit.
- Files that were built from scratch for Xilem but had copy-pasted Druid
headers get those headers corrected.
* Add copyright header check to CI.
* Add dedicated `LICENSE` files to each package to ensure it is part of
the crates.io source distribution.
* Add `AUTHORS` file to list most of the top contributors.
- It does not need to be complete and additional entries are welcome via
PRs.
2024-05-03 08:50:39 +00:00
Daniel McNab f2c5118737
Masonry: Only activate buttons when they are hot (#243)
This matches the behaviour in Xilem classic
2024-05-02 16:08:08 +00:00
Olivier FAURE 9bb34c20e2
Simplify focus system (#242) 2024-05-02 16:07:11 +00:00
Olivier FAURE c5b69a3908
Remove StoreInWidgetMut and declare_widget (#240)
This makes the WidgetMut type much simpler to implement, at the cost of
not being able to use it as a receiver for custom widgets.

See this discussion for details:

https://xi.zulipchat.com/#narrow/stream/317477-masonry/topic/Thoughts.20on.20simplifying.20WidgetMut
2024-05-02 09:36:18 +00:00
Bruce Mitchener d25d624d79
deps: Use workspace vello, release parley. (#238)
`xilem` now uses the same `vello` as others (git for now) and everyone
uses the new released version of `parley`.
2024-05-01 15:52:42 +00:00
Aaron Muir Hamilton 30c838b400
Port Xilem and Masonry to winit 0.30.0 (#237) 2024-05-01 11:58:21 +00:00
Bruce Mitchener 38ef8d9bf8
deps: Remove unused `open` dependency. (#236) 2024-04-30 16:58:22 +00:00
ykerit 90a5005b05
re-export parley && vello (#234)
I try to use masonry to implement my own application, which requires
vello and parley

---------

Co-authored-by: ykerit <ykerforit@gmail.com>
2024-04-30 15:15:36 +00:00