/** * What a component owns and what a plain `def` may not: the `using` a * construction section has no scope to release at, the component element a * helper answers with but cannot build, and the reactive declaration that makes * a markup helper a component in a function's clothes. * * D115 P4 R3c. The three are one module because each of them is the same * question asked from a different side — who owns the value this position * produces — and each answers it from the component depths. */ import { type Statement } from "@velarscript/compiler/extension"; import { type ComponentAnalysisHost } from "./host.ts"; type FunctionDeclaration = Extract; /** * D43 item 69: a component body is a construction section, not a scope with * an exit — its resources live until unmount. Ownership belongs to the * lifecycle hook or to a function inside the component, so the setup section * says so instead of releasing at the wrong moment. * * Null means this position has nothing of its own to say, and the base * analyzer's own answer stands. */ export declare function ownershipScopeRejection(host: ComponentAnalysisHost): string | null; /** * P2b-5: a `def` that answers markup and answers it with a component element. * * Everything about the shape is legal one step out. A component element is a * legal module-level expression — `const root = ` is the instantiation * site D90 R4-b rules on, and `mount` takes exactly the instance it evaluates * to. A `def` answering markup is a legal markup helper — dispatch over a * closed vocabulary is what the P2b wave was writing. The defect is only * where the two meet, and it is a representation split the type does not * carry: a component element in a *child* position lowers to `__velarChild`, * which owns a scope and answers a DOM node, while the same element standing * alone lowers to `__velarInstantiate`, which answers an instance. Both are * typed `WebNode`; only one is one. Returned from a helper and handed to a * render, the instance reaches `__velarAppend` and takes the whole subtree * down with "JSX can render only text, finite numbers, bool, enums, WebNode * values, and Lists of those values" — the check-green, runtime-dead shape. * * The walk stops at every JSX element, which is exactly where the emitter * stops: inside one, every position is a child position and every component * element there is already correct — `return
` and an * interpolated `{cond ? : ...}` both work today and must keep * working. Only a component element the returned markup *starts* with is the * defect, including one reached through a `.map(...)` answering a row per * item, which fails the same way for the same reason. */ export declare function rejectUnownedComponentElement(host: ComponentAnalysisHost, statement: FunctionDeclaration): void; /** * The audit's seventh root cause: a `def` that declares reactive state and * answers `WebNode` is a component wearing a function's clothes, and calling * it bypasses exactly what the charter already refuses `View(...)` for. Two * things follow from the call, both reproduced: every call runs the `state` * declaration again, so the value resets on every re-render; and the * observers the returned markup registers bind to whatever scope the call * site was building — at module scope the global one, which is never * destroyed, so they are never cleaned up. * * Only DECLARATION is refused. A `def -> WebNode` that merely reads state or a * prop is a legitimate markup helper — examples/app has two — and a `def` * nested inside a component binds its observers to that component's scope, so * nothing about reading is defective. * * What answers "this `def` returns markup" is the sink, not one spelling of * it: `-> WebNode?` and `-> List` are the shapes markup travels in, * and a `def` may carry no return type at all — all three reached the same * defect with the same body while only the bare annotation was read. */ export declare function rejectStatefulWebNodeFunction(host: ComponentAnalysisHost, statement: FunctionDeclaration): void; export {}; //# sourceMappingURL=ownership.d.ts.map