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

hopeui

v0.0.2

Published

a front end UI lib made by HOPE studio

Downloads

3

Readme

HopeUI

Build Status Coverage Status

基于 react 的 UI 组件库

安装与使用

$ npm install hopeui --save
import React from 'react';
import ReactDOM from 'react-dom';
import HopeUI from 'hopeui';

ReactDOM.render(
  <link rel="text/stylesheet" href={HopeUI.css}/>,
  document.getElementById('css')
)

ReactDOM.render(
  <HopeUI.Button/>,
  document.getElementById('root')
)

开发说明

流程说明

  1. fork 到自己名下
  2. 本地开发组件
  3. 编写测试文件 *.spec.js 并测试
  4. 发 pull request 到 master 分支
  5. 关注结果反馈

本地开发

$ git clone [email protected]:HopeStudio/hopeUI.git
$ cd hopeUI
$ npm install
$ npm start

使用浏览器访问 http://localhost:8868 查看 demo

目录结构

├── app                # 组件代码
│   ├── icons          # 矢量图标
│   │   ├── source     # SVG 源文件
│   │   ├── store      # 转换后的 react 组件
│   │   └── export.js  # 图标组件导出文件
│   ├── rules          # 基本 CSS 规则以及颜色规则
│   ├── tools          # 工具函数
│   ├── entry.js       # demo 入口文件
│   └── hopeUI.html    # demo html 文件
├── dist               # 生成文件
├── lib                # 外部库
└── package.json

打包

$ npm run build

lint

目前多数代码并未规范化,只需保证新加入代码符合规范即可

$ npm run lint

测试

测试

$ npm run test

测试并生成覆盖率报告

$ npm run testCoverage

代码覆盖率报告将以 html 形式生成在 coverage/icov-report 中

添加矢量图标

  1. 将待添加图标的 SVG 源文件复制到 app/icons/source 目录下
  2. 运行
    $ npm run svgIcon
  3. 在 app/icons/export.js 中加入导入和导出新图标的代码

工具函数说明

colorTrans(styleObj, className)

  • styleObj <Object> 添加的样式
  • className <String>

styleObjclassName 组成样式表并写入到一个 <style> 标签中。返回 <style> 标签的 id。

在这个过程中会对 styleObj 中的颜色值进行转换,转换规则参考 app/rules/colors.js。

注意:styleObj 中的键名应该是在 CSS 中出现的原始样式名,而不应该是驼峰形式。

uuid(len, radix)

  • len <Number> 长度
  • radix <Number> 所用字符数,默认为 62

返回一个随机的字符串。

不指定长度时返回的字符串符合 GUID 格式,但其中每个部分均由随机产生而并未使用到日期、网卡等信息。