@hoci/components 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +74 -0
- package/README.zh-CN.md +74 -0
- package/dist/index.d.ts +779 -731
- package/dist/index.js +708 -0
- package/package.json +12 -17
- package/dist/index.cjs +0 -2243
- package/dist/index.d.cts +0 -793
- package/dist/index.d.mts +0 -793
- package/dist/index.mjs +0 -2229
package/LICENSE
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @hoci/components
|
|
2
|
+
|
|
3
|
+
[中文](README.zh-CN.md) | English
|
|
4
|
+
|
|
5
|
+
Vue 3 components that wrap [@hoci/core](../core/README.md) headless primitives. Use these when you want ready-to-use components with consistent naming (`Hi*` / `hi-*`) and a single `install()` for global registration.
|
|
6
|
+
|
|
7
|
+
> **💡 Recommendation:** For most use cases, we recommend using the **hoci** package instead of directly installing `@hoci/components`. The **hoci** package provides a unified entry point with components, composables, and auto-import resolver (`HociResolver`).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @hoci/components
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Peer dependencies:** Vue 3.3+, [@vueuse/core](https://vueuse.org/) 10.5+.
|
|
16
|
+
|
|
17
|
+
**Dependencies:** [@hoci/core](../core/README.md), [@hoci/shared](../shared/README.md).
|
|
18
|
+
|
|
19
|
+
## Components
|
|
20
|
+
|
|
21
|
+
| Component | Description | Key Features |
|
|
22
|
+
|-----------|-------------|--------------|
|
|
23
|
+
| **HiAffix** | Pin content to viewport or target element while scrolling | Supports top/bottom positioning, custom offset, scroll container |
|
|
24
|
+
| **HiAffixTarget** | Target element for affix positioning | Provides context for affix components |
|
|
25
|
+
| **HiConfigProvider** | Global configuration provider | Sets default icon config, activate event for child components |
|
|
26
|
+
| **HiFileUpload** | File input with drag-and-drop support | Single/multiple file selection, file validation |
|
|
27
|
+
| **HiIcon** | Icon wrapper component | Size, color, mask support, flexible icon sources |
|
|
28
|
+
| **HiItem** | Selectable list item | Works with HiSelection, supports custom labels |
|
|
29
|
+
| **HiPopover** | Floating panel with placement control | Multiple placements, trigger events (click, hover, etc.), teleport support |
|
|
30
|
+
| **HiSelection** | Single/multi selection container | Supports single/multiple selection, custom classes, clearable |
|
|
31
|
+
| **HiSwitch** | Toggle switch component | Boolean state, active/inactive classes, disabled state |
|
|
32
|
+
| **HiTabs** | Tab container component | Tab switching logic, works with HiTabPane |
|
|
33
|
+
| **HiTabPane** | Individual tab panel | Used within HiTabs container |
|
|
34
|
+
| **HiVirtualList** | Virtualized list for large datasets | Efficient rendering, scroll handling, customizable item size |
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
### Full Import
|
|
39
|
+
|
|
40
|
+
If you don't care about the bundle size so much, it's more convenient to use full import.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import * as HociComponents from "@hoci/components";
|
|
44
|
+
// main.ts
|
|
45
|
+
import { createApp } from "vue";
|
|
46
|
+
import App from "./App.vue";
|
|
47
|
+
|
|
48
|
+
const app = createApp(App);
|
|
49
|
+
app.use(HociComponents);
|
|
50
|
+
app.mount("#app");
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Manually import
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import {
|
|
57
|
+
HiAffix,
|
|
58
|
+
HiAffixTarget,
|
|
59
|
+
HiConfigProvider,
|
|
60
|
+
HiFileUpload,
|
|
61
|
+
HiIcon,
|
|
62
|
+
HiItem,
|
|
63
|
+
HiPopover,
|
|
64
|
+
HiSelection,
|
|
65
|
+
HiSwitch,
|
|
66
|
+
HiTabPane,
|
|
67
|
+
HiTabs,
|
|
68
|
+
HiVirtualList,
|
|
69
|
+
} from "@hoci/components";
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @hoci/components
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
基于 [@hoci/core](../core/README.zh-CN.md) 无样式基础逻辑的 Vue 3 组件封装。适用于需要即用型组件、统一命名(`Hi*` / `hi-*`)以及一次 `install()` 全局注册的场景。
|
|
6
|
+
|
|
7
|
+
> **💡 推荐:** 大多数场景下,我们推荐使用 **hoci** 主包,而不是直接安装 `@hoci/components`。**hoci** 包提供了统一的入口,包含组件、组合式函数和自动导入解析器(`HociResolver`)。
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @hoci/components
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**依赖要求:** Vue 3.3+、[@vueuse/core](https://vueuse.org/) 10.5+。
|
|
16
|
+
|
|
17
|
+
**内部依赖:** [@hoci/core](../core/README.zh-CN.md)、[@hoci/shared](../shared/README.zh-CN.md)。
|
|
18
|
+
|
|
19
|
+
## 组件列表
|
|
20
|
+
|
|
21
|
+
| 组件 | 说明 | 主要特性 |
|
|
22
|
+
|------|------|----------|
|
|
23
|
+
| **HiAffix** | 滚动时将内容固定在视口或目标元素 | 支持顶部/底部定位、自定义偏移量、滚动容器 |
|
|
24
|
+
| **HiAffixTarget** | Affix 定位的目标元素 | 为 affix 组件提供上下文 |
|
|
25
|
+
| **HiConfigProvider** | 全局配置提供者 | 设置默认图标配置、子组件的激活事件 |
|
|
26
|
+
| **HiFileUpload** | 支持拖拽的文件上传 | 单选/多选文件、文件校验 |
|
|
27
|
+
| **HiIcon** | 图标封装组件 | 尺寸、颜色、遮罩支持,灵活的图标源 |
|
|
28
|
+
| **HiItem** | 可选项列表项 | 与 HiSelection 配合使用,支持自定义标签 |
|
|
29
|
+
| **HiPopover** | 可控制位置的浮动面板 | 多种位置、触发事件(点击、悬停等)、传送支持 |
|
|
30
|
+
| **HiSelection** | 单选/多选容器 | 支持单选/多选、自定义类名、可清除 |
|
|
31
|
+
| **HiSwitch** | 开关切换组件 | 布尔状态、激活/非激活类名、禁用状态 |
|
|
32
|
+
| **HiTabs** | 标签页容器组件 | 标签切换逻辑,与 HiTabPane 配合使用 |
|
|
33
|
+
| **HiTabPane** | 单个标签页面板 | 在 HiTabs 容器内使用 |
|
|
34
|
+
| **HiVirtualList** | 大列表虚拟滚动 | 高效渲染、滚动处理、可自定义项大小 |
|
|
35
|
+
|
|
36
|
+
## 使用方式
|
|
37
|
+
|
|
38
|
+
### 完整导入
|
|
39
|
+
|
|
40
|
+
如果不太在意打包体积,完整导入更方便。
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import * as HociComponents from "@hoci/components";
|
|
44
|
+
// main.ts
|
|
45
|
+
import { createApp } from "vue";
|
|
46
|
+
import App from "./App.vue";
|
|
47
|
+
|
|
48
|
+
const app = createApp(App);
|
|
49
|
+
app.use(HociComponents);
|
|
50
|
+
app.mount("#app");
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 手动导入
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import {
|
|
57
|
+
HiAffix,
|
|
58
|
+
HiAffixTarget,
|
|
59
|
+
HiConfigProvider,
|
|
60
|
+
HiFileUpload,
|
|
61
|
+
HiIcon,
|
|
62
|
+
HiItem,
|
|
63
|
+
HiPopover,
|
|
64
|
+
HiSelection,
|
|
65
|
+
HiSwitch,
|
|
66
|
+
HiTabPane,
|
|
67
|
+
HiTabs,
|
|
68
|
+
HiVirtualList,
|
|
69
|
+
} from "@hoci/components";
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 许可
|
|
73
|
+
|
|
74
|
+
MIT
|