@figspec/components

中文文档
2.1.0发布于 2026/01/14MITTypeScriptES Module零依赖近 30 天下载 1091.2万

非官方 Figma spec 查看器:活出嵌入的 Kit - Live + Guideline + 检查器

中文使用文档
文档目录4 节
  1. 安装
  2. 使用量
  3. 浏览器支持
  4. 相关软件包

@ figspec/ 组件

npm version docs HTML (with demo)

@figspec/components 是一组自定义元素, 它可以使 Figma 文件/ 框架 并显示 Figma 的编辑器类检查器 .

这些组件旨在对Figma REST API结果开展工作. 此库没有提供引用 Figma REST API 端点的功能 .

安装

$ npm i @figspec/components

此库不提供捆绑的脚本 。 请自行使用CDN或捆绑.

使用量

导入条目脚本( E)import '@figspec/components'它会记录我们的定制元素. 现在你可以用这些 在你的页面.

<body>
  <figspec-frame-viewer id="figma_frame"></figspec-frame-viewer>
</body>
// your script.js
import "@figspec/components";

const figmaFrame = document.getElementById("figma_frame")

figmaFrame.apiResponse = /* ... */;
figmaFrame.renderedImage = /* ... */;

要显示整个图像文件, 请使用 <figspec-file-viewer> 换句话说.

<body>
  <figspec-file-viewer id="figma_file"></figspec-file-viewer>
</body>
// your script.js
import "@figspec/components";

const figmaFile = document.getElementById("figma_file")

figmaFrame.apiResponse = /* ... */;
figmaFrame.renderedImages = /* ... */;

请检查url=值 (帮助) 文档网站。 。 。 .

浏览器支持

这个库用于浏览器执行WebComponents v1 spec和ES2019. 捆绑的文件在 esm/es2019。 。 。 .

版本与发布记录

@figspec/components 共发布 20 个版本,首次发布于 2020/12/26;过去 12 个月发布了 2 个版本。

版本发布日期距今
2.1.0latest2026/01/149 个月前
2.0.52025/11/2411 个月前
2.0.42024/02/272 年前
2.0.32024/01/052 年前
1.0.32024/01/052 年前
2.0.22023/09/123 年前

关于 @figspec/components 的常见问题

@figspec/components 是什么?

非官方 Figma spec 查看器:活出嵌入的 Kit - Live + Guideline + 检查器

如何安装 @figspec/components?

在项目目录运行 npm install @figspec/components,或使用 pnpm add / yarn add / bun add。

@figspec/components 支持 TypeScript 吗?

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

@figspec/components 支持 ESM 还是 CommonJS?

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

@figspec/components 可以商用吗?

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

@figspec/components 的下载量有多少?

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

@figspec/components 还在维护吗?

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