sigmoid.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A social space for people researching, working with, or just interested in AI!

Server stats:

574
active users

#shadowdom

0 posts0 participants0 posts today

After a long while tinkering with smaller and smaller ways to build re-usable pieces of HTML, I've landed on something that is simple, and uses the browsers built-in abilities to upgrade elements.

Introducing "ShadowRoot Injector" 🎉
github.com/Tram-One/shadowroot

ShadowRoot Injector is a way to declaratively define HTML, that will automatically insert when custom elements appear in the DOM. 🪡

Check out the link and examples, and let me know what y'all think!
#WebComponents #HTML #ShadowDOM #WebDev

New Kitten release

• Now leaves <style> tags within <template> tags alone when collating and normalising the CSS on a page so as not to interfere with scoped styles in declarative shadow DOM.

(Kitten’s Streaming HTML workflow¹ – which uses htmx and WebSockets under the hood – combined with built-in support for slots, etc., in Kitten components² means the use of declarative shadow DOM is mostly useful if you want scoped styles. Ideally, of course, use classes to scope styles to your components and be specific in your CSS selectors in general so as not to pollute elements in your components. Although that’s a bit like saying you should floss everyday. Yeah, we all know we should…) :)

Update: All that said, I’d highly recommend you don’t use Shadow DOM in your Kitten apps. For one thing, htmx’s WebSocket extension doesn’t seem to play well with it. And for another, you really don’t need it and definitely not just to get scoped CSS.

Enjoy!

:kitten:💕

¹ kitten.small-web.org/tutorials
² kitten.small-web.org/tutorials

In that it was dropped as part of a thread that you might have otherwise been uninterested in, sharing this again to start your Thursday:

blog.westbrookjohnson.com/patt

Catch up on some techniques for managing connection time work in a custom element. 😁 There's even reasons for using shadow DOM hidden in there. 😱

Thanks @nachtfunke for starting the convo on this and @zachleat for challenging a toot into a full on blog dump. 🙇

blog.westbrookjohnson.comI'm feeling so disconnected
Replied to Nathan Knowler

@knowler MDN accepts PRs…

I started working on github.com/Westbrook/axe-core- as a test bed for #ElementInternals usage for ace-core, but maybe more useful at large for these APIs. I accept PRs, too. 🤗

Also, we’re looking to reignite the push for community docs and guides for WCs in discord.gg/KzgaSbGc9q to clarify these sorts of things, as well.

GitHubGitHub - Westbrook/axe-core-element-internals: Tests for accessibility tree equivelency of Element Internals usage.Tests for accessibility tree equivelency of Element Internals usage. - Westbrook/axe-core-element-internals
Continued thread

I can maybe see CSS modules / constructible stylesheets kind of gives a browser primitive for CSS in a way which aligns more with this model. Though it kind of requires #ShadowDOM for scoping to work in any reasonable fashion, and without a clear scoping story I don't think it's quite there yet. Also it's not that far off from a string literal of CSS IMHO.

Replied in thread

@patrickbrosset I've used it like this in the past: github.com/adobe/spectrum-web- Specifically to get information through shadow roots.

However, I'm not sure whether it should cross shadow boundaries on its own. I could maybe see an option, so you had to do work to get through, but didn't need to write your own recursive method.

GitHubspectrum-web-components/tools/shared/src/get-deep-element-from-point.ts at main · adobe/spectrum-web-componentsSpectrum Web Components. Contribute to adobe/spectrum-web-components development by creating an account on GitHub.

Hi #webComponents friends, new and old! 👋

So many of you in recent days, was there some kind of drama? 😉

Thing won't always be this exciting, but I hope together we make make the web a little better place. 🚧

At times that might mean participating in the #webComponentsCG. Come hang out: github.com/w3c/webcomponents-c 👷

Others will just be sharing ideas about #webDev #shadowDOM #CSS #customElements #w3c, etc. 📖

What about you? What are you working on/learning about? Let people know in the thread! 🗣️

GitHubGitHub - w3c/webcomponents-cg: Web Components community groupWeb Components community group. Contribute to w3c/webcomponents-cg development by creating an account on GitHub.