Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite xilem_web to support new xilem_core #403

Merged
merged 57 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
42ece98
xilem_core: Add `ViewSequence::count`
Philipp-M Jun 9, 2024
ac6fe76
xilem_core: Temporarily don't require `Send` bound on `Message` trait
Philipp-M Jun 9, 2024
918083f
xilem_web: Initial commit of rewrite
Philipp-M Jun 9, 2024
605361e
Slight cleanup and rename of `Attrs` to `Props` for better distinctio…
Philipp-M Jun 10, 2024
fc614af
Add experimental `OneOf2` View in xilem_core and xilem_web
Philipp-M Jun 10, 2024
06232f2
Small fix in classes, and more renaming
Philipp-M Jun 10, 2024
304b78d
xilem_web: Port counter example to new xilem_web
Philipp-M Jun 10, 2024
c422e4f
Refine OneOf2 view (reduce boilerplate) add generational ids and clea…
Philipp-M Jun 11, 2024
56473df
Add a OneOf2 `ViewSequence` impl
Philipp-M Jun 11, 2024
80c6213
Cleanup `OneOf2` view and sequence and document everything
Philipp-M Jun 12, 2024
731094e
Add tests for `OneOf2`
Philipp-M Jun 12, 2024
dc1e4e3
Add `OneOf2-9` implementations via a macro
Philipp-M Jun 12, 2024
4a3fa4b
Add orphan views
Philipp-M Jun 14, 2024
40406bb
A lot of fixes, and add DOM interfaces
Philipp-M Jun 15, 2024
f525a53
Port style support from old xilem_web and port the mathml_svg example…
Philipp-M Jun 15, 2024
ed2cc6c
Add parent to `PodMut` and fix `OneOf` view impl with it
Philipp-M Jun 15, 2024
ef2ccfa
Lazy access to attributes, which increases performance, when they're …
Philipp-M Jun 15, 2024
8f5efbf
Cleanup with `AnyPod` alias, and reduce macro-expanded boilerplate by…
Philipp-M Jun 15, 2024
71f6c85
Ported `Pointer` view from xilem_web
Philipp-M Jun 15, 2024
8862d77
Port `Fill` and `Stroke` views and add them to the relevant interfaces
Philipp-M Jun 15, 2024
1e3175e
xilem_core: Add support for kurbo shapes
Philipp-M Jun 15, 2024
b8bd42d
Port kurbo shapes and svgtoy example
Philipp-M Jun 15, 2024
f91e4c8
Port todomvc example
Philipp-M Jun 17, 2024
2092b85
Port custom_element
Philipp-M Jun 17, 2024
7675762
Add missing Adapt view
Philipp-M Jun 17, 2024
50b921a
Delete old xilem_web and rename new xilem_web2 to xilem_web
Philipp-M Jun 17, 2024
c732da5
Add a DomViewSequence as a workaround for regressing compile times be…
Philipp-M Jun 20, 2024
1be6bfa
Cleaned up and documented a lot
Philipp-M Jun 20, 2024
c6e053e
Merge branch 'main' into xilem_web2
Philipp-M Jun 20, 2024
06e5306
Correct license headers
Philipp-M Jun 20, 2024
f4c9cf0
Provide a way to add `View` implementations in downstream implementat…
Philipp-M Jun 17, 2024
4f6bfc4
Remove unneeded std feature
Philipp-M Jun 21, 2024
4b8335b
Cleanup a little bit and remove `AsOrphanView` in favor of `OrphanView`
Philipp-M Jun 22, 2024
627c16d
Document and port generic `Message`
Philipp-M Jun 22, 2024
c37a926
xilem_core: Add a test for the `OrphanView`
Philipp-M Jun 22, 2024
39f7790
Merge branch 'orphan-views' into xilem_web2
Philipp-M Jun 22, 2024
75847e4
Adjust to generic message of xilem_core (i.e. unhack `Send` bound fro…
Philipp-M Jun 22, 2024
6307703
xilem_core: Add a `ViewSequence` impl for `[impl ViewSequence; N]`
Philipp-M Jun 23, 2024
b7a5d66
Fix `set_attribute` when element is not an `HtmlInputElement`
Philipp-M Jun 23, 2024
1d60987
Add a lot of documentation to the interfaces and fix `OneOf` `WithSty…
Philipp-M Jun 23, 2024
52c8eb7
Add new example "blog" to show some of the new properties of xilem_web
Philipp-M Jun 23, 2024
e5dac12
Add missing `message.rs`
Philipp-M Jun 23, 2024
5101fc1
Add `README`
Philipp-M Jun 23, 2024
e482dc8
Fix some doc comments
Philipp-M Jun 23, 2024
0ed9231
Merge branch 'main' into xilem_web2
Philipp-M Jun 25, 2024
51f01ca
Fix CI
Philipp-M Jun 25, 2024
d5e420d
Remove blog example
Philipp-M Jun 27, 2024
1b53a9b
Make the `DomViewSequence` a private (crate level) implementation det…
Philipp-M Jun 27, 2024
e538bd0
Readd missing LICENSE to xilem_web
Philipp-M Jun 27, 2024
6aa53ab
Move `ViewCtx` to a separate module `context`
Philipp-M Jun 27, 2024
ac8caa6
Add builder methods from old `ViewExt` trait to `DomView` trait and f…
Philipp-M Jun 27, 2024
40745c8
Add missing License header
Philipp-M Jun 27, 2024
4e29707
Readd meta in Cargo.toml
Philipp-M Jun 27, 2024
4eb1e1d
... and readd package.metadata.docs for scrape-examples in Cargo.toml
Philipp-M Jun 27, 2024
bdf4259
Improve readme and use same trick as in Xilem Core
Philipp-M Jun 27, 2024
05038d6
Use `Rc<[ViewId]>` instead of `Vec<ViewId>` where possible
Philipp-M Jun 27, 2024
ca212a0
Address Review Feedback
Philipp-M Jun 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ members = [
"masonry",

"xilem_web",
"xilem_web/xilem_web_core",
"xilem_web/web_examples/counter",
"xilem_web/web_examples/counter_custom_element",
"xilem_web/web_examples/todomvc",
Expand Down
3 changes: 2 additions & 1 deletion xilem_core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

</div>

Xilem Core provides primitives which are used by [Xilem][] (a cross-platform GUI toolkit). <!-- and Xilem Web (a web frontend framework) -->
Xilem Core provides primitives which are used by [Xilem][] (a cross-platform GUI toolkit) and [Xilem Web][] (a web frontend framework).
If you are using Xilem, [its documentation][xilem docs] will probably be more helpful for you. <!-- TODO: In the long-term, we probably also need a book? -->

Xilem apps will interact with some of the functions from this crate, in particular [`memoize`][].
Expand Down Expand Up @@ -73,6 +73,7 @@ Contributions are welcome by pull request. The [Rust code of conduct][] applies.

[LICENSE]: LICENSE
[Xilem]: https://crates.io/crates/xilem
[Xilem Web]: https://crates.io/crates/xilem_web
[xilem docs]: https://docs.rs/xilem/latest/xilem/
[`memoize`]: https://docs.rs/xilem_core/latest/xilem_core/views/memoize/fn.memoize.html
[`View`]: https://docs.rs/xilem_core/latest/xilem_core/view/trait.View.html
6 changes: 1 addition & 5 deletions xilem_core/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,11 @@ impl<A, Message> MessageResult<A, Message> {
/// A dynamically typed message for the [`View`] trait.
///
/// Mostly equivalent to `Box<dyn Any>`, but with support for debug printing.
// We can't use intra-doc links here because of
// We can't use intra-doc links here because of rustdoc doesn't understand impls on `dyn Message`
/// The primary interface for this type is [`dyn Message::downcast`](trait.Message.html#method.downcast).
///
/// These messages must also be [`Send`].
Philipp-M marked this conversation as resolved.
Show resolved Hide resolved
/// This makes using this message type in a multithreaded context easier.
/// If this requirement is causing you issues, feel free to open an issue
/// to discuss.
/// We are aware of potential backwards-compatible workarounds, but
/// are not aware of any tangible need for this.
///
/// [`View`]: crate::View
pub type DynMessage = Box<dyn Message>;
Expand Down
289 changes: 143 additions & 146 deletions xilem_web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "xilem_web"
version = "0.1.0"
description = "HTML DOM frontend for the Xilem Rust UI framework."
keywords = ["xilem", "html", "dom", "web", "ui"]
keywords = ["xilem", "html", "svg", "dom", "web", "ui"]
categories = ["gui", "web-programming"]
publish = false # Until it's ready
edition.workspace = true
Expand All @@ -19,155 +19,152 @@ cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
workspace = true

[dependencies]
xilem_web_core = { workspace = true }
xilem_core = { workspace = true, features = ["kurbo"] }
peniko.workspace = true
bitflags.workspace = true
wasm-bindgen = "0.2.92"
paste = "1.0.15"
log = "0.4.21"
gloo = { version = "0.11.0", default-features = false, features = ["events"] }

[dependencies.web-sys]
version = "0.3.69"
features = [
"console",
"CssStyleDeclaration",
"Document",
"DomTokenList",
"Element",
"Event",
"HtmlElement",
"Node",
"NodeList",
"SvgElement",
"SvgaElement",
"SvgAnimateElement",
"SvgAnimateMotionElement",
"SvgAnimateTransformElement",
"SvgCircleElement",
"SvgClipPathElement",
"SvgDefsElement",
"SvgDescElement",
"SvgEllipseElement",
"SvgfeBlendElement",
"SvgfeColorMatrixElement",
"SvgfeComponentTransferElement",
"SvgfeCompositeElement",
"SvgfeConvolveMatrixElement",
"SvgfeDiffuseLightingElement",
"SvgfeDisplacementMapElement",
"SvgfeDistantLightElement",
"SvgfeDropShadowElement",
"SvgfeFloodElement",
"SvgfeFuncAElement",
"SvgfeFuncBElement",
"SvgfeFuncGElement",
"SvgfeFuncRElement",
"SvgfeGaussianBlurElement",
"SvgfeImageElement",
"SvgfeMergeElement",
"SvgfeMergeNodeElement",
"SvgfeMorphologyElement",
"SvgfeOffsetElement",
"SvgfePointLightElement",
"SvgfeSpecularLightingElement",
"SvgfeSpotLightElement",
"SvgfeTileElement",
"SvgfeTurbulenceElement",
"SvgFilterElement",
"SvgForeignObjectElement",
"SvggElement",
# "SvgHatchElement",
# "SvgHatchpathElement",
"SvgImageElement",
"SvgLineElement",
"SvgLinearGradientElement",
"SvgMarkerElement",
"SvgMaskElement",
"SvgMetadataElement",
"SvgmPathElement",
"SvgPathElement",
"SvgPatternElement",
"SvgPolygonElement",
"SvgPolylineElement",
"SvgRadialGradientElement",
"SvgRectElement",
"SvgScriptElement",
"SvgSetElement",
"SvgStopElement",
"SvgStyleElement",
"SvgsvgElement",
"SvgSwitchElement",
"SvgSymbolElement",
"SvgTextElement",
"SvgTextPathElement",
"SvgTitleElement",
"SvgtSpanElement",
"SvgUseElement",
"SvgViewElement",
"Text",
"Window",
"FocusEvent",
"HtmlInputElement",
"InputEvent",
"KeyboardEvent",
"MouseEvent",
"PointerEvent",
"WheelEvent",
"HtmlAnchorElement",
"HtmlAreaElement",
"HtmlAudioElement",
"HtmlBrElement",
"HtmlButtonElement",
"HtmlCanvasElement",
"HtmlDataElement",
"HtmlDataListElement",
"HtmlDetailsElement",
"HtmlDialogElement",
"HtmlDivElement",
"HtmlDListElement",
"HtmlEmbedElement",
"HtmlFieldSetElement",
"HtmlFormElement",
"HtmlHeadingElement",
"HtmlHrElement",
"HtmlIFrameElement",
"HtmlImageElement",
"HtmlInputElement",
"HtmlLabelElement",
"HtmlLegendElement",
"HtmlLiElement",
"HtmlLinkElement",
"HtmlMapElement",
"HtmlMediaElement",
"HtmlMenuElement",
"HtmlMeterElement",
"HtmlModElement",
"HtmlObjectElement",
"HtmlOListElement",
"HtmlOptGroupElement",
"HtmlOptionElement",
"HtmlOutputElement",
"HtmlParagraphElement",
"HtmlPictureElement",
"HtmlPreElement",
"HtmlProgressElement",
"HtmlQuoteElement",
"HtmlScriptElement",
"HtmlSelectElement",
"HtmlSlotElement",
"HtmlSourceElement",
"HtmlSpanElement",
"HtmlTableCaptionElement",
"HtmlTableCellElement",
"HtmlTableColElement",
"HtmlTableElement",
"HtmlTableRowElement",
"HtmlTableSectionElement",
"HtmlTemplateElement",
"HtmlTimeElement",
"HtmlTextAreaElement",
"HtmlTrackElement",
"HtmlUListElement",
"HtmlVideoElement",
"console",
"CssStyleDeclaration",
"Document",
"DomTokenList",
"Element",
"Event",
"AddEventListenerOptions",
"HtmlElement",
"Node",
"NodeList",
"SvgElement",
"SvgaElement",
"SvgAnimateElement",
"SvgAnimateMotionElement",
"SvgAnimateTransformElement",
"SvgCircleElement",
"SvgClipPathElement",
"SvgDefsElement",
"SvgDescElement",
"SvgEllipseElement",
"SvgfeBlendElement",
"SvgfeColorMatrixElement",
"SvgfeComponentTransferElement",
"SvgfeCompositeElement",
"SvgfeConvolveMatrixElement",
"SvgfeDiffuseLightingElement",
"SvgfeDisplacementMapElement",
"SvgfeDistantLightElement",
"SvgfeDropShadowElement",
"SvgfeFloodElement",
"SvgfeFuncAElement",
"SvgfeFuncBElement",
"SvgfeFuncGElement",
"SvgfeFuncRElement",
"SvgfeGaussianBlurElement",
"SvgfeImageElement",
"SvgfeMergeElement",
"SvgfeMergeNodeElement",
"SvgfeMorphologyElement",
"SvgfeOffsetElement",
"SvgfePointLightElement",
"SvgfeSpecularLightingElement",
"SvgfeSpotLightElement",
"SvgfeTileElement",
"SvgfeTurbulenceElement",
"SvgFilterElement",
"SvgForeignObjectElement",
"SvggElement",
# "SvgHatchElement",
# "SvgHatchpathElement",
"SvgImageElement",
"SvgLineElement",
"SvgLinearGradientElement",
"SvgMarkerElement",
"SvgMaskElement",
"SvgMetadataElement",
"SvgmPathElement",
"SvgPathElement",
"SvgPatternElement",
"SvgPolygonElement",
"SvgPolylineElement",
"SvgRadialGradientElement",
"SvgRectElement",
"SvgScriptElement",
"SvgSetElement",
"SvgStopElement",
"SvgStyleElement",
"SvgsvgElement",
"SvgSwitchElement",
"SvgSymbolElement",
"SvgTextElement",
"SvgTextPathElement",
"SvgTitleElement",
"SvgtSpanElement",
"SvgUseElement",
"SvgViewElement",
"Text",
"Window",
"FocusEvent",
"HtmlInputElement",
"InputEvent",
"KeyboardEvent",
"MouseEvent",
"PointerEvent",
"WheelEvent",
"HtmlAnchorElement",
"HtmlAreaElement",
"HtmlAudioElement",
"HtmlBrElement",
"HtmlButtonElement",
"HtmlCanvasElement",
"HtmlDataElement",
"HtmlDataListElement",
"HtmlDetailsElement",
"HtmlDialogElement",
"HtmlDivElement",
"HtmlDListElement",
"HtmlEmbedElement",
"HtmlFieldSetElement",
"HtmlFormElement",
"HtmlHeadingElement",
"HtmlHrElement",
"HtmlIFrameElement",
"HtmlImageElement",
"HtmlInputElement",
"HtmlLabelElement",
"HtmlLegendElement",
"HtmlLiElement",
"HtmlLinkElement",
"HtmlMapElement",
"HtmlMediaElement",
"HtmlMenuElement",
"HtmlMeterElement",
"HtmlModElement",
"HtmlObjectElement",
"HtmlOListElement",
"HtmlOptGroupElement",
"HtmlOptionElement",
"HtmlOutputElement",
"HtmlParagraphElement",
"HtmlPictureElement",
"HtmlPreElement",
"HtmlProgressElement",
"HtmlQuoteElement",
"HtmlScriptElement",
"HtmlSelectElement",
"HtmlSlotElement",
"HtmlSourceElement",
"HtmlSpanElement",
"HtmlTableCaptionElement",
"HtmlTableCellElement",
"HtmlTableColElement",
"HtmlTableElement",
"HtmlTableRowElement",
"HtmlTableSectionElement",
"HtmlTemplateElement",
"HtmlTimeElement",
"HtmlTextAreaElement",
"HtmlTrackElement",
"HtmlUListElement",
"HtmlVideoElement",
]
Loading