/* */ import type { Stack } from '~/methods/debugger' type IContext = import('~/objects/context').default type IEffect = import('~/objects/effect').default type IMemo = import('~/objects/memo').default type IObservable = import('~/objects/observable').default type IObserver = import('~/objects/observer').default type IOwner = import('~/objects/owner').default type IRoot = import('~/objects/root').default type ISchedulerAsync = typeof import('~/objects/scheduler.async').default type ISchedulerSync = typeof import('~/objects/scheduler.sync').default type ISuperRoot = import('~/objects/superroot').default type ISuspense = import('~/objects/suspense').default /* FUNCTIONS */ type BatchFunction = () => PromiseMaybe type CallbackFunction = (stack?: Stack) => void type CleanupFunction = (stack?: Stack) => void type ContextFunction = (stack?: Stack) => T type DisposeFunction = (stack?: Stack) => void type EffectFunction = (stack?: Stack) => CleanupFunction | void type ErrorFunction = (error: Error) => void type EqualsFunction = (value: T, valuePrev: T) => boolean type MapFunction = (value: T, index: FunctionMaybe) => R type MapValueFunction = (value: Indexed, index: FunctionMaybe) => R type MemoFunction = (stack?: Stack) => T type ObserverFunction = (stack?: Stack) => T type SelectorFunction = (value: T) => ObservableReadonly type SuspenseFunction = (stack?: Stack) => T type TryCatchFunction = ({ error, reset }: { error: Error, reset: DisposeFunction }) => T type UntrackFunction = () => T type UntrackedFunction = (...args: Arguments) => T type UpdateFunction = (value: T) => T type WithFunction = (stack?: Stack) => T type WrappedFunction = (stack?: Stack) => T type WrappedDisposableFunction = (stack?: Stack, dispose?: DisposeFunction) => T /* EFFECT */ type EffectOptions = { suspense?: boolean, sync?: boolean | 'init' stack?: Stack } /* FOR */ type ForOptions = { pooled?: boolean, unkeyed?: boolean } /* MEMO */ type MemoOptions = { equals?: EqualsFunction | false, sync?: boolean stack?: Stack } /* OBSERVABLE */ type Observable = { (): T, (fn: (value: T) => T): T, (value: T): T, readonly [ObservableSymbol]: true } type ObservableLike = { (): T, (fn: (value: T) => T): T, (value: T): T } type ObservableReadonly = { (): T, readonly [ObservableSymbol]: true } type ObservableReadonlyLike = { (): T } /** * ObservableOptions type definition */ type ObservableOptions = { equals?: EqualsFunction | false, type?: 'string' | 'function' | 'object' | 'number' | 'boolean' | 'symbol' | 'undefined' | 'bigint' | String | Function | Object | Number | Boolean | Symbol | BigInt | Constructor | T /** * Function to convert the observable value to a string representation for HTML attributes. * This is useful when binding observables to DOM element attributes. */ toHtml?: (t: T) => string /** * Function to convert a string value from HTML attributes back to the observable's type. * This is useful when binding HTML attributes back to observables. */ fromHtml?: (s: string) => T } declare const ObservableSymbol: unique symbol /* OWNER */ type Owner = { isSuperRoot: boolean, isRoot: boolean, isSuspense: boolean, isComputation: boolean } /* STORE */ type StoreOptions = { equals?: EqualsFunction | false } /* OTHERS */ type ArrayMaybe = T | T[] type Callable = (T & { call: CallableFunctionCall }) | ({ call: CallableFunctionCall, apply?: never }) type CallableFunction = (...args: any[]) => any type CallableFunctionCall = (thiz: any, ...args: Parameters) => ReturnType type Constructor = { new(...args: Arguments): T } type Contexts = Record type FunctionMaybe = (() => T) | T type Indexed = T extends ObservableReadonly ? ObservableReadonly : ObservableReadonly type LazyArray = T[] | T | undefined type LazySet = Set | T | undefined type LazyValue = T | undefined type PromiseMaybe = T | Promise type ResolvablePrimitive = null | undefined | boolean | number | bigint | string | symbol type ResolvableArray = Resolvable[] type ResolvableObject = { [Key in string | number | symbol]?: Resolvable } type ResolvableFunction = () => Resolvable type Resolvable = ResolvablePrimitive | ResolvableObject | ResolvableArray | ResolvableFunction type Resolved = T /* EXPORT */ export type { IContext, IEffect, IMemo, IObservable, IObserver, IOwner, IRoot, ISchedulerAsync, ISchedulerSync, ISuperRoot, ISuspense } export type { BatchFunction, CallbackFunction, CleanupFunction, ContextFunction, DisposeFunction, EffectFunction, ErrorFunction, EqualsFunction, MapFunction, MapValueFunction, MemoFunction, ObserverFunction, SelectorFunction, SuspenseFunction, TryCatchFunction, UntrackFunction, UntrackedFunction, UpdateFunction, WithFunction, WrappedFunction, WrappedDisposableFunction } export type { EffectOptions } export type { ForOptions } export type { MemoOptions } export type { Observable, ObservableLike, ObservableReadonly, ObservableReadonlyLike, ObservableOptions } export type { Owner } export type { StoreOptions } export type { ArrayMaybe, Callable, CallableFunction, Constructor, Contexts, FunctionMaybe, Indexed, LazyArray, LazySet, LazyValue, PromiseMaybe, Resolvable, Resolved }