import { TemplateResult } from 'lit'; /** * SPA event name constants. * All events use the `pd-spa:` prefix for namespacing. */ export declare const SPA_EVENTS: { /** Fired when the SPA has been initialized */ readonly INIT: "pd-spa:init"; /** Fired to show a toast notification */ readonly TOAST: "pd-spa:toast"; /** Fired for navigation events */ readonly ROUTE: "pd-spa:route"; /** Fired when login was successful */ readonly LOGIN_SUCCESS: "pd-spa:login-success"; /** Fired when locale changes */ readonly LOCALE_CHANGE: "pd-spa:locale-change"; /** Fired by pages to register their sections with the framework. */ readonly REGISTER_SECTIONS: "pd-spa:register-sections"; /** Fired to request app configuration */ readonly APP_CONFIG: "pd-spa:app-config"; }; /** * Type for SPA event names */ export type SpaEventName = (typeof SPA_EVENTS)[keyof typeof SPA_EVENTS]; /** * Toast notification types */ export type ToastType = "success" | "error" | "info"; /** * Detail for toast events */ export interface ToastEventDetail { /** The message to display (can be string or TemplateResult) */ message: string | TemplateResult; /** The type of toast */ type: ToastType; /** Duration in ms before auto-hide (-1 for no auto-hide) */ duration?: number; } /** * Detail for route events */ export interface RouteEventDetail { /** Target route path */ route?: string; /** Element to scroll to */ element?: HTMLElement; } /** * Detail for locale change events */ export interface LocaleChangeEventDetail { /** The new locale code */ locale: string; /** The previous locale code */ previousLocale?: string; } /** * Detail for section registration events dispatched by pages on firstUpdated. * Pages advertise their sections; the framework maintains a per-page registry * used for both menu-ref propagation and direct section-scroll navigation. */ export interface RegisterSectionsEventDetail { /** Route name this page is registering for (must match NavigationPage.name) */ pageName: string; /** Map of section IDs to element references (keys may match MenuElement.sec) */ sections: Record; /** Optional: action creators dispatched once per section on first visibility */ sectionActions?: Record any>; } /** * Detail for login success events */ export interface LoginSuccessEventDetail { /** The authenticated user */ user: { uid: string; email: string | null; emailVerified: boolean; }; } /** * Detail for app config request events */ export interface AppConfigEventDetail { /** Will be populated with the app configuration */ appConf?: unknown; } /** * Detail for pd-action events (from data-pd-action links/buttons). * These events are dispatched by scoped click interceptors on containers * that render HTML with data-pd-action attributes. */ export interface PdActionEventDetail { /** Action type: "route", "section", "wizard", "url", or custom */ action: string; /** Action target: route path, section ID, wizard key, or URL */ target: string; } /** * Map of event names to their detail types. * Use with CustomEvent */ export interface SpaEventMap { [SPA_EVENTS.INIT]: void; [SPA_EVENTS.TOAST]: ToastEventDetail; [SPA_EVENTS.ROUTE]: RouteEventDetail; [SPA_EVENTS.LOGIN_SUCCESS]: LoginSuccessEventDetail; [SPA_EVENTS.LOCALE_CHANGE]: LocaleChangeEventDetail; [SPA_EVENTS.REGISTER_SECTIONS]: RegisterSectionsEventDetail; [SPA_EVENTS.APP_CONFIG]: AppConfigEventDetail; } /** * Dispatch a toast event */ export declare function dispatchToast(target: EventTarget, message: string | TemplateResult, type?: ToastType, duration?: number): void; /** * Dispatch a route event */ export declare function dispatchRoute(target: EventTarget, route?: string, element?: HTMLElement): void; /** * Dispatch an init event */ export declare function dispatchInit(target?: EventTarget): void; /** * Dispatch a locale change event */ export declare function dispatchLocaleChange(target: EventTarget, locale: string, previousLocale?: string): void; /** * Type guard to check if an event is a SPA toast event */ export declare function isToastEvent(event: Event): event is CustomEvent; /** * Type guard to check if an event is a SPA route event */ export declare function isRouteEvent(event: Event): event is CustomEvent; //# sourceMappingURL=spa-events.d.ts.map