<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Serhii Kulykov</title>
    <description>The latest articles on Forem by Serhii Kulykov (@webpadawan).</description>
    <link>https://forem.com/webpadawan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F91653%2Fe5dbeda1-34f7-436a-9a5e-e9d59825f89e.jpeg</url>
      <title>Forem: Serhii Kulykov</title>
      <link>https://forem.com/webpadawan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/webpadawan"/>
    <language>en</language>
    <item>
      <title>10 years of building Web Components: the story of &lt;vaadin-combo-box&gt;</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Wed, 27 Aug 2025 16:10:00 +0000</pubDate>
      <link>https://forem.com/webpadawan/10-years-of-building-web-components-the-story-of-91d</link>
      <guid>https://forem.com/webpadawan/10-years-of-building-web-components-the-story-of-91d</guid>
      <description>&lt;p&gt;Today marks the 10 year “&lt;a href="https://github.com/vaadin/vaadin-combo-box/commit/91364ba92a57a77d3e8725a8b7e1c70a0e96c5a7" rel="noopener noreferrer"&gt;birthday&lt;/a&gt;” of one of the most complex and sophisticated parts of Vaadin web components: the &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt;. I had a chance to use this component and contribute to it before joining Vaadin. Today, I’d like to explore its story, and to illustrate how Vaadin web components evolved over time.&lt;/p&gt;

&lt;p&gt;Building a combo-box component is quite a challenging task, but I’m not going to dig deep into technical details. There is a great &lt;a href="https://component.kitchen/blog/posts/building-a-great-combo-box-component-is-so-much-trickier-than-youd-think" rel="noopener noreferrer"&gt;blog post&lt;/a&gt; about this topic by Jan Miksovsky, creator of Elix library. I also recommend &lt;a href="https://react-spectrum.adobe.com/blog/building-a-combobox.html" rel="noopener noreferrer"&gt;this article&lt;/a&gt; by the React Aria team about their ComboBox implementation and challenges they faced.&lt;/p&gt;

&lt;p&gt;At Vaadin, we invested significant effort into making our combo-box both feature rich and accessible. Our component supports different ways of assigning data, lazy loading, internal and external filtering. As for accessibility, in our case it took some time to get things right — especially because of using Shadow DOM.&lt;/p&gt;

&lt;p&gt;Over the years, our work on &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt; followed the Web Components evolution. We created it using &lt;a href="https://polymer-library.polymer-project.org/1.0/docs/devguide/feature-overview" rel="noopener noreferrer"&gt;Polymer 1&lt;/a&gt; at the time of the so-called “v0” proposals. Then we ported it to following Polymer versions 2 and 3. And this year, we finally migrated to &lt;a href="https://lit.dev" rel="noopener noreferrer"&gt;Lit&lt;/a&gt;. But let’s take a step back to see where it all started.&lt;/p&gt;

&lt;h2&gt;
  
  
  First steps
&lt;/h2&gt;

&lt;p&gt;The initial prototype of &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt; was internally using... a single column data grid! More specifically, an early version of &lt;code&gt;&amp;lt;vaadin-grid&amp;gt;&lt;/code&gt; — another of Vaadin components with an even more fascinating story. Both were parts of the Vaadin Elements set featured on the &lt;a href="https://youtu.be/945pO9Yn1ns?si=pukc3Q2shxKiwS98" rel="noopener noreferrer"&gt;Polycasts episode&lt;/a&gt; by Rob Dodson.&lt;/p&gt;

&lt;p&gt;During the next iteration, the combo-box was updated to use &lt;code&gt;&amp;lt;iron-list&amp;gt;&lt;/code&gt; — a virtual scroller element by the Polymer team (which was even used by Chrome UI, especially history and downloads). Around the same time it was changed to use &lt;a href="https://github.com/vaadin/vaadin-combo-box/pull/105" rel="noopener noreferrer"&gt;overlay teleportation&lt;/a&gt;, adopted by many other Vaadin components later.&lt;/p&gt;

&lt;p&gt;Visually the component was designed to be aligned with a set of Paper Elements by the Polymer team. At the time, the future was looking bright: Web Components started to gain cross-browser support, the Polymer ecosystem was rapidly evolving — and Vaadin Elements team worked hard to catch up. &lt;/p&gt;

&lt;p&gt;The first stable version of &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt; was released in 2016 — that’s when I had a chance to use it in production in my previous company. In just a bit over a year, the component reached &lt;a href="https://github.com/vaadin/vaadin-combo-box/releases/v2.0.0" rel="noopener noreferrer"&gt;version 2.0&lt;/a&gt; based on Polymer 2, with support for stable implementations of custom elements and shadow DOM.&lt;/p&gt;

&lt;p&gt;And that's what is great about Web Components: while the implementation details change over time, ultimately it’s still standard HTML. Both &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt; version 2.0 and this year's upcoming 25.0 release are based on the same standards, and provide mostly the same API: properties, attributes and events.&lt;/p&gt;

&lt;h2&gt;
  
  
  Early days
&lt;/h2&gt;

&lt;p&gt;Starting from 2017, Vaadin Elements were undergoing a major internal overhaul related to styling. While custom elements created by the Polymer team originally were using “CSS mixins” and &lt;code&gt;@apply&lt;/code&gt;, that proposal ended up being &lt;a href="https://www.xanthir.com/b4o00" rel="noopener noreferrer"&gt;abandoned&lt;/a&gt; in favor of shadow parts, which only got implemented in browsers 2 years later.&lt;/p&gt;

&lt;p&gt;That’s when the Vaadin Elements team came up with own future proof solution: &lt;a href="https://github.com/vaadin/vaadin-themable-mixin" rel="noopener noreferrer"&gt;ThemableMixin&lt;/a&gt;, used for style injection into shadow roots. While there was no native &lt;code&gt;::part()&lt;/code&gt; support yet, elements inside &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt;  were updated to provide part attributes (in fact, some of these parts are still there today).&lt;/p&gt;

&lt;p&gt;Also, around this time usage of Paper Elements was replaced with new web components built by Vaadin, like &lt;code&gt;&amp;lt;vaadin-text-field&amp;gt;&lt;/code&gt;, and provided new default styles. These changes marked &lt;a href="https://cdn.vaadin.com/vaadin-combo-box/3.0.5/demo/" rel="noopener noreferrer"&gt;version 3.0&lt;/a&gt;, and I had a chance to contribute to it after joining Vaadin in late 2017. But that was still only the start of the journey.&lt;/p&gt;

&lt;p&gt;The next step of the styling update for Vaadin web components was related to theming. In &lt;a href="https://github.com/vaadin/vaadin-combo-box/releases/v4.0.0" rel="noopener noreferrer"&gt;version 4.0&lt;/a&gt;, which became part of the Vaadin platform 10, we updated &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt; to use the new Lumo theme by default. Later we also added &lt;a href="https://cdn.vaadin.com/vaadin-material-styles/1.3.2/demo/combo-boxes.html" rel="noopener noreferrer"&gt;Material theme&lt;/a&gt;, which could be used by importing different HTML files.&lt;/p&gt;

&lt;p&gt;Yes, back then Polymer 2 was relying on HTML imports — another proposal that didn’t reach cross-browser adoption. It was &lt;a href="https://www.polymer-project.org/blog/2017-08-22-npm-modules" rel="noopener noreferrer"&gt;announced&lt;/a&gt; that the next version will move to ES modules. So in our team, we had to make adjustments to all Vaadin components in preparation for the long-awaited Polymer 3 stable release.&lt;/p&gt;

&lt;h2&gt;
  
  
  The road to Lit
&lt;/h2&gt;

&lt;p&gt;By the end of 2018, Polymer 3.0 was released as stable… just to be effectively deprecated. Google recommended to use new libraries — &lt;a href="https://youtu.be/Io6JjgckHbg?si=qI1_0VShbzoNGrFX" rel="noopener noreferrer"&gt;lit-html&lt;/a&gt; and lit-element for creating Web Components. With our rapidly growing codebase, moving to new libraries would mean a significant amount of work, which we couldn't afford.&lt;/p&gt;

&lt;p&gt;However, at this point the Polymer dependency became a technical debt, while the Lit team built new things that many developers, including myself, were eager to try. This is how Vaadin web components journey to Lit started. However, after some prototyping we were only able to ship a few incomplete &lt;a href="https://dev.to/webpadawan/the-next-generation-of-vaadin-web-components-34k6"&gt;alpha versions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Then it became clear that we need to at least get the codebase to Polymer 3 first. While the main goal was to ship proper TypeScript definitions, while working on this project, I also migrated our tests to &lt;code&gt;@web/test-runner&lt;/code&gt;, a great tool by the &lt;a href="https://modern-web.dev" rel="noopener noreferrer"&gt;Modern Web&lt;/a&gt; team. We still use it for testing Vaadin web components today.&lt;/p&gt;

&lt;p&gt;The next step towards Lit was moving Vaadin web components to the &lt;a href="https://github.com/vaadin/web-components" rel="noopener noreferrer"&gt;monorepo&lt;/a&gt;. Thanks to dropping bower support and significantly faster tests with the new test runner, we could finally consolidate our codebase. This also allowed us to ship internal improvements, like replacing &lt;code&gt;&amp;lt;iron-list&amp;gt;&lt;/code&gt; with the &lt;a href="https://github.com/vaadin/web-components/pull/2339" rel="noopener noreferrer"&gt;new virtualizer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Another milestone worth a separate blog post was improving accessibility of many components including &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt; in Vaadin 22. In this version, we moved interactive elements like &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; to the light DOM. We also improved code sharing using a set of mixins and Lit reactive controllers. &lt;/p&gt;

&lt;h2&gt;
  
  
  Where we are today
&lt;/h2&gt;

&lt;p&gt;Refactoring is hard. Especially, it's hard to justify having to spend months of work on something considered and implementation detail. So it took years for Vaadin web components to be migrated to Lit. And I’m grateful to all my colleagues from the Vaadin design system team for our joint effort to make it happen.&lt;/p&gt;

&lt;p&gt;To make moving to Lit smoother, we created &lt;a href="https://github.com/vaadin/web-components/pull/3655" rel="noopener noreferrer"&gt;PolylitMixin&lt;/a&gt;, a small layer on top of LitElement bringing support for Polymer features like property observers. We also adapted our test setup to run the same set of &lt;a href="https://github.com/vaadin/web-components/pull/8592" rel="noopener noreferrer"&gt;test suites&lt;/a&gt; for both Lit and Polymer. Finally, for every web component we added an experimental Lit version.&lt;/p&gt;

&lt;p&gt;This was especially tricky because of numerous cross-dependencies and certain components being tightly coupled with each other. In case of &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt;, most of its logic was reused in our time-picker component. In Vaadin 23, we added a &lt;a href="https://github.com/vaadin/web-components/pull/3358" rel="noopener noreferrer"&gt;multi-select&lt;/a&gt; version of the combo-box, initially built as an add-on.&lt;/p&gt;

&lt;p&gt;Finally, this year we &lt;a href="https://github.com/vaadin/web-components/pull/9218" rel="noopener noreferrer"&gt;completed&lt;/a&gt; the Lit migration project and removed Polymer dependency from the upcoming Vaadin 25. As for the combo-box logic, it was split it into smaller mixins used by time-picker and multi-select-combo-box components, instead of "internal" versions of combo-box in shadow DOM.&lt;/p&gt;

&lt;p&gt;And one last important change that I’d like to highlight: after almost 10 years, we no longer use DOM teleportation for our overlays! Thanks to the native &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using" rel="noopener noreferrer"&gt;popover API&lt;/a&gt; landing in all modern browsers including Safari 17+, we can keep overlays in shadow DOM of their respective components and use slots for content.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s next
&lt;/h2&gt;

