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 🙏

© 2025 – Pkg Stats / Ryan Hefner

flamer

v0.0.4

Published

The fast, small and functional JavaScript library for building web user interfaces.

Downloads

13

Readme

The fast, small and functional JavaScript library for building web user interfaces.


Install

Npm: npm install flamer CDN: https://unpkg.com/flamer@0.0.4

The Gist:

import { render, update, Reactive, Container } from 'flamer';

// Initial Application State
const applicationState = {
  text: 'Click',
  title: 'Flamer.js'
}

// Event Handler
const Event = {
  change: () => {
    update('text', 'Nice one!')
    update('title', 'Awesome!')
  }
}

/**
 * Each Reactive component are pure function that returns 
 * a template string.
 */
const Button = Reactive( 'text', props => 
  `<button 
      id="btn" 
      onclick="Event.change()" 
      flamer-observe="text">${props.text}
    </button>` )

/**
 * Minimal DOM Updates
 * [flamer-observe] when the reactive event be called, 
 * the Reactive function will be called
 */
const Title = Reactive( 'title', props => `<h1 flamer-observe="title">${props.title}</h1>` )

  /**
   * The Container lyfecycle
   * beforeRender -> Trigger before the Container be rendered
   * afterRender -> Trigger after the Container are rendered
   */
  const ApplLifecycle = {
    beforeRender: () => console.log('Before render'),
    afterRender: () => console.log('After render')
  }
  
/**
 * The Container Component that will
 * be render inside the DOM
 * It's a function that return an object 
 */
  const App = new Container( initialState  => { 
    return `
    <div>
      ${Title(initialState)}
      ${Button(initialState)}       
    </div>`
    }, AppLifecycle);

// The container will receive the appliactionState as argument
render(App, applicationState, '#app');
  <body>
    <div id="app"></div>
  </body>

API

Container

/**
 * @name Container
 * @description Create your Container Component. Container doesn't have state itself, just
 * iteract with it when render. It keeps more simple the flow.
 * @param {Function} App The container function
 * @param {Object} lifecycle The Container Lifecycle. Just two functions: afterRender and beforeRender
 */

new Container(App, lifecycle);

Reactive

/**
 * @name Reactive
 * @description Your reactive component that will
 * bind the flamer-observe event
 * @param {String} event The Reactive event name
 * e.g update('text', value) // text -> Reactive Component
 * @param {Function} component The component function that will be
 * returned when the event name are called
 */

Reactive(event, component)

render

/**
 * @name render
 * @description Render the container inside the dom
 * It keeps more simple the flow. Container doesn't have state itself, just
 * iteract with it when render
 * @param {Function} Container The container function
 * @param {Object} state The initial state that the container will receive
 * @param {String} root The root element that the container will be mounted
 */

render(Container, state, root);

[flamer-observe]

<!--
  * @name flamer-observe
  * @description The tag element that will be updated when the reactive event be called
  * When the title reactive event be called, the flamer-observe element will be updated.
  * Keep the minimal DOM update
  **/
  -->
  <h1 flamer-observe="title">Initial Title</h1>

Reactive Methods:

update

/**
 * Use when you want change update the respective Reactive element
 * @name update
 * @description Update the state
 * @param  {String} eventName The reactive event name
 * @param  {String|Object} value The value that will be updated
 */

 update(eventName, value);

append

/**
 * Use when you want to add the respective Reactive element
 * @name append
 * @description Update your flamer-observe component
 * @param {String} eventName The reactive event name
 * @param {Any} value The state that will be updated
 */

 append(eventName, value);

remove

/**
 * Use when you want to remove the respective Reactive element
 * @name append
 * @description Update your flamer-observe component
 * @param {String} eventName The reactive event name
 * @param {Number|String} key The element key index that will be removed
 */

 remove(eventName, key);

replace

/**
 * Use when you want to replace the respective Reactive element
 * @name replace
 * @description Update your flamer-observe component
 * @param {String} eventName The state that will be updated
 * @param {Number|String} key The key of the element
 * @param {Any} value The value that will be replaced
 */

 replace(eventName, key, value);

License MIT