News for hackers. Stuff that matters.
Re:Shoelace: A library of web components by Inviz on Wednesday January 10, 2024 @09:53PM (#38946884)
I'm looking for a library of web components that:

1) Uses slots for composition

2) Does not use CSS-in-JS

3) Lightweight

I understand that slots imply shadow Dom, and then shadow Dom usually means adding/adopting stylesheets into components, and that means css in js.

But there's also ::part that allows piercing the shadow dom. Is there any library that uses it?

Re:Shoelace: A library of web components by mattlondon on Thursday January 11, 2024 @01:35AM (#38948584)
The CSS doesn't need to be in the JS. You can trivially just fetch the static CSS file in JS then have the content adopted.
Re:Shoelace: A library of web components by Inviz on Thursday January 11, 2024 @07:41AM (#38951451)
Yeah but flash of unstyled content? Plus you need to somehow adopt only related parts? Selectors wouldnt match easily necessarily, e.g. decision to adopt :hover selector must be made somehow
Re:Shoelace: A library of web components by nona on Thursday January 11, 2024 @06:32AM (#38950853)
I think this library does what you want: https://shoelace.style/getting-started/customizing#css-parts
Re:Shoelace: A library of web components by Inviz on Thursday January 11, 2024 @07:38AM (#38951418)
I guess it’s most-but-not-all part that got me confused. The are parts re-exported Manually? I guess that works
Re:Shoelace: A library of web components by dannye on Sunday January 21, 2024 @07:30AM (#39077856)
https://webcomponents.dev/blog/all-the-ways-to-make-a-web-co...

Yet, they are all Tools, and you don't learn a Technology by learning a Tool, or do you become a Writer when you learn Word?

``::part`` is part [sic] of the Standard, it doesn't require any tooling.

CCS in JS is your choice

https://jsfiddle.net/WebComponents/znbgf726/

https://i.imgur.com/inJAbQW.png