import { Component } from '../component-class'; import { DOMApi, GenericReturnType } from '../types'; import { Destructors } from '../glimmer/destroyable'; import { Cell, MergedCell } from '../reactive'; import { RENDERED_NODES_PROPERTY, COMPONENT_ID_PROPERTY } from '../shared'; export type IfFunction = () => boolean; declare const BLOCK_WRAPPER_SYMBOL: unique symbol; export declare class IfCondition { isDestructorRunning: boolean; prevComponent: GenericReturnType | null; condition: MergedCell | Cell; destructors: Destructors; runNumber: number; lastValue: boolean; target: DocumentFragment | HTMLElement; placeholder: Comment; throwedError: Error | null; destroyPromise: Promise | null; [RENDERED_NODES_PROPERTY]: Array; [COMPONENT_ID_PROPERTY]: number; [BLOCK_WRAPPER_SYMBOL]: boolean; branchDomNodes: Array; currentBranchCtx: object | null; trueBranch: (ifContext: IfCondition) => GenericReturnType; falseBranch: (ifContext: IfCondition) => GenericReturnType; _treeParent: Component | null; api: DOMApi; constructor(parentContext: Component, maybeCondition: Cell | IfFunction | MergedCell, target: DocumentFragment | HTMLElement, placeholder: Comment, trueBranch: (ifContext: IfCondition) => GenericReturnType, falseBranch: (ifContext: IfCondition) => GenericReturnType); checkStatement(value: boolean): true | undefined; reInit(): Promise; syncState(value: unknown): void; renderBranch(nextBranch: (ifContext: IfCondition) => GenericReturnType, runNumber: number): void; /** * Synchronous-destroy branch swap used under Ember integration (the * `WITH_EMBER_INTEGRATION` branch of `renderBranch`). Extracted into its own * method so the epoch recheck can be unit-tested directly — `renderBranch`'s * gate folds to `false` in the standalone test build, making the inline path * unreachable from `syncState` there. * * Re-check the epoch between destroy and render: a destructor (or any side * effect of `destroyBranchSync`) can synchronously flip the condition again and * re-enter `syncState`, advancing `runNumber`. Without the recheck the outer * (now-stale) call would still proceed to render its branch, clobbering the * inner (newer) render. The async sibling path uses the same guard. */ renderBranchSyncHost(nextBranch: (ifContext: IfCondition) => GenericReturnType, runNumber: number): void; validateEpoch(runNumber: number): boolean; /** * Remove any DOM nodes that the previous branch render inserted between * its first node and the IfCondition placeholder. Used as a fallback for * branches whose render function does not thread results back through * `prevComponent` (e.g. yield-only true branches in slot mode). */ removeOrphanBranchDom(): void; /** * Fire the OUTGOING branch's per-branch ctx destructors (those the host * registered from the `onConditionBranchSwap` hook) and clear the slot. Called * at the START of `destroyBranchSync`/`destroyBranch`, i.e. BEFORE the outgoing * branch's DOM is removed, so a host destructor runs while the element is * still connected — mirroring `list.ts`'s `destroyRowCtx` ordering. * * Zero-cost when no host hook is installed: `currentBranchCtx` is only ever * assigned in `renderState` under the `onConditionBranchSwap` presence gate, so * it stays `null` and this is a single null-check. Idempotent (nulls the slot; * `destroySync` itself guards against double-destroy). */ teardownBranchCtx(): void; destroyBranchSync(): void; destroyBranch(): Promise; renderState(nextBranch: (ifContext: IfCondition) => GenericReturnType): void; destroy(): Promise; setupCondition(maybeCondition: Cell | IfFunction | MergedCell): void; } export {};