@rx-angular/template
Version:
**Fully** Reactive Component Template Rendering in Angular. @rx-angular/template aims to be a reflection of Angular's built in renderings just reactive.
1 lines • 44.3 kB
Source Map (JSON)
{"version":3,"file":"template-virtual-view.mjs","sources":["../../../../libs/template/virtual-view/src/lib/virtual-view.config.ts","../../../../libs/template/virtual-view/src/lib/model.ts","../../../../libs/template/virtual-view/src/lib/virtual-view-cache.ts","../../../../libs/template/virtual-view/src/lib/virtual-view.directive.ts","../../../../libs/template/virtual-view/src/lib/virtual-view-content.directive.ts","../../../../libs/template/virtual-view/src/lib/resize-observer.ts","../../../../libs/template/virtual-view/src/lib/virtual-view-observer.directive.ts","../../../../libs/template/virtual-view/src/lib/virtual-view-placeholder.directive.ts","../../../../libs/template/virtual-view/src/template-virtual-view.ts"],"sourcesContent":["import { InjectionToken, Provider } from '@angular/core';\nimport { RxStrategyNames } from '@rx-angular/cdk/render-strategies';\n\nexport const VIRTUAL_VIEW_CONFIG_TOKEN =\n new InjectionToken<RxVirtualViewConfig>('VIRTUAL_VIEW_CONFIG_TOKEN', {\n providedIn: 'root',\n factory: () => VIRTUAL_VIEW_CONFIG_DEFAULT,\n });\n\nexport interface RxVirtualViewConfig {\n keepLastKnownSize: boolean;\n useContentVisibility: boolean;\n useContainment: boolean;\n placeholderStrategy: RxStrategyNames<string>;\n contentStrategy: RxStrategyNames<string>;\n cacheEnabled: boolean;\n startWithPlaceholderAsap: boolean;\n cache: {\n /**\n * The maximum number of contents that can be stored in the cache.\n * Defaults to 20.\n */\n contentCacheSize: number;\n\n /**\n * The maximum number of placeholders that can be stored in the cache.\n * Defaults to 20.\n */\n placeholderCacheSize: number;\n };\n}\n\nexport const VIRTUAL_VIEW_CONFIG_DEFAULT: RxVirtualViewConfig = {\n keepLastKnownSize: false,\n useContentVisibility: false,\n useContainment: true,\n placeholderStrategy: 'low',\n contentStrategy: 'normal',\n startWithPlaceholderAsap: false,\n cacheEnabled: true,\n cache: {\n contentCacheSize: 20,\n placeholderCacheSize: 20,\n },\n};\n\n/**\n * Provides a configuration object for the `VirtualView` service.\n *\n * Can be used to customize the behavior of the `VirtualView` service.\n *\n * Default configuration:\n * - contentCacheSize: 20\n * - placeholderCacheSize: 20\n *\n * Example usage:\n *\n * ```ts\n * import { provideVirtualViewConfig } from '@rx-angular/template/virtual-view';\n *\n * const appConfig: ApplicationConfig = {\n * providers: [\n * provideVirtualViewConfig({\n * contentCacheSize: 50,\n * placeholderCacheSize: 50,\n * }),\n * ],\n * };\n * ```\n *\n * @developerPreview\n *\n * @param config - The configuration object.\n * @returns An object that can be provided to the `VirtualView` service.\n */\nexport function provideVirtualViewConfig(\n config: Partial<\n RxVirtualViewConfig & { cache?: Partial<RxVirtualViewConfig['cache']> }\n >,\n): Provider {\n return {\n provide: VIRTUAL_VIEW_CONFIG_TOKEN,\n useValue: {\n ...VIRTUAL_VIEW_CONFIG_DEFAULT,\n ...config,\n cache: { ...VIRTUAL_VIEW_CONFIG_DEFAULT.cache, ...(config?.cache ?? {}) },\n },\n } satisfies Provider;\n}\n","import { TemplateRef, ViewContainerRef } from '@angular/core';\nimport { Observable } from 'rxjs';\n\n/**\n * @internal\n */\nexport interface _RxVirtualViewContent {\n viewContainerRef: ViewContainerRef;\n templateRef: TemplateRef<unknown>;\n}\n\n/**\n * @internal\n */\nexport interface _RxVirtualViewPlaceholder {\n templateRef: TemplateRef<unknown>;\n}\n\n/**\n * @internal\n */\nexport abstract class _RxVirtualViewObserver {\n abstract observeElementVisibility(\n virtualView: HTMLElement,\n ): Observable<boolean>;\n abstract observeElementSize(\n element: Element,\n options?: ResizeObserverOptions,\n ): Observable<ResizeObserverEntry>;\n}\n\n/**\n * @internal\n */\nexport abstract class _RxVirtualView {\n abstract registerContent(content: _RxVirtualViewContent): void;\n abstract registerPlaceholder(placeholder: _RxVirtualViewPlaceholder): void;\n}\n","import { inject, Injectable, OnDestroy, ViewRef } from '@angular/core';\nimport { VIRTUAL_VIEW_CONFIG_TOKEN } from './virtual-view.config';\n\n/**\n * A service that caches templates and placeholders to optimize view rendering.\n * It makes sure that all cached resources are cleared when the service is destroyed.\n *\n * @developerPreview\n */\n@Injectable()\nexport class VirtualViewCache implements OnDestroy {\n #config = inject(VIRTUAL_VIEW_CONFIG_TOKEN);\n\n // Maximum number of content that can be stored in the cache.\n #contentCacheSize = this.#config.cache.contentCacheSize;\n\n // Cache for storing content views, identified by a unique key, which is the directive instance.\n #contentCache = new Map<unknown, ViewRef>();\n\n // Maximum number of placeholders that can be stored in the cache.\n #placeholderCacheSize = this.#config.cache.placeholderCacheSize;\n\n // Cache for storing placeholder views, identified by a unique key.\n #placeholderCache = new Map<unknown, ViewRef>();\n\n /**\n * Stores a placeholder view in the cache. When the cache reaches its limit,\n * the oldest entry is removed.\n *\n * @param key - The key used to identify the placeholder in the cache.\n * @param view - The ViewRef of the placeholder to cache.\n */\n storePlaceholder(key: unknown, view: ViewRef) {\n if (this.#placeholderCacheSize <= 0) {\n view.destroy();\n return;\n }\n if (this.#placeholderCache.size >= this.#placeholderCacheSize) {\n this.#removeOldestEntry(this.#placeholderCache);\n }\n this.#placeholderCache.set(key, view);\n }\n\n /**\n * Retrieves a cached placeholder view using the specified key.\n *\n * @param key - The key of the placeholder to retrieve.\n * @returns The ViewRef of the cached placeholder, or undefined if not found.\n */\n getPlaceholder(key: unknown) {\n const view = this.#placeholderCache.get(key);\n this.#placeholderCache.delete(key);\n return view;\n }\n\n /**\n * Stores a content view in the cache. When the cache reaches its limit,\n * the oldest entry is removed.\n *\n * @param key - The key used to identify the content in the cache.\n * @param view - The ViewRef of the content to cache.\n */\n storeContent(key: unknown, view: ViewRef) {\n if (this.#contentCacheSize <= 0) {\n view.destroy();\n return;\n }\n if (this.#contentCache.size >= this.#contentCacheSize) {\n this.#removeOldestEntry(this.#contentCache);\n }\n this.#contentCache.set(key, view);\n }\n\n /**\n * Retrieves a cached content view using the specified key.\n *\n * @param key - The key of the content to retrieve.\n * @returns The ViewRef of the cached content, or undefined if not found.\n */\n getContent(key: unknown) {\n const view = this.#contentCache.get(key);\n this.#contentCache.delete(key);\n return view;\n }\n\n /**\n * Clears both content and placeholder caches for a given key.\n *\n * @param key - The key of the content and placeholder to remove.\n */\n clear(key: unknown) {\n this.#contentCache.get(key)?.destroy();\n this.#contentCache.delete(key);\n this.#placeholderCache.get(key)?.destroy();\n this.#placeholderCache.delete(key);\n }\n\n /**\n * Clears all cached resources when the service is destroyed.\n */\n ngOnDestroy() {\n this.#contentCache.forEach((view) => view.destroy());\n this.#placeholderCache.forEach((view) => view.destroy());\n this.#contentCache.clear();\n this.#placeholderCache.clear();\n }\n\n #removeOldestEntry(cache: Map<unknown, ViewRef>) {\n const oldestValue = cache.entries().next().value;\n if (oldestValue !== undefined) {\n const [key, view] = oldestValue;\n view?.destroy();\n cache.delete(key);\n }\n }\n}\n","import {\n AfterContentInit,\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n ElementRef,\n EmbeddedViewRef,\n inject,\n input,\n OnDestroy,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n RxStrategyNames,\n RxStrategyProvider,\n} from '@rx-angular/cdk/render-strategies';\nimport { NEVER, Observable, ReplaySubject } from 'rxjs';\nimport {\n distinctUntilChanged,\n finalize,\n map,\n switchMap,\n tap,\n} from 'rxjs/operators';\nimport {\n _RxVirtualView,\n _RxVirtualViewContent,\n _RxVirtualViewObserver,\n _RxVirtualViewPlaceholder,\n} from './model';\nimport { VIRTUAL_VIEW_CONFIG_TOKEN } from './virtual-view.config';\nimport { VirtualViewCache } from './virtual-view-cache';\n\n/**\n * The RxVirtualView directive is a directive that allows you to create virtual views.\n *\n * It can be used on an element/component to create a virtual view.\n *\n * It works by using 3 directives:\n * - `rxVirtualViewContent`: The content to render when the virtual view is visible.\n * - `rxVirtualViewPlaceholder`: The placeholder to render when the virtual view is not visible.\n * - `rxVirtualViewObserver`: The directive that observes the virtual view and emits a boolean value indicating whether the virtual view is visible.\n *\n * The `rxVirtualViewObserver` directive is mandatory for the `rxVirtualView` directive to work.\n * And it needs to be a sibling of the `rxVirtualView` directive.\n *\n * @example\n * ```html\n * <div rxVirtualViewObserver>\n * <div rxVirtualView>\n * <div *rxVirtualViewContent>Virtual View 1</div>\n * <div *rxVirtualViewPlaceholder>Loading...</div>\n * </div>\n * </div>\n * ```\n *\n * @developerPreview\n */\n@Directive({\n selector: '[rxVirtualView]',\n host: {\n '[style.--rx-vw-h]': 'height()',\n '[style.--rx-vw-w]': 'width()',\n '[style.min-height]': 'minHeight()',\n '[style.min-width]': 'minWidth()',\n '[style.contain]': 'containment()',\n '[style.contain-intrinsic-width]': 'intrinsicWidth()',\n '[style.contain-intrinsic-height]': 'intrinsicHeight()',\n '[style.content-visibility]': 'useContentVisibility() ? \"auto\" : null',\n },\n providers: [{ provide: _RxVirtualView, useExisting: RxVirtualView }],\n})\nexport class RxVirtualView\n implements AfterContentInit, _RxVirtualView, OnDestroy\n{\n readonly #observer = inject(_RxVirtualViewObserver, { optional: true });\n readonly #elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n readonly #strategyProvider = inject<RxStrategyProvider>(RxStrategyProvider);\n readonly #viewCache = inject(VirtualViewCache, { optional: true });\n readonly #destroyRef = inject(DestroyRef);\n readonly #config = inject(VIRTUAL_VIEW_CONFIG_TOKEN);\n\n #content: _RxVirtualViewContent | null = null;\n #placeholder: _RxVirtualViewPlaceholder | null = null;\n\n /**\n * Useful when we want to cache the templates and placeholders to optimize view rendering.\n *\n * Enabled by default.\n */\n readonly cacheEnabled = input(this.#config.cacheEnabled, {\n transform: booleanAttribute,\n });\n\n /**\n * Whether to start with the placeholder asap or not.\n *\n * If `true`, the placeholder will be rendered immediately, without waiting for the content to be visible.\n * This is useful when you want to render the placeholder immediately, but you don't want to wait for the content to be visible.\n *\n * This is to counter concurrent rendering, and to avoid flickering.\n */\n readonly startWithPlaceholderAsap = input(\n this.#config.startWithPlaceholderAsap,\n {\n transform: booleanAttribute,\n },\n );\n\n /**\n * This will keep the last known size of the host element while the content is visible.\n */\n readonly keepLastKnownSize = input(this.#config.keepLastKnownSize, {\n transform: booleanAttribute,\n });\n\n /**\n * Whether to use content visibility or not.\n *\n * It will add the `content-visibility` CSS class to the host element, together with\n * `contain-intrinsic-width` and `contain-intrinsic-height` CSS properties.\n */\n readonly useContentVisibility = input(this.#config.useContentVisibility, {\n transform: booleanAttribute,\n });\n\n /**\n * Whether to use containment or not.\n *\n * It will add `contain` css property with:\n * - `size layout paint`: if `useContentVisibility` is `true` && placeholder is visible\n * - `content`: if `useContentVisibility` is `false` || content is visible\n */\n readonly useContainment = input(this.#config.useContainment, {\n transform: booleanAttribute,\n });\n\n /**\n * The strategy to use for rendering the placeholder.\n */\n readonly placeholderStrategy = input<RxStrategyNames<string>>(\n this.#config.placeholderStrategy,\n );\n\n /**\n * The strategy to use for rendering the content.\n */\n readonly contentStrategy = input<RxStrategyNames<string>>(\n this.#config.contentStrategy,\n );\n\n /**\n * A function extracting width & height from a ResizeObserverEntry\n */\n readonly extractSize =\n input<(entry: ResizeObserverEntry) => { width: number; height: number }>(\n defaultExtractSize,\n );\n\n /**\n * ResizeObserverOptions\n */\n readonly resizeObserverOptions = input<ResizeObserverOptions>();\n\n readonly #placeholderVisible = signal(false);\n\n #contentIsShown = false;\n\n readonly #visible$ = new ReplaySubject<boolean>(1);\n\n readonly size = signal({ width: 0, height: 0 });\n\n readonly width = computed(() =>\n this.size().width ? `${this.size().width}px` : 'auto',\n );\n\n readonly height = computed(() =>\n this.size().height ? `${this.size().height}px` : 'auto',\n );\n\n readonly containment = computed(() => {\n if (!this.useContainment()) {\n return null;\n }\n return this.useContentVisibility() && this.#placeholderVisible()\n ? 'size layout paint'\n : 'content';\n });\n\n readonly intrinsicWidth = computed(() => {\n if (!this.useContentVisibility()) {\n return null;\n }\n return this.width() === 'auto' ? 'auto' : `auto ${this.width()}`;\n });\n readonly intrinsicHeight = computed(() => {\n if (!this.useContentVisibility()) {\n return null;\n }\n return this.height() === 'auto' ? 'auto' : `auto ${this.height()}`;\n });\n\n readonly minHeight = computed(() => {\n return this.keepLastKnownSize() && this.#placeholderVisible()\n ? this.height()\n : null;\n });\n readonly minWidth = computed(() => {\n return this.keepLastKnownSize() && this.#placeholderVisible()\n ? this.width()\n : null;\n });\n\n constructor() {\n if (!this.#observer) {\n throw new Error(\n 'RxVirtualView expects you to provide a RxVirtualViewObserver',\n );\n }\n }\n\n ngAfterContentInit() {\n if (!this.#content) {\n throw new Error(\n 'RxVirtualView expects you to provide a RxVirtualViewContent',\n );\n }\n if (this.startWithPlaceholderAsap()) {\n this.renderPlaceholder();\n }\n\n this.#observer\n ?.observeElementVisibility(this.#elementRef.nativeElement)\n .pipe(takeUntilDestroyed(this.#destroyRef))\n .subscribe((visible) => this.#visible$.next(visible));\n\n this.#visible$\n .pipe(\n distinctUntilChanged(),\n switchMap((visible) => {\n if (visible) {\n return this.#contentIsShown\n ? NEVER\n : this.showContent$().pipe(\n switchMap((view) => {\n const resize$ = this.#observer!.observeElementSize(\n this.#elementRef.nativeElement,\n this.resizeObserverOptions(),\n );\n view.detectChanges();\n return resize$;\n }),\n map(this.extractSize()),\n tap(({ width, height }) => this.size.set({ width, height })),\n );\n }\n return this.#placeholderVisible() ? NEVER : this.showPlaceholder$();\n }),\n finalize(() => {\n this.#viewCache!.clear(this);\n }),\n takeUntilDestroyed(this.#destroyRef),\n )\n .subscribe();\n }\n\n ngOnDestroy() {\n this.#content = null;\n this.#placeholder = null;\n }\n\n registerContent(content: _RxVirtualViewContent) {\n this.#content = content;\n }\n\n registerPlaceholder(placeholder: _RxVirtualViewPlaceholder) {\n this.#placeholder = placeholder;\n }\n\n /**\n * Shows the content using the configured rendering strategy (by default: normal).\n * @private\n */\n private showContent$(): Observable<EmbeddedViewRef<unknown>> {\n return this.#strategyProvider.schedule(\n () => {\n this.#contentIsShown = true;\n this.#placeholderVisible.set(false);\n const placeHolder = this.#content!.viewContainerRef.detach();\n if (this.cacheEnabled() && placeHolder) {\n this.#viewCache!.storePlaceholder(this, placeHolder);\n } else if (!this.cacheEnabled() && placeHolder) {\n placeHolder.destroy();\n }\n const tmpl =\n (this.#viewCache!.getContent(this) as EmbeddedViewRef<unknown>) ??\n this.#content!.templateRef.createEmbeddedView({});\n this.#content!.viewContainerRef.insert(tmpl);\n placeHolder?.detectChanges();\n\n return tmpl;\n },\n { scope: this, strategy: this.contentStrategy() },\n );\n }\n\n /**\n * Shows the placeholder using the configured rendering strategy (by default: low).\n * @private\n */\n private showPlaceholder$() {\n return this.#strategyProvider.schedule(() => this.renderPlaceholder(), {\n scope: this,\n strategy: this.placeholderStrategy(),\n });\n }\n\n /**\n * Renders a placeholder within the view container, and hides the content.\n *\n * If we already have a content and cache enabled, we store the content in\n * the cache, so we can reuse it later.\n *\n * When we want to render the placeholder, we try to get it from the cache,\n * and if it is not available, we create a new one.\n *\n * Then insert the placeholder into the view container and trigger a CD.\n */\n private renderPlaceholder() {\n this.#placeholderVisible.set(true);\n this.#contentIsShown = false;\n\n const content = this.#content!.viewContainerRef.detach();\n\n if (content) {\n if (this.cacheEnabled()) {\n this.#viewCache!.storeContent(this, content);\n } else {\n content.destroy();\n }\n\n content?.detectChanges();\n }\n\n if (this.#placeholder) {\n const placeholderRef =\n this.#viewCache!.getPlaceholder(this) ??\n this.#placeholder.templateRef.createEmbeddedView({});\n\n this.#content!.viewContainerRef.insert(placeholderRef);\n placeholderRef.detectChanges();\n }\n }\n}\n\nconst defaultExtractSize = (entry: ResizeObserverEntry) => ({\n width: entry.borderBoxSize[0].inlineSize,\n height: entry.borderBoxSize[0].blockSize,\n});\n","import {\n Directive,\n inject,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport { _RxVirtualViewContent } from './model';\nimport { RxVirtualView } from './virtual-view.directive';\n\n/**\n * The RxVirtualViewTemplate directive is a directive that allows you to create a content template for the virtual view.\n *\n * It can be used on an element/component to create a content template for the virtual view.\n *\n * It needs to be a sibling of the `rxVirtualView` directive.\n *\n * @example\n * ```html\n * <div rxVirtualViewObserver>\n * <div rxVirtualView>\n * <div *rxVirtualViewContent>Virtual View 1</div>\n * <div *rxVirtualViewPlaceholder>Loading...</div>\n * </div>\n * </div>\n * ```\n *\n * @developerPreview\n */\n@Directive({ selector: '[rxVirtualViewContent]', standalone: true })\nexport class RxVirtualViewContent implements _RxVirtualViewContent {\n #virtualView = inject(RxVirtualView);\n viewContainerRef = inject(ViewContainerRef);\n constructor(public templateRef: TemplateRef<unknown>) {\n this.#virtualView.registerContent(this);\n }\n}\n","import { DestroyRef, inject, Injectable } from '@angular/core';\nimport { Observable, ReplaySubject, Subject } from 'rxjs';\nimport { distinctUntilChanged, finalize } from 'rxjs/operators';\n\n/**\n * A service that observes the resize of the elements.\n *\n * @developerPreview\n */\n@Injectable()\nexport class RxaResizeObserver {\n #destroyRef = inject(DestroyRef);\n #resizeObserver = new ResizeObserver((entries) => {\n entries.forEach((entry) => {\n if (this.#elements.has(entry.target))\n this.#elements.get(entry.target)!.next(entry);\n });\n });\n\n /** @internal */\n #elements = new Map<Element, Subject<ResizeObserverEntry>>();\n\n constructor() {\n this.#destroyRef.onDestroy(() => {\n this.#elements.clear();\n this.#resizeObserver.disconnect();\n });\n }\n\n observeElement(\n element: Element,\n options?: ResizeObserverOptions,\n ): Observable<ResizeObserverEntry> {\n const resizeEvent$ = new ReplaySubject<ResizeObserverEntry>(1);\n this.#elements.set(element, resizeEvent$);\n this.#resizeObserver.observe(element, options);\n\n return resizeEvent$.pipe(\n distinctUntilChanged(),\n finalize(() => {\n this.#resizeObserver.unobserve(element);\n this.#elements.delete(element);\n }),\n );\n }\n}\n","import {\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n OnDestroy,\n OnInit,\n} from '@angular/core';\nimport {\n BehaviorSubject,\n combineLatest,\n Observable,\n ReplaySubject,\n Subject,\n} from 'rxjs';\nimport { distinctUntilChanged, finalize, map } from 'rxjs/operators';\nimport { _RxVirtualViewObserver } from './model';\nimport { RxaResizeObserver } from './resize-observer';\nimport { VirtualViewCache } from './virtual-view-cache';\n\n/**\n * The RxVirtualViewObserver directive observes the virtual view and emits a boolean value indicating whether the virtual view is visible.\n * This is the container for the RxVirtualView directives.\n *\n * This is a mandatory directive for the RxVirtualView directives to work.\n *\n * @example\n * ```html\n * <div rxVirtualViewObserver>\n * <div rxVirtualView>\n * <div *rxVirtualViewContent>Virtual View 1</div>\n * <div *rxVirtualViewPlaceholder>Loading...</div>\n * </div>\n * </div>\n * ```\n *\n * @developerPreview\n */\n@Directive({\n selector: '[rxVirtualViewObserver]',\n standalone: true,\n providers: [\n VirtualViewCache,\n RxaResizeObserver,\n { provide: _RxVirtualViewObserver, useExisting: RxVirtualViewObserver },\n ],\n})\nexport class RxVirtualViewObserver\n extends _RxVirtualViewObserver\n implements OnInit, OnDestroy\n{\n #elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n #observer: IntersectionObserver | null = null;\n\n #resizeObserver = inject(RxaResizeObserver, { self: true });\n\n /**\n * The root element to observe.\n *\n * If not provided, the root element is the element that the directive is attached to.\n */\n root = input<ElementRef | HTMLElement | null>();\n\n /**\n * The root margin to observe.\n *\n * This is useful when you want to observe the virtual view in a specific area of the root element.\n */\n rootMargin = input('');\n\n /**\n * The threshold to observe.\n *\n * If you want to observe the virtual view when it is partially visible, you can set the threshold to a number between 0 and 1.\n *\n * For example, if you set the threshold to 0.5, the virtual view will be observed when it is half visible.\n */\n threshold = input<number | number[]>(0);\n\n #rootElement = computed(() => {\n const root = this.root();\n if (root) {\n if (root instanceof ElementRef) {\n return root.nativeElement;\n }\n return root;\n } else if (root === null) {\n return null;\n }\n return this.#elementRef.nativeElement;\n });\n\n #elements = new Map<Element, Subject<boolean>>();\n\n #forcedHidden$ = new BehaviorSubject(false);\n\n ngOnInit(): void {\n this.#observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (this.#elements.has(entry.target))\n this.#elements.get(entry.target)?.next(entry.isIntersecting);\n });\n },\n {\n root: this.#rootElement(),\n rootMargin: this.rootMargin(),\n threshold: this.threshold(),\n },\n );\n }\n\n ngOnDestroy() {\n this.#elements.clear();\n this.#observer?.disconnect();\n this.#observer = null;\n }\n\n /**\n * Hide all the virtual views.\n *\n * This is useful when you want to hide all the virtual views when the user cannot see them.\n *\n * For example, when the user opens a modal, you can hide all the virtual views to improve performance.\n *\n * **IMPORTANT:**\n *\n * Don't forget to call `showAllVisible()` when you want to show the virtual views again.\n */\n hideAll(): void {\n this.#forcedHidden$.next(true);\n }\n\n /**\n * Show all the virtual views that are currently visible.\n *\n * This needs to be called if `hideAll()` was called before.\n */\n showAllVisible(): void {\n this.#forcedHidden$.next(false);\n }\n\n observeElementVisibility(virtualView: HTMLElement) {\n const isVisible$ = new ReplaySubject<boolean>(1);\n\n // Store the view and the visibility state in the map.\n // This allows us to retrieve the visibility state later.\n this.#elements.set(virtualView, isVisible$);\n\n // Start observing the virtual view immediately.\n this.#observer?.observe(virtualView);\n\n return combineLatest([isVisible$, this.#forcedHidden$]).pipe(\n map(([isVisible, forcedHidden]) => (forcedHidden ? false : isVisible)),\n distinctUntilChanged(),\n finalize(() => {\n this.#observer?.unobserve(virtualView);\n this.#elements.delete(virtualView);\n }),\n );\n }\n\n observeElementSize(\n element: Element,\n options?: ResizeObserverOptions,\n ): Observable<ResizeObserverEntry> {\n return this.#resizeObserver.observeElement(element, options);\n }\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\nimport { _RxVirtualView, _RxVirtualViewPlaceholder } from './model';\n\n/**\n * The RxVirtualViewPlaceholder directive is a directive that allows you to create a placeholder for the virtual view.\n *\n * It can be used on an element/component to create a placeholder for the virtual view.\n *\n * It needs to be a sibling of the `rxVirtualView` directive.\n *\n * @example\n * ```html\n * <div rxVirtualViewObserver>\n * <div rxVirtualView>\n * <div *rxVirtualViewContent>Virtual View 1</div>\n * <div *rxVirtualViewPlaceholder>Loading...</div>\n * </div>\n * </div>\n * ```\n *\n * @developerPreview\n */\n@Directive({ selector: '[rxVirtualViewPlaceholder]', standalone: true })\nexport class RxVirtualViewPlaceholder implements _RxVirtualViewPlaceholder {\n #virtualView = inject(_RxVirtualView);\n constructor(public templateRef: TemplateRef<unknown>) {\n this.#virtualView.registerPlaceholder(this);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAGO,MAAM,yBAAyB,GACpC,IAAI,cAAc,CAAsB,2BAA2B,EAAE;AACnE,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,2BAA2B;AAC3C,CAAA,CAAC;AAyBG,MAAM,2BAA2B,GAAwB;AAC9D,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,cAAc,EAAE,IAAI;AACpB,IAAA,mBAAmB,EAAE,KAAK;AAC1B,IAAA,eAAe,EAAE,QAAQ;AACzB,IAAA,wBAAwB,EAAE,KAAK;AAC/B,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,KAAK,EAAE;AACL,QAAA,gBAAgB,EAAE,EAAE;AACpB,QAAA,oBAAoB,EAAE,EAAE;AACzB,KAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACG,SAAU,wBAAwB,CACtC,MAEC,EAAA;IAED,OAAO;AACL,QAAA,OAAO,EAAE,yBAAyB;AAClC,QAAA,QAAQ,EAAE;AACR,YAAA,GAAG,2BAA2B;AAC9B,YAAA,GAAG,MAAM;AACT,YAAA,KAAK,EAAE,EAAE,GAAG,2BAA2B,CAAC,KAAK,EAAE,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE;AAC1E,SAAA;KACiB;AACtB;;ACtEA;;AAEG;MACmB,sBAAsB,CAAA;AAQ3C;AAED;;AAEG;MACmB,cAAc,CAAA;AAGnC;;AClCD;;;;;AAKG;MAEU,gBAAgB,CAAA;AAC3B,IAAA,OAAO,GAAG,MAAM,CAAC,yBAAyB,CAAC;;IAG3C,iB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