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

webjs-menu

v0.0.4

Published

```javascript npm i webjs-menu ```

Downloads

9

Readme

安装

npm i webjs-menu

使用

import { MenuDark, Menu, MenuDark1,createMenuDark,  MenuGenerator } from "webjs-menu"
// Menu 默认主题
// MenuDark 黑色主题菜单
// MenuDark1 黑色主题菜单
// createMenuDark 创建自定义黑色主题菜单
// MenuGenerator 自定义任意主题菜单

new Menu(
// 第一层数组为组,每一组里面有三个属性,name、items、style ,name、style可不写
// 第二层 items 数组 是菜单项,菜单项属性有:name、desc、style、arrowColor、descColor、color、 bgColor、 activeBgColor、activeColor、activeDescColor、 activeArrowColor、children
// 这些属性可以根据需求设置,children创建层级菜单,就像window菜单那样的展开方式,children的层次结构和父级是一样的,从创建组开始
[
    {
        name:"测试1组",
        items:[
            {
                name: "菜单项1",
                desc: "Ctrl + A",
                style:{
                    color: "red"
                },
                children:[
                    // 组
                    {

                    }
                ]
            },
            {
                name: "菜单项2"
            },
            {
                name: "菜单项3"
            }
        ]
    },
    {
        name:"测试2组",
        items:[
            {
                name: "菜单项1",
                style:{
                    color: "red"
                }
            },
            {
                name: "菜单项2"
            },
            {
                name: "菜单项3"
            }
        ]
    }
]
).show(100, 100) // show两个参数是显示位置,需要自己传入

我们不可能给每一菜单项都配置上:style、arrowColor、descColor、color、 bgColor、 activeBgColor、activeColor、activeDescColor、 activeArrowColor这些属性,那样会很麻烦,可以使用MenuGenerator创建一个菜单模板

const MyMenuDark = MenuGenerator({
    plane: { // 菜单面板style设置
        background: '#373737',
        borderRadius: "6px",
    },
    group: { 
        style: {}, // 菜单组style设置
        titleStyle: { // 组里面标题style设置
            paddingTop: '10px',
            color: color
        }
    },
    item: {
        style: { // 菜单项style设置
            minWidth: "250px"
        },
        arrowColor: '#fff', // 默认菜单项右边多级箭头颜色
        descColor: '#fff', // 默认描述文字颜色
        color: '#fff', // 默认菜单文字颜色
        bgColor: 'none', // 默认菜单背景色
        activeBgColor: color, // 激活菜单背景色
        activeColor: '#fff', // 激活菜单文字颜色
        activeDescColor: '#fff', // 激活描述文字颜色
        activeArrowColor: '#fff', // 激活菜单项右边多级箭头颜色
    }
})

然后使用我们自己定义主题的菜单

new MyMenuDark(
[
    {
        name:"测试1组",
        items:[
            {
                name: "菜单项1",
                desc: "Ctrl + A",
                children:[
                    // 组
                    {
                        ...
                    }
                ]
            },
            {
                name: "菜单项2"
            },
            {
                name: "菜单项3"
            }
        ]
    },
    {
        name:"测试2组",
        items:[
            {
                name: "菜单项1",
                style:{
                    color: "red"
                }
            },
            {
                name: "菜单项2"
            },
            {
                name: "菜单项3"
            }
        ]
    }
]
).show() // show两个参数是显示位置,需要自己传入