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

brickjs

v0.3.5

Published

MVVM building block to create real time and large scale applications in a flash

Downloads

3

Readme

Brick

Compose your own MVVM library.

Build Status Selenium Test Status

Brick makes it easy to create rich yet maintainable web interfaces by providing a set of composable and extensible components. It uses cement to sync and update your UI with an underlying data store.

Brick has been built for wall, an express-like framework to ease the creation of maintainable and large scale application. Brick is simple, composable and easy to learn.

Give it a try you won't be disappointed!

10 seconds examples

Interpolation (see online):

var view = brick('<span>{{ name }}</span>', {
  name: 'bredele'
});

view.build(document.body);

Plugins:

brick('<ul repeat><li>{{ name }}</li></ul>', [{
    name: 'bredele' 
  }])
  .use(repeats)
  .build();

Factory (see online):

var card = brick.extend('<button>{{ name }}</button>')
  .use(interval(100))

var view = card({
  name: 'bredele'
}).build();

Browser support

Supporting IE8 is a pain but it's unfortunately still widely used in the industry. This is the reason why brick is fully tested and supports all mainstrean browsers, IE8 included.

Selenium Test Status

IE7 requires the use of JSON and querySelector polyfill.

Concept

Brick is that tiny piece (3kb gzip) that composes well. It follows the UNIX philosophy and provides simply just what you need. Everything else is a module (using npm and browserify or component) with single responsability that you can reuse at scale.

You can compose your owm framework. The possibilities are limitless and commonjs allows you to reuse functionnalities made by the community (npm or component) and stop duplicating your effort.

Event if brick is small, it has a fair bit of power under the hood:

  • observer/emitter
  • extendable models and collections
  • computed properties
  • localstorage
  • composable views
  • fast dom rendering
  • interpolation
  • filters
  • composable data bindings (aka plugins)
  • lifecycle hooks (rendered, inserted, ready, removed, etc)
  • SVG binding
  • IE support
  • etc

Brick is also simple. Just a minute is enough to get into it:

<div class="el">
  <style>
    .brick {
      background: {{ color }};
    }
  </style>
  <div class="brick"> {{ label }} </div>
</div>
var view = brick('.el', {
  color: 'red',
  label: 'Hello'
}).build();

// change label
view.set('label', 'World!');

Let's be honnest, there is enough MV* libraries out there and some of them are actually really good. It's not brick's intent to replace them. Instead, brick's goal is to create an ecosytem of composable components to create rich and maintainable web applications in a flash.

Installation

with component:

$ component install bredele/brick

with nodejs/browserify:

$ npm install brickjs

Documentation

We are currently writing a new documentation but you can find the old one in the wiki.

FAQ

Is it different from other MVVM libraries?

In Brickjs, each view has its own bindings and set of plugins unlike some libraries where everything is contained in a global scope. This is important in order to avoid conflict, memory leaks and to maintain your code properly.

view.add('repeat', require('repeat-brick'));

As shown above, you can give a name to your plugins to avoid name conflicts when different views overlap. Your code is readable and also configurable! You can create your own plugins like jQuery (it's as easy as creating a function) and reuse them multiple times inside or outside of your application.

Why support IE8?

Supporting IE8 is really not complicated and does not make Brickjs slower. IE8 doesn't support indexOf and trim. IE8 has shadow node attributes and doesn't support data (we use nodeValue in binding). Thats's pretty much it!

What is wall?

Wall has an express-like API and is inspired by this article. It allows you to split your larger application into smaller pieces. Instead having a composite layout where you have a view in a view in a view (and keep references of every views), you have totally independant pieces (with single responsability) that communicate through an event hub.

The main benefits are:

  • removing/adding or updating an app doesn't break the others
  • easier to test
  • easing to maintain
  • easier to reuse
  • memory safety

You'll see that it'll be easier to get back on your code when your application will become bigger and even a new team member could add, remove or update features in a flash. However. nothing forces you to use it.

Get in Touch

Changelog

See release notes.

License

The MIT License (MIT)

Copyright (c) 2014 Olivier Wietrich [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.