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

@snazzyui/snazzyui

v1.0.0

Published

A modern, functional UI library that is API compatible with Hyperapp, but built on top of the battle-tested Snabbdom VDOM library. Great for building fast little apps or used with [Snazzy Elements](https://github.com/gamebox/snazzy-elements) to build des

Downloads

4

Readme

Snazzy UI

A modern, functional UI library that is API compatible with Hyperapp, but built on top of the battle-tested Snabbdom VDOM library. Great for building fast little apps or used with Snazzy Elements to build design systems with Custom Web Elements (web components).

Installation

npm

npm i @snazzyui/snazzy-ui

pnpm

pnpm add @snazzyui/snazzy-ui

Getting started

// Import from the package
import { app, h } from '@snazzyui/snazzy-ui';

// An update function, will be passed to your app's dispatch function. It can
// return just a new state, or a tuple of newState and a list of effects to run
// asynchronously after the newState has been applied.
const Increment = (state) => {
    const newCount = state.count + 1;
    const newState = { ...state, count: newCount};

    if (newCount % 15 === 0) {
        return [newState, [[notifyUser, { message: "fizzbuzz" }]]]
    }[
    if (newCount % 5 === 0) {
        return [newState, [[notifyUser, { message: "buzz" }]]];
    } 
    if (newCount % 3 === 0) {
        return [newState, [[notifyUser, { message: "fizz" }]]];
    }
    return newState;
};

// An effect function.  This can be async and do work in the background.  It
// notifies that app of changes to state that need to be made through the
// dispatch function that is passed in.
const notifyUser = (dispatch, payload) => {
    window.alert(payload.message);
};

// This sets up the app
app({
    // This can either be a static object(must be an object), or a function that
    // returns one.
    init: { count: 0 },
    // This is the function that will be called to render your UI whenever the
    // state is changed.
    // The first parameter is the current state
    // The second parameter is a function that will call update functions.  It
    // takes the update function as the first argument, and it's argument as the
    // second argument.
    //
    // Notice that we use the h function imported from the package, this comes
    // directly from Snabbdom. See [Snabbdom docs on h](https://github.com/snabbdom/snabbdom?tab=readme-ov-file#h) to see how to use it.
    view: (state, dispatch) => h('div', {}, [
        h('h1', {}, state.count),
        h('button', { on: { click: () => dispatch(Increment, {}) } }, 'Increment'),
    ]),
    // This is a function that will be called with state on every state change
    // and return a list of subscriptions.  Subscriptions can set up and clean
    // up event watchers or other events you want to listen to outside of the
    // DOM.
    subscriptions: () => [],
    // The second argument of app is the element used to mount your application in.
}, document.querySelector("#app'))