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

suitup

v0.0.4

Published

SuitUp is a javascript OpenSource MVC framework that allows you to create sweet apps with less code that makes sense

Downloads

9

Readme

SuitUp.js is an Open Source Javascript OOP-MVC framework that allows you to create sweet apps with less code. SuitUp.js comes with jquery included, so you are free to use your jquery plugins without inconvenients or hacks. Also, any change in your model instances will result in DOM updates.

SuitUp.js uses Handlebars as template language and a virtual copy of your DOM. When your data changes, SuitUp.js re-render the template and updates the virtual tree.

SuitUp.js is in early development.

##Components Create components by extending from SuitUp.Component Class. Instances of the component are created from any template you want.

var HeaderComponent = function() {
    SuitUp.Component.call(this, {
        template: "header" //handlebars template name that this component is going to use
    });
};
HeaderComponent.prototype = Object.create(SuitUp.Component.prototype);
HeaderComponent.prototype.constructor = HeaderComponent;

##Routing Creating routes is easy and clean in suitup. Just specify the route, component name and a callback function.

app.js

var router = SuitUp.Router;

var index = router.map ("/", "IndexComponent", function(req, res) {
    var data = {
        data: "your data"
    };
    res.render(data);
});

var friends = router.map ("/friends", "FriendsComponent", function(req, res) {
    var data = {
        friends: ["your","friends","list"] 
    };
    res.render(data);
});

var friend = router.map ("/friend/:id", "FriendComponent", function(req, res) {
    console.log(req);
    var data = {
        id: req.query.id
    };
    res.render(data);
});

##Templates SuitUp uses handlebars. It's fast and easy. Call a template with the partial helper. Create a component instance with the component helper. Load templates based on url with the context helper. Load static templates with partial helper.

application.handlebars

{{{component "HeaderComponent" model "header"}}}

<section class="main-content">
    {{{context}}}
</section>

{{{partial "footer"}}}

Update your model when inputs change.

component.handlebars

<textarea {{{modelVar "text"}}} value="{{{model.text}}}"> </textarea>
<p>{{{model.text}}}</p>

##Components inside other components In SuitUp, components are encapsulated reducing coupling. You can define a component inside another component in your template and access to the component instance. For example, if you have 2 components, IndexComponent and HeaderComponent, you can define the IndexComponent template, index.handlebars like this:

  • first argument: The Component Class.
  • second argument: The Model to use.
  • third argument: A property name to access the child Component from parent component.

index.handlebars

{{{component "HeaderComponent" model "headerComponent"}}}

<p>this is index</p>

Then, if you have an instance of your IndexComponent called index, you can access to your header data like this:

//first
var headerModel = index.headerComponent.getModel();
//then you can update your model and your Html will be updated.
var headerTitle = headerModel.set("title", "home");
//you can do this too
var link = headerModel.get("menu.links[2].href");

##Running example If not enough documentation here, check the example included. Just execute the server file included in the example folder. Then open it in your browser http://localhost:4200/

$ cd example
$ node server.js

##Including it in your html Just include suitup.min.js from dist folder and your compiled handlebars templates.

<script src="templates.js"></script>
<script src="suitup.min.js"></script>

##TODO

  • Model Class
  • More helpers

##Contributing You are free to hack, modify or improve this code.

##Thanks