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yBAAoBb,EAA6B,CAAEO,4DAL9CD,GAAqBP,oDAArBO,EAAqBQ,WAFpBT,iCAFH,CAACU,KAAcC,KAAgBC,SAI7BX,GAAb,EAAaA","names":["CarouselElementSlideService","constructor","this","Map","getSlides","hostElement","slides","get","isStorybookRuntime","setSlide","carouselElementSlideElement","elementRef","nativeElement","parentElement","has","add","set","Set","factory","i0","CarouselElementSlideElement","carouselElementSlideService","ngOnInit","selectors","TemplateRef","CarouselElement","CarouselElementModule","injector","componentFactoryResolver","customElements","resolveComponentFactory","selector","define","createCustomElement","bootstrap","CommonModule","CarouselModule","FormsModule"],"sources":["./src/app/carousel-element/carousel-element-slide/carousel-element-slide.service.ts","./src/app/carousel-element/carousel-element-slide/carousel-element-slide.component.html","./src/app/carousel-element/carousel-element-slide/carousel-element-slide.component.ts","./src/app/carousel-element/carousel-element.component.html","./src/app/carousel-element/carousel-element.component.ts","./src/app/carousel-element/carousel-element.module.ts"],"sourcesContent":["import { Injectable } from \"@angular/core\";\n\nimport { isStorybookRuntime } from \"@vattenfall/core\";\n\nimport { CarouselElementSlideElement } from \"./carousel-element-slide.component\";\n\n/**\n * Service that stores all {@link CarouselElementSlideElement} found on a page, by its containing carousel's id. Storing\n * the slides by a carousel id allows for multiple carousels on a page.\n *\n * @privateRemarks\n * The ContentChildren decorator can not (currently) be used to extract elements that are originating outside of Angular\n * (the containing page). This is a workaround for that limitation. Note, when running in Storybook, it is expected that\n * no Carousel host element can be found and all slides will be registered on, and returned by, null as key.\n */\n@Injectable({ providedIn: \"root\" })\nexport class CarouselElementSlideService {\n private readonly slides = new Map>();\n\n getSlides(hostElement: Element) {\n if (isStorybookRuntime) return this.slides.get(null);\n return this.slides.get(hostElement);\n }\n\n setSlide(carouselElementSlideElement: CarouselElementSlideElement) {\n const hostElement = isStorybookRuntime ? null : carouselElementSlideElement.elementRef.nativeElement.parentElement;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (this.slides.has(hostElement)) this.slides.get(hostElement)!.add(carouselElementSlideElement);\n else this.slides.set(hostElement, new Set([carouselElementSlideElement]));\n }\n}\n","\n \n \n \n \n \n \n \n \n \n
\n \n
\n \n \n
\n","/* eslint-disable @angular-eslint/no-input-rename */\nimport { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit, TemplateRef, ViewChild } from \"@angular/core\";\n\nimport { CarouselElementType } from \"../carousel-element.component\";\n\nimport { CarouselElementSlideService } from \"./carousel-element-slide.service\";\n\n@Component({\n selector: \"carousel-element-slide\",\n templateUrl: \"./carousel-element-slide.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CarouselElementSlideElement implements OnInit {\n /** Image alt text for slide */\n @Input(\"image-alt\") imageAlt?: string;\n\n /** Image source for slide */\n @Input(\"image-src\") imageSrc?: string;\n\n type!: CarouselElementType;\n\n @ViewChild(TemplateRef) templateRef!: TemplateRef;\n\n constructor(\n public readonly elementRef: ElementRef,\n private readonly carouselElementSlideService: CarouselElementSlideService\n ) {}\n\n ngOnInit(): void {\n this.carouselElementSlideService.setSlide(this);\n }\n}\n","\n
\n \n \n
\n \n
\n\n \n
\n \n \n \n \n \n
\n
\n\n","import { ChangeDetectionStrategy, Component, Input, ElementRef } from \"@angular/core\";\n\nimport { CarouselElementSlideService } from \"./carousel-element-slide/carousel-element-slide.service\";\n\nexport type CarouselElementType = \"white-blue\" | \"white-grey\" | \"blue-white\" | \"grey-white\";\n\n@Component({\n selector: \"carousel-element\",\n templateUrl: \"./carousel-element.component.html\",\n styleUrls: [\"./carousel-element.component.scss\"],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CarouselElement {\n /** Types of styles for the carousel */\n @Input() type: CarouselElementType = \"white-blue\";\n\n get slides() {\n return this.carouselElementSlideService.getSlides(this.elementRef.nativeElement);\n }\n\n constructor(\n private readonly elementRef: ElementRef,\n private readonly carouselElementSlideService: CarouselElementSlideService\n ) {}\n}\n","import { CommonModule } from \"@angular/common\";\nimport { ComponentFactoryResolver, Injector, NgModule } from \"@angular/core\";\nimport { createCustomElement } from \"@angular/elements\";\nimport { FormsModule } from \"@angular/forms\";\nimport { CarouselModule } from \"@vattenfall/ui\";\n\nimport { CarouselElementSlideElement } from \"./carousel-element-slide/carousel-element-slide.component\";\nimport { CarouselElement } from \"./carousel-element.component\";\n\n@NgModule({\n declarations: [CarouselElement, CarouselElementSlideElement],\n imports: [CommonModule, CarouselModule, FormsModule],\n exports: [CarouselElement, CarouselElementSlideElement],\n bootstrap: [CarouselElement],\n})\nexport class CarouselElementModule {\n constructor(injector: Injector, componentFactoryResolver: ComponentFactoryResolver) {\n if (!customElements.get(componentFactoryResolver.resolveComponentFactory(CarouselElementSlideElement).selector))\n customElements.define(\n componentFactoryResolver.resolveComponentFactory(CarouselElementSlideElement).selector,\n createCustomElement(CarouselElementSlideElement, { injector })\n );\n }\n}\n"],"sourceRoot":"webpack:///","file":"593.js"}