Commit Graph

14 Commits

Author SHA1 Message Date
Raph Levien 6f27b4da94 Make the HTML elements more typed
Don't store the name in the element view, but use a zero-sized type.

Note, this breaks the untyped case. That will probably need a separate view, or alternatively the tag doesn't have to be zero-sized (so there is a variant that stores a String), the name func could take a &self parameter, and it could return the internal string.

Note, also uses the stringify function to reduce the duplication in the macros. That's a separate, orthogonal change.
2023-07-03 16:38:20 -07:00
Richard Dodd 3501382f26 Include attribution for todomvc assets 2023-07-02 17:12:54 +01:00
Richard Dodd 5b29458aaa Update readme 2023-07-02 17:08:17 +01:00
Richard Dodd cc9e81dbc9 Add documentation 2023-07-02 17:05:05 +01:00
Richard Dodd a7cc3a1e4e Remove unused `void` impl 2023-07-02 16:21:30 +01:00
Richard Dodd 8eb4c81043 Don't shorten `element` to `el` 2023-07-02 15:59:00 +01:00
Richard Dodd 89ab953167 Impl `View` directly on text, and refactor action return types. 2023-07-02 15:57:01 +01:00
Richard Dodd da58556d15 Use `gloo` for registering event callback
`gloo::events::EventListener` will automatically remove the callback when it is dropped.
2023-07-02 14:35:24 +01:00
Raph Levien 1fd1ce7885 Add wasm DOM implementation for xilem.
I'm doing all the work in a single commit so it's easier to rebase.

Below is a list of the individual changes I did

 - Squash prev commits
 - Remove top-level action handler (use Adapt instead).
 - Type events in the same way as elements (could also do attributes the
   same)
 - Allow users to avoid compiling the typed html/attributes/events
 - Use more specific types for mouse events from web_sys
 - change "click" from PointerEvent to MouseEvent (PointerEvent caused a
   panic on `dyn_into().unwrap()`)
2023-06-25 19:42:02 +01:00
Raph Levien 6d5aff4970 Make Vec impl of ViewSequence dynamic
Handle cases where the length of the Vec changes.

Also fine-tunes the handling of tree structure changes, setting just the tree structure change flag rather than all (and fixing a hygiene problem in the macro).
2023-04-30 16:55:05 -07:00
Raph Levien 4f8193e663 Add Vec impl of ViewSequence 2023-04-25 20:26:53 -07:00
Raph Levien e97036b603 Make main traits generic on Send
Add additional arguments to the macros which instantiate view, allowing them optionally to be Send.

The main widget tree is Send because we're pushing the ability to run app logic in multiple threads. A web deployment would not be Send, because many primitives needed for web integration (including closures) are !Send.
2023-04-25 06:02:47 -07:00
Raph Levien df4000e5e7 Clean up generic references in macros
Some of the references to generic parameters were still referring to indentifiers expected to be in scope; that made them not really generic.
2023-04-24 22:20:25 -07:00
Raph Levien d729039f13 Macro based implementation of xilem_core
Experimenting with macros to make the View traits more generic.
2023-04-24 21:43:50 -07:00