effex-monorepo
    Preparing search index...

    Interface EachConfig<A, E, R>

    Configuration for the each control flow (DOM-specific with animation support).

    interface EachConfig<A, E = never, R = never> {
        animate?: ListAnimationOptions;
        container?: () => Element<HTMLElement | SVGElement, never, never>;
        key: (item: A) => string;
        render: (
            item: Readable<A>,
            index: Readable<number>,
        ) => Element<HTMLElement | SVGElement, E, R>;
    }

    Type Parameters

    • A
    • E = never
    • R = never
    Index

    Properties

    Optional animation configuration

    container?: () => Element<HTMLElement | SVGElement, never, never>

    Optional custom container element. If not provided, defaults to a div with display: contents.

    key: (item: A) => string

    Function to extract a unique key from each item

    render: (
        item: Readable<A>,
        index: Readable<number>,
    ) => Element<HTMLElement | SVGElement, E, R>

    Function to render each item.

    Type Declaration

      • (
            item: Readable<A>,
            index: Readable<number>,
        ): Element<HTMLElement | SVGElement, E, R>
      • Parameters

        • item: Readable<A>

          Readable for the item data (updates when item changes)

        • index: Readable<number>

          Readable for the item's position (updates when items reorder)

        Returns Element<HTMLElement | SVGElement, E, R>