@featherk/composables

中文文档
0.19.4发布于 2026/11/14MITTypeScriptESM + CJS近 30 天下载 2786

Vue 3 composables that improve Kendo UI for Vue behavior and accessibility.

原始使用文档
文档目录11 节
  1. Composables Overview
  2. Utility Export
  3. Importing Composables
  4. What Gets Installed vs. What Ships
  5. Kendo UI Compatibility
  6. Dependencies
  7. Styling
  8. Testing with Vitest
  9. Build
  10. Maintainer Notes
  11. Changelog

@featherk/composables

Vue 3 composables that improve Kendo UI for Vue behavior and accessibility.

Composables Overview

Utility Export

computeCollisionOffset is a pure utility export, not a Vue composable. It applies per-axis fit or flip collision behavior and is available from @featherk/composables/geometry or the package root.

Importing Composables

Import from the feature subpath. Each subpath is a separate entry that loads only its own composables, which also keeps the dev server fast. The package root re-exports every feature; see What Gets Installed vs. What Ships. Don't import internal dist paths.

Subpath imports (recommended):

// Grid
import {
  useGridA11y,
  useGridActiveFilter,
  useGridRowAction,
  type RowActionContext,
} from "@featherk/composables/grid";

// Date input
import {
  useMaskedDateInput,
  type ChangePayload,
} from "@featherk/composables/date";

// Date range input
import {
  useMaskedDateRangeInput,
  type RangeChangePayload,
} from "@featherk/composables/range";

// Time input
import {
  useMaskedTimeInput,
  type ChangePayload,
} from "@featherk/composables/time";

// Popup focus trap utilities
import { usePopupTrap } from "@featherk/composables/trap";

// Kendo Popup + Menu action-menu utilities
import {
  usePopupMenu,
  type KendoMenuSelectEvent,
} from "@featherk/composables/menu";

// Shared active-id bookkeeping for single-open grid or list patterns
import {
  useActiveIdRegistry,
  useExclusiveGroup,
} from "@featherk/composables/registry";

// Intersection observer utilities
import { useIntersectionObserver } from "@featherk/composables/observer";

// Geometry utilities
import { computeCollisionOffset } from "@featherk/composables/geometry";

// Component-scoped DOM ID utilities
import { useCompositeId } from "@featherk/composables/id";

// Address utilities
import {
  useZipTextBox,
  useUSAddress,
  type USAddressSubmitPayload,
} from "@featherk/composables/address";

// Form utilities
import {
  useFieldsetValidationKit,
  useFieldsetTouchTracker,
} from "@featherk/composables/form";

// Kendo Window wrappers
import { useWindow, useWindowDrawer } from "@featherk/composables/window";

The package root re-exports every feature. Date and time payload types are aliased there to avoid name collisions:

import {
  useGridA11y,
  useGridActiveFilter,
  useGridRowAction,
  type RowActionContext,
  useMaskedDateInput,
  type DateChangePayload,
  useMaskedDateRangeInput,
  type RangeChangePayload,
  useMaskedTimeInput,
  type TimeChangePayload,
  usePopupTrap,
  usePopupMenu,
  type KendoMenuSelectEvent,
  useActiveIdRegistry,
  useExclusiveGroup,
  useIntersectionObserver,
  useCompositeId,
  useZipTextBox,
  useUSAddress,
  useFieldsetValidationKit,
  useFieldsetTouchTracker,
  useWindow,
  useWindowDrawer,
} from "@featherk/composables";

For complete setup, behavior, and examples, use the guide listed in Composables Overview.

What Gets Installed vs. What Ships

FeatherK packages should just work once installed: you should never have to track down a missing dependency or silence a peer warning. When that conflicts with install size, FeatherK accepts a larger node_modules and keeps the browser bundle small.

You importInstalled in node_modulesShipped to the browser (production build)
import { useX } from "@featherk/composables/<feature>"Every runtime dependency (VueUse, focus-trap), installed automaticallyuseX and the dependencies it imports
import { useX } from "@featherk/composables"SameSame as the subpath import
Nothing from a featureIts dependencies are still installedNothing from that feature

During vite dev, a root import loads every feature. This affects only the dev server, not what users download.

Kendo UI Compatibility

Built and tested against Kendo UI for Vue 6.4.1. The composables do not import Kendo at runtime, but they depend on the DOM structure and k-* classes rendered by specific Kendo versions, and several public types come from Kendo packages. Those packages are declared as optional peer dependencies (^6.4.1): none is required, but any you install must be in the supported range.

