/** * Shared, DOM-free grouping helpers for list components * (`ixfx-grid-list`, `ixfx-detail-list`). Semantics mirror `ixfx-data-grid`: * groups appear in first-encounter order, keys are `String(value ?? '')`. */ /** * How to derive an item's group key: a property (or `data-*` attribute) name, * or a function of the item. */ type ListGroupBy = string | ((item: T, index: number) => string); /** Turns a group key and its items into the header label. */ type ListGroupLabel = (groupKey: string, items: readonly unknown[]) => string; /** Read-only description of one rendered group. */ type ListGroupInfo = { readonly key: string; readonly label: string; /** Visible (post-filter) items, including those hidden by collapse. */ readonly count: number; readonly collapsed: boolean; }; type ListGroupToggleDetail = { readonly groupKey: string; readonly collapsed: boolean; }; type ListGroupChangeDetail = { readonly groupBy: ListGroupBy | null; }; type ListGroupToggleEvent = CustomEvent; type ListGroupChangeEvent = CustomEvent; interface ListGroupEventMap { 'list-group-toggle': ListGroupToggleEvent; 'list-group-change': ListGroupChangeEvent; } /** One group produced by {@link partitionByGroup}. */ type ListGroupPartition = { readonly key: string; readonly label: string; readonly items: T[]; /** Index (in the input array) of the group's first item. */ readonly firstIndex: number; }; /** Label shown for the empty group key. */ declare const EMPTY_GROUP_LABEL = "(none)"; /** Default header label: the key, or `(none)` for the empty key. */ declare function defaultGroupLabel(key: string): string; /** Coerce a raw group value to a key, as data-grid does. */ declare function toGroupKey(value: unknown): string; /** * Group key for `item`. A string `groupBy` is resolved through `readNamed` * (property or `data-*` lookup, supplied by the host); a function is called. */ declare function resolveGroupKey(groupBy: ListGroupBy, item: T, index: number, readNamed: (item: T, name: string) => unknown): string; /** * Split `items` into groups in first-encounter order. Single pass, O(n). * Item order within a group is preserved. */ declare function partitionByGroup(items: readonly T[], keyOf: (item: T, index: number) => string, labelOf?: ListGroupLabel): Array>; /** Immutable toggle of `key` in `set`. */ declare function toggleInSet(set: ReadonlySet, key: string): Set; export { ListGroupEventMap as a, ListGroupPartition as c, defaultGroupLabel as d, partitionByGroup as f, toggleInSet as h, ListGroupChangeEvent as i, ListGroupToggleDetail as l, toGroupKey as m, ListGroupBy as n, ListGroupInfo as o, resolveGroupKey as p, ListGroupChangeDetail as r, ListGroupLabel as s, EMPTY_GROUP_LABEL as t, ListGroupToggleEvent as u };