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

mkg-sidebar

v1.0.0

Published

mkg-sidebar is stylable navigation bar/pane/drawer with nested menu support for mobile and web UI. You can easily set up navigation items or custom html content. then u just need trigger to open.

Downloads

3

Readme

mkg-sidebar

mkg-sidebar is stylable navigation bar/pane/drawer with nested menu support for mobile and web UI. You can easily set up navigation items or custom html content. then u just need trigger to open.

Install

From Node

npm install mkg-sidebar --save
import mSidebar from "mkg-sidebar";
import "mkg-sidebar/dist/mkg-sidebar.css";// if you use webpack with style loader

From Browser

you can get the latest release of mkg-sidebar from repo

import script and css files

<script src="mkg-sidebar.min.js"></script>
<link rel="stylesheet" type="text/css" href="mkg-sidebar.min.css">

Usage

var items = [
    {
        text:'Main Page',
        link:'Link1'
    },
    {
        text:'Another Page',
        link:'AnotherLink'
    }
];

var menu = mSidebar({baseURL: 'http://site.com/'});
menu.addItem(items);
menu.open();

Options with Default Values

baseURL:'' // base url to every relative menu links
position:'left' // left, top, bottom, right
closeButton:true //
closeOnBackgroundClick:true //
animationType:'slide' // TODO:push, spread
defaultTitle:'' //default title attr value
defaultFollow:true, // default follow attr value
autoCollapse:false// auto collapse on close
onOpen:null // handler
onClose:null // handler

Methods

var menu =  mSidebar(options);
menu.addItem({
    text:'Test',
    link:'/PageLink.html',
    callback:function(){console.log(this);}
}); //add menu item

menu.collapse(); //collapse all submenus
menu.unCollapse(); //uncollapse all submenus
menu.open(); //open menu
menu.close(); //close menu
menu.toggle(); //toggle menu
menu.removeItems(); //clears all items
menu.setContentFrom('#divWithContent'); //sets the menu content from targeted element
menu.setHeaderFrom('#divWithContent'); //sets the menu header content from targeted element
menu.setFooterFrom('#divWithContent'); //sets the menu footer content from targeted element
menu.setContent('<div>test</div>'); //sets the menu content from targeted element
menu.setHeader('<div>test</div>'); //sets the menu header content from targeted element
menu.setFooter('<div>test</div>'); //sets the menu footer content from targeted element
menu.refreshItems();

Visualize

Scss styling

.mSidebar{
  & &-item{} //all menu items
  & &-collapse{ //whole collapsable item container
    //a collapsable item has 3 parts:
    & &-header{} //header area is the part of without button and sub items
    & &-items{} //items area is the sub-items container of collapsable item
    & &-button{} // button area of the collapsable item
  }
  & &--d0{} //you can compine any class with mSidebar--d{level} class
  & &--d1{}
  & &--d2{}
}

css styling

.mSidebar .mSidebar-item{}
.mSidebar .mSidebar-collapse {}
    .mSidebar .mSidebar-collapse-header {}
    .mSidebar .mSidebar-collapse-items {}
    .mSidebar .mSidebar-collapse-button {}

.mSidebar-collapse-button.mSidebar--d0 {} //you can combine any class with mSidebar--d{level} class
.mSidebar-collapse-button.mSidebar--d1 {}
.mSidebar-collapse-button.mSidebar--d2 {}

Building

ensure that you have all dependency packes with 'npm install' and install gulp to gloval with npm install gulp -g package using gulp for building. following tasks are avaliable:

  • gulp default : watches src files and serves index.html for developing
  • gulp minify : creates minified version of package. don't forget to use it after development ends.

TO DO

  • add React component
  • add alternative animation styles
  • optional animation libraries //'It based on native js and css. Animation libraries TweenMax, jQuery animate are also optional.'
  • add alternative visual style
  • documantation