HyperFrames 注册表
注册表提供可通过 hyperframes add <name> 安装的可复用块和组件。
- 块 — 独立的子组合(拥有自己的尺寸、时长和时间线)。通过 host 组合中的
data-composition-src引入。 - 组件 — 效果片段(没有自己的尺寸)。直接粘贴到 host 组合的 HTML 中。
何时使用此技能
- 用户提及
hyperframes add、"block"、"component" 或hyperframes.json hyperframes add的输出出现在会话中(文件路径、剪贴板片段)- 你需要将已安装项接入现有组合
- 你想发现注册表中可用的内容
快速参考
hyperframes add data-chart # 安装块
hyperframes add grain-overlay # 安装组件
hyperframes add shimmer-sweep --dir . # 指定目标项目
hyperframes add data-chart --json # 机器可读输出
hyperframes add data-chart --no-clipboard # 跳过剪贴板(CI/无头环境)
安装后,CLI 会输出写入的文件以及要粘贴到 host 组合中的片段。片段是起点 —— 接线块时,你需要添加 data-composition-id(必须匹配块的内部组合 ID)、data-start 和 data-track-index 属性。
注意:hyperframes add 仅适用于块和组件。对于示例,请使用 hyperframes init <dir> --example <name> 替代。
安装位置
块默认安装到 compositions/<name>.html。
组件默认安装到 compositions/components/<name>.html。
这些路径可在 hyperframes.json 中配置:
{
"registry": "https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry",
"paths": {
"blocks": "compositions",
"components": "compositions/components",
"assets": "assets"
}
}
接线块
块是独立组合 —— 通过 host 的 index.html 中的 data-composition-src 引入:
<div
data-composition-id="data-chart"
data-composition-src="compositions/data-chart.html"
data-start="2"
data-duration="15"
data-track-index="1"
data-width="1920"
data-height="1080"
></div>
关键属性:
data-composition-src— 块 HTML 文件的路径data-composition-id— 必须匹配块的内部 IDdata-start— 块在 host 时间线中出现的时间(秒)data-duration— 块播放的时长data-width/data-height— 块画布尺寸data-track-index— 图层顺序(数值越大越靠前)
详见 wiring-blocks.md。
接线组件
组件是片段 —— 将它们的 HTML 粘贴到组合的标记中,CSS 粘贴到样式块中,JS 粘贴到脚本中(如果有的话):
- 读取已安装文件(例如
compositions/components/grain-overlay.html) - 将 HTML 元素复制到你的组合的
<div data-composition-id="...">中 - 将
<style>块复制到你的组合样式中 - 将任何
<script>内容复制到你的组合脚本中(在时间线代码之前) - 如果组件暴露了 GSAP 时间线集成(参见片段中的注释块),将这些调用添加到你的时间线中
发现
浏览可用项:
# 读取注册表清单
curl -s https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry/registry.json
每个项的 registry-item.json 包含:名称、类型、标题、描述、标签、尺寸(仅块)、时长(仅块)和文件列表。
详见 discovery.md 以了解按类型和标签筛选的详细信息。