@fiscozen/alert

中文文档
3.0.7发布于 2026/09/29MITES Module近 30 天下载 4061

Design System Alert component

原始使用文档
文档目录7 节
  1. Development
  2. Setup
  3. Architecture
  4. Code organization
  5. Key concepts
  6. Testing
  7. Build

@fiscozen/alert

Alert component: callout for timely information (info, error, warning, success, danger).

For usage documentation and examples, see Storybook Documentation – Messages / FzAlert.

Development

Setup

From the repo root: install dependencies with pnpm install. Run unit tests with pnpm --filter @fiscozen/alert test:unit. Run Storybook from the repo root to try the component.

Architecture

  • Variants: background (always expanded, optional title and actions), accordion (collapsible), text (description only, no title/actions/dismiss, transparent background, tone ignored).
  • Tone: Drives icon, background and border for background and accordion; ignored for text (transparent background; icon still reflects tone for semantics).
  • Environment: frontoffice (default) vs backoffice. Affects padding (p-12 vs p-6) and is passed to FzButton / FzIconButton. For variant text + environment: 'backoffice', the leading icon uses size sm; otherwise md.

Code organization

  • src/FzAlert.vue: main component; computed safeVariant, safeEnvironment, isTextVariant, iconSize, containerClass, etc.
  • src/types.ts: AlertProps, AlertVariant; deprecated props alertStyle, size.
  • src/index.ts: exports component and types.

Key concepts

Text variant: No title, no button/link actions, not collapsible, not dismissible. Container uses bg-transparent (tone-based background and border are not applied). Icon size is sm when environment === 'backoffice', md otherwise (iconSize computed).

Environment and padding: Root div gets p-6 only in backoffice. Inner FzContainer uses p-6 (backoffice) or p-12 (frontoffice).

Testing

  • Unit tests: pnpm --filter @fiscozen/alert test:unit (or test:unit --run -u to update snapshots).
  • Tests cover rendering, props (all variants including text), events, CSS classes, accessibility expectations, edge cases, and snapshots (including text and text + backoffice).

Build

  • pnpm --filter @fiscozen/alert build: runs vue-tsc and vite build.

版本与发布记录

@fiscozen/alert 共发布 17 个版本,首次发布于 2024/06/21;过去 12 个月发布了 12 个版本。

版本发布日期距今
3.0.7latest2026/09/291 个月前
3.0.62026/09/072 个月前
3.0.52026/07/173 个月前
3.0.42026/06/154 个月前
3.0.32026/06/105 个月前
3.0.22026/06/095 个月前

关于 @fiscozen/alert 的常见问题

@fiscozen/alert 是什么?

Design System Alert component

如何安装 @fiscozen/alert?

在项目目录运行 npm install @fiscozen/alert,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.4.13)、vue-router(^4.3.0)、tailwindcss(^3.4.1)、@fiscozen/icons(^1.0.8)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fiscozen/alert 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fiscozen__alert 是否存在。

@fiscozen/alert 支持 ESM 还是 CommonJS?

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

@fiscozen/alert 可以商用吗?

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

@fiscozen/alert 的下载量有多少?

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

@fiscozen/alert 还在维护吗?

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