Skip to content
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

Make it easier to define userland "components" #208

Open
armanbilge opened this issue Feb 21, 2023 · 0 comments
Open

Make it easier to define userland "components" #208

armanbilge opened this issue Feb 21, 2023 · 0 comments
Labels
enhancement New feature or request UX Improve usability of an existing feature

Comments

@armanbilge
Copy link
Owner

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.

@armanbilge armanbilge added enhancement New feature or request UX Improve usability of an existing feature labels Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request UX Improve usability of an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant