/** * ComponentMapping interface. * @private */ interface ComponentMappingObject { [key: string]: unknown; } /** * LazyComponentMappingObject interface. * @private */ interface LazyComponentMappingObject { [key: string]: lazyMapFunction; } export declare type lazyMapFunction = () => Promise; /** * ComponentMapping singleton. It manages the mapping between AEM component resource types and corresponding * JavaScript component class. * @private */ declare class ComponentMappingImpl { static mapping: ComponentMappingObject; static lazyMapping: LazyComponentMappingObject; static get instance(): ComponentMappingImpl; constructor(); /** * Creates mapping for given resource type(s) and a component class. * @param resourceTypes Resource type(s). * @param clazz Component class that will be associated with given resource type(s). * @protected */ map(resourceTypes: string | string[], clazz: unknown): void; /** * Creates mapping for given resource type(s) and a component class. * @param resourceTypes Resource type(s). * @param clazz Component class that will be associated with given resource type(s). * @protected */ static map(resourceTypes: string | string[], clazz: unknown): void; lazyMap(resourceTypes: string | string[], clazz: lazyMapFunction): void; static lazyMap(resourceTypes: string | string[], clazz: lazyMapFunction): void; /** * Returns object (or `undefined`) matching with given resource type. * @param resourceType Resource type. * @returns Class associated with given resource type or `undefined`. */ get(resourceType: string): T; /** * Returns object (or `undefined`) matching with given resource type. * @param resourceType Resource type. * @returns Class associated with given resource type or `undefined`. */ static get(resourceType: string): T; /** * Returns object (or undefined) matching with given resource type. * * @param {string} resourceType - resource type * @returns {object|undefined} - class associated with given resource type */ getLazy(resourceType: string): Promise; static getLazy(resourceType: string): Promise; } /** * Use to register resource types to Class mapping. * * Example: * ``` * import { MapTo } from '@adobe/aem-spa-component-mapping'; * * class MyComponent { * ... * } * * export default MapTo('my/resource/type')(MyComponent); * ``` * * @param resourceTypes AEM resource type(s). * @returns Function mapping a class with the given resource types. */ declare const MapTo: (resourceTypes: string | string[]) => (clazz: unknown) => void; /** * Use to register resource types to Class mapping in a lazyLoad fashion, with dynamic imports * * Example: * ``` * import { LazyMapTo } from '@adobe/aem-spa-component-mapping'; * * MyComponent.ts: * export class MyComponent { * ... * } * * LazyMapTo('my/resource/type')(MyComponent); * ``` * * @param resourceTypes AEM resource type(s). * @returns Function mapping a class with the given resource types. */ declare const LazyMapTo: (resourceTypes: string | string[]) => (lazyPromise: lazyMapFunction) => void; export { ComponentMappingImpl as ComponentMapping, MapTo, LazyMapTo }; //# sourceMappingURL=ComponentMapping.d.ts.map