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

brite

v1.1.6

Published

DOM Centric Minimalistic MVC Framework

Downloads

3

Readme

brite.js

brite.js is a simple but powerful DOM centric MVC (D-MVC) framework for building high-end HTML5 applications. The driving concept is to just add the missing MVC pieces to the DOM rather than force fitting Desktop MVC and Widget patterns to the DOM. The result is simpler, easier to optimize, and more scalable HTML/CSS/JS application code. In short, brite turns the DOM (and jQuery) into a robust, efficient, and scalable MVC platform.

MIT licensed | brite.min.js | documentation | Sample App (TodoMVC) | Release Log | more dist

Quick Overview

Create a new view definition


// brite.registerView(VIEW_NAME,VIEW_DEFINITION_CREATE_INIT_POSTDISPLAY_DESTROY)
brite.registerView("MyView",{
    // REQUIRED: can return a HTML string, DOM Element, jQuery object
    create: function(data,config){
        return "<div>My <button>Button</button></div>";
    }, 

    // optional (if present, this will be called after the element will be displayed)
    postDisplay(data,config){
        // usually a good place to do anything which is not UI related 
        // (since it will be called after it is displayed )
        var view = this; // best practice (the this is the view instance)
        // .$el is the jQuery object of the first view DOM element (i.e. <div> created in the create )
        view.$el.addClass("some-state-class");
    }, 

    // optional (convenient way to bind events at the view level)
    events: {
        // "TYPE;SELECTOR" will internally make a simple jquery binding call view.$el.on(TYPE,SELECTOR) call;
        "click; button": function(event){
            var view = this; // the this is the view (makes it very OO)
            console.log("A button has been clicked in view " + view.id);
        }
    }
    // more things, such as init, destroy, winEvents, docEvents, and daoEvents 
    // (see http://britesnow.com/brite for more info)
})

Display instances of MyView

// brite.display(VIEW_NAME,JQUERY_SELECTOR_OR_OBJECT_OR_DOM_ELEMENT)
// This will create a new instance of MyView and append it to body
brite.display("MyView","body");

brite.display("MyView",$("body")); // same as above. 

// View lifecycle is async (using jQuery promise)
brite.display("MyView","body").done(function(myViewInstance){
    console.log("This view unique instance id is: " + myViewInstance.id);
});

IMPORTANT: Remember that the concept of brite.js is not to make everything a "View" or widget, but rather to partition the User Interface into reusable composite views (that usually become brite.js views) and smaller HTML elements that should be just HTML/CSS based with their respective delegated behavior (Bootstrap is a great base for those type of components).

Component Usage

component.json

{
    …
    dependencies: {
        "BriteSnow/brite": "*"
        …
    }
    …
}

Release Log

Notation: "+" Addition | "-" Fix | "!" API change | "*" Important | "." minor

1.1.2 (March 22nd 2014)

    • added brite.config.jsPath and brite.config.cssPath for configuring the location of the brite view components when using on demand loading
  • . updated examples to jquery 1.11
  • . minor reformating to be more jshint compliant. Updated to bootstrap 3.1.1
  • . update to handlebars 1.3.0 and fix taskmanager with latest bootstrap
    • Makes brite.js compatible with AMD and CommonJS (Thanks to Sankar Gorthi)
  • . updated sample/taskmanager to point correctly to the bootstrap 3.0 and use handlebars-1.0.0
  • ! remove the brite.gtx (canvas utilities) from brite (moved gtx.js to /extra)
    • btap issue when binding only on parent, btap on child does not propagate
    • Fix btap event to fire only once (without the use of preventDefault which would be too destructive for other event handlers)