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

@tofl/figue

v1.0.1

Published

An experimental frontend micro-framework

Downloads

12

Readme

Figue

Figue is an experimental frontend micro-framework written in Javascript.

The idea for this project came to my mind after discovering the Strawberry framework and this conference on the virtual DOM, although I ended up not adding a vDOM to the framework.

Although I've been using frontend frameworks for years (mainly Vue.js, but also React and Angular to some extent), they had always felt like incomprehensible tools. As I was studying their internals, I started to question why these frameworks exist in the first place, and why we can't use native Javascript more often.

I believe these frameworks serve two main purposes:

  • A functional purpose: the Web API was not as developed then as it is now. It made sense, at the time, to add the possibility to use components for example. However, nowadays, many of the tools that exist in frontend frameworks like React natively exist in the browser.
  • A practical purpose: frameworks impose certain guidelines and help making the codebase more maintainable and understandable. This makes sense as websites can be extremely complex.

The first point, the functional concern, is the one Figue aims to address. By developing Figue, I want to see if there are viable, simpler and lightweight alternatives to today's most famous frameworks.


Advantages of Figue

  • Reactive
  • No build process, just import the script
  • Super lightweight, no dependencies
  • No virtual DOM

Installation

Using a link

The best way of importing Figue is by simply getting the latest version of the package using unpkg.com, like so:

<script src="https://unpkg.com/@tofl/figue@latest/index.js"></script>

Note: you must wait for your HTML structure to be loaded before calling the script.

Importing Figue as a package

If your project is an app that is served via an application bundler or a server, you can use npm to install Figue. First, run the install command:

$ npm i @tofl/figue

Then, import it as a module:

<script type="module">
    import '@tofl/figue';
</script>

Usage

Initialisation

To initialize the app, simply use the initFigue() function after importing the framework as shown above. It takes in a CSS selector as its only argument and returns an _ object.

const _ = initFigue('html');

Adding reactive state

You can declare reactive state and methods by simply adding keys to the _ object.

const _ = initFigue('html');

_.firstname = 'John';
_.lastname = 'Doe';

Then, just call these properties from the template by using curly braces:

<p>Hello, {{ firstname }} {{ lastname }}. Welcome back.</p>

Manage events

It is very easy to handle common events with Figue. Simply append an event handler to the _ object in the script section and reference the event name as an attribute starting with an @ (and the event handler as its value) in the template.

<body>
    <h1>Hello, {{ firstname }}</h1>
    <input type="text" @keyup="updateFirstname" />
    
    <script>
        const _ = initFigue('body');
        
        _.firstname = '';
        _.updateFirstname = (event) => {
            data.firstname = event.target.value;
        };
    </script>
</body>

As you can see, the event object is automatically passed as an argument to the event handler.

Figue supports any event type supported by the addEventListener() method, preceded by the @ symbol.

Next steps

Although being as simple and light as possible is a requirement for Figue, there is still lots of room for improvement and new functionalities.

  • Adding Vue-style refs to quickly and easily reference HTML attributes instead of using document.querySelector().
  • Executing Javascript code within the template, using the {{ ... }} syntax.
  • Adding conditional rendering and loops within the template.
  • Rewriting the framework in Typescript.