&lt;p&gt;While Vaadin 25 is still in alpha and has some rough edges, you can already try new Lit based versions of Vaadin web components. I’m planning to share more updates about our progress in the upcoming months, as we approach beta and stable release. In the meantime, you can check out following resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://vaadin.github.io/web-components/" rel="noopener noreferrer"&gt;Live demos&lt;/a&gt; of new base styles that make customizing Vaadin web components much easier and will serve as a foundation for the new Aura theme,&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha16/" rel="noopener noreferrer"&gt;New API documentation&lt;/a&gt; built using 11ty static site generator, covering JS, CSS and TypeScript API provided by our web components.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you have never used Web Components yet, it’s definitely worth trying! Despite all the challenges, they eventually proved to be the right choice for Vaadin components. And by the way, the latest &lt;a href="https://bundlephobia.com/package/@vaadin/combo-box@25.0.0-alpha16" rel="noopener noreferrer"&gt;alpha of&lt;/a&gt; of the &lt;code&gt;@vaadin/combo-box&lt;/code&gt; is almost 40% smaller than the &lt;a href="https://bundlephobia.com/package/@vaadin/vaadin-combo-box@5.5.3" rel="noopener noreferrer"&gt;Polymer 3&lt;/a&gt; version from 5 years ago.&lt;/p&gt;

&lt;p&gt;Happy 10 years anniversary to &lt;code&gt;&amp;lt;vaadin-combo-box&amp;gt;&lt;/code&gt;! It’s been a great journey. &lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>vaadin</category>
    </item>
    <item>
      <title>CSS Shadow Parts are coming!</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Tue, 07 Jan 2020 18:23:50 +0000</pubDate>
      <link>https://forem.com/webpadawan/css-shadow-parts-are-coming-mi5</link>
      <guid>https://forem.com/webpadawan/css-shadow-parts-are-coming-mi5</guid>
      <description>&lt;p&gt;Firefox 72 has been released with some &lt;a href="https://wiki.developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/72" rel="noopener noreferrer"&gt;new APIs&lt;/a&gt;, and two of those are good news for the Web Components users. The first one is &lt;a href="https://wiki.developer.mozilla.org/en-US/docs/Web/API/FormDataEvent" rel="noopener noreferrer"&gt;&lt;code&gt;FormDataEvent&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://web.dev/more-capable-form-controls/#event-based-api" rel="noopener noreferrer"&gt;event-based form participation&lt;/a&gt;, previously only available in Chromium. But today I would like to focus on another feature, implemented behind a flag since Firefox 69: &lt;code&gt;part&lt;/code&gt; HTML attribute and &lt;code&gt;::part&lt;/code&gt; pseudo-element.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://drafts.csswg.org/css-shadow-parts/" rel="noopener noreferrer"&gt;CSS Shadow Parts&lt;/a&gt; proposal is among the most waited additions to the standard for developers who create customizable components and design systems. It is a new API for styling individual elements in Shadow DOM from outside. This lets to make a single instance of certain UI widget look slightly differently – an ability that we often need in the real world apps.&lt;/p&gt;

&lt;p&gt;Unlike CSS Custom Properties, which only allow to configure individual values like &lt;code&gt;--primary-color&lt;/code&gt;, a new &lt;code&gt;::part&lt;/code&gt; pseudo-element give us a true flexibility we have been longed for. At Vaadin, we adopted the idea of CSS Shadow Parts already in 2017 as explained in this &lt;a href="https://youtu.be/xSnG-mNWhqI" rel="noopener noreferrer"&gt;talk on theming&lt;/a&gt;. And now we are happy to see that &lt;code&gt;::part&lt;/code&gt; finally gets cross-browser support.&lt;/p&gt;

&lt;h2&gt;
  
  
  History
&lt;/h2&gt;

&lt;p&gt;The idea of custom pseudo-elements, also known as CSS Shadow Parts, has been discussed at least &lt;a href="https://github.com/w3c/webcomponents/issues/300#issuecomment-136716945" rel="noopener noreferrer"&gt;since 2015&lt;/a&gt; but the agreement was reached in early 2017 when it was decided to abandon &lt;a href="https://www.xanthir.com/b4o00" rel="noopener noreferrer"&gt;CSS mixins and &lt;code&gt;@apply&lt;/code&gt;&lt;/a&gt; proposal (never released in Chrome), and to implement &lt;code&gt;::part&lt;/code&gt; instead. Three years after – not too long for web standards – and we are getting there in 2020.&lt;/p&gt;

&lt;p&gt;One note for those who remember a &lt;a href="https://meowni.ca/posts/part-theme-explainer/" rel="noopener noreferrer"&gt;fancy explainer&lt;/a&gt; by Monica Dinculescu: the spec has changed since then. There is now an &lt;a href="https://github.com/fergald/docs/blob/master/explainers/css-shadow-parts-1.md" rel="noopener noreferrer"&gt;updated version&lt;/a&gt; by Fergal Daly. Also, today I'm only talking about &lt;code&gt;::part&lt;/code&gt; because &lt;code&gt;::theme&lt;/code&gt;, another pseudo-element from the original proposal, has been postponed. There are ongoing discussions related to &lt;code&gt;::theme&lt;/code&gt; and its future is rather unclear.&lt;/p&gt;

&lt;p&gt;But the status of &lt;code&gt;::part&lt;/code&gt; looks very promising. It is supported in &lt;a href="https://www.chromestatus.com/feature/5763933658939392" rel="noopener noreferrer"&gt;Chrome&lt;/a&gt; since version 73 and now also in Firefox 72. Safari has already implemented CSS Shadow Parts in &lt;a href="https://webkit.org/blog/9609/release-notes-for-safari-technology-preview-94/" rel="noopener noreferrer"&gt;Technology Preview 94&lt;/a&gt;, and it remains to wait for a stable version to be released – same as for Chromium-based Edge. So it's already time to experiment with &lt;code&gt;::part&lt;/code&gt; and learn how to use it in practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Basic example
&lt;/h3&gt;

&lt;p&gt;According to the &lt;a href="https://github.com/w3c/csswg-drafts/issues/3431#issuecomment-446401804" rel="noopener noreferrer"&gt;comment&lt;/a&gt; by Tab Atkins, one of the spec editors, the point of &lt;code&gt;::part&lt;/code&gt; is to hide the internal details of the web component, and to only expose exactly the parts the component author explicitly wants to.&lt;/p&gt;

&lt;p&gt;Let's go directly to the example. The embedded CodePen below provides an example of styling &lt;a href="https://github.com/vaadin/vaadin-details" rel="noopener noreferrer"&gt;&lt;code&gt;&amp;lt;vaadin-details&amp;gt;&lt;/code&gt;&lt;/a&gt; custom element using &lt;code&gt;::part&lt;/code&gt;. This is a simple component which exposes a few elements using &lt;code&gt;part&lt;/code&gt; attribute.&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/web-padawan/embed/yLyPKJP?height=600&amp;amp;default-tab=result,css&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
Looks like good old vanilla CSS, doesn't it? Even if you open this demo in a browser that doesn't &lt;a href="https://caniuse.com/#feat=mdn-css_selectors_part" rel="noopener noreferrer"&gt;support&lt;/a&gt; &lt;code&gt;::part&lt;/code&gt;, nothing will explode: the component will remain fully functional with the styles that it provides out of the box.&lt;/p&gt;

&lt;p&gt;Using CSS Shadow Parts in simple cases like this one it's cheap. In fact, you only need to add &lt;code&gt;part&lt;/code&gt; HTML attribute on the elements you wish to expose. This leaves a component consumer to choose whether to use this API or not.&lt;/p&gt;
&lt;h3&gt;
  
  
  Using &lt;code&gt;::part&lt;/code&gt; with pseudo-elements
&lt;/h3&gt;

&lt;p&gt;As you may noticed, the above example demonstrates how the details toggle button can he styled using the &lt;code&gt;::part(toggle)::after&lt;/code&gt; CSS selector. We can use &lt;code&gt;::part&lt;/code&gt; this way in combination with any other pseudo elements, too.&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/web-padawan/embed/PowOjYq?height=600&amp;amp;default-tab=result,css&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
As demonstrated in the CodePen above, all the browsers that implement &lt;code&gt;::part&lt;/code&gt; already support this feature. However, please don't expect it to work with non-standard pseudo-elements like &lt;code&gt;::-webkit-scrollbar&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Using &lt;code&gt;::part&lt;/code&gt; with pseudo-classes
&lt;/h3&gt;

&lt;p&gt;Another feature that is often needed for elements inside shadow tree is an ability to style certain states like &lt;code&gt;:hover&lt;/code&gt;. We can achieve it with &lt;code&gt;::part&lt;/code&gt; – and that's how it naturally fits into the way of writing CSS we are used to:&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/web-padawan/embed/RwNjNdJ?height=600&amp;amp;default-tab=result,css&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
While other user-action pseudo-classes like &lt;code&gt;:focus&lt;/code&gt; are also allowed to be used with &lt;code&gt;::part&lt;/code&gt;, the spec clearly states that &lt;a href="https://drafts.csswg.org/selectors-4/#structural-pseudo-classes" rel="noopener noreferrer"&gt;structural pseudo-classes&lt;/a&gt; (e. g. &lt;code&gt;:first-child&lt;/code&gt;, &lt;code&gt;:nth-of-type()&lt;/code&gt;, &lt;code&gt;:empty&lt;/code&gt; and so on) are not supported.&lt;/p&gt;
&lt;h3&gt;
  
  
  Path forwarding with &lt;code&gt;exportparts&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In certain cases, the parts we might need to expose for styling are located in a &lt;strong&gt;nested component&lt;/strong&gt;, which has its own shadow root. That isn't possible with &lt;code&gt;::part&lt;/code&gt; by default, as it does not recursively traverse shadow trees.&lt;/p&gt;

&lt;p&gt;However, there is now &lt;a href="https://drafts.csswg.org/css-shadow-parts/#exportparts-attr" rel="noopener noreferrer"&gt;&lt;code&gt;exportparts&lt;/code&gt;&lt;/a&gt; attribute designed to handle this case. When an element in shadow tree has this attribute, its value defines what parts are "exported" from that element and can be styled with &lt;code&gt;::part&lt;/code&gt;:&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/web-padawan/embed/mdypNmR?height=600&amp;amp;default-tab=result,css&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
As of today, this feature only works as a "whitelist". There was a proposal to also support &lt;a href="https://github.com/fergald/docs/blob/master/explainers/css-shadow-parts-1.md#forwarding-with--" rel="noopener noreferrer"&gt;forwarding with &lt;code&gt;-*&lt;/code&gt;&lt;/a&gt; to have kind of "wildcard". However, it is not currently standardized and therefore not implemented in browsers.&lt;/p&gt;
&lt;h3&gt;
  
  
  Feature detection
&lt;/h3&gt;

&lt;p&gt;In some cases you might want to detect whether a browser supports CSS Shadow Parts or not – for example, to load a different chunk or &lt;code&gt;.css&lt;/code&gt; file with fallback styles. This can be done in JS using the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;part&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;HTMLElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// true if "part" is supported&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no cross-browser way to detect support for &lt;code&gt;::part&lt;/code&gt; using CSS only because &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@supports#selector" rel="noopener noreferrer"&gt;&lt;code&gt;@supports selector()&lt;/code&gt;&lt;/a&gt; API is currently only available in Firefox.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations
&lt;/h2&gt;

&lt;p&gt;While CSS Shadow Parts definitely bring us a lot of flexibility, they still has certain limitations that exist by design. The restrictions related to certain pseudo-classes that are disallowed after &lt;code&gt;::part&lt;/code&gt; belong to them. &lt;/p&gt;

&lt;p&gt;Same as &lt;code&gt;::slotted()&lt;/code&gt; pseudo-element that is already familiar to anyone who uses Shadow DOM, &lt;code&gt;::part&lt;/code&gt; is disallowed to use in complex selectors so you can't use it to style a sibling or child node – only the part itself.&lt;/p&gt;

&lt;p&gt;Another important limitation: it's not possible to use &lt;strong&gt;classes or attribute selectors&lt;/strong&gt; after &lt;code&gt;::part&lt;/code&gt; – these are &lt;a href="https://github.com/w3c/csswg-drafts/issues/3431#issuecomment-446401804" rel="noopener noreferrer"&gt;considered an implementation detail&lt;/a&gt;. One possible workaround for it could be to use &lt;a href="https://github.com/w3c/csswg-drafts/issues/4412" rel="noopener noreferrer"&gt;multiple parts&lt;/a&gt; approach.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/w3c/webcomponents/blob/gh-pages/proposals/custom-states-and-state-pseudo-class.md" rel="noopener noreferrer"&gt;&lt;code&gt;:state()&lt;/code&gt;&lt;/a&gt; pseudo-class is designed to work with &lt;code&gt;::part&lt;/code&gt; and it should cover some use cases by allowing CSS like &lt;code&gt;::part(video):state(playing)&lt;/code&gt; for styling custom elements that are exposed using &lt;code&gt;part&lt;/code&gt; attribute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Documenting
&lt;/h2&gt;

