import type { App } from "../App.js"; import { IValueConverter } from "./IValueConverter.js"; import { CancelToken } from "./types.js"; export interface IAtomComponent { element: any; viewModel: any; localViewModel: any; data: any; app: App; runAfterInit(f: () => void): void; setLocalValue(e: any, name: string, value: any): void; bindEvent(e: any, name: string, handler: any): any; bind(e: any, name: string, path: any, twoWays: boolean, converter: any, source?: any): any; } /** * Bindings needs to be cloned... */ export type bindingFunction = (control: T, e?: any) => any; export type asyncBindingFunction = (control: T, e: any, cancelToken: CancelToken) => Promise; export type bindingFunctionCommand = (control: T, e?: any) => (p: any) => void; export interface IData extends IAtomComponent { data: T; } export interface IVM extends IAtomComponent { viewModel: T; } export interface ILVM extends IAtomComponent { localViewModel: T; } export interface IBinder { presenter(name?: string): Bind; event(handler: (control: T, e?: CustomEvent) => void): any; /** * Bind the expression one time * @param path Lambda Expression for binding * @param now Default value to set immediately */ oneTime(path: bindingFunction, now?: any): Bind; /** * Bind the expression one way * @param path Lambda Expression for binding * @param now Default value to set immediately */ oneWay(path: bindingFunction, now?: any): Bind; /** * Setup two way binding with given expression * @param path Lambda Expression for binding * @param events events on auto refresh */ twoWays(path: bindingFunction, events?: string[]): Bind; onCreate(fx: (control: T, e: HTMLElement, creator: any) => void): Bind; } export declare const bindSymbol: unique symbol; export default class Bind { readonly setupFunction: ((name: string, b: Bind, c: IAtomComponent, e: any, self?: any) => void); readonly name?: string; readonly eventList?: string[]; static forControl(): IBinder; static forData(): IBinder>; static forViewModel(): IBinder>; static forLocalViewModel(): IBinder>; static onCreate(fx: (c: IAtomComponent, e: HTMLElement, n: string) => void): { [bindSymbol](cn: string, control: IAtomComponent, e: any, creator: any): void; }; static presenter(name?: string | ((c: any) => any)): any; static event(sourcePath: (control: T, e?: CustomEvent) => void): any; /** * Bind the expression one time * @param sourcePath Lambda Expression for binding * @param now Default value to set immediately */ static oneTime(sourcePath: bindingFunction, now?: any): any; /** * Bind the expression one time * @param sourcePath Lambda Expression for binding * @param now Default value to set immediately */ static oneTimeAsync(sourcePath: asyncBindingFunction, now?: any): Promise; /** * Bind the expression one way with source, you cannot reference * `this` inside this context, it will not watch `this` * @param source source to watch * @param path Lambda Expression for binding * @param now Default value to set immediately */ static source(source: T, path: (x: { control: IAtomComponent; source: T; }) => any, now?: any): any; static oneWayAsync(sourcePath: asyncBindingFunction, { watchDelayInMS, default: defaultValue }?: { watchDelayInMS?: number; default?: any; }): Promise; /** * Bind the expression one way * @param sourcePath Lambda Expression for binding * @param now Default value to set immediately */ static oneWay(sourcePath: bindingFunction, now?: any): any; /** * Setup two way binding with given expression * @param sourcePath Lambda Expression for binding * @param events events on auto refresh * @param converter IValueConverter for value conversion */ static twoWays(sourcePath: bindingFunction, events?: string[], converter?: IValueConverter): any; /** * Bind the expression one way with source, you cannot reference * `this` inside this context, it will not watch `this` * @param source source to watch * @param path Lambda Expression for binding * @param now Default value to set immediately */ static sourceTwoWays(source: T, path: (x: { control: IAtomComponent; source: T; }) => any, events?: string[]): any; /** * Use this for HTML only, this will fire two way binding * as soon as the input/textarea box is updated * @param sourcePath binding lambda expression * @param converter Optional value converter */ static twoWaysImmediate(sourcePath: bindingFunction, converter?: IValueConverter): any; readonly sourcePath: bindingFunction; readonly pathList: string[][]; readonly thisPathList: string[][]; readonly combined: string[][]; constructor(setupFunction: ((name: string, b: Bind, c: IAtomComponent, e: any, self?: any) => void), sourcePath: bindingFunction, name?: string, eventList?: string[]); } //# sourceMappingURL=Bind.d.ts.map