ComposablesKendo package
useGridA11y, useGridActiveFilter, useGridRowAction@progress/kendo-vue-grid, @progress/kendo-data-query
useWindow, useWindowDrawer@progress/kendo-vue-dialogs
usePopupMenu@progress/kendo-vue-layout, @progress/kendo-vue-popup
usePopupTrap@progress/kendo-vue-popup
useMaskedDateInput, useMaskedDateRangeInput, useMaskedTimeInput@progress/kendo-vue-dateinputs
useZipTextBox, useUSAddress@progress/kendo-vue-inputs

Dependencies

  • Required peers: vue (3.5+)

    npm and pnpm install it automatically; with Yarn Berry, install it yourself.

  • Optional peers: the Kendo packages listed under Kendo UI Compatibility, for the composables you use. They're used only for types, and your app already installs them for the Kendo components it renders.

  • Runtime dependencies: @vueuse/core, @vueuse/integrations and focus-trap, installed with this package. usePopupTrap uses VueUse integrations and focus-trap internally.

Keep all @featherk/* packages on the same version. They release together, and each @featherk/ui release requires at least the matching @featherk/composables. With Renovate or Dependabot, group them into one update.

Styling

The composables ship no CSS. Some, such as useWindow and useGridA11y, add fk-* classes to the Kendo components they manage, and @featherk/styles themes those classes.

Testing with Vitest

To mock a composable, mock its subpath, and import it from that same subpath in the code under test. Each subpath is a separate module, and a mock replaces only the module it names. A root mock doesn't reach code that imports a subpath, which includes every @featherk/ui component, and a subpath mock doesn't reach code that imports the root. Neither case raises an error; the test simply runs the real composable.

// Before 0.18.0 every subpath was one module, so either specifier worked.
vi.mock("@featherk/composables", …);

// Now: mock the subpath the code imports.
vi.mock("@featherk/composables/trap", …);

Build

Run from repository root:

npm run build -- --filter=@featherk/composables

Or run package-local:

npm run build

Maintainer Notes

  • Every feature folder has an index.ts barrel, is re-exported from src/index.ts, and has a matching exports subpath. For example, useGridA11y, useGridActiveFilter and useGridRowAction live in src/grid/ and ship from @featherk/composables/grid.
  • vite.config.ts builds one ES and one CommonJS entry for the root and for each package.json exports subpath. A new feature folder only needs its subpath added to exports.
  • package.json sets "sideEffects": false, so a root import tree-shakes to the same code as the subpath. Keep modules free of import-time side effects. A module that must run on import has to be listed in sideEffects, or bundlers will drop it.
  • Keep shared state out of module scope: no module-level refs, Maps or provide/inject keys. An app can load both the ES and CommonJS builds, and the two copies don't share state. Create state in the composable and pass the instance, as useActiveIdRegistry does.
  • Add each new source file to coverage.include in vitest.config.ts. The list is explicit, so a file left out is missing from the coverage report and escapes the coverage thresholds, even when it has its own tests.
  • The repo's scripts/check-entries.mjs runs at the end of the build. It fails if an export target is missing, an entry imports a package that isn't a dependency or peer, or any entry imports an optional peer (npm doesn't install those). Kendo packages are optional peers, so this keeps them type-only.
  • The repo's scripts/check-peers.mjs doesn't run here, because this package has no @featherk/* peers. If it ever gains one, add the sibling as a file: dev dependency and the peer check to the build script, as @featherk/ui does.

Changelog

Release history for all @featherk/* packages is maintained in a single CHANGELOG.md.

版本与发布记录

@featherk/composables 共发布 127 个版本,首次发布于 2025/09/27;过去 12 个月发布了 108 个版本。

版本发布日期距今
0.19.4latest2026/11/14今天
0.19.32026/11/113 天前
0.19.22026/11/058 天前
0.19.12026/10/3114 天前
0.19.02026/10/2717 天前
0.18.12026/10/2421 天前

关于 @featherk/composables 的常见问题

@featherk/composables 是什么?

Vue 3 composables that improve Kendo UI for Vue behavior and accessibility.

如何安装 @featherk/composables?

在项目目录运行 npm install @featherk/composables,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.5.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@featherk/composables 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@featherk/composables 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@featherk/composables 可以商用吗?

@featherk/composables 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@featherk/composables 的下载量有多少?

根据 npm 官方下载统计,@featherk/composables 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,786 次,日均约 93 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@featherk/composables 还在维护吗?

最新版本 0.19.4 发布于 2026/11/14(今天);至今共发布 127 个版本,其中过去 12 个月发布了 108 个;首次发布于 2025/09/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。