@bpmn-io/feel-editor

中文文档
2.8.1发布于 2026/10/28MITES Module近 30 天下载 36.9万

Editor for FEEL expressions.

原始使用文档
文档目录6 节
  1. Usage
  2. Variables
  3. Content attributes
  4. Events
  5. Hacking the Project
  6. License

@bpmn-io/feel-editor

Embeddable Editor for FEEL expressions.

Usage

To get started, create a feel-editor instance:

import FeelEditor from '@bpmn-io/feel-editor';

const editor = new FeelEditor({
  container
});

Configure the FEEL dialect (expression or unary tests):

const editor = new FeelEditor({
  container,
  dialect: 'unaryTests' // defaults to 'expression'
});

You can provide a starting document and listen for changes:

const editor = new FeelEditor({
  container,
  onChange,
  onKeyDown,
  onLint,
  value
});

Variables

You can provide a variables array that will be used for auto completion. Nested structures are supported. The Variables need to be in the following format:

const editor = new FeelEditor({
  container,
  variables: [
    {
      name: 'variablename to match',
      detail: 'optional inline info',
      info: 'optional pop-out info',
      entries: [
        {
          name: 'nested variable',
          ...
        }
      ]
    }
  ]
});

The variables can be updated on the instance via FeelEditor#setVariables():

editor.setVariables([
  {
    name: 'newName',
    detail: 'new variable inline info',
    info: 'new pop-out info'
  }
]);

Content attributes

You can provide attributes which will be set on the content editable div:

const editor = new FeelEditor({
  container,
  contentAttributes: {
    'aria-label': 'Expression editor'
  }
});

Events

You can listen to events fired by the editor:

const editor = new FeelEditor({
  container
});

editor.on('lint', ({ diagnostics }) => console.log(diagnostics));

Hacking the Project

To get the development setup make sure to have NodeJS installed. As soon as you are set up, clone the project and execute

npm install
npm start

License

MIT

版本与发布记录

@bpmn-io/feel-editor 共发布 45 个版本,首次发布于 2022/06/14;过去 12 个月发布了 14 个版本。

版本发布日期距今
2.8.1latest2026/10/2811 天前
2.8.02026/09/141 个月前
2.7.12026/08/212 个月前
2.7.02026/08/132 个月前
2.6.02026/06/184 个月前
2.5.22026/03/058 个月前

其他发布通道:exp → 0.0.1-alpha0。

关于 @bpmn-io/feel-editor 的常见问题

@bpmn-io/feel-editor 是什么?

Editor for FEEL expressions.

如何安装 @bpmn-io/feel-editor?

在项目目录运行 npm install @bpmn-io/feel-editor,或使用 pnpm add / yarn add / bun add。

@bpmn-io/feel-editor 支持 TypeScript 吗?

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

@bpmn-io/feel-editor 支持 ESM 还是 CommonJS?

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

@bpmn-io/feel-editor 可以商用吗?

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

@bpmn-io/feel-editor 的下载量有多少?

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

@bpmn-io/feel-editor 还在维护吗?

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