Define Fiber<I> and Effect<I> types in src/host/fiber.ts

This commit is contained in:
2026-05-18 16:43:21 +00:00
parent 614ee05364
commit d472b9f107
3 changed files with 211 additions and 0 deletions

17
src/host/fiber.ts Normal file
View File

@@ -0,0 +1,17 @@
export interface Fiber<I> {
instance: I;
tag: string;
props: Record<string, unknown>;
key: string | undefined;
children: Fiber<I>[];
parent: Fiber<I> | null;
effect: Effect<I> | null;
signalDisposers: (() => void)[];
prevProps: Record<string, unknown> | null;
}
export type Effect<I> =
| { type: "update"; payload: unknown }
| { type: "insert"; before: Fiber<I> | null }
| { type: "move"; before: Fiber<I> | null }
| { type: "remove" };

View File

@@ -19,5 +19,7 @@ export { ValuePointer, selectNode, setNode } from "./core/pointer.js";
export { createRoot as createHostRoot } from "./host/config.js";
export type { HostConfig, Root } from "./host/config.js";
export type { Fiber, Effect } from "./host/fiber.js";
export { TransformRegistry, childCtx, matchesSchema, ctx as transformCtx } from "./transform/registry.js";
export type { TransformContext, TransformFn, TransformRule } from "./transform/registry.js";