<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Clarity Design System - Medium]]></title>
        <description><![CDATA[Clarity is an open source design system that brings together UX guidelines, an HTML/CSS framework, and Angular components. Visit our website here: http://clarity.design - Medium]]></description>
        <link>https://medium.com/claritydesignsystem?source=rss----a56d7d294514---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Clarity Design System - Medium</title>
            <link>https://medium.com/claritydesignsystem?source=rss----a56d7d294514---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 01 Jun 2026 04:22:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/claritydesignsystem" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Clarity Angular version 12 is available!]]></title>
            <link>https://medium.com/claritydesignsystem/clarity-angular-version-12-is-available-a3f2f93cb7f5?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/a3f2f93cb7f5</guid>
            <category><![CDATA[vmware]]></category>
            <category><![CDATA[clarity-design-system]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Jeremy Wilken]]></dc:creator>
            <pubDate>Wed, 11 Aug 2021 00:13:40 GMT</pubDate>
            <atom:updated>2021-08-11T00:13:40.186Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*41xMfpk3P2U7pJTR8dpZkw.png" /><figcaption>We are celebrating the Clarity Angular release for Angular version 12.</figcaption></figure><h4>We’ve released Clarity Angular v12, and we’re making some simple updates to how we ship Clarity Angular to align better with Angular’s release cycle.</h4><p>We’re excited to announce Clarity Angular has a new version available, with Angular 12 support! This anticipated release is easy to install, run the following with the Angular CLI to update your Clarity Angular packages to the latest release that will work with Angular 12:</p><pre>ng update @clr/angular@12</pre><p>This will update your Clarity Angular packages to the latest release that will work with Angular 12.</p><h4>Why the version change?</h4><p>We are releasing the next major version of Clarity Angular as version 12, which skips a few numbers ahead to align with Angular version numbering. Aligning versions with Angular has the advantage of making it clearer which version of Clarity Angular and Angular are compatible.</p><p>When we released Clarity Angular v1 several years ago, we similarly updated our release cycle to match Angular’s releases. We will continue to update Clarity Angular to work with each new major Angular release.</p><h4>What is new in Clarity Angular?</h4><p>The only changes are related to updates for Angular 12 and TypeScript compatibility. There are no other breaking changes if you are updating from Clarity Angular v5. We will continue to fix and release patches for bugs in Clarity Angular on an ongoing basis as well.</p><p>If you haven’t seen our updated <a href="https://clarity.design/get-started/support/">support strategy</a>, rest assured that we are continuing to maintain and support Clarity Angular into the future as long as there is critical use. As part of that strategy, we also are <a href="https://medium.com/claritydesignsystem/clarity-5-0-jump-start-with-core-web-components-dcb22a51222e">not making major feature improvements and avoiding breaking changes to Clarity Angular</a>, so it can be a long term stable platform for teams who are still using it.</p><h4>What about Clarity Core?</h4><p>We worked to separate our <a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">Clarity Core</a> and Clarity Angular codebases, which will allow us to release each independently of one another. That means that Clarity Core will continue to release under v5.x release branches until we have a breaking change. We are working on a Clarity Core v6 later this year, but more will come on that later.</p><p>We’ve recently launched 7 new Core components into beta: Table, Tree View, Cards, Panel, Vertical Navigation, Breadcrumbs, and Navigation. Documentation about these can be found in our <a href="https://clarity.design/storybook/core/">Storybook demo app</a>, and we’ll be adding them to our <a href="https://clarity.design">main documentation site</a> in the coming months. We’re currently working hard on the Datagrid and Dropdown components and expect the beta versions to arrive in the coming weeks.</p><h4>Common questions</h4><p>Let’s quickly address some of the common questions and concerns that we’ve been answering related to these changes.</p><ul><li>Is Clarity Angular being deprecated or abandoned? — In January we <a href="https://medium.com/claritydesignsystem/clarity-5-0-jump-start-with-core-web-components-dcb22a51222e">outlined our path forward with Clarity Angular</a> and nothing has changed. We will not release any new components or major features in Clarity Angular, but we are continuing to support it with bug fixes and updates for major Angular releases. The goal is to ensure that Clarity Angular is as stable as possible so you can continue to use it as long as you need.</li><li>Can I get the Angular documentation with interactive demos? — Yes, we are nearing completion of several efforts with our documentation, which will bring the original Clarity Angular website back with latest updates. Look for updates on this soon!</li><li>Should I quit using Clarity Angular? — You can safely continue to use Clarity Angular as long as you need it. We recommend that you consider planning your journey for how you expect to evolve your application and anticipate how you can adopt Clarity Core on your own timeline to get the new features, better accessibility, and long term stability. If you start with a new website today, we recommend using as much from Clarity Core as you can, and fill in with Clarity Angular if needed until we have finished Clarity Core components.</li></ul><p>By fully separating Clarity Core and Clarity Angular, we have a better path forward to support our communities while also innovating for our framework independent goals. It is going to enable us to move faster, to more easily document things, and make it easier to support applications looking to transition from Clarity Angular to Clarity Core on their own timeline.</p><p>Got questions? Ask in <a href="https://github.com/vmware/clarity/discussions">GitHub</a> or connect on <a href="https://twitter.com/vmwareclarity">Twitter</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3f2f93cb7f5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/clarity-angular-version-12-is-available-a3f2f93cb7f5">Clarity Angular version 12 is available!</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clarity Design Architecture Part Two]]></title>
            <link>https://medium.com/claritydesignsystem/clarity-design-architecture-part-two-bf9df8ed7a6f?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/bf9df8ed7a6f</guid>
            <category><![CDATA[clarity-design-system]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Colin Miller]]></dc:creator>
            <pubDate>Thu, 15 Jul 2021 14:41:47 GMT</pubDate>
            <atom:updated>2023-03-28T16:01:02.814Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*av2eG0mW_6mdigMJ0eYpMQ.png" /></figure><h4><strong><em>Type System | </em></strong>Spacing and Layout | Theming</h4><p>(Continued from <a href="https://medium.com/claritydesignsystem/clarity-design-architecture-part-one-95ef0adcd30c">Clarity Design Architecture Part One</a>)</p><h3>Type System</h3><p>Design systems need well designed type tools. Too many variations lead to inconsistency, while too few can make achieving proper hierarchy difficult. A carefully selected collection of sizes, weights, letter spacings, line heights and colors, result in the right balance of options to support both consistency and attention to detail. Taken together, these are essential for designers dedicated to creating the visual elegance and usability achieved through vertical rhythm and information hierarchy. The resulting nuanced typography makes the difference between acceptable and great.</p><blockquote><strong><em>Typography is two dimensional architecture, based on experience and imagination, and guided by rules and readability.</em></strong></blockquote><blockquote><em>~ Herrman Zapf</em></blockquote><p>In addition to the wholesale changes in the way our type system is architected, there were a few aspects of the existing system we needed to update. At a pure hierarchy level with regard to size and weight we lacked range, and nuance in line height. Both resulted in reading difficulty and occasional odd rhythms.</p><p>All type classes specified gray with 0% saturation which felt dull and lacking in vibrance especially in lighter values. Classes and tags were tied together. If a designer needed to use the H2 class as the page title (for example), the page structure would violate accessibility requirements, or the developer would have to build in an override. This was creating confusion and brittle code, also adding complexity to responsive design and making upgrades overly complex.</p><h4>Clarity City Open Source Typeface</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOzIoJ9yRrXHLildtQm2OQ.png" /></figure><h3>Type Enhancements</h3><p><strong>Classes: </strong>We created CSS classes that use names such as: <em>Display, Headline, Title, </em>and<em> Section</em>. This decoupling of tags from classes allows designers to structure applications using type elements that best support the information hierarchy, while developers specify headings and paragraphs that structure the document properly. Design, development, and accessibility all get what they need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQHy8SYyDYXYZnLu2xvRCA.png" /><figcaption>Heading Type Classes with Usage based class names</figcaption></figure><p><strong>Line Height Eraser: </strong>We added a customization that has become known as the line-height-eraser. This was done so we could have precise control of line heights. Browsers apply line-height equally even if a line of text is the first, last, or only line of textual content. This means that text always has a little extra padding above and below. This is a common problem when one wants equal space above and below a text element to keep it exactly centered such as in the case of a button label. This is a great article looking into this issue: <a href="https://medium.com/microsoft-design/leading-trim-the-future-of-digital-typesetting-d082d84b202">https://medium.com/microsoft-design/leading-trim-the-future-of-digital-typesetting-d082d84b202</a></p><p>We created a line-height-eraser that keeps all type within a bounding box that matches the character cap-height, so our leading and vertical rhythm can be precisely controlled. The first and last lines of text in a content block have no additional padding supplied by the browser. Visual alignment begins and ends where the actual text does.</p><p>There is a proposal for a new CSS property (leading-trim) that will correct this issue. see: <a href="https://www.w3.org/TR/css-inline-3/">https://www.w3.org/TR/css-inline-3/</a> Leading-trim is still only a proposal awaiting adoption by the CSS Working Group. We couldn’t wait until this was implemented in browsers so we built our own workaround. We expect to no longer need it when leading-trim is supported in browsers. In the meantime, it has enabled the implementation of variable line heights. Big props to <a href="https://medium.com/@mathis_scott">Scott Mathis</a> for his excellent and meticulous work getting this just right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*IICwbLXjzpwtVEtPRXQuGQ.png" /></figure><p><strong>Variable Line Height: </strong>Clarity NG uses a proportional system based on 6 with baselines of 24 px and 12 px. The Clarity Core system is based on 4 and includes a number of line heights with more granularity. Line height has been further enhanced by adding options for <em>compact, default, </em>and<em> expanded</em>. This is primarily because vertical rhythm for type presents several challenges where enterprise applications are concerned. Power-users regularly request tight information density. To such users a broad and elegantly open screen that makes generous use of white space is perceived as wasteful and less usable. Because of this there is a constant awareness of considering opportunities for more compact layouts.</p><figure><img alt="14 px type BODY with Compact 16px, Standard 20px and Expanded 24px line heights" src="https://cdn-images-1.medium.com/max/708/1*dCr9SJG-R_B8nI1SGlnubg.png" /><figcaption><strong>14 px</strong> type BODY with <strong>16 px </strong>Compact, <strong>20 px</strong> Standard, and <strong>24 px </strong>Expanded line heights</figcaption></figure><p>The compact line height is useful when type is within a container such as a table or alert. The needs for vertical rhythm are not defined by the type itself but instead by the bounding box of the container. This is an opportunity for type tighter than one might otherwise prefer. There will also always be screens of the opposite sort — landing and login pages, and those with a need for more broad marketing or magazine style layout. In such screens the type often stands alone. This means it must define the vertical rhythm unambiguously given no devices other than line height and negative space. Here compact line heights look incorrect and fail to create the required structure. To create a well designed, sophisticated and attractive design in such cases, expanded line heights are required. These 3 line height options are available in classes where such different contexts are likely.</p><p>In order to make the line heights work properly with magnification we needed to refer to <em>em</em> values in the parent type class. To solve this we added CSS modifiers which scale line height relative to the parent by 1.25 (condensed) and 1.5 (expanded). These look like this:</p><blockquote><em>&lt;style&gt; <br> [cds-text*=’compact’] { <br> line-height: 1.25; <br> } [cds-text*=’expanded’] { <br> line-height: 1.5; <br> } <br> &lt;/style&gt;</em></blockquote><p><strong>Weight: </strong>For Heading type classes which were previously <em>light</em> (300) we increased the weight to <em>medium</em> (500). The added ink allows greater hierarchy as achieved through contrast between heading and content. VMware designers expressed a lot of support for these extended hierarchy tools. For P types — we added a scale of weights, greatly reducing the number classes.</p><p><strong>Color: </strong>Clarity type classes had been desaturated neutral gray. The new system leverages the cool grays in the color system to add a little bit of vibrancy to the type.</p><p><strong>Sizes: </strong>For Heading types — Some odd sizes (28, 22 and 18) were eliminated in preference to those that work well in a 4 px scale: (24 and 20). 32 and 16 which were present in the old system remained. We added a largest size of 40 px.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LpXPNHlH0VddW6rQSDsS9g.png" /><figcaption>Core class vs Angular class</figcaption></figure><p>For Paragraph types — we reduced the number of sizes available from 8 to 2, referred to as <em>body</em> and <em>secondary</em> preferring to provide variety via 3 weights and enabling all 3 line heights. This includes guidance as to where each is appropriate and the net result is a calming down of an excessive number of small type sizes. For extra small we included <em>caption</em> and <em>caption-small</em> for use in cases such as footnotes, legalese etc.</p><p><strong>Clarity City: </strong>We began the Clarity journey with an open source typeface called Metropolis. We liked many aspects of it and being open source aligned with our position as an open source system. Along the way we discovered some details and omissions we wanted to address and decided the best path forward was to fork Metropolis to Clarity City where we have made several of the changes we wanted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9gy--FkJBBB5K6t42iSsoQ.png" /><figcaption>Differences between Metropolis and Clarity City</figcaption></figure><p>Clarity City is available here:</p><ul><li><a href="https://github.com/vmware/clarity-city">vmware/clarity-city</a></li><li><a href="https://clarity.design/get-started/design/">Designing</a></li></ul><p><strong>Letter spacing: </strong>Metropolis and Clarity City are <em>geometric</em> typefaces with wide characters and generous letter-spacing that take up a fair amount of horizontal space. To the same end of space economy important for enterprise applications, many designers and users have been asking about a more condensed typeface. Because these typefaces are essential to the VMware brand, changing them has been ruled impractical for the time being. Some of this was addressed in Clarity City where we tightened up the horizontal flow (see above). The solution in type classes has been to tighten the tracking (letter-spacing in CSS) by as much as 0.5 px on the largest sizes, only allowing regular or expanded letter spacing on tiny sizes where space is not so jealously guarded. Opening up the spacing in these smallest sizes aids legibility.</p><p><strong>Usage: </strong>In our type survey we found that many designers had questions about usage guidelines and were often concerned with product-to-product consistency. There were also some designers who hadn’t solid grounding in best practices for attributes such as line length / character count and title case / sentence case / all caps etc. Guidelines have been created to address these questions and to provide greater guidance for product-to-product consistency. This is currently a work in progress and will result in a ‘designing with type’ section in our type system documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PY2R4nwZgijY1KSLVY2vTg.png" /><figcaption>Type usage guidelines (excerpt).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_yMWpXxVN0uCLmc4E7AeQ.png" /></figure><h3><strong>Space and Layout</strong></h3><p>Vertical rhythm and information hierarchy are largely controlled by the spacing in and around components (i.e. margin and padding). We had a lot of values coded into the components. This was responsible for inconsistent layout, and brittle code was often created in the process of fine tuning spacing. Product teams did not upgrade as often as they would have preferred to, missing out on new components and enhancements, because re-writing these customizations was often more than their available resources could take on. Similarly, custom components made by product teams didn’t have a set of building blocks to which they could refer. All of this contributed to difficulties with maintaining consistency — one of the key benefits of a successful design system. By creating both space and layout tools we were able to provide design and development tools for consistent rhythmic designs.</p><p><strong>Spacing: </strong>We designed a system which employed space as a token that can be used against a zero margin / padding value to easily and consistently control layouts. The challenge was to keep this set as small as possible. A large set, while useful for fine tuning and subtlety, becomes cumbersome and performance suffers because the way the tokens are used by applications requires generated CSS which increases the number of values significantly.</p><p>The resulting set comprises 2 categories. The first are the <strong><em>space</em></strong> tokens. This is a larger set of values that are used for building components. These allow the construction of components to follow consistent principles and makes them scale properly given things like browser zoom, as well as preparing them to function appropriately in different tech stacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xwfRfnhJsyz2U8n3B4xMvg.png" /><figcaption>Token based <strong>-space-</strong></figcaption></figure><p>The second set are the <strong><em>layout-space</em></strong> tokens. This is a smaller set which are used for controlling the white / negative space between components. These spacing tokens are in t-shirt sizes allow designers and developers to share a common language. A designer can specify “Use an SM here” and if upon review it is determined that the space needs adjustment, the selected token can be swapped. “Lets try an MD instead”. This becomes extremely useful not only for efficiency but also consistency within applications, and should greatly reduce the effort required when upgrading. This set results in a lot of generated CSS so we kept it to 9 values from <strong>xxxs</strong> to <strong>xxxl</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*oo6cPP-_593qXeJcJKAFEg.png" /><figcaption>Token based <strong>-layout-space-</strong></figcaption></figure><p><strong>Layout Utilities: </strong>The companion to our spacing tokens are the layout utilities. These create sets of objects defined by their relationship to one another and the page. Layouts include arrangements such as vertical, horizontal, grid, wrap, stretch/shrink, align, fill, and responsive. With spacing tokens, referred to as <strong><em>gap</em></strong> by the layout utilities, a designer and developer can work together to define how a group of objects is to be arranged. These function just as auto-layout does in Figma.</p><p>There are three layouts, horizontal, vertical and grid. Each support main and cross axis alignment. The layouts and Figma auto layout API are almost a 1:1 match. Naming is slightly different.</p><p>direction: cds-layout=&quot;horizontal/vertical/grid&quot;<br>alignments: cds-layout=&quot;align:top/bottom/right/left&quot;<br>distribution: cds-layout=&quot;gap:xxxs/xxs/xs/sm/md/lg/xl/xxl/xxxl&quot;<br>padding: cds-layout=&quot;p:xxxs/xxs/xs/sm/md/lg/xl/xxl/xxxl&quot;</p><p>Figma <em>autolayout</em> is similar to how CSS Flexbox works. &quot;Auto Layout should be a thoughtful subset of flexbox.&quot; <a href="https://www.figma.com/blog/behind-the-feature-the-making-of-the-new-auto-layout/">https://www.figma.com/blog/behind-the-feature-the-making-of-the-new-auto-layout/</a> The main thing Figma doesn’t have is Grid layout. Hopefully at some point they will be able to add support.</p><p>We added these layout-space components to Figma. By including the different sizes as variants employing the same names they have in the code, and using them with Figmas auto-layout function, the method almost exactly mirrors the implementation. Switching a <strong><em>space-token</em></strong> causes the layout to realign in the same way an application screen will when developer specifies a different size in the code.</p><h4>Layout</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z4-pS-JXreXEtfVvVsZTCQ.png" /></figure><h3><strong>Theming</strong></h3><p>All of these enhancements have allowed us to create a theming paradigm that is simple and elegant. Where our theme switching code was previously in the neighborhood of 17,000 lines of generated CSS it now is around 50. This huge change is largely due to the availability of CSS variables, and dropping IE11 made this massive improvement possible.</p><p>This represents a fantastic performance enhancement, and a 10x reduction in code we need to maintain. Less code to maintain means fewer mistakes or inconsistencies. Product teams can load any number of themes since they’re small or they may do so on demand, and in both situations they don’t experience a performance hit. With Clarity Core we can switch between themes with ease and we are assessing how this may enable other useful enhancements in terms of customization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dx7gdNVn3Pnzzq6f74PbhQ.png" /><figcaption>Dark and Light theme status colors</figcaption></figure><p>With the way the system is now architected, themes can use tokens and aliases to control a lot more than just color. Everything that one might wish to have control of from type scales and spacing to corners and shadows is controlled by tokens, so with a little bit of ingenuity (and lots of due diligence for accessibility) all can be adjusted and customized as needed. We foresee theming being useful for all sorts of things moving forward. A future article will discuss the how and what of theming Clarity Core as we continue to expand the system to serve additional needs.</p><h3><strong>Conclusion</strong></h3><p>All of these enhancements have allowed us to create a system that is much more useful for the key pain point we wanted to address, that being collaboration between design and development.</p><p>The opportunity to rearchitect a design system is rare and not to be taken lightly. With Clarity we embraced the opportunity to look into a lot of things we wanted to improve that might otherwise be impossible due to the cost of breaking changes to a large number of product teams using the system. We feel we have made a lot of innovative improvement to our system and are getting positive reviews from design and development and the enhanced collaboration we sought to achieve is already paying dividends. No discussion of this work would be complete without recognition of the amazing group of developers who brought this all to life, keeping this designer humble in awe of the brilliant work it takes to make it happen: Big up <a href="https://medium.com/@coryrylan">Cory Rylan</a>, <a href="https://medium.com/@gnomeontherun">Jeremy Wilken</a>, <a href="https://medium.com/@jeeyun.lim">Jeeyun Lim</a>, and <a href="https://medium.com/@mathis_scott">Scott Mathis</a>.</p><p>Clarity remains open source and we encourage anyone with an interest to take a look and see what our system can do for you. We appreciate all feedback and contributions. We’d love to hear from you.</p><ul><li><a href="https://medium.com/claritydesignsystem">Clarity Design System</a></li><li><a href="https://twitter.com/VMwareClarity">JavaScript is not available.</a></li><li><a href="https://github.com/vmware/clarity">vmware/clarity</a></li></ul><h3>Links and further information</h3><ul><li><a href="https://clarity.design/core-components/">Web Components Overview</a></li><li><a href="https://clarity.design/get-started/developing/">Core (@cds/core) | Clarity Design System</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf9df8ed7a6f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/clarity-design-architecture-part-two-bf9df8ed7a6f">Clarity Design Architecture Part Two</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clarity Design Architecture Part One]]></title>
            <link>https://medium.com/claritydesignsystem/clarity-design-architecture-part-one-95ef0adcd30c?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/95ef0adcd30c</guid>
            <dc:creator><![CDATA[Colin Miller]]></dc:creator>
            <pubDate>Tue, 06 Jul 2021 19:09:09 GMT</pubDate>
            <atom:updated>2021-07-19T18:25:16.476Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*roKQpsFUkrEG4xcA-G2mag.png" /></figure><h4><strong><em>Enhanced Collaboration | Color System</em></strong></h4><p>We recently embarked on the large project of updating the way the design foundation of Clarity is built and organized. This article and its companion will go into the changes and enhancements we’ve made to our color, type, space and layout, and theming systems. These are all essential foundational parts of Clarity, and the opportunity to reimagine them has been both fulfilling and fruitful.</p><h3>First things first</h3><p>Where do you start when reimagining an already mature and well-adopted system? How can observation and understanding of the challenges in the current system help us to design and build an updated one that works better for everyone?</p><blockquote>What changes and enhancements will most benefit our users?</blockquote><blockquote>What are the use cases and pain points to which these apply?</blockquote><blockquote>What research should we do to support this?</blockquote><p>Referring to these questions while reviewing our day-to-day Slack discussions, office hours, and research initiatives, as well as feature and component requests, all pointed us in the direction of <strong>Enhanced Collaboration </strong>between design and development<strong>.</strong></p><p>This idea of enabling designers and developers to collaborate more effectively based on a shared understanding became our focus. Given this guiding principle, we ask: What are the challenges to address in achieving this goal? How do we evolve a system already extensively employed in production?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tR85edjJJN6QEdv_xzm-pw.png" /></figure><blockquote><strong>One of the most interesting challenges is how to evolve a system that is mature, already working, and well adopted.</strong></blockquote><h3>Making Decisions</h3><p>To reach our goal, we had to answer many questions: How do we introduce breaking changes when they will cost product teams additional development effort and possibly introduce inconsistencies in cross-product workflows? How do we continue to evolve while supporting legacy browsers? How do we support development teams using various JavaScript frameworks? What kind of support and documentation will we need to provide? How do we help teams plan version upgrades?</p><p>With Clarity, these challenges included: Over 100 products and a highly engaged open source community, each using various releases and aspects of the system, and support for a large selection of browsers. These products are used by companies worldwide in every imaginable configuration. With such formidable challenges, a mature design system can find its success becoming a liability. Change must be methodical and incremental, considering how users will adapt, adopt, and migrate. We made a few key decisions and these gave us the freedom to significantly reimagine and rework the way the system is architected and implemented.</p><p><strong>These decisions:</strong></p><blockquote><strong>Web components — known as Clarity Core.</strong> This reworking of the library allows us to be framework independent. React teams can avail themselves of the benefits of the library while Angular teams can integrate web components piecemeal. See this article from <a href="https://medium.com/@mathis_scott">Scott Mathis</a> covering our web components strategy. <a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc</a></blockquote><blockquote><strong>A ‘small shift’ approach. </strong>Visual and functional parity for equivalent components would remain close enough to not be an impediment to incremental adoption.</blockquote><blockquote><strong>Discontinuing support for IE 11</strong>. This was primarily because most Web APIs needed in modern Web apps are not supported. Since we made this decision, wider discontinuation of IE (Microsoft and Google Angular) has come.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tlRfi8bqxYgxzKgNEIcgxQ.png" /></figure><p>With these added opportunities and a few impediments removed, we embarked on re-architecting the system. This work included a few enhancements I’ve been wanting to add for a while.</p><h3><strong>Enhancements</strong></h3><p><strong>Color System: </strong>Offering both light and dark themes guided us towards creating a universal color system using tokens and aliases. This allows consistency, control for accessibility concerns, semantic accuracy when it comes to status, object and interaction styles, effortless theme switching, and additional useful structures such as support for a charts system. Switching to HSL was helpful by enabling alignment around exact hue choices, then using lightness and saturation adjustments to ensure accessibility everywhere. Once this foundational system of colors-as-global-tokens was created, a system of functional aliases was added to define usage in a semantic way, ensuring all traffic-light / icon / UI control / interaction style colors were consistent across applications.</p><p><strong>Type System: </strong>Typography is always a top concern for any designer seeking to create visual elegance while achieving the usability benefits of finely crafted vertical rhythm and information hierarchy. Clarity’s initial type system had a few things I wanted to address with regard to this. The largest sizes were <em>light</em> and maxed out at 32 px. Line heights were based on a rigid adherence to 24 px with occasional allowance for 12 px resulting in some running text being overly tight while other text was excessively broad. Both can result in reading difficulty and occasional odd rhythms.</p><p>All type classes were gray values with 0% saturation which can be perceived as dull and lacking in vibrance. Classes and tags were tied together — when a designer wanted to use a class in a way that was at odds with its tag, the document would violate accessibility or the developer would have to build in an override. This created discontinuity between appearance and structure. These overrides often subvert the cascading aspect of CSS, meaning that upgrades might produce no effect and require teams to manually rewrite their code.</p><p><strong>Space and Layout: </strong>Vertical rhythm and layout are often largely impacted by how components are built regarding margin and padding, and how these values are controlled. We had a lot of values coded into the components rather than abstracted to the system level. This sometimes led to inconsistent layout and brittle code as well as responsive and zoom problems. In addition, custom components made by product teams didn’t have a set of building blocks to which they could refer. All of this contributed to difficulties with maintaining consistency — one of the key benefits to a design system, and a very important one at VMware considering how many products and cross-product workflows Clarity impacts. By creating both spacing tokens and layout utilities, we were able to provide design and development with the tools for consistent rhythmic designs, as well as the flexibility to easily customize layout as needed.</p><p><strong>Theming: </strong>All of these systems have allowed us to create a theming mechanism that is simple and elegant. With Clarity Core we can switch between light and dark themes with ease, and we are considering how this may enable many other useful customizations.</p><h3><strong>Color System</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DXTbWhf1vPcr4_6KcfFwsg.png" /><figcaption>Clarity Core global Color</figcaption></figure><p>New for Clarity Core is a redesigned color system. We took this opportunity to address a few things we wanted to update. These include:</p><blockquote><strong><em>Switch to HSL</em></strong></blockquote><blockquote><strong><em>Increased saturation</em></strong></blockquote><blockquote><strong><em>Non-neutral grays</em></strong></blockquote><blockquote><strong><em>Global tokens</em></strong></blockquote><blockquote><strong><em>Functional aliases</em></strong></blockquote><blockquote><strong><em>Aesthetic enhancements</em></strong></blockquote><blockquote><strong><em>Charts palettes</em></strong></blockquote><p><strong>HSL</strong> — we like HSL because the values are human-readable. It doesn’t take a lot of familiarity with the way colors work to learn where various hues fall. With this basis the saturation and lightness values become self-explanatory. Looking at the 3 numbers will give you a pretty good idea what color you are going to get. Tints, tones, and shades stay pegged to a central hue and calculating compliments is simple (add or subtract 180 from the hue). This also eases shifting hue either for simple warmer / cooler adjustments, or in more sophisticated cases such as keeping yellows fresh as they get darker. Hue shifting is also useful for multi-color gradients often preferable in data visualization and for colorblind users. see: <a href="https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html">cran.r-project.org intro-to-viridis</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wJKHLAHZ0zwsxaaYBdRYIQ.png" /><figcaption>HSL color INFO and complement</figcaption></figure><p><strong>Increased Chroma</strong> — Upon reviewing the system as a whole, examining a lot of product screens, and interviewing many product designers, we found support for our observation that the system was lacking in saturation. Every opportunity to make an adjustment that favored a little more juice in the chroma was embraced, leading to a more vibrant palette. Working in HSL was extremely useful in this because, once a hue was locked, we could adjust saturation and lightness with attention to both aesthetics and maintaining accessibility compliance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8_JhupgjfsFU8_RxYJhVUA.png" /><figcaption>Increased saturation above / previous action blue below</figcaption></figure><p><strong>Non-neutral grays </strong>— other areas for improvement were the construction and typographic grays. Clarity was using flat values with no chroma. We took the opportunity to shift the system to using cool grays in service of added vibrancy and chroma as above. The saturation is quite low — just enough to ‘take the curse off of it’ as a great director I used to work with was fond of saying. We use these cool grays for type and for the construction lines that make containers, as well as for shadows. The difference is largely invisible unless you look at the before and after side-by-side when the increased life in the interplay of elements is apparent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A7NnCUKwreJKRm99x1pIDw.png" /><figcaption>Gray updated to cool gray above / previous neutral below</figcaption></figure><p><strong>Global tokens. </strong>We did a meticulous survey of all the colors used in both the Clarity Light and Dark themes. This included an accessibility audit for bugs and desired enhancements and an aligned system for data visualization color themes. Given this understanding, we created a global Clarity palette to provide a universal set that supports all these needs. This set comprises 211 colors in total. These include 5 functional, 8 utility, 5 muted, and a construction set, each in 11 shades from pastel to rich. In keeping with our theme of human-readable code we use <em>-black-</em> and <em>-white-</em> instead of HSL or HEX values at these poles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZyTWFZmMckJ1zOTDB2Hwg.png" /><figcaption>Success Green 93<strong>°</strong></figcaption></figure><p><strong>Functional aliases. </strong>To simplify the theming attributes and create consistency as well as human readability across the system, we refer to any frequently used values by way of aliases. Thus <strong>— cds-global-color-green-700</strong> which functions as our primary success color, is referred to as <strong>— cds-alias-status-success</strong>. Should a theme require a different color for this function, remapping the alias to another global is all thats required. In addition to the primary status color, there are closely related aliases -<em>tint</em>- and -<em>shade</em>- in this case <strong>— cds-alias-status-success-tint</strong> and <strong>— cds-alias-status-success-shade</strong> which allow and support dynamic but related color shifts (such as hover) without employing transparency which can confound accessibility evaluation. This is also is useful for multicolored components such as alerts. <a href="https://medium.com/@coryrylan">Cory Rylan</a> has been the master of this system of globals and aliases — his work has made this clear, useful, and easy to understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*h4Wz53Im2PXVJXh44KyqbA.png" /><figcaption>Component built with aliases (Light theme)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*Khsj43ctE5jJemM0i1X-Iw.png" /><figcaption>Component built with aliases (Dark theme)</figcaption></figure><p><strong>Aesthetic enhancements </strong>— We didn’t love the ‘yellows’ (actually more of a mustard or butterscotch) used in Clarity Angular. These were a source of a lot of discussion since they weren’t actually yellow. We took this opportunity to update these components to use a true yellow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUuUIHVpeSA-2GsPDHpiYA.png" /><figcaption>Warning yellow update</figcaption></figure><p><strong>Charts palettes and system </strong>— charts have long been a user request for an addition to Clarity. Since this is a large undertaking for a small design system team we took the initial step of creating charts themes aligned with Clarity color. By creating charts sets via aliases which map global colors to their function in the chart, a collection of sets which can switch within and between themes is enabled. This allows applications to do things with charts that enhance usability, such as emphasizing a visualization dynamically through interaction, or creating differentiation within dashboards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SwQvzMJnq29OlO_Y7F4LRA.png" /><figcaption>Companion light and dark charts color themes</figcaption></figure><p>We are moving ahead with more complete themes for Clarity charts that include type styles and textures and will be adding them to the system. Stay tuned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9aRIwaizdv8NOUrhS4Wdew.png" /><figcaption>Charts using Clarity Themes</figcaption></figure><p>The opportunity to reimagine the way we define and organize color has allowed us to update it in ways that would be much more difficult were we required to do so in the system being used in live products. We made a serious effort to keep close to the existing colors to make migrations as invisible as possible. At the same time were were able to redesign the CSS including our shift to HSL, increasing the chroma overall, switching to non-neutral (cool) grays for type and construction lines as well as shadows. We codified all this with global tokens and employ these colors in an elegant fashion via aliases. We also made some aesthetic enhancements particularly with regard to using a true yellow and added a charts system derived from the same globals and based on the aligning principles.</p><p>The <a href="https://medium.com/claritydesignsystem/clarity-design-architecture-part-two-bf9df8ed7a6f">next article</a> will include the <em>Type System</em>, our <em>Layout Utilities</em> and the <em>Token Based Space Primitives</em> they use, and how all these systems come together to enable <em>Theming</em> in a powerful and flexible way.</p><p>Visit us at our website <a href="https://clarity.design">https://clarity.design</a> and connect with us on <a href="https://github.com/vmware/clarity">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95ef0adcd30c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/clarity-design-architecture-part-one-95ef0adcd30c">Clarity Design Architecture Part One</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Goodbye Clarity Icons, Hello Clarity Core!]]></title>
            <link>https://medium.com/claritydesignsystem/goodbye-clarity-icons-hello-clarity-core-adb07de9739e?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/adb07de9739e</guid>
            <category><![CDATA[vmware]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[litelement]]></category>
            <category><![CDATA[clarity-design-system]]></category>
            <dc:creator><![CDATA[Scott Mathis]]></dc:creator>
            <pubDate>Wed, 10 Mar 2021 22:07:19 GMT</pubDate>
            <atom:updated>2021-04-22T17:46:34.126Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pqp8bMM8VOaQA0EEJ6UAxA.jpeg" /></figure><h3>Intro to Clarity Core</h3><p><a href="https://medium.com/claritydesignsystem/clarity-v4-how-clarity-expanded-and-improved-baabf1a98923">Clarity 4.0</a> was one of the most impactful releases in the history of the <a href="https://clarity.design/">Clarity Design System</a>. In 4.0, the new <a href="https://www.npmjs.com/package/@cds/core">Clarity Core package</a> of web components emerged from its 3.0 preview/beta status and introduced <a href="https://clarity.design/core-components/">almost two dozen new components</a>. Clarity also released the <a href="https://www.npmjs.com/package/@cds/react">Clarity React library</a> in 4.0, extending Clarity support for the first time to teams using React.</p><p>This is a huge milestone for Clarity and marks the beginning of <a href="https://medium.com/claritydesignsystem/claritys-future-user-focused-framework-independent-accessible-enterprise-ready-and-open-61a3f62eac93">a new era of framework independence</a>.</p><p>But something new rarely manifests without changing what has come before.</p><blockquote>With the 4.0 release, the <a href="https://clarity.design/icons">Clarity Icons</a> (<a href="https://www.npmjs.com/package/@clr/icons">@clr/icons</a>) package will be deprecated. The Clarity team’s current plan is to end-of-life Clarity Icons at a currently unspecified future date. After the 5.0 release, however, @clr/icons will have no new icons added to it and new major versions will stop at 5.0.</blockquote><h4>What?! Why do this?</h4><p>Clarity Icons was important to Clarity for a couple of reasons:</p><ol><li>It was one of the first projects <a href="https://medium.com/claritydesignsystem/the-road-to-svg-and-custom-elements-in-clarity-icons-1d691c6cc91">to use web components</a> to deliver a library of SVG icon glyphs. When I delivered the original proof-of-concept for Clarity Icons in November of 2016, the dominant implementation of icon libraries were “<a href="https://www.pluralsight.com/blog/creative-professional/icon-fonts">icon fonts</a>”. Icon fonts used icon glyphs that were accessed through <a href="https://en.wikipedia.org/wiki/Private_Use_Areas">the private use area (PUA) of a webfont</a>. This was a good solution at the time. But it had its limitations. <a href="https://cloudfour.com/thinks/seriously-dont-use-icon-fonts/">And then there was that <em>horse problem</em></a>. Clarity Icons allowed us to leave all of that behind and <a href="https://medium.com/claritydesignsystem/the-road-to-svg-and-custom-elements-in-clarity-icons-1d691c6cc91">embrace the future with web components and SVG</a>.</li><li>Clarity Icons were a precursor to our current <a href="https://medium.com/claritydesignsystem/claritys-future-user-focused-framework-independent-accessible-enterprise-ready-and-open-61a3f62eac93">framework-independent future</a>. While the web component portion of the original Clarity Icons package was not as full-featured as the web components in Clarity Core, Clarity Icons played a significant role in sparking conversations among the Clarity team about using web components as a basis for a full library of components. Even though the delivery of a Clarity web component library with <a href="https://www.npmjs.com/package/@cds/core">@cds/core</a> would ultimately make <a href="https://www.npmjs.com/package/@clr/icons">@clr/icons</a> redundant, there would not be a Clarity Core without Clarity Icons.</li></ol><p>Now that Clarity has delivered a library of web components, it makes sense for us to roll Clarity’s <em>library of web component icons</em> into the project where all the other web components live. And, while the <a href="https://www.npmjs.com/package/@clr/icons">@clr/icons</a> package is deprecated, its vision and mission will live on inside of Clarity Core.</p><h3>A great reason to use Clarity Core… tree-shaking!</h3><p>In addition to carrying forward the functionality and icons from the previous library, moving over to <a href="https://www.npmjs.com/package/@cds/core">@c</a>ds<a href="https://www.npmjs.com/package/@cds/core">/core</a> allows Clarity to offer upgrades to the library that will improve developer experience, bundle sizes, and performance.</p><p>When the original Clarity Icons library was created, our build architecture was not tree-shakeable. “Tree-shaking” here refers to the capability of <a href="https://rollupjs.org/guide/en/">build tools like Rollup</a> to remove unused JavaScript code from a project when it is bundled for delivery. The point of tree-shaking is to reduce the amount of JavaScript in an application by removing code that the application doesn’t need. Larger files take longer to download and longer for the browser’s JavaScript engine to parse.</p><p>Tree-shaking results in smaller bundles. So it’s a good thing.</p><p>When we began writing code for Clarity Icons, the Clarity team <a href="https://gulpjs.com/">was using Gulp</a> to package and deliver its component library. <a href="https://webpack.js.org/">Webpack</a> was the better part of a year away for us and getting the project on Rollup/Webpack and creating the icons library were parallel items of work. Clarity Icons was largely complete when the Rollup/Webpack work was just getting started.</p><p>As a result, tree-shaking was still just a thought experiment for us when @clr/icons was introduced. Many teams who have migrated their codebases from pre-Webpack to post-Webpack are likely familiar with the limbo of “we didn’t know what we didn’t know” when it comes to optimizing their project’s ability to treeshake.</p><blockquote>As a result of architectural decisions early on in the Clarity repository, Clarity Icons would not be tree-shakeable. <em>This meant that if you used one icon in an icon set all of its friends would be coming along for the ride!</em></blockquote><p>We identified this as a problem long before Clarity moved to Webpack in <a href="https://github.com/vmware/clarity/commit/3d00bd443b9100fcce1af6f3e95aa1a2218f9202#diff-b9cfc7f2cdf78a7f4b91a753d10865a2">version 0.10.8</a> (October 2017). But fixing this problem would require an overhaul of how our repository was structured and how the hundreds of icon glyphs were delivered.</p><p>Like technical debt in a lot of projects, re-writing the Clarity Icons library and re-structuring our build never jumped to the top of our list of priorities.</p><p><strong>Clarity Core gave us an opportunity to tackle this.</strong></p><p>As my colleague, <a href="https://medium.com/u/c2f4eb731d6e">Cory Rylan</a>, demonstrated <a href="https://medium.com/claritydesignsystem/design-system-performance-with-clarity-core-web-components-fbab56516f30">in a recent article</a>, being able to re-imagine a new component library from the ground up gave us an opportunity to redouble our focus on <a href="https://medium.com/claritydesignsystem/design-system-performance-with-clarity-core-web-components-fbab56516f30">improving performance, maintainability, and bundle-sizing</a>. The result has yielded a tree-shakeable library of icons. This makes the @cds/core icons library a significant upgrade over its predecessor.</p><h3>Migration</h3><p>By now, you are hopefully super-eager to <a href="https://clarity.design/get-started/developing/">jump onboard Clarity Core</a>. The migration path to the Core icons from any prior version of @clr/icons is straightforward because the Core icon library is backward-compatible to a large extent.</p><p>Here are the detailed steps for migrating from Clarity Icons to Clarity Core:</p><ol><li>Add <a href="https://clarity.design/get-started/developing/">@cds/core to your project</a>.</li><li>Substitute <strong>clr-icon</strong> web components in your application with <strong>cds-icon</strong>. A developer may be able to do a <em>find-and-replace</em> to complete this step.</li><li>Add icons to the <strong>ClarityIcons</strong> registry as needed. Depending on how ubiquitous the icons are in your application, this may be incredibly easy or a chore. Whether your team chooses to create an inventory list of all icon shapes in your application and then add them all in one big listing in the application module or whether your team prefers to add the icons on a component-by-component basis, Clarity Core icons offer multiple paths to migrate.</li></ol><p>Here’s an example of what a migration could look like:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fcore-icons-migration-side-by-side%3Fembed%3D1&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fcore-icons-migration-side-by-side&amp;image=https%3A%2F%2Fc.staticblitz.com%2Fassets%2Ficon-03bbb9acbba813917725387f46e5df03a95d232be240e910ce5f946a973b3f86.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/e88733041ddd36b84eea9fe1299e3a94/href">https://medium.com/media/e88733041ddd36b84eea9fe1299e3a94/href</a></iframe><h3>Core icons are backward-compatible but…</h3><p>In Core version 4.0, Clarity Icons’ full API — including all CSS classnames, icon shapes, and aliases — was re-implemented to make migration easier.</p><p>This legacy code, however, has been replaced with an improved API in 5.0.</p><p>For illustrative purposes, the following code examples demonstrate how tasks in Clarity Icons <em>(before)</em> can be accomplished with Clarity Core <em>(after 5.0)</em>.</p><p>Note that Clarity Core versions 3 and 4 are under the <a href="https://www.npmjs.com/package/@clr/core">@clr/core package name on npm</a>. In versions 3 and 4, the CSS classname-based API of Clarity Icons’ “clr-icon” component should work as expected but we recommend applications migrate to the new Clarity Core code examples.</p><h3>Using Icons</h3><p>Previously, using an icon in Clarity required importing the Clarity Icons CSS file <em>and</em> the @clr/icons file.</p><blockquote>Including a CSS file to display icons is no longer necessary in Clarity Core.</blockquote><p>In addition, loading the <em>@clr/icons</em> file would automatically load the “core set” of icons. Clarity Core no longer does this. To use an icon in your application, it must be added to the @cds/core ClarityIcons service as shown below.</p><p>Clarity Core also has a separate registration file for the icon web component that needs to be imported.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d0f0e04451f41613120fb2ca16178f3/href">https://medium.com/media/6d0f0e04451f41613120fb2ca16178f3/href</a></iframe><p>As before, icons are rendered in your application via a custom element (a.k.a. web component). That has remained the same but the prefix of the web component’s tag name has been changed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5062801431ff401dee20f126d8ecec41/href">https://medium.com/media/5062801431ff401dee20f126d8ecec41/href</a></iframe><h4>Why change the tag name prefix?</h4><p>Tag names in <a href="https://www.npmjs.com/package/@clr/angular">@clr/angular</a> and <a href="https://www.npmjs.com/package/@clr/icons">@clr/icons</a> are prefixed with <em>“clr-”</em> and all tag names in <a href="https://www.npmjs.com/package/@cds/core">@cds/core</a> are prefixed with <em>“cds-”</em>.</p><p>To prevent namespace collisions and overloading for teams using Clarity Core alongside Clarity Angular (or even Clarity Icons by itself), Clarity Core (<a href="https://www.npmjs.com/package/@cds/core">@cds/core</a>) could not use the same tag name as the other Clarity libraries.</p><p>We did not want to force users to choose between Core and Clarity Angular or Clarity UI, so we needed them to work alongside one another to some degree. Changing the prefix for Clarity Core’s web components was the best path forward to achieve that.</p><blockquote>While the old <em>“clr-”</em> prefix was a derivative of the word “clarity”, the <em>“cds-”</em> prefix is an abbreviation of the phrase “Clarity Design System”.</blockquote><h3>How to add icons to the API</h3><p>Clarity Icons could always add custom icon glyphs to the icon registry and share them across an application. <em>@cds/core</em> supports this as well.</p><p>As mentioned previously, the 4.x Clarity Core icons API is backward-compatible. So all of your old code will still work if you point it to the v4 or earlier Clarity Core icons API — assuming you’ve changed your tagnames from <em>&lt;clr-icon&gt; </em>to <em>&lt;cds-icon&gt;</em>.</p><p>Support for this legacy API will no longer be available after 5.0.</p><p>That makes this is a great opportunity to learn how to move forward with Clarity Core after legacy support ends.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/becbd810110481ee76067e4c923f3ffa/href">https://medium.com/media/becbd810110481ee76067e4c923f3ffa/href</a></iframe><h4>Why “addIcons()” when “add()” is more succinct?</h4><p>When we delivered the Clarity Core icon API, we wanted to make sure we had <em>at least one version</em> that was backward-compatible. addIcons() was the clearest choice for a method name because add() was already taken by the legacy API. We couldn’t change the call signature (a.k.a. the type and number of arguments passed to the add() method) without breaking backward-compatibility.</p><p>In the future, add() will be re-introduced as a method of the Clarity Core Icons API but will be an alias for the existing <em>addIcons()</em> method. So, in the future, the Clarity Core Icons API add() static method will have an identical call signature to the current addIcons() class method.</p><h4>What are you doing in the arguments with the arrays?</h4><p>Technically, the icon name and shape “array arguments” are <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html#tuple"><em>tuples</em></a>. They are easy to work with and don’t carry around a lot of the baggage associated with a vanilla JavaScript object. No checking for hasOwnProperty and all that.</p><p>One day, JavaScript will have <a href="https://github.com/tc39/proposal-record-tuple">a true tuple data structure</a>. Until then, we have this “array thing”.</p><h3>Add a custom icon</h3><p>We’ve gone over the method that will add an icon to the Clarity Core Icons API. But we haven’t covered how to format a custom icon to have it fully integrated with the API.</p><p>There are a couple of ways to do this. One way is straightforward and requires a bare minimum of work on a developer’s part. The second way makes a custom icon a first-class citizen inside Clarity Core but requires a little more understanding of the internals of the icons API.</p><p>Let’s go over both of these approaches now.</p><h4>Using an SVG</h4><p>The easiest way to add an icon to the Clarity Core icons API is to pass an icon name and the SVG of the icon as a string in the tuple argument of ClarityIcons.addIcons().</p><ul><li>The appeal of this approach is that it is easy. There’s not a lot of extra work to get from an SVG that a designer sent you to a glyph stored in the API.</li><li>The drawback of this approach is that the badging, status colors, and other functionality will not be available for that icon. It will only render what you pass to it.</li><li>Make sure you remove widths and heights from the <em>&lt;svg&gt;</em> tag itself. These might introduce unintended side effects when sizing your icon.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2e1b0a7fdfe526a238642b9a1c67d88/href">https://medium.com/media/b2e1b0a7fdfe526a238642b9a1c67d88/href</a></iframe><h4>Using an icon template</h4><p>Those who are familiar with Clarity Icons understand that the icon components do a lot more than store an SVG in a registry. So how can you create an icon that takes advantage of all that built-in functionality?</p><p>The answer is using a Clarity Core<strong><em> icon template</em></strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fcore-icons-migration-add-custom-icon%3Fembed%3D1&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fcore-icons-migration-add-custom-icon&amp;image=https%3A%2F%2Fc.staticblitz.com%2Fassets%2Ficon-03bbb9acbba813917725387f46e5df03a95d232be240e910ce5f946a973b3f86.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb152a408382e1c110908fc269e893cc/href">https://medium.com/media/fb152a408382e1c110908fc269e893cc/href</a></iframe><ul><li>The renderIcon() function in the example above converts your <em>icon template</em> into an SVG. It builds the SVG for you and applies the formatting the icons library needs to be able to show solid, outlined, badged, and alerted icons when you tell it to.</li><li>Icons inside an icon template should be <a href="https://medium.com/claritydesignsystem/how-to-design-clarity-icons-a443b19ad84b">designed with a 36px x 36px viewbox</a>.</li><li>The icon template accepts &lt;path&gt;,<em> </em>&lt;circ&gt;,<em> </em>&lt;rect&gt;… virtually any SVG you throw its way. SVG wrapped in a &lt;g&gt; tag or other nested SVG structures may cause problems for it, however. Pass only flat paths and shapes and make sure that all SVG shape tags are self-closing (&lt;path … /&gt;<em> </em>instead of &lt;path …&gt;&lt;/path&gt;).</li><li>In the early days of Clarity Icons, we had trouble using CSS styling to customize strokes in some problematic browsers. As such, our library has always recommended <a href="https://medium.com/claritydesignsystem/how-to-design-clarity-icons-a443b19ad84b"><em>using filled paths instead of strokes</em></a>. This has not changed. Icon templates will be your best friend if you convert strokes and fonts in your glyphs to outlines/paths before exporting SVG from your vector art program of choice.</li><li>Not all of the properties in an icon template need to be defined. In the example, my-dot only has an outline and solid path. custom-icon has paths for everything! Core icons are smart enough to fallback to outline if you don’t have a solid variant or the solid or outline variant if badged and alerted variants are requested but not defined.</li><li>Including the badge-dot or warning-triangle in your badged and alerted paths is not necessary. The icon service applies those for you. But your icon will look better if it <a href="https://medium.com/claritydesignsystem/how-to-design-clarity-icons-a443b19ad84b#c8cd">allows space for the circular badges and warning triangles</a>. Even still, the icon library will apply the dot or triangle over any path you send it if the badged and alerted properties are defined in the icon template, as shown with custom-icon in the example.</li></ul><h3>Aliases and sets</h3><p>The Clarity Icons API gave users the ability to “alias” icon glyphs under different names and also load large sets of icons all at once.</p><p>This meant you could refer to icon glyphs by different names like “menu” instead of “bars”, “settings”, or “gear” instead of “cog”. In addition, <em>sets</em> gave users the ability to load dozens of icons with a single command. A lot of that changes in Clarity Core.</p><p><strong>Don’t use sets. </strong>With Clarity Core, we recommend <em>against</em> loading sets of icons because it presents challenges with tree-shaking. Products rarely use all the icons in a set and it is not wise to load all 129 icons in the “<em>essential</em>” set yet only use ten of them. Clarity recommends adding icons as they are needed. This is the optimum way to ensure applications remain lean and performant.</p><p><strong>Add icons, don’t alias them. </strong>As far as aliasing goes, <em>@clr/core</em> supports aliasing in 4.0. But we have a preference for <em>adding</em> icons instead. It does the same thing under the hood and there is no need for an application to be required to use Clarity’s naming conventions. Feel free to name our icons anything that makes sense for your application’s domain.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c30c31d3c35ea392005c1dbf5fcc8e2/href">https://medium.com/media/6c30c31d3c35ea392005c1dbf5fcc8e2/href</a></iframe><h3>Using an icon in your app</h3><p>Besides the new <em>cds-</em> prefix, using a Clarity Core icon in your application is no different than it was in <em>@clr/icons</em>.</p><p>But the new Core icon library has given us an opportunity to improve the developer experience.</p><p>The following examples are going to compare and contrast common use cases in <em>@clr/icons</em> with the preferred way to do the same thing in <em>@cds/core. </em>There are some running themes and migration should feel logical once a developer has a little practice migrating a couple of features.</p><h4>Size</h4><p>A stealth improvement in <em>@cds/core </em>is related to how icons can be sized. Previously, a <em>@clr/icons</em> component could be sized in one of two ways: setting the <em>style attribute</em> on the icon or passing a <em>numeric string</em> into the icon’s size attribute.</p><p>The numeric string approach caused problems for teams with <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP">strict content security policies</a>. This is because passing a number to the size of the attribute on the &lt;<em>clr-icon&gt;</em> element causes the web component to programmatically set its own style attribute. Some CSPs view this as a violation.</p><p>Clarity Core improved the size attribute so that it can now accept <strong><em>t-shirt size</em></strong> values <em>(xs, sm, md, lg, xl, xxl)</em>. T-shirt sizes resolve those CSP concerns by setting the icons to a handful of predefined dimensions without writing to the style attribute.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/851380e22f89f9a0d2e1e9bb84fb58b0/href">https://medium.com/media/851380e22f89f9a0d2e1e9bb84fb58b0/href</a></iframe><h4>Direction</h4><p>As with the old <em>@clr/icons</em> web component, users can set an attribute to rotate the icon glyph. In <em>@clr/icons</em>, this was the <em>dir</em> attribute. In <em>@cds/core</em>, the attribute is <strong><em>direction</em></strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d2c8c09532ff54b6ea9a5925b0a4d17/href">https://medium.com/media/5d2c8c09532ff54b6ea9a5925b0a4d17/href</a></iframe><p><strong><em>But, wait, there’s more!</em></strong></p><p><em>@cds/core</em> also introduces the <strong><em>flip</em></strong> attribute. This inverts the icon along its horizontal or vertical axis.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a4e1641d3f16c43c6b45acdfff3c98af/href">https://medium.com/media/a4e1641d3f16c43c6b45acdfff3c98af/href</a></iframe><h4>Solid</h4><p>Similar to other items listed above, <em>@cds/core </em>accomplishes the same thing as the legacy <em>@clr/icons </em>did but by using an HTML attribute instead of a CSS classname.</p><p>This is consistent with how solid and outlined (filled and not filled) icons are rendered.</p><p>In <em>@clr/icons</em>, users had to use the <em>is-solid</em> classname on the web component to display an icon’s solid variant. In <em>@cds/core</em>, users only need to add the <strong><em>solid</em></strong> boolean attribute.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f62232eae4ce2a89c4492c4337477870/href">https://medium.com/media/f62232eae4ce2a89c4492c4337477870/href</a></iframe><h4>Inverse</h4><p>An <em>“inverse”</em> icon is an icon that is filled with a light color instead of a dark color. By default, this color is white. These are helpful when you need an icon on a dark background.</p><p>The difference between Clarity Core and Clarity Icons should start to feel familiar by this point.</p><blockquote>Instead of burdening applications with Clarity-specific CSS classnames, Clarity Core accomplishes the same styling through HTML attributes. This is consistent throughout all of our components in Clarity Core.</blockquote><p>As with solid icons, inverse icons used to use the <em>“is-inverse”</em> classname in <em>@clr/icons</em>. But now they use the <strong><em>inverse</em></strong> attribute.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5cfa94edd720e216310f36d3254db124/href">https://medium.com/media/5cfa94edd720e216310f36d3254db124/href</a></iframe><h4>Statuses and Colors</h4><p>Clarity Icons also allowed for the icon glyphs to show in a number of predefined colors (green, ochre, red, and blue) in addition to the icon inheriting its host element’s text color (generally the default dark gray).</p><p>These colors are aligned with statuses in Clarity and constitute the familiar triad of <em>“stoplight colors” –</em>success, warning, and danger–with blue as an “info” or highlight color.</p><p>As with the other cases above, <em>@cds/core </em>uses an attribute — called <strong><em>status</em></strong> — where <em>@clr/icons </em>used a CSS classname.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8086d368c25fcf9419f7b81fa9014191/href">https://medium.com/media/8086d368c25fcf9419f7b81fa9014191/href</a></iframe><h4>Badged and Alerted</h4><p>In both Clarity Core and Clarity Icons, icon glyphs can have “badged” and “alerted” variants. These variations feature a decoration in the top right corner of the icon glyph.</p><ul><li>For “badged” icons, this decoration is a <strong>round dot</strong>.</li><li>For “alerted” icons, this decoration is a <strong>triangle</strong>.</li></ul><p>This remains consistent in Clarity Core and Clarity Icons.</p><p>In <em>@clr/icons</em>, badges and alerts on icons were shown by adding a CSS classname. If you didn’t skip ahead, the next part should come as no surprise.</p><blockquote>In <em>@cds/core</em>, badges and alerts are shown by adding an HTML attribute.</blockquote><p>Clarity Core has one new twist that was not available in <em>@clr/icons</em>, however.</p><p>Both the alerted (or “triangled”) icons and badged (or “dotted”) icons can now be set to an <em>“inherit”</em> mode.</p><p>An <em>inherit-mode </em>means that the icon decoration will display with the same color as the rest of the icon.</p><p>By default, the badged dot is red and the alert triangle is dark orange (a.k.a. ochre). By setting them to inherit the color of the rest of the icon, you make the badge, the triangle, and the rest of the icon all one color.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b09e541d9d4eca5031e780d215edcb1a/href">https://medium.com/media/b09e541d9d4eca5031e780d215edcb1a/href</a></iframe><h3>In summary</h3><p>The introduction of <em>@cds/core</em> gave the Clarity team an opportunity to revisit Clarity Icons and improve its API and performance. Now that those upgrades have been introduced, it’s time to say goodbye to <em>@clr/icons</em>.</p><blockquote>The @<em>clr/icons </em>package<em> </em>has been deprecated in 4.0 and will end-of-life in the future. The exact date has not been determined (yet).</blockquote><p>It is recommended that all teams using <em>@clr/icons </em>migrate to <em>@cds/core</em> as soon as possible. The 4.x version of the <em>@clr/core </em>library is fully compatible with the public API of <em>@clr/icons</em>. We did this to give teams a chance to migrate at their own pace. But no new icon glyphs will be added to <em>@clr/icons </em>and no future support will be given to it after it reaches end-of-life.</p><p>The Clarity team is incredibly grateful for <em>@clr/icons</em>. The effort of <a href="https://medium.com/u/e1852758089c">Shijir Tsogoo</a> and many others put Clarity on the bleeding edge of icon libraries as one of the first SVG and web component-based solutions in early 2017. It also served as the proving ground for what eventually became Clarity Core and our drive for framework-independence.</p><p>We hope that current users of Clarity Icons will find that <a href="https://clarity.design/foundation/icons/">the icon library in Clarity Core</a> carries forward the innovations introduced in Clarity Icons. We also invite current users of <em>@clr/icons </em>to join us on our journey as we <a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">continue to embrace web standards and a framework independent future</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adb07de9739e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/goodbye-clarity-icons-hello-clarity-core-adb07de9739e">Goodbye Clarity Icons, Hello Clarity Core!</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Level Up Your Application by Adopting Clarity Core]]></title>
            <link>https://medium.com/claritydesignsystem/level-up-your-application-by-adopting-clarity-core-8a5f3f863139?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/8a5f3f863139</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[clarity-design-system]]></category>
            <dc:creator><![CDATA[Jeremy Wilken]]></dc:creator>
            <pubDate>Tue, 15 Dec 2020 20:51:36 GMT</pubDate>
            <atom:updated>2020-12-15T20:51:35.285Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xP37GBEv9ftaIQZaawDFSA.jpeg" /><figcaption>You can climb the leader board by using Clarity Core — Credit <a href="https://unsplash.com/photos/R401qwThw7w">Unsplash</a></figcaption></figure><h4>The concise guide to using Clarity Core, in any project, right now.</h4><p>Last year, we shared an article about <a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">our Clarity Core initiative</a> and our <a href="https://medium.com/claritydesignsystem/claritys-future-user-focused-framework-independent-accessible-enterprise-ready-and-open-61a3f62eac93">drive towards a new future</a>. Many applications have already been using Clarity Core (our web component implementation of Clarity) in their projects, and it is already getting over two-thirds the number of weekly downloads Clarity Angular has been getting for the last two years! We’ve shared that our web component implementations are Clarity’s future because it helps any application quickly adopt and align to Clarity patterns and components regardless of what frameworks they use.</p><p>If you haven’t started using Clarity Core, this is your guide. This post is aimed at projects using Clarity Angular today, who haven’t yet adopted Clarity Core. Major changes in a design system can have a big impact on productivity, and we’ve worked hard to provide a path forward to give existing Clarity Angular projects the flexibility and freedom they need to choose when and how to adopt Clarity Core. For applications that are using Clarity Angular today, we made the following promise:</p><blockquote>The goal is to make [adopting Clarity Core] as minimally impactful to existing Clarity Angular applications as possible.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/144/1*RtdWkRyW2xVK1dgn8vDwYQ.png" /><figcaption>Clarity 8-bit logo</figcaption></figure><p>In this post, I’m going to walk through how we’re going to support you in leveling up your application by adopting Clarity Core. I’ll outline the path for applications using Clarity Angular and share details about how we will partner with you on this journey to align on Clarity Core.</p><p>First, we need to understand where things stand with Clarity Core and how it relates to Clarity Angular.</p><h3>Clarity Core is Available NOW, with FREE Expansion Packs Coming!</h3><p>Clarity Core is the implementation of Clarity written in web components. We created Clarity Angular using Angular as the foundation, and therefore requires applications to be written with Angular to get the full benefits of Clarity. As we aim to support all applications, written in any framework, Clarity Core is central to making that possible.</p><p>Clarity Core has made significant progress in the past year and has been available since February 2020. However, we recognize that for many existing projects it doesn’t offer much that wasn’t already in Clarity Angular. Some people wonder why you would update to the latest Xbox when it doesn’t have any games that are worth updating for yet. We have more work to do to bring our library of web components up to parity with Clarity Angular, so you can expect to see more in the coming year.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*WKjevp47WPdB4_Ms" /><figcaption>Are you ready to play? — Source <a href="https://unsplash.com/photos/dwcC-OJ-bRs">Unsplash</a></figcaption></figure><p>Today, we have over two dozen components available in <a href="https://clarity.design/storybook/core">Clarity Core</a>, which account for more than half of the components we have in Clarity Angular. This first wave of Core components includes frequently used and fundamental building blocks, such as <a href="https://clarity.design/storybook/core/?path=/story/components-button-getting-started--page">buttons</a>, <a href="https://clarity.design/storybook/core/?path=/story/components-alert-getting-started--page">alerts</a>, and <a href="https://clarity.design/storybook/core/?path=/story/components-modal-getting-started--page">modals</a>. As we move into 2021, more complex components, like the datagrid, will become an area of focus for us. (Oh yeah, and these expansion packs are free because Clarity is open source, unlike expansions for Fortnite.)</p><p>We’ve also provided many improvements and new capabilities not found in Clarity Angular — most notably the <a href="https://clarity.design/storybook/core/?path=/story/foundation-design-tokens-getting-started--page">design tokens</a> and <a href="https://clarity.design/storybook/core/?path=/story/foundation-layout-get-started--page">layouts</a>. We have found that using Core’s design tokens and layouts can easily remove the majority of the custom CSS applications have to write to supplement Clarity Angular and provide more standardization across an application. Think of it like an upgrade game engine under the hood of your application that makes everything smoother.</p><p>You may have noticed we’ll have two independent implementations of Clarity, if so you can get some bonus points. The long term goal is to deprecate our existing Clarity Angular component library and support only Clarity Core. This will only happen long after reaching parity between both libraries, which we expect to take more than a year to achieve.</p><p>You can depend upon Clarity Angular for the years to come, as long as it suits your needs. With our upcoming v5 release, we will also feature freeze Clarity Angular and focus on accessibility and bug fixes. This will help stabilize Clarity Angular for the long term, and it means we have no breaking changes planned in the future. We will update for major Angular releases as needed, just like all your phone games update regularly to support the latest iOS or Android. Just like if you can still play a Nintendo 64 but you don’t see new games being developed, Clarity Angular will continue to be reliable for your application for the years to come as long as you need it.</p><p>Now, let’s try adopting some Clarity Core components inside of an existing Clarity Angular application!</p><h3>Cheater’s Guide for using Clarity Core in Angular</h3><p>For new applications, adopting Clarity Core is as simple as following our documentation at <a href="https://clarity.design/storybook/core/">https://clarity.design/storybook/core/</a>. We’re working to incorporate this documentation into our main website early next year. You’ll be able to update Clarity Core as new releases come to get the latest enhancements and components.</p><p>For existing applications using Clarity Angular, you have the opportunity to adopt Clarity Core as you go instead of having to worry about a major and complex migration process. As we release Clarity Core components, applications can choose when and how they update their usage from Clarity Angular to Clarity Core.</p><p>This is beneficial for applications because using Clarity Core is not tied to Angular, and can work with any recent version. This avoids the pain of updating Angular and Clarity Angular to adopt updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*M_DSygEwiBRpyR1mrUj-Nw.png" /><figcaption>Simple Clarity Angular application with alert, label/tag, button, and modal (currently closed)</figcaption></figure><p>To help illustrate how to get started, here is a simple Angular project that uses an alert, button, badge, and modal. Now we’ll step through how to update it to use the web components in Clarity Core.</p><p>Before: <a href="https://stackblitz.com/edit/clarity-angular-using-core-v5-before?file=src%2Fapp%2Fapp.component.html">Stackblitz Demo</a><br>After: <a href="https://stackblitz.com/edit/clarity-angular-using-core-v5-after?file=src%2Fapp%2Fapp.component.html">Stackblitz Demo</a></p><h4>Step 1 — Activate Clarity Core in your project</h4><p>First, you’ll need to install Clarity Core, which is done by using NPM or Yarn:</p><pre>npm install @cds/core #If you use NPM<br>yarn add @cds/core #If you use Yarn</pre><p>This installs Core into your project, but it won’t have any impact until you try to incorporate a component into your project. With Clarity v5, you’ll get this installed by default with Angular projects.</p><p>Right now, you’ll also have to add the CUSTOM_ELEMENTS_SCHEMA to your NgModule schemas so the Angular compiler doesn’t get upset. We are working on a solution that won’t require this step for v5</p><pre>@NgModule({<br>  schemas: [CUSTOM_ELEMENTS_SCHEMA],<br>// ...the rest of your module definition<br>})</pre><h4>Step 2 — Replace a component</h4><p>Let’s start by replacing the label component. The relevant code snippet for this component is below, which is a simple HTML/CSS element in Clarity Angular.</p><pre>&lt;span class=&quot;label label-danger&quot;&gt;Danger Tag&lt;/span&gt;</pre><p>In Clarity Core, the label component has been renamed to a tag, because labels are a semantic HTML element for forms and we want to avoid confusion. You can see the <a href="https://clarity.design/storybook/core/?path=/story/components-tag-getting-started--page">tag documentation</a> for the details about the component. We will need to register the Core component so it is available to use, by adding the bolded line below to the Angular module file imports list.</p><pre>import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from &quot;@angular/core&quot;;<br>// Other imports</pre><pre><strong>import &quot;@cds/core/tag/register&quot;;</strong></pre><pre>@NgModule({<br>// Rest of your NgModule definition</pre><p>This is necessary to do once per Angular module within which you wish to use the Core component. Alternately, you can do this globally at the AppModule level. This import makes the browser aware of the Core component and is similar to adding a component to the NgModule declarations array.</p><p>Now that our tag is ready to use, we can replace our span snippet above with the following tag component.</p><pre>&lt;cds-tag status=&quot;danger&quot;&gt;Danger Tag&lt;/cds-tag&gt;</pre><p>That’s it! We’ve adopted a Clarity Core component to replace an existing Clarity Angular component with minimal effort. You may notice a change in colors, which improves the accessibility of the tags for color contrast requirements.</p><h4>Step 3 — Achievement unlocked!</h4><p>That is all you have to do to begin using Clarity Core in your Angular projects. During step 3, you can bask in the glory of obtaining your new achievement badge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*LrTXu_5FtegNABDF" /><figcaption>You’ve made it! — Source <a href="https://unsplash.com/photos/LTyDj7u_TU4">Unsplash</a></figcaption></figure><p>Now it&#39;s your turn! Can you try to replace the alert component with a <a href="https://clarity.design/storybook/core/?path=/story/components-alert-group-getting-started--page">Core version</a>? Remember you have to first register the Angular component and then replace the components in the template. I’ll go play some arcade games while you try it out.</p><p>Did you get it? First, register the alert in your module like this.</p><pre>import &quot;@cds/core/alert/register&quot;;</pre><p>Then replace the alert component in the template like this and you’ve got it!</p><pre>&lt;cds-alert-group status=&quot;info&quot;&gt;<br>    &lt;cds-alert&gt;This is an info alert!&lt;/cds-alert&gt;<br>&lt;/cds-alert-group&gt;</pre><p>I really like the cleaner API that Clarity Core components have over the original Clarity Angular API. The APIs are simpler and have a consistency that makes the components more intuitive. I hope you also find it to be an improvement, as we’ve spent a lot of time considering the API carefully.</p><p>The last two components are the button and modals, and the steps are the same basic steps. First, add the imports to the module file.</p><pre>import &quot;@cds/core/button/register&quot;;<br>import &quot;@cds/core/modal/register&quot;;</pre><p>Then we have our template to update for the button and modal. The structure of the Core modal is more complex due to the header, content, and footer, but it also has a more consistent and clean API.</p><pre>&lt;p&gt;&lt;cds-button (click)=&quot;getImage()&quot;&gt;See Random XKCD Comic&lt;/cds-button&gt;&lt;/p&gt;<br>&lt;cds-modal *ngIf=&quot;comic&quot; (closeChange)=&quot;comic = null&quot; size=&quot;lg&quot;&gt;<br>  &lt;cds-modal-header&gt;<br>    &lt;h3 class=&quot;modal-title&quot;&gt;{{comic?.safe_title}}&lt;/h3&gt;<br>  &lt;/cds-modal-header&gt;<br>  &lt;cds-modal-content&gt;<br>    &lt;img [src]=&quot;comic?.img&quot; [alt]=&quot;comic?.alt&quot; /&gt;<br>  &lt;/cds-modal-content&gt;<br>  &lt;cds-modal-actions&gt;<br>    &lt;cds-button (click)=&quot;comic = null&quot;&gt;Close&lt;/cds-button&gt;<br>  &lt;/cds-modal-actions&gt;<br>&lt;/cds-modal&gt;</pre><p>The final version of this <a href="https://stackblitz.com/edit/clarity-angular-using-core-v5-after?file=src%2Fapp%2Fapp.component.html">demo is in this Stackblitz</a> example. That is it, we’ve managed to replace the Clarity Angular components with Clarity Core with minimal effort, and could even remove the ClarityModule from the project!</p><h3>Is Core in beta, should I wait?</h3><p>Clarity Core is considered stable and ready to use! We have worked hard to build out the foundational platform so future enhancements will come to you with minimal friction. Better yet, you don’t have to <a href="https://www.newsweek.com/ps5-black-friday-launch-gamestop-camping-outside-1550701">camp outside of a store to get access</a> to it. Clarity Core is already in use with some of our high profile products at VMware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Do1l8hForgFkLL9pAs1jg.jpeg" /><figcaption>People waiting outside Apple store, which you won’t have to do to use Clarity Core — Source: <a href="https://commons.wikimedia.org/wiki/File:Line_at_Apple_Store_in_NYC.jpg">Wikipedia</a></figcaption></figure><p>Hopefully, using Clarity Core is pretty straightforward and makes sense for you. However, if not, why bother changing? Glad you asked! It might not be obvious why you will want to do this.</p><ol><li>Clarity Core components will be eligible for future enhancements. The more you use them, the easier it will be to get new features such as search input, input groups, and circular progress that are only available in Core.</li><li>Clarity Core components are often more flexible and customizable than their Angular counterparts.</li><li>Clarity Core components have a more consistent API, better theming support, accessibility improvements, and work in any frontend framework.</li></ol><p>I recommend that you consider using Clarity Core components for all new work in your project when possible. As you update or enhance parts of your application you can update any uses of Clarity Angular that you see. It will take a while for Clarity Core to get full parity with Clarity Angular, but there is no reason you can’t start to adopt today where you can!</p><h3>Got some cheat codes?</h3><p>While the steps above are pretty straightforward and simple, it is not something that you will want to do for every single component that you are using today. The good news is we can automate some of these tasks for you. (It might be as easy as pressing <a href="https://en.wikipedia.org/wiki/Konami_Code">up, up, down, down, left, right, left, right, B, A and Start</a>.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*sr2e4Qte9BBLwx1c" /><figcaption>Disclaimer Clarity Core’s cheat codes won’t open a box of treasure — Source <a href="https://unsplash.com/photos/lLRm3S-7Kfw">Unsplash</a></figcaption></figure><p>First, we’re building out an adoption guide that will show before and after examples like these for all of our components. We plan to launch the initial version of this guide in early 2021. This will be a useful tool for anyone looking to see quick comparisons between implementations.</p><p>Second, we’ve been building out ESLint rules to help detect usage of Clarity Angular components. This will help you find the places in your application where you are using a Clarity Angular component and help identify Clarity Core adoption opportunities. Since this uses ESLint, it will work with any frontend project framework since some teams use other frameworks with our CSS components. Details about how to use this will come out with v5.</p><p>Finally, we’re going to work on adding fixers to those ESLint rules that can automatically update your code. Given the complexity of some components, we don’t expect to be able to make them for every component or to be able to auto-fix every use, but we do expect it to make a huge impact on adopting Clarity Core components. It will be opt-in to use the fixers when you are ready, so you can choose when to run it in your project.</p><p>Nothing is perfect, and we know you might run into a few challenges along the way. Some existing implementations might be fairly complex and require more work to use Clarity Core, or you might have some customizations on Clarity Angular that would have to be redone. That is why we don’t want to automatically change everything for you, so it doesn’t create unexpected side effects that make your life painful.</p><h3>Reach the bonus levels of Core</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*DX3zexfSuVPGoPeF" /><figcaption>Video game player reaching new levels, just like you have! — Source <a href="https://unsplash.com/photos/oK7agFHGIhk">Unsplash</a></figcaption></figure><p>How else can you begin to adopt Clarity Core?</p><ul><li>You can begin to use Clarity Core components in new work for your application.</li><li>You can use Clarity Core in any legacy aspects of your application that aren’t running on Angular.</li><li>You can prototype new ideas using Clarity Core components.</li><li>You can use the new <a href="https://clarity.design/storybook/core/?path=/story/components-modal-getting-started--page#foundation-design-tokens">Design Tokens</a> for creating <a href="https://clarity.design/storybook/core/?path=/story/components-modal-getting-started--page#foundation-layout">Layouts</a>, <a href="https://clarity.design/storybook/core/?path=/story/components-modal-getting-started--page#foundation-color">Color</a>, <a href="https://clarity.design/storybook/core/?path=/story/components-modal-getting-started--page#foundation-spacing">Spacing</a>, and <a href="https://clarity.design/storybook/core/?path=/story/components-modal-getting-started--page#foundation-typography">Typography</a>, which are one of the most understated features of Clarity Core as it can greatly reduce having to write your own CSS for these common tasks.</li></ul><p>There are no limits to when and how you can adopt Clarity Core inside of your projects. You’ll be able to level up your application consistently as more components are released.</p><p>So what’s next?</p><p>We will deliver on the v5 release and the initial vision for adoption support early next year. However, v5 beta is available today! You can download it using npm install @cds/core@next to add it to your project. You can read the current <a href="https://clarity.design/storybook/core/">documentation on Clarity Core</a>.</p><p>Let us know how it goes from our GitHub project at <a href="https://github.com/vmware/clarity">https://github.com/vmware/clarity</a> and <a href="https://github.com/vmware/clarity/issues">open issues for problems you face</a> or give us feedback in our <a href="https://github.com/vmware/clarity/discussions">new discussions area</a>.</p><p>Keep an eye out for more details coming soon about how we’re going to help you adopt Clarity Core!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a5f3f863139" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/level-up-your-application-by-adopting-clarity-core-8a5f3f863139">Level Up Your Application by Adopting Clarity Core</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design System Performance with Clarity Core Web Components]]></title>
            <link>https://medium.com/claritydesignsystem/design-system-performance-with-clarity-core-web-components-fbab56516f30?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/fbab56516f30</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[clarity-design-system]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Cory Rylan]]></dc:creator>
            <pubDate>Thu, 08 Oct 2020 21:12:55 GMT</pubDate>
            <atom:updated>2020-10-08T21:12:55.782Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lWHoSOaeuk0kjFnNVQtd1w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@chrisliverani?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Chris Liverani</a> on <a href="https://unsplash.com/s/photos/gauge?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Design Systems serve as a foundation for consistent and accessible user interfaces. Components within a design system can also serve as a foundation for the performance of a UI. With <a href="https://clarity.design/storybook/core">Clarity Core</a>, our Web Component library, we wanted to ensure we kept components lightweight to continue a high standard of performance as we develop new components.</p><p>Creating fast user interfaces on the Web is no easy challenge. The same challenges apply to any UI component library. With the <a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">development of Clarity Core</a>, we identified the following key concepts to help keep Clarity’s performance on track.</p><ul><li>Dependency Management</li><li>Modern build targets</li><li>Tree shaking (Components, Icons, CSS)</li><li>Bundling and CDNs</li><li>Rendering</li><li>Measuring and Automation</li></ul><h3><strong>Dependency Management</strong></h3><p>Excessive JavaScript is one of the largest contributors to slow Web applications today. With Clarity Core, we take careful consideration when using an external dependency.</p><ul><li>Can this be accomplished with something existing in the Web platform today?</li><li>Is this utility tree-shakable and side effect free?</li><li>Can we guarantee it does not change the public API of our components?</li><li>Is the kbs cost worth the value?</li></ul><p>Clarity Core uses only a few critical dependencies such as <a href="https://lit-element.polymer-project.org/">lit-element</a> to make it easy to build and maintain Web Components.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/882bdf6a398c3a7d44d7a59fc657eccb/href">https://medium.com/media/882bdf6a398c3a7d44d7a59fc657eccb/href</a></iframe><p>The direct dependencies are all internal in Core and not exposed in any public API. By keeping dependencies internal, we can help ensure long term stability with the component APIs. The optionalDependencies allow applications to choose if a particular dependency needs to be installed. Keeping polyfills an optionalDependency teams can conditionally load them as needed for their target browser support.</p><h3><strong>Modern Build Targets</strong></h3><p>For Clarity Core, we ship the latest es2015+ JavaScript code. Core does not ship ES5 or UMD style bundles. This choice is for maintainability and performance. By shipping modern JavaScript as the default, we can significantly reduce the amount of code sent to the client. By providing a modern JavaScript source, applications start with the lightest option and can optionally downgrade to ES5 for older browser support. This strategy gets us the broadest amount of tooling support in the JavaScript ecosystem.</p><p>For applications that need to target ES5 browsers, the code can be consumed and transpiled with Babel or TypeScript. Many framework tools like the <a href="https://angular.io/guide/deployment#differential-loading">Angular CLI have this ability built right in</a>.</p><p>To learn more about the details of packaging Web Components, I highly recommend these two articles:</p><ul><li><a href="https://open-wc.org/publishing/">https://open-wc.org/publishing/</a></li><li><a href="https://justinfagnani.com/2019/11/01/how-to-publish-web-components-to-npm/">https://justinfagnani.com/2019/11/01/how-to-publish-web-components-to-npm/</a></li></ul><h3><strong>Tree Shaking Web Components</strong></h3><p>Tree shaking is a concept where a build process removes unused code from a final build output. When using a comprehensive design system like Clarity, you may only use a subset of its components. When this happens, we want only the used components end up in your final output shipped to the client. Removing or tree shaking this unused code can significantly improve the startup time of an application.</p><p>To promote tree shaking, we have organized Core to have multiple entry points. Multiple entry points mean there is more than one starting location to import from in a package. Example, a single entry point library may look like the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a55362e02e946c200fb4a99df6d89ff0/href">https://medium.com/media/a55362e02e946c200fb4a99df6d89ff0/href</a></iframe><p>In many cases, this works; however, if we split this into smaller entry points, we can help promote patterns that will improve tree-shaking.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec47936bae95e58c95f2da78ee076345/href">https://medium.com/media/ec47936bae95e58c95f2da78ee076345/href</a></iframe><p>Each component has its own entry point enforcing a hard and clear boundary between components. This boundary helps prevent accidental bundling situations since the components are not referred to in the same entry point file.</p><p>If there is code we need to share between component boundaries, we move it to our internal @clr/core/internal package. This entry point allows us to safely share internal code between component boundaries and encourage code de-duplication at build time.</p><h3>Side Effects</h3><p>Many libraries and even some applications will have a sideEffects key defined within their package.json.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5adc4bf28ed189ba45b825bef6126ed/href">https://medium.com/media/b5adc4bf28ed189ba45b825bef6126ed/href</a></iframe><p>This flag signals bundlers like <a href="https://webpack.js.org/">Webpack</a> and <a href="https://rollupjs.org/">Rollup</a> only to keep code that is exported and used within other modules. This optimization can further reduce the overall bundle size of your applications. However, JavaScript modules natively support side effects. So what is a side effect? A side effect is produced whenever a piece of JavaScript code executes and changes state outside of the executed function. Let’s take a look at this example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/343804889f524043ced412b1d04dae30/href">https://medium.com/media/343804889f524043ced412b1d04dae30/href</a></iframe><p>This file, we have a variable statement, a console log, and two exported functions. With the sideEffects: false flag a bundler will bundle the add() and sub() functions if used in another module. However, the console log and variable will be removed from the final build output. The log and variable are side-effects or code that do work outside the scope of being statically exported.</p><p>With side effects set to false, the bundlers must assume the default JavaScript behavior and include everything in the file/module. That means if you only use the add() function in your application, the bundler will still include sub().</p><p>With our Web Components, we want the optimal performance, but there is a bit of a wrinkle in our sideEffects: false plan. We have to register our components to the custom elements registry to use the in the DOM. The act of registering a component is a side effect, so if we use sideEffects: false in them, our components will never be registered.</p><p>So how do we get around this? We move the side effects into a single register.js file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2048c668baead6f8e6a96142e7e939f4/href">https://medium.com/media/2048c668baead6f8e6a96142e7e939f4/href</a></iframe><p>By moving the side effect of registering our Web Component, we allow the rest of the library to be fully tree shakable and side effect free. We can tell bundlers that we have only one specific side effect file in our package.json.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48a8d2e1968c5105947431a2507181de/href">https://medium.com/media/48a8d2e1968c5105947431a2507181de/href</a></iframe><p>Now, as a user of Clarity, you can import the registration statement to use the component and still get advanced tree shaking capabilities.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c0cb73688010171aa6866a58e74e2a3/href">https://medium.com/media/4c0cb73688010171aa6866a58e74e2a3/href</a></iframe><h3><strong>Tree Shaking Icons</strong></h3><p>With Clarity Core, we have extensive strategies in place to ensure your final build only includes the components that you use. We can take it one step further and tree shake at the symbol level.</p><p>A symbol is anything imported through an import statement. Most build tools like Webpack and Rollup rely on import statements to safely determine what code can or should not be bundled.</p><p>By relying on this behavior, we can improve our icons API to promote tree shaking. With almost 500 icons, we want only the icons you use to make it to the final application build. Including all icons would cause users to download hundreds of kb of embedded SVG in your application. By supporting tree shaking at the icon level, performance can improve as less JavaScript is needed to be parsed on application startup.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16304d6840d0f1c691a845f4b1857aee/href">https://medium.com/media/16304d6840d0f1c691a845f4b1857aee/href</a></iframe><p>By leaning on the side effect free behavior we discussed earlier, a bundler can safely assume only the ClarityIcons service and two icons are used. This explicit import of the icons used within your application allows Webpack or Rollup to safely drop the other 400+ icons from the final production bundle saving hundreds of kbs of JavaScript from having to be sent to the client.</p><p>You can start <a href="https://clarity.design/storybook/core/?path=/story/components-icon-getting-started--page">using Core Icons today</a> within your existing applications, even if you currently use the @clr/icons package.</p><h3><strong>Bundles and CDNs</strong></h3><p>Along with shipping modern, side effect free JavaScript, we do not bundle or minify the source code. This may seem counter-intuitive at first but bundling and minification are application concerns. These optimizations work better at application-level tooling as these tools can understand all dependencies of the entire application.</p><p>Bundling code at the library level can cause dependencies to become difficult to tree shake or de-duplicate in the final build. By keeping everything as plain modern ESM, most bundlers can better optimize your usage of library code.</p><p>By not bundling, we also open the door for the first time to support build-less versions of Clarity. When we keep the source unbundled, we can use native ES modules via a CDN. Using native ESM, the browser can natively load only the modules required with no bundler or build step.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6bc1a2358f169e51c1ce87c0383a0f8/href">https://medium.com/media/f6bc1a2358f169e51c1ce87c0383a0f8/href</a></iframe><p>Prototyping with Clarity has never been easier with CDN support. Check out <a href="https://skypack.dev/">https://skypack.dev/</a> or <a href="https://unpkg.com/">https://unpkg.com/</a> for more details on ESM support.</p><h3><strong>Global and Utility CSS</strong></h3><p>Another significant performance improvement with Clarity Core is our global CSS payload size. Component CSS is inlined within the component. This means that, if you use the button component, the button component CSS is included within the JavaScript. This allows us to significantly reduce the amount of global CSS needed.</p><p>To use the global CSS in Clarity Core, you can import the global file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/269e5f91b80d61e1c76b0122b10aafe1/href">https://medium.com/media/269e5f91b80d61e1c76b0122b10aafe1/href</a></iframe><p>The global stylesheet provides a basic Clarity specific reset, CSS Custom Variables, layout utilities, and typography utilities. Together these total to a final bundled, minified, and compressed output of ~7kb.</p><p>If you only want a subset of these utilities, you can import them directly instead of importing the single global bundle. This lets you pick and choose what you need — resulting in even smaller bundles. We do, however, recommend including the normalize and reset styles at a minimum.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4ff94e78e664c4c865be1142571eac3/href">https://medium.com/media/e4ff94e78e664c4c865be1142571eac3/href</a></iframe><p>Our layout and typography utilities cover many use cases. This causes the initial global CSS bundle to come in around 177kb uncompressed and unminified. But the repetitive nature of the utility selectors allows us to leverage text compression behavior.</p><p>Compression tools like Gzip and Brotli heavily optimize for repetitive text. Because of this behavior, we compile our utility CSS in an order that places similar selectors next to each other in the final output. This enables a 177kb CSS file to be ~7kb with minification and Brotli compression or 10kb with Gzip compression.</p><p>With some tweaks to our CSS output, we can shrink our CSS significantly with text compression. But even though we have a small network payload, we still are sending a lot of potentially unused CSS.</p><h3>Tree Shaking CSS</h3><p>The provided global CSS utilities are also used internally within our Web Components. The Core CSS utilities are extensive and we may only use a small subset of the utilities provided within any given component. We can optimize for this by ensuring only the utilities we use are bundled within our Web Components.</p><p>For this, we use a tool called <a href="https://purgecss.com/">Purge CSS</a> that ensures we only bundle CSS utilities which are used within the component. We run Purge CSS as part of the build process and it tree shakes our CSS within our internal templates.</p><p>For example, if our button only uses a couple of the CSS utilities, we don’t want the 7kb+ of CSS bundled with it nor bundled multiple times for each component. By running Purge CSS, we can check what is used within our component templates and strip out any unused CSS. Here is a snippet demonstrating how we tree shake the CSS in our components.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f71c52dd8153d1f39814980dfb97e1d/href">https://medium.com/media/6f71c52dd8153d1f39814980dfb97e1d/href</a></iframe><p>By tree shaking the CSS used internally by Core components, we further drive down the bundle sizes. While we use Purge CSS at the library level, you can also use it on your applications to reduce your CSS payload. The less CSS that is sent down the wire, the faster the browser can start rendering the page.</p><h3>Rendering</h3><p>With our components using Shadow DOM, we can guarantee a certain amount of containment with CSS layout and behavior. External styles don’t leak into our component, and our component styles don’t leak to the global scope. With this behavior, we can optimize the browser rendering by using the CSS contain property.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0204efb6942bcc4cb6df04188262104e/href">https://medium.com/media/0204efb6942bcc4cb6df04188262104e/href</a></iframe><p>Using the contain property, we tell the browser this element is self-contained and can optimize when to render and re-render it. This can significantly reduce render times on the page as the browser can skip layout recalculations. To dig into this topic, check out the Google Developer Docs on <a href="https://developers.google.com/web/updates/2016/06/css-containment">CSS Contain</a>.</p><p>Now that we have identified all the different strategies to keep Core running at optimal performance, how do we stay on track and prevent performance regressions?</p><h3><strong>Measure and Automate</strong></h3><p>We run a check against our final build output for final payload sizes with each build in our CI process. We use <a href="https://github.com/siddharthkp/bundlesize">bundle-size</a>, which can check what our final file sizes are compressed.</p><p>The bundle-size tool takes a config with maximum sizes for given files. If a file exceeds that size, then the build will fail. This helps catch mistakes that would cause unexpected size increases or issues that would break tree shaking.</p><p>Here is a sample of what our config looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9cc8176aa5b766df6cfc56ef0baa7a3/href">https://medium.com/media/a9cc8176aa5b766df6cfc56ef0baa7a3/href</a></iframe><p>We have a small Webpack build that runs against a single JavaScript file to catch tree shaking regressions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e8c3f73645b362357b8a341893ac93f/href">https://medium.com/media/5e8c3f73645b362357b8a341893ac93f/href</a></iframe><p>This simple file will allow us to test that Webpack can successfully import our two components and icon without bundling any other components or icons. This tests that we are successfully tree shaking at the component level and symbol import level.</p><p>We benchmark our bundle sizes against <a href="https://opensource.google/projects/brotli">Brotli Compression</a> rather than gzip. Brotli is a modern compression format and provides significant improvements over gzip. Most web services and <a href="https://www.netlify.com/blog/2020/05/20/gain-instant-performance-boosts-as-brotli-comes-to-netlify-edge/">CDNs now support Brotli</a> automatically and it is <a href="https://caniuse.com/#feat=brotli">widely supported in browsers</a>.</p><h3>Results</h3><p>With all these optimizations in place, we can create a <a href="http://clarity-core-performance.web.app/">hello world Clarity app </a>consisting of only 17kb of JavaScript and 8kb of CSS with a basic Webpack build. This demo app includes two components: the badge and icon component and two icon shapes. The CSS is our standard global bundle and the normalize.css package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VBSM-4wDQEbBxd14e68PpA.png" /><figcaption>Network usage for an application using a basic Webpack build and Clarity Design Web Components</figcaption></figure><p>While this is lightweight, we can do more. We are only using a fraction of the CSS utilities in this <a href="http://clarity-core-performance.web.app/">simple demo</a>. Using Rollup, we can push the performance even further in our application with just a few adjustments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zfg47a1aQeKvjRCCYtY2sw.png" /><figcaption>Network usage for an optimized application using RollupJS and Clarity Design Web Components</figcaption></figure><p>With Rollup, we can provide a couple of <a href="https://lit-element.polymer-project.org/guide/build">lit-element specific optimizations</a> for our application build. This includes dropping polyfills and minifying our templates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ietieQHlCBspL27_IZyhVQ.png" /><figcaption>Snapshot of final bundle output with Clarity Core and RollupJS</figcaption></figure><p>With both component and icon tree shaking, we can use the <a href="https://github.com/danvk/source-map-explorer">Source Map Explorer</a> tool to verify we are only loading the code we use and our dependencies in our final bundle.</p><p>Using <a href="https://purgecss.com/">PurgeCSS</a>, we can tree shake our unused Global CSS. This pulls our hello world Clarity app down to around 1kb of compressed CSS and around 15kb of compressed JavaScript! While simple, this demo demonstrates the optimizations made possible by component, icon, and CSS tree shaking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*j9hYt8-WeCvTU-uugxVPMw.png" /><figcaption>Lighthouse performance score for an application using Clarity</figcaption></figure><p>With such a light payload, we get an initial render of around 1 second on a simulated 3g connection. Take time to check out the running <a href="https://clarity-core-performance.web.app">demo application</a> and the <a href="https://github.com/vmware/clarity/tree/master/apps/core-rollup-js">source code</a>. You can find more demos in various frameworks in the Clarity Core repository on <a href="https://github.com/vmware/clarity/tree/master/apps">Github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbab56516f30" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/design-system-performance-with-clarity-core-web-components-fbab56516f30">Design System Performance with Clarity Core Web Components</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[QuadriClarity — The Clarity v4 Release]]></title>
            <link>https://medium.com/claritydesignsystem/clarity-v4-how-clarity-expanded-and-improved-baabf1a98923?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/baabf1a98923</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[clarity-design-system]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Matt Hippely]]></dc:creator>
            <pubDate>Tue, 22 Sep 2020 16:51:23 GMT</pubDate>
            <atom:updated>2020-09-22T16:51:23.161Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Clarity logo four angular react and rocket ship" src="https://cdn-images-1.medium.com/max/1024/1*2lWhqZGcfO_WCjAKRcegfQ.png" /></figure><h3>Clarity v4: How Clarity expanded and improved</h3><p>Clarity has a history of growing and becoming more diverse with each major release. Clarity v4 is no exception, as we have continued to iterate and enhance the ability to build accessible enterprise products!</p><h3>Clarity Core, improved by 14 form components</h3><p>Late last year, Clarity promised to move towards a framework-independent design system based on web components. We’ve honored that promise by creating 14 new components for the web, which we call Clarity Core.</p><p>After working with hundreds of real world scenarios utilizing Clarity Core, we were faced with the reality of the foundational need for forms to be integrated into any application that supports a rich interactive experience between users and data. The result was 14 new components that help build your own customizable forms.</p><p><a href="https://clarity.design/storybook/core/?path=/story/forms-preview-forms-getting-started--page">Read more</a> about implementing clear and concise forms that have strong response rates, using several of our new form controls such as:</p><ul><li>Input groups</li><li>Time picker</li><li>Search input</li><li>File input</li><li>And others!</li></ul><figure><img alt="Example showcasing new Clarity form components" src="https://cdn-images-1.medium.com/max/904/1*AQPe9Z_VesaZN7-NZHe4MQ.png" /><figcaption>Example showcasing new Clarity form components</figcaption></figure><h3>Added support for React</h3><p>React is by far the most popular framework among Clarity users. We recognized this when we acknowledged one of the most frequently requested features was React wrappers. Our community is important to us, so we dedicated a large slice of v4 to React wrappers in order to support more people and more teams building more products.</p><p>We enhanced the developer experience by adding the @clr/react library of React wrappers to support React applications.</p><p>React can work with web components, but typically it requires a bit of work on the applications to integrate them correctly. Our library provides a lightweight integration that bypasses the work for developers to integrate. To learn more please view the <a href="https://clarity.design/storybook/core">Core React Documentation</a>.</p><h3>Added combobox to Angular</h3><p>Clarity Angular is built to work with the popular Angular framework, and we remain committed to supporting a great developer experience in Angular.</p><h4>Combobox</h4><p>One of the most frequently requested components that came from our community was the combobox. After careful auditing for accessibility, we created a highly useable and customizable combobox. Additional documentation can get you started in using this new component.</p><p>Beyond Combobox, we’ve had a number of other improvements, fixes, and enhancements that you can read about in our <a href="https://clarity.design/news/v4.0.0">v4 release notes</a>.</p><figure><img alt="Clarity Angular combobox" src="https://cdn-images-1.medium.com/max/998/0*L1cqCfjsUnVWI1ae.png" /><figcaption>Clarity Angular combobox</figcaption></figure><h3>Getting started with v4</h3><h4>Angular</h4><p>If you are using the awesome Angular CLI, it is the easiest way to update your application and use Clarity v4.</p><pre>ng update @clr/angular</pre><p>You can also upgrade manually with NPM or Yarn:</p><pre>npm install @clr/angular @clr/icons @clr/ui</pre><pre>yarn upgrade @clr/angular @clr/icons @clr/ui</pre><h4>Core</h4><p>To upgrade to the latest version of Core, use one of the following commands for NPM or Yarn.</p><pre>npm update @clr/core</pre><pre>yarn upgrade @clr/core</pre><h3>Need help?</h3><p>Inevitably, we all need help from time to time. Clarity recognizes that and we have a lot of different avenues to make sure your experience using Clarity is frictionless.</p><ul><li>Start a discussion on <a href="https://github.com/vmware/clarity/discussions">Github Discussions</a> (a new support channel!)</li><li>Reach out on Twitter (<a href="https://twitter.com/VMwareClarity">@VMwareClarity</a>)</li><li>Report bugs using <a href="https://github.com/vmware/clarity/issues">GitHub Issues</a></li></ul><p>Additionally, when determining if there is a usage question or an issue with one of the components, we recommend isolating the use case and identifying the steps that demonstrate the problem encountered. To that end, we provide versioned <a href="https://stackblitz.com/@clr-team">StackBlitz</a> applications that will help both with determining if there is a question or an issue as well as giving us code that we can use to triage and investigate.</p><h3>What’s next?</h3><p>Clarity is far from being finished, we constantly iterate and improve. We have a lot of work ahead of us. What we have identified on our roadmap looks like this:</p><ul><li><strong>Refreshed and enhanced website</strong>. We have been working hard on a refresh of our website. We’ve changed the design, updated and expanding our content, and are adding more demos and samples for everyone to use.</li><li><strong>More web components</strong>. Our next round of web components are underway, such as: Accordion, Vertical Nav and Dropdowns.</li><li><strong>Alignment between Angular and Core</strong>. We’re working on how to bring the API and behaviors of our existing Angular components in line with the API and behaviors of the Core component, which will help standardize Clarity across frameworks and also support future enhancements.</li><li><strong>Migration and update support</strong>. For applications already using Clarity Angular, we are already working on improving our tooling and automation to better support automatic updates for projects during major release cycles for minimal disruption.</li></ul><h3>In closing</h3><p>As an open source project, Clarity values the community that makes us whole. The community engagement we receive is what helps us align with your needs while we continue to grow our offerings. Don’t see something on our product roadmap that you’re looking for? Lets us know.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baabf1a98923" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/clarity-v4-how-clarity-expanded-and-improved-baabf1a98923">QuadriClarity — The Clarity v4 Release</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Four ways of listening to DOM events in Angular (Part 3: Renderer2.listen)]]></title>
            <link>https://medium.com/claritydesignsystem/four-ways-of-listening-to-dom-events-in-angular-part-3-renderer2-listen-14c6fe052b59?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/14c6fe052b59</guid>
            <category><![CDATA[renderer2]]></category>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[dom-events]]></category>
            <category><![CDATA[vmware]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Shijir Tsogoo]]></dc:creator>
            <pubDate>Fri, 05 Jun 2020 16:14:01 GMT</pubDate>
            <atom:updated>2020-08-30T23:42:56.875Z</atom:updated>
            <content:encoded><![CDATA[<p>In the previous two posts, we did a deep-dive into how we could listen to DOM events in an Angular app through the following two methods:</p><ol><li><a href="https://medium.com/claritydesignsystem/four-ways-of-listening-to-dom-events-in-angular-part-1-event-binding-3ec7e9f51a1d"><strong>Event Binding</strong></a>: One-way data binding, in which information is sent from a component’s template to the component’s class</li><li><a href="https://medium.com/claritydesignsystem/four-ways-of-listening-to-dom-events-in-angular-part-2-hostlistener-1b66d45b3e3d"><strong>@HostListener</strong></a>: Angular decorator that handles events on the host element of a component or directive</li></ol><p>As we covered these methods, we learned how much they simplify the process of listening to DOM events while also providing many other nifty little features. However, a common aspect of these two methods is that they are both completely tied to their template or host element, which creates certain limitations. In this post, we will go over what those limitations are and how we can use Angular’s <a href="https://angular.io/api/core/Renderer2#listen">Renderer2.listen</a> method to resolve them as well as many other cases where you can put it into use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*RaZ1eUz15e8ELop0sZlM5Q.jpeg" /></figure><h4><em>What is Renderer2 in Angular?</em></h4><p>As Angular is a multi-platform framework, it offers secure and easy-to-use tools that manage and abstract away differences across browsers and platforms. One of those tools is <a href="https://angular.io/api/core/Renderer2#renderer2">Renderer2</a>, which is an Angular’s built-in service that provides APIs for interacting with and manipulating DOM elements.</p><p>As different environments such as web browsers, web-workers, and server-side rendering have different implementations of DOM, these Renderer2 APIs are built to manage those differences and yield consistent results. Note that Renderer2 not only facilitates manipulating HTML elements, but also the types of XML, SVG, etc. To learn more about the intricacies of Renderer2, I recommend taking a closer look at its <a href="https://github.com/angular/angular/blob/master/packages/platform-browser/src/dom/dom_renderer.ts">source code</a>.</p><h4>Angular Renderer2.listen <em>vs Element.addEventListener</em></h4><p>Let’s recall how we add and remove event listeners using native DOM APIs. If we want to listen to a mousemove event on some native DOM element and invoke its callback function, onMouseMove, we would call the .addEventListener in the following way:</p><pre>nativeElement.addEventListener(&quot;mousemove&quot;, onMouseMove);</pre><p>To remove this event listener, we need to call .removeEventListener on the same button element with the <strong>exact same matching parameters</strong>:</p><pre>nativeElement.removeEventListener(&quot;mousemove&quot;, onMouseMove);</pre><p>But it’s very easy to blunder when you try to <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#Matching_event_listeners_for_removal">match event listeners for removal</a>. <strong>Properly removing an event listener that is added manually is crucial as it prevents memory leaks as well as performance drag on your application.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*p_kZspv8piN3EA73y5_Hcg.jpeg" /></figure><p>With Renderer2.listen, it becomes much easier to clean up event listeners. Take a look at its API pattern:</p><pre><a href="https://angular.io/api/core/Renderer2"><strong>Renderer2</strong></a><strong>.listen(</strong>target: <em>any</em>, eventName: <em>string</em>, callback: <em>(event: any) =&gt;  boolean | void</em> <strong>)</strong>:<strong> () =&gt; void;</strong></pre><p>You can see that Renderer2.listen method itself returns another method with the type of <strong>() =&gt; void</strong>. That returned method is used for removing the event listener. This is much simpler than trying to match event listeners for removal. Just save the returned method’s reference to a variable or property, and call that whenever you need to remove the listener. Let’s see how this would play out in a simple example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/197023616578efe7071147fd663656f4/href">https://medium.com/media/197023616578efe7071147fd663656f4/href</a></iframe><p>In the example above, I am trying to listen to the mousemove event on document. So I’ve imported Renderer2 into my component first and then added the mousemove event listener todocument through Renderer2.listen in theOnInit cycle.</p><p>Note that when I add the event listener, I’m saving the returned method to the unlistener property which will be called later to remove the event listener in the OnDestroy cycle, which gets called when the component gets destroyed.</p><p>Another important thing to note here is that I’ve passed document not as an object, but as a string. If we pass document as an object, we will see the following error when we try to run our app in a server-side environment:</p><pre>ERROR ReferenceError: document is not defined</pre><p>This is because there are no global objects such as window or document in environments other than web browsers. We could resolve this issue by checking what environment this code is running in. But with Renderer2.listen, we can simply pass either string &quot;document&quot; or &quot;window&quot; and let Angular do the checking for us and adapt to the environment that it’s running in.</p><h4>Angular Renderer2.listen vs Event Binding</h4><p>Let’s see an example where you want to create Drag and Drop functionality using generic mousedown, mousemoveand mouseup events. This example below accomplishes just that through template event binding:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fbasic-dnd-with-template-binding%3Fembed%3D1&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fbasic-dnd-with-template-binding&amp;image=https%3A%2F%2Fc.staticblitz.com%2Fassets%2Ficon-664493542621427cc8adae5e8f50d632f87aaa6ea1ce5b01e9a3d05b57940a9f.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/430f215f6467eff2e09322ad3829d01e/href">https://medium.com/media/430f215f6467eff2e09322ad3829d01e/href</a></iframe><p>The main idea here is that dragging should start with a mousedown event on the draggable element. Only after that first mousedown should we start responding to the mousemove event(s) on the document, as the element could be dragged anywhere on the document. To make sure mousedown is registered first, we check if the draggableEl property is defined in the mousemove event’s handler. On themouseup event, we reset the whole process by simply assigning null to the draggableEl property.</p><p>As you can see in the demo above, the code looks extremely simple… but there are some serious issues that we need to fix. For one, we’ve added three active event listeners on the draggable element that will always be listening until the target element gets removed from the DOM. To make matters worse, we are listening to mousemove and mouseup events globally because they are defined on document. So we are continuously listening and trying to respond to all mousemove and mouseup events on the entire app — and it doesn’t end there! Every time these events fire, they also trigger Angular’s change detection throughout all components and directives, which could cause significant performance deterioration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*X3A1dKgWthdHeQ_aPUQPTQ.jpeg" /></figure><p>The first step to solve the above-mentioned problems is to add the mousemove and the mouseup event listeners <strong>inside</strong> themousedown event listener’s handler. However, we cannot accomplish that with event bindings as they are inlined to their template elements permanently. In the case of using @HostListener, we would still face the same problem.</p><p>Hence, we need to use Renderer2.listen which allows us to dynamically add and remove listeners when only certain conditions are met. In our case, we need to add the mousemove and the mouseup event listeners to document only when the mousedown event is registered on the draggable element. In the example below, I’ve demonstrated how to do that using Renderer2.listen:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fbasic-dnd-with-renderer2-listen%3Fembed%3D1&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fbasic-dnd-with-renderer2-listen&amp;image=https%3A%2F%2Fc.staticblitz.com%2Fassets%2Ficon-664493542621427cc8adae5e8f50d632f87aaa6ea1ce5b01e9a3d05b57940a9f.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/5971d4c313024d7a70703dfa6b48c624/href">https://medium.com/media/5971d4c313024d7a70703dfa6b48c624/href</a></iframe><p>The code is a bit more involved compared to what we saw with the event binding example. Here, the important thing to pay attention to is how we are adding and removing event listeners. Now we have only one active listener on the draggable element instead of three as the event listeners on mousemove and mouseup are nested inside the mousedown event listener’s handler. And you can also see that the event listeners on mousemove and mouseup are removed when the mouseup event fires.</p><p>But we have to address another issue I’ve briefly mentioned earlier: every time one of these mousedown, mousemove, and mouseup events fire, Angular change detection would also run. Remember that Angular change detection runs through all components and directives in the following three cases:</p><ul><li>When event listeners respond to their target DOM events</li><li>When setTimeout() or setInterval() executes</li><li>When ajax requests respond</li></ul><p>This is especially concerning as we are dealing with an event such as mousemove that fires on each pixel movement you make with your mouse. So Angular change detection might be unnecessarily triggered thousands of times. Fortunately, Angular lets us run our code outside of its change detection zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*HDvRl_CKanRqSnWamLrYSw.jpeg" /></figure><p>What we need to do is to make use of <a href="https://angular.io/api/core/NgZone">NgZone</a>, which is a service that lets you run your code inside or outside of the Angular zone. To run our code outside of the Angular zone, we need to use the following API pattern:</p><pre><strong>NgZone.runOutsideAngular</strong>&lt;T&gt;(fn: (...args: any[]) =&gt; T): T</pre><p>We also need to be careful while using the API above because any data binding changes made outside of the Angular zone will not take effect unless you are directly manipulating the DOM. In the case of our Drag and Drop example, we could add mousemove event listener outside of the Angular zone:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e615c5a5fc5a4fdbe207ccf5da5d68d7/href">https://medium.com/media/e615c5a5fc5a4fdbe207ccf5da5d68d7/href</a></iframe><p>As you can see, I’ve placed themousemove event listener entirely inside this.ngZone.runOutsideAngular‘s callback method to prevent change detection from running. But for the mousedown event, change detection would still run when the event fires as this.ngZone.runOutsideAngular is used inside its handler. That’s an important difference to keep in mind. This is the reason why we cannot suppress change detection if we add event listeners through Event Binding or @HostListener methods. Hence, if you need to listen to events that fire frequently many times such mousemove, touchmove, or scroll, consider using Renderer2.listen with this.ngZone.runOutsideAngular.</p><h4>Bonus tip:</h4><p>Another cool feature Renderer2.listen offers is that you can listen to DOM events and also listen to Angular Pseudo Events. That means you could do this:</p><pre>Renderer2.listen(nativeElement, &quot;<strong>keyup.enter</strong>&quot;, event =&gt; { ... })</pre><pre>Renderer2.listen(nativeElement, &quot;<strong>keydown.esc</strong>&quot;, event =&gt; { ... })</pre><pre>Renderer2.listen(nativeElement, &quot;<strong>keyup.arrowup</strong>&quot;, event =&gt; { ... })</pre><pre>Renderer2.listen(nativeElement, &quot;<strong>keyup.arrowdown</strong>&quot;, event =&gt; { ... })</pre><p>If you want to learn more about Angular Pseudo Events, please refer to <a href="https://medium.com/claritydesignsystem/angular-pseudo-events-d4e7f89247ee">this article</a>.</p><h3>Let’s recap — Key Takeaways:</h3><ul><li><a href="https://angular.io/api/core/Renderer2#renderer2">Renderer2</a> is Angular’s built-in service that provides APIs for interacting with and manipulating DOM elements. Manipulating DOM elements through Renderer2 yields consistent results across different web browsers as well as environments.</li><li>With Renderer2.listen, it becomes much easier to clean up event listeners. You no longer need to <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#Matching_event_listeners_for_removal">match event listeners for removal</a>.</li><li>Unlike Event Binding or @HostListener methods, with Renderer2.listen, you can manage complex event listeners by adding and removing them on specific conditions.</li><li>You can leverage Renderer2.listen together with NgZone.runOutsideAngular to suppress Angular change detection.</li></ul><p>Stay tuned for the next blog post of this series, which will be on RxJS and how we could use it to listen to DOM events in Angular app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14c6fe052b59" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/four-ways-of-listening-to-dom-events-in-angular-part-3-renderer2-listen-14c6fe052b59">Four ways of listening to DOM events in Angular (Part 3: Renderer2.listen)</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clarity 3.0: Good things come in 3's]]></title>
            <link>https://medium.com/claritydesignsystem/clarity-3-0-good-things-come-in-3s-56df0eb0a757?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/56df0eb0a757</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[clarity-design-system]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Rebecca McMillin]]></dc:creator>
            <pubDate>Wed, 25 Mar 2020 20:18:24 GMT</pubDate>
            <atom:updated>2020-04-06T18:45:44.025Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qh6h6N5_S70lLd7fzNnIzA.png" /><figcaption>Clarity v3 illustration by Stela Stamenkova-Din</figcaption></figure><h3>Clarity turned three and just released 3.0</h3><p><em>Omne trium perfectum</em> translated into English means <em>the rule of three</em>, which roughly means that everything that comes in threes is whole and complete. True to that rule, the Clarity Design System has released one of its biggest updates to date with more new features in this release than v1 &amp; 2 combined; with new components, enhancements, accessibility improvements and the initial set of elements for our framework independent <a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">Clarity Core</a> initiative.</p><p>The focus of this release was to deepen our commitment to accessibility and usability in the enhancement of our most utilized components Datagrid and Form Controls, while officially launching <a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">Clarity Core</a>.</p><h4><strong>Clarity’s top 3 new component enhancements:</strong></h4><p><a href="https://clarity.design/documentation/datagrid/detail-pane"><strong>The Detail Pane</strong></a><strong><br></strong>The Datagrid has a new pattern for viewing details of a specific record, called the <a href="https://clarity.design/documentation/datagrid/detail-pane">Detail Pane</a>. This is our recommended way to show more complex details over the existing expandable rows feature, because it provides more space for your content, has stronger accessibility semantics, and has a better overall user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*0nT-NCihbfjj5hWUJV-ESQ.gif" /><figcaption>Detail pane animated image</figcaption></figure><p><a href="https://clarity.design/documentation/datalist"><strong>Datalist Form Control</strong></a><strong><br></strong>Browsers natively support the HTML <a href="https://clarity.design/documentation/datalist">Datalist</a> form control, which is a lightweight way to create an input field that has autocomplete from a list of options. While the Combobox is still in the works, the Datalist component can meet many of the typical autocomplete form control needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*FjsZkPDDn_PwEY_UfXldhg.gif" /><figcaption>Datalist animated example</figcaption></figure><p><a href="https://clarity.design/documentation/range"><strong>Range slider</strong></a><strong><br></strong>In addition to the Datalist, we’ve also create a new range slider form control to allow you to easily define a slider control to set a value between two numbers. Not all browsers support a <a href="https://clarity.design/documentation/range">range slider</a>, and those that do have a very different visual appearance, but Clarity’s range slider works in all browsers and is visually consistent with the rest of our form controls, a big task for a small component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*dksx-vgRpaNzqmngpyULoQ.gif" /><figcaption>Range slider animated example</figcaption></figure><p>There’s much more in this release, like our volume 17 icons, making Aria live service public, Angular 9 integration and more; check out the full <a href="https://clarity.design/news/3.0.0">release here</a>.</p><p><strong>Introducing </strong><a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc"><strong>Clarity web components</strong></a><strong> library</strong><br>We introduced our Clarity Core initiative last year, and v3 marks the first beta release. We’ve built 6 fundamental elements that will be used to build other more complex components so that non-Angular frameworks can be aligned with Clarity in a highly efficient, streamlined integration. More details on the Clarity Core initiative <a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">here</a>.</p><p>We’re working hard to bring parity to all our components regardless of your framework, that is fully accessible, open source and enterprise ready. If you are using a framework other than Angular to build your applications, try out the Clarity Core preview and help us build the elements you need by <a href="https://github.com/vmware/clarity/blob/master/docs/CODING_GUIDELINES_CORE.md">contributing</a>! For anyone using Angular, you won’t need to work with Clarity Core at this time. Learn more about the <a href="https://clarity.design/storybook/core">release here</a>.</p><h3><strong>New Design and Accessibility Improvements</strong></h3><p>Clarity continues to improve by addressing usability and improving design tools available. We’ve worked hard to minimize disruptions to align the UI and expected behaviors to ensure smoother upgrades.</p><p><strong>Updated HSL color system<br></strong>We’ve aligned our color palette to use HSL instead of HEX codes, so that the color progression in a particular color series is based on the same hue. This change also makes it easier to calculate compatible colors. Color variables are provided to easily use the color options.</p><p><strong>Updated over 100 accessibility tickets<br></strong>In the past 6 months, we solved over 100 accessibility needs that help every Clarity consumer meet quality accessibility WCAG 2.1 compliance requirements, while saving months of time, generally a 25% savings in accessibility remediation. Clarity is proud to be fully accessible with minor exceptions we are prioritizing.</p><p><strong>Published a new </strong><a href="https://www.vmware.com/help/accessibility.html"><strong>VPAT</strong></a><br>Review our updated VPAT for <a href="https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/product/vpat/vmware-clarity-design-system-vpat-2.2.pdf">v2.2</a>+ with minor exceptions, we expect to publish a VPAT for v3 soon in the same location as well.</p><h3><strong>How to update to Clarity v3</strong></h3><p>We’ve updated Clarity v3 to work with the recent Angular 9 release. We’ll continue to release according to our release strategy; all new features and enhancements will be available in v3+, and v1 and v2 will continue to be supported with bugfixes. To update, you can follow the basic steps below.</p><p>1. First, update to Angular 9. Ensure that all of your other dependencies are also able to update to Angular 9, and follow the <a href="https://update.angular.io">Angular update guide</a>.</p><p>2. Second, update Clarity. Use the Angular CLI update tooling to update Clarity and run any migration scripts. ng update @clr/angular@latest</p><p>3. Finally, review your application for breaking changes in Clarity. You can view the full list on our <a href="https://clarity.design/news/3.0.0">release notes</a>.</p><p>As only the major update versions have breaking changes, you can expect to update to any patch or minor release within the v3 timeline.</p><h3><strong>What’s next</strong></h3><p>Now that v3 is out, we’re working on our next major milestone. We expect to remain on the same release cadence to follow shortly after the next Angular release. We plan to focus on three key areas for v4.</p><p>1. <strong>Clarity Website</strong> — We are improving the clarity and depth of our documentation, the structure of the site’s navigation, enhancing the quality and consistency of the demos, and insuring a scalable structure for the future.</p><p>2. <strong>Form Improvements</strong> — In addition to the form improvements in v3, we plan to work on additional enhancements. We’re improving and expanding support for more complex form layouts to help our enterprise customers complex needs and introduce additional form controls to allow for greater scalability for the majority of our customers use cases.</p><p>3. <strong>Clarity Core expansion</strong>— Our Clarity Core initiative will bring more foundational details to our framework independent future. The design and layout tokens will allow you to create custom application layouts and will be usable with just CSS/HTML. More details to come.</p><p>We’d love to hear from you, follow us on <a href="https://twitter.com/VMwareClarity">twitter and reach out</a> to help us know what’s working well and what we can improve. Thanks for reading and being a part of the Clarity community helping to contribute and scale the most accessible, enterprise ready, open source design system available!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56df0eb0a757" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/clarity-3-0-good-things-come-in-3s-56df0eb0a757">Clarity 3.0: Good things come in 3&#39;s</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clarity Core]]></title>
            <link>https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc?source=rss----a56d7d294514---4</link>
            <guid isPermaLink="false">https://medium.com/p/72f6d3a029bc</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[custom-elements]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vmwareclarity]]></category>
            <category><![CDATA[clarity-design-system]]></category>
            <dc:creator><![CDATA[Scott Mathis]]></dc:creator>
            <pubDate>Mon, 28 Oct 2019 19:38:12 GMT</pubDate>
            <atom:updated>2019-10-28T19:38:12.437Z</atom:updated>
            <content:encoded><![CDATA[<h4>Our design system’s journey to framework independence</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pl0fa62cPfW6qUQfCtEyHA.png" /><figcaption>“Clarity Rocket” by Stela Stamenkova-Din</figcaption></figure><p><a href="https://medium.com/claritydesignsystem/claritys-future-user-focused-framework-independent-accessible-enterprise-ready-and-open-61a3f62eac93">Two weeks ago, we announced the work we’ve been doing</a> behind the scenes to build Clarity Core, a framework-independent design system based on web components. At a high level, these are our five key goals and drivers:</p><ul><li>Clarity is <strong>user-focused</strong>. Its design patterns are and will continue to be driven by our users.</li><li>Clarity is <a href="https://medium.com/claritydesignsystem/a-commitment-to-accessibility-56dcb88af5c2"><strong>committed to accessibility </strong>and inclusive design</a>.</li><li>Clarity is <strong>enterprise-ready </strong>and we think that raises the bar for usability.</li><li>Clarity has <a href="https://github.com/vmware/clarity">always been and is committed to <strong>remaining open source</strong></a>.</li><li>A big part of Clarity’s future will involve <strong>framework independence</strong>.</li></ul><p>My colleagues have already written about <a href="https://medium.com/claritydesignsystem/a-commitment-to-accessibility-56dcb88af5c2">our commitment to accessibility</a> and the efforts to which we have gone as a team to build an inclusive library of components. Today we will address that last bullet point — <em>framework independence</em>.</p><h3>What is framework independence?</h3><p>A front-end framework is (generally speaking) code written by an outside group or organization that ships with a web application. A framework typically handles the following features:</p><ul><li><em>Routing: </em>switching “pages” of the application without taking you to a new page</li><li><em>Data-binding: </em>when you change information in one place it shows up correctly in another</li><li><em>State management: </em>maintaining consistency of data so that everything remains as expected when you go from one page to another</li></ul><p>Frameworks can do more than this, surely, but that’s the gist of what they do. And <a href="https://github.com/tastejs/todomvc/tree/master/examples">there are hundreds of them</a>.</p><p>For the past decade, the front-end development community has been at the center of a veritable tempest of JavaScript frameworks. The most popular frameworks in use today are <a href="https://reactjs.org">React</a>, <a href="https://angular.io">Angular</a>, <a href="https://emberjs.com/">Ember</a>, and <a href="https://vuejs.org">Vue</a>. And the landscape has been fairly rocky over the past 9 years, leading many to distrust that the current status quo will remain such for very long. That last part is called “framework fatigue” or sometimes “<a href="https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4#.prcj59904">javascript fatigue</a>”.</p><p>In the early days, Clarity rallied around Angular as a way to materialize our design system in a library complex, data-bound components and bring our product teams at VMware together on a common tech stack. This was a huge success for us as we saw the vast majority of products at VMware choosing Angular and Clarity to build their applications.</p><p>The good news is that we will continue to support and drive Angular adoption across the company. But the better news is that our patterns, services, and components will now be available to teams who rely on <a href="https://vuejs.org">Vue</a>, <a href="https://reactjs.org">React</a>, <a href="https://emberjs.com">Ember</a>, <a href="https://elm-lang.org">Elm</a>, or any other framework.</p><p>We feel strongly that the future of all viable component libraries is framework independence and our plan is to deliver on this belief.</p><h3>How are we going to do this?</h3><p>Our plan is to deliver a core set of <a href="https://developers.google.com/web/fundamentals/web-components/customelements">web components</a> in an npm package we are calling Clarity Core. In addition to these components, the Clarity Core library will contain helpers, mixins, services, and utilities that are generally useful across <a href="https://clarity.design/documentation">Clarity Angular</a>, Clarity Core, and <a href="https://clarity.design/icons">Clarity Icons</a>.</p><blockquote>Clarity Core will become a foundational piece of the existing Angular library we have because Clarity Angular will reuse its services and components.</blockquote><h3>Why web components?</h3><p>At this point in time, web components are a <a href="https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements">mature web standard</a>. They are available in <a href="https://caniuse.com/#feat=custom-elementsv1">almost every modern browser</a> and support can be polyfilled back to browsers that lack support.</p><p>We know that custom elements can work across all the browsers we support and that this is the right time to embrace them as a foundation for the Clarity Design System.</p><h3>How will this affect the Angular library?</h3><p>Clarity Core will not affect consumers of the Clarity Angular at all. Even when Clarity Core components and services are used as a foundational piece of the Clarity Angular library, the teams who rely on Clarity Angular will not know or need to know that it is there.</p><blockquote>The goal is to make this as minimally impactful to existing Clarity Angular applications as possible.</blockquote><p>An Angular application should not know or care whether a Clarity component is written 100% in Angular or is built on top of a Clarity Core component.</p><p>Additionally, Clarity will always rely on frameworks to do what they do best because it would be counter-productive for us to try and rebuild a framework inside of a library of web components. Our #1 framework at VMware is Angular, so we are committed in the long-term to supporting and growing Clarity Angular.</p><h3>I’ve had a hard time with web components in React. How does this help me?</h3><p>For the last few months, members of the Clarity team have been doing a deep dive into integrating web components with React applications. At the end of our journey, we identified an architecture of “<em>React wrappers</em>”. We’ve reviewed this architecture with some of VMware’s best React developers to make sure we had their stamp of approval before moving forward.</p><h3>How are you building this?</h3><p>The Clarity team put a lot of effort into researching the best path forward for this library. In the end, we identified <strong><em>three key attributes</em></strong> that we wanted to preserve:</p><ul><li>The architecture of the Clarity Core components library would be <strong><em>familiar </em></strong>enough that contributors with experience working with Clarity Angular could contribute to Clarity Core without a steep learning curve.</li><li>The APIs of the current Angular components would transfer as closely as possible to help manage situations where a current Angular component would be moving to the web component library.</li><li>The code underneath would adhere as closely as possible to emerging web standards as we continue to bet on web standards for the future.</li></ul><p>After several explorations into a variety of possibilities, we arrived at <em>five foundations</em> for the Clarity Core architecture. Note that the following is a deeper dive into the technical aspects of Clarity Core. If that’s not something that interests you, please jump forward to the next question.</p><ol><li><strong>Typescript</strong></li></ol><p><a href="http://www.typescriptlang.org">Typescript</a> is a super-set of Javascript. It is a combination of a type-checker and transpiler. If you are writing Angular code, you are no doubt already familiar with its benefits. Carrying this forward into the Clarity Core component library is fundamental to the goal of the codebase remaining familiar to developers who have been working on Clarity Angular in the past.</p><p>2. <strong>Custom Properties</strong></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties">CSS Custom Properties</a> are the future and this is one big bet we are making on web standards. Custom properties <a href="https://caniuse.com/#feat=css-variables">already work in all major browsers</a>.</p><p>Additionally, custom properties are the most direct way to enable theming in a library of ShadowDOM encapsulated web components.</p><p>3. <strong>Lit Element</strong></p><p><a href="https://lit-element.polymer-project.org">Lit element</a> is an incredibly solid and light foundation upon which to build a library of web components. Lit is maintained by the Polymer team at Google and our esteem for this library has grown the more we have worked with it.</p><p>Besides being a very lightweight dependency, Lit follows web standards — which was important to us because we believe web standards are the future. It also feels great to have your sole, major dependency be such a thin layer above the code running in the browser itself.</p><p>Lit is more than syntactic sugar, but one would be excused for viewing it as a convenient base class and nothing more. The simplicity and transparency of Lit also support our desire to keep the architecture as easy to work with as possible.</p><p>4. <strong>Minimally Stateful</strong></p><p>In our research, we wanted to make sure that Clarity Core components would be easy to use for product teams working in Angular or React. For extra credit, we also dove into Vue and a couple of other frameworks. We did hit a minor speed bump, however.</p><blockquote>Angular’s views and change detection cycle are just different enough from React’s Flux architecture and Virtual DOM that the way a developer works in one framework may not necessarily follow in the other framework.</blockquote><p>Sure, Angular developers have NgRx and can use that for state management combined with advanced (or some would say proper) use of RxJS to implement the Flux architecture in their Angular applications. But we do not have the luxury of only supporting one implementation of the Angular application architecture.</p><p>It also became clear early on that the current Clarity Angular library of components offers functionality tied to Angular. This constituted functionality that it would make no sense for us to replicate in a library of web components.</p><p>To be more specific, we are talking about features in Angular like reactive forms, routing, and two-way binding. While most frameworks have their own spin on these features, it became clear that most frameworks weren’t always in alignment on the details. In the end, we found <em>there was no one ideal solution</em>.</p><p>Our team now jokingly refers to the task of building frameworks-within-frameworks as “<em>Frankenstein Angular</em>” and have decided against re-building “framework features” into a framework-agnostic library of components.</p><blockquote>Instead, we decided the best path forward was to adopt a strategy of being “<strong>minimally stateful</strong>”.</blockquote><p>There are some features of a component that it would be tiresome to have to turn on and off from your application. Being “minimally stateful” means we will handle those tasks for you, track them for you, and communicate any changes so you can keep your application’s state current if you need to.</p><p>But we also concluded that any features of a component that an application developer might reasonably want to circumvent should be driven and managed by the application’s state — not from within the component.</p><p>As a consequence, a datagrid in Clarity Core won’t manage large chunks of data like the datagrid in Clarity Angular does. Likewise, a wizard in Clarity Core won’t be managing the state of its pages and the user’s ability to navigate them in the same way either.</p><p>While this may be a little surprising for developers used to monolithic, black-box components that gobble up hundreds of lines of JSON configurations, we feel confident that this will ultimately be liberating for application developers because it puts a level of customization in their hands that other libraries cannot match.</p><p>It also lowers the requirements for developers to invest in learning a component library API — especially one that may run counter to their framework of choice.</p><p>5. <strong>Reduce Through Reuse</strong></p><p>Ultimately, Clarity Core will be a refinement of the vision that resulted in the current library of Angular components.</p><blockquote>The intent with this new initiative is not to duplicate the effort with an unrelated library that requires separate support, maintenance, and its own entire team. The real value of Clarity Core, for us, is in what we can abstract and reuse.</blockquote><p>There are going to be some components in Clarity Angular that will always be built on top of Angular–even if they have a replicate in Clarity Core. But many, if not most, components in our Angular library will become wrappers for Clarity Core components. This will help our team differentiate between framework-driven features and core features of the components we deliver.</p><h3>How do we get there?</h3><p>We have a lot of work ahead of us and some effort towards fixing up the current Clarity architecture to allow for a new library of web components.</p><p>Presently, our roadmap to web components looks something like this:</p><h4>CSS Custom Properties–3.0 release (Nov-Dec 2019)</h4><p>Refactoring Clarity to use CSS Custom Properties is a big task — and one we completed just this month! We started by proving that we could use custom properties in all our supported browsers and reliably use them across the Shadow DOM.</p><p>The implementation involved cleaning up some technical debt in our SASS/CSS and then a significant chore of creating all the CSS Custom Properties. In addition, we handled the delivery in a way that isn’t a huge breaking change for teams that don’t need to theme their applications or prefer to use the SASS-based theming we support today through 3.0.</p><blockquote>But to fully realize the benefits of the web components in Clarity Core, we have to deprecate SASS-based theming in 3.0. <strong>This means, starting in 4.0, CSS Custom Properties will be the only way to theme Clarity applications.</strong></blockquote><h4>Move Clarity Icons to Core–3.0 release (Nov-Dec 2019)</h4><p>The <strong>Clarity Icons migration</strong> is our first proving ground for the Lit-based architecture and a fundamental effort towards delivering our set of essential components.</p><h4>Foundational Components–Q1 2020</h4><p>Following the icons migration, we will see more <strong>foundational components </strong>entering the fray.</p><blockquote>By “<em>foundational components</em>”, I mean components upon which more complex components depend. We cannot, for example, have an “icon button” without icons–or buttons.</blockquote><h4>Strategic Components–2020</h4><p>After we complete our foundational components, we plan to move on to <em>“strategic components”</em><strong> </strong>through the remainder of 2020. This phase two of component delivery will not constitute <em>all</em> of the components in Clarity Angular today but it will be a good number of them.</p><p>When designating something as a strategic component, we are looking for components that satisfy one of three criteria:</p><ol><li>Components that <strong><em>fill an immediate need</em></strong> with a component that non-Angular teams interested in using Clarity do not have access to today…</li><li>Components that <strong><em>augment the Clarity Angular library </em></strong>with components that the library currently doesn’t have, and…</li><li><strong><em>High-value components </em></strong>that are not easily replicated using the HTML and CSS Clarity currently offers.</li></ol><p>This may mean that we don’t jump right into forms. Maybe we focus on something like the datepicker. Or the wizard.</p><blockquote>It all depends on the intersection of need, value, and availability.</blockquote><h4>Contribution Guidelines–Nov 2019</h4><p>Our contribution guidelines<strong> </strong>will be released early on during our work on the “foundational components”. By nature, these components will be simpler in implementation. There will be a lot of “low hanging fruit” componentry that we will not be tackling right out of the gate as we focus on foundational components and more complex, strategic components. This makes this a fertile ground for external contributions and, if you’re looking to contribute, <a href="https://github.com/vmware/clarity/wiki/Contributing">keep an eye out for those contribution guidelines</a>!</p><h4>React Wrappers (2019 on…)</h4><p>Lastly, the foundational component work will introduce our library of <strong>“react wrappers” </strong>for Clarity Core. So keep an eye on those for a preview of how we plan to support React teams with Clarity Core.</p><h3>In Closing</h3><p>When it comes to components geared towards building websites and web applications, we feel the future of the web is <strong><em>framework independence</em></strong>. That doesn’t mean frameworks go away.</p><blockquote>But it does mean that component libraries that rely on a framework for their delivery will become less useful.</blockquote><p>As one of the founders of Clarity, I can say that this team has always bet on the web. Whether it was ES2015/ES6, CSS3, SVG, or HTML5, we unanimously believed the best path forward was adopting web standards.</p><p>We have proven that the time is right for web components and we feel confident that the time is right for Clarity Core.</p><p>Please <a href="https://github.com/vmware/clarity">keep an eye on our github repository</a> as work on Clarity Core progresses! And <a href="https://github.com/vmware/clarity/issues/3668">keep an eye on this RFC</a> for more details and discussion on the architecture of Clarity’s next leap forward.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72f6d3a029bc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/claritydesignsystem/clarity-core-72f6d3a029bc">Clarity Core</a> was originally published in <a href="https://medium.com/claritydesignsystem">Clarity Design System</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>