Progressive Web Components
11–20 of 61 posts
Re: Progressive Web Components
#12Re: Progressive Web Components
#13I like web components, the simpler the better, so I like what I see but having a strong OCD about syntax I just want to propose the use of It's just a matter of using a regex [1] and making your syntax more palatable Regardless, kudos for the release * const componentRegex = / )([^%] ?)%>/g;
Your component regex represents a JSX limitation, but web components do not need React. Plus, if you capitalize the first letter, JSX would treat it as a React component rather than a web component (i.e. custom native HTML elements)
Re: Progressive Web Components
#14React cannot do this. It's difficult to explain without writing a whole essay but the benefits are very clear once you try this approach.
Re: Progressive Web Components
#15The HTML + CSS first approach and JS only for enrichment sounds great, and like what should be done anyway. I wonder though, how it will play out in reality. Will web developers using this library make the effort to keep essential functionality JS free, if possible, and provide additional views using whatever web framework they use, or will they implement essential functionality as "JS enrichment", requiring JS for t…
In reality, building anything complex is a huge pain using web components, particularly because it is hard to author them with appropriate level of styling API and accessibility support. In my experience, web components are fantastic for consumers but terrible for the authors. Still, the advantages are clear: they don’t need any special runtime and can be used with other JS frameworks. Another thing in favor of web c…
Everything works like normal html + css, but you get all the benefits of reusability and encapsulated script logic.
Lit-html (the library, not the framework) gives this approach super rendering speed too.
Re: Progressive Web Components
#16I like web components, the simpler the better, so I like what I see but having a strong OCD about syntax I just want to propose the use of It's just a matter of using a regex [1] and making your syntax more palatable Regardless, kudos for the release * const componentRegex = / )([^%] ?)%>/g;
Customer elements MUST have an hyphen.
is the same as in HTML
Re: Progressive Web Components
#17But when you think of them as a suite of APIs to define custom elements, that can coexist with your framework components, this delimma goes away.
I do think it's a-shame that modern frameworks don't better support shadow dom and local styles, and local events. Understandably I also get why they also don't see that as a good use of their time either, it adds complexity to the runtimes, they need to observe events at multiple root nodes.
Besides the cost of implementation and commitment to additional complexity, assuming that was a nonissue, with the exception of those otherwise legitimate reasons, there's no technical limitation that prevents React from supporting shadow roots for arbitrary custom element. I made a proof of concept of this myself seems to work quite nicely with a stylesheet loader hook (which ensured it was loaded once and there was a shared sheet between all instances of the same element), but I had to start observing events in each elements shadow root.