&lt;p&gt;CSS Shadow Parts can be considered &lt;strong&gt;public CSS API&lt;/strong&gt; exposed by a web component. This means that they should follow semantic versioning – so removing or renaming any &lt;code&gt;part&lt;/code&gt; attribute requires a major version bump.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/mdn/web-components-examples/tree/master/shadow-part" rel="noopener noreferrer"&gt;web-component-analyzer&lt;/a&gt; tool supports &lt;code&gt;@csspart&lt;/code&gt; JSDoc annotation that can be used to document CSS Shadow Parts exposed by a custom element, and outputs them as part of experimental JSON format.&lt;/p&gt;

&lt;p&gt;And with the help of the &lt;a href="https://github.com/web-padawan/api-viewer-element" rel="noopener noreferrer"&gt;&lt;code&gt;&amp;lt;api-viewer&amp;gt;&lt;/code&gt;&lt;/a&gt; element (my pet project), you can generate a web component API docs from JSON, including CSS Shadow Parts. By the way, &lt;code&gt;&amp;lt;api-viewer&amp;gt;&lt;/code&gt; itself can be &lt;a href="https://api-viewer-element.netlify.com/" rel="noopener noreferrer"&gt;styled with &lt;code&gt;::part&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgcf9lnmeghmvh4srufd0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgcf9lnmeghmvh4srufd0.png" alt="CSS Shadow Parts API documentation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Learn more
&lt;/h2&gt;

&lt;p&gt;As long as CSS Shadow Parts are relatively new API, there aren't many examples yet. Here are few places where you can see &lt;code&gt;::part&lt;/code&gt; in action:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/elix/elix/search?q=part" rel="noopener noreferrer"&gt;Elix&lt;/a&gt;, a collection of web components that implement common UI patterns by Jan Miksovsky. Elix recommends &lt;a href="https://component.kitchen/elix/customizing#styling-element-parts" rel="noopener noreferrer"&gt;styling element parts&lt;/a&gt; among other approaches for customizing elements appearance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://source.chromium.org/chromium/chromium/src/+/master:ui/webui/resources/cr_elements/" rel="noopener noreferrer"&gt;Chromium Web UI elements&lt;/a&gt;. These web components are &lt;a href="https://bugs.chromium.org/p/chromium/issues/detail?id=973674" rel="noopener noreferrer"&gt;in progress&lt;/a&gt; of being updated to using CSS Shadow Parts instead of CSS mixins. You can see them already used in &lt;a href="https://source.chromium.org/search?q=::part&amp;amp;ss=chromium%2Fchromium%2Fsrc:chrome%2Fbrowser%2Fresources%2F" rel="noopener noreferrer"&gt;several places&lt;/a&gt; like Chrome Settings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://searchfox.org/mozilla-central/search?q=%3A%3Apart&amp;amp;path=browser" rel="noopener noreferrer"&gt;Firefox UI&lt;/a&gt;. As mentioned in the recent &lt;a href="https://briangrinstead.com/blog/firefox-webcomponents/" rel="noopener noreferrer"&gt;blog post&lt;/a&gt; by Brian Grinstead, the process of re-building Firefox UI with Web Components resulted in prioritizing CSS Shadow Parts support among other related features.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/web-platform-tests/wpt/tree/master/css/css-shadow-parts" rel="noopener noreferrer"&gt;The web-platform-tests suite&lt;/a&gt;. This project is very useful to understand how certain features are supposed to work. You can check the &lt;a href="https://wpt.fyi/results/css/css-shadow-parts" rel="noopener noreferrer"&gt;results&lt;/a&gt; to see how CSS Shadow Parts work in the latest browser builds.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mozilla Developer Network already (MDN) provides two articles about &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/::part" rel="noopener noreferrer"&gt;&lt;code&gt;::part&lt;/code&gt; pseudo-element&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part" rel="noopener noreferrer"&gt;&lt;code&gt;part&lt;/code&gt; global attribute&lt;/a&gt;. They also have a dedicated &lt;a href="https://github.com/mdn/web-components-examples/tree/master/shadow-part" rel="noopener noreferrer"&gt;example&lt;/a&gt; in the &lt;code&gt;web-components-examples&lt;/code&gt; project.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, if you want to look into questions that are still under discussion, check out the &lt;a href="https://github.com/w3c/csswg-drafts/labels/css-shadow-parts-1" rel="noopener noreferrer"&gt;CSSWG issue tracker&lt;/a&gt; with the corresponding label.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;CSS Shadow Parts are new API that can be already used in some projects, especially in those cases when graceful degradation approach is acceptable. So I highly recommend evaluating &lt;code&gt;part&lt;/code&gt; and &lt;code&gt;exportparts&lt;/code&gt; to anyone who works on a web components library, UI kit or design system.&lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>css</category>
    </item>
    <item>
      <title>The next generation of Vaadin web components</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Tue, 19 Nov 2019 16:36:52 +0000</pubDate>
      <link>https://forem.com/webpadawan/the-next-generation-of-vaadin-web-components-34k6</link>
      <guid>https://forem.com/webpadawan/the-next-generation-of-vaadin-web-components-34k6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Originally posted on the &lt;a href="https://vaadin.com/blog/next-generation-vaadin-components"&gt;Vaadin blog&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The current set of &lt;a href="https://vaadin.com/components"&gt;Vaadin components&lt;/a&gt; is the result of many years of development. We invested a lot in building high-quality components that are suitable for enterprise-grade apps. Starting from Vaadin 10, every major version ships with a set of new components.&lt;/p&gt;

&lt;p&gt;While we constantly add new features and provide long-term support, there is another important priority that is always paramount in our minds: component performance. Today’s trend is to ship lightweight, performant libraries with &lt;strong&gt;minimal network footprint&lt;/strong&gt; for building faster web apps.&lt;/p&gt;

&lt;p&gt;In this post, we would like to share our ideas on what the next generation of Vaadin components might look like. This is not a roadmap, but rather a summary of the direction that we aim to follow in the coming years, to keep up to date with the rapidly evolving frontend ecosystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the next generation?
&lt;/h2&gt;

&lt;p&gt;We started building the current generation of Vaadin components in the era of Polymer 1 and HTML Imports. While we mainly considered them to be simply an implementation detail, they did to some extent affect our public API, and the architectural decisions we took along the way. &lt;/p&gt;

&lt;p&gt;Now that all the evergreen browsers support ES modules, we can leverage this to improve our codebase a lot. Improvements include reusing and sharing logic and styles between web components in ways that make them more efficient, and easier to customize, extend, and contribute to.&lt;/p&gt;

&lt;p&gt;We also consider the next generation a perfect opportunity to &lt;strong&gt;modernize&lt;/strong&gt; our technology stack. This means that we will eventually replace the Polymer library, which is currently in maintenance mode, with a new set of libraries and tools that allow us to build fast and robust web components.&lt;/p&gt;

&lt;h2&gt;
  
  
  How are we going to do this?
&lt;/h2&gt;

&lt;p&gt;Our plan is to &lt;strong&gt;gradually upgrade&lt;/strong&gt; existing Vaadin components to be based on &lt;a href="https://lit-element.polymer-project.org/"&gt;LitElement&lt;/a&gt;, a lightweight library for creating fast and modern web components built by the Polymer authors. As an additional improvement, we are looking into moving our codebase to &lt;strong&gt;TypeScript&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Thanks to our compliance with web standards, we can be flexible and easily mix web components built using different libraries, especially Polymer 3 and LitElement. So in practice, we will continue to build on the foundation we already have, rather than rewriting from scratch.&lt;/p&gt;

&lt;p&gt;As long as the migration mostly targets the web components, we do not expect major changes to our Java API. We will update the server-side counterparts to ensure that Java developers benefit from a smooth transition to the upcoming next generation of Vaadin components.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does it affect developers using Vaadin?
&lt;/h2&gt;

&lt;p&gt;We are planning to retain the public API of the Vaadin components during the migration, and to avoid breaking changes (unless required), while focusing on the &lt;strong&gt;internal optimizations&lt;/strong&gt;. The API surface will likely only change in a few cases, for example the &lt;code&gt;&amp;lt;template&amp;gt;&lt;/code&gt; element usage. &lt;/p&gt;

&lt;p&gt;One area in which we anticipate significant improvement is the performance of components that use infinite scrolling, like Combo Box, Time Picker and Grid. Another important area that we would like to cover is a more customizable form &lt;strong&gt;validation API&lt;/strong&gt; for the field components.&lt;/p&gt;

&lt;p&gt;As we follow semantic versioning, every web component updated to LitElement will be released as a new &lt;strong&gt;major version&lt;/strong&gt;. On the Java side, we expect minimal changes, mostly related to improving the developer experience by making the API more flexible and easy to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why LitElement?
&lt;/h2&gt;

&lt;p&gt;Since their first stable releases in early 2019, lit-html and LitElement have already been adopted by the web component’s community as a solid replacement for Polymer. These libraries are powering open source UI kits and design systems built by Microsoft, SAP, and VMWare.&lt;/p&gt;

&lt;p&gt;At Vaadin, we bet on the standards-based component model offered by custom elements and shadow DOM standards. These will remain a low-level foundation for our components. With LitElement, we can keep that foundation clean and simple — as we always fight for simplicity.&lt;/p&gt;

&lt;p&gt;We learned a lot about web components while developing with Polymer. And what is especially great is that, according to our estimates and research, with LitElement it will be possible to reuse most of the code we already have and the knowledge we have accumulated over the years. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why TypeScript?
&lt;/h2&gt;

&lt;p&gt;Over the past 2 years, TypeScript has evolved rapidly as a language, and its adoption has grown steadily as well. As you can observe this by looking at &lt;a href="https://www.npmtrends.com/typescript"&gt;npm downloads&lt;/a&gt;: TypeScript usage has doubled in 2019 from about 4 M to more than 8 M monthly npm downloads.&lt;/p&gt;

&lt;p&gt;The biggest benefit of using TypeScript is the nice &lt;strong&gt;developer experience&lt;/strong&gt; that it brings to frontend developers. We also appreciate the comprehensive type definitions for DOM APIs and the type-checking support for lit-html templates that allow us to make Vaadin components even more &lt;strong&gt;reliable&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;From the developer’s point of view, TypeScript support is &lt;strong&gt;purely additive&lt;/strong&gt; and does not require any changes to the workflow and toolchain. You can continue to write JS and get all the benefits, like better editor support and code completion, of the TS type declarations that we will ship.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vp-8eHAe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6m6iucvlruod5axl7ka4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vp-8eHAe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6m6iucvlruod5axl7ka4.png" alt="Code completion with LitElement and TypeScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How do we get there?
&lt;/h2&gt;

&lt;p&gt;As of today, Vaadin has more than 40 components (including Core and Pro), Lumo and Material themes, plus a couple of internal dependencies. We expect that migrating them all will be a &lt;strong&gt;long process&lt;/strong&gt; involving a number of refactorings and requiring a coordinated effort from the team.&lt;/p&gt;

&lt;p&gt;We expect LitElement and Polymer-based components to coexist for a while. This means that new features will be implemented in both versions, as necessary, by cherry-picking the corresponding changes and shipping them as part of Vaadin 14 LTS minor releases.&lt;/p&gt;

&lt;p&gt;The plan for the upcoming months is that we start by moving certain &lt;strong&gt;“leaf” components&lt;/strong&gt; (the ones with the least dependents) to LitElement. At the same time, other components will still be based on Polymer, until we migrate them as well, during one of the iterations that follow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0afSCO9j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u6hegqg7ypi41y1eqgtq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0afSCO9j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u6hegqg7ypi41y1eqgtq.png" alt="&amp;lt;vaadin-details&amp;gt;, a first LitElement-based web component"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are our first steps?
&lt;/h2&gt;

