A place to cache linked articles (think custom and personal wayback machine)
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="en">
  4. <!-- Has to be within the first 1024 bytes, hence before the `title` element
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>The Web Component Success Story (archive) — David Larlet</title>
  13. <meta name="description" content="Publication mise en cache pour en conserver une trace.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f7f7f7">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f7f7f7" media="(prefers-color-scheme: light)">
  26. <meta name="theme-color" content="#272727" media="(prefers-color-scheme: dark)">
  27. <!-- Is that even respected? Retrospectively? What a shAItshow…
  28. https://neil-clarke.com/block-the-bots-that-feed-ai-models-by-scraping-your-website/ -->
  29. <meta name="robots" content="noai, noimageai">
  30. <!-- Documented, feel free to shoot an email. -->
  31. <link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
  32. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  35. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  36. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  37. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  38. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  39. <script>
  40. function toggleTheme(themeName) {
  41. document.documentElement.classList.toggle(
  42. 'forced-dark',
  43. themeName === 'dark'
  44. )
  45. document.documentElement.classList.toggle(
  46. 'forced-light',
  47. themeName === 'light'
  48. )
  49. }
  50. const selectedTheme = localStorage.getItem('theme')
  51. if (selectedTheme !== 'undefined') {
  52. toggleTheme(selectedTheme)
  53. }
  54. </script>
  55. <meta name="robots" content="noindex, nofollow">
  56. <meta content="origin-when-cross-origin" name="referrer">
  57. <!-- Canonical URL for SEO purposes -->
  58. <link rel="canonical" href="https://jakelazaroff.com/words/the-web-component-success-story/">
  59. <body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick" data-instant-intensity="viewport-all">
  60. <article>
  61. <header>
  62. <h1>The Web Component Success Story</h1>
  63. </header>
  64. <nav>
  65. <p class="center">
  66. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  67. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  68. </svg> Accueil</a> •
  69. <a href="https://jakelazaroff.com/words/the-web-component-success-story/" title="Lien vers le contenu original">Source originale</a>
  70. <br>
  71. Mis en cache le 2024-01-31
  72. </p>
  73. </nav>
  74. <hr>
  75. <p>Tom MacWright wrote a short post wondering <a class="link" href="https://macwright.com/2024/01/24/on-web-components" data-astro-cid-bi7aps5f>why we don’t see prominent applications using web components</a><a class="tooltip" data-tooltip href="https://macwright.com/2024/01/24/on-web-components" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>On Web Components</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://macwright.com/css/favicon.png" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>macwright.com/2024/01/24/on-web-components</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>.</p>
  76. <p>That’s a fair question!
  77. It’s easy to see the success of frameworks like React and Rails: just look at the thousands of websites built with them.
  78. What does the web component success story look like?</p>
  79. <p>Contrary to some people, I don’t see web components on their own as a huge productivity boon for individual websites.
  80. Once you’ve bought into a particular set of technologies, it makes sense to use it for as much as you can.
  81. If you have a React app, you’d be justifiably skeptical of introducing a second way to build components!</p>
  82. <p>Rather, the biggest benefits I see are <em>collective</em>, cutting across the industry as a whole.
  83. I think web components can make the entire web more accessible.
  84. They have the potential to unify currently fragmented communities, including various JavaScript frameworks <em>and</em> those who avoid them.</p>
  85. <p>I know that’s an audacious pitch, but bear with me.</p>
  86. <h3 id="javascript-framework-interop">JavaScript Framework Interop</h3>
  87. <p>Whenever I write about web components, I see pushback from people in the JavaScript community who seem to think that I want replace to JavaScript frameworks.</p>
  88. <p>If you’re in that camp, let me assuage those fears: the web component success story emphatically does <em>not</em> involve rewriting every React app using web components.
  89. As I’ll continue to say, web components and JavaScript frameworks are <em>complementary</em> (as opposed to <em>competing</em>) technologies.
  90. In fact, I think JavaScript framework apps will be one of the most common places in which web components are used!</p>
  91. <p>Does that mean we’ll all start writing web components in addition to React components?
  92. Not at all.
  93. When I say that web components will be used in JavaScript framework apps, I’m talking about third-party libraries.</p>
  94. <p>JavaScript frameworks are tools, all tools have tradeoffs, yada yada, let’s skip the preamble.
  95. I want to talk about one specific weakness of JavaScript frameworks: interoperability, or the lack thereof.
  96. Almost without exception, each framework can only render components written for that framework specifically.</p>
  97. <p>As a result, the JavaScript community tends to fragment itself along framework lines.
  98. Switching frameworks has a high cost, especially when moving to a less popular one; it means leaving most of the third-party ecosystem behind.</p>
  99. <p>That switching cost stunts framework innovation by heavily favoring incumbents with large ecosystems.
  100. It’s hard to create new frameworks, because each one has to start its own ecosystem from scratch.
  101. We keep rebuilding the same set of primitives over and over and over again.</p>
  102. <p>There’s a famous Joel Spolsky blog post about <a class="link" href="https://www.joelonsoftware.com/2002/06/12/strategy-letter-v/" data-astro-cid-bi7aps5f>why capitalistic tech companies contribute to open source</a><a class="tooltip" data-tooltip href="https://www.joelonsoftware.com/2002/06/12/strategy-letter-v/" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://i0.wp.com/www.joelonsoftware.com/wp-content/uploads/2016/12/11969842.jpg?fit=400%2C400&amp;ssl=1" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>Strategy Letter V</span> <span class="description" data-astro-cid-bi7aps5f>When I was in college I took two intro economics courses: macroeconomics and microeconomics. Macro was full of theories like “low unemployment causes inflation” that never quite stood u…</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://i0.wp.com/www.joelonsoftware.com/wp-content/uploads/2016/12/11969842.jpg?fit=32%2C32&amp;ssl=1" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>www.joelonsoftware.com/2002/06/12/strategy-letter-v/</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>.
  103. Briefly: every product has <em>substitutes</em> (products that can replace it) and <em>complements</em> (products that can be used alongside it).
  104. The big takeaway is that ”<strong>smart companies try to commoditize their products’ complements</strong>”.
  105. In other words, they try to make it so that their own product has a proprietary advantage, while the products used alongside it are all cheap and interchangeable.</p>
  106. <p>Back to JavaScript frameworks.
  107. React and Svelte are substitutes, while React and Radix are complements.
  108. As a library author, the way to commoditize your complement is to make it work with as many frameworks as possible.<sup><a class="link" href="#user-content-fn-reactnative" id="user-content-fnref-reactnative" data-footnote-ref="" aria-describedby="footnote-label" data-astro-cid-bi7aps5f>1</a></sup>
  109. And unlike in Native Land — where people have collectively spent billions of dollars over decades developing write-once run-anywhere environments — the web has one built in.</p>
  110. <p>Maybe you’ve heard of it?
  111. It’s called HTML, and it works with <a class="link" href="https://custom-elements-everywhere.com" data-astro-cid-bi7aps5f>every Javascript framework</a><a class="tooltip" data-tooltip href="https://custom-elements-everywhere.com" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://custom-elements-everywhere.com/images/card.jpg" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>Custom Elements Everywhere</span> <span class="description" data-astro-cid-bi7aps5f>Making sure frameworks and custom elements can be BFFs 🍻</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://custom-elements-everywhere.com/images/favicon.ico" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>custom-elements-everywhere.com</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>.
  112. For all their warts, the fact that web components get this interoperability for free is a <em>ridiculously powerful advantage</em>, and libraries that don’t exploit it are leaving a lot of potential users on the table.</p>
  113. <p>Here’s a concrete example.
  114. <a class="link" href="https://www.xyflow.com" data-astro-cid-bi7aps5f>xyflow</a><a class="tooltip" data-tooltip href="https://www.xyflow.com" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://xyflow.com/img/og/xyflow.jpg" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>Node Based UIs for React and Svelte – xyflow</span> <span class="description" data-astro-cid-bi7aps5f>Powerful open source libraries for building node-based UIs with React or Svelte. Ready out-of-the-box and infinitely customizable.</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://xyflow.com/img/favicon.ico" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>www.xyflow.com</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a> is an excellent library for making flow charts.
  115. It was originally called React Flow, but the maintainers renamed it when they added Svelte support.
  116. <a class="link" href="https://www.xyflow.com/blog/why-svelte-flow" data-astro-cid-bi7aps5f>They had to put in a ton of work just to support that <em>one</em> extra framework</a><a class="tooltip" data-tooltip href="https://www.xyflow.com/blog/why-svelte-flow" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://xyflow.com/img/og/xyflow.jpg" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>Why Svelte Flow? – xyflow</span> <span class="description" data-astro-cid-bi7aps5f>xyflow - Customizable library for rendering workflows, diagrams and node-based UIs.</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://xyflow.com/img/favicon.ico" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>www.xyflow.com/blog/why-svelte-flow</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>!
  117. And if you use Vue, Angular, Solid, Qwik or Ember, you’re still out of luck.</p>
  118. <p>React has enjoyed continued success because it has a moat of fantastic third-party libraries: Radix, React Aria, React Three Fiber, Framer Motion and xyflow, among many others.
  119. Web components have the potential to give us that same ecosystem — but for <em>every</em> framework.</p>
  120. <h3 id="islands-of-interactivity">Islands of Interactivity</h3>
  121. <p>Of course, plenty of websites don’t use JavaScript frameworks.
  122. Hypermedia-centric approaches (read: how websites were built before circa 2010) are making a resurgence, led by libraries such as htmx.</p>
  123. <p>Many websites like this still incorporate highly dynamic elements.
  124. Often, these take the form of rich widgets that are missing from HTML, like menus and combo boxes.
  125. Sometimes they’re even more complicated, like interactive diagrams in articles.
  126. The modern term for these dynamic regions within an otherwise static page is “islands of interactivity”, but the pattern has existed for a long time.</p>
  127. <p>Embedding these islands within the larger page has always been kinda awkward.
  128. The process remains mostly unchanged from the days of jQuery plugins, relying on a complex choreography of HTML classes, CSS selectors and JavaScript function calls.
  129. The bulk of the setup happens in a separate JavaScript file, far away from the HTML where the component will live on the page.</p>
  130. <p>Web components invert that process.
  131. They allow islands to be instantiated in the same way as any other element: by writing a tag name in the page’s markup.
  132. As I wrote in <a class="link" href="https://jakelazaroff.com/words/the-website-vs-web-app-dichotomy-doesnt-exist/" data-astro-cid-bi7aps5f>The Website vs. Web App Dichotomy Doesn’t Exist</a><a class="tooltip" data-tooltip href="https://jakelazaroff.com/words/the-website-vs-web-app-dichotomy-doesnt-exist/" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://jakelazaroff.com/og/the-website-vs-web-app-dichotomy-doesnt-exist.png" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>The Website vs. Web App Dichotomy Doesn't Exist | jakelazaroff.com</span> <span class="description" data-astro-cid-bi7aps5f>A one-dimensional spectrum can't sufficiently capture the tradeoffs involved in web development.</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://jakelazaroff.com/favicon.ico" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>jakelazaroff.com/words/the-website-vs-web-app-dichotomy-doesnt-exist/</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>, web components allow developers to declaratively add dynamic behavior to HTML itself.</p>
  133. <p>What makes web components particularly good companions for hypermedia-oriented libraries is the way they interact with other parts of the page.
  134. While JavaScript framework components tend to do so by invoking callback functions, web components instead embrace one of the web’s core idioms: events. <sup><a class="link" href="#user-content-fn-target" id="user-content-fnref-target" data-footnote-ref="" aria-describedby="footnote-label" data-astro-cid-bi7aps5f>2</a></sup>
  135. Indeed, Carson Gross’s essay <a class="link" href="https://htmx.org/essays/hypermedia-friendly-scripting/#events" data-astro-cid-bi7aps5f>Hypermedia-Friendly Scripting</a><a class="tooltip" data-tooltip href="https://htmx.org/essays/hypermedia-friendly-scripting/#events" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>&lt;/&gt; htmx ~ Hypermedia-Friendly Scripting</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://htmx.org/favicon.ico#events" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>htmx.org/essays/hypermedia-friendly-scripting/#events</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a> neatly outlines this use case:</p>
  136. <blockquote>
  137. <p>A JavaScript-based component that triggers events allows for hypermedia-oriented JavaScript libraries, such as htmx, to listen for those events and trigger hypermedia exchanges. This, in turn, makes any JavaScript library a potential hypermedia control, able to drive the Hypermedia-Driven Application via user-selected actions.</p>
  138. </blockquote>
  139. <p>As an example, here’s a TIL I wrote on <a class="link" href="https://til.jakelazaroff.com/htmx/load-modal-content-when-shoelace-dialog-opens/" data-astro-cid-bi7aps5f>using htmx and the Shoelace web component library to load the content of a dialog when it opens</a><a class="tooltip" data-tooltip href="https://til.jakelazaroff.com/htmx/load-modal-content-when-shoelace-dialog-opens/" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://til.jakelazaroff.com/og/htmx/load-modal-content-when-shoelace-dialog-opens.png" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>[htmx] Load modal content when a Shoelace dialog opens | Today I Learned</span> <span class="description" data-astro-cid-bi7aps5f>A collection of useful things I've learned.</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://til.jakelazaroff.com/favicon.ico" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>til.jakelazaroff.com/htmx/load-modal-content-when-shoelace-dialog-opens/</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>.
  140. Notice how the whole process — from instantiating the dialog component, to requesting the content when the modal opens, to inserting it into the appropriate place in the DOM — is controlled declaratively via markup.</p>
  141. <p>There are also <a class="link" href="https://www.zachleat.com/web/a-taxonomy-of-web-component-types/#html-web-components" data-astro-cid-bi7aps5f>HTML web components</a><a class="tooltip" data-tooltip href="https://www.zachleat.com/web/a-taxonomy-of-web-component-types/#html-web-components" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://v1.screenshot.11ty.dev/https%3A%2F%2Fwww.zachleat.com%2Fopengraph%2Fweb%2Fa-taxonomy-of-web-component-types%2F/opengraph/_x202401_0/" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>An Attempted Taxonomy of Web Components—zachleat.com</span> <span class="description" data-astro-cid-bi7aps5f>A post by Zach Leatherman (zachleat)</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://www.zachleat.com/img/rel-icon-192.jpg#html-web-components" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>www.zachleat.com/web/a-taxonomy-of-web-component-types/#html-web-components</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>, which work by progressively enhancing existing markup rather than by rendering new DOM elements.
  142. Colocating logic in this way, sometimes called <a class="link" href="https://htmx.org/essays/locality-of-behaviour/" data-astro-cid-bi7aps5f>locality of behavior</a><a class="tooltip" data-tooltip href="https://htmx.org/essays/locality-of-behaviour/" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>&lt;/&gt; htmx ~ Locality of Behaviour (LoB)</span> <span class="description" data-astro-cid-bi7aps5f>htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext
  143. htmx is small (~14k min.gz’d), dependency-free, extendable, IE11 compatible &amp; has reduced code base sizes by 67% when compared with react</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://htmx.org/favicon.ico" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>htmx.org/essays/locality-of-behaviour/</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>, is a different lens on <a class="link" href="https://speakerdeck.com/didoo/let-there-be-peace-on-css?slide=62" data-astro-cid-bi7aps5f>a concept with which JavaScript developers should already be familiar</a><a class="tooltip" data-tooltip href="https://speakerdeck.com/didoo/let-there-be-peace-on-css?slide=62" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://files.speakerdeck.com/presentations/ecd310041a6841e0b4680dd85771a6fb/slide_61.jpg?8848622" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>Let There Be Peace On CSS</span> <span class="description" data-astro-cid-bi7aps5f>In the last few months there's been a growing friction between those who see CSS as an untouchable layer in the "separation of concerns" paradigm, and those who have simply ignored this golden rule and found different ways to style the UI (typically applying CSS styles via JavaScript).
  144. This debate is getting more and more intense every day, bringing division in a community that used to be immune to this kind of “wars”.
  145. This talk is my attempt to bring peace between the two fronts. To help these two opposite factions to understand and listen to each other, see the counterpart's points of views. To find the good things they have in common, and learn something from that.
  146. ## This talk has been presented at London CSS Meetup + Design Exchange Nottingham (DXN) + Front End London (FEL) + State of The Browser ##
  147. Video of the talk: https://www.youtube.com/watch?v=bb_kb6Q2Kdc</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://d1eu30co0ohy4w.cloudfront.net/assets/favicon-bdd5839d46040a50edf189174e6f7aacc8abb3aaecd56a4711cf00d820883f47.png" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>speakerdeck.com/didoo/let-there-be-peace-on-css?slide=62</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>.</p>
  148. <h3 id="no-more-silos">No More Silos</h3>
  149. <p>These sound like separate problems, but they’re actually two sides of the same coin.
  150. With web components, the library that works in every JavaScript framework <em>also</em> works as an island of interactivity on a static webpage.
  151. Even HTML web components fit into both niches.</p>
  152. <p>Brad Frost has called for <a class="link" href="https://bradfrost.com/blog/post/a-global-design-system/" data-astro-cid-bi7aps5f>a global design system</a><a class="tooltip" data-tooltip href="https://bradfrost.com/blog/post/a-global-design-system/" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://bradfrost.com/wp-content/uploads/2023/11/CleanShot-2023-11-02-at-13.53.24.png" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>A Global Design System</span> <span class="description" data-astro-cid-bi7aps5f>TL;DR: This is a call to action to create a Global Design System that provides the world's web designers &amp; developers a library of common UI components. A Global Design System would improve the quality and accessibility of the world's web experiences, save the world's web designers and developer</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://bradfrost.com/favicon.ico" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>bradfrost.com/blog/post/a-global-design-system/</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>: “a common library containing common UI components currently found in most design systems”.
  153. The proposal is to create a cohesive, unstyled, accessible and internationalizable set of components — like <a class="link" href="https://www.radix-ui.com/primitives" data-astro-cid-bi7aps5f>Radix</a><a class="tooltip" data-tooltip href="https://www.radix-ui.com/primitives" data-astro-cid-bi7aps5f> <img class="thumbnail" src="https://radix-ui.com/social/primitives.png" alt="" data-astro-cid-bi7aps5f> <span class="title" data-astro-cid-bi7aps5f>Radix Primitives</span> <span class="description" data-astro-cid-bi7aps5f>Unstyled, accessible, open source React primitives for high-quality web apps and design systems.</span> <span class="href" data-astro-cid-bi7aps5f> <img class="favicon" src="https://www.radix-ui.com/favicon.png" alt="" data-astro-cid-bi7aps5f> <span class="url" data-astro-cid-bi7aps5f>www.radix-ui.com/primitives</span> <svg xmlns="http://www.w3.org/2000/svg" class="arrow"> <use href="/icons.svg#share"></use> </svg> </span> </a>, but for the entire web rather than for a single JavaScript framework.
  154. It’s an ambitious goal, and from where I stand web components are by far the best way to achieve it.</p>
  155. <p>Web components won’t take web development by storm, or show us the One True Way to build websites.
  156. They don’t need to dethrone JavaScript frameworks.
  157. We probably won’t even all learn how to write them!</p>
  158. <p>What web components <em>will</em> do — at least, I hope — is let us collectively build a rich ecosystem of dynamic components that work with any web stack.
  159. No more silos.
  160. That’s the web component success story.</p>
  161. </article>
  162. <hr>
  163. <footer>
  164. <p>
  165. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  166. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  167. </svg> Accueil</a> •
  168. <a href="/david/log/" title="Accès au flux RSS"><svg class="icon icon-rss2">
  169. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-rss2"></use>
  170. </svg> Suivre</a> •
  171. <a href="http://larlet.com" title="Go to my English profile" data-instant><svg class="icon icon-user-tie">
  172. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-user-tie"></use>
  173. </svg> Pro</a> •
  174. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel"><svg class="icon icon-mail">
  175. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-mail"></use>
  176. </svg> Email</a> •
  177. <abbr class="nowrap" title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340"><svg class="icon icon-hammer2">
  178. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-hammer2"></use>
  179. </svg> Légal</abbr>
  180. </p>
  181. <template id="theme-selector">
  182. <form>
  183. <fieldset>
  184. <legend><svg class="icon icon-brightness-contrast">
  185. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-brightness-contrast"></use>
  186. </svg> Thème</legend>
  187. <label>
  188. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  189. </label>
  190. <label>
  191. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  192. </label>
  193. <label>
  194. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  195. </label>
  196. </fieldset>
  197. </form>
  198. </template>
  199. </footer>
  200. <script src="/static/david/js/instantpage-5.1.0.min.js" type="module"></script>
  201. <script>
  202. function loadThemeForm(templateName) {
  203. const themeSelectorTemplate = document.querySelector(templateName)
  204. const form = themeSelectorTemplate.content.firstElementChild
  205. themeSelectorTemplate.replaceWith(form)
  206. form.addEventListener('change', (e) => {
  207. const chosenColorScheme = e.target.value
  208. localStorage.setItem('theme', chosenColorScheme)
  209. toggleTheme(chosenColorScheme)
  210. })
  211. const selectedTheme = localStorage.getItem('theme')
  212. if (selectedTheme && selectedTheme !== 'undefined') {
  213. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  214. }
  215. }
  216. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  217. window.addEventListener('load', () => {
  218. let hasDarkRules = false
  219. for (const styleSheet of Array.from(document.styleSheets)) {
  220. let mediaRules = []
  221. for (const cssRule of styleSheet.cssRules) {
  222. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  223. continue
  224. }
  225. // WARNING: Safari does not have/supports `conditionText`.
  226. if (cssRule.conditionText) {
  227. if (cssRule.conditionText !== prefersColorSchemeDark) {
  228. continue
  229. }
  230. } else {
  231. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  232. continue
  233. }
  234. }
  235. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  236. }
  237. // WARNING: do not try to insert a Rule to a styleSheet you are
  238. // currently iterating on, otherwise the browser will be stuck
  239. // in a infinite loop…
  240. for (const mediaRule of mediaRules) {
  241. styleSheet.insertRule(mediaRule.cssText)
  242. hasDarkRules = true
  243. }
  244. }
  245. if (hasDarkRules) {
  246. loadThemeForm('#theme-selector')
  247. }
  248. })
  249. </script>
  250. </body>
  251. </html>