UNPKG

@storybook/angular

Version:

Storybook for Angular: Develop Angular components in isolation with hot reloading.

54 lines (53 loc) 2.44 kB
import { Subject } from 'rxjs'; import { ICollection, StoryFnAngularReturnType } from '../types'; type StoryRenderInfo = { storyFnAngular: StoryFnAngularReturnType; moduleMetadataSnapshot: string; }; export declare abstract class AbstractRenderer { /** * Wait and destroy the platform */ static resetApplications(domNode?: HTMLElement): void; /** * Reset compiled components because we often want to compile the same component with * more than one NgModule. */ protected static resetCompiledComponents: () => Promise<void>; protected previousStoryRenderInfo: Map<HTMLElement, StoryRenderInfo>; protected storyProps$: Subject<ICollection | undefined>; constructor(); protected abstract beforeFullRender(domNode?: HTMLElement): Promise<void>; protected abstract afterFullRender(): Promise<void>; /** * Bootstrap main angular module with main component or send only new `props` with storyProps$ * * @param storyFnAngular {StoryFnAngularReturnType} * @param forced {boolean} If : * - true render will only use the StoryFn `props' in storyProps observable that will update sotry's component/template properties. Improves performance without reloading the whole module&component if props changes * - false fully recharges or initializes angular module & component * @param component {Component} */ render({ storyFnAngular, forced, component, targetDOMNode, }: { storyFnAngular: StoryFnAngularReturnType; forced: boolean; component?: any; targetDOMNode: HTMLElement; }): Promise<void>; /** * Only ASCII alphanumerics can be used as HTML tag name. * https://html.spec.whatwg.org/#elements-2 * * Therefore, stories break when non-ASCII alphanumerics are included in target selector. * https://github.com/storybookjs/storybook/issues/15147 * * This method returns storyId when it doesn't contain any non-ASCII alphanumerics. * Otherwise, it generates a valid HTML tag name from storyId by removing non-ASCII alphanumerics from storyId, prefixing "sb-", and suffixing "-component" * @protected * @memberof AbstractRenderer */ protected generateTargetSelectorFromStoryId(id: string): string; protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string): void; private fullRendererRequired; } export {};