ETAF Manual

Emacs Text Application Framework

Draft — 初版框架。已具备核心能力,持续演进中。

ETAF Manual

ETAF(Emacs Text Application Framework)是构建在独立 Ebox 布局/渲染引擎之上的小型 Emacs 文本应用框架。它用公共 Component 契约把 View、Renderer、Ebox Node 和 Emacs buffer 连接起来。

1 Overview

ETAF 的输出表面是 Emacs buffer。Ebox 是独立的布局/渲染引擎, ETAF 则在它之上组织 Component、View、Runtime 和相关边界。 本页是手册首页的第一版纵向切片,优先保存准确术语、稳定锚点和可扩写结构。

当前状态应理解为“已具备核心能力,持续演进中”。本站不声明稳定发布、 完整生态、版本号、安装命令、源码入口或社区入口;这些信息确认后再补入手册。

Scope of this manual page
项目 说明
名称 ETAF, Emacs Text Application Framework
底层基础 Ebox, 独立布局/渲染引擎
输出表面 Emacs buffer

2 Core concepts

ETAF 公开模型是:

Component(props, Scope) -> View -> Renderer -> Ebox Node -> Emacs buffer

2.1 Model terms

Component
通过 props 和 Scope 生成 View 的边界。
Scope
承载 retained identity、lifecycle 和响应式 primitive 等运行时上下文。
View
公共 View 契约描述的可见结构。
Renderer
把 View 转为 Ebox Node 的公开渲染边界。
Ebox Node
Ebox 布局/渲染引擎理解的节点结构。
Emacs buffer
最终呈现表面;它不是浏览器 DOM,也不是终端输出伪装。

2.2 View syntax

所有可见结构都采用 (name :property value ... child ...)etaf-view 是唯一公共 View 构造入口。子节点计算桥接为 expr :value,属性值是普通 Elisp 表达式。

2.3 Runtime and ownership

核心契约强调每项能力一个 owner;render 只读;状态更新发生在 Event、Action、effect、Data、Resource 等边界。失败候选渲染不得替换上一次已经提交的 buffer。 当前 core 不引入通用 Promise/Task 层,也不直接加载 .etaf

现有 core 包括 View/Component/Runtime、retained identity 与 lifecycle、 ref/computed/watch/effect、Context/Theme、Event/Action/Behavior/focus、 Data Controller、同步 Resource/error boundary、Grid Host、公开 Ebox renderer 边界,以及 observer-based performance recorder。

3 A small example

下列 Emacs Lisp 片段明确标注为示意:它只展示手册里的代码排版区域和公开 View 形状,不声明为可直接运行的 ETAF API 示例。可执行示例以 core README 中的 retained counter、Data Controller 和 Resource health 为准。

;; 示意:展示 View 形状和代码排版,不作为可执行 API 承诺。
(etaf-view
 '(panel :title "Health"
   (text :value "Resource status")
   (expr :value status-line)))

未来如果引入 SFC/compiler,它也只能 lower 到同一公共 Component 契约; 本页不把未来形式写成当前 runtime loader。

4 Reading and next steps

独立同级生态包括 etaf-uietaf-sqliteetaf-playgroundebox-playground。 这些是可选包,core facade 不自动加载它们。

Ecosystem boundary
名称 边界
etaf-ui 官方 Component 目录,待在手册中补充入口。
etaf-sqlite SQLite Data Source,待在手册中补充入口。
etaf-playground 可选 playground,入口后续公布。
ebox-playground Ebox 同级 playground,入口后续公布。

事实来源以 ETAF repo 中的 README.zh-CN.mddocs/architecture.zh.mddocs/user-guide.zh.mddocs/implementation-plan.zh.mdexamples/README.zh-CN.md 为准。公开链接、安装命令和版本信息待补充。

Index

第一版索引只列出本页已经出现的术语。未确认的外部入口不在这里渲染为链接。