@editframe/react

中文文档
0.60.37发布于 2026/10/31SEE LICENSE IN LICENSE-FULL.mdTypeScriptES Module近 30 天下载 6390

First-class React wrappers + hooks for @editframe/elements.

原始使用文档

@editframe/react

React bindings for Editframe Elements.

Install

npm install @editframe/react

React 18 or later and react-dom are required. Importing the bindings also registers the Elements custom elements.

Composition props

Wrappers accept the underlying element's JavaScript properties, plus standard React props such as children, className, style, and ref. Use playbackRate for source speed and pass volumeAtTime as a function:

import { Configuration, Text, Timegroup, TimelineRoot, Video } from "@editframe/react";

const fade = (localTime: number) =>
  Math.max(0, Math.min(1, localTime / 0.25, (4 - localTime) / 0.25));

function Cut({ id }: { id: string }) {
  return (
    <Timegroup id={id} mode="fixed" duration="4s"
      style={{ position: "relative", width: 640, height: 360 }}>
      <Video src="/take.mp4" sourcein="2s" sourceout="10s"
        playbackRate={2} volume={0.8} volumeAtTime={fade}
        style={{ width: "100%", height: "100%" }} />
      <Text duration="4s"
        style={{ position: "absolute", top: 24, left: 24, lineHeight: 1.15 }}>
        A four-second cut
      </Text>
    </Timegroup>
  );
}

export function Composition() {
  return (
    <Configuration>
      <TimelineRoot id="cut" component={Cut} />
    </Configuration>
  );
}

This consumes eight source seconds in four composition seconds, preserving audio pitch. Supported playbackRate values are 0.25 through 4, with 1 as the default. Invalid property assignments throw RangeError. volumeAtTime receives clip-local composition seconds and returns a multiplier of volume from 0 to 1. The envelope is evaluated per audio sample during export. See the Elements README for trim rules and a render-clone export example.

TimelineRoot registers a React remount for exports and thumbnails, so React hooks and frame callbacks run in the render clone. Its component must render a Timegroup as its root. For playback, attach the mounted timegroup with an EFConfigurationElement ref's attachPlayback(root); Configuration alone does not attach a controller. A Workbench wrapper can attach playback automatically.

Configuration and Text accept ordinary JSX props and typed element refs directly in 0.60.34; no app-side re-typing is needed. Custom event handlers, such as Video's onReadyStateChange, retain their component-specific event types. Other element properties are accepted by name rather than individually type-checked; consult the underlying Elements class for the supported values.

See the documentation and the composition skill for more usage.

版本与发布记录

@editframe/react 共发布 345 个版本,首次发布于 2023/03/16;过去 12 个月发布了 212 个版本。

版本发布日期距今
0.60.37latest2026/10/3113 天前
0.60.362026/10/3113 天前
0.60.342026/10/1727 天前
0.60.332026/10/131 个月前
0.60.312026/10/091 个月前
0.60.302026/10/091 个月前

其他发布通道:beta → 0.59.0-beta.25。

关于 @editframe/react 的常见问题

@editframe/react 是什么?

First-class React wrappers + hooks for @editframe/elements.

如何安装 @editframe/react?

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

@editframe/react 支持 TypeScript 吗?

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

@editframe/react 支持 ESM 还是 CommonJS?

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

@editframe/react 可以商用吗?

@editframe/react 使用 SEE LICENSE IN LICENSE-FULL.md 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@editframe/react 的下载量有多少?

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

@editframe/react 还在维护吗?

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