import { WithDerived, Derived } from './shared/c7f3bced'; export { Derived, Watcher, isDerived, no, noto, o, watch, when } from './shared/c7f3bced'; import { Auto, Falsy, ObserverTarget, Change } from './shared/ed456245'; export { Auto, AutoConfig, Change, ChangeObserver, auto, shallowChanges } from './shared/ed456245'; import * as React from 'react'; import { ReactElement, Ref, RefAttributes } from 'react'; declare function useO(state: Exclude, deps?: readonly any[]): WithDerived; /** * Create an observable getter that is managed by React. * This lets you memoize an expensive combination of observable values. */ declare function useO(create: () => () => T, deps?: readonly any[]): Derived; /** Create observable component state. */ declare function useO(create: () => Exclude, deps?: readonly any[]): T; /** Memoize an object and return its observable proxy. Non-objects are returned as-is. */ declare function useO(state: T, deps?: readonly any[]): T; declare type EffectReturn = void | (() => void | undefined); /** Wrap a `useEffect` call with magic observable tracking */ declare function useAuto(effect: () => EffectReturn, deps?: readonly any[]): Auto; /** * Combine a `useEffect` call with an `Auto` instance that invokes an * unobserved side `effect` when the `compute` function returns a new value. */ declare function useAuto(compute: () => T, effect: (value: T) => EffectReturn, deps?: readonly any[]): Auto; interface Component

{ (props: P): ReactElement | null; displayName?: string; } interface RefForwardingComponent { (props: P, ref: Ref): ReactElement | null; displayName?: string; } declare type RefForwardingAuto = T & ((props: T extends RefForwardingComponent ? P & RefAttributes : never) => ReactElement | null); /** Wrap a component with magic observable tracking */ declare function withAuto(render: T): T; /** Wrap a component with `forwardRef` and magic observable tracking */ declare function withAuto(render: T): RefForwardingAuto; declare namespace withAuto { var dev: (render: any) => React.ForwardRefExoticComponent & React.RefAttributes>; } /** * Create an observable getter that is managed by React. * This lets you memoize an expensive combination of observable values. * * If the `compute` argument changes over the course of a component's lifetime, * its value should be added to the `deps` array. * * When `deps` are changed, the derived state is reset. This is useful when * the `compute` function is using a variable from another function scope. */ declare function useDerived(compute: () => T, deps?: readonly any[]): Derived; declare function useDerived(compute: (() => T) | Falsy, deps?: readonly any[]): Derived | null; declare function useDerived(compute: () => T, discard: (memo: T, oldMemo: T | undefined) => boolean, deps?: readonly any[]): Derived; declare function useDerived(compute: (() => T) | Falsy, discard: (memo: T, oldMemo: T | undefined) => boolean, deps?: readonly any[]): Derived | null; /** Listen for shallow changes to an observable object. */ declare function useChanges(target: ObserverTarget, onChange: (change: Change) => void, deps?: readonly any[]): void; declare type UnmountFn = () => undefined | void; declare type Source = { [key: string]: T; } | ReadonlyArray | ReadonlySet | ReadonlyMap; declare type Effect = T extends Source ? T extends ReadonlyMap ? (value: U, key: P) => UnmountFn | void : T extends ReadonlyArray | ReadonlySet ? (value: U) => UnmountFn | void : (value: U, key: string) => UnmountFn | void : never; /** * Create a layout effect for every key of your `values` object. * * Values are passed to your `effect` function as they are added and replaced. * The `effect` can return a cleanup function to call for removed values. * * Map objects use their keys */ declare function useEffects(source: T, effect: Effect, deps?: readonly any[]): void; /** * An alternative to `withAuto` that re-renders the caller * when the given observable value is changed. * * If you pass an object without a key, the entire object * is observed. * * ⚠️ This hook has performance drawbacks! It cannot automatically * batch React updates, so you need to wrap changes with `batchedUpdates` * to avoid multiple re-renders. It also cannot wait for ancestor * components to re-render first, which also leads to excessive re-renders. */ declare function useBinding(target: T extends ReadonlyMap ? never : T, key: P): T[P]; declare function useBinding(target: ReadonlyMap, key: K): V | undefined; declare function useBinding(target: Derived): T; declare function useBinding(target: T): T; export { useAuto, useBinding, useChanges, useDerived, useEffects, useO, withAuto };