/** * A self contained signal function, when an argument is present it * writes to the signal, when theres no argument it reads the signal. * * @template T * @param {T} [value] - Optional initial value * @returns {SignalFunction} */ export function signalFunction(value?: T): SignalFunction; /** * Runs a function inside an effect if value is a function * * @param {unknown} value * @param {(value: unknown, prev?: unknown) => unknown} fn */ export function withPrevValue(value: unknown, fn: (value: unknown, prev?: unknown) => unknown): void; /** * Returns `true` when all derived has been resolved * * @template {Derived} T * @param {...T} args * @returns {boolean} * @url https://pota.quack.uy/isResolved */ export function isResolved>(...args: T[]): boolean; /** * Creates an asynchronously effect * * @param {(currentRunningEffect: Promise) => any} fn - A * function that receives a `currentRunningEffect` that should be * awaited for when wanting to run effects synchronously, that's it * one effect after another. * @returns {void} * @url https://pota.quack.uy/asyncEffect */ export function asyncEffect(fn: (currentRunningEffect: Promise) => any): void; /** * Same as signal but writing to it patches current data. To be used * to patch a signal array with data that comes from a server without * losing references to what its already there avoiding a store. * * @template {{ id?: string | number; [key: string]: any }[]} T * @param {T} initialValue * @param {SignalOptions} [options] * @returns {Signal} * @url https://pota.quack.uy/externalSignal */ export function externalSignal(initialValue: T, options?: SignalOptions): Signal; /** * Resolves and returns `children` in a memo. A memo in a memo, so * reactivity on the inner memo doesnt trigger reactivity outside. * * @template {JSX.Element} T * @param {T | (() => T)} fn * @returns {SignalAccessor>} * @url https://pota.quack.uy/resolve */ export function resolve(fn: T | (() => T)): SignalAccessor>; /** * Recursively unwrap children functions * * @template T * @param {T} children * @returns {Resolved} * @url https://pota.quack.uy/unwrap */ export function unwrap(children: T): Resolved; /** * Makes of `children` a function. Reactive children will run as is, * non-reactive children will run untracked, regular children will * just return. * * @template {JSX.Element | JSX.Element[]} T * @param {T} children * @returns {(...args: unknown[]) => T} * @url https://pota.quack.uy/makeCallback */ export function makeCallback(children: T): (...args: unknown[]) => T; /** * Marks a function as a `Component`. * * Allows to tell a `signal function` from a `component function`. * Signals and user functions go in effects, for reactivity. * Components and callbacks are untracked and wont go in effects to * avoid re-rendering if signals are used in the components body * * @url https://pota.quack.uy/markComponent */ export function markComponent(fn: any): any; /** * Adds an event listener to a node * * @template {Document | typeof window | DOMElement} TargetElement * @template {JSX.EventName} Name * @param {TargetElement} node - Element to add the event listener * @param {Name} type - The name of the event listener * @param {JSX.EventHandler, TargetElement>} handler * - Function to handle the event * * @returns {Function} - An `off` function for removing the event * listener * @url https://pota.quack.uy/addEvent */ export function addEvent(node: TargetElement, type: Name, handler: JSX.EventHandler, TargetElement>): Function; /** * Removes an event listener from a node * * @template {Document | typeof window | DOMElement} TargetElement * @template {JSX.EventName} Name * @param {TargetElement} node - Element to add the event listener * @param {Name} type - The name of the event listener * @param {JSX.EventHandler, TargetElement>} handler * - Function to handle the event * * @returns {Function} - An `on` function for adding back the event * listener * @url https://pota.quack.uy/removeEvent */ export function removeEvent(node: TargetElement, type: Name, handler: JSX.EventHandler, TargetElement>): Function; export function ref(): SignalFunction; export function microtask(fn: () => unknown): void; /** * Reactive Map * * @type {{ * ( * list: Each, * callback: (item: T, index: () => number) => JSX.Element, * noSort: boolean | undefined, * fallback: JSX.Element | undefined, * reactiveIndex: true, * ): (fn?: Function) => JSX.Element * ( * list: Each, * callback: (item: T, index: number) => JSX.Element, * noSort?: boolean, * fallback?: JSX.Element, * reactiveIndex?: boolean, * ): (fn?: Function) => JSX.Element * }} * @url https://pota.quack.uy/map */ export const map: { (list: Each, callback: (item: T, index: () => number) => JSX.Element, noSort: boolean | undefined, fallback: JSX.Element | undefined, reactiveIndex: true): (fn?: Function) => JSX.Element; (list: Each, callback: (item: T, index: number) => JSX.Element, noSort?: boolean, fallback?: JSX.Element, reactiveIndex?: boolean): (fn?: Function) => JSX.Element; }; /** * Extend `Pota` and define a `render(){}` method to create a class * component. `ready(cb)` and `cleanup(cb)` methods will be registered * automatically. * * JSX props become `Partial

` via `JSX.LibraryManagedAttributes` — * the renderer merges JSX props on top of the `props` field defaults * (see `createClass` in `src/core/renderer.js`), so every individual * JSX prop is optional at the call site. Inside `render()`, the * parameter is the full `P`. * * @template {Record} [P=Record] * Default is `Record` * @url https://pota.quack.uy/Pota */ export class Pota