&lt;p&gt;Recently we released &lt;a href="https://github.com/vaadin/vaadin-details/releases/tag/v2.0.0-alpha1"&gt;&lt;code&gt;&amp;lt;vaadin-details&amp;gt;&lt;/code&gt; 2.0.0-alpha1&lt;/a&gt;, a first preview release of the LitElement-based Vaadin component. Even though it is one of the smallest components we have, while working on it, we learned a lot and tested new tools that will help us to be more productive.&lt;/p&gt;

&lt;p&gt;These first steps may not seem valuable from an end-user point of view, but they are, in fact, the &lt;strong&gt;extensive groundwork&lt;/strong&gt; that will facilitate the migration. Among the notable efforts is the fact that we keep the existing unit and visual tests almost the same to prevent occasional regressions.&lt;/p&gt;

&lt;p&gt;We will keep you informed about our progress with the next generation. As we convert more components to LitElement, we will publish them in &lt;strong&gt;Vaadin Labs&lt;/strong&gt; to ask for your feedback. And of course, the development is fully transparent on GitHub: keep a look out for “next” branches.&lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>&lt;api-viewer&gt;: document your Web Components API</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Tue, 22 Oct 2019 13:16:27 +0000</pubDate>
      <link>https://forem.com/webpadawan/api-viewer-document-your-web-components-api-p8j</link>
      <guid>https://forem.com/webpadawan/api-viewer-document-your-web-components-api-p8j</guid>
      <description>&lt;p&gt;Building Web Components is something I enjoy, and it is really easy to create one using &lt;a href="http://lit-element.polymer-project.org"&gt;LitElement&lt;/a&gt;. However, the ecosystem around LitElement is not quite mature yet, and sometimes we don't have a replacement for certain important tools we used to have while developing with Polymer.&lt;/p&gt;

&lt;p&gt;Documenting is one such missing piece. While we can use Storybook with a preset by &lt;a href="https://open-wc.org/demoing/"&gt;open-wc.org&lt;/a&gt; for showcasing different states of our components, there is a thing that we are lacking: a simple tool to browse the API docs. This is exactly what the component I'm sharing today is intended to be.&lt;/p&gt;

&lt;h2&gt;
  
  
  What?
&lt;/h2&gt;

&lt;p&gt;Meet the &lt;a href="https://github.com/web-padawan/api-viewer-element"&gt;&lt;code&gt;&amp;lt;api-viewer&amp;gt;&lt;/code&gt;&lt;/a&gt; element! It is built with LitElement and TypeScript. Check out the &lt;a href="https://api-viewer-element.netlify.com"&gt;live demo&lt;/a&gt; to see what kind of documentation it provides.&lt;/p&gt;

&lt;p&gt;Note, this is just 0.1.0 release and I have a lot of ideas on how to improve the API viewer. Also, the idea behind this component is that we might use it for &lt;a href="https://vaadin.com/components"&gt;Vaadin components&lt;/a&gt; in the future, so there might be some "internal" feature requests over time, but the community feedback is always welcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why?
&lt;/h2&gt;

&lt;p&gt;While we can still use &lt;code&gt;polymer-analyzer&lt;/code&gt; tool and &lt;a href="https://github.com/PolymerElements/iron-component-page"&gt;&lt;code&gt;&amp;lt;iron-component-page&amp;gt;&lt;/code&gt;&lt;/a&gt; component by the Polymer team with LitElement and &lt;a href="(https://polymer-library.polymer-project.org/3.0/docs/tools/documentation)"&gt;document&lt;/a&gt; properties, methods and events, it starts getting complicated if we switch to TypeScript. Also, these components and tools are no longer actively updated.&lt;/p&gt;

&lt;p&gt;Thankfully, there is a &lt;a href="https://github.com/runem/web-component-analyzer"&gt;web-component-analyzer&lt;/a&gt;, a CLI tool by &lt;a href="https://github.com/runem"&gt;Rune Mehlsen&lt;/a&gt;. It provides the ability to extract properties, attributes, methods, events, slots and custom CSS properties of the custom elements and outputs analysis as markdown or JSON (including the format &lt;a href="https://github.com/w3c/webcomponents/issues/776"&gt;proposed&lt;/a&gt; by VSCode team).&lt;/p&gt;

&lt;p&gt;I was looking for a web component compatible with the Analyzer, and I found &lt;a href="https://github.com/bahrus/wc-info"&gt;&lt;code&gt;&amp;lt;wc-info&amp;gt;&lt;/code&gt;&lt;/a&gt; by &lt;a href="https://github.com/bahrus"&gt;Bruce B. Anderson&lt;/a&gt;. While I like the general idea, the component is still not exactly what I needed. So I decided to go ahead and build the &lt;code&gt;&amp;lt;api-viewer&amp;gt;&lt;/code&gt; from scratch, and in a few days I built an MVP.&lt;/p&gt;

&lt;h2&gt;
  
  
  How?
&lt;/h2&gt;

&lt;p&gt;Here is a minimal usage example which you can run using &lt;a href="https://open-wc.org/developing/es-dev-server.html"&gt;es-dev-server&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;api-viewer-element&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;api-viewer&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"./custom-elements.json"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/api-viewer&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the full &lt;a href="https://github.com/web-padawan/api-viewer-element#usage"&gt;usage instructions&lt;/a&gt; to learn how to generate the JSON file. The Web Component Analyzer &lt;a href="https://github.com/runem/web-component-analyzer#-how-to-document-your-components-using-jsdoc"&gt;documentation&lt;/a&gt; is also worth checking.&lt;/p&gt;

&lt;p&gt;And of course, let me know if you have any comments, feature requests or any other feedback regarding &lt;code&gt;&amp;lt;api-viewer&amp;gt;&lt;/code&gt;. Let's make it better together!&lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>Web Components for Enterprise. Part 2: Nuxeo, Ionic, Vaadin  </title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Tue, 23 Jul 2019 20:16:49 +0000</pubDate>
      <link>https://forem.com/webpadawan/web-components-for-enterprise-part-2-nuxeo-ionic-vaadin-22l7</link>
      <guid>https://forem.com/webpadawan/web-components-for-enterprise-part-2-nuxeo-ionic-vaadin-22l7</guid>
      <description>&lt;p&gt;Web Components, like almost any technology in the frontend ecosystem, have supporters and opponents. The opinion polarity is mentioned in the &lt;a href="https://twitter.com/FronteersConf/status/1146751390078918656"&gt;announcement&lt;/a&gt; of this year’s talk by Paul Lewis at Fronteers. By the way, I think it is symbolic that it's going to be the same conference where Web Components have been originally &lt;a href="https://fronteers.nl/congres/2011/sessions/web-components-and-model-driven-views-alex-russell"&gt;introduced&lt;/a&gt; by Alex Russell in 2011.&lt;/p&gt;

&lt;p&gt;While I must admit that Web Components have strengths and weaknesses, I think they deserve deeper research, and in my opinion, there is a certain gap here that I am trying to fill. The observations from my experience and the community became grounding for several blog posts I wrote this year, including this “enterprise” series, and I still have something to tell.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://dev.to/webpadawan/web-components-for-enterprise-part-1-salesforce-oracle-sap-e70"&gt;previous post&lt;/a&gt; was about enterprise-scale software companies, paying a lot of attention to ownership, making proper decisions and staying current with the web standards. But there are many corporations for which the software development is not a core domain, so they usually outsource it, especially when it comes to building web applications for internal use.&lt;/p&gt;

&lt;p&gt;Creating this kind of enterprise-grade apps might be challenging. They are often built with a tight budget, as they don’t bring any direct revenue to the owner. At the same time, these are apps, where the users can spend their entire working day. And finally, such apps tend to have a very long lifespan, which means a years of maintenance, support and painful bug fixing.&lt;/p&gt;

&lt;p&gt;In this blog post, I would like to describe three companies who created the UI development platforms targeting mostly corporate customers using Web Components. A necessary disclaimer: I’m a frontend developer working at Vaadin, a company listed here – so I tried to avoid being biased by providing a more or less equal representation of the compared technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nuxeo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.nuxeo.com"&gt;Nuxeo&lt;/a&gt; is a software company offering an enterprise content management &lt;a href="https://github.com/nuxeo/nuxeo"&gt;platform&lt;/a&gt; written in Java and developed in open source under Apache 2.0 license. Nuxeo claims “zero legacy” and investments in innovation as one of its advantages. On the front-end side, this can be confirmed by the fact that Nuxeo was among the early adopters of Web Components specifications. &lt;/p&gt;

&lt;p&gt;In 2014, Google has implemented so-called “v0” Custom Elements and Shadow DOM proposals in Chrome and was actively advocating them. Nuxeo belongs to companies which &lt;a href="https://www.nuxeo.com/blog/web-components-a-great-standard-for-a-platform-approach/"&gt;got excited&lt;/a&gt; about “using the platform" approach promised by Web Components. As a result, Nuxeo considered these bleeding edge specs as a potential replacement for existing JSF stack.&lt;/p&gt;

&lt;p&gt;The new client for Nuxeo platform called “Web UI 1.0” was &lt;a href="https://www.nuxeo.com/blog/everything-you-need-to-know-about-web-ui/"&gt;presented&lt;/a&gt; in 2017. It was built with Web Components and Polymer 1 (which was using HTML Imports and “v0” proposals under the hood). Also, &lt;a href="https://www.webcomponents.org/author/nuxeo"&gt;nuxeo-elements&lt;/a&gt;, an evolving collection of UI and data visualisation controls used for building web applications with Nuxeo, has been developed in open source.&lt;/p&gt;

&lt;p&gt;There has been a lot of changes in Nuxeo since the decision to use Web Components. In particular, elements collection is now updated to Polymer 3 and moved to &lt;a href="https://github.com/nuxeo/nuxeo-elements"&gt;monorepo&lt;/a&gt;. Finally, JSF has been &lt;a href="https://www.nuxeo.com/blog/jsf-deprecated/"&gt;deprecated&lt;/a&gt; in LTS 2019 release with motivated explanation, and a migration tool helping to convert existing JSF-based projects to Web UI has been released in beta.&lt;/p&gt;

&lt;p&gt;One important decision made by Nuxeo was &lt;a href="https://www.nuxeo.com/blog/nuxeo-web-ui-ie11/"&gt;ending support for IE11&lt;/a&gt; announced in 2018. As we can understand based on the wording about “inordinate amount of time” put into fixing bugs and performance issues, it was a tough call after a lot of struggle. The reality is that IE11 needs backup solution when moving to Web Components (JSF in case of Nuxeo).&lt;/p&gt;

&lt;h2&gt;
  
  
  Ionic
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://ionicframework.com"&gt;Ionic&lt;/a&gt; is a software company offering an open-source MIT-licensed cross-platform UI development toolkit called &lt;a href="https://github.com/ionic-team/ionic"&gt;Ionic framework&lt;/a&gt; and providing commercial services and support. Initially focused on building native-style apps for mobile devices using Cordova and Angular, Ionic eventually came up with own tool: &lt;a href="https://github.com/ionic-team/stencil"&gt;Stencil&lt;/a&gt;, a compiler for Web Components and PWAs.&lt;/p&gt;

&lt;p&gt;According to the recent &lt;a href="https://twitter.com/manucorporat/status/1147438907342118912"&gt;tweet&lt;/a&gt;, core development of Ionic and Stencil is handled by 10 people, and the &lt;a href="https://github.com/orgs/ionic-team/people"&gt;team on GitHub&lt;/a&gt; has only 15 public members. However, since its founding in 2013 Ionic has been focusing on building a product for enterprise usage. This explains the choice of AngularJS, which used to be popular before the rise of React heavily affected JS landscape.&lt;/p&gt;

&lt;p&gt;It took nearly 2 years for Stencil alpha &lt;a href="https://www.youtube.com/watch?v=UfD-k7aHkQE"&gt;announced&lt;/a&gt; at Polymer Summit 2017 to land as &lt;a href="https://github.com/ionic-team/stencil/blob/master/CHANGELOG.md#%EF%B8%8F-100-2019-06-01"&gt;1.0.0&lt;/a&gt; stable release in June 2019. Ionic team is working on new features, especially related to SSR which is usually mentioned as one of the “drawbacks” of Shadow DOM. Recently, pre-rendering and client side hydration &lt;a href="https://twitter.com/adamdbradley/status/1143554342122938368"&gt;demo&lt;/a&gt; was shared by Stencil team as a future improvement.&lt;/p&gt;

