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

oh-my-chat

v1.0.10

Published

### install ```sh yarn add oh-my-chat // or npm i oh-my-chat ```

Downloads

7

Readme

oh-my-chat

install

yarn add oh-my-chat
// or
npm i oh-my-chat

usage

import Vue from 'vue'
import ChatRoom from 'oh-my-chat'
import 'oh-my-chat/dist/oh-my-chat.css'

Vue.component(ChatRoom.name, ChatRoom)
<template>
  <ChatRoom
    ref="room"
    :avatar-component="avatarComp"
    :message-components="messageComps"
    :header-components="headerComps"
    :footer-components="footerComps"
    :widget-components="widgetComps"
  />
</template>
export default {
  methods: {
      handleAddBubble(type) {
        const images = new Array(Math.floor(Math.random() * 9)).fill('')
        images.forEach((item, index) => {
          images[index] = faker.image.image()
        })
        this.$refs.room.addMessage({
          type,
          float: type === 'text-msg' ? 'left' : 'right',
          id: Math.random().toString(10).substring(3, 6),
          loading: type === 'loading-msg',
          pending: type === 'pending-msg',
          header: 'nickname',
          footer: 'created-at',
          data: {
            content: this.randomContent(),
            src: images,
            created_at: faker.date.recent(),
            user: {
              id: Math.random().toString(10).substring(3, 6),
              avatar: faker.image.avatar(),
              nickname: faker.name.findName()
            }
          }
        })
      }
  }
}

props

| name | type | required | meaning | | ---- | ---- | -------- | ------- | | avatarComponent | vue-component | N | 头像组件,如果定义了,并且 data 中有 user,就会给展示头像组件 | | loadingComponent | vue-component | N | loading 组件,当内容是异步展示的时候,会展示 loading,不填则使用默认的 loading | | messageComponents | vue-components | N | 自定义气泡容器,默认仅支持 text 容器,通过 addMessage 中的 type 来调用不同容器 | | widgetComponents | vue-components | N | 自定义挂件,如分割线等,通过 addWidget 方法调用 | | headerComponents | vue-components | N | 气泡顶部的组件,如昵称,通过 addMessage 中的 header 来调用 | | footerComponents | vue-components | N | 气泡底部的组件,如点赞,通过 addMessage 中的 footer 来调用 | | colors | { bg: '#12b7f5', text: '#fff' } | N | 气泡的颜色,需要定义背景色和文字的颜色,也可以通过 addMessage 中的 color 自定义 |

tips

  1. 使用自定义组件时,会为每个组件传递一个 item 的 props
  2. 使用异步的气泡时,会先展示 loading 组件,当异步组件加载完毕后,需要在组件内手动调用this.$emit('loaded')就可以消除 loading
  3. 当 addMessage 的 pending 是 true 时,当前气可以通过watch next()来获取到后面的气泡数据,如:
// pending component
export default {
    watch: {
      next() {
        this.next && this.next.then(this.handleNext)
      }
    },
    methods: {
      handleNext(data) {
        this.users.push(data.user.nickname)
      },
      resolve() {
        this.$emit('resolve')
      }
    }
}
  1. 除非手动调动this.$emit('resolve')或出现下一个pending component否则 next 会一直触发
  2. 基本上以上的 feature 就可以覆盖表单验证,异步问答这种复杂场景了