0.0.9 • Published 2 years ago

flyg v0.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

✈️ Flyg

Flyg is a simple library for building components with javascript template literals. In addition to standard string interpolation, flyg offers the ability to interpolate dom elements and keeping its references for further manipulation and event binding.

Installation

To install from npm:

npm i flyg

Import to project:

import { flyg } from "flyg";

Examples

Create a component with a type:

const App = flyg<HTMLElement>`<div>Nice to see you 👋</div>`;

document.body.appendChild(App);

Combine components:

const ContactButton = ({ text }) => {
  const component = flyg<HTMLButtonElement>`
    <button>
        ${text}
    </button>`;

  component.addEventListener("click", () => {
    alert("Awesome ⭐️");
  });

  return component;
};

const App = flyg<HTMLElement>`
    <div>
        <h1>About</h1>
        <p>This is fun right?</p>
        <div>${ContactButton({ text: "📬 Contact me" })}</div>
    </div>
`;

document.body.appendChild(App);
0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago