npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lumeojs

v0.4.0

Published

LumeoJS is a lightweight JavaScript library that provides reactive data binding for web applications

Downloads

820

Readme

LumeoJS

Overview

LumeoJS is a lightweight JavaScript library that provides reactive data binding for web applications. It allows you to easily bind variables to HTML elements, enabling dynamic updates in response to user input or changes in data.

Features

  • Reactive Data Binding: Automatically updates HTML elements when data changes.
  • Simple Syntax: Easy to use with intuitive conventions.
  • Event Handling: Bind event handlers directly in HTML.
  • Conditional Rendering: Show or hide elements based on variable values.
  • Template Binding: Use {{ }} syntax for dynamic content.

Installation

You can install LumeoJS using npm:

npm install lumeojs

CDN Access

You can also include LumeoJS via a CDN. Use one of the following URLs:

  • jsDelivr:

    <script src="https://cdn.jsdelivr.net/npm/lumeojs"></script>
  • unpkg:

    <script src="https://unpkg.com/lumeojs"></script>

Usage

Basic Example

  1. Include the package in your HTML file:

    <script src="https://cdn.jsdelivr.net/npm/lumeojs"></script>
  2. Use the library in your JavaScript code:

    <script>
      // Initialize Lumeo with your state
      Lumeo((state) => {
        state.name = "World";
        state.isVisible = true;
        state.message = "Welcome to LumeoJS!";
      });
    </script>
  3. Bind elements in your HTML:

    <input type="text" l-model="name" placeholder="Enter your name" />
    <p>Hello, {{ name }}!</p>
    <p l-show="isVisible">This is visible!</p>
    <p title=":message">Hover over me!</p>

Attribute Examples

Binding Variables

To bind a variable to an HTML element, use the l-model attribute:

<input type="text" l-model="myVariable" />

Event Handling

You can bind event handlers using the on- prefix:

<button on-click="handleClick">Click Me</button>

In your JavaScript:

<script>
  Lumeo((state) => {
    state.handleClick = () => {
      alert("Button clicked!");
    };
  });
</script>

Conditional Rendering

To conditionally show or hide elements, use the l-show attribute:

<div l-show="isVisible">This is visible!</div>

In your JavaScript:

<script>
  Lumeo((state) => {
    state.isVisible = true; // or false to hide
  });
</script>

Template Binding

Use double curly braces {{ }} to display dynamic content:

<p>Hello, {{ name }}!</p>

Dynamic Attribute Binding

To bind attributes dynamically using a colon (:):

<p title=":message">Hover over me!</p>

In your JavaScript:

<script>
  Lumeo((state) => {
    state.message = "Welcome to LumeoJS!";
  });
</script>

API

  • Lumeo(callback): Initializes the reactive system with the provided callback. Use this to define your state and functions.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Support

If you have any questions or need support, feel free to open an issue on the GitHub repository.