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

col-umn

v0.2.0

Published

experiment in grid configuration

Downloads

1

Readme

col-umn.js

Note: this is not ready for stable use

col-umn.js uses functions to describe nested columns and the work (sync or async) needed to fill those columns with data.

Installation

$ npm install col-umn

Motivation

I often end up writing JSON descriptions of grids for laying out complicated pages. These descriptions can become quite complicated and usually have properties that are essentially pointers to work that needs to be done (for instance what component needs to be used).

By approaching this problem in a more functional way, I hope to make descriptions of complicated layouts that are compact, flexible, and expressive. I am also interested in thinking of the layout as an application and not as data.

Structure overview


var COL = require('col-umn');

//  * Setup the column               * Render the column
//  |_____                           |_________________________
//  |    |                           |                        |
    COL(3)(optionFn)('optionB', true)({data: [1,2,3]},callback);
//        |_________________________|
//        |
//        * Setup column operations to execute on render.
//          - functions that set options
//          - simple option assignment
//          - child columns

breaking down the structure

The COl function returns the build function which is used to set options and nest other columns’ build functions.


// Setup a 3 unit column and return the 'build function'

var buildFn = COL(3);
  
// The build function returns itself until
// it is called with an {} or undefined

buildFn = buildFn(optionFn);
buildFn = buildFn('optionB', true);

// Execute the final rendered column
// and return the final data

buildFn({data: [1,2,3]}, function callBack (errors, finalData) {
  // handle the rendered column
});

Examples

Simple Option setting


COL(6)('Awesome', true);

// Rendered:

// {
//   "width": 6,
//   "options": {
//      "Awesome": true
//    }
//  }
    

Nesting


COL(6)
  (
    COL(6)
      (
        COL(3)
      )(
        COL(3)
      )
  )(
    COL(4)
  )(
    COL(2)
  );
  
// Rendered:

// {
//   "width": 6,
//   "columns": [
//     {
//       "width": 6,
//       "columns": [
//         {
//           "width": 3
//         },
//         {
//           "width": 3
//         }
//       ]
//     },
//     {
//       "width": 4
//     },
//     {
//       "width": 2
//     }
//   ]
// }