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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yh-ui/hooks

v1.0.63

Published

YH-UI composition hooks

Readme

@yh-ui/hooks

YH-UI 的 Vue Composition API 工具包。它沉淀了组件库内部常用的交互状态、上下文、缓存、国际化、滚动、AI 和业务计算逻辑,也可以独立用于你的 Vue 3 项目。

Documentation | GitHub

Highlights

  • 组件基础能力:useNamespaceuseZIndexuseIduseConfiguseFormItem 帮你统一命名、层级、ID 和表单上下文。
  • 交互型 Hooks:useClickOutsideuseEventListeneruseScrollLockuseVirtualScroll 处理常见 DOM 交互并自动清理副作用。
  • 业务型 Hooks:useSKUuseCountdownuseCache、响应式 storage 可直接服务电商、活动页和高频缓存场景。
  • AI Hooks:useAiChatuseAiStreamuseAiConversationsuseAiRequestuseAiVoiceuseAiPersistence 支撑 AI 对话和流式输出。
  • 国际化集成:useLocale 和 dayjs locale helpers 让组件文本和日期语言保持一致。
  • SSR 友好:涉及 DOM 的能力会在服务端环境下保护执行,适合 Nuxt。

Install

pnpm add @yh-ui/hooks

Usage

import { useCountdown, useNamespace, useVirtualScroll } from '@yh-ui/hooks'

Common Hooks

| Hook | Use case | | ------------------ | ------------------------------------------------------------ | | useNamespace | Generate BEM-style class names with the YH-UI prefix | | useZIndex | Allocate overlay z-index values consistently | | useVirtualScroll | Render large lists with a small visible window | | useCache | Reactive cache with expiration and cleanup behavior | | useSKU | Calculate selectable SKU combinations and disabled states | | useCountdown | Countdown state with start, pause, resume and reset | | useLocale | Read and translate current locale messages | | useAiChat | Manage AI chat messages, loading state and request lifecycle |

Example

<script setup lang="ts">
import { useCountdown } from '@yh-ui/hooks'

const { remaining, isRunning, start, pause, resume, reset } = useCountdown({
  duration: 60,
  interval: 1000
})
</script>

<template>
  <span>{{ remaining }}s</span>
  <button @click="start">Start</button>
  <button :disabled="!isRunning" @click="pause">Pause</button>
  <button @click="resume">Resume</button>
  <button @click="reset">Reset</button>
</template>

License

MIT