&lt;p&gt;One important note about Stencil is that, although it’s based on Web Components, it treats Custom Elements as a compile target. On top of that, Stencil provides an opinionated set of features claimed as key innovations to stay competitive: TypeScript, JSX, virtual DOM, reactive data binding and asynchronous rendering (described as “similar to React Fiber”).&lt;/p&gt;

&lt;p&gt;In the recent &lt;a href="https://dev.to/ionic/why-we-use-web-components-2c1i"&gt;blog post&lt;/a&gt; by Max Lynch, Ionic is claimed to be “somewhere in the middle” of two competing visions about Web Components. Developer experience provided by Stencil is similar both to Angular (TypeScript, decorators) and React (lifecycle callbacks, JSX). Also, Ionic follows the trends around JS frameworks community, like building &lt;a href="https://blog.ionicframework.com/build-your-next-design-system-with-web-components/"&gt;design systems&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vaadin
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://vaadin.com"&gt;Vaadin&lt;/a&gt; is a company offering a framework, components and tools for building web apps in Java. Historically, Vaadin has been powered with GWT and used it for UI components since 2009. Compiling from Java to JavaScript was a key feature back then, but in 2018 Vaadin has moved away from GWT and shipped &lt;a href="https://vaadin.com/blog/but-why-web-components-"&gt;version 10&lt;/a&gt; with UI based on Web Components standards.&lt;/p&gt;

&lt;p&gt;Vaadin is known as one of the pioneers in the Polymer community. Early experiments with Web Components started in 2015 with Polymer 0.8 resulted in creating &lt;a href="https://vaadin.com/blog/building-components-on-top-of-polymer"&gt;Vaadin Elements&lt;/a&gt;: a set of components meant to be a seamless extension to the Polymer element catalog. The initial set contained 5 elements and focused on feature-rich, complex controls, like &lt;a href="https://vaadin.com/blog/reinventing-the-data-grid"&gt;data grid&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Early versions of Vaadin Elements used to depend on Paper Elements and leveraged a lot from that, while also being an example of scaling beyond the Polymer team, mentioned by Rob Dodson in "&lt;a href="https://youtu.be/945pO9Yn1ns?t=408"&gt;Built with Polymer&lt;/a&gt;" polycast episode. However, the need for ownership and especially full control over the codebase, versioning, and appearance has become clear over time.&lt;/p&gt;

&lt;p&gt;The ability to implement own theme, not limited to Material Design, has proven to be the essential feature for customer projects. So, we extended Vaadin components with all the primitives: buttons, text fields, overlays etc. Also, we came up with own &lt;a href="https://youtu.be/xSnG-mNWhqI"&gt;theming approach&lt;/a&gt;, to get rid of the abandoned CSS mixins proposal and &lt;code&gt;@apply&lt;/code&gt; syntax used by Paper Elements.&lt;/p&gt;

&lt;p&gt;As of today, Vaadin components use &lt;a href="https://demo.vaadin.com/lumo-editor/"&gt;Lumo&lt;/a&gt; as a default theme and provide Material version as an alternative. The component set has evolved, and we learned a lot while improving it, including contributions to the polyfills and dealing with browser bugs. Finally, our components are now integrated with &lt;a href="https://vaadin.com/flow"&gt;Vaadin Flow&lt;/a&gt;, a framework bringing Web Components support to Java users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The internal enterprise web applications form a separate world. They are well hidden under NDAs, full of legacy beasts and sometimes not really staying in touch with modern trends like tiny bundle size – who cares about downloading 500 kB of JS on desktop in fast corporate intranets? But certain products aiming to approach these apps are built with Web Components.&lt;/p&gt;

&lt;p&gt;Nuxeo, Ionic and Vaadin are companies offering such products. And they all provide long term support (LTS), either as a premium feature (&lt;a href="https://ionicframework.com/docs/intro/support#long-term-support-premium-"&gt;Ionic&lt;/a&gt;), 3 years of support (&lt;a href="https://doc.nuxeo.com/nuxeo-release-cycle/"&gt;Nuxeo&lt;/a&gt;) or 5 years of support (&lt;a href="https://vaadin.com/roadmap"&gt;Vaadin&lt;/a&gt;). But apart from the fact that one could raise money and be safe about the web platform stability for years, let me outline a few other lessons which I think we can learn:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flexibility&lt;/strong&gt;. Some people who prefer functional approach have been complaining about Custom Elements being class based by design. But the fact that DOM API is using class syntax and prototype inheritance should not limit anyone from implementing own layer of abstraction: &lt;a href="https://css-tricks.com/haunted-hooks-for-web-components/"&gt;hooks&lt;/a&gt;, objects, or even server-side representation of the DOM tree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Themability&lt;/strong&gt;. Usage of Shadow DOM in combination with custom CSS properties for theming appears to be an underestimated feature of the web platform. Most of developers are stick with global CSS and class name conventions, while in theory we now have potentially more scalable and reliable solutions. “Survival of the fittest” in action?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;IE11: a showstopper&lt;/strong&gt;. Although Web Components polyfills support IE11, it is nearly impossible to ensure proper performance of the big apps running in that “&lt;a href="https://techcommunity.microsoft.com/t5/Windows-IT-Pro-Blog/The-perils-of-using-Internet-Explorer-as-your-default-browser/ba-p/331732"&gt;compatibility solution&lt;/a&gt;”. Having to make an app work in IE11, which is often the case for corporate environments, in practice means a need for a separate version (YouTube has one).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There is some hope that more enterprise companies will start considering Web Components over time, especially after &lt;a href="https://www.mozilla.org/en-US/firefox/organizations/"&gt;Firefox ESR&lt;/a&gt; 68 is out. At the time of writing, it is undergoing the so-called qualification and testing period. The support for Custom Elements and Shadow DOM, available since  Firefox 63, will thus become available for an even wider audience.&lt;/p&gt;

&lt;p&gt;And personally, I hope that there will be enough material for the next blog posts in this series later this year. That’s where you, the reader, could help me a lot. If your company is using Web Components, please reach me in the comments, and share what you’ve learned! And of course, feel free to also share any other feedback, I really appreciate it and it keeps me inspired.&lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>Web Components for Enterprise. Part 1: Salesforce, Oracle, SAP</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Tue, 02 Jul 2019 19:41:35 +0000</pubDate>
      <link>https://forem.com/webpadawan/web-components-for-enterprise-part-1-salesforce-oracle-sap-e70</link>
      <guid>https://forem.com/webpadawan/web-components-for-enterprise-part-1-salesforce-oracle-sap-e70</guid>
      <description>&lt;p&gt;Web Components continue to be a subject of debates. Naturally, now when they are supported by all evergreen browsers, some people ask themselves if that should be the “new era”. Then it turns out that new standards are not a silver bullet and don't meet someone’s expectations, not all the bugs are fixed, and some parts of the web platform need further improvement.&lt;/p&gt;

&lt;p&gt;I described few such problems in my previous blog posts (&lt;a href="https://dev.to/webpadawan/beyond-the-polyfills-how-web-components-affect-us-today-3j0a"&gt;1&lt;/a&gt;, &lt;a href="https://dev.to/webpadawan/the-journey-of-web-components-wrong-ways-lacking-parts-and-promising-paths-1d5a"&gt;2&lt;/a&gt;). However, certain opinion leaders having some impact on the JS ecosystem tend to criticise the idea as a whole, by claiming Web Components to be based on wrong assumptions and not practically useful. These statements  have their ground, but they produce a lot of misconception among the community.&lt;/p&gt;

&lt;p&gt;You may not yet be aware of it, but in fact Web Components are now experiencing an impressive growth in the most inert part of the industry: enterprise UI development. The big companies are interested in long term solutions, and some of them learned many painful lessons in the past. That’s why now they express strong signs of support to web standards.&lt;/p&gt;

&lt;p&gt;In this series I will give an overview of several enterprise platforms for business web app development, adopted Web Components as part of the programming model. We will see how they introduce changes while moving towards web standards over time, what value do they bring to the open source ecosystem, and what lessons can we learn from their experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Salesforce
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.salesforce.com"&gt;Salesforce&lt;/a&gt; is a software company offering a CRM platform and a suite of enterprise web applications. Many of those applications came from acquisition, which is often the case for the market expansion, and were built using different stack. At the same time, customers can build their own applications using the Salesforce platform and the tools it offers.&lt;/p&gt;

&lt;p&gt;The case for Web Components at Salesforce was &lt;a href="https://youtu.be/YBwgkr_Sbx0?t=272"&gt;presented&lt;/a&gt; at Google I/O 2019 in the talk by Kevin Schaaf and Caridy Patiño. The main points of the talk are listed in the &lt;a href="https://web.dev/web-components-io-2019#enterprise:-web-components-at-salesforce"&gt;article&lt;/a&gt; by Arthur Evans. The reasons why Salesforce choose Web Components include the need for a common component model ensuring consistent look and feel and backwards compatibility. &lt;/p&gt;

&lt;p&gt;However, there are other valid points in that list, which I personally think are more important – especially, concerns against proprietary solutions, risk of being stuck with legacy technologies and fear of staying in the walled garden of closed ecosystem. This is how “not invented here” symptom clearly manifests itself in a rapidly changing frontend world.&lt;/p&gt;

&lt;p&gt;In the end of 2018, Salesforce &lt;a href="https://developer.salesforce.com/blogs/2018/12/introducing-lightning-web-components.html"&gt;announced&lt;/a&gt; the Lightning Web Components as a new component model for UI development in the platform, leveraging the benefits of the web standards. A special focus was put on the coexistence and seamless interoperability with the previous model, Aura components, with the suggestion to consider migrating to Lightning over time.&lt;/p&gt;

&lt;p&gt;Few months after, Salesforce &lt;a href="https://developer.salesforce.com/blogs/2019/05/introducing-lightning-web-components-open-source.html"&gt;open sourced&lt;/a&gt; the Lightning Web Components framework and presented the &lt;a href="https://github.com/salesforce/lwc"&gt;repository&lt;/a&gt; licensed under MIT, new &lt;a href="https://lwc.dev"&gt;website&lt;/a&gt; and &lt;code&gt;lwc-create-app&lt;/code&gt;  CLI tool allowing to create a new project. Salesforce developer evangelists are also writing blog posts on the related frontend technologies, like unit testing the components with Jest and debugging.&lt;/p&gt;

&lt;h2&gt;
  
  
  Oracle
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.oracle.com"&gt;Oracle&lt;/a&gt; is a corporation which offers a wide variety of enterprise software products, including client-side web applications. Many of these apps are built with &lt;a href="https://github.com/oracle/oraclejet"&gt;Oracle JET&lt;/a&gt;, or JavaScript Extension Toolkit, available under open source UPL license. Note that word “toolkit” represents and emphasises the modular structure: JET is not a framework, but rather a set of libraries.&lt;/p&gt;

&lt;p&gt;In 2017, Oracle &lt;a href="https://blogs.oracle.com/developers/announcing-oracle-jet-40-and-web-components"&gt;introduced&lt;/a&gt; support for Custom Elements in the 4.0 release of JET. This decision was motivated as part of effort to better align with HTML standard and modern specifications. At the same time, new architecture of JET UI components was presented to the audience of UI designers and developers as a better syntax, more intuitive and natural to work with.&lt;/p&gt;

&lt;p&gt;Previously, until 3.2.0 release of JET, all the components were wrapped as jQuery UI widgets. New “syntax” was implemented to work side-by-side with the existing model, and &lt;a href="https://www.oracle.com/webfolder/technetwork/jet-400/globalSupport-releaseNotes.html#upgrade-custom-elements"&gt;migrating&lt;/a&gt; to it was clearly indicated as not required when upgrading to the new version. But all the new features, developer guide updates etc only targeted new web components. &lt;/p&gt;

&lt;p&gt;Note that getting rid of jQuery was not the motivation for using Custom Elements. Two years and 3 major releases after the big change, Oracle JET is still using jQuery, as well as other not so fancy libraries like RequireJS and Knockout (there is even a “&lt;a href="https://www.oracle.com/webfolder/technetwork/jet/globalSupport-FAQ.html#why_knockout"&gt;Why Knockout&lt;/a&gt;” section in FAQ). The &lt;a href="https://www.oracle.com/webfolder/technetwork/jet-700/globalSupport-releaseNotes.html#theme_changes"&gt;transition&lt;/a&gt; from Sass to CSS custom properties in JET also occurs slowly.&lt;/p&gt;

