import { EventObject } from '@dojo/core/interfaces'; import { Evented } from '@dojo/core/Evented'; import { Constructor, InjectorFactory, InjectorItem, RegistryLabel, WidgetBaseConstructor, WidgetBaseInterface } from './interfaces'; export declare type WidgetBaseConstructorFunction = () => Promise; export declare type ESMDefaultWidgetBaseFunction = () => Promise>; export declare type RegistryItem = WidgetBaseConstructor | Promise | WidgetBaseConstructorFunction | ESMDefaultWidgetBaseFunction; /** * Widget base symbol type */ export declare const WIDGET_BASE_TYPE: symbol; export interface RegistryEventObject extends EventObject { action: string; item: WidgetBaseConstructor | InjectorFactory; } /** * Widget Registry Interface */ export interface RegistryInterface { /** * Define a WidgetRegistryItem against a label * * @param label The label of the widget to register * @param registryItem The registry item to define */ define(label: RegistryLabel, registryItem: RegistryItem): void; /** * Return a RegistryItem for the given label, null if an entry doesn't exist * * @param widgetLabel The label of the widget to return * @returns The RegistryItem for the widgetLabel, `null` if no entry exists */ get(label: RegistryLabel): Constructor | null; /** * Returns a boolean if an entry for the label exists * * @param widgetLabel The label to search for * @returns boolean indicating if a widget registry item exists */ has(label: RegistryLabel): boolean; /** * Define an Injector against a label * * @param label The label of the injector to register * @param registryItem The injector factory */ defineInjector(label: RegistryLabel, injectorFactory: InjectorFactory): void; /** * Return an Injector registry item for the given label, null if an entry doesn't exist * * @param label The label of the injector to return * @returns The RegistryItem for the widgetLabel, `null` if no entry exists */ getInjector(label: RegistryLabel): InjectorItem | null; /** * Returns a boolean if an injector for the label exists * * @param widgetLabel The label to search for * @returns boolean indicating if a injector registry item exists */ hasInjector(label: RegistryLabel): boolean; } /** * Checks is the item is a subclass of WidgetBase (or a WidgetBase) * * @param item the item to check * @returns true/false indicating if the item is a WidgetBaseConstructor */ export declare function isWidgetBaseConstructor(item: any): item is Constructor; export interface ESMDefaultWidgetBase { default: Constructor; __esModule?: boolean; } export declare function isWidgetConstructorDefaultExport(item: any): item is ESMDefaultWidgetBase; /** * The Registry implementation */ export declare class Registry extends Evented<{}, RegistryLabel, RegistryEventObject> implements RegistryInterface { /** * internal map of labels and RegistryItem */ private _widgetRegistry; private _injectorRegistry; /** * Emit loaded event for registry label */ private emitLoadedEvent(widgetLabel, item); define(label: RegistryLabel, item: RegistryItem): void; defineInjector(label: RegistryLabel, injectorFactory: InjectorFactory): void; get(label: RegistryLabel): Constructor | null; getInjector(label: RegistryLabel): InjectorItem | null; has(label: RegistryLabel): boolean; hasInjector(label: RegistryLabel): boolean; } export default Registry;