<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:webfeeds="http://webfeeds.org/rss/1.0">
  <title>Lit Blog</title>
  <subtitle>Latest news, announcements, and highlights from the Lit team and community.</subtitle>
  <link rel="alternate" href="https://lit.dev/blog/"/>
  <link rel="self" href="https://lit.dev/blog/atom.xml"/>
  <id>https://lit.dev/blog/</id>
  <icon>https://lit.dev/images/icon.svg</icon>
  <logo>https://lit.dev/images/logo.svg</logo>
  <webfeeds:icon>https://lit.dev/images/icon.svg</webfeeds:icon>
  <webfeeds:logo>https://lit.dev/images/logo.svg</webfeeds:logo>
  <updated>2022-09-06T00:00:00Z</updated>
    
    <entry>
      <title>Lightning-fast templates &amp; Web Components: lit-html &amp; LitElement</title>
      <link href="https://lit.dev/blog/2019-02-05-lit-element-and-lit-html-release/"/>
      <updated>2019-02-05T00:00:00Z</updated>
      <id>https://lit.dev/blog/2019-02-05-lit-element-and-lit-html-release/</id>
      <summary>Announcing the stable releases of our next-generation web development libraries.</summary>
        
        <author>
          <name>Justin Fagnani</name>
          
            <uri>https://twitter.com/justinfagnani</uri>
          
        </author>
      <content type="html">
        &lt;p&gt;Today we&#39;re excited to announce the first stable releases of our two