&lt;p&gt;And this is the next lesson we can learn: at enterprise scale, gradual migration is a must. Big companies can’t afford to rewrite everything from scratch, while having to maintain projects for years. Oracle JET seems to keep a reasonable balance between legacy and technology renewal, while also thinking about the ecosystem and having own &lt;a href="https://medium.com/@jtiago/building-the-future-of-oracle-jet-ecosystem-b9bde34cc88d"&gt;vision of the future&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SAP
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://sap.com"&gt;SAP&lt;/a&gt; is a corporation providing enterprise software, including ERP system. For frontend developers SAP offers &lt;a href="https://github.com/SAP/openui5"&gt;OpenUI5&lt;/a&gt; framework available under Apache 2.0 open source license. UI5 is positioned as enterprise-grade JavaScript toolkit for building web applications running on almost any browser, using jQuery as its foundation and following web standards.&lt;/p&gt;

&lt;p&gt;In early 2019, SAP &lt;a href="https://blogs.sap.com/2019/02/11/ui5-web-components-the-beta-is-there"&gt;announced&lt;/a&gt; the beta of UI5 Web Components library, presented as a key pillar of the UI5 Evolution project, aiming to enable independent consumption of UI elements. As it turns out from another &lt;a href="https://blogs.sap.com/2019/01/16/ui5-and-webcomponents-working-together/"&gt;blog post&lt;/a&gt;, SAP developers evaluated Web Components starting from 2014. And now they look really optimistic: “the time has come, the web is ready!”&lt;/p&gt;

&lt;p&gt;Few months after the initial announcement, and at the time of writing &lt;a href="https://github.com/SAP/ui5-webcomponents/releases/tag/v1.0.0-rc.1"&gt;RC1&lt;/a&gt; has been released just in time to be presented at UI5 Con. Apart from keeping a good pace with the actual development, SAP also published a &lt;a href="https://sap.github.io/ui5-webcomponents/"&gt;website&lt;/a&gt; with interactive playground, a &lt;a href="https://blogs.sap.com/2019/04/01/the-fastest-way-to-get-started-with-ui5-web-components/"&gt;tutorial&lt;/a&gt; on how to get started, several demo apps and a &lt;a href="https://open.sap.com/static/ui5-newscast/?name=2019-03-05_ui5newscast008.mp3"&gt;newscast&lt;/a&gt; episode with UI5 lead architect.&lt;/p&gt;

&lt;p&gt;One important note about UI5 Web Components is how they are positioned compared to OpenUI5 as an existing product. There is a special &lt;a href="https://github.com/SAP/ui5-webcomponents#classification-of-ui5-web-components"&gt;section&lt;/a&gt; describing the new components as “complementary offering”, not a successor of OpenUI5. The lesson we can learn from here is the importance of clearly formulated message alongside the architecture update. &lt;/p&gt;

&lt;p&gt;And one more thing, related to the above point: getting rid of jQuery. Here we go again: sometimes the architects have to explain the decisions they make to the users. I strongly recommend reading this &lt;a href="https://blogs.sap.com/2019/02/11/ui5-web-components-the-beta-is-there/#comment-451355"&gt;comment&lt;/a&gt; by Andreas Kunz from SAP to understand how carefully do big companies consider the actual value of tools they use and the impact of decisions they make.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Web Components have reached the broad browser support quite recently: Custom Elements and Shadow DOM shipped in Firefox 63 in October 2018, and Edge based on Chromium is now available in &lt;a href="https://www.microsoftedgeinsider.com/en-us/download/"&gt;canary and dev channel&lt;/a&gt;. Nevertheless, certain enterprise companies have already chosen Web Components as a foundation for their UI development platforms.&lt;/p&gt;

&lt;p&gt;Salesforce, Oracle and SAP are examples of such companies. Their frontend solutions are created using different approaches, and they are all at different stages of adoption of new component models. Comparison of those is not the primary goal of this blog post, so let me outline and briefly formulate the lessons which I think we should learn from their achievements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ownership&lt;/strong&gt;. Preferring web standards over proprietary solutions is driven by the aim to avoid vendor lock-in or being stuck in closed ecosystem. Focus on web standards allows to reduce the barrier to entry for new developers, while also providing full control over the technology stack and promoting the internal competence growth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gradual migration&lt;/strong&gt;. Being able to combine Web Components with other libraries is a key to ensure the smooth transition between two development models. A new approach, initially introduced either as “complementary solution” or “alternative syntax”, has to evolve and stand the test of time to finally supersede an old model.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Impact of decisions&lt;/strong&gt;. Big companies carefully evaluate the choice they make when it comes to upgrading the technology stack, and this is especially relevant for rapidly evolving JavaScript ecosystem. In enterprise UI development, any new feature goes through a long validation phase, this is where the web standards come into play.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the second part of the series, I will continue the overview of frontend toolkits built with Web Component from a slightly different angle. We will explore three different open source platforms which are in themselves provided as products, accompanied with the commercial services – and will hopefully learn a few other lessons from them. Stay tuned!&lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>The Web Components journey: wrong ways, lacking parts and promising paths</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Tue, 16 Apr 2019 19:16:04 +0000</pubDate>
      <link>https://forem.com/webpadawan/the-journey-of-web-components-wrong-ways-lacking-parts-and-promising-paths-1d5a</link>
      <guid>https://forem.com/webpadawan/the-journey-of-web-components-wrong-ways-lacking-parts-and-promising-paths-1d5a</guid>
      <description>&lt;p&gt;In my &lt;a href="https://dev.to/webpadawan/beyond-the-polyfills-how-web-components-affect-us-today-3j0a"&gt;previous blog post&lt;/a&gt; about Web Components, I described several challenging problems still unsolved as of today. The feedback I received was surprisingly warm, and I was feeling excited to be &lt;a href="https://twitter.com/slightlylate/status/1116365413053599744"&gt;mentioned&lt;/a&gt; by Alex Russell, one of the authors of the &lt;a href="https://fronteers.nl/congres/2011/sessions/web-components-and-model-driven-views-alex-russell"&gt;initial proposals&lt;/a&gt;. Some people called my notes a bit of an eye opener, while others mentioned even more problems.&lt;/p&gt;

&lt;p&gt;Taking pink glasses off wasn’t the only goal I wanted to achieve though. My criticism was aiming to identify the pain points, and remind about the importance of consensus. The recent &lt;a href="https://component.kitchen/blog/posts/a-history-of-the-html-slot-element"&gt;blog post by Jan Miksovsky&lt;/a&gt; about the history of HTML &lt;code&gt;&amp;lt;slot&amp;gt;&lt;/code&gt; element is a great illustration of the dead end where we could get same as 5 years ago, by pushing the proposals again.&lt;/p&gt;

&lt;p&gt;Today I would like to expand my vision further and approach the same topic from a slightly different angle, by exploring the path of Web Components towards the wider adoption so far and in the foreseeable future. Same as before, I rely on my personal experience and observations, so feel free to add your own notes, and correct me if you think I’m missing something crucial.&lt;/p&gt;

&lt;p&gt;One more thing from the previous post I would like to remind you about is the upcoming &lt;a href="https://github.com/w3c/webcomponents/issues/802"&gt;“Face to face” (F2F) meeting&lt;/a&gt; regarding Web Components, with the participation of spec authors, browser vendors and users. Yes, there is a slot in the agenda dedicated to the real use cases. That’s good news, and I’m looking forward to see the meeting notes once they are published.&lt;/p&gt;

&lt;h2&gt;
  
  
  The wrong ways
&lt;/h2&gt;

&lt;p&gt;In early 2016, when I was making first steps with Web Components, there wasn’t that much examples. For me, the only source of inspiration at that time was &lt;a href="https://github.com/Polymer/polymer-starter-kit"&gt;Polymer Starter Kit&lt;/a&gt;. It has been changed a lot since then, and was replaced with the LitElement-based successor, &lt;a href="https://github.com/Polymer/pwa-starter-kit"&gt;PWA Starter Kit&lt;/a&gt;. But in a nutshell, they do the same: place &lt;code&gt;&amp;lt;my-app&amp;gt;&lt;/code&gt; component in &lt;code&gt;index.html&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Wrapping a whole SPA into web component is the point where some people start to dream about throwing the frameworks away. At this very moment, in my opinion, they start falling into the pit of using improper patterns. Here I share the concern &lt;a href="https://equinsuocha.io/blog/web-components-the-right-way/"&gt;raised by Mattia Astorino&lt;/a&gt;. And from my previous post you already know how overusing Shadow DOM might strike back. &lt;/p&gt;

&lt;p&gt;Taking the story further, the common feature every SPA needs is a client-side routing. And yes, people have been using Web Components for routing, too. In my former team, we were using &lt;a href="https://github.com/erikringsmuth/app-router"&gt;&lt;code&gt;&amp;lt;app-router&amp;gt;&lt;/code&gt;&lt;/a&gt;, a vanilla v0 custom element from 2014 – and one of the first open source projects I ever have contributed to. At that time, I really liked its way of declarative routing.&lt;/p&gt;

&lt;p&gt;But today it sounds ridiculous to me: first we run JS while registering a custom element, then each time user navigates we search matching routes &lt;a href="https://github.com/erikringsmuth/app-router/blob/6ad9c9ac2d877d1e4a64b6f883baa3991a6200ed/src/app-router.js#L216-L223"&gt;from the DOM&lt;/a&gt; and run JS again. Am I wrong or is there an extra link in the chain? Declarativity is good per se, but trying to use HTML anywhere you need it, or in a way other people use JSX, is again a serious mistake.&lt;/p&gt;

&lt;p&gt;The next framework-specific wheel we had to reinvent was a set of tools for loading data and managing application state. There has been a lack of best practices in this area in Polymer community. In short, we were supposed to use &lt;a href="https://github.com/PolymerElements/iron-ajax"&gt;&lt;code&gt;&amp;lt;iron-ajax&amp;gt;&lt;/code&gt;&lt;/a&gt; to trigger API requests from the DOM, and then store the data again in the DOM – just to completely mess things up. &lt;/p&gt;

&lt;p&gt;Someone would say, once you get locked into a web components collection, the tendency is to push it as far as you can. It can be explained by the fact that Polymer was heavily limited by HTML Imports (thanks to &lt;a href="https://hacks.mozilla.org/2014/12/mozilla-and-web-components/"&gt;Mozilla&lt;/a&gt; for dropping them), and based on some assumptions from the “model driven views” concept, inspired by the dream about &lt;a href="https://addyosmani.com/blog/the-webs-declarative-composable-future/"&gt;"declarative renaissance"&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Talking about HTML, there is still a chance that &lt;a href="https://github.com/w3c/webcomponents/issues/645"&gt;HTML modules proposal&lt;/a&gt; will improve our developer experience and allow to use &lt;code&gt;&amp;lt;template&amp;gt;&lt;/code&gt; more. This is one of the areas where the Edge team is doing contributions to Chromium. While this could help &lt;em&gt;creating&lt;/em&gt; Web Components in a better way, we shouldn't take those wrong ways of &lt;em&gt;using&lt;/em&gt; them anymore.&lt;/p&gt;

&lt;h2&gt;
  
  
  The lacking parts
&lt;/h2&gt;

&lt;p&gt;Back to 2019, what are the better use cases for Web Components today? The first one you probably thought about are UI components, especially complex form controls. Surprisingly, Custom Elements are not currently designed to be picked up when submitting the standard &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; HTML element. The &lt;a href="https://github.com/w3c/webcomponents/issues/187"&gt;form participation API&lt;/a&gt; proposal by Chrome team is expected to fix that.&lt;/p&gt;

&lt;p&gt;When looking at the &lt;a href="https://github.com/w3c/webcomponents/issues/187#issuecomment-467314213"&gt;list of proposed updates&lt;/a&gt; to Custom Elements API, it seems to be a lot of work for browser vendors to agree and implement. Until then, we are unable use HTML form validation and submission without workarounds like &lt;a href="https://github.com/PolymerElements/iron-form"&gt;&lt;code&gt;&amp;lt;iron-form&amp;gt;&lt;/code&gt;&lt;/a&gt; element. In my opinion, Web Components could reach a lot more audience once this issue is finally solved.&lt;/p&gt;

