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

sp-front

v1.0.0

Published

a fast zero-dependency lightweight object based frontend framework

Downloads

6

Readme

sp-front

front

A fast javascript object based front-end framework with zero dependency

##example in your index.html or any html file add a module type script file (for example main.js) you can specify element while initializing front or it will use body as default element

main.js

import Front from 'front.js'

let front = new Front(); 


let app = {
    tag: 'div',
    children: [
        {
            tag: 'h2',
            text: 'hello world',
            style: {
                color: 'tomato',
            }
        },
        {
            tag: 'p',
            innerHTML: 'Welcome to <em>Front<em>.'
        }
    ]
};

front.render(app);

default ui structure

ui = { tag: 'div', id: 0, text: 'text content', style: { color: 'red', }

}

basic options: of ui:

tag: string id: number/string text / textContent : string style: object // css styles {key: value} classes: string/array // class names listeners: object // {event: function} innerHTML: string // html code styleSheets: array // [cssStyleSheet] data: object // {key: value} animations: object // {name: {frames: [], opts: {}}}

derived options added to ui by front: animationTable: object // {name: Animation} elem: HTMLElement parent: ui children: array // [ui] killMe: boolean

optional mods for children of ui: type : router/ lazy / page router children special options: pattern : string/ regularexp to match url pathname autiontication: bool/ bool function - should be authenticated to access this page

lazy children special options:
    batch : number // number of children to render at once
    offset: number // number of children to skip
    next: function // function to call when next batch is needed to rendered

page(pagination) children special options:
    batch : number // number of children to render at once
    page : number // page number
    next : function // function to call when next page is needed to rendered
    prev : function // function to call when prev page is needed to rendered
    paginate(i): function // function to call when ith page is needed to rendered

special listeners: init: function // called when ui is created create: function // called when ui is created , after init beforeUpdate: function // called before ui is updated afterUpdate: function // called after ui is updated beforeRender: function // called before ui is rendered afterRender: function // called after ui is rendered intersection: function // called when ui is intersected with viewport mutation: function // called when ui is mutated resize: function // called when ui is resized

special ui component: Link(path, content, delay = 0, preJumpFunc = undefined)

cross component data access: DataEntry -write(key, value) -read(key) -save(key) -load(key) -listen(key, callback) -setCookie(key, value, expiry) -getCookie(key) -deleteCookie(key)

lifecycle methods of ui: update: function kill: function push: function pop: function getElement: function selectors: function