Seed: Typed Styles - API design.

Created on 14 Jan 2020  路  4Comments  路  Source: seed-rs/seed

API design

Most helpful comment

Khalas looks very nice, but it seems more like a library than super simple wrapper for CSS properties.
The idea is - Seed provides basic foundation for attributes, events, styles and elements/tags and you can use it to build libraries.
This foundation should be auto-generated, consistent, non-opinionated and typed & simple as much as possible. Example of styles (consistent with the draft design for atttributes):

div![
    S.position.absolute(),
    S.left.px(30),
    S.top.px(50),
]

And with Khalas:
https://docs.rs/khalas/0.1.1/khalas/css/struct.Style.html#method.position

div![
    Style::default()
        .position(|conf| {
            conf.position(|conf| {
                conf.absolute().top(px(50)).left(px(30))
            })
        })
]

All 4 comments

What about something similar to this Style. I use this in Khalas and I use the same way with events. If you guys like this way I can make PR with these changes in Seed so they become part of Seed ?

Khalas looks very nice, but it seems more like a library than super simple wrapper for CSS properties.
The idea is - Seed provides basic foundation for attributes, events, styles and elements/tags and you can use it to build libraries.
This foundation should be auto-generated, consistent, non-opinionated and typed & simple as much as possible. Example of styles (consistent with the draft design for atttributes):

div![
    S.position.absolute(),
    S.left.px(30),
    S.top.px(50),
]

And with Khalas:
https://docs.rs/khalas/0.1.1/khalas/css/struct.Style.html#method.position

div![
    Style::default()
        .position(|conf| {
            conf.position(|conf| {
                conf.absolute().top(px(50)).left(px(30))
            })
        })
]
  1. draft:
div![
    S.position().absolute(),
    S.left().px(30),
    S.border().style(|s| (s.solid(), s.dotted())),
    S.border().style(|s| s.solid()),
]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

flosse picture flosse  路  7Comments

sbditto85 picture sbditto85  路  3Comments

MartinKavik picture MartinKavik  路  3Comments

TuntematonSotilas picture TuntematonSotilas  路  3Comments

songmaotian picture songmaotian  路  4Comments