/** * @license * Copyright Datorama. All Rights Reserved. * * Use of this source code is governed by an Apache License 2.0 license that can be * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE */ import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injector, Type, ViewContainerRef, ViewRef } from '@angular/core'; import { ContentType } from '../dynamic-content/dynamic-content.types'; export declare type NewComponentParams = { resolver: ComponentFactoryResolver; component: Type; injector: Injector; projectableNodes?: any[][]; }; export declare type ContentResolverParams = { content: ContentType; resolver: ComponentFactoryResolver; injector: Injector; applicationRef: ApplicationRef; context?: object; vcr?: ViewContainerRef; }; /** * Create dynamic component * * const component = createComponent({ * component: DatoSnackbarComponent, * projectableNodes: contentRef.nodes, * injector: this.injector, * resolver: this.resolver * }); * */ export declare function createComponent({ resolver, component, injector, projectableNodes }: NewComponentParams): ComponentRef; export declare class ContentRef { nodes: any[]; viewRef?: ViewRef; componentRef?: ComponentRef; constructor(nodes: any[], viewRef?: ViewRef, componentRef?: ComponentRef); /** * * @param {ApplicationRef} applicationRef */ destroy(applicationRef: ApplicationRef): void; } /** * * Resolves ng content from a String/TemplateRef/Component * * const contentRef = ngContentResolver({ * applicationRef: this.appRef, * injector: this.injector, * resolver: this.resolver, * content * }); * */ export declare function ngContentResolver({ content, resolver, injector, applicationRef, context, vcr }: ContentResolverParams): ContentRef;