&lt;p&gt;There are few other problems related to using Web Components in forms. One of those is &lt;a href="https://bugs.webkit.org/show_bug.cgi?id=172567"&gt;broken form autofill&lt;/a&gt; for form elements within shadow trees in Safari. Another issue is that password managers like LastPass or 1Password &lt;a href="https://twitter.com/chadhikes/status/1079865767192084480"&gt;do not support&lt;/a&gt; &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; elements in Shadow DOM, as they presumably rely on global API, like &lt;code&gt;document.querySelector()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One more Shadow DOM concern we need to keep in mind is how it affects accessibility. This was &lt;a href="https://robdodson.me/the-future-of-accessibility-for-custom-elements/#butwaittheresmore"&gt;described by Rob Dodson&lt;/a&gt;, but let me repeat in two words: shadow trees introduce the boundaries for IDs in the document, which affects ARIA attributes, like &lt;code&gt;aria-labelledby&lt;/code&gt;. That can sometimes make it harder to make the components both accessible and granular.&lt;/p&gt;

&lt;p&gt;The similar issue with the IDs breaks the internal &lt;a href="https://github.com/w3c/webcomponents/issues/179#issuecomment-438838649"&gt;references in SVG&lt;/a&gt;, when using it inside Shadow DOM. As an example, &lt;code&gt;&amp;lt;use&amp;gt;&lt;/code&gt; element doesn’t work because of how &lt;code&gt;href&lt;/code&gt; references are resolved. Good news is that at least &lt;a href="https://github.com/w3c/webcomponents/issues/772#issuecomment-467191544"&gt;Safari has a solution&lt;/a&gt; supposed to fix that particular bug – which still has to be adopted by all the other browser vendors and then reflected in standards.&lt;/p&gt;

&lt;p&gt;As you can see, at least two seemingly perfect cases to be solved with Web Components – namely, form elements and icons – have been more or less blocked for a while. In my opinion, having such lacking parts not covered for years (including the issues I already mentioned in my previous post) hurts the expansion of the new standards more than anything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  The promising paths
&lt;/h2&gt;

&lt;p&gt;So how could Web Components eventually reach the adoption? The browser support (at least, for basics) is now good. What we really lack today are real examples of using the native component model in production – preferably, in the big projects – and the best practices as a logical outcome of those. This in turn leads to a &lt;em&gt;lack of trust&lt;/em&gt; to Web Components, and so on in a circle.&lt;/p&gt;

&lt;p&gt;There is of course an example of YouTube, which is again a full SPA built with Polymer. But so far we observed mostly complaints about it being &lt;a href="https://twitter.com/cpeterso/status/1021626510296285185"&gt;slow in Firefox and Edge&lt;/a&gt; and causing the decision to &lt;a href="https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/h-JwMiPUnuU/KCiheZSeBQAJ"&gt;postpone&lt;/a&gt; the removal of V0 specs until Chrome 75. Finally, YouTube still doesn’t use native Shadow DOM, but a polyfill (and will most likely continue doing that in future).&lt;/p&gt;

&lt;p&gt;Another case I would like to highlight is GitHub, which switched to &lt;a href="https://github.blog/2018-09-06-removing-jquery-from-github-frontend/#custom-elements"&gt;using Custom Elements&lt;/a&gt; as part of the effort related to moving away from jQuery. What is especially great is how well Custom Elements fit the idea of keeping the content in HTML and progressive enhancement. See &lt;a href="https://github.com/github/details-dialog-element"&gt;details-dialog&lt;/a&gt; and &lt;a href="https://github.com/github/details-menu-element"&gt;details-menu&lt;/a&gt; elements as really good examples of that philosophy.&lt;/p&gt;

&lt;p&gt;Moving forward in search for the hype train where Web Components could in theory jump in, it appears that the today's motto are &lt;a href="https://twitter.com/css/status/1113550993961172993"&gt;design systems&lt;/a&gt;. Reusability and being framework agnostic are the strengths we shouldn’t underestimate; that’s why &lt;a href="https://twitter.com/alisonailea/status/1114203815211753472"&gt;Tesla&lt;/a&gt; has chosen Web Components. We shall see over time how much people consider making the same bet.&lt;/p&gt;

&lt;p&gt;Enterprise companies are potentially the strongest audience for Web Components, and that’s what we see from &lt;a href="https://2018.stateofjs.com/front-end-frameworks/overview/tools-company-size"&gt;State of JS 2018 survey&lt;/a&gt; – check the numbers for Polymer. Let me mention &lt;a href="https://dev.to/thepassle/ing--web-components-aef"&gt;ING&lt;/a&gt; and its team of open source enthusiasts who created &lt;a href="https://open-wc.org"&gt;open-wc&lt;/a&gt;, and Red Hat sponsoring the &lt;a href="https://github.com/patternfly/patternfly-elements"&gt;PatternFly&lt;/a&gt; elements library among the examples of such big companies.&lt;/p&gt;

&lt;p&gt;One of the promising paths would be using Web Components to build an architecture and to embed parts of the application. This concept is known under the name of &lt;a href="https://micro-frontends.org/#the-dom-is-the-api"&gt;Micro Frontends&lt;/a&gt;. It can be questionable to what extent should we use Custom Elements as &lt;a href="https://twitter.com/davatron5000/status/1116795270400864257"&gt;“spicy iframes”&lt;/a&gt;. But at least it’s good to keep in mind that DOM and CSS aren’t necessarily global anymore.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;Back to where we started, let me again emphasize that Web Components are not a silver bullet. They will not replace JS frameworks, despite some people &lt;a href="https://www.dannymoerkerke.com/blog/web-components-will-replace-your-frontend-framework"&gt;claim the opposite&lt;/a&gt;, or even start &lt;a href="https://twitter.com/heydonworks/status/1115510306522959873"&gt;saying bye to React&lt;/a&gt;. In fact, such biased statements usually hurt more than help. That's why I wanted to add my 5 cents to the ongoing discussion and drive it in the right direction.&lt;/p&gt;

&lt;p&gt;The Web Components are safe to use today, regardless of all the unsolved issues requiring further standardization, which I have tried to systematize. Forewarned is forearmed, and I hope you are brave enough to not even fear the Chrome &lt;a href="https://github.com/vaadin/vaadin-grid/issues/1530"&gt;crashes&lt;/a&gt; or &lt;a href="https://github.com/vaadin/flow/issues/5025#issuecomment-462668991"&gt;rendering issues&lt;/a&gt;, which have affected few stable versions. Some things need to stabilise, but it’s not that scary after all.&lt;/p&gt;

&lt;p&gt;The lack of expertise among the developers, &lt;a href="https://github.com/mdn/sprints/issues/967#issuecomment-463272392"&gt;admitted by David Flanagan&lt;/a&gt; during the recent holy war regarding the MDN web docs page header being rewritten in React, doesn’t sound a really valid excuse to me either. As long as most of frontend teams stick to well known stack, how would we adopt for example CSS grid layout, or ES modules supported natively as well?&lt;/p&gt;

&lt;p&gt;So let’s accept the challenge and take it as a chance to be a pioneer, building completely new things with the native component model which the web platform offers. Now in 2019, it’s time to give a try to Custom Elements and Shadow DOM. They might not be “the next big thing” by themselves, but rather solid foundation the next big thing could be built upon.&lt;/p&gt;

&lt;p&gt;I recommend considering Custom Elements, Shadow DOM or both, depending on the actual needs, when starting a new project or refactoring the existing one, to anyone interested in the long-term solution. Also, I would love to hear about the lessons you learned with Web Components – including your own pain points, as I realise that it’s not all roses. &lt;/p&gt;

&lt;p&gt;Finally, I would like to encourage anyone to contribute to the “awesome” list named &lt;a href="https://github.com/mateusortiz/webcomponents-the-right-way"&gt;Web Components: the right way&lt;/a&gt;. As I previously &lt;a href="https://dev.to/webpadawan/web-components-the-right-way-project-relaunch-20d7"&gt;announced&lt;/a&gt;, I’m the maintainer of that project and try to do my best in order to make it a more or less full and up-to-date knowledge base. And, as usual, I’m very grateful to hear your feedback and any comments regarding this blog post. &lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>Beyond the polyfills: how Web Components affect us today?</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Tue, 09 Apr 2019 20:59:15 +0000</pubDate>
      <link>https://forem.com/webpadawan/beyond-the-polyfills-how-web-components-affect-us-today-3j0a</link>
      <guid>https://forem.com/webpadawan/beyond-the-polyfills-how-web-components-affect-us-today-3j0a</guid>
      <description>&lt;p&gt;After the recent public announcement of &lt;a href="https://blogs.windows.com/msedgedev/2019/04/08/microsoft-edge-preview-channel-details"&gt;Chromium-based Edge&lt;/a&gt; canary builds, there has been a lot of excitement on Twitter because of the Web Components finally getting closer to land in all evergreen browsers. The Polymer community has been waiting for it so many years, and I share that feeling. Web Components are here... but I would still say it very carefully.&lt;/p&gt;

&lt;p&gt;Let’s assume we don’t have to support IE11 or any other legacy browsers. So, evergreen browsers with native support for both Custom Elements and Shadow DOM. The good news is that we can forget about &lt;a href="https://github.com/webcomponents/webcomponentsjs"&gt;polyfills&lt;/a&gt;. The bad news is that “zero polyfills” doesn’t really mean “zero bugs”. Today, I would like to share my pain and talk about the problems that still exist.&lt;/p&gt;

&lt;p&gt;The blog post is written based on 3 years of commercial experience with all the Polymer versions since 0.5 (yes, I still remember a weirdness of multiple shadow roots in the same component). During that period, I have been working both on the quite complex production application and a &lt;a href="https://github.com/vaadin/vaadin-core"&gt;web component library&lt;/a&gt;, so my opinion is based on the actual background.&lt;/p&gt;

&lt;p&gt;I’m writing this now also because of the upcoming &lt;a href="https://github.com/w3c/webcomponents/issues/802"&gt;“face to face” (F2F)&lt;/a&gt; meeting regarding the progress on Web Components implementation. Both the browser vendors and the representatives of the companies like GitHub and Salesforce are planning to attend it. The topics to be discussed include the future, which seems bright and shiny, as usual. But today I‘m going to focus more on the present, as there are still issues unlikely to be ever fixed.&lt;/p&gt;

&lt;p&gt;The first one (you guessed) is about &lt;a href="https://developers.google.com/web/fundamentals/web-components/customelements#extendhtml"&gt;extending built-in HTML elements&lt;/a&gt;. Let’s say we want to implement our own anchor and use it for routing, which is a common practice for SPA. I was using such a &lt;a href="https://github.com/erikringsmuth/pushstate-anchor"&gt;web component&lt;/a&gt; at the times of Custom Elements V0 and it worked nicely. But Safari &lt;a href="https://github.com/w3c/webcomponents/issues/509#issuecomment-222860736"&gt;refused&lt;/a&gt; to implement &lt;code&gt;“is”&lt;/code&gt; attribute, as they didn’t want to change HTML parser.&lt;/p&gt;

&lt;p&gt;So, one can not simply extend the anchor (or button, or anything else like that) in Safari. And that’s very unlikely to change, even the corresponding issue has been closed long ago. It’s not even covered by the &lt;a href="https://github.com/webcomponents/custom-elements/pull/88"&gt;“official” polyfill&lt;/a&gt; by Google. Of course, there is a &lt;a href="https://github.com/ungap/custom-elements-builtin"&gt;community polyfill&lt;/a&gt; for it. But does anyone really want to use it and monkey patch the browser internals forever?&lt;/p&gt;

&lt;p&gt;Another problem where consensus with Safari wasn’t met is related to styling Shadow DOM. Specifically, it’s about &lt;a href="https://developers.google.com/web/fundamentals/web-components/shadowdom#contextstyling"&gt;&lt;code&gt;:host-context&lt;/code&gt;&lt;/a&gt; CSS selector, designed to change a web component's styles based on its parent. This kind of inversion of control is not supported anywhere else in CSS. And Safari refused to implement &lt;code&gt;:host-context&lt;/code&gt; and &lt;a href="https://github.com/w3c/csswg-drafts/issues/1914#issuecomment-468864879"&gt;requested to remove&lt;/a&gt; it from the specification. So far, it only works in Chrome. Sounds familiar, doesn’t it?&lt;/p&gt;

