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

@muops/theme-naive

v0.1.7

Published

NaiveUI 主题样式配置管理

Downloads

104

Readme

NaiveUI 主题样式配置管理

使用

  • package.json 添加配置项:"type": "module"
  • ApplyTheme 方法返回的对象传递给 n-config-provider 组件的 theme-overrides 属性

方法

ApplyTheme

import { ApplyTheme } from '@muops/theme-naive'
// 预设了 blue green 两种主题,可以通过 MixinTheme 扩展更多,如果传入了未定义的主题,则返回 null
ApplyTheme('blue')

// 临时扩展主题,参数都可选
import THEME from 'theme.json'
// inline 方式引入 css 以免被插入到 DOM 当中
import STYLE from 'style.styl?inline'
ApplyTheme('blue', THEME, STYLE)

MixinTheme

import { MixinTheme, ApplyTheme } from '@muops/theme-naive'

import THEME from 'theme.json'
import STYLE from 'style.styl?inline'
// 混合新的主题,或者扩展原有主题,扩展后会覆盖原主题配置
MixinTheme('red', THEME, STYLE)
MixinTheme('blue', THEME, STYLE)

// 混合后不会应用主题,需要手动进行应用
ApplyTheme('red')
ApplyTheme('blue')

维护

  • 参照下方的文件结构修改对应部分的样式与配置
  • 新增主题配置时需要修改 index.js,参照已有主题进行新增配置
.
├─ dist,构建结果目录,实际使用的文件
│
├─ fonts,字体文件目录
│  └─ source_hans_regular,思源黑
│
├─ style,基础样式目录
│  ├─ index.styl,通用工具样式
│  ├─ mobile.json,naive-ui 的移动端变量配置
│  ├─ naive.styl,naive-ui 的样式调整
│  ├─ theme.json,naive-ui 的变量配置
│  └─ theme.styl,涉及主题的公共样式部分
│
├─ theme,主题样式目录,内容以主题命名,两个一组构成配置
│  ├─ [color].json,主题变量配置
│  └─ [color].styl,主题样式调整,不便通过变量控制的样式覆盖部分
│
├─ index.js,主题配置部分
└─ utils.js,主题管理逻辑

发布

npm i nrm -g   # 通过 nrm 管理源
nrm use npm    # 使用 npm 源
npm login      # 首次使用需要先登录 npm 帐号
npm run build  # 构建生产版本
npm publish    # 每次推送前须在 package.json 中更新版本号