@lifeart/gxt
Version:
<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">
44 lines (42 loc) • 2.13 kB
TypeScript
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;
export declare class IfCondition {
isDestructorRunning: boolean;
prevComponent: GenericReturnType | null;
condition: MergedCell | Cell<boolean>;
destructors: Destructors;
runNumber: number;
lastValue: boolean;
target: DocumentFragment | HTMLElement;
placeholder: Comment;
throwedError: Error | null;
destroyPromise: Promise<any> | null;
[RENDERED_NODES_PROPERTY]: Array<Node>;
[COMPONENT_ID_PROPERTY]: number;
branchDomNodes: Array<Node>;
trueBranch: (ifContext: IfCondition) => GenericReturnType;
falseBranch: (ifContext: IfCondition) => GenericReturnType;
api: DOMApi;
constructor(parentContext: Component<any>, maybeCondition: Cell<boolean> | IfFunction | MergedCell, target: DocumentFragment | HTMLElement, placeholder: Comment, trueBranch: (ifContext: IfCondition) => GenericReturnType, falseBranch: (ifContext: IfCondition) => GenericReturnType);
checkStatement(value: boolean): true | undefined;
reInit(): Promise<void>;
syncState(value: unknown): void;
renderBranch(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;
destroyBranchSync(): void;
destroyBranch(): Promise<void>;
renderState(nextBranch: (ifContext: IfCondition) => GenericReturnType): void;
destroy(): Promise<void>;
setupCondition(maybeCondition: Cell<boolean> | IfFunction | MergedCell): void;
}