3.0.4 • Published 5 months ago

pure-lit v3.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
5 months ago

pure-lit

Version Size vulnerabilities dependencies Statements Branch Functions Lines

lit with pure functions.

Install

npm install pure-lit

or add it to your page as module like this:

<script type="module" src="https://unpkg.com/pure-lit@latest?module"></script>

Getting started

pure-lit.org

The quickest way of getting started is by using JavaScript modules.

Create a file index.html that looks like this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Awesome pure-lit</title>
    <script type="module">
      import { html } from "https://unpkg.com/lit@latest?module";
      import { pureLit } from "https://unpkg.com/pure-lit@latest?module";

      pureLit(
        "hello-you",
        async ({ who }) => {
          return html`<div>Hello ${who}!</div>`;
        },
        {
          defaults: { who: "" },
        }
      );
    </script>
  </head>
  <body>
    <hello-you who="me"></hello-you>
  </body>
</html>

Open it in the browser. Done.

Adding some state

pureLit exports the hooks from lit-element-state-decoupler and lit-element-effect which you can use to manage your state inside the functional components.

You can import them via

import { pureLit, useState, useReducer, useWorkflow, useEffect, useOnce } from "pure-lit";

and then use them like this:

pureLit("hello-world", (element) => {
    const counter = useState(element, 0);
    return html`<button @click="${() => counter.set(counter.get() + 1)}">You clicked me ${counter.get()} times!</button>`
});
2.0.9

6 months ago

3.0.4

5 months ago

3.0.2

6 months ago

3.0.1

6 months ago

3.0.0

6 months ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.3

3 years ago

0.4.4

3 years ago

0.4.0

3 years ago

0.4.3

3 years ago

0.3.4

3 years ago

0.4.2

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago