import { HKT } from "./hkt"; import { Pipeable } from "./pipeable"; import { GenericTransformOpScoped } from "./transform"; export declare type TypeBitfield = number; export declare const T_SCOPED = 7; export declare const T_SEED = 2; export declare const T_SOURCE = 4; export declare const T_PROPERTY = 16; export declare const T_STREAM = 32; export declare const T_ATOM = 80; export declare const T_EVENT = 256; export declare const T_SCOPE = 512; export declare const T_VALUE = 4352; export declare const T_END = 8448; export declare function matchFlags(o: any, flags: TypeBitfield): boolean; export declare function isProperty(e: any): e is Property; export declare function isPropertySeed(e: any): e is PropertySeed; export declare function isPropertySource(e: any): e is PropertySource; export declare function isEventStream(e: any): e is EventStream; export declare function isEventStreamSeed(e: any): e is EventStreamSeed; export declare function isEventStreamSource(e: any): e is EventStreamSeed; export declare function isAtom(e: any): e is Atom; export declare function isAtomSeed(e: any): e is AtomSeed; export declare function isAtomSource(e: any): e is AtomSeed; export declare function isObservableSeed, O extends ScopedObservable>(e: any): e is ObservableSeed; export declare type Callback = () => void; export declare type Observer = (value: V) => void; export declare type Subscribe = (onValue: Observer, onEnd?: Observer) => Unsub; export declare type Unsub = Callback; export declare class Description { desc: Desc; constructor(desc: Desc); toString(): string; } export declare type Desc = Description | DescWithContext | MethodDesc | string; export declare type MethodDesc = [string, any[]]; export declare type DescWithContext = [any, string, any[]]; export declare function composeDesc(context: any, methodCall: MethodDesc): DescWithContext; export declare abstract class Event { _L: TypeBitfield; } export declare class Value extends Event { _L: TypeBitfield; value: V; constructor(value: V); } export declare class End extends Event { _L: TypeBitfield; } export declare type EventLike = Event[] | Event | V; export declare function toEvent(value: Event | V): Event; export declare function isEvent(value: any): value is Event; export declare function toEvents(value: EventLike): Event[]; export declare function valueEvent(value: V): Value; export declare function isValue(event: Event): event is Value; export declare function isEnd(event: Event): event is End; export declare const endEvent: End; export declare function valueObserver(observer: Observer): Observer>; export interface ObservableIdentifiers { _L: TypeBitfield; desc: Description; toString(): string; } export interface ForEach { forEach(observer: Observer): Unsub; log(message?: string): Unsub; } export declare type Observable = ObservableIdentifiers & ForEach & { subscribe(onValue: Observer, onEnd?: Observer): Unsub; }; export interface ObservableSeed, O extends ScopedObservable> extends Pipeable, ObservableIdentifiers, ForEach { observableType(): string; consume(): C; applyScope(scope: Scope): O; } export declare type ScopedObservable = Observable & { getScope(): Scope; }; export interface PropertyMethods { get(): V; onChange(onValue: Observer, onEnd?: Observer | undefined): Unsub; } export declare type PropertySource = Observable & PropertySeed & PropertyMethods & HKT> & { observableType(): "PropertySource" | "Property" | "AtomSource" | "Atom"; }; export declare type Property = ScopedObservable & PropertySource & PropertyMethods & HKT> & { observableType(): "Property" | "Atom"; }; export declare type PropertySeed = ObservableSeed, Property> & HKT> & { observableType(): "PropertySeed" | "PropertySource" | "Property" | "AtomSeed" | "AtomSource" | "Atom"; }; export declare type EventStreamSource = Observable & EventStreamSeed & HKT> & { observableType(): "EventStreamSource" | "EventStream" | "Bus"; }; export declare type EventStream = ScopedObservable & EventStreamSource & HKT> & { observableType(): "EventStream" | "Bus"; }; export declare type EventStreamSeed = ObservableSeed, EventStream> & HKT> & { observableType(): "EventStreamSeed" | "EventStreamSource" | "EventStream" | "Bus"; }; export declare type AtomSource = PropertySource & PropertySeed & AtomSeed & HKT> & { observableType(): "AtomSource" | "Atom"; set(updatedValue: V): void; }; export declare type AtomSeed = ObservableSeed, Atom> & HKT> & { observableType(): "AtomSeed" | "AtomSource" | "Atom"; }; export declare type Atom = Property & AtomSource & HKT> & { observableType(): "Atom"; set(newValue: V): void; modify(fn: (old: V) => V): void; }; export interface Bus extends EventStream { push(newValue: V): void; end(): void; } export declare type ScopeFn = (onIn: () => Unsub) => void; export declare type Scope = GenericTransformOpScoped & { _L: typeof T_SCOPE; subscribe: ScopeFn; }; export declare function isScope(x: any): x is Scope; export declare type Function0 = () => R; export declare type Function1 = (t1: T1) => R; export declare type Function2 = (t1: T1, t2: T2) => R; export declare type Function3 = (t1: T1, t2: T2, t3: T3) => R; export declare type Function4 = (t1: T1, t2: T2, t3: T3, t4: T4) => R; export declare type Function5 = (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R; export declare type Function6 = (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R;