= Record> { /** @param {P} props */ constructor(props: P); /** @type {P} */ props: P; /** @param {P} props */ render(props: P): void; } export function isComponent(value: any): boolean; export function ownedEvent>(handler: T): ((...args: any[]) => any) | (T & { handleEvent: (...args: any[]) => any; }); export const action: typeof import("../../typescript/private/action.js").action; export const asyncTracking: { add: () => () => void; ready: (fn: any) => void; }; export const batch: (fn: () => T, init?: boolean) => T; export const catchError: (fn: () => T, handler: (err: unknown) => void) => T | undefined; export const cleanup: void>(fn: T) => T; export const context: (defaultValue?: T) => Context; export const createSuspenseContext: { new (): { s: Signal; c: number; add(): () => void; isEmpty(): boolean; }; }; export const derived: typeof import("../../typescript/private/derived.js").derived; export const effect: (fn: () => T, options?: EffectOptions) => void; export const listener: () => { state: number; updatedAt: number; fn: Function | undefined; sources: any[]; sourceSlots: number[]; update(): void; dispose(): void; queue(): void; owner: undefined | { owner: undefined | /*elided*/ any; owned: /*elided*/ any[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: /*elided*/ any): void; dispose(): void; disposeOwned(): void; doCleanups(): void; }; owned: /*elided*/ any[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: /*elided*/ any): void; disposeOwned(): void; doCleanups(): void; }; export const memo: (fn: () => T, options?: SignalOptions) => SignalAccessor & { readonly memo?: void; }; export const on: (depend: () => any, fn: () => T, options?: EffectOptions) => void; export const owned: (cb: ((...args: A[]) => T) | Function, onCancel?: () => void) => (...args: any[]) => any; export const owner: () => { state: number; updatedAt: number; fn: Function | undefined; sources: any[]; sourceSlots: number[]; update(): void; dispose(): void; queue(): void; owner: undefined | { owner: undefined | /*elided*/ any; owned: /*elided*/ any[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: /*elided*/ any): void; dispose(): void; disposeOwned(): void; doCleanups(): void; }; owned: /*elided*/ any[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: /*elided*/ any): void; disposeOwned(): void; doCleanups(): void; }; export const root: (fn: (dispose: () => void) => T, options?: EffectOptions) => T; export const Root: { new (owner: { state: number; updatedAt: number; fn: Function | undefined; sources: any[]; sourceSlots: number[]; update(): void; dispose(): void; queue(): void; owner: undefined | { owner: undefined | /*elided*/ any; owned: /*elided*/ any[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: /*elided*/ any): void; dispose(): void; disposeOwned(): void; doCleanups(): void; }; owned: /*elided*/ any[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: /*elided*/ any): void; disposeOwned(): void; doCleanups(): void; }, options?: EffectOptions): { owner: undefined | /*elided*/ any; owned: { state: number; updatedAt: number; fn: Function | undefined; sources: any[]; sourceSlots: number[]; update(): void; dispose(): void; queue(): void; owner: undefined | /*elided*/ any; owned: /*elided*/ any[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: /*elided*/ any): void; disposeOwned(): void; doCleanups(): void; }[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: { state: number; updatedAt: number; fn: Function | undefined; sources: any[]; sourceSlots: number[]; update(): void; dispose(): void; queue(): void; owner: undefined | /*elided*/ any; owned: /*elided*/ any[]; cleanups: Function[]; context: Record; addCleanups(fn: () => void): void; cleanupCancel(fn: () => void): void; addOwned(value: /*elided*/ any): void; disposeOwned(): void; doCleanups(): void; }): void; dispose(): void; disposeOwned(): void; doCleanups(): void; }; }; export const runWithOwner: (owner: any, fn: any) => any; export const signal: (value?: T, options?: SignalOptions) => Signal; export const syncEffect: (fn: () => T, options?: EffectOptions) => void; export const untrack: (fn: () => T) => T; export const useSuspense: Context<{ s: Signal; c: number; add(): () => void; isEmpty(): boolean; }>; export const withValue: (value: Attribute, fn: (value: T) => void, writeDefaultValue?: () => void, wroteValue?: any, resolved?: any) => void; import { createReactiveSystem } from './solid.js'; export { createReactiveSystem }; //# sourceMappingURL=reactive.d.ts.map