-
Notifications
You must be signed in to change notification settings - Fork 156
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
experimental UI Library #333
Comments
Very nice experiment! On the first glance:
|
Glad you like it :D
Autocompletes in my case doesn't work (Emacs with lsp on), I think this is the case with most if not all IDEs. docs generation is fine and it can be better.
hmmm, I really don't know Elm and I can't read it's code. Anyway, What would
A lot of reasons :D.. Why GitLab
sure, I will add some examples soon. |
|
I don't have much time and I don't think I'll use Elm in any way. It would be great if there are some resources explain the ideas/concepts/patterns behind Elm, if you know any please share them.
one problem I can see with this approach, is that users cannot clone the radio with it's config using simple correct me if I'm mistaken. |
I have added counter example for now, other examples will be added after I add support for events for the elements/components. |
The amount of boilerplate depends on your architecture and how much safety you want, etc. They are just trade-offs. In the Elm arch. - When the So again - they are trade-offs and it depends on you preferences and use-cases. Ad
impl Default for MyApp {
fn default() -> Self {
Self {
inc_btn: el::Button::with_label("+", Msg::IncBtn)
.add_event_handler(Ev::Click, |_| Msg::Increment),
...
impl Model<Msg, ()> for MyApp {
fn update(&mut self, msg: Msg, orders: &mut impl Orders<Msg, ()>) {
match msg {
Msg::IncBtn(msg) => self.inc_btn.update(msg, &mut orders),
...
.add(self.inc_btn.render(theme)) |
Valid point, it make sense not to clone the check value.. hmm didn't think of that situation yet!. I will play with the
Sure, that was not possible before e900221 I believe.
this is
Sure, this is what I'm trying to do right now, it would be something like this: el::Button::with_label("+", Msg::IncBtn)
.on_click(|_| Msg::Increment)
listeners in the view because I didn't add
I'm working on this, but this involve generics which make the code hard to work with :D. thank you for your feedback and guidance. |
I have add |
Can we define the associated inc_btn: el::Button::with_label("+", Msg::IncBtn).events(|e| e.click(|_| Msg::Increment)),
...
Msg::IncBtn(msg) => self.inc_btn.update(msg, &mut orders),
...
.add(|item| item.content(vec![self.inc_btn.render(theme)])) |
I have tried to do it using generics struct App {
home_btn: Button<AppMsg, ???>,
} we can store the MapMsg using
but I'm trying to minimize the use of trait object for performance, do think using |
There are many |
Hmm, I try to implement it using pub struct Button<ParentMsg> {
map_msg: Rc<dyn FnOnce(Msg) -> ParentMsg + 'static>
...
} and later when I want to render the button I have to call fn render(&self, theme: &impl Theme) -> Self::View {
button![
ev(Ev::Click, |_| Msg::Click)
]
// calling MessageMapper::map_msg with the stored `map_msg`
.map_msg(*Rc::clone(&self.map_msg))
} I got error saying |
You have to use a "magic trick" - transform |
hehehe didn't think about this trick :D, I have updated the example with the new changes. |
will close this for now. if there is any update I might open it again. |
So I was doing some experimental UI library and I think I reach state where I can publish this library.
I didn't add any docs yet. but the code is there if anyone would like to help :D.
https://gitlab.com/muhannad_alrusayni/khalas
This is also response for:
in #310 (comment)
I am not sure if opening issue is the right way to tell :D.. I will close this issue after a few days. if you think this is not the right place to post about it, feel free to close the issue now.
The text was updated successfully, but these errors were encountered: