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

@hoci/core

v1.0.0

Published

[English](README.md) | 中文

Readme

@hoci/core

English | 中文

hoci 的核心组合式函数、props、emits 与类型。不提供 Vue 组件 — 即用型组件请使用 @hoci/components。基于 Vue 3 与 @vueuse/core

💡 推荐: 大多数场景下,我们推荐使用 hoci 主包,而不是直接安装 @hoci/corehoci 包提供了统一的入口,包含组件、组合式函数和自动导入解析器。

安装

pnpm add @hoci/core

依赖要求: Vue 3.3+、@vueuse/core 10.5+。

组合式函数 API

| 组合式函数 | 返回值 | 说明 | |------------|--------|------| | useAffix | { className, wrapperRef, isFixed, placeholderStyle, fixedStyle, updatePosition } | 滚动时将内容固定在视口或目标。返回固定状态、样式和引用。 | | useFileUpload | { inputRef, files, handleChange, handleDrop, handleDragOver } | 支持拖拽的文件上传。返回文件列表和处理函数。 | | useIcon | { style } | 图标逻辑(尺寸、颜色、遮罩)。返回计算后的样式。 | | useSelectionItem | { isActive, activate, reject, className } | 可选项逻辑。返回激活状态和处理函数。 | | usePopover | { visible, show, close, popupRef, triggerRef, placement, offset } | 可控制位置的浮动面板。返回可见性状态和引用。 | | useSelectionList | { options, actives, isActive, changeActive, renderItem, render } | 单选/多选状态管理。返回选择状态和渲染函数。 | | useSelectionContext | HiSelectionContext | 从父级 HiSelection 注入选择上下文。返回包含 activate、isActive 等的上下文。 | | useSwitch | { toggle, modelValue, className, isDisabled, activateEvent } | 开关逻辑。返回状态和切换处理函数。 | | useVirtualList | { virtualizer, scrollToIndex, scrollToOffset } | 大列表虚拟滚动。返回虚拟化实例和滚动方法。 |

Props 与 Emits

| 模块 | Props | Emits | 说明 | |------|-------|-------|------| | Affix | affixProps | affixEmits | 固定定位属性(offset、position、target、zIndex)和事件(scroll、change) | | ConfigProvider | configProviderProps | - | 全局配置属性(icon、activateEvent) | | FileUpload | fileUploadProps | fileUploadEmits | 文件选择属性(modelValue、multiple)和事件(update:modelValue、change) | | Icon | iconProps | - | 图标属性(src、size、width、height、color、mask) | | Item | itemProps | itemEmits | 选择项属性(value、disabled)和事件(reject) | | Popover | popoverProps | popoverEmits | 浮动面板属性(placement、triggerEvent、offset、visible)和事件(update:visible、change) | | Selection | selectionProps | selectionEmits | 选择属性(modelValue、multiple、activeClass、itemClass)和事件(update:modelValue、change) | | Switch | switchProps | switchEmits | 开关属性(modelValue、activeClass、disabled)和事件(update:modelValue、change、reject) | | VirtualList | virtualListProps | virtualListEmits | 虚拟列表属性(count、estimateSize、options)和事件(scroll、scrollStart、scrollEnd) |

工具函数

| 导出 | 说明 | |------|------| | provideAffixTarget | 为子组件提供 affix 目标元素 | | AFFIX_TARGET_KEY | Affix 目标上下文的注入键 |

类型、组合式函数(如 useShowable)与工具由 @hoci/shared 重新导出。

使用方式

基于组合式函数进行二次组件开发;若需要现成 Vue 组件,请使用 @hoci/componentshoci

import { selectionEmits, selectionProps, useSelectionList } from "@hoci/core";

// 在你自己的组件中使用
const { isActive, changeActive, render } = useSelectionList(props, { emit, slots });

许可

MIT