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

eb-module-magic-shuffle

v1.0.2-alpha7

Published

Isotope-like grouping, sorting and filtering interface

Downloads

7

Readme

Ekstra Bladet - Magic Shuffle Module

Let the magic happen

Isotope-like grouping, sorting and filtering interface. This project was inspired by Isotope and d3.layout.grid

Demo of Magic Shuffle

Table Of Content

Getting Started

Dependencies

This module requires Node.JS and NPM for installation. The module use 'debounce' package to limit the number of invocations when resizing the browser. Add the module and install dependencies using NPM:

npm i eb-module-magic-shuffle

Usage

Create a container in the HTML-file for the shuffle:

<div class="grid-container"></div>

Reference the required stylesheet:

@import 'eb-module-magic-shuffle/main.css';

Reference the module in the javascript:

import EbGridLayout from 'eb-module-magic-shuffle';

/* Create a new instance */
const gridInstance = new EbGridLayout(document.querySelector('.grid-container'));

/* Create some elements for sorting */
gridInstance.createElem({
        attributes: {'color': 'blue', 'otherdata': 311},
        innerHTML: `<p style="color: blue;">Item 1</p>`
      });

gridInstance.createElem({
        attributes: {'color': 'blue', 'otherdata': 121},
        innerHTML: `<p style="color: blue;">Item 2</p>`
      });

gridInstance.createElem({
        attributes: {'color': 'red', 'otherdata': 411},
        innerHTML: `<p style="color: red;">Item 3</p>`
      });

The module creates corresponding DOM-elements every time createElem() function is invoked. The DOM-elements can be targeted in as by referencing the default classname grid-item.

.grid-item {
  width: 33,3%;
  background: blue;
}

Public functions

Grouping:

Shows groupnames and sorts by item

/* Group the created items by color and update layout */
gridInstance.groupBy('color');

Sorting:

Hides groupname and sorts by attribute

/* Sort items by otherdata */
gridInstance.sortBy('otherdata');

Filter:

Filters out files by passing attributes to boolean function

/* Group the created items by color and update layout */
gridInstancer.filter((attr) => {
  return (attr.color !=== 'blue')
})

Examples

Contributing

If you want to contribute to a project and make it better, your help is very welcome.

git clone [email protected]:EkstraBladetUdvikling/eb-module-magic-shuffle.git
cd eb-module-magic-shuffle

References: API Documentation

Build

Run build to output ES5 CommonJS-module for use with package manager (index.js). Typescript definitions is automatically created (index.d.js).

npm run build

License

Copyright © 2018, Ekstra Bladet

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.