组件
组件不是“看起来像一组图层”的任意节点,也不是某个已经运行的 Instance。Flamo Component 是从 Artifact Export 晋升而来的可复用发布单元,具有精确版本身份、公开 surface、依赖闭包、Runtime ABI 与可验证 package hash。
组件公开什么
Section titled “组件公开什么”组件 surface 由四类 W3C 友好的能力组成:
props:声明式输入,可投影为 attribute 或 DOM property;events:向宿主发出的 typed CustomEvent;methods:明确公开的 imperative method;slots:由宿主或父组件提供的内容入口。
内部节点、脚本实现和 child graph 默认私有。需要公开 child 时必须列入 publicChildRefs,避免宿主依赖不稳定的内部层级。
组件依赖使用完整 Component Ref,而不是只靠名称或 alias。resolver 在实例创建前核对 namespace、id、version、Artifact hash、surface hash 与 Runtime ABI;解析失败应在 mutation 前 fail closed,不能静默换到“最接近”的版本。
组件从哪里来
Section titled “组件从哪里来”- Figma 中的 Component、Component Set 或显式标记的 boundary 可以生成 Artifact Export;
- Artifact authoring 可以定义 component/export operation;
- TS/JS 可以用
defineFlamoComponent()组合 exact refs 并编译为新 Artifact; - verify、package、promote 后才成为可跨项目解析的 Component Release。
Copyright (c) 2025-present [email protected]