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

decla

v0.0.4

Published

Decla - declarative apps framework

Readme

Declá - declarative apps framework

Decla.js is game changing frontend framework of 2021! Everything you like and ever wanted - writing fast, superlight, functional and simple web apps. Common packages out of the box, bunch of examples and tutorials, fastest growing framework community.


Briefly before we begin, Decla components are pure functions, they don't create any side effects, instead they return declarative structures to describe side effects. So for example, instead of returning explicit vdom, they return declarations of dom effects to be taken. This allows handling any kind of side effect in appropriate way, making components design simple and predictable. Read more: Decla.js Virtual Effects, Decla Components

One more thing to mention, Decla framework makes your frontend development fast and easy, so please hit the like button and share with friends to give it more juice!

Simple Component and App

Creating component is as easy as to write a function, because Decla components are simple js functions:

import { app, dom } from 'decla'

function Hello({ h }){

  return h('h1', {}, [
    h('text', 'Hello World!')
  ])
}

app(Hello, {}, dom(document.body))
function Hello({ domEffect }){
  return [domEffect, { tagName: 'h1', attrs: {} },[
    [domEffect, { tagName: 'text', attrs: 'Hello world!' }]
  ]]
}

Try it on CodePen. It is recommended to use hyperscript or jsx to make your code more readable and elegant. Read more: Using hyperscript and jsx

Stateless Component and App

Decla is state driven framework, meaning it re-renders app on any state change (initial state is passed while app is mounting, see example below). Decla components are stateless, they interact with app state using state decorators like useState(getter,setter).

import { app, dom } from 'decla'
import { intervalEffect } from '@decla/effects'

const Counter = ({ useState, h }) => {
  const [count, incCount] = useState(
    state => state,
    state => ++state
  )

  return [
    count < 10 && [IntervalEffect, { 
      action: incCount,
      every: 1000, 
    }],
    h('text', count)
  ]
}

app(Counter, 0, dom(document.body))

Try it on CodePen. Decla takes care about cancelling and (re)starting effects depending on returned structure, this gives freedom and more advanced control over effects. Read more about effects: Decla Effects

Components composition and App

This expample shows how simple components composition can be, and how to handle user actions

import { app, dom } from 'decla'

const RandomCat = ({ useProps, h }) => {
  const { say } = useProps()

  return h('img', { 
    src: `https://cataas.com/cat/says/${say}` 
  })
}

const CatApp = ({ useState, h }) => {
  const [cats, incCats] = useState(
    cats => cats,
    cats => ++cats
  )

  return [ 
    h('input', {
      value: 'Get Random Cat!',
      onclick: incCats,
      type: 'button',
    }),
    [RandomCat, { 
      say: `Random-cat-${cats}`
    }]
  ]
}

app(CatApp, 0, dom(document.body))

Try it on CodePen. Decla differentiates components from effects by names, effect's name should always end with 'Effect' (this means effects cannot be declared as arrow functions), read more: Decla API

Congratulations!

Now you are decla.js developer! Yes, that's easy! Slap the like button to let us know we are on the right direction, stay tuned and safe!

Want some more of Decla.js?

Community

We are open to any question, feedback or improvement, feel free to join our community channel discussions or file an github issue for some help.

License

MIT