Thread
#compose-web
    David Herman

    David Herman

    3 weeks ago
    I'm wondering if there are official plans for adding support for CSS functions into the Web Compose API, e.g. things like clamp, abs, min, max.
    I think what's probably missing is a base class somewhere (
    CSSFunction
    ?
    CSSNumericFunction
    ?) similar to all the
    CSSNumeric
    base class options for numeric properties.
    And then, a bunch of functions across the API which would allow you to take such a function in as an argument, e.g.
    fontSize(value: CSSNumericFunction)
    Maybe there's already a solution that's done, or in progress at least, that I'm missing?
    @Ayfri, did you ever submit a PR? (I noticed your thread from ~a month ago)
    a

    Ayfri

    3 weeks ago
    I submitted a first PR adding DSLs about a month ago for
    transitions
    but never got an answer, for my project I also added these functions, a dsl for creating linear-gradiants, and a lot of missing enums ike TextAlign, Resize, Cursor, Overflow also a similar way that
    auto
    is impemented but for
    min/fit/max-content
    David Herman

    David Herman

    3 weeks ago
    Do you have a link to the PR? I'd love to follow it. I can help you make some noise 🙂
    a

    Ayfri

    3 weeks ago
    Also, I didn't created any other PR because I'm still waiting for this one to be added, I want to see if my first PR was right with nothing forgot nor badly made 🙂
    David Herman

    David Herman

    3 weeks ago
    Thanks! Yeah, makes sense. When I look at docs for CSS functions, I can appreciate they'd want to think carefully about the design before committing to an API.
    a

    Ayfri

    3 weeks ago
    If you want to see all the things I added to my side it's open source on my portfolio in this package : https://github.com/Ayfri/Ayfri.github.io/tree/master/src/main/kotlin/style/utils
    David Herman

    David Herman

    3 weeks ago
    I know what you mean about wanting the make sure you're getting it right. There's a lot of subtle stuff going on in the code with external interfaces, composite interfaces, inlines, and things like that
    Oh, you made
    CSSClamp
    a generic numeric value. That seems like a really nice approach.
    a

    Ayfri

    3 weeks ago
    also the last lines on
    _CSSBuilder
    are pretty badly made because I was running out of time x) (my school was asking me to finish it on August 22, I finished on this day like at 8pm lol !)
    Yup, even added a way to create clamp with a range of two CSSValues, and a class for storing this range 🙂