{"version":3,"file":"template-if.mjs","sources":["../../../../libs/template/if/src/lib/model/template-names.ts","../../../../libs/template/if/src/lib/if.directive.ts","../../../../libs/template/if/src/template-if.ts"],"sourcesContent":["import {\n  RxBaseTemplateNames,\n  rxBaseTemplateNames,\n} from '@rx-angular/cdk/template';\n\nexport type rxIfTemplateNames = 'rxThen' | 'rxElse' | rxBaseTemplateNames;\n\nexport const RxIfTemplateNames = {\n  ...RxBaseTemplateNames,\n  then: 'rxThen',\n  else: 'rxElse',\n} as const;\n","import {\n  ChangeDetectorRef,\n  Directive,\n  inject,\n  Injector,\n  Input,\n  isSignal,\n  NgZone,\n  OnChanges,\n  OnDestroy,\n  OnInit,\n  Signal,\n  SimpleChanges,\n  TemplateRef,\n  ViewContainerRef,\n} from '@angular/core';\nimport { coerceAllFactory } from '@rx-angular/cdk/coercing';\nimport { toObservableMicrotaskInternal } from '@rx-angular/cdk/internals/core';\nimport {\n  createTemplateNotifier,\n  RxNotificationKind,\n} from '@rx-angular/cdk/notifications';\nimport {\n  RxStrategyNames,\n  RxStrategyProvider,\n} from '@rx-angular/cdk/render-strategies';\nimport {\n  createTemplateManager,\n  RxTemplateManager,\n} from '@rx-angular/cdk/template';\nimport {\n  merge,\n  NEVER,\n  NextObserver,\n  Observable,\n  ObservableInput,\n  ReplaySubject,\n  Subject,\n  Subscription,\n} from 'rxjs';\nimport { filter, map, mergeAll } from 'rxjs/operators';\nimport {\n  RxIfTemplateNames,\n  rxIfTemplateNames,\n  RxIfViewContext,\n} from './model/index';\n\n/**\n * @Directive IfDirective\n * @description\n *\n * The `RxIf` directive is drop-in replacement for the `NgIf` directive, but with additional features.\n * `RxIf` allows you to bind observables directly without having the need of using the `async`\n * pipe in addition.\n *\n * This enables `rxIf` to completely operate on its own without having to interact with `NgZone`\n * or triggering global change detection.\n *\n * Read more about the RxIf directive in the [official\n *   docs](https://www.rx-angular.io/docs/template/rx-if-directive).\n *\n * @example\n * <app-item *rxIf=\"show$\"></app-item>\n *\n * @docsCategory RxIf\n * @docsPage RxIf\n * @publicApi\n */\n@Directive({\n  selector: '[rxIf]',\n  standalone: true,\n})\nexport class RxIf<T = unknown>\n  implements OnInit, OnChanges, OnDestroy, OnChanges\n{\n  /** @internal */\n  private strategyProvider = inject(RxStrategyProvider);\n  /** @internal */\n  private cdRef = inject(ChangeDetectorRef);\n  /** @internal */\n  private ngZone = inject(NgZone);\n  /** @internal */\n  private viewContainerRef = inject(ViewContainerRef);\n  /** @internal */\n  private injector = inject(Injector);\n  /** @internal */\n  private subscription = new Subscription();\n  /** @internal */\n  private _renderObserver: NextObserver<unknown>;\n  /** @internal */\n  private templateManager: RxTemplateManager<\n    T,\n    RxIfViewContext<T>,\n    rxIfTemplateNames\n  >;\n\n  /**\n   * @description\n   * The Observable or value to representing the condition.\n   *\n   * @example\n   * showHero = true;\n   * showHero$ = new BehaviorSubject<boolean>(true);\n   *\n   * <ng-container *rxIf=\"showHero\">\n   *   <app-hero></app-hero>\n   * </ng-container>\n   *\n   * <ng-container *rxIf=\"showHero$\">\n   *   <app-hero></app-hero>\n   * </ng-container>\n   *\n   * @param { ObservableInput<T> | T } rxIf\n   */\n  @Input() rxIf: ObservableInput<T> | Signal<T> | T;\n\n  /**\n   * @description\n   *\n   * You can change the used `RenderStrategy` by using the `strategy` input of the `*rxIf`. It accepts\n   * an `Observable<RxStrategyNames>` or\n   *   [`RxStrategyNames`](https://github.com/rx-angular/rx-angular/blob/b0630f69017cc1871d093e976006066d5f2005b9/libs/cdk/render-strategies/src/lib/model.ts#L52).\n   *\n   * The default value for strategy is\n   * [`normal`](https://www.rx-angular.io/docs/template/cdk/render-strategies/strategies/concurrent-strategies).\n   *\n   * Read more about this in the\n   * [official docs](https://www.rx-angular.io/docs/template/rx-if-directive#use-render-strategies-strategy).\n   *\n   * @example\n   *\n   * \\@Component({\n   *   selector: 'app-root',\n   *   template: `\n   *     <ng-container *rxIf=\"showHero$; strategy: 'userBlocking'\">\n   *       <app-hero></app-hero>\n   *     </ng-container>\n   *\n   *     <ng-container *rxIf=\"showHero$; strategy: strategy$\">\n   *       <app-hero></app-hero>\n   *     </ng-container>\n   *   `\n   * })\n   * export class AppComponent {\n   *   strategy$ = of('immediate');\n   * }\n   *\n   * @param { string | Observable<string> | undefined } strategyName\n   * @see {@link RxStrategyNames}\n   */\n  @Input('rxIfStrategy')\n  set strategy(strategyName: Observable<RxStrategyNames> | RxStrategyNames) {\n    this.strategyHandler.next(strategyName);\n  }\n\n  /**\n   * @description\n   * Defines the template to be used when the bound value is falsy\n   *\n   * @example\n   * <app-hero *rxIf=\"show$; else: noHero\"></app-hero>\n   * <ng-template #noHero><no-hero></no-hero></ng-template>\n   */\n  @Input('rxIfElse') else: TemplateRef<RxIfViewContext<T>>;\n\n  /**\n   * @description\n   * Defines the template to be used when the bound value is truthy\n   *\n   * @example\n   * <ng-container *rxIf=\"show$; then: hero\"></ng-container>\n   * <ng-template #hero><app-hero></app-hero></ng-template>\n   */\n  @Input('rxIfThen') then: TemplateRef<RxIfViewContext<T>>;\n\n  /**\n   * @description\n   * Defines the template for the suspense state. Will be\n   * shown when the bound Observable is in \"suspense\" state.\n   * Suspense state is active when the current value is undefined or no value\n   * was ever emitted.\n   *\n   * Read more about the reactive context in the\n   * [official docs](https://www.rx-angular.io/docs/template/concepts/reactive-context).\n   *\n   * @example\n   * <app-hero *rxIf=\"show$; suspense: suspenseTemplate\" ></app-hero>\n   * <ng-template #suspenseTemplate>\n   *   <mat-progress-spinner></mat-progress-spinner>\n   * </ng-template>\n   *\n   * @param { TemplateRef<RxIfViewContext> } suspense\n   */\n  @Input('rxIfSuspense') suspense: TemplateRef<RxIfViewContext<T>>;\n\n  /**\n   * @description\n   * Defines the template for the complete state. Will be\n   * shown when the bound Observable is in \"complete\" state.\n   *\n   * Read more about the reactive context in the\n   * [official docs](https://www.rx-angular.io/docs/template/concepts/reactive-context).\n   *\n   * @example\n   * <app-hero *rxIf=\"show$; complete: completeTemplate\" ></app-hero>\n   * <ng-template #completeTemplate>\n   *   <icon>thumbs_up</icon>\n   * </ng-template>\n   *\n   * @param { TemplateRef<RxIfViewContext> } suspense\n   */\n  @Input('rxIfComplete') complete: TemplateRef<RxIfViewContext<T>>;\n\n  /**\n   * @description\n   * Defines the template for the error state. Will be\n   * shown when the bound Observable is in \"error\" state.\n   *\n   * Read more about the reactive context in the\n   * [official docs](https://www.rx-angular.io/docs/template/concepts/reactive-context).\n   *\n   * @example\n   * <app-hero *rxIf=\"show$; error: errorTemplate\" ></app-hero>\n   * <ng-template #errorTemplate>\n   *   <icon>error</icon>\n   * </ng-template>\n   *\n   * @param { TemplateRef<RxIfViewContext> } suspense\n   */\n  @Input('rxIfError') error: TemplateRef<RxIfViewContext<T>>;\n\n  /**\n   * @description\n   * A trigger to manually set the active template. It accepts a `RxNotificationKind`\n   * which determines what template to display. If no template is given, a context\n   * variable resembling the notification state is put into the `Next`\n   * template of the directive\n   *\n   * @example\n   * <ng-container\n   *  *rxIf=\"\n   *    show$;\n   *    let e = error;\n   *    contextTrigger: contextTrigger$\n   * \">\n   *\n   *   <app-hero></app-hero>\n   *   <error *ngIf=\"e\"></error>\n   * </ng-container>\n   *\n   * // trigger template from component.ts\n   * contextTrigger$.next(RxNotificationKind.error)\n   *\n   * @param { Observable<RxNotificationKind> } contextTrigger\n   * @see {@link RxNotificationKind}\n   */\n  @Input('rxIfContextTrigger') contextTrigger?: Observable<RxNotificationKind>;\n\n  /**\n   * @description\n   * A trigger to manually activate the default template. It accepts any value,\n   * on emission it will switch to the let directives default template.\n   *\n   * @example\n   * <ng-container\n   *  *rxIf=\"\n   *    show$;\n   *    suspense: suspense\n   *    nextTrigger: nextTrigger$\n   * \">\n   *\n   *   <app-hero></app-hero>\n   * </ng-container>\n   *\n   * <ng-template #suspense><loader></loader></ng-template>\n   *\n   * // trigger template from component.ts\n   * nextTrigger$.next()\n   *\n   * @param { Observable<unknown> } nextTrigger\n   */\n  @Input('rxIfNextTrigger') nextTrigger?: Observable<unknown>;\n\n  /**\n   * @description\n   * A trigger to manually activate the suspense template. It accepts any value,\n   * on emission it will display the suspense template. If no template is given,\n   * the suspense context variable will be set to true instead.\n   *\n   * @example\n   * <ng-container\n   *  *rxIf=\"\n   *    show$;\n   *    let s = suspense;\n   *    suspenseTrigger: suspenseTrigger$\n   * \">\n   *\n   *   <app-hero></app-hero>\n   *   <loader *ngIf=\"s\"></loader>\n   * </ng-container>\n   *\n   *\n   * // trigger template from component.ts\n   * suspenseTrigger$.next()\n   *\n   * @param { Observable<unknown> } suspenseTrigger\n   */\n  @Input('rxIfSuspenseTrigger') suspenseTrigger?: Observable<unknown>;\n\n  /**\n   * @description\n   * A trigger to manually activate the error template. It accepts any value,\n   * on emission it will display the error template. If no template is given,\n   * the error context variable will be set to true instead.\n   *\n   * @example\n   * <ng-container\n   *  *rxIf=\"\n   *    show$;\n   *    let e = error;\n   *    errorTrigger: errorTrigger$\n   * \">\n   *\n   *   <app-hero></app-hero>\n   *   <error *ngIf=\"e\"></error>\n   * </ng-container>\n   *\n   * // trigger template from component.ts\n   * errorTrigger$.next()\n   *\n   * @param { Observable<unknown> } errorTrigger\n   */\n  @Input('rxIfErrorTrigger') errorTrigger?: Observable<unknown>;\n\n  /**\n   * @description\n   * A trigger to manually activate the complete template. It accepts any value,\n   * on emission it will display the error template. If no template is given,\n   * the complete context variable will complete set to true instead.\n   *\n   * @example\n   * <ng-container\n   *  *rxIf=\"\n   *    show$;\n   *    let c = complete;\n   *    completeTrigger: completeTrigger$\n   * \">\n   *\n   *   <app-hero></app-hero>\n   *   <done *ngIf=\"c\"></done>\n   * </ng-container>\n   *\n   * // trigger template from component.ts\n   * completeTrigger$.next()\n   *\n   * @param { Observable<unknown> } completeTrigger\n   */\n  @Input('rxIfCompleteTrigger') completeTrigger?: Observable<unknown>;\n\n  /**\n   * @description\n   *\n   * Structural directives maintain `EmbeddedView`s within a components' template.\n   * Depending on the bound value as well as the configured `RxRenderStrategy`,\n   * updates processed by the `*rxIf` directive might be asynchronous.\n   *\n   * Whenever a template gets inserted into, or removed from, its parent component, the directive has to inform the\n   *   parent in order to update any view- or contentquery (`@ViewChild`, `@ViewChildren`, `@ContentChild`,\n   *   `@ContentChildren`).\n   *\n   * Read more about this in the\n   * [official\n   *   docs](https://www.rx-angular.io/docs/template/rx-if-directive#local-strategies-and-view-content-queries-parent).\n   *\n   * @example\n   * \\@Component({\n   *   selector: 'app-root',\n   *   template: `\n   *    <app-component>\n   *      <app-item\n   *        *rxIf=\"\n   *          show$;\n   *          parent: true;\n   *        \"\n   *      >\n   *      </app-item>\n   *    </app-component>\n   *   `\n   * })\n   * export class AppComponent {\n   *   show$ = state.select('showItem');\n   * }\n   *\n   * @param {boolean} renderParent\n   *\n   * @deprecated this flag will be dropped soon, as it is no longer required when using signal based view & content queries\n   */\n  @Input('rxIfParent') renderParent = this.strategyProvider.config.parent;\n\n  /**\n   * @description\n   * A flag to control whether `*rxIf` templates are created within `NgZone` or not.\n   * The default value is `true, `*rxIf` will create its `EmbeddedView` inside `NgZone`.\n   *\n   * Event listeners normally trigger zone.\n   * Especially high frequency events can cause performance issues.\n   *\n   * Read more about this in the\n   * [official docs](https://www.rx-angular.io/docs/template/let-directive#working-with-event-listeners-patchzone).\n   *\n   * @example\n   * \\@Component({\n   *   selector: 'app-root',\n   *   template: `\n   *    <app-component>\n   *      <app-item\n   *        *rxIf=\"\n   *          show$;\n   *          patchZone: false;\n   *        \"\n   *        (drag)=\"itemDrag($event)\"\n   *      >\n   *      </app-item>\n   *    </app-component>\n   *   `\n   * })\n   * export class AppComponent {\n   *   show$ = state.select('showItem');\n   * }\n   *\n   * @param {boolean} patchZone\n   */\n  @Input('rxIfPatchZone') patchZone = this.strategyProvider.config.patchZone;\n\n  /**\n   * @description\n   * A `Subject` which emits whenever `*rxIf` rendered a change to the view.\n   * This enables developers to perform actions when rendering has been done.\n   * The `renderCallback` is useful in situations where you\n   * rely on specific DOM properties like the dimensions of an item after it got rendered.\n   *\n   * The `renderCallback` emits the latest value causing the view to update.\n   *\n   * @example\n   * \\@Component({\n   *   selector: 'app-root',\n   *   template: `\n   *    <app-component>\n   *      <app-item\n   *        *rxIf=\"\n   *          show$;\n   *          renderCallback: rendered;\n   *        \"\n   *      >\n   *      </app-item>\n   *    </app-component>\n   *   `\n   * })\n   * export class AppComponent {\n   *  show$ = state.select('showItem');\n   *  // this emits whenever rxIf finished rendering changes\n   *  rendered = new Subject<boolean>();\n   *\n   *   constructor(elementRef: ElementRef<HTMLElement>) {\n   *     rendered.subscribe(() => {\n   *       // item is rendered, we can access its dom now\n   *     })\n   *   }\n   * }\n   *\n   * @param {Subject<boolean>} callback\n   */\n  @Input('rxIfRenderCallback')\n  set renderCallback(callback: NextObserver<boolean>) {\n    this._renderObserver = callback;\n  }\n\n  /** @internal */\n  private triggerHandler = new ReplaySubject<RxNotificationKind>(1);\n\n  /** @internal */\n  private templateNotifier = createTemplateNotifier<T>();\n\n  /** @internal */\n  private readonly strategyHandler = coerceAllFactory<RxStrategyNames>(\n    () => new ReplaySubject<RxStrategyNames | Observable<RxStrategyNames>>(1),\n    mergeAll(),\n  );\n  /** @internal */\n  private readonly rendered$ = new Subject<void>();\n  /** @internal */\n  private get thenTemplate(): TemplateRef<RxIfViewContext<T>> {\n    return this.then ? this.then : this.templateRef;\n  }\n\n  constructor(private readonly templateRef: TemplateRef<RxIfViewContext<T>>) {}\n\n  /** @internal */\n  ngOnInit() {\n    this.subscription.add(\n      merge(\n        this.contextTrigger || NEVER,\n        this.nextTrigger?.pipe(map(() => RxNotificationKind.Next)) || NEVER,\n        this.suspenseTrigger?.pipe(map(() => RxNotificationKind.Suspense)) ||\n          NEVER,\n        this.completeTrigger?.pipe(map(() => RxNotificationKind.Complete)) ||\n          NEVER,\n        this.errorTrigger?.pipe(map(() => RxNotificationKind.Error)) || NEVER,\n      )\n        .pipe(filter((v) => !!v))\n        .subscribe((t) => this.triggerHandler.next(t)),\n    );\n    this.subscription.add(\n      this.templateManager\n        .render(this.templateNotifier.values$)\n        .subscribe((n) => {\n          this.rendered$.next(n);\n          this._renderObserver?.next(n);\n        }),\n    );\n  }\n\n  /** @internal */\n  ngOnChanges(changes: SimpleChanges): void {\n    if (!this.templateManager) {\n      this._createTemplateManager();\n    }\n\n    if (changes.then && !changes.then.firstChange) {\n      this.templateManager.addTemplateRef(\n        RxIfTemplateNames.then,\n        this.thenTemplate,\n      );\n    }\n\n    if (changes.else) {\n      this.templateManager.addTemplateRef(RxIfTemplateNames.else, this.else);\n    }\n\n    if (changes.complete) {\n      this.templateManager.addTemplateRef(\n        RxIfTemplateNames.complete,\n        this.complete,\n      );\n    }\n\n    if (changes.suspense) {\n      this.templateManager.addTemplateRef(\n        RxIfTemplateNames.suspense,\n        this.suspense,\n      );\n      this.templateNotifier.withInitialSuspense(!!this.suspense);\n    }\n\n    if (changes.error) {\n      this.templateManager.addTemplateRef(RxIfTemplateNames.error, this.error);\n    }\n    if (changes.rxIf) {\n      if (isSignal(this.rxIf)) {\n        this.templateNotifier.next(\n          toObservableMicrotaskInternal(this.rxIf, { injector: this.injector }),\n        );\n      } else {\n        this.templateNotifier.next(this.rxIf);\n      }\n    }\n  }\n\n  /** @internal */\n  ngOnDestroy() {\n    this.subscription.unsubscribe();\n  }\n\n  /** @internal */\n  private _createTemplateManager(): void {\n    const getNextTemplate = (value) => {\n      return value\n        ? RxIfTemplateNames.then\n        : this.else\n          ? RxIfTemplateNames.else\n          : undefined;\n    };\n    this.templateManager = createTemplateManager<\n      T,\n      RxIfViewContext<T>,\n      rxIfTemplateNames\n    >({\n      templateSettings: {\n        viewContainerRef: this.viewContainerRef,\n        customContext: (rxIf) => ({ rxIf }),\n      },\n      renderSettings: {\n        cdRef: this.cdRef,\n        parent: coerceBooleanProperty(this.renderParent),\n        patchZone: this.patchZone ? this.ngZone : false,\n        defaultStrategyName: this.strategyProvider.primaryStrategy,\n        strategies: this.strategyProvider.strategies,\n      },\n      notificationToTemplateName: {\n        [RxNotificationKind.Suspense]: (value) =>\n          this.suspense ? RxIfTemplateNames.suspense : getNextTemplate(value),\n        [RxNotificationKind.Next]: (value) => getNextTemplate(value),\n        [RxNotificationKind.Error]: (value) =>\n          this.error ? RxIfTemplateNames.error : getNextTemplate(value),\n        [RxNotificationKind.Complete]: (value) =>\n          this.complete ? RxIfTemplateNames.complete : getNextTemplate(value),\n      },\n      templateTrigger$: this.triggerHandler,\n    });\n    this.templateManager.addTemplateRef(\n      RxIfTemplateNames.then,\n      this.thenTemplate,\n    );\n    this.templateManager.nextStrategy(this.strategyHandler.values$);\n  }\n\n  /** @internal */\n  public static rxIfUseIfTypeGuard: void;\n\n  /**\n   * Assert the correct type of the expression bound to the `ngIf` input within the template.\n   *\n   * The presence of this static field is a signal to the Ivy template type check compiler that\n   * when the `NgIf` structural directive renders its template, the type of the expression bound\n   * to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to\n   * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.\n   */\n  static ngTemplateGuard_rxIf: 'binding';\n\n  /**\n   * Asserts the correct type of the context for the template that `NgIf` will render.\n   *\n   * The presence of this method is a signal to the Ivy template type-check compiler that the\n   * `NgIf` structural directive renders its template with a specific context type.\n   */\n  static ngTemplateContextGuard<T>(\n    dir: RxIf<T>,\n    ctx: any,\n  ): ctx is RxIfViewContext<Exclude<T, false | 0 | '' | null | undefined>> {\n    return true;\n  }\n}\n\n/**\n * @internal\n * @description\n * Coerces a data-bound value (typically a string) to a boolean.\n *\n */\nfunction coerceBooleanProperty(value: unknown): boolean {\n  return value != null && `${value}` !== 'false';\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAOa,MAAA,iBAAiB,GAAG;AAC/B,IAAA,GAAG,mBAAmB;AACtB,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,IAAI,EAAE,QAAQ;;;ACqChB;;;;;;;;;;;;;;;;;;;;AAoBG;MAKU,IAAI,CAAA;AA4Cf;;;;;;;;;;;;;;;;;;;;;;;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