Giter VIP home page Giter VIP logo

lithen-fns's Introduction

Lithen Functions

Functions to use with html and css to create simple and powerful UI elements. Its part of Lithen modules. It works alone but is created to use with Web Components.

Getting started

You can see the Getting started page, teaching how to setup a Vanilla project or a project with Vite.

After the Getting started, try this counter modal example:

function counterModal() {
  const count = signal(0)
  const dialogRef = ref<HTMLDialogElement>()

  function increment() {
    count.set(value => value + 1)
  }

  return html`
    <dialog ref=${dialogRef}>
      <p>Count: ${count}</p>
      <button on-click=${increment}>
        Increment
      </button>
      <button on-click=${() => dialogRef.el?.close()}>
        Close
      </button>
    </dialog>
    
    <button on-click=${() => dialogRef.el?.showModal()}>
      Open Modal
    </button>
  `
}

document.body.append(counterModal())

List of including functions, tag functions and its features

VSCode Extensions Recommendation

  • lit-plugin which came with lit-html and styled components extensions.
  • Auto Close Tag for auto closing HTML tags.
  • es6-string-html for HTML syntax highlight to custom tag functions, good to work with the el tag function.
  • inline HTML for emmet and IntelliSense in html and css tag functions.

Other libs that are part of Lithen

lithen-fns's People

Contributors

gabriel-jm avatar

Stargazers

Alpha Vylly avatar Matheus P Agostinho avatar

Watchers

 avatar

lithen-fns's Issues

What is missing!

This PR is to list the ToDo you said we do.

  • Getting Started (doc)
    Install the Lib in your project
npm i lithen-tag-functions

Install Vite + TypeScript to make your life easier (optional).

npm i -D vite typescript

Create a src/main.ts:

// src/main.ts
import { html, css, signal, ref } from 'lithen-tag-functions'
...
const app = document.getElementById("app");
app?.append(counterModel());

Create your index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite + TS</title>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>
  • More information about Element merge
    The way it is described is easy to understand. However, I think providing more information, the kind that can be called from within another component, might be helpful. e.g.:
import { html } from "lithen

export function HeaderApp() {
  return html`
    <header>
      ...
    </header>
  `
}
// home.ts
import { HeaderApp } from "header"

function Home() {
  return html`
   ${HeaderApp()}
  `
}

...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.