declare let _$_: { new (): {}; } & typeof globalThis; declare class $ extends _$_ { } declare namespace $ { export type $ = typeof $$; export class $$ extends $ { static $: $; } namespace $$ { type $$ = $; } export {}; } declare namespace $ { /** Generates unique identifier. */ function $mol_guid(length?: number, exists?: (id: string) => boolean): string; } declare namespace $ { function $mol_fail(error: any): never; } declare namespace $ { /** Special status statuses. */ enum $mol_wire_cursor { /** Update required. */ stale = -1, /** Some of (transitive) pub update required. */ doubt = -2, /** Actual state but may be dropped. */ fresh = -3, /** State will never be changed. */ final = -4 } } declare namespace $ { /** * Collects subscribers in compact array. 28B */ class $mol_wire_pub extends Object { constructor(id?: string); [Symbol.toStringTag]: string; data: unknown[]; static get [Symbol.species](): ArrayConstructor; /** * Index of first subscriber. */ protected sub_from: number; /** * All current subscribers. */ get sub_list(): readonly $mol_wire_sub[]; /** * Has any subscribers or not. */ get sub_empty(): boolean; /** * Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe. */ sub_on(sub: $mol_wire_pub, pub_pos: number): number; /** * Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`. */ sub_off(sub_pos: number): void; /** * Called when last sub was unsubscribed. **/ reap(): void; /** * Autowire this publisher with current subscriber. **/ promote(): void; /** * Enforce actualization. Should not throw errors. */ fresh(): void; /** * Allow to put data to caches in the subtree. */ complete(): void; get incompleted(): boolean; /** * Notify subscribers about self changes. */ emit(quant?: $mol_wire_cursor): void; /** * Moves peer from one position to another. Doesn't clear data at old position! */ peer_move(from_pos: number, to_pos: number): void; /** * Updates self position in the peer. */ peer_repos(peer_pos: number, self_pos: number): void; } } declare namespace $ { /** Generic subscriber interface */ interface $mol_wire_sub extends $mol_wire_pub { temp: boolean; pub_list: $mol_wire_pub[]; /** * Begin auto wire to publishers. * Returns previous auto subscriber that must me transfer to the `end`. */ track_on(): $mol_wire_sub | null; /** * Returns next auto wired publisher. It can be easely repormoted. * Or promotes next publisher to auto wire its togeter. * Must be used only between `track_on` and `track_off`. */ track_next(pub?: $mol_wire_pub): $mol_wire_pub | null; pub_off(pub_pos: number): void; /** * Unsubscribes from unpromoted publishers. */ track_cut(sub: $mol_wire_pub | null): void; /** * Ends auto wire to publishers. */ track_off(sub: $mol_wire_pub | null): void; /** * Receive notification about publisher changes. */ absorb(quant: $mol_wire_cursor, pos: number): void; /** * Unsubscribes from all publishers. */ destructor(): void; } } declare namespace $ { let $mol_wire_auto_sub: $mol_wire_sub | null; /** * When fulfilled, all publishers are promoted to this subscriber on access to its. */ function $mol_wire_auto(next?: $mol_wire_sub | null): $mol_wire_sub | null; /** * Affection queue. Used to prevent accidental stack overflow on emit. */ const $mol_wire_affected: ($mol_wire_sub | number)[]; } declare namespace $ { function $mol_fail_hidden(error: any): never; } declare namespace $ { function $mol_dev_format_register(config: { header: (val: any, config: any) => any; hasBody: (val: any, config: any) => false; } | { header: (val: any, config: any) => any; hasBody: (val: any, config: any) => boolean; body: (val: any, config: any) => any; }): void; const $mol_dev_format_head: unique symbol; const $mol_dev_format_body: unique symbol; function $mol_dev_format_native(obj: any): any[]; function $mol_dev_format_auto(obj: any): any[]; function $mol_dev_format_element(element: string, style: object, ...content: any[]): any[]; let $mol_dev_format_span: (style: object, ...content: any[]) => any[]; let $mol_dev_format_div: (style: object, ...content: any[]) => any[]; let $mol_dev_format_ol: (style: object, ...content: any[]) => any[]; let $mol_dev_format_li: (style: object, ...content: any[]) => any[]; let $mol_dev_format_table: (style: object, ...content: any[]) => any[]; let $mol_dev_format_tr: (style: object, ...content: any[]) => any[]; let $mol_dev_format_td: (style: object, ...content: any[]) => any[]; let $mol_dev_format_accent: (...args: any[]) => any[]; let $mol_dev_format_strong: (...args: any[]) => any[]; let $mol_dev_format_string: (...args: any[]) => any[]; let $mol_dev_format_shade: (...args: any[]) => any[]; let $mol_dev_format_indent: (...args: any[]) => any[]; } declare namespace $ { /** * Publisher that can auto collect other publishers. 32B * * P1 P2 P3 P4 S1 S2 S3 * ^ ^ * pubs_from subs_from */ class $mol_wire_pub_sub extends $mol_wire_pub implements $mol_wire_sub { protected pub_from: number; protected cursor: $mol_wire_cursor; get temp(): boolean; get pub_list(): $mol_wire_pub[]; track_on(): $mol_wire_sub | null; promote(): void; track_next(pub?: $mol_wire_pub): $mol_wire_pub | null; track_off(sub: $mol_wire_sub | null): void; pub_off(sub_pos: number): void; destructor(): void; track_cut(): void; complete(): void; complete_pubs(): void; absorb(quant?: $mol_wire_cursor, pos?: number): void; [$mol_dev_format_head](): any[]; /** * Is subscribed to any publisher or not. */ get pub_empty(): boolean; } } declare namespace $ { const $mol_ambient_ref: unique symbol; /** @deprecated use $ instead */ type $mol_ambient_context = $; function $mol_ambient(this: $ | void, overrides: Partial<$>): $; } declare namespace $ { /** * Proxy that delegates all to lazy returned target. * * $mol_delegate( Array.prototype , ()=> fetch_array() ) */ function $mol_delegate(proto: Value, target: () => Value): Value; } declare namespace $ { const $mol_owning_map: WeakMap; function $mol_owning_allow(having: Having): having is Having & { destructor(): void; }; function $mol_owning_get(having: Having, Owner?: { new (): Owner; }): Owner | null; function $mol_owning_check(owner: Owner, having: Having): having is Having & { destructor(): void; }; function $mol_owning_catch(owner: Owner, having: Having): boolean; } declare namespace $ { type $mol_type_writable = { -readonly [P in keyof T]: T[P]; }; } declare namespace $ { function $mol_func_name(this: $, func: Function): string; function $mol_func_name_from(target: Target, source: Function): Target; } declare namespace $ { const $mol_key_handle: unique symbol; const $mol_key_store: WeakMap; } declare namespace $ { class $mol_object2 { static $: $; [Symbol.toStringTag]: string; [$mol_ambient_ref]: $; get $(): $; set $(next: $); static create(this: new (init?: (instance: any) => void) => Instance, init?: (instance: $mol_type_writable) => void): Instance; static [Symbol.toPrimitive](): any; static toString(): any; static toJSON(): any; static [$mol_key_handle](): any; destructor(): void; static destructor(): void; [Symbol.dispose](): void; toString(): string; } } declare namespace $ { class $mol_after_tick extends $mol_object2 { task: () => void; static promise: Promise | null; cancelled: boolean; constructor(task: () => void); destructor(): void; } } declare namespace $ { function $mol_promise_like(val: any): val is Promise; } declare namespace $ { /** * Suspendable task with support both sync/async api. * * A1 A2 A3 A4 P1 P2 P3 P4 S1 S2 S3 * ^ ^ ^ * args_from pubs_from subs_from **/ abstract class $mol_wire_fiber extends $mol_wire_pub_sub { readonly task: (this: Host, ...args: Args) => Result; readonly host?: Host | undefined; static warm: boolean; static planning: Set<$mol_wire_fiber>; static reaping: Set<$mol_wire_fiber>; static plan_task: $mol_after_tick | null; static plan(): void; static sync(): void; cache: Result | Error | Promise; get args(): Args; result(): Result | undefined; get incompleted(): boolean; field(): string; constructor(id: string, task: (this: Host, ...args: Args) => Result, host?: Host | undefined, args?: Args); plan(): this; reap(): void; toString(): string; toJSON(): string; [$mol_dev_format_head](): any[]; [$mol_dev_format_body](): null; get $(): any; emit(quant?: $mol_wire_cursor): void; fresh(): this | undefined; refresh(): void; abstract put(next: Result | Error | Promise): Result | Error | Promise; /** * Synchronous execution. Throws Promise when waits async task (SuspenseAPI provider). * Should be called inside SuspenseAPI consumer (ie fiber). */ sync(): Awaited; /** * Asynchronous execution. * It's SuspenseAPI consumer. So SuspenseAPI providers can be called inside. */ async_raw(): Promise; async(): Promise & { destructor(): void; }; step(): Promise; destructor(): void; } } declare namespace $ { /** Returns string key for any value. */ function $mol_key(value: Value): string; } declare namespace $ { class $mol_after_frame extends $mol_object2 { task: () => void; static _promise: Promise | null; static get promise(): Promise; cancelled: boolean; promise: Promise; constructor(task: () => void); destructor(): void; } } declare namespace $ { let $mol_compare_deep_cache: WeakMap>; /** * Deeply compares two values. Returns true if equal. * Define `Symbol.toPrimitive` to customize. */ function $mol_compare_deep(left: Value, right: Value): boolean; } declare namespace $ { /** Logger event data */ type $mol_log3_event = { [key in string]: unknown; } & { /** Time of event creation */ time?: string; /** Place of event creation */ place: unknown; /** Short description of event */ message: string; } & Fields; /** Logger function */ type $mol_log3_logger = (this: $, event: $mol_log3_event) => Res; /** Log begin of some task */ let $mol_log3_come: $mol_log3_logger<{}>; /** Log end of some task */ let $mol_log3_done: $mol_log3_logger<{}>; /** Log error */ let $mol_log3_fail: $mol_log3_logger<{}>; /** Log warning message */ let $mol_log3_warn: $mol_log3_logger<{ hint: string; }>; /** Log some generic event */ let $mol_log3_rise: $mol_log3_logger<{}>; /** Log begin of log group, returns func to close group */ let $mol_log3_area: $mol_log3_logger<{}, () => void>; /** Log begin of collapsed group only when some logged inside, returns func to close group */ function $mol_log3_area_lazy(this: $, event: $mol_log3_event<{}>): () => void; let $mol_log3_stack: (() => void)[]; } declare namespace $ { /** * Extracts keys from `Input` which values extends `Upper` and extendable by `Lower`. * * type MathConstants = $mol_type_keys_extract< Math , number > // "E" | "PI" ... */ type $mol_type_keys_extract = { [Field in keyof Input]: unknown extends Input[Field] ? never : Input[Field] extends never ? never : Input[Field] extends Upper ? [ Lower ] extends [Input[Field]] ? Field : never : never; }[keyof Input]; } declare namespace $ { function $mol_log3_web_make(level: $mol_type_keys_extract, color: string): (this: $, event: $mol_log3_event<{}>) => () => void; } declare namespace $ { /** One-shot fiber */ class $mol_wire_task extends $mol_wire_fiber { static getter(task: (this: Host, ...args: Args) => Result): (host: Host, args: Args) => $mol_wire_task; get temp(): boolean; complete(): void; put(next: Result | Error | Promise): Error | Result | Promise; destructor(): void; } } declare namespace $ { /** * Decorates method to fiber to ensure it is executed only once inside other fiber. */ function $mol_wire_method(host: Host, field: PropertyKey, descr?: TypedPropertyDescriptor<(...args: Args) => any>): { value: (this: Host, ...args: Args) => any; enumerable?: boolean; configurable?: boolean; writable?: boolean; get?: (() => (...args: Args) => any) | undefined; set?: ((value: (...args: Args) => any) => void) | undefined; }; } declare namespace $ { /** * Returns `Tuple` without first element. * * $mol_type_tail<[ 1 , 2 , 3 ]> // [ 2, 3 ] */ type $mol_type_tail = ((...tail: Tuple) => any) extends ((head: any, ...tail: infer Tail) => any) ? Tail : never; } declare namespace $ { /** * Returns last element of `Tuple`. * * $mol_type_tail<[ 1 , 2 , 3 ]> // 3 */ type $mol_type_foot = Tuple['length'] extends 0 ? never : Tuple[$mol_type_tail['length']]; } declare namespace $ { function $mol_fail_catch(error: unknown): boolean; } declare namespace $ { function $mol_try(handler: () => Result): Result | Error; } declare namespace $ { function $mol_try_web(handler2: () => Result): Result | Error; } declare namespace $ { function $mol_fail_log(error: unknown): boolean; } declare namespace $ { /** Long-living fiber. */ class $mol_wire_atom extends $mol_wire_fiber { static solo(host: Host, task: (this: Host, ...args: Args) => Result): $mol_wire_atom; static plex(host: Host, task: (this: Host, ...args: Args) => Result, key: Args[0]): $mol_wire_atom; static watching: Set<$mol_wire_atom>; static watcher: $mol_after_frame | null; static watch(): void; watch(): void; /** * Update atom value through another temp fiber. */ resync(args: Args): Error | Result | Promise; once(): Awaited; channel(): ((next?: $mol_type_foot) => Awaited) & { atom: $mol_wire_atom; }; destructor(): void; put(next: Result | Error | Promise): Error | Result | Promise; } } declare namespace $ { var $mol_dom_context: typeof globalThis; } declare namespace $ { } declare namespace $ { var $mol_dom: typeof globalThis; } declare namespace $ { function $mol_dom_render_children(el: Element | DocumentFragment, childNodes: NodeList | Array): void; } declare namespace $ { function $mol_wire_patch(obj: object): void; } interface Node { __defineGetter__: (field: string, getter: () => any) => void; } declare namespace $ { function lookup_descr(obj: Obj, field: Field): PropertyDescriptor | null; /** Polyfill makes DOM reactive. */ function $mol_wire_dom(el: El): El; } export = $; //# sourceMappingURL=web.d.ts.map