/* @ts-self-types="./index.d.ts" */ import { ExitMethod, ListTransitionOptions, OnListChange, OnTransition, SwitchTransitionOptions, TransitionMode } from "./types.js"; import { Accessor } from "solid-js"; /** * Create an element transition interface for switching between single elements. * It can be used to implement own transition effect, or a custom ``-like component. * * It will observe {@link source} and return a signal with array of elements to be rendered (current one and exiting ones). * * @param source a signal with the current element. Any nullish value will mean there is no element. * Any object can used as the source, but most likely you will want to use a `HTMLElement` or `SVGElement`. * @param options transition options {@link SwitchTransitionOptions} * @returns a signal with an array of the current element and exiting previous elements. * * @see https://github.com/solidjs-community/solid-primitives/tree/main/packages/transition-group#createSwitchTransition * * @example * const [el, setEl] = createSignal(); * * const rendered = createSwitchTransition(el, { * onEnter(el, done) { * // the enter callback is called before the element is inserted into the DOM * // so run the animation in the next animation frame / microtask * queueMicrotask(() => { ... }) * }, * onExit(el, done) { * // the exitting element is kept in the DOM until the done() callback is called * }, * }) * * // change the source to trigger the transition * setEl(refToHtmlElement); */ export declare function createSwitchTransition(source: Accessor, options: SwitchTransitionOptions>): Accessor[]>; /** * Create an element list transition interface for changes to the list of elements. * It can be used to implement own transition effect, or a custom ``-like component. * * It will observe {@link source} and return a signal with array of elements to be rendered (current ones and exiting ones). * * @param source a signal with the current list of elements. * Any object can used as the element, but most likely you will want to use a `HTMLElement` or `SVGElement`. * @param options transition options {@link ListTransitionOptions} * * @see https://github.com/solidjs-community/solid-primitives/tree/main/packages/transition-group#createListTransition * * @example * const [els, setEls] = createSignal([]); * * const rendered = createListTransition(els, { * onChange({ list, added, removed, unchanged, finishRemoved }) { * // the callback is called before the added elements are inserted into the DOM * // so run the animation in the next animation frame / microtask * queueMicrotask(() => { ... }) * * // the removed elements are kept in the DOM until the finishRemoved() callback is called * finishRemoved(removed); * } * }) * * // change the source to trigger the transition * setEls([...refsToHTMLElements]); */ export declare function createListTransition(source: Accessor, options: ListTransitionOptions): Accessor; export type { ExitMethod, ListTransitionOptions, OnListChange, OnTransition, SwitchTransitionOptions, TransitionMode };