import type { MenuDividerItem, MenuItemType, MenuSectionHeader } from './index.js'; /** * One rendered entry of a section group. * * `index` is the entry's position in the ORIGINAL flat `items` array, not in * the group — the id and `{#each}` key fallbacks derive from it, so grouping * must not renumber them. */ export type MenuGroupEntry = { item: TItem; index: number; /** A rule, per the `isDivider` predicate — renders a separator, never a row. */ divider: boolean; }; /** A section header plus the items it owns; `section: null` for a bare run. */ export type MenuSectionGroup = { section: MenuSectionHeader | null; /** * `{#each}` key, derived from the group's own first position. A run of * bare items can occur more than once (a rule between two sections opens * one), so a constant key for the bare case would collide. */ key: string; entries: MenuGroupEntry[]; }; /** * The structural divider shape, used when the consumer supplies no `isDivider` * mapper. Consulted only through that mapper's fallback: a consumer whose own * item type happens to carry `type: 'divider'` must be able to say so, or * their row would silently become a rule. */ export declare function isMenuDividerItem(item: MenuItemType): item is MenuDividerItem; /** * Segment a flat `items` array into section groups. * * Shared by Menu's top level and MenuSubmenu's child pipeline so the two * cannot disagree about what belongs to a section: before this, the submenu * rendered section headers flat and grouped nothing, which made the same * `{ type: 'section' }` entry produce a different accessibility tree * depending on how deep it sat. * * Both predicates come from the caller — never read off the item here — so * every classification runs through the consumer's `isSection` / `isDivider` * mappers, exactly like every other field. * * A rule stays where the consumer wrote it, inside the section it falls in. * The one exception is a rule that sits directly before the next header: it * separates the two sections rather than belonging to the closing one, so it * moves out of the group and renders between them. */ export declare function groupMenuItems(items: readonly TItem[], isSection: (item: MenuItemType) => boolean, isDivider: (item: MenuItemType) => boolean): MenuSectionGroup[]; /** Stable `{#each}` key for one entry — a rule carries no id of its own. */ export declare function menuEntryKey(entry: MenuGroupEntry, resolveId: (item: TItem, fallbackIndex: number) => string): string;