@box-kite/core

中文文档
2.4.0发布于 2026/11/07MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 3648

The Box Kite styling engine, with no framework at all — runtime atomic CSS for a plain-DOM app, a Web Component or another framework.

原始使用文档

@box-kite/core

The Box Kite styling engine, with no framework at all. It generates atomic CSS at runtime and caches every rule by its content, so the same value anywhere in a page reuses one class.

This is the package a plain-DOM app, a Web Component or another framework's adapter installs. Using React? Install @box-kite/react instead — it depends on this and re-exports it, so you get one copy of the engine and the Box component with it.

npm install @box-kite/core
import { createStyleEngine } from '@box-kite/core';

const engine = createStyleEngine();

document.querySelector('#card').className = engine.classNames({
  p: 4,
  bgColor: 'blue-500',
  borderRadius: 2,
  hover: { bgColor: 'blue-600' },
});

That is the whole runtime: no build step, no provider, no effects. Rules reach the document on their own microtask — flushSync() is for reading computed styles in the same tick, and getStyles() for static output with no DOM in the process at all.

Your own props and components

BoxExtends.extend() registers a prop or a value; the types come from the /types entry:

// types.d.ts
import { ExtractBoxStyles } from '@box-kite/core/types';
import { extendedProps } from './myProps';

declare module '@box-kite/core/types' {
  namespace Augmented {
    interface BoxProps extends ExtractBoxStyles<typeof extendedProps> {}
  }
}

@box-kite/core/types is the augmentation target for React projects too — the registry being extended lives here, not in the binding.

MIT

版本与发布记录

@box-kite/core 共发布 27 个版本,首次发布于 2026/08/25;过去 12 个月发布了 27 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.4.0latest2026/11/071 天前
2.3.12026/11/061 天前
2.3.02026/11/044 天前
2.2.182026/11/044 天前
2.2.172026/11/034 天前
2.2.162026/11/035 天前

关于 @box-kite/core 的常见问题

@box-kite/core 是什么?

The Box Kite styling engine, with no framework at all — runtime atomic CSS for a plain-DOM app, a Web Component or another framework.

如何安装 @box-kite/core?

在项目目录运行 npm install @box-kite/core,或使用 pnpm add / yarn add / bun add。

@box-kite/core 支持 TypeScript 吗?

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

@box-kite/core 支持 ESM 还是 CommonJS?

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

@box-kite/core 可以商用吗?

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

@box-kite/core 的下载量有多少?

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

@box-kite/core 还在维护吗?

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