import * as i0 from '@angular/core'; import { Signal, InjectionToken, OnInit, OnDestroy, ElementRef, EventEmitter, AfterContentInit, OnChanges, AfterViewInit, Injector, ValueProvider } from '@angular/core'; import * as rxjs from 'rxjs'; import * as _zaybu_focusly from '@zaybu/focusly'; type FocuslyItem = FocuslyTargetItem | FocuslyCellItem; type FocuslyTargetItem = { id: string; groupId: number; }; type FocuslyCellItem = FocuslyTargetItem & { row: number; column: number; }; type FocusRequest = { requestId: string; id: string; groupId?: number; preventScroll?: boolean; waitForVisible?: boolean; timeoutMs?: number; }; type FocusAck = { requestId: string; id: string; groupId?: number; success: boolean; reason?: 'not-found' | 'not-visible' | 'not-focusable' | 'timeout'; }; type KeyPressAction = 'up' | 'down' | 'left' | 'right' | 'home' | 'end' | 'pageUp' | 'pageDown'; type FocuslyKeyChord = string | string[]; type FocuslyKeyMap = Partial>; declare const DEFAULT_FOCUSLY_KEYMAP: FocuslyKeyMap; interface FocuslyServiceApi { readonly keyMap: Signal; updateKeymap(partial: FocuslyKeyMap): void; setFocusByElementId(id: string, groupId?: number, opts?: { timeoutMs: number; waitForVisible?: boolean; preventScroll?: boolean; }): Promise; } declare const FOCUSLY_SERVICE_API: InjectionToken; type FocuslyShortcutScope = 'element' | 'group' | 'global'; type FocuslyShortcutHandler = (e: KeyboardEvent) => void; type FocuslyShortcutsMap = Record; type FocuslyShortcuts = FocuslyShortcutsMap | FocuslyShortcutDef[]; /** * Host-friendly "definition" type (no id, key can be string or string[]). * This is what users pass via [focuslyShortcuts]="..." */ interface FocuslyShortcutDef { key: string | string[]; handler: FocuslyShortcutHandler; scope?: FocuslyShortcutScope; groupId?: number; elementId?: string; preventInTextActions?: boolean; priority?: number; description?: string; source?: 'host' | 'child'; } /** * Internal store type (requires id, and keys are already normalised string[]). */ interface FocuslyShortcutRegistration { id: string; keys: string[]; scope: FocuslyShortcutScope; groupId?: number; elementId?: string; preventInTextActions: boolean; priority: number; handler: FocuslyShortcutHandler; description?: string; source?: 'host' | 'child'; } type ShortcutStore = { byChord: Map; byId: Map; }; declare class FocuslyService implements FocuslyServiceApi { private endStopSubject; readonly endStopHit$: rxjs.Observable; private focusRegistry; readonly currentFocus: i0.WritableSignal; private focusKeyMap; private readonly _keymap; readonly keyMap: i0.Signal>>; private readonly keyPressActionHandlers; readonly keyHandlers: i0.Signal void>>; private shortcutGlobal; private shortcutByGroup; private shortcutByElement; private readonly focusRequestSubject; readonly focusRequests$: rxjs.Observable; private readonly focusAckSubject; readonly focusAcks$: rxjs.Observable; private pendingRequests; constructor(); getHandlerForKeyboardEvent(e: KeyboardEvent): (() => void) | undefined; tryHandleShortcutEvent(e: KeyboardEvent, context?: { groupId?: number; elementId?: string; }): boolean; getShortcutHandlerForKeyboardEvent(e: KeyboardEvent, context?: { groupId?: number; elementId?: string; }): ((e: KeyboardEvent) => void) | undefined; updateKeymap(partial: FocuslyKeyMap): void; private cellKey; private getOrCreateStore; private getStore; private recomputeMaximum; onFocus(focus: FocuslyItem): void; up(): void; down(): void; left(): void; right(): void; home(): void; end(): void; pageUp(): void; pageDown(): void; registerItemFocus(focus: FocuslyItem): void; unRegisterItemFocus(focus: FocuslyItem): void; isCurrentFocus(id: string): boolean; registerShortcut(reg: FocuslyShortcutRegistration): void; unregisterShortcut(id: string): void; setFocusByElementId(id: string, groupId?: number, opts?: { timeoutMs?: number; waitForVisible?: boolean; preventScroll?: boolean; }): Promise; ackFocus(ack: FocusAck): void; private findRegisteredFocus; private moveRow; private moveColumn; private moveFocus; private currentFocusMaxRow; private currentFocusMaxColumn; private getOrCreateShortcutStore; private addToStore; private removeFromStore; private isTextInputTarget; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class FocuslyGroupHostDirective { private _groupId?; set focuslyGroupHost(value: number); get focuslyGroupHost(): number | undefined; resolveGroup(): number | undefined; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class FocuslyFocusDirective implements OnInit, OnDestroy { protected readonly groupHost: FocuslyGroupHostDirective | null; set focuslyGroup(group: number); set focuslyElementId(id: string); get focuslyElementId(): string; get focuslyGroup(): number | undefined; protected readonly uniqueId: `${string}-${string}-${string}-${string}-${string}`; protected _focuslyGroup: number | undefined; protected _focuslyElementId: string | undefined; protected readonly elementRef: ElementRef; protected readonly focusService: FocuslyService; private readonly limitHitSubscription; private focusRequestSub?; protected lastRegistered: FocuslyItem | null; private focusRafId; private focusAttempt; private readonly maxFocusAttempts; private activeRequestId; get resolvedGroup(): number | undefined; protected get focusItem(): FocuslyTargetItem; protected onElementFocus: () => void; protected selectCustomElement: (() => void) | undefined; readonly isActive: i0.Signal; get activeClass(): boolean; constructor(); ngOnInit(): void; ngOnDestroy(): void; protected buildItem(): FocuslyTargetItem | null; protected syncRegistration(): void; private cancelFocusRetry; private isActuallyFocusableNow; private didDomFocusLand; private applyDomFocusOnce; private ensureDomFocusForRequest; protected handleFocusIn(event: FocusEvent): void; protected handleFocusOut(event: FocusEvent): void; protected handleMouseDown(event: MouseEvent): void; protected handleKeydown(e: KeyboardEvent): void; protected handleEnterKey(e: Event): void; protected onFocusIn(event: FocusEvent): void; protected onFocusOut(event: FocusEvent): void; protected onMouseDown(event: MouseEvent): void; protected onKeydown(event: KeyboardEvent): void; protected onEnterKey(event: KeyboardEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class FocuslyDirective extends FocuslyFocusDirective implements OnInit, OnDestroy { set focuslyColumn(column: number); set focuslyRow(row: number); get focuslyColumn(): number | undefined; get focuslyRow(): number | undefined; private _focuslyColumn; private _focuslyRow; protected buildItem(): FocuslyCellItem | null; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class FocuslyShortcutDirective { focuslyKey: string | string[]; focuslyShortcutScope: FocuslyShortcutScope; focuslyGroup?: number; focuslyPreventInTextActions: boolean; focuslyPriority: number; focuslyElementId?: string; focuslyDescription?: string; focuslyAction: EventEmitter; /** Host calls this when it needs current declaration */ getRegistration(defaults: { groupId?: number; elementId?: string; }): Omit | null; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class FocuslyShortcutHostDirective implements OnInit, OnDestroy, AfterContentInit, OnChanges { private readonly el; private readonly zone; private readonly focuslyService; private readonly groupHost; focuslyShortcuts: FocuslyShortcuts | null; focuslyIncludeChildShortcuts: boolean; focuslyGroup?: number; focuslyElementId?: string; private readonly childShortcuts?; private keySub?; private childSub?; private readonly hostId; private registeredIds; ngOnInit(): void; ngAfterContentInit(): void; ngOnDestroy(): void; ngOnChanges(): void; private resolveGroupId; private rebuildRegistrations; private unregisterAll; private toRegistrationsFromHostInput; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * @deprecated * This component is deprecated and will be removed in a future version. * * Use {@link FocuslyShortcutDirective} instead: * * ```html *