&lt;p&gt;The reason why &lt;code&gt;:host-context&lt;/code&gt; is so important is that it’s the only way for the web component to adjust styles based on its parent. As an example, in some CSS frameworks, the &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; placed inside disabled &lt;code&gt;&amp;lt;fieldset&amp;gt;&lt;/code&gt; should look disabled. We can achieve it with global CSS, but with Shadow DOM we can not. The only thing we can really do is... to change our mind.&lt;/p&gt;

&lt;p&gt;One more thing which Shadow DOM affects is handling the focus, especially navigation order when tabbing to any focusable element, like &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt;, inside the shadow root. This again works in Chrome only, with the flag called &lt;a href="https://github.com/w3c/webcomponents/blob/0625cf4c42785aa1202a9d0daed182e12466aa29/proposals/ShadowRoot-delegatesFocus-Proposal.md"&gt;&lt;code&gt;“delegatesFocus”&lt;/code&gt;&lt;/a&gt; passed to &lt;code&gt;attachShadow()&lt;/code&gt; call. One line is expected to do a lot of magic and save us a lot of time once all browsers support it. Until then, we have to use &lt;a href="https://github.com/vaadin/vaadin-control-state-mixin"&gt;temporary&lt;/a&gt; &lt;a href="https://github.com/elix/elix/blob/master/src/DelegateFocusMixin.js"&gt;workarounds&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Did I say “temporary”? At the time of writing, the &lt;a href="https://github.com/w3c/webcomponents/issues/802#issuecomment-477807379"&gt;state of things&lt;/a&gt; sounds like this: nobody has done the work to refactor and &lt;a href="https://github.com/whatwg/html/issues/2013"&gt;integrate the feature&lt;/a&gt; into the HTML specification. And the developer from Chrome, who had been assigned to work on that long ago, has since left the team. So there hasn’t been any progress for almost 3 years. I really hope to see it after F2F meeting.&lt;/p&gt;

&lt;p&gt;Moving forward, we stumble on yet another shadow DOM related thing. So now, a few words about &lt;a href="https://github.com/fergald/docs/blob/master/explainers/css-shadow-parts-1.md"&gt;CSS shadow parts&lt;/a&gt;. They have been recently shipped in Chrome and there has been some interest from Firefox, which is migrating its internals to Custom Elements. But again, no update on &lt;a href="https://bugs.webkit.org/show_bug.cgi?id=149443"&gt;WebKit tracking issue&lt;/a&gt; for more than a year. As a result, yet another Chrome-only feature.&lt;/p&gt;

&lt;p&gt;Unlike the examples above, missing support for CSS shadow parts doesn’t break anything… except that it completely breaks developer experience. In the real world, style encapsulation can be an evil for the users – especially when a web component has a lot of customisable internals, it is hard to provide a flexible architecture using only custom CSS properties.&lt;/p&gt;

&lt;p&gt;In fact, users don’t really want styles to leak out the component. But at the same time, they often want certain styles to magically leak in. Yes, this has been partially covered with the &lt;a href="https://github.com/WICG/construct-stylesheets/blob/gh-pages/explainer.md"&gt;Constructible Stylesheets&lt;/a&gt; (have you been able to guess the only browser supporting them as of today?). But we still need CSS shadow parts to replace &lt;a href="http://www.xanthir.com/b4o00"&gt;abandoned CSS mixins&lt;/a&gt; and &lt;code&gt;@apply&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So far so good, but it looks like I have to mention Safari once again – now because of a more advanced topic. If you have ever tried to use a rich text editor JS library like &lt;a href="https://github.com/ckeditor/ckeditor5-engine/issues/692"&gt;CKEditor&lt;/a&gt;, &lt;a href="https://github.com/quilljs/quill/issues/2021"&gt;Quill&lt;/a&gt;, &lt;a href="https://github.com/ProseMirror/prosemirror/issues/476"&gt;Prosemirror&lt;/a&gt; or even &lt;a href="https://github.com/basecamp/trix/issues/403"&gt;Trix&lt;/a&gt; (which is built with Custom Elements) inside a shadow root, you will understand me. And that’s again the issue to be fixed by the browser vendors.&lt;/p&gt;

&lt;p&gt;Calling &lt;code&gt;document.getSelection()&lt;/code&gt; in Safari doesn’t return nodes from shadow trees. Chrome, in its turn, implements this method also on shadow roots, but Safari &lt;a href="https://bugs.webkit.org/show_bug.cgi?id=163921"&gt;doesn’t&lt;/a&gt;. There has been a &lt;a href="https://github.com/w3c/webcomponents/issues/79#issuecomment-432974389"&gt;rough consensus&lt;/a&gt; at one of the previous F2F meetings and a &lt;a href="https://github.com/w3c/selection-api/issues/98"&gt;related issue&lt;/a&gt; submitted to the corresponding repo. Until this is fixed, we should consider using shadow DOM carefully.&lt;/p&gt;

&lt;p&gt;As you might have noticed, all the issues except the first one are related to Shadow DOM. Even without the ShadyDOM shim making certain monkey-patched API &lt;a href="https://github.com/webcomponents/shadydom/issues/248"&gt;slow&lt;/a&gt; in "good old" Edge, we still have problems to keep in mind. The declarative shadow DOM proposal (needed for server side rendering) &lt;a href="https://github.com/whatwg/dom/issues/510#issuecomment-370995066"&gt;opposed&lt;/a&gt; by the implementers is yet another serious challenge.&lt;/p&gt;

&lt;p&gt;I hope it is now clear why so many people aren’t that excited about Web Components specs. They do provide a missing primitives and solve a certain amount of problems – at the cost of introducing other challenges. So, blind evangelism in support of the Web Components can actually result in backfire, as someone could call them a “broken promise” even today.&lt;/p&gt;

&lt;p&gt;Wrapping it up, I do believe that Web Components are a big thing, and will hopefully make the architecture of our web apps more flexible, and the size of our bundles smaller. They can be compared to CSS grid or ES modules, except the fact that Web Components are coupled with all the underlying parts of the web platform: HTML, CSS, JavaScript and DOM.&lt;/p&gt;

&lt;p&gt;And finally, as already mentioned above, I really hope to update this post in the upcoming weeks and to see at least certain of those tough questions resolved. And if you, the reader, watch as many GitHub repositories and issues as I do, you probably can give me a hand with some inside. Anyways, I would be glad to hear any valuable feedback regarding this post!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;UPD&lt;/em&gt;: Please note, I'm not blaming neither Safari nor Chrome here, and to be honest Firefox has had a number of smaller issues too, once they rolled version 63. The point here is about how much the consensus means, and how long does it take for Web Components APIs to mature and stabilise.&lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>Announcing Aybolit: lightweight web components library built with LitElement</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Wed, 13 Mar 2019 09:41:40 +0000</pubDate>
      <link>https://forem.com/webpadawan/announcing-aybolit-lightweight-web-components-library-built-with-litelement-302f</link>
      <guid>https://forem.com/webpadawan/announcing-aybolit-lightweight-web-components-library-built-with-litelement-302f</guid>
      <description>&lt;p&gt;Yesterday, I released a 0.1.0 version of Aybolit, the pet project I've been working on lately. In two words, it is about writing web components and finding "the common denominator" between popular CSS frameworks.&lt;/p&gt;

&lt;p&gt;The problems Aybolit aims to solve are: granular DOM structure with Custom Elements, scoped CSS thanks to Shadow DOM, and flexible theming API with custom CSS properties and calc(). It also leverages the benefit of Constructible Stylesheets landing in Chrome, as the support for it is already integrated into LitElelment.&lt;/p&gt;

&lt;p&gt;The initial release 0.1.0 only includes 5 components: button, checkbox, progress, range and switch (more to come soon). At the same time, it provides Bootstrap, Bulma and Material versions for all of those, plus "White Label" variant with bare minimum of styles, easy to override.&lt;/p&gt;

&lt;p&gt;I appreciate any feedback and would like to make Aybolit better with the help of community. It's almost 3 years now since I started making first steps with Polymer, and I put all my experience and enthusiasm into this project.&lt;/p&gt;

&lt;p&gt;Check it live: &lt;a href="https://web-padawan.github.io/aybolit/"&gt;https://web-padawan.github.io/aybolit/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source code: &lt;a href="https://github.com/web-padawan/aybolit"&gt;https://github.com/web-padawan/aybolit&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>Web Components: the Right Way. Project relaunch!</title>
      <dc:creator>Serhii Kulykov</dc:creator>
      <pubDate>Tue, 04 Dec 2018 20:04:34 +0000</pubDate>
      <link>https://forem.com/webpadawan/web-components-the-right-way-project-relaunch-20d7</link>
      <guid>https://forem.com/webpadawan/web-components-the-right-way-project-relaunch-20d7</guid>
      <description>&lt;p&gt;Web Components have been one of the most debatable sets of specifications so far. Someone called them "a broken promise", someone &lt;a href="https://frontendmasters.com/books/front-end-handbook/2018/2018.html" rel="noopener noreferrer"&gt;predicted&lt;/a&gt; that in 2018 they would still "lurk" waiting for interest from developers. The path of the Web Components towards the adoption was not strewn with roses. &lt;/p&gt;

&lt;p&gt;Furthermore, this path was really long. It is now more than 7 years since the original ideas by Dimitri Glazkov and Alex Russell were demonstrated. Now, by the end of 2018, there are implementations in Chrome, Safari, and Firefox. And Microsoft, including &lt;a href="https://github.com/w3c/webcomponents/issues/776" rel="noopener noreferrer"&gt;VSCode team&lt;/a&gt;, is working on it too.&lt;/p&gt;

&lt;p&gt;There has been a lot of enthusiasm from the developers excited by the ideas of the componentized future. Early adopters appearing here and there were brave enough to use Web Components in production (and to discover how deep the rabbit hole goes). They were sharing the pain and the knowledge.&lt;/p&gt;

&lt;p&gt;It was 4 years ago, 1 December 2014, when Sindre Sorhus pushed the &lt;a href="https://github.com/sindresorhus/awesome/commit/07b9c6a8b3cc8ede102bc1fc6f2450994ef79326" rel="noopener noreferrer"&gt;commit&lt;/a&gt; to his "Awesome" list, updating it with the new items. Among the others, there was a new list called "Web Components: the Right Way" by Mateus Ortiz, created a few months before that, in October 2014.&lt;/p&gt;

&lt;p&gt;The wave of hype which was about to start in 2014 failed, and there was a period of disbelief. Web Components did not make it to the browsers that fast, future was unclear, React conquered the minds – dramatic story, huh. At some point, the "Right Way" list became unmaintained for a long time.&lt;/p&gt;

&lt;p&gt;So, now what, you ask me? You got it: &lt;a href="https://github.com/mateusortiz/webcomponents-the-right-way" rel="noopener noreferrer"&gt;Web Components: the Right Way&lt;/a&gt; is again bright and shiny – and so Web Components are! I'm happy to announce that from now on, as a collaborator and maintainer, I will do my best keeping the list up-to-date and adding awesome content.&lt;/p&gt;

&lt;p&gt;And now, I need your help and the power of the community to make it even better. We need a centralized knowledge base for anyone learning how to build Web Components. And we can work on it together. Right not there are already links to specs, blog posts, and tutorials – expect more to come.&lt;/p&gt;

&lt;p&gt;Apart from the "introduction" level blog posts, which can be found easily, we need the real use cases – not in the form of marketing buzz, as it sometimes happens. Instead of digging into framework-specific details, let's collect the best practices which can be used regardless of the specific stack.&lt;/p&gt;

&lt;p&gt;If you are looking for the place to watch for what's going on with the Web Components, without following &lt;a href="https://github.com/w3c/webcomponents/issues" rel="noopener noreferrer"&gt;w3c issues&lt;/a&gt;, this repo is a good choice. Also, feel free to submit your &lt;a href="https://github.com/mateusortiz/webcomponents-the-right-way/issues/new" rel="noopener noreferrer"&gt;issues&lt;/a&gt;, if you have some topics to discuss or items worth including to the list. And of course, PRs are welcome! &lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>customelements</category>
      <category>javascript</category>
      <category>html</category>
    </item>
  </channel>
</rss>
