{"version":3,"file":"ngrx-busy.mjs","sources":["../../../projects/ngrx-busy/src/lib/spinner.ts","../../../projects/ngrx-busy/src/lib/spinner.html","../../../projects/ngrx-busy/src/lib/busy.ts","../../../projects/ngrx-busy/src/lib/busy.html","../../../projects/ngrx-busy/src/lib/rx-busy.ts","../../../projects/ngrx-busy/src/lib/busy.module.ts","../../../projects/ngrx-busy/src/public-api.ts","../../../projects/ngrx-busy/src/ngrx-busy.ts"],"sourcesContent":["import {\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  ElementRef,\n  Inject,\n  OnDestroy,\n  OnInit,\n  Optional,\n  ViewEncapsulation\n} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {DOCUMENT} from '@angular/common';\nimport {interval, Subject} from 'rxjs';\nimport {distinctUntilChanged, filter, map, startWith, takeUntil} from 'rxjs/operators';\n\nconst BASE_SIZE = 100;\nconst BASE_STROKE_WIDTH = 10;\n\nlet shadowDomIsSupported: boolean;\n\nfunction _getShadowRoot(element: HTMLElement): Node | null {\n  if (shadowDomIsSupported == null) {\n    const head = typeof document !== 'undefined' ? document.head : null;\n    shadowDomIsSupported = !!(head && ((head as any).createShadowRoot || head.attachShadow));\n  }\n\n  if (shadowDomIsSupported) {\n    const rootNode = element.getRootNode ? element.getRootNode() : null;\n\n    // Note that this should be caught by `_supportsShadowDom`, but some\n    // teams have been able to hit this code path on unsupported browsers.\n    if (typeof ShadowRoot !== 'undefined' && ShadowRoot && rootNode instanceof ShadowRoot) {\n      return rootNode;\n    }\n  }\n\n  return null;\n}\n\nconst INDETERMINATE_ANIMATION_TEMPLATE = `\n @keyframes ngrx-progress-spinner-stroke-rotate-DIAMETER {\n    0%      { stroke-dashoffset: START_VALUE;  transform: rotate(0); }\n    12.5%   { stroke-dashoffset: END_VALUE;    transform: rotate(0); }\n    12.5001%  { stroke-dashoffset: END_VALUE;    transform: rotateX(180deg) rotate(72.5deg); }\n    25%     { stroke-dashoffset: START_VALUE;  transform: rotateX(180deg) rotate(72.5deg); }\n    25.0001%   { stroke-dashoffset: START_VALUE;  transform: rotate(270deg); }\n    37.5%   { stroke-dashoffset: END_VALUE;    transform: rotate(270deg); }\n    37.5001%  { stroke-dashoffset: END_VALUE;    transform: rotateX(180deg) rotate(161.5deg); }\n    50%     { stroke-dashoffset: START_VALUE;  transform: rotateX(180deg) rotate(161.5deg); }\n    50.0001%  { stroke-dashoffset: START_VALUE;  transform: rotate(180deg); }\n    62.5%   { stroke-dashoffset: END_VALUE;    transform: rotate(180deg); }\n    62.5001%  { stroke-dashoffset: END_VALUE;    transform: rotateX(180deg) rotate(251.5deg); }\n    75%     { stroke-dashoffset: START_VALUE;  transform: rotateX(180deg) rotate(251.5deg); }\n    75.0001%  { stroke-dashoffset: START_VALUE;  transform: rotate(90deg); }\n    87.5%   { stroke-dashoffset: END_VALUE;    transform: rotate(90deg); }\n    87.5001%  { stroke-dashoffset: END_VALUE;    transform: rotateX(180deg) rotate(341.5deg); }\n    100%    { stroke-dashoffset: START_VALUE;  transform: rotateX(180deg) rotate(341.5deg); }\n  }\n`;\n\n@Component({\n  selector: 'ngrx-spinner',\n  host: {\n    'role': 'progressbar',\n    'class': 'ngrx-progress-spinner',\n    '[style.width.px]': 'diameter',\n    '[style.height.px]': 'diameter'\n  },\n  templateUrl: 'spinner.html',\n  styleUrls: ['spinner.scss'],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class NgrxSpinner implements OnInit, OnDestroy {\n  /**\n   * Tracks diameters of existing instances to de-dupe generated styles (default d = 100).\n   * We need to keep track of which elements the diameters were attached to, because for\n   * elements in the Shadow DOM the style tags are attached to the shadow root, rather\n   * than the document head.\n   */\n\n  private static diameters = new WeakMap<Node, Set<number>>();\n  private readonly unsubscribe$ = new Subject();\n  private readonly fallbackAnimation: boolean = false;\n\n  // tslint:disable-next-line:variable-name\n  private _diameter = BASE_SIZE;\n\n  /**\n   * Element to which we should add the generated style tags for the indeterminate animation.\n   * For most elements this is the document, but for the ones in the Shadow DOM we need to\n   * use the shadow root.\n   */\n  private styleRoot!: Node;\n\n  /** The diameter of the progress spinner (will set width and height of svg). */\n  get diameter(): number { return this._diameter; }\n  set diameter(size: number) {\n    this._diameter = size;\n\n    // If this is set before `ngOnInit`, the style root may not have been resolved yet.\n    if (!this.fallbackAnimation && this.styleRoot) {\n      this.attachStyleNode();\n    }\n    this.cdr.markForCheck();\n  }\n\n  constructor(public elementRef: ElementRef<HTMLElement>,\n              platform: Platform,\n              private readonly cdr: ChangeDetectorRef,\n              @Optional() @Inject(DOCUMENT) private document: any) {\n\n    interval(50).pipe(\n      startWith(0),\n      filter(() => !!this.elementRef && !!this.elementRef.nativeElement && !!this.elementRef.nativeElement.parentElement),\n      map(() => {\n        const {width, height} = this.elementRef.nativeElement.parentElement ? getComputedStyle(this.elementRef.nativeElement.parentElement) : ({width: null, height: null});\n        return {width, height};\n      }),\n      distinctUntilChanged((prev, cur) => prev.height === cur.height && prev.width === cur.width),\n      map(style => Math.min(100, style.height ? parseInt(style.height, 10) : 0, style.width ? parseInt(style.width, 10) : 0)),\n      filter(diameter => diameter > 0),\n      takeUntil(this.unsubscribe$)\n    ).subscribe(diameter => this.diameter = diameter);\n\n    const trackedDiameters = NgrxSpinner.diameters;\n\n    // The base size is already inserted via the component's structural styles. We still\n    // need to track it so we don't end up adding the same styles again.\n    if (!trackedDiameters.has(document.head)) {\n      trackedDiameters.set(document.head, new Set<number>([BASE_SIZE]));\n    }\n\n    this.fallbackAnimation = platform.EDGE || platform.TRIDENT;\n  }\n\n  ngOnInit() {\n    // Note that we need to look up the root node in ngOnInit, rather than the constructor, because\n    // Angular seems to create the element outside the shadow root and then moves it inside, if the\n    // node is inside an `ngIf` and a ShadowDom-encapsulated component.\n    this.styleRoot = _getShadowRoot(this.elementRef.nativeElement) || this.document.head;\n    this.attachStyleNode();\n\n    // On IE and Edge, we can't animate the `stroke-dashoffset`\n    // reliably so we fall back to a non-spec animation.\n    const animationClass = `ngrx-progress-spinner-indeterminate${this.fallbackAnimation ? '-fallback' : ''}-animation`;\n\n    this.elementRef.nativeElement.classList.add(animationClass);\n  }\n\n  ngOnDestroy(): void {\n    this.unsubscribe$.next();\n    this.unsubscribe$.complete();\n  }\n\n  /** The radius of the spinner, adjusted for stroke width. */\n  get circleRadius() {\n    return (this.diameter - BASE_STROKE_WIDTH) / 2;\n  }\n\n  /** The view box of the spinner's svg element. */\n  get viewBox() {\n    const viewBox = this.circleRadius * 2 + this.strokeWidth;\n    return `0 0 ${viewBox} ${viewBox}`;\n  }\n\n  /** The stroke circumference of the svg circle. */\n  get strokeCircumference(): number {\n    return 2 * Math.PI * this.circleRadius;\n  }\n\n  /** The dash offset of the svg circle. */\n  get strokeDashOffset() {\n    return this.strokeCircumference * 0.2;\n  }\n\n  /** Stroke width of the circle in percent. */\n  get circleStrokeWidth() {\n    return this.strokeWidth / this.diameter * 100;\n  }\n\n  /** Stroke width of the progress spinner. */\n  private get strokeWidth(): number {\n    return this.diameter / 10;\n  }\n\n  /** Dynamically generates a style tag containing the correct animation for this diameter. */\n  private attachStyleNode(): void {\n    const styleRoot = this.styleRoot;\n    const currentDiameter = this._diameter;\n    const diameters = NgrxSpinner.diameters;\n    let diametersForElement = diameters.get(styleRoot);\n\n    if (!diametersForElement || !diametersForElement.has(currentDiameter)) {\n      const styleTag: HTMLStyleElement = this.document.createElement('style');\n      styleTag.setAttribute('ngrx-spinner-animation', currentDiameter + '');\n      styleTag.textContent = this.getAnimationText();\n      styleRoot.appendChild(styleTag);\n\n      if (!diametersForElement) {\n        diametersForElement = new Set<number>();\n        diameters.set(styleRoot, diametersForElement);\n      }\n\n      diametersForElement.add(currentDiameter);\n    }\n  }\n\n  /** Generates animation styles adjusted for the spinner's diameter. */\n  private getAnimationText(): string {\n    return INDETERMINATE_ANIMATION_TEMPLATE\n      // Animation should begin at 5% and end at 80%\n      .replace(/START_VALUE/g, `${0.95 * this.strokeCircumference}`)\n      .replace(/END_VALUE/g, `${0.2 * this.strokeCircumference}`)\n      .replace(/DIAMETER/g, `${this.diameter}`);\n  }\n}\n","<svg [style.width.px]=\"diameter\"\n     [style.height.px]=\"diameter\"\n     [attr.viewBox]=\"viewBox\"\n     preserveAspectRatio=\"xMidYMid meet\"\n     focusable=\"false\">\n  <circle cx=\"50%\"\n          cy=\"50%\"\n          [attr.r]=\"circleRadius\"\n          [style.animation-name]=\"'ngrx-progress-spinner-stroke-rotate-' + diameter\"\n          [style.stroke-dashoffset.px]=\"strokeDashOffset\"\n          [style.stroke-dasharray.px]=\"strokeCircumference\"\n          [style.stroke-width.%]=\"circleStrokeWidth\"></circle>\n</svg>\n","import {\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  ComponentFactoryResolver,\n  ComponentRef,\n  ElementRef,\n  HostBinding,\n  Inject,\n  InjectionToken,\n  OnDestroy,\n  Type,\n  ViewChild,\n  ViewContainerRef,\n  ViewEncapsulation\n} from '@angular/core';\nimport {of, Subject} from 'rxjs';\nimport {delay, takeUntil} from 'rxjs/operators';\nimport {NgrxSpinner} from './spinner';\n\nconst BASE_BACKDROP = true;\n// const BASE_DELAY = 0;\n// const BASE_MIN_DURATION = 0;\nconst BASE_TEMPLATE = NgrxSpinner;\n\n/** Default `ngrx-busy` options that can be overridden. */\nexport interface NgrxBusyDefaultOptions {\n  /** A faded backdrop will be shown behind the indicator if true. */\n  backdrop?: boolean;\n  // /** The amount of time to wait until showing the indicator. Specified in milliseconds. */\n  // delay?: number;\n  // /** The amount of time to keep the indicator showing even if the busy thing was completed quicker. Specified in milliseconds. */\n  // minDuration?: number;\n  /**\n   * The template can be a template or a component.\n   * If provided, the custom template will be shown in place of the default indicator template.\n   */\n  template?: Type<any>;\n}\n\n/** Injection token to be used to override the default options for `ngrx-busy`. */\nexport const NGRX_BUSY_DEFAULT_OPTIONS =\n  new InjectionToken<NgrxBusyDefaultOptions>('ngrx-busy-default-options', {\n    providedIn: 'root',\n    factory: NGRX_BUSY_DEFAULT_OPTIONS_FACTORY,\n  });\n\nexport function NGRX_BUSY_DEFAULT_OPTIONS_FACTORY(): NgrxBusyDefaultOptions {\n  return {backdrop: BASE_BACKDROP, /*delay: BASE_DELAY, minDuration: BASE_MIN_DURATION,*/ template: BASE_TEMPLATE};\n}\n\n@Component({\n  selector: 'ngrx-busy, [ngrx-busy]',\n  templateUrl: './busy.html',\n  styleUrls: ['./busy.scss'],\n  exportAs: 'ngrxBusy',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n  host: {\n    class: 'ngrx-busy-container'\n  }\n})\nexport class NgrxBusy implements OnDestroy {\n\n  private readonly unsubscribe$ = new Subject();\n  @ViewChild('loader', {read: ViewContainerRef}) loader!: ViewContainerRef;\n  @HostBinding('class.ngrx-busy-loading')\n  // tslint:disable-next-line:variable-name\n  private _loading = false;\n  private counter = 0;\n  private initialized?: ComponentRef<any>;\n\n  constructor(public elementRef: ElementRef,\n              private readonly cdr: ChangeDetectorRef,\n              private readonly resolver: ComponentFactoryResolver,\n              @Inject(NGRX_BUSY_DEFAULT_OPTIONS) public defaults: NgrxBusyDefaultOptions) {\n  }\n\n  public get loading(): boolean {\n    // return true;\n    return this._loading;\n  }\n\n  ngOnDestroy(): void {\n    this.unsubscribe$.next();\n    this.unsubscribe$.complete();\n  }\n\n  show(): void {\n    if (this.counter === 0) {\n      this._loading = true;\n      this.cdr.detectChanges();\n      const factory = this.resolver.resolveComponentFactory(this.defaults.template || BASE_TEMPLATE);\n      this.initialized = this.loader.createComponent(factory);\n    }\n    this.counter++;\n  }\n\n  hide(): void {\n    if (!this._loading) { return; }\n\n    of(true).pipe(\n      delay(100),\n      takeUntil(this.unsubscribe$)\n    ).subscribe(() => {\n      this.counter = Math.max(0, this.counter - 1);\n      if (this.counter === 0) {\n        this._loading = false;\n        this.cdr.markForCheck();\n      }\n    });\n  }\n}\n","<ng-content></ng-content>\n<div *ngIf=\"loading\"\n     class=\"ngrx-busy-overlap\"\n     [ngClass]=\"{'ngrx-busy-overlap-backdrop': defaults.backdrop && loading}\">\n  <ng-container #loader></ng-container>\n</div>\n","import {from, MonoTypeOperatorFunction, Observable, Operator, Subscriber, Subscription, timer} from 'rxjs';\nimport {InnerSubscriber} from 'rxjs/internal-compatibility';\nimport {first, flatMap, map} from 'rxjs/operators';\n\nimport {NgrxBusy} from './busy';\nimport {SimpleInnerSubscriber} from 'rxjs/internal/innerSubscribe';\n\ndeclare type BusyAccessor = () => NgrxBusy | null;\n\nexport function withBusy<T>(accessor: BusyAccessor): MonoTypeOperatorFunction<T> {\n  // if (!accessor) { throw Error('Busy container is not defined.'); }\n  return (source: Observable<T>) => source.lift(new WithBusyOperator(accessor));\n}\n\nexport function pushBusy<T>(source: Observable<T>): Observable<T> {\n  return source.lift(new PushBusyOperator());\n}\n\nclass WithBusyOperator<T> implements Operator<T, T> {\n  constructor(private readonly accessor: BusyAccessor) {\n  }\n\n  call(subscriber: Subscriber<T>, source: any): any {\n    return source.subscribe(new WithBusySubscriber(subscriber, this.accessor));\n  }\n}\n\nclass WithBusySubscriber<T> extends Subscriber<T> {\n  constructor(destination: Subscriber<T>, readonly accessor: BusyAccessor) {\n    super(destination);\n  }\n}\n\nclass PushBusyOperator<T> implements Operator<T, T> {\n\n  call(subscriber: Subscriber<T>, source: any): any {\n    let accessors: BusyAccessor[];\n    try {\n      accessors = Array.from(this.findBusy(subscriber)).map(busySubscriber => busySubscriber.accessor);\n    } catch (e) {\n      accessors = [];\n    }\n    return source.subscribe(new PushBusySubscriber(subscriber, accessors));\n  }\n\n  private* findBusy(innerSubscriber: Subscriber<T>): IterableIterator<WithBusySubscriber<T>> {\n    if (innerSubscriber instanceof WithBusySubscriber) { yield innerSubscriber; }\n    // @ts-ignore\n    // if (innerSubscriber instanceof InnerSubscriber || innerSubscriber instanceof SimpleInnerSubscriber) { yield* this.findBusy(innerSubscriber.parent); }\n    // @ts-ignore\n    if (innerSubscriber.parent !== undefined) { yield* this.findBusy(innerSubscriber.parent); }\n    // @ts-ignore\n    if (innerSubscriber.destination !== undefined) { yield* this.findBusy(innerSubscriber.destination); }\n  }\n}\n\nclass PushBusySubscriber<T> extends Subscriber<T> {\n  private readonly watcher: Subscription;\n\n  constructor(destination: Subscriber<T>, private readonly accessors: BusyAccessor[]) {\n    super(destination);\n\n    this.watcher = from(accessors)\n      .pipe(flatMap(accessor => timer(0, 50).pipe(map(_ => accessor()), first((busy): busy is NgrxBusy => !!busy))))\n      .subscribe(busy => busy.show());\n  }\n\n  _error(err: any): void {\n    this.hide();\n    super._error(err);\n  }\n\n  _complete(): void {\n    this.hide();\n    super._complete();\n  }\n\n  unsubscribe(): void {\n    this.hide();\n    super.unsubscribe();\n  }\n\n  private hide(): void {\n    this.watcher.unsubscribe();\n    this.accessors\n      .map(accessor => accessor())\n      .filter((busy): busy is NgrxBusy => !!busy)\n      .forEach(container => container.hide());\n  }\n}\n","import {InjectionToken, ModuleWithProviders, NgModule} from '@angular/core';\nimport {NgrxBusy} from './busy';\nimport {CommonModule} from '@angular/common';\nimport {NgrxSpinner} from './spinner';\n\n\n@NgModule({\n  declarations: [NgrxBusy, NgrxSpinner],\n  imports: [\n    CommonModule\n  ],\n  exports: [NgrxBusy]\n})\nexport class NgrxBusyModule {\n  // static forRoot(): ModuleWithProviders<NgrxBusyModule> {\n  //   return {\n  //     ngModule: NgrxBusyModule,\n  //     // providers: [SideNavService]\n  //   };\n  // }\n}\n\n","/*\n * Public API Surface of ngrx-busy\n */\n\nexport * from './lib/busy';\nexport * from './lib/rx-busy';\nexport * from './lib/busy.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAgBA,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,IAAI,oBAA6B,CAAC;AAElC,SAAS,cAAc,CAAC,OAAoB;IAC1C,IAAI,oBAAoB,IAAI,IAAI,EAAE;QAChC,MAAM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