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

menufexp

v1.0.4

Published

Menu that emulates file explorer

Downloads

5

Readme

#What's this Menu That Emulates File Explorer In JavaScript (beginners project)

#Installation npm i menufexp --save Then...

import {mnu,it,rm} from '.menufexp'

// create array of menu items
// new it(item id, item title, item value, item parent id, item type ('c'-container(folder),'i' - end item(file)) )
let items=[
    new it(-1,"*","*",-2,"c"),new it(1,"it1","val1",-1,"c"),new it(2,"it2","val2",-1,"c"),new it(3,"it3","val3",-1,"c"),
    new it(11,"it11 it11 it11it11 it11 it11","val11",1,"c"),new it(12,"it12","val12",1,"c"),new it(13,"it13","val13",1,"c"),
    new it(41,"it11 it11 it11it11 it11 it11","val11",1,"c"),new it(42,"it42","val12",1,"c"),new it(43,"it43","val13",1,"c"),
    new it(21,"it21","val21",2,"c"),new it(22,"it22","val22",2,"c"),new it(23,"it23","val23",2,"c"),
    new it(31,"it31","val31",3,"c"),new it(32,"it32","val32",3,"c"),new it(33,"it33","val33",3,"i"),
    new it(111,"it111","val111",11,"c"),new it(112,"it112","val112",11,"i"),new it(113,"it113","val113",11,"c"),
    new it(121,"it121","val21",21,"i"),new it(122,"it122","val122",21,"i"),new it(123,"it123","val123",21,"i"),
    new it(131,"it131","val131",21,"i"),new it(132,"it132","val132",21,"i"),new it(133,"it133","val133",21,"i"),
    ]
    
/////////////////////////////////////////////////////////////////////
//create new menu :
//icli handles click on item
//
let showmenu=()=>{
    
   let icli=(e,item,r,rndr,rr)=>{
		switch(item.type){
			case "c":rndr(item.id); break;
			case "i":
				let q=false;
				for(let i=0;i<r.length;i++){
					if (r[i]==item.id){q=true; break;}
					//console.log("i=",i,"res=",this.result[i],"it=",item.id,"rel=",(this.result[i]==item.id),"q=",q);
				}
				if(!q) { 
					r.push(item.id); 
					rr();
				}  
				break;
			}
		}
	let rootFolder=-1; //set rootfolder ID
	let currentFolder=1 //set currentFolder ID
	let f1={name:'Properties',f:(i)=>{alert(i.title+"\nProperties");}, type:"ci"}
	let f2={name:"New File",f:(i)=>{alert("New File in " + i.title + " folder");}, type:"c"}
	let f3={name:"Edit File",f:(i)=>{alert(i.title+"\nEdit\n"+i.value);}, type:"i"}
	let f4={name:"Delete",f:(i)=>{alert(i.title+"\n Delete\n"+i.value);}, type:"ci"}
	let f5={name:"Alert1",f:(i)=>{alert(i.title+"\nAlert1\n"+i.value)}, type:"ci"}
	let mfarr=[f1,f2,f3,f4,f5];
	//prepared  actions menu for individual menu Items(appears when you place cursor on menu sign for more then 1 sec and disappears in 3sec )
	let fr1={name:' Selected Properties',f:(i)=>{alert(i.title+"\nProperties");}, type:"ci"}
	let fr2={name:"New File",f:(i)=>{alert("New File in " + i.title + " folder");}, type:"c"}
	let fr3={name:"Edit Selected File",f:(i)=>{alert(i.title+"\nEdit\n"+i.value);}, type:"i"}
	let fr4={name:"Delete Selected file",f:(i)=>{alert(i.title+"\n Delete\n"+i.value);}, type:"ci"}
	let fr5={name:"Alert Selected",f:(i)=>{alert(i.title+"\nAlert1\n"+i.value)}, type:"ci"}
	let rfarr=[fr1,fr2,fr3,fr4,fr5];
	//prepares  actions menu for individual selected menu Items(appears when you place cursor on menu sign for more then 1 sec and disappears in 3sec )
	
	let frr1={name:'Properties',f:(r)=>{alert(r.toString()+"\nProperties")}}
	let frr2={name:"Send Selected Items Somewhere",f:(r)=>{alert("Send ["+r.toString()+"] Somewhere")}}
	let frr3={name:"Send Selected Somewhere Else",f:(r)=>{alert("Send ["+r.toString()+"] Somewhere Else");}, type:"i"}
	let rrfarr=[frr1,frr2,frr3];
	//prepares  actions menu for  selected items array(appears when you click menu sign  )

//new menu parameters 
// icli -handler of click onthe iem event,
// trigger id of html element click on which invokes new menu
// app id of html element where menu is placed
// moveanchor id of html element dragging of which moves menu
// id of root menu item (here 1)
// items array of menu items
// SelectedItems aray of ids  of selected items
// mfarr array of item  actions
// render menu method that renders menu: 1 id of current folder

    const tebu= new mnu(icli,'trigger','app','moveanchor',rootFolder,items,selectedItems,mfarr,rrfarr).render(currentFolder);
    let move=null;
    // rm object enabling menu moving
    if(!move){ move= new rm('moveanchor','app')};
}
///////////////////////////////////////////////////////////////////
    document.getElementById("trigger").addEventListener("click",showmenu)