@freightos/freightwind

中文文档
2.4.0发布于 2026/11/09MITTypeScriptESM + CJS近 30 天下载 2775

FreightWind Design System — icons, constants, and utilities for Freightos applications

原始使用文档
文档目录6 节
  1. Installation
  2. Usage
  3. Host isolation (WebCargo)
  4. MCP Apps ( @freightos/freightwind/mcp-app )
  5. Peer Dependencies
  6. License

@freightos/freightwind

FreightWind Design System — React UI components for Freightos applications.

Installation

npm install @freightos/freightwind @freightos/freightwind/icons

Usage

import { Button, Alert, Badge } from '@freightos/freightwind';
import '@freightos/freightwind/tokens.css';

Components require Tailwind CSS v4 with the FDS design tokens loaded via tokens.css.

Host isolation (WebCargo)

When mounting FreightWind inside the WebCargo host, also import the WebCargo isolation sheet and wrap your App in a .fw-root element:

import '@freightos/freightwind/tokens.css';
import '@freightos/freightwind/host-isolation/webcargo.css';

<div className="fw-root">
  <App />
</div>

The sheet ports Tailwind's standard Preflight scoped to .fw-root via :where() (zero added specificity), plus a focus-bleed cancellation keyed on the .fw-base per-element marker so it covers FW components rendered inside Radix portals (Dialog / Popover / Tooltip / DropdownMenu / Select). It exists solely to neutralize WebCargo's Bootstrap-style host CSS that targets bare element selectors (h1-h6 { margin-bottom: .5rem }, button { border-radius: 0 }, button:focus { outline: 5px auto … }, …) — it does NOT impose FW-specific styling, so it never drifts from FW design tokens.

Skip this file when consuming FreightWind in a clean host (Vite playground, greenfield Next.js apps, partner sites without Bootstrap) — there is no host CSS to fight there.

MCP Apps (@freightos/freightwind/mcp-app)

Render a FreightWind surface as an interactive card inside AI chats (Claude, ChatGPT) via the MCP Apps standard. useMcpApp connects to the host, mirrors its theme (.dark) and language (dir/lang), hands you the tool result, and stops an older card from sending once a newer one replaces it.

import { useMcpApp } from '@freightos/freightwind/mcp-app';

function Card() {
  const { data, isSuperseded, updateModelContext, sendMessage } = useMcpApp<MyData>({
    appInfo: { name: 'my-card', version: '1.0.0' },
    supersessionChannel: 'my-app:show_thing',
    instanceKeyOf: (d) => ({ issuedAt: d.issuedAt, seq: d.seq }),
  });
  // updateModelContext(text) informs the model quietly; sendMessage(text) posts to the chat.
}

Install the optional peers to use it: @modelcontextprotocol/ext-apps (>= 1.7.5 < 2) and @modelcontextprotocol/sdk (^1.29). The subpath is ESM-only, like ext-apps itself. Supersession uses a BroadcastChannel, so a newer card in another open chat also marks older ones outdated. Full guide: FreightWind docs → AI → MCP Apps.

Peer Dependencies

  • react >= 18
  • react-dom >= 18
  • @freightos/freightwind/icons >= 1.0.0
  • @modelcontextprotocol/ext-apps >= 1.7.5 < 2 and @modelcontextprotocol/sdk ^1.29 (optional, for /mcp-app only)

License

MIT

版本与发布记录

@freightos/freightwind 共发布 26 个版本,首次发布于 2026/01/15;过去 12 个月发布了 26 个版本。

版本发布日期距今
2.4.0latest2026/11/096 天前
2.3.22026/11/0312 天前
2.3.12026/10/2917 天前
2.3.02026/09/281 个月前
2.2.52026/08/162 个月前
2.2.42026/07/124 个月前

其他发布通道:host-isolation → 2.1.3-host-isolation.3。

关于 @freightos/freightwind 的常见问题

@freightos/freightwind 是什么?

FreightWind Design System — icons, constants, and utilities for Freightos applications

如何安装 @freightos/freightwind?

在项目目录运行 npm install @freightos/freightwind,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、react-dom(>=18)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@freightos/freightwind 支持 TypeScript 吗?

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

@freightos/freightwind 支持 ESM 还是 CommonJS?

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

@freightos/freightwind 可以商用吗?

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

@freightos/freightwind 的下载量有多少?

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

@freightos/freightwind 还在维护吗?

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