Skip to content

Make it easier to define userland "components" #208

Open

Description

@armanbilge

See also:

Consider this Laminar-style example:

def MyComponent(mods: Mod[HtmlElement]*) = 
  div(
    cls := "decoration",
    mods
  )

At the moment this wouldn't work great with Calico, because modifiers are typeclass-based (#207). Another issue is that if the caller of MyComponent wants to add additional cls values, it would override the cls := "decoration" (#205). It doesn't compose well.

The composition issue in particular bugs me, since it's not just about the class attribute but basically any attribute. It's too easy to mess up the "component"'s internals when doing things externally.

Hence why I say "component", because it's not really well encapsulated. I feel like the answer might be #37: that we should make it easy to define true Web Components, that have proper encapsulation of their internals. Web Components specifically solves this issue of encapsulation.

Activity

  1. added
    enhancement
    UX
    on Feb 21, 2023
  2. JoeCelaster commented on Mar 4, 2025

    @JoeCelaster

    See also:

    Consider this Laminar-style example:

    def MyComponent(mods: Mod[HtmlElement]*) =
    div(
    cls := "decoration",
    mods
    )
    At the moment this wouldn't work great with Calico, because modifiers are typeclass-based (#207). Another issue is that if the caller of MyComponent wants to add additional cls values, it would override the cls := "decoration" (#205). It doesn't compose well.

    The composition issue in particular bugs me, since it's not just about the class attribute but basically any attribute. It's too easy to mess up the "component"'s internals when doing things externally.

    Hence why I say "component", because it's not really well encapsulated. I feel like the answer might be #37: that we should make it easy to define true Web Components, that have proper encapsulation of their internals. Web Components specifically solves this issue of encapsulation.

    Hi Arman, I can understand the problem, the user-defined Attribute values like cls are overwritten by the existing one. I can fix this, Can you assign this issue to me ?

  3. armanbilge commented on Mar 4, 2025

    @armanbilge
    OwnerAuthor

    @JoeCelaster thanks for your interest! I think this is a difficult issue to get started with. Instead, can I suggest you make a contribution to the Calico Material web component library?

  4. JoeCelaster commented on Mar 4, 2025

    @JoeCelaster

    @JoeCelaster thanks for your interest! I think this is a difficult issue to get started with. Instead, can I suggest you make a contribution to the Calico Material web component library?

    I am actually contributing to take part in GSOC, which is the right repo to contribute ?

  5. armanbilge commented on Mar 4, 2025

    @armanbilge
    OwnerAuthor

    I am actually contributing to take part in GSOC, which is the right repo to contribute ?

    @JoeCelaster excellent! Adding a web component to the Calico Material library will be a good first contribution, to help you get started with the GSoC project :)

  6. JoeCelaster commented on Mar 5, 2025

    @JoeCelaster

    I am actually contributing to take part in GSOC, which is the right repo to contribute ?

    @JoeCelaster excellent! Adding a web component to the Calico Material library will be a good first contribution, to help you get started with the GSoC project :)

    Thanks for that @armanbilge , But i can't find any issues there and pull requests. How can i contribute to it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions