import Component from '@glimmer/component'; import type RouterService from '@ember/routing/router-service'; import type EmberFreestyleService from '../../services/ember-freestyle'; import { type Section, type Subsection } from '../../services/ember-freestyle'; import { TrackedArray, TrackedSet } from 'tracked-built-ins'; export interface FilteredSubsection { name: string; flatIndex: number; isHighlighted: boolean; isActive: boolean; } export interface FilteredSection { section: Section; subsections: FilteredSubsection[]; isExpanded: boolean; isSectionActive: boolean; } interface FlatSubsectionItem { sectionName: string; subsectionName: string; } interface Signature { Args: { includeAllOption?: boolean; }; } export default class FreestyleMenu extends Component { emberFreestyle: EmberFreestyleService; router: RouterService; includeAllOption: boolean; menu: TrackedArray
; expandedSections: TrackedSet; userCollapsedSections: TrackedSet; filterText: string; highlightedIndex: number; /** Stable prefix for element IDs to avoid collisions */ elementIdPrefix: string; get isFiltering(): boolean; get activeDescendantId(): string | undefined; /** * Sections filtered by search text, with expansion state resolved. * Does NOT include highlight/active enrichment — that's in `filteredMenu`. */ get visibleSections(): { section: Section; subsections: Subsection[]; isExpanded: boolean; }[]; /** * Enriches `visibleSections` with highlight/active state and flat indices * for keyboard navigation and scroll spy. Also schedules sidebar * auto-scroll when scroll spy is active. */ get filteredMenu(): FilteredSection[]; get flatSubsectionItems(): FlatSubsectionItem[]; isSectionExpanded(sectionName: string): boolean; onFilterInput(event: Event): void; handleKeydown(event: KeyboardEvent): void; toggleSection(sectionName: string): void; expandSection(sectionName: string): void; moveHighlight(direction: 1 | -1): void; navigateToHighlighted(): void; scrollToSubsection(sectionName: string, subsectionName: string): void; scrollHighlightedIntoView(): void; scrollActiveItemIntoView(): void; } export {};