function / @typed/ui/index

Collection.byDomOrder

Returns a sorted copy using compareDocumentPosition; items without comparable mounted elements retain an equivalent ordering position.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Collection ordering
Since
1.0.0
Member of
Collection

Import

import { Collection } from "@typed/ui/index";

Access Collection.byDomOrder through the imported Collection export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export declare function byDomOrder<ItemType extends Item<unknown, object>>(items: readonly ItemType[]): readonly ItemType[];

Why

Separating this deterministic policy from event wiring lets applications test it directly and reuse it in custom composites.

Ownership and lifetime

This is a synchronous calculation. It acquires no resources and does not mutate the input array, state, event, or DOM.

Examples

import * as Collection from "@typed/ui/Collection";

const ordered = Collection.byDomOrder([{ id: "body", element: document.body }]);

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source