next-generation web development libraries:
&lt;a href=&quot;https://lit-html.polymer-project.org/&quot;&gt;lit-html&lt;/a&gt; and
&lt;a href=&quot;https://lit-element.polymer-project.org/&quot;&gt;LitElement&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;lit-html is a tiny, fast, expressive library for HTML templating. LitElement is
a simple base class for creating Web Components with lit-html templates.&lt;/p&gt;
&lt;p&gt;If you&#39;ve been following the projects, you probably know what lit-html and
LitElement are all about (and you can &lt;a href=&quot;https://lit.dev/blog/2019-02-05-lit-element-and-lit-html-release/#get-started&quot;&gt;skip to the end&lt;/a&gt; if you
like). If you&#39;re new to lit-html and LitElement, read on for an overview.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;lit-html:-a-tiny-fast-library-for-html-templating&quot; tabindex=&quot;-1&quot;&gt;lit-html: a tiny, fast library for HTML templating&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;lit-html is a tiny (just over 3k bundled, minified, and gzipped) and fast
JavaScript library for HTML templating. lit-html works well with functional
programming approaches, letting you express your application&#39;s UI declaratively,
as a function of its state.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;cm-def&quot;&gt;myTemplate&lt;/span&gt; &lt;span class=&quot;cm-operator&quot;&gt;=&lt;/span&gt; (&lt;span class=&quot;cm-def cm-local&quot;&gt;name&lt;/span&gt;) &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    Hi, my name is &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable-2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;.&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It&#39;s simple to render a lit-html template:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;(&lt;span class=&quot;cm-variable cm-callee&quot;&gt;myTemplate&lt;/span&gt;(&lt;span class=&quot;cm-string&quot;&gt;&#39;Ada&#39;&lt;/span&gt;), &lt;span class=&quot;cm-variable&quot;&gt;document&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;body&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Re-rendering a template only updates the data that&#39;s changed:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;(&lt;span class=&quot;cm-variable cm-callee&quot;&gt;myTemplate&lt;/span&gt;(&lt;span class=&quot;cm-string&quot;&gt;&#39;Grace&#39;&lt;/span&gt;), &lt;span class=&quot;cm-variable&quot;&gt;document&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;body&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;lit-html is efficient, expressive, and extensible:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Efficient&lt;/strong&gt;. lit-html is lightning fast. When data changes, lit-html
doesn&#39;t need to do any diffing; instead, it remembers where you inserted
expressions in your template and only updates these dynamic parts.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Expressive&lt;/strong&gt;. lit-html gives you the full power of JavaScript, declarative
UI, and functional programming patterns. The expressions in a lit-html
template are just JavaScript, so you don&#39;t need to learn a custom syntax and
you have all the expressiveness of the language at your disposal. lit-html
supports many kinds of values natively: strings, DOM nodes, arrays and more.
Templates themselves are values that can be computed, passed to and from
functions, and nested.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Extensible&lt;/strong&gt;: lit-html is also customizable and extensible—your very own
template construction kit. Directives customize how values are handled,
allowing for asynchronous values, efficient keyed-repeats, error boundaries,
and more. lit-html includes several ready-to-use directives and makes it
easy to define your own.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A number of libraries and projects have already incorporated lit-html. You can
find a list of some of these libraries in the
&lt;a href=&quot;https://github.com/web-padawan/awesome-lit-html&quot;&gt;awesome-lit-html&lt;/a&gt; repo on
GitHub.&lt;/p&gt;
&lt;p&gt;If templating is all you need, you can get started now with the &lt;a href=&quot;https://lit-html.polymer-project.org/&quot;&gt;lit-html
docs&lt;/a&gt;. If you&#39;d like to build components
to use in your app or share with your team, read on to learn more.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;litelement:-a-lightweight-web-component-base-class&quot; tabindex=&quot;-1&quot;&gt;LitElement: a lightweight Web Component base class&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;LitElement is a lightweight base class that makes it easier than ever to build
and share Web Components.&lt;/p&gt;
&lt;p&gt;LitElement uses lit-html to render components and adds APIs to declare reactive
properties and attributes. Elements update automatically when their properties
change. And they update &lt;em&gt;fast&lt;/em&gt;, without diffing.&lt;/p&gt;
&lt;p&gt;Here&#39;s a simple LitElement component:&lt;/p&gt;
&lt;litdev-switchable-sample&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;@&lt;span class=&quot;cm-variable cm-callee&quot;&gt;customElement&lt;/span&gt;(&lt;span class=&quot;cm-string&quot;&gt;&#39;name-tag&#39;&lt;/span&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cm-def cm-type&quot;&gt;NameTag&lt;/span&gt; &lt;span class=&quot;cm-keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;cm-type&quot;&gt;LitElement&lt;/span&gt; {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  @&lt;span class=&quot;cm-variable cm-callee&quot;&gt;property&lt;/span&gt;()&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-def cm-property&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;cm-operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;cm-string&quot;&gt;&#39;a secret&#39;&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-def cm-property&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Hi, my name is &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;!&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  }&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cm-type cm-def&quot;&gt;NameTag&lt;/span&gt; &lt;span class=&quot;cm-keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;LitElement&lt;/span&gt; {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;cm-def cm-property&quot;&gt;properties&lt;/span&gt; = {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    name: {},&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  };&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-variable cm-callee&quot;&gt;constructor&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-keyword&quot;&gt;super&lt;/span&gt;();&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;cm-operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;cm-string&quot;&gt;&#39;a secret&#39;&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  }&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Hi, my name is &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;!&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  }&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable&quot;&gt;customElements&lt;/span&gt;.&lt;span class=&quot;cm-property cm-callee&quot;&gt;define&lt;/span&gt;(&lt;span class=&quot;cm-string&quot;&gt;&#39;name-tag&#39;&lt;/span&gt;, &lt;span class=&quot;cm-variable&quot;&gt;NameTag&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/litdev-switchable-sample&gt;
&lt;p&gt;This creates an element you can use anywhere you&#39;d use a regular HTML element:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;name-tag&lt;/span&gt; &lt;span class=&quot;cm-attribute&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;cm-string&quot;&gt;&quot;Ida&quot;&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&amp;lt;/name-tag&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you use Web Components already, you&#39;ll be happy to hear that they&#39;re now
natively supported in Chrome, Safari and Firefox. Edge support is coming soon,
and polyfills are only needed for legacy browser versions.&lt;/p&gt;
&lt;p&gt;If you&#39;re new to Web Components, you should give them a try! Web Components let
you extend HTML in a way that interoperates with other libraries, tools, and
frameworks. This makes them ideal for sharing UI elements within a large
organization, publishing components for use anywhere on the web, or building UI
design systems like Material Design.&lt;/p&gt;
&lt;p&gt;You can use custom elements anywhere you use HTML: in your main document, in a
CMS, in Markdown, or in views &lt;a href=&quot;https://custom-elements-everywhere.com/&quot;&gt;built with
frameworks&lt;/a&gt; like React and Vue. You can
also mix and match LitElement components with other Web Components, whether
they&#39;ve been written using vanilla web technologies or made with the help of
tools like &lt;a href=&quot;https://developer.salesforce.com/blogs/2018/12/introducing-lightning-web-components.html&quot;&gt;Salesforce Lightning Web
Components&lt;/a&gt;,
Ionic&#39;s &lt;a href=&quot;https://stenciljs.com/&quot;&gt;Stencil&lt;/a&gt;,
&lt;a href=&quot;https://skatejs.netlify.com/&quot;&gt;SkateJS&lt;/a&gt; or the &lt;a href=&quot;https://polymer-library.polymer-project.org/&quot;&gt;Polymer
library&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;get-started&quot; tabindex=&quot;-1&quot;&gt;Get started&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Want to try lit-html and LitElement? A good starting point is the LitElement
tutorial:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://lit-element.polymer-project.org/try&quot;&gt;Try LitElement&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you&#39;re interested in using lit-html by itself, or integrating lit-html
templating into another project, see the lit-html docs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://lit-html.polymer-project.org/&quot;&gt;lit-html docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As always, let us know what you think. You can reach us on
&lt;a href=&quot;https://lit.dev/discord/&quot;&gt;Discord&lt;/a&gt; or &lt;a href=&quot;https://twitter.com/buildWithLit&quot;&gt;Twitter&lt;/a&gt;. Our projects
are open source (of course!) and you can report bugs, file feature requests or
suggest improvements on GitHub:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/lit/lit&quot;&gt;lit-html on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/Polymer/lit-element&quot;&gt;LitElement on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </content>
    </entry>
    
    <entry>
      <title>LitElement 3.0 &amp; lit-html 2.0: Early Preview Release</title>
      <link href="https://lit.dev/blog/2020-09-22-lit-element-and-lit-html-next-preview/"/>
      <updated>2020-09-22T00:00:00Z</updated>
      <id>https://lit.dev/blog/2020-09-22-lit-element-and-lit-html-next-preview/</id>
      <summary>Preview the next major versions of LitElement and lit-html.</summary>
      <content type="html">
        &lt;p&gt;Today we’re publishing the first preview releases of the next major versions of
our flagship libraries, LitElement and lit-html.&lt;/p&gt;
&lt;p&gt;These releases include most of the breaking changes we intend to make, and most
of the functionality we want to carry over from the previous versions. They are
not yet feature complete or fully API stable. Notably, they don’t yet support
legacy browsers like IE11, or browsers requiring the web components polyfill.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;motivation&quot; tabindex=&quot;-1&quot;&gt;Motivation&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;We’ve been very happy with the current versions of our libraries—they’re fast,
small, and stable (yay!)—and in some ways we don’t have very many pressing needs
to make breaking changes. We don’t make breaking changes lightly. But there are
some compelling reasons for changes that we think will improve the
user-experience of components and applications built with LitElement.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We have found that some of our browser-bug workaround code and customization
abstractions prevent optimizations that we would like to do.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Size&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;That same code, and our extensive public API, costs bytes. We always
want to find ways to make the libraries smaller.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Features &amp;amp; API cleanup&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Some features are difficult to add in a
cost-effective way with the current architecture, or can’t really be improved
without breaking changes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Server-side-rendering&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;lit-html has an extremely flexible and customizable API, and in some ways is
more of a template-system construction kit than a single template-system. But
this flexibility complicates SSR, which needs to make assumptions about how
the server-rendered HTML maps to templates. SSR would only work well with the
default, uncustomized lit-html, so limiting customization makes SSR more
reliable. Very few developers used the customization APIs anyway.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We also want to make the directive API SSR compatible by limiting access to the
DOM.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;what&#39;s-changed&quot; tabindex=&quot;-1&quot;&gt;What’s changed&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;These are new major versions, so there are some breaking changes, but we want to
minimize disruption to our users as much as possible. We’ve limited the breaking
changes so that they don’t affect most users, or only require a mechanical
change (like changing an import).&lt;/p&gt;
&lt;p&gt;Please see the READMEs
(&lt;a href=&quot;https://github.com/lit/lit/tree/lit-next/packages/lit-element#readme&quot;&gt;LitElement&lt;/a&gt;,
&lt;a href=&quot;https://github.com/lit/lit/tree/lit-next/packages/lit-html#readme&quot;&gt;lit-html&lt;/a&gt;)
and CHANGELOGs
(&lt;a href=&quot;https://github.com/lit/lit/blob/lit-next/packages/lit-element/CHANGELOG.md&quot;&gt;LitElement&lt;/a&gt;,
&lt;a href=&quot;https://github.com/lit/lit/blob/lit-next/packages/lit-html/CHANGELOG.md&quot;&gt;lit-html&lt;/a&gt;)
for the most detailed list of changes.&lt;/p&gt;
&lt;p&gt;The most important changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Customizing the syntax of lit-html is no longer directly supported. The
templateFactory and TemplateProcessor APIs have been removed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The public API has been minimized in order to facilitate better minification
and future evolution.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The lit-html directive API has changed to be class-based and to persist
directive instances. Directives should be easier to write and easier to make
SSR compatible.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The LitElement decorators are no longer exported from the main module—they
have to be imported individually or from a new &lt;code&gt;lit-element/decorators.js&lt;/code&gt;
module. This means smaller app sizes for non-decorator-users and opens the
door to new decorators implementing the current TC39 JavaScript proposal when
those arrive.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;lit-html no longer uses &lt;code&gt;instanceof&lt;/code&gt; or module-level WeakMaps to detect
special objects like template results and directives, which should improve the
compatibility of multiple copies of lit-html in a single app. We still
recommend de-duping npm packages, but more cases will work now.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Safari 12 has a critical &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=190756&quot;&gt;template literal
bug&lt;/a&gt;, which is no longer
worked around in lit-html. If you support Safari 12 you will have to compile
template literals to their ES5 equivalent. Note that babel-preset-env already
does this for the broken versions of Safari.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are smaller changes listed in the change logs. Overall we hope these
versions are drop in replacements for most users, or only require updating
decorator imports.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;installation&quot; tabindex=&quot;-1&quot;&gt;Installation&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Run:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;npm i lit-element@next-major&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And/or:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;npm i lit-html@next-major&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;submitting-feedback&quot; tabindex=&quot;-1&quot;&gt;Submitting feedback&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;We’re in the process of moving the next versions of LitElement and lit-html into
a mono-repo. Please file issues on the &lt;a href=&quot;https://github.com/lit/lit/issues&quot;&gt;current lit-html
repo&lt;/a&gt;, using a prefix of
&lt;code&gt;[lit-html]&lt;/code&gt; or &lt;code&gt;[lit-element]&lt;/code&gt;. We expect that, as with any pre-release, there
will be common issues we will have to fix. Please search for your issue first.
Issues for the next major versions will have the label lit-next.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;what&#39;s-next&quot; tabindex=&quot;-1&quot;&gt;What’s next&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;For the next preview release we will be focusing on browser and polyfill
support, especially IE11.&lt;/p&gt;

      </content>
    </entry>
    
    <entry>
      <title>Lit 2.0: Meet Lit, all over again!</title>
      <link href="https://lit.dev/blog/2021-04-21-lit-2.0-meet-lit-all-over-again/"/>
      <updated>2021-04-21T00:00:00Z</updated>
      <id>https://lit.dev/blog/2021-04-21-lit-2.0-meet-lit-all-over-again/</id>
      <summary>New name, new site, new version: smaller, better, faster, and SSR-ready.</summary>
        
        <author>
          <name>Gray Norton</name>
          
            <uri>https://twitter.com/graynorton</uri>
          
        </author>
      <content type="html">
        &lt;p&gt;Today, we’re excited to announce the first release candidate of Lit 2.0!&lt;/p&gt;
&lt;p&gt;As we shared &lt;a href=&quot;https://github.com/lit/lit/issues/1182&quot;&gt;last&lt;/a&gt;
&lt;a href=&quot;https://github.com/Polymer/lit-element/issues/1077&quot;&gt;summer&lt;/a&gt;, we have been hard
at work on our first major update since shipping production-ready versions of
lit-html and LitElement in early 2019. We’re calling this update Lit 2.0.&lt;/p&gt;
&lt;p&gt;The API has been stable for a few months, and we’ve gotten great feedback from
prerelease users, so late last night we cut our first release candidate. All
that stands between us and an official release is a bit more time for developers
to put the software through its paces and identify any final issues.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;what&#39;s-in-the-new-version&quot; tabindex=&quot;-1&quot;&gt;What’s in the new version?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Our major goals for Lit 2.0 were to reduce size, add powerful new features,
improve performance and make some key changes under the hood to facilitate
server-side rendering (SSR) — all while minimizing breaking changes. Easy,
right?&lt;/p&gt;
&lt;p&gt;Happily, we might have actually done it! To paraphrase a popular dance track
from the early days of the Web, Lit 2.0 is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Smaller.&lt;/strong&gt; Lit 2.0’s templating system weighs in at 2.8k (minified and
compressed), 10% smaller than the previous version, and its complete component
base class (including templating) is just 5.2k, 20% smaller than before.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Better.&lt;/strong&gt; Meanwhile, we’ve added a raft of new features, including several
templating enhancements; a clean, new, class-based API for directive authors;
and reactive controllers, a powerful new primitive for sharing stateful logic
between components.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Faster.&lt;/strong&gt; Efficient rendering has always been one of our core values, and
Lit 2.0 is speedier than ever before: up to 20% faster on initial render, and
up to 15% faster on updates.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Server.&lt;/strong&gt; Lit 2.0 includes the foundation for fast, streaming SSR and
flexible client-side hydration, unlocking a full range of use cases — from
integration with popular frameworks (e.g., Next.js) and static site generators
(e.g., eleventy) to apps built entirely with Lit and other web components.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And all of these improvements come with minimal changes to the existing API: the
vast majority of existing Lit code will run with little to no modification. If
you’re updating from a previous version, check out our helpful &lt;a href=&quot;https://lit.dev/docs/releases/upgrade/&quot;&gt;upgrade guide&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;what-else-is-new&quot; tabindex=&quot;-1&quot;&gt;What else is new?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;As we hinted above, the big news doesn’t end with the Lit 2.0 update — we’ve also made some major improvements beyond the software itself.&lt;/p&gt;
&lt;p&gt;Most importantly, we’ve simplified our packaging, docs and presence. Whereas lit-html and LitElement have historically been separate packages with separate sites and docs, we’ve now combined them into a single product with a clear, simple identity — Lit — and a distinctive new logo.&lt;/p&gt;
&lt;p&gt;Users have casually referred to our offerings as “Lit” for some time. By formalizing this name and simplifying the way we deliver the software, we aim to make Lit even easier to understand and use.&lt;/p&gt;
&lt;p&gt;So, what does this mean in practice?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;A new npm package:&lt;/strong&gt; Installing Lit is now as simple as typing &lt;code&gt;npm i lit&lt;/code&gt;.
Since this is really our second major release, we chose to release the initial
version of the new package as 2.0.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;A new website:&lt;/strong&gt; &lt;a href=&quot;https://lit.dev/&quot;&gt;lit.dev&lt;/a&gt; is a brand new, one-stop shop for all things Lit, with
a complete set of unified docs, a no-install interactive tutorial, a
playground for exploring and creating sample code, and a dedicated Lit blog.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;A new home on GitHub:&lt;/strong&gt; We’ve moved our source code and issue tracker to the
new &lt;a href=&quot;https://github.com/lit/lit&quot;&gt;Lit org&lt;/a&gt; on GitHub. Most of the code lives in
the new lit mono-repo, which simplifies testing and releasing and makes the
project more approachable for external contributors.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;A new Twitter handle:&lt;/strong&gt; We’ll be tweeting about Lit from
&lt;a href=&quot;https://twitter.com/buildWithLit&quot;&gt;@buildWithLit&lt;/a&gt; — follow this account to
stay on top of all the latest news.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;simple.-fast.-web-components.&quot; tabindex=&quot;-1&quot;&gt;Simple. Fast. Web Components.&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;There’s actually a whole lot more to share, so we encourage you to explore
lit.dev, watch today’s &lt;a href=&quot;https://www.youtube.com/watch?v=f1j7b696L-E&quot;&gt;launch
event&lt;/a&gt; (live or after the fact),
and keep your eye on Twitter and the blog for more details in the coming weeks.&lt;/p&gt;
&lt;p&gt;But despite all the news, Lit fundamentally remains what it has always been: a
simple library for building fast, lightweight web components. Because it
embraces the browser’s native component model, Lit is perfectly suited for
building shareable components or design systems, and it can also help you build
highly maintainable, future-ready sites and apps.&lt;/p&gt;
&lt;p&gt;We can’t wait to see what you build with Lit 2.0!&lt;/p&gt;

      </content>
    </entry>
    
    <entry>
      <title>Announcing Lit 2 stable release</title>
      <link href="https://lit.dev/blog/2021-09-21-announcing-lit-2/"/>
      <updated>2021-09-21T00:00:00Z</updated>
      <id>https://lit.dev/blog/2021-09-21-announcing-lit-2/</id>
      <summary>Lit 2: smaller, better, faster, SSR-ready, and ready for production.</summary>
      <content type="html">
        &lt;p&gt;Today we&#39;re announcing the stable release of Lit 2. Lit 2 is a major update: it&#39;s smaller, faster and better than before, it lays the foundation for server-side rendering, and it&#39;s all wrapped up in the new &lt;code&gt;lit&lt;/code&gt; package on npm.&lt;/p&gt;
&lt;p&gt;Lit has come a long way since April when we &lt;a href=&quot;https://lit.dev/blog/2021-04-21-lit-2.0-meet-lit-all-over-again/&quot;&gt;announced&lt;/a&gt; the first release candidate for Lit 2.  Since then, many partners have tested the release candidates on big applications and reported easy upgrades, better performance, and smaller bundles. In addition, some partners and community members have been exploring new features like reactive controllers and experimental server-side rendering support.&lt;/p&gt;
&lt;p&gt;Meanwhile, at Google, we&#39;ve extensively tested Lit 2 by upgrading thousands of Google&#39;s internal components to the new version.&lt;/p&gt;
&lt;p&gt;Today we&#39;re happy to announce that Lit 2 is ready to go.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Correction:&lt;/strong&gt; &lt;em&gt;The lit-analyzer CLI and VS Code Lit plugin are being updated to work with Lit 2. The original version of this post incorrectly stated that these had already been released.&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;what&#39;s-in-lit-2&quot; tabindex=&quot;-1&quot;&gt;What’s in Lit 2?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Lit 2 adds a number of new features and enhancements while maintaining backward compatibility; in most cases, Lit 2 should be a drop-in replacement for previous versions. Significant new features in Lit 2 include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;New directive API&lt;/strong&gt;. Lit 2 introduces a new class-based API for writing &lt;a href=&quot;https://lit.dev/docs/templates/custom-directives/&quot;&gt;custom directives&lt;/a&gt;, objects that can customize how Lit renders. Directives aren&#39;t new, but the new API makes them more powerful and easier to define.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Asynchronous directives&lt;/strong&gt;. Async directives can be notified when they are added to and removed from the DOM, which allows directives to do clean up work. For example,  an async directive could use the callbacks to subscribe and unsubscribe to an observable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reactive controllers&lt;/strong&gt;. A &lt;a href=&quot;https://lit.dev/docs/composition/controllers/&quot;&gt;reactive controller&lt;/a&gt; is an object that can hook into a component&#39;s &lt;a href=&quot;https://lit.dev/docs/components/lifecycle/&quot;&gt;lifecycle&lt;/a&gt;, so they can respond when the component updates, and when the component is added to or removed from the DOM. Controllers can bundle state and behavior related to a feature, making it reusable across multiple component definitions. Reactive controllers can make it easy to add state management, animations, async tasks and much more to components.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Element expressions&lt;/strong&gt;. New in Lit 2 is the ability to add expressions that act on an element as a whole, rather than modifying a property, attribute, or the element&#39;s children. &lt;a href=&quot;https://lit.dev/docs/templates/expressions/#element-expressions&quot;&gt;Element expressions&lt;/a&gt; are useful for directives that need to manipulate multiple properties or to call methods on the element.&lt;/p&gt;
&lt;p&gt;For example, an experimental animation package, &lt;code&gt;@lit-labs/motion&lt;/code&gt; provides an &lt;code&gt;animate()&lt;/code&gt; directive that animates when the element&#39;s state changes. For example, the following snippet animates list items when the list reorders.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;repeat&lt;/span&gt;(&lt;span class=&quot;cm-variable&quot;&gt;items&lt;/span&gt;,&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    (&lt;span class=&quot;cm-def cm-local&quot;&gt;item&lt;/span&gt;) &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable-2&quot;&gt;item&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;id&lt;/span&gt;,&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    (&lt;span class=&quot;cm-def cm-local&quot;&gt;item&lt;/span&gt;) &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;animate&lt;/span&gt;()&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable-2&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-string-2&quot;&gt;}`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For a more complete example of the &lt;code&gt;animate&lt;/code&gt; directive, see the package &lt;a href=&quot;https://github.com/lit/lit/blob/main/packages/labs/motion/README.md&quot;&gt;README&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Static expressions&lt;/strong&gt;. Also new in Lit 2, &lt;a href=&quot;https://lit.dev/docs/templates/expressions/#static-expressions&quot;&gt;static expressions&lt;/a&gt; allow you to interpolate constant or rarely-changed values into a template before processing. Static expressions can be used in a variety of places where ordinary expressions cannot—for example, in tag-name position:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;cm-def&quot;&gt;tagName&lt;/span&gt; &lt;span class=&quot;cm-operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;literal&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`button`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable&quot;&gt;tagName&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable&quot;&gt;tagName&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;SSR-ready&lt;/strong&gt;. Lit 2 was rebuilt to be SSR-ready. The new &lt;code&gt;@lit-labs/ssr&lt;/code&gt; package implements fast, streaming SSR for Lit on Node.js. SSR support is still experimental; work is ongoing to finish and test the SSR library.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition to the new features in the Lit library, we&#39;ve made a few more changes around Lit:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;All Lit related projects are in a &lt;a href=&quot;https://github.com/lit/&quot;&gt;new GitHub organization&lt;/a&gt;. Most Lit related code has been moved to a monorepo to make it easier to test changes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The monorepo also includes a number of experimental projects, including &lt;a href=&quot;https://www.npmjs.com/package/@lit-labs/ssr&quot;&gt;server-side rendering&lt;/a&gt; support for Lit and other web components; &lt;a href=&quot;https://www.npmjs.com/package/@lit-labs/motion&quot;&gt;animation helpers&lt;/a&gt;; and a Lit controller for &lt;a href=&quot;https://www.npmjs.com/package/@lit-labs/task&quot;&gt;asynchronous tasks&lt;/a&gt;. Experimental projects are published under the &lt;code&gt;@lit-labs&lt;/code&gt; npm scope.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An all-new website, &lt;a href=&quot;https://lit.dev/&quot;&gt;lit.dev&lt;/a&gt;, featuring guides, API docs, tutorials, and an interactive code editor. We launched the site with the initial Lit release candidate; since then we&#39;ve added two of the most-requested features: site search, and better support for JavaScript users, with switchable JavaScript/TypeScript code snippets.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;changes-since-rc-1&quot; tabindex=&quot;-1&quot;&gt;Changes since RC 1&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Since the initial RC, most changes have been bug fixes. A few notable changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Element lifecycle not paused when an element is disconnected. This reverts a change in Lit that caused some subtle bugs. If you developed an asynchronous directive using one of the Lit 2 release candidates, you may need to make some changes. For details, see &lt;a href=&quot;https://github.com/lit/lit/pull/2034&quot;&gt;PR #2034&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Better runtime warnings in the development build. For information on using the development build, see &lt;a href=&quot;https://lit.dev/docs/tools/development/#development-and-production-builds&quot;&gt;Development and production builds&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For a full list of changes, see the &lt;a href=&quot;https://github.com/lit/lit/blob/main/packages/lit/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;get-started-with-lit-2&quot; tabindex=&quot;-1&quot;&gt;Get started with Lit 2&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Want to try out Lit 2? Visit &lt;a href=&quot;https://lit.dev/docs/getting-started/&quot;&gt;lit.dev&lt;/a&gt; to get started. The site features a &lt;a href=&quot;https://lit.dev/tutorials&quot;&gt;catalog of interactive tutorials&lt;/a&gt; to get you started with Lit 2, an interactive &lt;a href=&quot;https://lit.dev/playground/&quot;&gt;playground&lt;/a&gt; for live coding, guides, and API docs.&lt;/p&gt;
&lt;p&gt;Want to talk Lit? Join the &lt;a href=&quot;https://lit.dev/discord/&quot;&gt;Lit Discord&lt;/a&gt; for discussions on Lit and web components, or open a discussion on our &lt;a href=&quot;https://github.com/lit/lit/discussions&quot;&gt;GitHub Discussions&lt;/a&gt; board.&lt;/p&gt;

      </content>
    </entry>
    
    <entry>
      <title>Watch the Lit 2 release livestream</title>
      <link href="https://lit.dev/blog/2021-09-22-lit-2-release-livestream/"/>
      <updated>2021-09-22T00:00:00Z</updated>
      <id>https://lit.dev/blog/2021-09-22-lit-2-release-livestream/</id>
      <summary>What&#39;s new in Lit 2, a big-picture view of Lit usage at Google, and a community panel discussion.</summary>
      <content type="html">
        &lt;p&gt;If you weren&#39;t able to join us for the Lit 2  release livestream, you can watch the recording on YouTube.&lt;/p&gt;
&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube-nocookie.com/embed/nfb779XIhsU&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

      </content>
    </entry>
    
    <entry>
      <title>Lit 2.1 Release</title>
      <link href="https://lit.dev/blog/2022-01-05-lit-2.1-release/"/>
      <updated>2022-01-05T00:00:00Z</updated>
      <id>https://lit.dev/blog/2022-01-05-lit-2.1-release/</id>
      <summary>New directives, new decorator, new observers package, and task/SSR updates</summary>
        
        <author>
          <name>Justin Fagnani</name>
          
            <uri>https://twitter.com/justinfagnani</uri>
          
        </author>
        
        <author>
          <name>Arthur Evans</name>
          
            <uri>https://twitter.com/devdocdude</uri>
          
        </author>
      <content type="html">
        &lt;p&gt;Happy New Year from the Lit team! This week we&#39;re excited to share a few updates
with our fantastic community in the form of the Lit 2.1 release and some Lit
Labs updates.&lt;/p&gt;
&lt;p&gt;Lit 2.1 consists of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;New directives that help with looping and conditionals in your templates.&lt;/li&gt;
&lt;li&gt;New &lt;code&gt;@queryAssignedElements&lt;/code&gt; decorator, related to the existing
&lt;code&gt;@queryAssignedNodes&lt;/code&gt; decorator.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Plus we have some Lit Labs updates to make your season bright:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The new &lt;code&gt;@lit-labs/observers&lt;/code&gt; package provides reactive controllers for
working with web platform observers like &lt;code&gt;MutationObserver&lt;/code&gt; and
&lt;code&gt;ResizeObserver&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Updates to the &lt;code&gt;@lit-labs/task&lt;/code&gt; package.&lt;/li&gt;
&lt;li&gt;Updates to the &lt;code&gt;@lit-labs/ssr&lt;/code&gt; package.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more details, read on.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;new-directives&quot; tabindex=&quot;-1&quot;&gt;New directives&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Lit brings a handful of new convenience directives that make working with
conditionals and looping a bit more declarative. Mostly wrappers around plain
JavaScript expressions, we&#39;ve found that many users appreciate the way these
helpers reduce clutter in their templates.&lt;/p&gt;
&lt;p&gt;Like all of the directives included with Lit, these new directives are
pay-as-you-go: they&#39;re shipped as separate modules, so you only bundle the
directives that you choose to import.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;when(cond, t, f)&lt;/code&gt; is like a ternary where the else clause is optional. It
renders the first template if the condition is true, and the second if present
and the condition is false.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;when&lt;/span&gt;(&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;user&lt;/span&gt;, () &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;User: &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;user&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}`&lt;/span&gt;, () &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;Sign In...&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;)&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;map(iter, fn)&lt;/code&gt; is like &lt;code&gt;Array.map&lt;/code&gt;, but also works on iterators. It&#39;s similar
to &lt;code&gt;repeat()&lt;/code&gt; without the key function, but much smaller in code size.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;      &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;map&lt;/span&gt;(&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;items&lt;/span&gt;, (&lt;span class=&quot;cm-def cm-local&quot;&gt;i&lt;/span&gt;) &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable-2&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;)&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;join(iter, t)&lt;/code&gt; interleaves items in an iterable with a joiner value or
function. Useful for adding separators between items, like &lt;code&gt;Array.join()&lt;/code&gt; but
instead of returning a string returns an iterable of renderable values.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;join&lt;/span&gt;(&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;items&lt;/span&gt;, &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;cm-attribute&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;cm-string&quot;&gt;&quot;separator&quot;&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&lt;/span&gt;|&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;)&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;range(start, end, step)&lt;/code&gt; is useful for iterating a specific number of times in
a template.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;map&lt;/span&gt;(&lt;span class=&quot;cm-variable cm-callee&quot;&gt;range&lt;/span&gt;(&lt;span class=&quot;cm-number&quot;&gt;8&lt;/span&gt;), () &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;cm-attribute&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;cm-string&quot;&gt;&quot;cell&quot;&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;)&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;choose(v, cases, defaultCase)&lt;/code&gt; chooses one template to render among a set of
cases. It&#39;s like an inline switch statement.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-variable cm-callee&quot;&gt;choose&lt;/span&gt;(&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;section&lt;/span&gt;, [&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;      [&lt;span class=&quot;cm-string&quot;&gt;&#39;home&#39;&lt;/span&gt;, () &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Home&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;],&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;      [&lt;span class=&quot;cm-string&quot;&gt;&#39;about&#39;&lt;/span&gt;, () &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;About&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;]&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    ],&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    () &lt;span class=&quot;cm-operator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Error&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;)&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;new-@queryassignedelements()-decorator&quot; tabindex=&quot;-1&quot;&gt;New @queryAssignedElements() decorator&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;@queryAssignedElements()&lt;/code&gt; returns the slotted or assigned elements for a given
slot. It&#39;s similar to the existing &lt;code&gt;@queryAssignedNodes()&lt;/code&gt; but uses the
&lt;code&gt;slot.assignedElements()&lt;/code&gt; method rather than &lt;code&gt;slot.assignedNodes()&lt;/code&gt;.
&lt;code&gt;@queryAssignedNodes()&lt;/code&gt; has been updated to take an options object as an
alternative to the positional argument API.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;@&lt;span class=&quot;cm-variable cm-callee&quot;&gt;queryAssignedElements&lt;/span&gt;({ &lt;span class=&quot;cm-def cm-property&quot;&gt;slot&lt;/span&gt;: &lt;span class=&quot;cm-string&quot;&gt;&#39;icon&#39;&lt;/span&gt; })&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;_icon&lt;/span&gt;&lt;span class=&quot;cm-operator&quot;&gt;!&lt;/span&gt;: &lt;span class=&quot;cm-variable cm-callee&quot;&gt;Array&lt;/span&gt;&amp;lt;&lt;span class=&quot;cm-type&quot;&gt;HTMLElement&lt;/span&gt;&amp;gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;easy-to-use-observers-with-@lit-labsobservers&quot; tabindex=&quot;-1&quot;&gt;Easy to use observers with @lit-labs/observers&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;In Lit Labs we&#39;ve introduced a new package called &lt;code&gt;@lit-labs/observers&lt;/code&gt; which
contains reactive controllers that let you easily use the web platform observer
APIs: MutationObserver, IntersectionObserver, ResizeObserver, and
PerformanceObserver. The controllers automatically drive the host element&#39;s
update lifecycle when they observe changes.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-keyword&quot;&gt;import&lt;/span&gt; { &lt;span class=&quot;cm-def&quot;&gt;ResizeController&lt;/span&gt; } &lt;span class=&quot;cm-keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;cm-string&quot;&gt;&#39;@lit-labs/observers/resize_controller.js&#39;&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cm-def cm-type&quot;&gt;MyResizableElement&lt;/span&gt; &lt;span class=&quot;cm-keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;cm-type&quot;&gt;LitElement&lt;/span&gt; {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-def cm-property&quot;&gt;_resizeController&lt;/span&gt; &lt;span class=&quot;cm-operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;cm-keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;cm-variable cm-callee&quot;&gt;ResizeController&lt;/span&gt;(&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;, {});&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-def cm-property&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;Current size is &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;offsetWidth&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt; x &lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;offsetHeight&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  }&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;task-updates&quot; tabindex=&quot;-1&quot;&gt;Task updates&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;We&#39;ve landed some changes to &lt;code&gt;@lit-labs/task&lt;/code&gt; that allow for manually run tasks
and automatic tasks with no dependencies. Tasks with no dependencies will run
once when the host is connected, and all tasks can be run manually with the new
&lt;code&gt;run()&lt;/code&gt; method.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;ssr-updates&quot; tabindex=&quot;-1&quot;&gt;SSR updates&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;We&#39;ve also landed some bug fixes to &lt;code&gt;@lit-labs/ssr&lt;/code&gt;, reduced its NPM
dependencies footprint, and refactored the &lt;code&gt;importModule&lt;/code&gt; function into a new
&lt;code&gt;ImportModule&lt;/code&gt; class as some groundwork for upcoming changes.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;keep-in-touch&quot; tabindex=&quot;-1&quot;&gt;Keep in touch&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;We hope your 2022 is off to a good start. If you&#39;ve tried the new releases, we&#39;d
love to hear from you. For questions and discussions, please join us on
&lt;a href=&quot;https://lit.dev/discord/&quot;&gt;Discord&lt;/a&gt; or on &lt;a href=&quot;https://github.com/lit/lit/discussions&quot;&gt;GitHub
Discussions&lt;/a&gt;. As always you can check
out our documentation and code playground at &lt;a href=&quot;https://lit.dev/&quot;&gt;lit.dev&lt;/a&gt; and
report issues on our &lt;a href=&quot;https://github.com/lit/lit/issues&quot;&gt;GitHub issue tracker&lt;/a&gt;.&lt;/p&gt;

      </content>
    </entry>
    
    <entry>
      <title>Eleventy + Lit</title>
      <link href="https://lit.dev/blog/2022-02-07-eleventy/"/>
      <updated>2022-02-07T00:00:00Z</updated>
      <id>https://lit.dev/blog/2022-02-07-eleventy/</id>
      <summary>Announcing a new Lit Labs Eleventy plugin for static rendering of Lit components</summary>
        
        <author>
          <name>Al Marks</name>
          
            <uri>https://twitter.com/aomarks</uri>
          
        </author>
      <content type="html">
        &lt;p&gt;The Lit team is pleased to announce an experimental preview release of
&lt;a href=&quot;https://github.com/lit/lit/tree/main/packages/labs/eleventy-plugin-lit&quot;&gt;&lt;code&gt;@lit-labs/eleventy-plugin-lit&lt;/code&gt;&lt;/a&gt;,
a new plugin for &lt;a href=&quot;https://www.11ty.dev/&quot;&gt;Eleventy&lt;/a&gt; that renders your Lit
components as static HTML during your Eleventy build, and lets you hydrate them
after your JavaScript loads.&lt;/p&gt;
&lt;img src=&quot;https://lit.dev/images/blog/eleventy/repo-screenshot.png&quot; width=&quot;600&quot; height=&quot;611.52&quot; class=&quot;block centered&quot; /&gt;
&lt;aside class=&quot;warning&quot;&gt;
&lt;p&gt;As with all Lit Labs projects, this release should be considered experimental
and incomplete. We&#39;d love for you to try it out and leave feedback, but expect
to find a few rough edges.&lt;/p&gt;
&lt;p&gt;Check out the &lt;a href=&quot;https://github.com/lit/lit/tree/main/packages/labs/eleventy-plugin-lit&quot;&gt;roadmap&lt;/a&gt;
for a list of issues and missing features we&#39;re still working on.&lt;/p&gt;
&lt;/aside&gt;
&lt;p&gt;Check it out now on
&lt;a href=&quot;https://github.com/lit/lit/tree/main/packages/labs/eleventy-plugin-lit&quot;&gt;GitHub&lt;/a&gt;
and &lt;a href=&quot;https://www.npmjs.com/package/@lit-labs/eleventy-plugin-lit&quot;&gt;NPM&lt;/a&gt;, or read
on to learn more about what it does, why you might want to use it, and how it
works.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;what-does-it-do&quot; tabindex=&quot;-1&quot;&gt;What does it do?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;After you&#39;ve added &lt;code&gt;@lit-labs/eleventy-plugin-lit&lt;/code&gt; to your Eleventy config, then
whenever you write a custom element tag in a markdown or HTML file, the initial
state of that component&#39;s shadow DOM and styles will be rendered directly into
the static HTML.&lt;/p&gt;
&lt;p&gt;For example, given a markdown file &lt;code&gt;hello.md&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;# Greetings&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;demo-greeter&lt;/span&gt; &lt;span class=&quot;cm-attribute&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;cm-string&quot;&gt;&quot;World&quot;&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&amp;lt;/demo-greeter&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And a component definition &lt;code&gt;js/demo-greeter.js&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-keyword&quot;&gt;import&lt;/span&gt; {&lt;span class=&quot;cm-def&quot;&gt;LitElement&lt;/span&gt;, &lt;span class=&quot;cm-def&quot;&gt;html&lt;/span&gt;, &lt;span class=&quot;cm-def&quot;&gt;css&lt;/span&gt;} &lt;span class=&quot;cm-keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;cm-string&quot;&gt;&#39;lit&#39;&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cm-type cm-def&quot;&gt;DemoGreeter&lt;/span&gt; &lt;span class=&quot;cm-keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;LitElement&lt;/span&gt; {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;cm-def cm-property&quot;&gt;styles&lt;/span&gt; = &lt;span class=&quot;cm-variable&quot;&gt;css&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-tag&quot;&gt;b&lt;/span&gt; { &lt;span class=&quot;cm-property&quot;&gt;color&lt;/span&gt;: &lt;span class=&quot;cm-keyword&quot;&gt;red&lt;/span&gt;; }&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-variable&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;properties&lt;/span&gt; &lt;span class=&quot;cm-operator&quot;&gt;=&lt;/span&gt; {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-def cm-property&quot;&gt;name&lt;/span&gt;: {},&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  };&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-variable cm-callee&quot;&gt;render&lt;/span&gt;() {&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;cm-variable&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;Hello &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;b&amp;gt;&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;cm-keyword&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;cm-property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;cm-string-2&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/b&amp;gt;&lt;/span&gt;!&lt;span class=&quot;cm-string-2&quot;&gt;`&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  }&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-variable&quot;&gt;customElements&lt;/span&gt;.&lt;span class=&quot;cm-property cm-callee&quot;&gt;define&lt;/span&gt;(&lt;span class=&quot;cm-string&quot;&gt;&#39;demo-greeter&#39;&lt;/span&gt;, &lt;span class=&quot;cm-variable&quot;&gt;DemoGreeter&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then Eleventy will produce an HTML file &lt;code&gt;hello/index.html&lt;/code&gt; like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;figure class=&quot;CodeMirror cm-s-default&quot;&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Greetings&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span cm-text=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;demo-greeter&lt;/span&gt; &lt;span class=&quot;cm-attribute&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;cm-string&quot;&gt;&quot;World&quot;&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;template&lt;/span&gt; &lt;span class=&quot;cm-attribute&quot;&gt;shadowroot&lt;/span&gt;=&lt;span class=&quot;cm-string&quot;&gt;&quot;open&quot;&lt;/span&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;style&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;      b { color: red; }&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;    Hello &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;b&amp;gt;&lt;/span&gt;World&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/b&amp;gt;&lt;/span&gt;!&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;  &lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot; CodeMirror-line &quot; role=&quot;presentation&quot;&gt;&lt;span role=&quot;presentation&quot; style=&quot;padding-right: 0.1px;&quot;&gt;&lt;span class=&quot;cm-tag&quot;&gt;&amp;lt;/demo-greeter&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This HTML allows the browser to paint the initial state of the component&#39;s DOM
and styles, preserving all of the encapsulation boundaries of web components,
even before a single line of JavaScript has downloaded!&lt;/p&gt;
&lt;p&gt;Later, when the JavaScript definition of &lt;code&gt;&amp;lt;demo-greeter&amp;gt;&lt;/code&gt; has finally loaded,
the statically rendered component is upgraded to its fully interactive
JavaScript implementation through a process called &lt;em&gt;hydration&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;why-should-i-use-it&quot; tabindex=&quot;-1&quot;&gt;Why should I use it?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Statically rendering components can be an effective method for reducing the time
it takes between a page starting to load, and the content becoming visible. This
is an important consideration that contributes to the responsiveness of your
site, particularly for users with slower connections and devices.&lt;/p&gt;
&lt;p&gt;By transmitting the initial state of your components as static HTML, the browser
is able to paint the initial view much faster than it takes to download, parse,
and evaluate the JavaScript implementations of those components.&lt;/p&gt;
&lt;p&gt;For a deeper dive into the benefits of static rendering, check out &lt;em&gt;&lt;a href=&quot;https://developers.google.com/web/updates/2019/02/rendering-on-the-web&quot;&gt;Rendering
on the
Web&lt;/a&gt;&lt;/em&gt;,
and for a discussion of how to measure this aspect of web performance, check out
&lt;em&gt;&lt;a href=&quot;https://web.dev/lcp/&quot;&gt;Largest Contentful Paint (LCP)&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;how-does-it-work&quot; tabindex=&quot;-1&quot;&gt;How does it work?&lt;/h2&gt;
&lt;/div&gt;
&lt;div class=&quot;heading h3&quot;&gt;
&lt;h3 id=&quot;lit-labs-ssr&quot; tabindex=&quot;-1&quot;&gt;Lit Labs SSR&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;The plugin uses &lt;code&gt;@lit-labs/ssr&lt;/code&gt; under the hood, which works by creating an
instance of each component in a lightweight browser-like environment within the
Eleventy Node process, and evaluating the element&#39;s template using a special
version of Lit&#39;s &lt;code&gt;render&lt;/code&gt; function. This special &lt;code&gt;render&lt;/code&gt; function behaves much
like the &lt;code&gt;render&lt;/code&gt; function that Lit uses in the browser, except that it emits a
stream of strings instead of writing to the DOM, allowing it to be efficiently
written out as static HTML.&lt;/p&gt;
&lt;p&gt;For more information about &lt;code&gt;@lit-labs/ssr&lt;/code&gt;, check out its &lt;a href=&quot;https://github.com/lit/lit/tree/main/packages/labs/ssr&quot;&gt;GitHub
repo&lt;/a&gt;. We&#39;ll be
expanding the documentation soon to help developers integrate &lt;code&gt;@lit-labs/ssr&lt;/code&gt;
into more tools and frameworks!&lt;/p&gt;
&lt;div class=&quot;heading h3&quot;&gt;
&lt;h3 id=&quot;declarative-shadow-dom&quot; tabindex=&quot;-1&quot;&gt;Declarative Shadow DOM&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;When &lt;code&gt;@lit-labs/ssr&lt;/code&gt; renders a component, it uses &lt;code&gt;&amp;lt;template shadowroot&amp;gt;&lt;/code&gt; HTML
elements to represent the component&#39;s shadow DOM and styles. When the browser
HTML parser encounters a &lt;code&gt;&amp;lt;template shadowroot&amp;gt;&lt;/code&gt;, it applies that template&#39;s
content as the shadow root of its parent element. This way, all of the DOM and
style encapsulation guarantees of web components are preserved.&lt;/p&gt;
&lt;p&gt;As of February 2022, Chrome and Edge have native support for Declarative Shadow
DOM, but Firefox and Safari have not yet implemented it. A very small polyfill
is available for browsers that don&#39;t yet have support. Integrating the polyfill
into your site is
&lt;a href=&quot;https://github.com/lit/lit/tree/main/packages/labs/eleventy-plugin-lit#polyfill&quot;&gt;documented&lt;/a&gt;
in the &lt;code&gt;@lit-labs/eleventy-plugin-lit&lt;/code&gt; README.&lt;/p&gt;
&lt;p&gt;For more information about Declarative Shadow DOM, check out &lt;em&gt;&lt;a href=&quot;https://web.dev/declarative-shadow-dom/&quot;&gt;Declarative
Shadow DOM&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;heading h3&quot;&gt;
&lt;h3 id=&quot;hydration&quot; tabindex=&quot;-1&quot;&gt;Hydration&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;While static rendering lets your components&#39; initial paint happen as quickly as
possible, the components won&#39;t yet be interactive, because their JavaScript
implementations haven&#39;t loaded.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Hydration&lt;/em&gt; is the process where a statically rendered component is upgraded to
its JavaScript implementation, becoming responsive and interactive.&lt;/p&gt;
&lt;p&gt;Lit comes with automatic support for hydration via the special
&lt;code&gt;lit/experimental-hydrate-support.js&lt;/code&gt; module. As long as this module has been
loaded, Lit components will detect when they have been statically rendered, and
will adopt their existing shadow root.&lt;/p&gt;
&lt;p&gt;Hydration with Lit is very efficient, because Lit knows that it doesn&#39;t need to
re-render the existing shadow root when it upgrades. If data changes after
hydration, then only the parts of the shadow root that changed will be updated.&lt;/p&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;what&#39;s-next&quot; tabindex=&quot;-1&quot;&gt;What&#39;s next?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Check out the
&lt;a href=&quot;https://github.com/lit/lit/tree/main/packages/labs/eleventy-plugin-lit#roadmap&quot;&gt;roadmap&lt;/a&gt;
for &lt;code&gt;@lit-labs/eleventy-plugin-lit&lt;/code&gt; for some of the main features and fixes you
can expect to land over the coming months.&lt;/p&gt;
&lt;p&gt;If you try out &lt;code&gt;@lit-labs/eleventy-plugin-lit&lt;/code&gt;, let us know if you have any
suggestions or find any problems by starting a
&lt;a href=&quot;https://github.com/lit/lit/discussions&quot;&gt;discussion&lt;/a&gt; or filing an
&lt;a href=&quot;https://github.com/lit/lit/issues&quot;&gt;issue&lt;/a&gt;.&lt;/p&gt;

      </content>
    </entry>
    
    <entry>
      <title>Lit on Discord!</title>
      <link href="https://lit.dev/blog/2022-09-06-discord/"/>
      <updated>2022-09-06T00:00:00Z</updated>
      <id>https://lit.dev/blog/2022-09-06-discord/</id>
      <summary>We&#39;ve launched a brand new Lit Discord server, and here&#39;s why you should join it now!</summary>
        
        <author>
          <name>Al Marks</name>
          
            <uri>https://twitter.com/aomarks</uri>
          
        </author>
      <content type="html">
        &lt;p&gt;We&#39;ve just launched a brand new &lt;a href=&quot;https://lit.dev/discord/&quot;&gt;Lit Discord server&lt;/a&gt;, and we&#39;d love
for you to &lt;a href=&quot;https://lit.dev/discord/&quot;&gt;join it now&lt;/a&gt;! Everybody is welcome, whether you are brand
new to Lit, or an experienced user.&lt;/p&gt;
&lt;p&gt;We think the Lit Discord will be the best place to chat with the Lit community,
talk to the Lit dev team, get help using Lit, and show off your Lit projects! We
also plan to host special events there, using both chat and voice!&lt;/p&gt;
&lt;img src=&quot;https://lit.dev/images/blog/discord/discord-screenshot.png&quot; width=&quot;600&quot; height=&quot;385.25&quot; class=&quot;block centered&quot; /&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;why-discord&quot; tabindex=&quot;-1&quot;&gt;Why Discord?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Here&#39;s what we like best about Discord:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;It&#39;s easy to be in &lt;em&gt;many&lt;/em&gt; communities&lt;/strong&gt;, becuase you can quickly switch
between them.&lt;/p&gt;
&lt;p&gt;There are already Discords for Modern Web, Shoelace, Vaadin, Material, Astro,
and many other open source projects, so we think it will be great to be able
to easily jump between them, share announcements, and more.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Syntax highlighting&lt;/strong&gt;, including for nested html tagged template literals!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Traction &amp;amp; growth&lt;/strong&gt;. Discord has had huge growth in recent years, and new
open source projects seem to be choosing Discord more often than not now. We
think that&#39;s becuase using Discord is a great experience, and because the
friction to joining new Discord servers is low after you&#39;ve started using it.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;heading h2&quot;&gt;
&lt;h2 id=&quot;what&#39;s-happening-to-slack&quot; tabindex=&quot;-1&quot;&gt;What&#39;s happening to Slack?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;em&gt;Lit &amp;amp; Friends&lt;/em&gt; workspace on Slack will be going into read-only mode on
&lt;strong&gt;Tuesday, September 13, 2022&lt;/strong&gt;. After that, you&#39;ll be able to read existing
messages, but won&#39;t be able to post new ones. We&#39;ve already sent a message to
every channel about these plans.&lt;/p&gt;
&lt;p&gt;We decided to retire the Slack instead of maintaining both because we want to
encourage more communication and less silos. Slack has served the Lit community
well, but we think now is the right time to move to Discord!&lt;/p&gt;

      </content>
    </entry>
</feed>
