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

web-component-wheat-ui

v1.1.18

Published

通过 web component 打造全新组件库

Downloads

21

Readme

wheat-ui

通过 web components 打造全新组件库

适配所有框架

无论你的技术栈使用的是 angular、vue、react;不存在框架兼容问题,你就当做标签直接使用

示例

image

在 html 中使用

将 dist 中的 wheat.ui.min.js 保存在本地或者 CDN 上,然后通过 script 引入即可

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Modal</title>
  </head>
  <style></style>
  <body>
    <button onclick="showModal()">显示弹框</button>
    <wheat-modal title="弹窗" visible="false" maskCloseable="true">
      <div slot="content">
        弹框内容
      </div>
    </wheat-modal>
  </body>
  <script src="./dist/wheat.ui.min.js"></script>
  <script>
    const MyModalDom = document.querySelector('wheat-modal')

    MyModalDom.addEventListener('onCancel', (value) => {
      const {
        detail: { visible }
      } = value
      console.log('触发取消方法')
      MyModalDom.setAttribute('visible', visible)
    })

    MyModalDom.addEventListener('onConfirm', (value) => {
      console.log('触发确定方法')
      MyModalDom.setAttribute('visible', false)
    })
    const showModal = () => {
      MyModalDom.setAttribute('visible', true)
    }
  </script>
</html>

在 angular、vue、react 项目中使用,

安装

npm i web-component-wheat-ui

使用

import 'web-component-wheat-ui'

在 React 中使用

import React, { useState, useEffect } from 'react'
import 'web-component-wheat-ui'
const App = () => {
  const [visible, setvisible] = useState(false)
  useEffect(() => {
    const MyModalDom = document.querySelector('wheat-modal')
    MyModalDom.addEventListener('onCancel', (value) => {
      const {
        detail: { visible }
      } = value
      console.log('触发取消方法')
      setvisible(visible)
    })

    MyModalDom.addEventListener('onConfirm', (value) => {
      console.log('触发确定方法')
      setvisible(false)
    })
  }, [])
  return (
    <div className="App">
      <button
        onClick={() => {
          setvisible(true)
        }}
      >
        显示弹框
      </button>
      <wheat-modal title="title" visible={visible}>
        <div slot="content">弹框内容</div>
      </wheat-modal>
    </div>
  )
}

export default App

在 Vue 中使用

<template>
  <div>
    <button @click="showModal">
      显示弹框
    </button>
    <wheat-modal title="title" :visible="visible.toString()">
      <div slot="content">弹框内容</div>
    </wheat-modal>
    <div>{{ visible }}</div>
  </div>
</template>

<script>
import 'web-component-wheat-ui'

export default {
  data() {
    return {
      visible: false
    }
  },
  mounted() {
    const MyModalDom = document.querySelector('wheat-modal')
    MyModalDom.addEventListener('onCancel', (value) => {
      const {
        detail: { visible }
      } = value
      console.log('触发取消方法', value)
      this.visible = visible
    })

    MyModalDom.addEventListener('onConfirm', (value) => {
      console.log('触发确定方法', value)
      this.visible = false
      this.hidden()
    })
  },
  methods: {
    showModal() {
      this.visible = true
    },
    hidden() {
      this.visible = false
    }
  }
}
</script>

更多>>

贡献流程

  1. 添加 SSH
  2. clone 仓库
https://github.com/glean-wheat/wheat-ui
  1. 新建 issue

发现问题或者有开发者提出的问题了后,在https://github.com/glean-wheat/wheat-ui/issues创建issue;

  1. 在develop中拉取分支
  • 根据第三步创建的issue后,根据生成的id,创建分支,一般bug类的 命名为 hotfix/#+ issueID; 新增功能 feature/#+issueID

eg:

feature/#3
  1. 提交
  • 提交的时可根据 commitlint 规范进行提交;描述信息为该 issueid;这样github会根据id进行关联

eg:

git commit -m "feat: #3"

6: 提交PR

master 是保护分支;需要有 review 之后;才可合并