1 | import { Application } from '../application';
|
2 | import { EventDispatcher, Event, EventMap } from './events';
|
3 | import { DeclarationOption } from './options/declaration';
|
4 | export interface ComponentHost {
|
5 | readonly application: Application;
|
6 | }
|
7 | export interface Component extends AbstractComponent<ComponentHost> {
|
8 | }
|
9 | export interface ComponentClass<T extends Component, O extends ComponentHost = ComponentHost> extends Function {
|
10 | new (owner: O): T;
|
11 | }
|
12 | export interface ComponentOptions {
|
13 | name?: string;
|
14 | childClass?: Function;
|
15 | internal?: boolean;
|
16 | }
|
17 | export declare function Component(options: ComponentOptions): ClassDecorator;
|
18 | export declare function Option(options: DeclarationOption): PropertyDecorator;
|
19 | export declare class ComponentEvent extends Event {
|
20 | owner: ComponentHost;
|
21 | component: AbstractComponent<ComponentHost>;
|
22 | static ADDED: string;
|
23 | static REMOVED: string;
|
24 | constructor(name: string, owner: ComponentHost, component: AbstractComponent<ComponentHost>);
|
25 | }
|
26 | export declare const DUMMY_APPLICATION_OWNER: unique symbol;
|
27 | export declare abstract class AbstractComponent<O extends ComponentHost> extends EventDispatcher implements ComponentHost {
|
28 | private _componentOwner;
|
29 | componentName: string;
|
30 | private _componentOptions?;
|
31 | constructor(owner: O | typeof DUMMY_APPLICATION_OWNER);
|
32 | protected initialize(): void;
|
33 | protected bubble(name: Event | EventMap | string, ...args: any[]): this;
|
34 | getOptionDeclarations(): DeclarationOption[];
|
35 | readonly application: Application;
|
36 | readonly owner: O;
|
37 | }
|
38 | export declare abstract class ChildableComponent<O extends ComponentHost, C extends Component> extends AbstractComponent<O> {
|
39 | private _componentChildren?;
|
40 | private _defaultComponents?;
|
41 | constructor(owner: O | typeof DUMMY_APPLICATION_OWNER);
|
42 | getComponent(name: string): C | undefined;
|
43 | getComponents(): C[];
|
44 | hasComponent(name: string): boolean;
|
45 | addComponent<T extends C>(name: string, componentClass: T | ComponentClass<T, O>): T;
|
46 | removeComponent(name: string): C | undefined;
|
47 | removeAllComponents(): void;
|
48 | }
|