Commit Graph

84 Commits

Author SHA1 Message Date
Daniel McNab d70076262d
Update dependencies and bump to Rust 1.80 (#450)
There is one "semi-false-positive" lint triggered, which I have fixed.
Otherwise, the required
```
cargo upgrade --ignore-rust-version
cargo update
```
2024-07-26 13:02:41 +00:00
Daniel McNab f11b64892c
Import our intended set of lints (#432)
See discussion in [#linebender > Standard Lint
set](https://xi.zulipchat.com/#narrow/stream/419691-linebender/topic/Standard.20Lint.20set)

Of note: I have taken steps to ensure that this can be practically
reviewed by *not* applying most of the lints.
The commented out lints make good follow-ups

---------

Co-authored-by: Olivier FAURE <couteaubleu@gmail.com>
2024-07-18 08:58:16 +00:00
Daniel McNab 7f40266bd8
Integrate `tokio` for async communication with Xilem (#423)
Supercedes https://github.com/linebender/xilem/pull/411

This is designed with #417 in mind, to not lock-in to our event loop.

---------

Co-authored-by: Philipp Mildenberger <philipp@mildenberger.me>
2024-07-18 07:38:28 +00:00
Daniel McNab f913a3882b
Update to Vello 0.2.1 and wgpu 0.20.1 (#430)
Mostly to double check that the new release is suitable, but formalising
the update can't hurt
2024-07-17 07:42:20 +00:00
Bruce Mitchener b83a7ef41f
[masonry] Update to accesskit 0.16 (#426)
There was a breaking change in this release that renamed
`role::StaticText` to `role::Label`.
2024-07-16 08:18:51 +00:00
Markus Kohlhase 62c06c9f98
xilem_web: Add Elm Architecture example (#425)
I have intentionally left out the `xilem_core::adapt` variant here in
order to have a clear classic Elm example. I would rather show the
`adapt` variant in a separate example.
2024-07-12 11:39:37 +00:00
Daniel McNab e76cf31258
Deny unsafe code globally (#406)
Related to #44

We don't have any necessary unsafe code, and I don't think any of us
want to lose that.

(Vello is also no longer laundering the unsafety wrt surface creation
thanks to a recent wgpu release)
2024-07-02 13:19:39 +00:00
Daniel McNab 032e86216a
Update to our latest CI standard (#414)
This was most recently updated in
https://github.com/linebender/vello/pull/505

The main differences are:
1) Greater concurrency between clippy and testing
2) More explanations
3) MSRV checking
4) Use of `cargo hack`
5) WASM checked in CI

I've also added the current values of our MSRVs to the main three
crates.
2024-06-28 13:02:54 +00:00
Philipp Mildenberger b33a2a680d
Rewrite xilem_web to support new xilem_core (#403)
This ports xilem_web to the new xilem_core.

There's also a lot of cleanup internally:
* Get rid of all of the complex macros to support DOM interfaces, and
instead use associated type bounds on the `View::Element`.
* Introduce an extendable modifier based system, which should also work
on top of memoization (`Arc`, `Memoize`) and `OneOf` views with an
intersection of the modifiable properties.
* This modifier based system gets rid of the hacky way to propagate
attributes to elements, and takes inspiration by masonrys `WidgetMut`
type to apply changes.
* Currently that means `Attributes`, `Classes` and `Styles` to reflect
what xilem_web previously offered.

Downsides (currently, needs some investigation):

~~Due to more internal type complexity via associated types this suffers
from https://github.com/rust-lang/rust/issues/105900. The new trait
solver should hopefully mitigate some of that, but it seems currently it
completely stalls in the todomvc example (not in other examples).~~
~~The deep, possibly completely static composition via associated
type-bounds of the view and element tree unfortunately can take some
time to compile, this gets (already) obvious in the todomvc example. The
other examples don't seem to suffer that bad yet from that issue,
probably because they're quite simple.~~

~~I really hope we can mitigate this mostly, because I think this is the
idiomatic (and more correct) way to implement what the previous API has
offered.~~

One idea is to add a `Box<dyn AnyViewSequence>`, as every element takes
a "type-erased" `ViewSequence` as parameter, so this may solve most of
the issues (at the slight cost of dynamic dispatch/allocations).

Edit: idea was mostly successful, see comment right below.

I think it also closes #274

It's a draft, as there's a lot of changes in xilem_core that should be
upstreamed (and cleaned up) via separate PRs and I would like to
(mostly) fix the slow-compile time issue.

---------

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-06-28 08:30:18 +00:00
Bruce Mitchener 32c365a42f
Update to winit 0.30.2 (#400)
A fix was in winit 0.30.1 to fix a crash on exit on macOS (among other
things).

Fixes #239.
2024-06-16 07:14:04 +00:00
Daniel McNab d6af6a6ef7
Differentiate pointer buttons in `Button` Widget and View (#397)
In most cases, you want a button which only actuates when the primary
mouse button is pressed, so the easy case is still that. This is a short
term hack, because e.g. the active state is still based on any button
being pressed, not just those we are interested in.

That is, we probably need to represent a set of buttons we are
interested in. However, this change minimally unblocks additional work
with Xilem. In particular, see [#xilem > Minesweeper converted from Iced
to
Xilem](https://xi.zulipchat.com/#narrow/stream/354396-xilem/topic/Minesweeper.20converted.20from.20Iced.20to.20Xilem).
2024-06-14 16:40:26 +00:00
Bruce Mitchener 1be18aeff0
deps: Update accesskit to 0.15, accesskit_winit to 0.21 (#382) 2024-06-10 08:45:18 +00:00
Bruce Mitchener 1ddff7be92
deps: Update `wgpu`, `vello`, `peniko` (#381)
This brings us to the 0.2 release of Vello, which brings the 0.20
release of wgpu.
2024-06-10 08:29:53 +00:00
Daniel McNab 86d9592a3e
Move `xilem` onto a new `xilem_core`, which uses a generic View trait (#310)
This:
1) Renames the current/old `xilem_core` to `xilem_web_core` and moves it
to the `xilem_web/xilem_web_core` folder
2) Creates a new `xilem_core`, which does not use (non-tuple) macros and
instead contains a `View` trait which is generic over the `Context` type
3) Ports `xilem` to this `xilem_core`, but with some functionality
missing (namely a few of the extra views; I expect these to
straightforward to port)
4) Ports the `mason` and `mason_android` examples to this new `xilem`,
with less functionality.

This continues ideas first explored in #235 

The advantages of this new View trait are:
1) Improved support for ad-hoc views, such as views with additional
attributes.
This will be very useful for layout algorithms, and will also enable
native *good* multi-window (and potentially menus?)
2) A lack of macros, to better enable using go-to-definition and other
IDE features on the traits

Possible disadvantages:
1) There are a few more traits to enable the flexibility
2) It can be less clear what `Self::Element::Mut` is in the `rebuild`
function, because of how the resolution works
3) When implementing `View`, you need to specify the context (i.e.
`impl<State, Action> View<State, Action, [new] ViewCtx> for
Button<State, Action>`.

---------

Co-authored-by: Philipp Mildenberger <philipp@mildenberger.me>
2024-06-06 15:16:36 +00:00
Kaur Kuut 5b200876c3
Disable `clippy::assigning_clones` lint. (#331)
Enabling
[`assigning_clones`](https://rust-lang.github.io/rust-clippy/master/index.html#/assigning_clones)
by default in Rust 1.78 was a mistake which was reversed in a week in
[rust-clippy#12779](https://github.com/rust-lang/rust-clippy/pull/12779).

We can disable it locally until the upstream fix arrives to stable Rust.
2024-06-03 14:35:03 +00:00
Olivier FAURE a2045f1356
Document masonry (#329)
This was initially a supposed to be a small documentation pass, which
grew into a few changes:

- Adding back a to-do-list example.
- Fixing the bugs revealed by that example (infinite bounding boxes,
wrong accessibility handling in Portal, etc).
- Making sure all widgets return the correct spans instead of the
less-useful default one.
- Adding a trace to the layout pass for easier debugging.

Overall I'm pretty happy with this!
2024-06-03 14:21:41 +00:00
Bruce Mitchener 6adcf746f4
masonry: Use `web-time` instead of `instant` (#323)
Recently, `instant` has been marked as unmaintained by the maintainer. A
suggested replacement is `web-time`, which is used by `winit` and is
already in our dependency tree.
2024-06-03 11:30:55 +00:00
Bruce Mitchener f8cbf81ca5
lints: Suppress some check-cfg warnings (#321)
The current nightly issues warnings for unknown cfgs, so we need to
suppress some of these for now.

Even though these are only needed for `masonry`, we put them in the
workspace configuration due to limitations in how the lints table is
configured and overridden in current versions of Cargo.
2024-05-30 04:42:48 +00:00
Bruce Mitchener 2ab7c824cc
xilem,masonry: Use `dpi` crate directly (#320)
This removes a class of dependencies from within both `masonry` and
`xilem` on the `winit` crate where we can just use `dpi` directly
instead.

The `dpi` crate is meant (like `cursor_icon`) to be a shared ecosystem
crate rather than only for usage with `winit`.
2024-05-29 07:52:04 +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
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
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
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
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
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
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
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
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 d513e33a6d
deps: Use `raw-window-handle` 0.6.0 (#227)
We don't need to force the usage of 0.5.0.
2024-04-28 02:46:50 +00:00
Bruce Mitchener 571c20d73e
deps: Update parley. (#221)
This version of parley has fontique as a separate crate and has updated
dependencies (as well as a removal of clap as a transitive dep).
2024-04-26 14:41:02 +00:00
Bruce Mitchener ebb4d55f12
parley: Use via workspace dependency. (#210)
This will help us keep everyone using the same version. This also
makes both `xilem` and `masonry` use the same version now.
2024-04-26 00:23:57 +00:00
Daniel McNab 69ac0807b9
Create a minimal xilem_masonry (#205)
* Create a minimal xilem_masonry

* Add a first draft of view sequences

* Implement a flex view

* Fix clippy

Some of these suggestions are kind of bad
but that's by-the-by

* Update CI to 1.77

* Skip masonry docs in CI

* Clippy, again

* Fix clippy

* Skip render snapshot tests

* Skip testing which needs rendering on CI

* Add tuple sequences

* Address review comments and clippy
2024-04-25 12:27:37 +00:00
Bruce Mitchener 041ea0df9f
Remove `test-log` and `env_logger`. (#201)
`test-log` is used with logging to set up `env_logger` for each
test and was only used in the box constraints code. This code
doesn't actually use logging, so this wasn't doing much.
2024-04-16 08:35:46 +00:00
Chad Brokaw 24423aa8f7
Update parley dependency to bring in new font fallback support (#196)
* testing fontique integration

* new text to test font fallback

* restore wgpu patch

* update to new parley git rev

* update rev again
2024-04-02 22:19:51 +00:00
Daniel McNab 072358e293
Use released versions of Vello and wgpu (#190)
* Use released versions of Vello and wgpu

Partially reverts #177

Fixes #189

* Revert auto format of comment
2024-03-19 14:20:03 +00:00
Bruce Mitchener fbe553f9de
clippy: Configure via `lints` table in `Cargo.toml` (#185)
As of Rust 1.74, lints can be configured within the `Cargo.toml`
which allows us to not have to configure them in the source code
as well as simplifying having a single configuration across an
entire workspace.

This is documented at: https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-lints-section
2024-03-09 16:26:02 +00:00
Aaron Muir Hamilton 21a84d6973
Bump vello and remove wgpu override. (#179) 2024-03-02 22:09:27 +00:00
Aaron Muir Hamilton 6500c5058b
Handle scroll events and use winit Modifiers and MouseButton (#178) 2024-02-29 18:45:26 +00:00
Philipp Mildenberger f2454ebe77
Updated dependencies (notably wgpu and vello) (#177) 2024-02-24 11:09:33 +00:00
Aaron Muir Hamilton 21771ef71b
basic winit port (#176)
* Remove menu bar.

* Add PointerCrusher

* Implement basic winit event handling.

* Remove now-inert accessibility and idle code.
2024-02-23 15:47:10 +00:00
Aaron Muir Hamilton 9db9497420
Bump kurbo and related dependencies. (#173) 2024-02-14 23:29:46 +00:00
Aaron Muir Hamilton 09d3656c3a
Bump Taffy to 0.4.0. (#172)
Bump Taffy.
2024-02-14 21:34:19 +00:00
Aaron Muir Hamilton 93480bc98d
Upgrade Vello and ditch SceneBuilder/SceneFragment. (#170) 2024-02-13 23:36:33 +00:00
Chad Brokaw d800c22399
Update vello and parley deps... (#165)
* Update vello and parley deps...

... and everything else, apparently. This pushes the new font code changes through the ecosystem.

Brings everything into sync and should put us in a good place to start releasing.

This works as is but depends on a vello commit that is still under review: linebender/vello#425 should land first and this should be updated with the new git rev before merging.

* fmt :(

* update git revs
2024-01-26 17:22:18 +00:00
Philipp Mildenberger ea45b9f8c1
Merge `xilem_html` and `xilem_svg` as `xilem_web` (#142)
* Merged xilem_svg into xilem_html

* Renamed xilem_html to xilem_web and removed xilem_svg

* xilem_web: factor pointer to root, as it can be used for all Elements and refactor slightly

* Rename example

* xilem_web: Make BoxedView public

* Rename cx.add_new_attribute_to_current_element -> add_attr_to_element and IntoAttributeValue::into_attribute_value -> IntoAttributeValue::into_attr_value

* Add the `fill` and `stroke` attribute to the `g` element
2024-01-04 16:17:13 +00:00
Nico Burns c439885866
Implement `TaffyLayout` widget (#140)
* Fix text widget layout invalidation

* Gitignore .DS_Store files

* Add downcast_ref method to Pod

* Add compute_max_intrinsic method to Pod

Implement compute_max_intrinsic for Box<dyn AnyWidget>

* Add TaffyLayout view and widget

* Add background_color support to TaffyLayout

* Add taffy example
2023-11-28 15:26:48 +00:00
Philipp Mildenberger 5b3de313c7
xilem_html: Add MathML and SVG elements/DOM interface traits (#153)
* Added all MathML elements

* xilem_html: Add all SVG elements and DOM interfaces, and an example using MathML and raw SVG

* Cargo fmt

* xilem_html: Reduce boilerplate in elements, by adding a new macro match arm

* xilem_html mathml_svg example: Remove unnecessary stuff in index.html

* xilem_html: Use `mod`s for each element namespace (html, mathml, svg)
2023-11-28 13:28:18 +00:00
Philipp Mildenberger d40a94fa8a
xilem_html: Significant refactor and introduce DOM interface traits (#141)
* xilem_html: Introduce DOM interface traits to make per DOM element typing possible and flexible

* Cleanup a little bit (remove artifacts from refactor)

* Use separate sealed interfaces to avoid blanket trait impl collisions

* Add generic params T and A to event views and Attr via PhantomData, to avoid inference issues with composed types

* xilem_html: Refactor DOM interface macros

* Add ancestor *and* descendent composable macros
* Added a macro to correctly and conveniently implement dom interfaces for interface restricted Views, this is used currently for the Attr view and the event views

* xilem_html: Add namespace to element generation and refactor element/attribute logic into separate functions

* xilem_html: Remove unnecessary features

* xilem_html: Implement DOM interface traits for Adapt and AdaptState

* xilem_html: Refactor OneOf views
* Eliminate associated trait bound for the View, for easier use
* Add additional OneSeqOf view sequences, to avoid removing the ViewMarker super trait bound on Element
* implement all dom interfaces for the OneOf views

* xilem_html: Reorder generic type parameters in composing views such as `Attr`
2023-11-23 16:25:42 +00:00
Raph Levien 71d1db04dc
Dust off xilem_svg (#139)
* Make xilem_svg into a library

Instead of having the demo app hardcoded, make it a library with a web_examples folder, just like its xilem_html sibling. This patch doesn't change the example or any functionality.

* Migrate KurboShape to ViewExt

Exports a `ViewExt` trait, and wires up types so that type inference can flow through the methods on this trait. That removes the hacky `KurboShape` workaround.

* clippy

* Add fill and stroke

Supports very basic fill and stroke (solid colors, stroke width but no other style parameters).

* rustfmt

* Address review feedback

Fix some cut'n'paste errors, and update README slightly.
2023-11-05 17:26:39 +00:00