Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | import { applicationConfig, componentWrapperDecorator, Meta, moduleMetadata } from '@storybook/angular'; import { AppConfig } from 'src/app/app.config'; import { RouterService } from 'src/app/services/router.service'; import { ForAngularCommonModule } from 'src/lib/for-angular-common.module'; import { NgxRenderingEngine } from 'src/lib/engine'; import { Model, ModelBuilderFunction } from '@decaf-ts/decorator-validation'; import { HeaderComponent } from 'src/app/components/header/header.component'; import { ContainerComponent } from 'src/app/components/container/container.component'; import { BackButtonComponent } from 'src/app/components/back-button/back-button.component'; import { LogoComponent } from 'src/app/components/logo/logo.component'; function getEngine(): void { let engine; try { engine = new NgxRenderingEngine(); Model.setBuilder(Model.fromModel as ModelBuilderFunction); } catch (e: unknown) { console.warn(`Engine already loaded`); } } export function getComponentMeta<C>(imports: unknown[] = [], type: "component" | "page" = "component", args: any = {}): Meta<C> { getEngine(); return { // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs tags: ['autodocs'], parameters: { // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout layout: 'fullscreen', }, decorators: [ applicationConfig(AppConfig), moduleMetadata({ //Imports both components to allow component composition with Storybook imports: [...imports, ForAngularCommonModule, HeaderComponent, ContainerComponent, BackButtonComponent, LogoComponent], providers: [{ provide: RouterService, useValue: RouterService }] }), // Wraps our stories with a decorator componentWrapperDecorator( (story) => type === "component" ? story : `<ion-app> <ion-content [fullscreen]="true"> <main> <app-container size="expand"> ${story} </app-container> </main> </ion-content> </ion-app>` ), ], args: args || {} } } |