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

frzr

v0.22.7

Published

Turboboosted 2 KB view library

Downloads

247

Readme

*FRZR*

Turboboosted 2 KB view library with 100 % test coverage.

npm Build Status npm Twitter Follow

Contributing:

Issues/pull requests are more than welcome! Please use the dev branch for pull requests, thanks!

Install:

npm install frzr

Download:

  • Development: https://pakastin.github.io/frzr/frzr.js (10 KB before, 3 KB after GZIP)
  • Production: https://pakastin.github.io/frzr/frzr.min.js (4 KB before, 2 KB after GZIP)
  • cdnjs: https://cdnjs.com/libraries/frzr

Latest updates

Using at server-side

FRZR-dom

Using with JSX

https://gist.github.com/fson/576eda4a5401fd078c18101cdda558e0#file-todo-js

Getting started

http://codepen.io/collection/XKwVMG (more will be added soon..)

Calendar project example

https://github.com/pakastin/frzr-calendar

Creating a table

https://jsfiddle.net/mhLq0p9r/1/

Performance

  • http://mathieuancelin.github.io/js-repaint-perfs/
  • http://pakastin.fi/perf

HelsinkiJS talk

http://youtu.be/0nh2EK1xveg

SurviveJS interview:

http://survivejs.com/blog/frzr-interview/

el(tagName, (attributes), (...children))

Creates a HTML element:

var p = el('p', { textContent: 'Hello world!' });

You can also define children:

var div = el('div', null, p);

You can also omit attributes:

var p = el('p', 'Hello world!' );
var div = el('div', p);

It's also possible the register custom elements and attributes, covered here.

svg(tagName, (attributes), (...children))

Works like el, but creates a SVG element:

var circle = svg('circle', { cx: 50, cy: 50, r: 50 });
var canvas = svg('svg', { width: 100, height: 100 }, circle);

Creating components

Components (or Views) are just POJF (plain old JavaScript functions):

function Item () {
  this.el = el('p');
}
Item.prototype.update = function (text) {
  this.el.textContent = text;
}
var item = new Item();
item.update('Hello world!');
mount(document.body, item); // <body><p>Hello world!</p></body>

You can also use ES6 classes:

class Item {
  constructor () {
    this.el = el('p');
  }
  update (text) {
    this.el.textContent = text;
  }
}
const item = new Item();
item.update('Hello world!');
mount(document.body, item); // <body><p>Hello world!</p></body>

There are also some lifecycle "events" covered here.

new List(View, (key), (initData), (skipRender));

Automatically inserts, removes and even reorders components. Previous example makes a lot more sense now:

var list = new List(Item);
mount(document.body, list);
list.update([1, 2, 3]); // <body><p>1</p><p>2</p><p>3</p></body>
list.update([2, 3, 4, 5]); // <body><p>2</p><p>3</p><p>4</p><p>5</p></body>

By defining a second key parameter you can reorder DOM elements. The third initData parameter just gets sent to the Component constructor as a first argument, with item and index. The fourth skipRender parameter skips the DOM update, if you want to implement a custom method.

mount(target, child)

You can mount HTML elements/components to HTML elements/components.

mount(document.body, p);
mount(document.body, div);
mount(div, p);

mountBefore(target, child, before)

mountBefore(document.body, svg, div);

unmount(target, child)

Unmounts element/component from element/component.

unmount(document.body, svg);

setChildren(target, [child])

This cleverly replaces target's children. Children already in the DOM automatically gets moved / kept in place.

setChildren(document.body, [p, svg]);

virtual-dom version

If you like virtual dom updates better, check out RZR. You can also mix & match!