@codaco/fresco-ui

中文文档
8.1.0发布于 2026/10/21MITTypeScriptES Module构建来源已验证近 30 天下载 3768

Fresco UI components, styles, and utilities

原始使用文档
文档目录3 节
  1. Install
  2. Tailwind / CSS setup
  3. Public API surface

@codaco/fresco-ui

Fresco UI components, styles, and utilities. See docs/superpowers/specs/2026-04-29-fresco-ui-package-design.md for the design spec and docs/superpowers/plans/2026-04-29-fresco-ui-package.md for the implementation plan.


Install

pnpm add @codaco/fresco-ui

Peer dependencies (you most likely already have these):

{
  "@base-ui/react": "^1.4.0",
  "@codaco/shared-consts": "5.0.0",
  "@codaco/tailwind-config": "^1.0.0-alpha.11",
  "immer": "^11.1.4",
  "motion": "^12.38.0",
  "react": "^19.2.5",
  "react-dom": "^19.2.5",
  "tailwindcss": "^4.2.4",
  "zod": "^4.1.13",
  "zustand": "^5.0.12",
}

Tailwind / CSS setup

The package assumes the host has a Tailwind v4 build plugin wired up (@tailwindcss/vite for Vite, @tailwindcss/postcss for Next.js / any PostCSS pipeline). Each CSS file in the chain owns one concern, and consumers import them in order:

/* styles/globals.css */
@import '@codaco/tailwind-config/fresco.css'; /* Tailwind v4 + theme + plugins + fonts */
@import '@codaco/fresco-ui/styles.css'; /* @source for fresco-ui's dist */

If you also use @codaco/interview, add its CSS file too — see that package's README:

@import '@codaco/interview/styles.css';

Do not also @import "tailwindcss" yourself. That import lives inside @codaco/tailwind-config/fresco.css; adding it again loads Tailwind's runtime twice and produces duplicate / conflicting utilities.

@codaco/fresco-ui/styles.css is intentionally tiny — its only content is a single @source "./**/*.{js,ts,tsx}" directive that tells Tailwind v4's class scanner to walk the package's compiled JS in dist/ so it emits the utility classes the components reference. It does not re-export the design-system foundation, so the tailwind-config import is not optional.

@codaco/tailwind-config/fresco.css bundles the default and interview theme variants together with self-hosted Nunito and Inclusive Sans woff2 files.

The interview theme is activated by the data-theme-interview attribute. Hosts typically apply it via the <ThemedRegion theme="interview"> component (exported from @codaco/fresco-ui/ThemedRegion), which also wires up a <PortalContainerProvider> so dialogs, popovers, dropdowns, tooltips, toasts, selects, and comboboxes portal into a node inside the themed subtree (and therefore inherit the theme's CSS variables) instead of into document.body.

Containing-block constraint: the <ThemedRegion> element and its ancestors up to <body> must not have transform, filter, perspective, or contain set. Any of these creates a new containing block for fixed-positioned descendants, which would break modal/popover positioning. If you cannot satisfy this constraint, fall back to applying data-theme-interview higher in the tree (e.g. <body>).

Public API surface

The exports field in package.json is an explicit allowlist. Add new entries there when shipping new modules. Internals (collection/store, button-constants, etc.) are intentionally excluded — anything not listed in exports is package-private even if Vite compiles it into dist.

版本与发布记录

@codaco/fresco-ui 共发布 53 个版本,首次发布于 2026/05/01;过去 12 个月发布了 53 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.1.0latest2026/10/2119 天前
8.0.02026/10/1327 天前
7.0.02026/09/291 个月前
6.4.02026/09/022 个月前
6.2.02026/09/012 个月前
6.1.02026/08/312 个月前

其他发布通道:next → 0.1.0-next.2。

关于 @codaco/fresco-ui 的常见问题

@codaco/fresco-ui 是什么?

Fresco UI components, styles, and utilities

如何安装 @codaco/fresco-ui?

在项目目录运行 npm install @codaco/fresco-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:zod(^4.6.5)、react(^19.3.0)、motion(^13.4.6)、zustand(^5.0.15)、react-dom(^19.3.0)、tailwindcss(^4.3.3)、@base-ui/react(^1.4.0)、@codaco/app-i18n(^0.3.0)、@codaco/shared-consts(^6.3.0)、@tanstack/react-table(^9.2.4)、@codaco/tailwind-config(^1.5.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@codaco/fresco-ui 支持 TypeScript 吗?

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

@codaco/fresco-ui 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@codaco/fresco-ui 可以商用吗?

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

@codaco/fresco-ui 的下载量有多少?

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

@codaco/fresco-ui 还在维护吗?

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