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

simple-mind-map-plugin-themes

v1.0.0

Published

为simple-mind-map提供可用的主题

Downloads

223

Readme

simple-mind-map-plugin-themes

mind-map主题扩展插件,为simple-mind-map提供可用的主题。

安装

npm i simple-mind-map-plugin-themes

使用

import MindMap from 'simple-mind-map'
import Themes from 'simple-mind-map-plugin-themes'

// 注册主题
Themes.init(MindMap)

// 实例化
new MindMap({
    theme: 'dark7'
})

属性

Themes对象暴露了两个属性:

  • darkList:暗色主题列表

  • lightList:亮色主题列表

方法

Themes对象暴露了两个方法:

  • init(MindMap)

注册主题,需要在实例化思维导图前调用。参数为simple-mind-map构造函数。

  • remove(MindMap)

删除注册的主题。参数为simple-mind-map构造函数。

其他

如果你需要获取所有主题列表可以通过如下方式:

import themeList from 'simple-mind-map-plugin-themes/themeList'

themeList数据结构如下所示:

[
    {
        name: '暗色',// 主题名称
        value: 'dark',// 主题标识,实例化或动态设置主题时都是通过该值
        theme: {},// 主题具体的配置
        dark: true// 是否是暗色主题
    }
]

需要注意的这个包里不包括simple-mind-map自带的默认主题,所以你要渲染包括默认主题在内的所有主题列表时需要自己加上默认主题,比如:

[
    {
        name: '默认主题',
        value: 'default',
        dark: false
    },
    ...themeList
]

包里提供了每个主题的预览图片,要获取主题到图片的映射数据可以通过如下方式:

import themeImgMap from 'simple-mind-map-plugin-themes/themeImgMap'

如果要获取打包后的文件,可以在/node_modules/simple-mind-map-plugin-themes/dist/目录下获取,提供了两种打包格式的文件:

themes.cjs.min.js
themes.esm.min.js

贡献主题

所有主题都是基于默认主题扩展的,注册时会和默认主题进行合并。

主题整体分为暗色和亮色,分别在/src/dark//src/light/目录下定义,文件定义完成后需要在各自目录的index.js文件中导出。

推荐附带一张预览图,可以在/src/imgs/找到现有主题的预览图片,如果添加了图片可以在themeImgMap.js文件中导出。

主题列表

所有可用主题可以从暗色主题列表亮色主题列表两个文件中查看。