import type { IPortalElementProps } from '../../Primitives/Portal/IPortalElementProps'; import type { PortalProjectionElement } from '../../Primitives/Portal/PortalProjectionElement'; import type { ISheetElementProps } from './ISheetElementProps'; import type { ISheetServiceConfig } from './ISheetServiceConfig'; import { SheetElement } from './SheetElement'; /** * Function type for resolving sheet results. * * @public */ export type SheetResolveFunction = (result: unknown) => void; /** * Represents the `ISheetRef` interface. * * @public */ export interface ISheetRef { sheetId: string; sheetElement: SheetElement; portalProjectionElement: PortalProjectionElement; wrapperElement: HTMLElement; options?: ISheetOptions; resolve?: SheetResolveFunction; } /** * Sheet options interface. * * @public */ export interface ISheetOptions extends Partial, Partial { navigateToClose?: boolean; } /** * Service for managing the display and behavior of sheet elements. * Provides methods to open and close sheets within a portal structure. * * Uses a singleton pattern with static configuration. * * @example * ```typescript * // Configure once at app startup * SheetService.configure({ * closeOnNavigation: true, * behaviors: [] * }); * * // Use throughout the app * const result = await SheetService.instance.open('mySheet', MySheetWrapper); * ``` * * @public */ export declare class SheetService { private static _instance; private static _config; private readonly _sheetMap; private readonly _behaviors; private _portalElement?; /** * Constructs a new instance of the `SheetService` class. * Use `SheetService.configure()` and `SheetService.instance` instead of direct instantiation. * * @private */ private constructor(); /** * Gets the singleton instance of `SheetService`. * If not configured, uses default configuration. * * @public * @static */ static get instance(): SheetService; /** * Configures the `SheetService` globally. * Must be called before accessing `instance` if custom configuration is needed. * Can only be called once; subsequent calls will throw an error. * * @public * @static * @param config - The configuration for the sheet service. * @throws Error if already configured. * * @example * ```typescript * SheetService.configure({ * closeOnNavigation: true, * behaviors: [myCustomBehavior] * }); * ``` */ static configure(config: Partial): void; /** * Opens a custom wrapper component containing a sheet within a portal. * * @public * @template T - Type of the wrapper component extending HTMLElement. * @template TData - Type of data provided to the wrapper component. * @template TResult - Expected return type of the resolved sheet result. * @param sheetId - Unique identifier for the sheet instance. * @param wrapperClass - Class of the wrapper component containing the sheet. * @param options - Properties for portal and sheet. * @param data - Optional data passed to the wrapper component. * @returns A promise resolving with the sheet result. */ open(sheetId: string, wrapperClass: new (args?: TData) => T, options?: ISheetOptions, data?: TData): Promise; /** * Closes the sheet in the wrapper component and optionally removes the wrapper from the DOM. * * @public * @template TResult - Type of result returned when the sheet is closed. * @param sheetId - Unique identifier for the sheet instance. * @param result - Optional result returned when closing the sheet. * @returns A promise resolving once the sheet is fully closed. */ close(sheetId: string, result?: TResult): Promise; /** * Disposes of the service and cleans up resources. * * @public */ dispose(): void; /** * Extends the sheet component by placing it within a portal structure. * * @private * @param element - The element to place within the portal. * @param props - Properties to set on the portal. * @returns The created PortalProjectionElement containing the sheet. */ private extendToPortal; } //# sourceMappingURL=SheetService.d.ts.map