@ngneat/helipopper
Version:
A Powerful Tooltip and Popover for Angular Applications
1 lines • 72.3 kB
Source Map (JSON)
{"version":3,"file":"ngneat-helipopper.mjs","sources":["../../../../projects/ngneat/helipopper/src/lib/intersection-observer.ts","../../../../projects/ngneat/helipopper/src/lib/utils.ts","../../../../projects/ngneat/helipopper/src/lib/tippy.factory.ts","../../../../projects/ngneat/helipopper/src/lib/inject-tippy.ts","../../../../projects/ngneat/helipopper/src/lib/tippy.service.ts","../../../../projects/ngneat/helipopper/src/lib/coercion.ts","../../../../projects/ngneat/helipopper/src/lib/tippy.directive.ts","../../../../projects/ngneat/helipopper/src/ngneat-helipopper.ts"],"sourcesContent":["// Let's retrieve the native `IntersectionObserver` implementation hidden by\n// `__zone_symbol__IntersectionObserver`. This would be the unpatched version of\n// the observer present in zone.js environments.\n// Otherwise, if the user is using zoneless change detection (and zone.js is not included),\n// we fall back to the native implementation. Accessing the native implementation\n// allows us to remove `runOutsideAngular` calls and reduce indentation,\n// making the code a bit more readable.\nexport const IntersectionObserver: typeof globalThis.IntersectionObserver =\n (globalThis as any)['__zone_symbol__IntersectionObserver'] ||\n globalThis.IntersectionObserver;\n","import { ElementRef } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { auditTime, map } from 'rxjs/operators';\nimport type { TippyElement } from '@ngneat/helipopper/config';\n\nimport { IntersectionObserver } from './intersection-observer';\n\nlet supportsIntersectionObserver = false;\nlet supportsResizeObserver = false;\n\nif (typeof window !== 'undefined') {\n supportsIntersectionObserver = 'IntersectionObserver' in window;\n supportsResizeObserver = 'ResizeObserver' in window;\n}\n\nexport const enum TippyErrorCode {\n TippyNotProvided = 1,\n}\n\nexport function inView(\n host: TippyElement,\n options: IntersectionObserverInit = {\n root: null,\n threshold: 0.3,\n },\n) {\n const element = coerceElement(host);\n\n return new Observable<void>((subscriber) => {\n if (!supportsIntersectionObserver) {\n subscriber.next();\n subscriber.complete();\n return;\n }\n\n const observer = new IntersectionObserver((entries) => {\n // Several changes may occur in the same tick, we want to check the latest entry state.\n const entry = entries[entries.length - 1];\n if (entry.isIntersecting) {\n subscriber.next();\n subscriber.complete();\n }\n }, options);\n\n observer.observe(element);\n\n return () => observer.disconnect();\n });\n}\n\nexport function isElementOverflow(host: HTMLElement): boolean {\n // Don't access the `offsetWidth`/`offsetHeight` multiple times since it triggers layout updates.\n const hostOffsetWidth = host.offsetWidth;\n const hostOffsetHeight = host.offsetHeight;\n\n return (\n hostOffsetWidth > host.parentElement!.offsetWidth ||\n hostOffsetWidth < host.scrollWidth ||\n hostOffsetHeight < host.scrollHeight\n );\n}\n\nexport function overflowChanges(host: TippyElement) {\n const element = coerceElement(host);\n\n return dimensionsChanges(element).pipe(\n auditTime(150),\n map(() => isElementOverflow(element)),\n );\n}\n\nexport function dimensionsChanges(target: HTMLElement) {\n return new Observable<void>((subscriber) => {\n if (!supportsResizeObserver) {\n subscriber.next();\n subscriber.complete();\n return;\n }\n\n const observer = new ResizeObserver(() => subscriber.next());\n observer.observe(target);\n return () => observer.disconnect();\n });\n}\n\nexport function onlyTippyProps(allProps: any) {\n const tippyProps: any = {};\n\n if (!allProps) {\n return tippyProps;\n }\n\n const ownProps = [\n 'useTextContent',\n 'variations',\n 'useHostWidth',\n 'defaultVariation',\n 'beforeRender',\n 'isLazy',\n 'variation',\n 'isEnabled',\n 'className',\n 'onlyTextOverflow',\n 'data',\n 'content',\n 'context',\n 'hideOnEscape',\n 'customHost',\n 'injector',\n 'preserveView',\n 'vcr',\n 'popperWidth',\n 'zIndexGetter',\n 'staticWidthHost',\n 'bindings',\n 'directives',\n ];\n\n const overriddenMethods = ['onShow', 'onHidden', 'onCreate'];\n\n Object.keys(allProps).forEach((prop) => {\n if (!ownProps.includes(prop) && !overriddenMethods.includes(prop)) {\n tippyProps[prop] = allProps[prop];\n }\n });\n\n return tippyProps;\n}\n\nexport function normalizeClassName(className: string | string[]): string[] {\n const classes = typeof className === 'string' ? className.split(' ') : className;\n\n return classes.map((klass) => klass?.trim()).filter(Boolean);\n}\n\nexport function coerceCssPixelValue<T>(value: T): string {\n if (value == null) {\n return '';\n }\n\n return typeof value === 'string' ? value : `${value}px`;\n}\n\nfunction coerceElement(element: TippyElement) {\n return element instanceof ElementRef ? element.nativeElement : element;\n}\n\nlet observer: IntersectionObserver;\nconst elementHiddenHandlers = new WeakMap<Element, () => void>();\nexport function observeVisibility(host: Element, hiddenHandler: () => void) {\n observer ??= new IntersectionObserver((entries: IntersectionObserverEntry[]) => {\n entries.forEach((entry) => {\n if (!entry.isIntersecting) {\n elementHiddenHandlers.get(entry.target)!();\n }\n });\n });\n elementHiddenHandlers.set(host, hiddenHandler);\n observer.observe(host);\n\n return () => {\n elementHiddenHandlers.delete(host);\n observer.unobserve(host);\n };\n}\n","import type tippy from 'tippy.js';\nimport { inject, Injectable, NgZone, ɵisPromise as isPromise } from '@angular/core';\nimport { defer, Observable, of, tap } from 'rxjs';\nimport { TIPPY_LOADER } from '@ngneat/helipopper/config';\n\n@Injectable({ providedIn: 'root' })\nexport class TippyFactory {\n private readonly _ngZone = inject(NgZone);\n\n private readonly _loader = inject(TIPPY_LOADER);\n\n private _tippyImpl$: Observable<typeof tippy> | null = null;\n private _tippy: typeof tippy | null = null;\n\n /**\n * This returns an observable because the user should provide a `loader`\n * function, which may return a promise if the tippy.js library is to be\n * loaded asynchronously.\n */\n getTippyImpl() {\n this._tippyImpl$ ||= defer(() => {\n if (this._tippy) return of(this._tippy);\n\n // Call the `loader` function lazily — only when a subscriber\n // arrives — to avoid importing `tippy.js` on the server.\n const maybeTippy = this._ngZone.runOutsideAngular(() => this._loader());\n\n let tippy$: Observable<typeof tippy>;\n // We need to use `isPromise` instead of checking whether\n // `result instanceof Promise`. In zone.js patched environments, `global.Promise`\n // is the `ZoneAwarePromise`. Some APIs, which are likely not patched by zone.js\n // for certain reasons, might not work with `instanceof`. For instance, the dynamic\n // import `() => import('./chunk.js')` returns a native promise (not a `ZoneAwarePromise`),\n // causing this check to be falsy.\n if (isPromise(maybeTippy)) {\n // This pulls less RxJS symbols compared to using `from()` to resolve a promise value.\n tippy$ = new Observable((subscriber) => {\n maybeTippy.then((tippy) => {\n subscriber.next(tippy.default);\n subscriber.complete();\n });\n });\n } else {\n tippy$ = of(maybeTippy);\n }\n\n return tippy$.pipe(\n tap((tippy) => {\n this._tippy = tippy;\n }),\n );\n });\n\n return this._tippyImpl$;\n }\n}\n","import { inject, InjectionToken } from '@angular/core';\nimport type { TippyInstance } from '@ngneat/helipopper/config';\n\nimport { TippyErrorCode } from './utils';\n\nexport const TIPPY_REF = /* @__PURE__ */ new InjectionToken<TippyInstance>(\n ngDevMode ? 'TIPPY_REF' : '',\n);\n\nexport function injectTippyRef(): TippyInstance {\n const instance = inject(TIPPY_REF, { optional: true });\n\n if (!instance) {\n if (ngDevMode) {\n throw new Error(\n 'tp is not provided in the current context or on one of its ancestors',\n );\n } else {\n throw new Error(`[tp]: ${TippyErrorCode.TippyNotProvided}`);\n }\n }\n\n return instance;\n}\n","import { inject, Injectable, Injector, NgZone, signal } from '@angular/core';\nimport {\n isComponent,\n isTemplateRef,\n ResolveViewRef,\n ViewService,\n} from '@ngneat/overview';\nimport { Content } from '@ngneat/overview';\nimport { map, type Observable } from 'rxjs';\n\nimport {\n CreateOptions,\n ExtendedTippyInstance,\n TIPPY_CONFIG,\n TippyInstance,\n} from '@ngneat/helipopper/config';\n\nimport { TIPPY_REF } from './inject-tippy';\nimport { TippyFactory } from './tippy.factory';\nimport { normalizeClassName, onlyTippyProps } from './utils';\n\n@Injectable({ providedIn: 'root' })\nexport class TippyService {\n private readonly _ngZone = inject(NgZone);\n private readonly _injector = inject(Injector);\n private readonly _globalConfig = inject(TIPPY_CONFIG, { optional: true });\n private readonly _viewService = inject(ViewService);\n private readonly _tippyFactory = inject(TippyFactory);\n\n readonly enabled = signal(true);\n\n enableAll(): void {\n this.enabled.set(true);\n }\n\n disableAll(): void {\n this.enabled.set(false);\n }\n\n create<T extends Content>(\n host: HTMLElement,\n content: T,\n options: Partial<CreateOptions> = {},\n ): Observable<ExtendedTippyInstance<T>> {\n const variation = options.variation || this._globalConfig?.defaultVariation || '';\n const config = {\n onShow: (instance: ExtendedTippyInstance<T>) => {\n host.setAttribute('data-tippy-open', '');\n if (!instance.$viewOptions) {\n instance.$viewOptions = {\n injector: Injector.create({\n providers: [\n {\n provide: TIPPY_REF,\n useValue: instance,\n },\n ],\n parent: options.injector || this._injector,\n }),\n };\n\n if (isTemplateRef(content)) {\n instance.$viewOptions.context = {\n $implicit: instance.hide.bind(instance),\n ...options.context,\n };\n } else if (isComponent(content)) {\n instance.context = options.context;\n instance.data = options.data;\n }\n }\n\n instance.view ||= this._viewService.createView(content, {\n ...options,\n ...instance.$viewOptions,\n }) as ResolveViewRef<T>;\n\n instance.setContent(instance.view.getElement());\n options?.onShow?.(instance);\n },\n onHidden: (instance: ExtendedTippyInstance<T>) => {\n host.removeAttribute('data-tippy-open');\n\n if (!options.preserveView) {\n instance.view?.destroy();\n instance.view = null;\n }\n options?.onHidden?.(instance);\n },\n ...onlyTippyProps(this._globalConfig),\n ...this._globalConfig?.variations?.[variation],\n ...onlyTippyProps(options),\n onCreate: (instance: TippyInstance) => {\n instance.popper.classList.add(`tippy-variation-${variation}`);\n if (options.className) {\n for (const klass of normalizeClassName(options.className)) {\n instance.popper.classList.add(klass);\n }\n }\n this._globalConfig?.onCreate?.(instance);\n options.onCreate?.(instance);\n },\n };\n\n return this._tippyFactory.getTippyImpl().pipe(\n map((tippy) => {\n return this._ngZone.runOutsideAngular(() => {\n return tippy(host, config) as ExtendedTippyInstance<T>;\n });\n }),\n );\n }\n}\n","import { booleanAttribute as originalBooleanAttribute } from '@angular/core';\n\ntype BooleanInput = boolean | `${boolean}` | '' | null | undefined;\n\n/**\n * Transforms a value (typically a string) to a boolean.\n * Intended to be used as a transform function of an input.\n *\n * @see https://material.angular.io/cdk/coercion/overview\n */\nconst coerceBooleanAttribute: (value: BooleanInput) => boolean = originalBooleanAttribute;\n\nexport { coerceBooleanAttribute };\n","import {\n afterEveryRender,\n AfterViewInit,\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n Injector,\n input,\n InputSignal,\n model,\n NgZone,\n OnChanges,\n output,\n PLATFORM_ID,\n SimpleChanges,\n untracked,\n ViewContainerRef,\n type Type,\n} from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport type { Instance } from 'tippy.js';\nimport { combineLatest, firstValueFrom, from, merge, Observable, Subject } from 'rxjs';\nimport { filter, map, switchMap, takeUntil } from 'rxjs/operators';\nimport {\n Content,\n isComponent,\n isString,\n isTemplateRef,\n ViewOptions,\n ViewRef,\n ViewService,\n} from '@ngneat/overview';\n\nimport {\n coerceCssPixelValue,\n dimensionsChanges,\n inView,\n isElementOverflow,\n normalizeClassName,\n observeVisibility,\n onlyTippyProps,\n overflowChanges,\n} from './utils';\nimport {\n TIPPY_CONFIG,\n TIPPY_LOADER_COMPONENT,\n TIPPY_LOADER_TIMING,\n type TippyConfig,\n type TippyContent,\n type TippyInstance,\n type TippyProps,\n} from '@ngneat/helipopper/config';\nimport { TippyFactory } from './tippy.factory';\nimport { TippyService } from './tippy.service';\nimport { coerceBooleanAttribute } from './coercion';\nimport { TIPPY_REF } from './inject-tippy';\n\n// An arrow function defined inside a method closes over the method's lexical scope,\n// causing V8 to allocate a Context object that indirectly references the directive\n// instance — keeping it alive after destroy.\n//\n// A bound function (JSBoundFunction) has no [[context]] field in V8's heap layout;\n// it only stores { bound_target_function, bound_this, bound_arguments }.\n// Binding to `null` produces a context-free callable, breaking the retention chain.\nconst appendTo = function appendTo() {\n return document.fullscreenElement || document.body;\n}.bind(null);\n\n// These are the default values used by `tippy.js`.\n// We are providing them as default input values.\n// The `tippy.js` repository has been archived and is unlikely to\n// change in the future, so it is safe to use these values as defaults.\nconst defaultAppendTo = (() => document.body) as TippyProps['appendTo'];\nconst defaultDelay = 0 as TippyProps['delay'];\nconst defaultDuration = [300, 250] as TippyProps['duration'];\nconst defaultInteractiveBorder = 2 as TippyProps['interactiveBorder'];\nconst defaultMaxWidth = 350 as TippyProps['maxWidth'];\nconst defaultOffset = [0, 10] as TippyProps['offset'];\nconst defaultPlacement = 'top' as TippyProps['placement'];\nconst defaultTrigger = 'mouseenter focus' as TippyProps['trigger'];\nconst defaultTriggerTarget = null as TippyProps['triggerTarget'];\nconst defaultZIndex = 9999 as TippyProps['zIndex'];\nconst defaultAnimation = 'fade' as TippyProps['animation'];\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[tp]',\n exportAs: 'tippy',\n})\nexport class TippyDirective implements OnChanges, AfterViewInit {\n readonly appendTo = input(defaultAppendTo, {\n alias: 'tpAppendTo',\n });\n\n readonly content = input<TippyContent | undefined | null>('', { alias: 'tp' });\n\n readonly delay = input(defaultDelay, {\n alias: 'tpDelay',\n });\n\n readonly duration = input(defaultDuration, {\n alias: 'tpDuration',\n });\n\n readonly hideOnClick = input(true, {\n alias: 'tpHideOnClick',\n });\n\n readonly interactive = input(false, {\n alias: 'tpInteractive',\n });\n\n readonly interactiveBorder = input(defaultInteractiveBorder, {\n alias: 'tpInteractiveBorder',\n });\n\n readonly maxWidth = input(defaultMaxWidth, {\n alias: 'tpMaxWidth',\n });\n\n // Note that some of the input signal types are declared explicitly because the compiler\n // also uses types from `@popperjs/core` and requires a type annotation.\n readonly offset: InputSignal<TippyProps['offset']> = input(defaultOffset, {\n alias: 'tpOffset',\n });\n\n readonly placement: InputSignal<TippyProps['placement']> = input(defaultPlacement, {\n alias: 'tpPlacement',\n });\n\n readonly popperOptions: InputSignal<TippyProps['popperOptions']> = input(\n {},\n {\n alias: 'tpPopperOptions',\n },\n );\n\n readonly showOnCreate = input(false, {\n alias: 'tpShowOnCreate',\n });\n\n readonly trigger = input(defaultTrigger, {\n alias: 'tpTrigger',\n });\n\n readonly triggerTarget = input(defaultTriggerTarget, {\n alias: 'tpTriggerTarget',\n });\n\n readonly zIndex = input(defaultZIndex, {\n alias: 'tpZIndex',\n });\n\n readonly animation = input(defaultAnimation, {\n alias: 'tpAnimation',\n });\n\n readonly useTextContent = input(false, {\n transform: coerceBooleanAttribute,\n alias: 'tpUseTextContent',\n });\n\n readonly isLazy = input(false, {\n transform: coerceBooleanAttribute,\n alias: 'tpIsLazy',\n });\n\n readonly variation = input<string | undefined>(undefined, { alias: 'tpVariation' });\n\n readonly isEnabled = input(true, { alias: 'tpIsEnabled' });\n\n readonly className = input<string | string[]>('', { alias: 'tpClassName' });\n\n readonly onlyTextOverflow = input(false, {\n transform: coerceBooleanAttribute,\n alias: 'tpOnlyTextOverflow',\n });\n\n readonly staticWidthHost = input(false, {\n transform: coerceBooleanAttribute,\n alias: 'tpStaticWidthHost',\n });\n\n readonly data = input<any>(undefined, { alias: 'tpData' });\n\n /** Angular `inputBinding`/`outputBinding`/`twoWayBinding` descriptors forwarded to `createComponent`. */\n readonly bindings = input<ViewOptions['bindings']>(undefined, { alias: 'tpBindings' });\n\n /** Host directives (with optional bindings) forwarded to `createComponent`. */\n readonly directives = input<ViewOptions['directives']>(undefined, {\n alias: 'tpDirectives',\n });\n\n readonly useHostWidth = input(false, {\n transform: coerceBooleanAttribute,\n alias: 'tpUseHostWidth',\n });\n\n readonly hideOnEscape = input(false, {\n transform: coerceBooleanAttribute,\n alias: 'tpHideOnEscape',\n });\n\n readonly tippyProps = input<Record<string, unknown> | undefined>(undefined, {\n alias: 'tpTippyProps',\n });\n\n readonly popperWidth = input<number | string | undefined>(undefined, {\n alias: 'tpPopperWidth',\n });\n\n readonly customHost = input<HTMLElement | undefined>(undefined, { alias: 'tpHost' });\n\n readonly tpOnShow = output<void>({ alias: 'tpOnShow' });\n\n readonly tpOnHide = output<void>({ alias: 'tpOnHide' });\n\n readonly isVisible = model(false, { alias: 'tpIsVisible' });\n\n visible = output<boolean>({ alias: 'tpVisible' });\n\n protected instance!: TippyInstance;\n protected viewRef: ViewRef | null = null;\n protected props!: Partial<TippyConfig>;\n protected variationDefined = false;\n protected viewOptions$: ViewOptions | null = null;\n\n /**\n * We had use `visible` event emitter previously as a `takeUntil` subscriber in multiple places\n * within the directive.\n * This is for internal use only; thus we don't have to deal with the `visible` event emitter\n * and trigger change detections only when the `visible` event is being listened outside\n * in the template (`<button [tippy]=\"...\" (visible)=\"...\"></button>`).\n */\n protected visibleInternal = new Subject<boolean>();\n private visibilityObserverCleanup: VoidFunction | null = null;\n private contentChanged = new Subject<void>();\n\n private host = computed<HTMLElement>(\n () => this.customHost() || this.hostRef.nativeElement,\n );\n\n // It should be a getter because computations are cached until\n // any of the producers change.\n private get hostWidth() {\n return this.host().getBoundingClientRect().width;\n }\n\n private destroyRef = inject(DestroyRef);\n private tippyService = inject(TippyService);\n private isServer =\n // Drop `isPlatformServer` once `ngServeMode` is available during compilation.\n (typeof ngServerMode !== 'undefined' && ngServerMode) ||\n isPlatformServer(inject(PLATFORM_ID));\n private tippyFactory = inject(TippyFactory);\n private destroyed = false;\n private created = false;\n\n protected globalConfig = inject(TIPPY_CONFIG);\n protected injector = inject(Injector);\n protected viewService = inject(ViewService);\n protected vcr = inject(ViewContainerRef);\n protected ngZone = inject(NgZone);\n protected hostRef = inject(ElementRef);\n\n private loaderViewRef: ViewRef | null = null;\n private globalLoaderComponent = inject(TIPPY_LOADER_COMPONENT, { optional: true });\n private loaderTiming = inject(TIPPY_LOADER_TIMING);\n\n constructor() {\n if (this.isServer) return;\n\n this.setupListeners();\n\n // `afterEveryRender` fires synchronously within Angular's CD cycle.\n // This lets us update the enabled/disabled state of the instance BEFORE a\n // synthetic mouseenter event is dispatched, which fixes test timing when\n // Angular-triggered changes (content/style bindings) cause the overflow\n // state to change. ResizeObserver (`overflowChanges`) remains as a fallback\n // for non-Angular-triggered resize events (browser window resize, etc.).\n afterEveryRender({\n read: () => {\n if (!this.onlyTextOverflow()) return;\n untracked(() => this.checkOverflow(isElementOverflow(this.host())));\n },\n });\n\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.instance?.destroy();\n this.destroyView();\n this.visibilityObserverCleanup?.();\n });\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (this.isServer) return;\n\n // `isVisible` and `tippyProps` are not merged into `this.props`; they are\n // handled separately (model signal and direct-spread effect respectively).\n const changedProps = Object.keys(changes)\n .filter((key) => key !== 'isVisible' && key !== 'tippyProps')\n .reduce(\n (accumulator, key) => ({ ...accumulator, [key]: changes[key].currentValue }),\n {} as Partial<TippyConfig>,\n );\n\n // Variation defaults are applied only on the first call or when the variation\n // input itself changes. Re-applying them on every ngOnChanges call would\n // overwrite explicitly-bound inputs (e.g. tpTrigger) with variation defaults\n // whenever any other input (e.g. tpData, tpIsEnabled) changes.\n if (!this.variationDefined || 'variation' in changes) {\n this.variationDefined = true;\n const variation = this.variation() || this.globalConfig.defaultVariation || '';\n this.setProps({\n ...this.globalConfig.variations?.[variation],\n ...this.props,\n ...changedProps,\n });\n } else {\n this.updateProps(changedProps);\n }\n }\n\n ngAfterViewInit() {\n if (this.isServer) return;\n\n const onlyTextOverflow = this.onlyTextOverflow();\n if (this.isLazy()) {\n const hostInView$ = inView(this.host());\n\n if (onlyTextOverflow) {\n hostInView$\n .pipe(\n switchMap(() => this.isOverflowing$()),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe((isElementOverflow) => {\n this.checkOverflow(isElementOverflow);\n });\n } else {\n hostInView$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {\n this.createInstance();\n });\n }\n } else if (onlyTextOverflow) {\n this.isOverflowing$()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((isElementOverflow) => {\n this.checkOverflow(isElementOverflow);\n });\n } else {\n this.createInstance();\n }\n }\n\n destroyView() {\n this.viewOptions$ = null;\n this.viewRef?.destroy();\n this.viewRef = null;\n this.loaderViewRef?.destroy();\n this.loaderViewRef = null;\n }\n\n /**\n * This method is useful when you append to an element that you might remove from the DOM.\n * In such cases we want to hide the tooltip and let it go through the destroy lifecycle.\n * For example, if you have a grid row with an element that you toggle using the display CSS property on hover.\n */\n observeHostVisibility() {\n if (this.isServer) return;\n // We don't want to observe the host visibility if we are appending to the body.\n if (this.props.appendTo && this.props.appendTo !== document.body) {\n this.visibilityObserverCleanup?.();\n return this.visibleInternal\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((isVisible) => {\n if (isVisible) {\n this.visibilityObserverCleanup = observeVisibility(\n this.instance.reference,\n () => {\n this.hide();\n // Because we have animation on the popper it doesn't close immediately doesn't trigger the `tpVisible` event.\n // Tippy is relying on the transitionend event to trigger the `onHidden` callback.\n // https://github.com/atomiks/tippyjs/blob/master/src/dom-utils.ts#L117\n // This event never fires because the popper is removed from the DOM before the transition ends.\n if (this.props.animation) {\n this.onHidden();\n }\n },\n );\n } else {\n this.visibilityObserverCleanup?.();\n }\n });\n }\n }\n\n show() {\n this.instance?.show();\n }\n\n hide() {\n this.instance?.hide();\n }\n\n enable() {\n this.instance?.enable();\n }\n\n disable() {\n this.instance?.disable();\n }\n\n protected updateProps(props: Partial<TippyConfig>) {\n this.setProps({ ...this.props, ...props });\n }\n\n protected setProps(props: Partial<TippyConfig>) {\n this.props = props;\n this.instance?.setProps({ ...onlyTippyProps(props), ...(this.tippyProps() ?? {}) });\n }\n\n protected setStatus(isEnabled: boolean) {\n isEnabled ? this.instance?.enable() : this.instance?.disable();\n }\n\n protected hasContent(): boolean {\n return !!(this.content() || this.useTextContent());\n }\n\n protected async createInstance() {\n if (this.created || !this.hasContent()) {\n return;\n }\n\n this.created = true;\n\n const tippy = await this.ngZone.runOutsideAngular(() => {\n return firstValueFrom(this.tippyFactory.getTippyImpl(), {\n defaultValue: undefined,\n });\n });\n\n if (tippy === undefined || this.destroyRef.destroyed) {\n return;\n }\n\n this.instance = this.ngZone.runOutsideAngular(() => {\n return tippy(this.host(), {\n appendTo,\n allowHTML: true,\n ...(this.globalConfig.zIndexGetter\n ? { zIndex: this.globalConfig.zIndexGetter() }\n : {}),\n ...onlyTippyProps(this.globalConfig),\n ...onlyTippyProps(this.props),\n ...(this.tippyProps() ?? {}),\n // Arrow functions or inline callbacks close over the method's lexical scope,\n // causing V8 to allocate a Context object that indirectly retains the directive\n // instance inside tippy.js after destroy. A JSBoundFunction has no [[Context]]\n // slot — only { bound_target_function, bound_this, bound_arguments } — so no\n // closure context is created. onHide is bound to null because it needs no `this`\n // at all, fully breaking the retention chain (same reasoning as `appendTo` above).\n onMount: this.onMount.bind(this),\n onCreate: this.onCreate.bind(this),\n onShow: this.onShow.bind(this),\n onHide: function (instance: TippyInstance) {\n instance.reference.removeAttribute('data-tippy-open');\n }.bind(null),\n onHidden: this.onHidden.bind(this),\n });\n });\n\n this.setStatus(this.isEnabled());\n this.setProps(this.props);\n\n const variationName = this.variation() || this.globalConfig.defaultVariation || '';\n const variationConfig = this.globalConfig.variations?.[variationName];\n // Check the isContextMenu marker set by withContextMenuVariation so any\n // variation name works. The 'contextMenu' name fallback preserves\n // compatibility with manually-constructed variations that predate this flag.\n (variationConfig?.isContextMenu || variationName === 'contextMenu') &&\n this.handleContextMenu();\n }\n\n // `resolvedContent` is provided when the caller already awaited a lazy factory.\n // Passing it here avoids re-reading `this.content()`, which would still carry\n // the raw factory function type and require another cast.\n protected resolveContent(instance: TippyInstance, resolvedContent?: Type<unknown>) {\n const content = (resolvedContent ?? this.content()) as Content | undefined | null;\n\n if (!this.viewOptions$ && !isString(content)) {\n const injector = Injector.create({\n providers: [\n {\n provide: TIPPY_REF,\n useValue: this.instance,\n },\n ],\n parent: this.injector,\n });\n\n const data = this.data();\n\n if (isComponent(content)) {\n this.instance.data = data;\n\n this.viewOptions$ = {\n injector,\n bindings: this.bindings(),\n directives: this.directives(),\n };\n } else if (isTemplateRef(content)) {\n this.viewOptions$ = {\n injector,\n context: {\n data,\n $implicit: this.hide.bind(this),\n },\n };\n }\n }\n\n let newContent = this.ngZone.run(() => {\n this.viewRef = this.viewService.createView(content!, {\n vcr: this.vcr,\n ...this.viewOptions$,\n });\n\n // We need to call `detectChanges` for OnPush components to update their content.\n if (isComponent(content)) {\n // `ɵcmp` is a component defition set for any component.\n // Checking the `onPush` property of the component definition is a\n // smarter way to determine whether we need to call `detectChanges()`,\n // as users may be unaware of setting the binding.\n const isOnPush = (content as { ɵcmp?: { onPush: boolean } }).ɵcmp?.onPush;\n if (isOnPush) {\n this.viewRef.detectChanges();\n }\n }\n\n return this.viewRef.getElement();\n });\n\n if (this.useTextContent()) {\n newContent = instance.reference.textContent!;\n }\n\n if (isString(newContent) && this.globalConfig.beforeRender) {\n newContent = this.globalConfig.beforeRender(newContent);\n }\n\n return newContent;\n }\n\n protected handleContextMenu() {\n const host = this.host();\n const onContextMenu = (event: MouseEvent) => {\n event.preventDefault();\n\n this.instance.setProps({\n getReferenceClientRect: () =>\n ({\n width: 0,\n height: 0,\n top: event.clientY,\n bottom: event.clientY,\n left: event.clientX,\n right: event.clientX,\n }) as DOMRectReadOnly,\n });\n\n this.instance.show();\n };\n\n host.addEventListener('contextmenu', onContextMenu);\n this.destroyRef.onDestroy(() =>\n host.removeEventListener('contextmenu', onContextMenu),\n );\n }\n\n protected handleEscapeButton(): void {\n const onKeydown = (event: KeyboardEvent) => {\n if (event.code === 'Escape') {\n this.hide();\n }\n };\n\n document.body.addEventListener('keydown', onKeydown);\n\n // Remove listener when `visibleInternal` becomes false.\n const visibleSubscription = this.visibleInternal.subscribe((v) => {\n if (!v) {\n document.body.removeEventListener('keydown', onKeydown);\n visibleSubscription.unsubscribe();\n }\n });\n\n this.destroyRef.onDestroy(() => {\n document.body.removeEventListener('keydown', onKeydown);\n visibleSubscription.unsubscribe();\n });\n }\n\n protected checkOverflow(isElementOverflow: boolean) {\n if (isElementOverflow) {\n if (!this.instance) {\n this.createInstance();\n } else {\n this.instance.enable();\n }\n } else {\n this.instance?.disable();\n }\n }\n\n protected listenToHostResize() {\n dimensionsChanges(this.host())\n .pipe(takeUntil(this.visibleInternal), takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n this.setInstanceWidth(this.instance, this.hostWidth);\n });\n }\n\n protected clearInstanceWidth(instance: Instance) {\n instance.popper.style.width = '';\n instance.popper.style.maxWidth = '';\n (instance.popper.firstElementChild as HTMLElement).style.maxWidth = '';\n }\n\n protected setInstanceWidth(instance: Instance, width: string | number) {\n const inPixels = coerceCssPixelValue(width);\n instance.popper.style.width = inPixels;\n instance.popper.style.maxWidth = inPixels;\n (instance.popper.firstElementChild as HTMLElement).style.maxWidth = inPixels;\n }\n\n private onMount(instance: TippyInstance) {\n const isVisible = true;\n this.isVisible.set(isVisible);\n this.visibleInternal.next(isVisible);\n this.ngZone.run(() => this.visible.emit(isVisible));\n this.useHostWidth() && this.listenToHostResize();\n this.globalConfig.onMount?.(instance);\n }\n\n private onCreate(instance: TippyInstance) {\n instance.popper.classList.add(\n `tippy-variation-${this.variation() || this.globalConfig.defaultVariation}`,\n );\n if (this.className()) {\n for (const klass of normalizeClassName(this.className())) {\n instance.popper.classList.add(klass);\n }\n }\n this.globalConfig.onCreate?.(instance);\n if (this.isVisible() === true) {\n instance.show();\n }\n }\n\n private onHidden(instance: TippyInstance = this.instance) {\n this.destroyView();\n const isVisible = false;\n // `model()` uses `OutputEmitterRef` internally to emit events when the\n // signal changes. If the directive is destroyed, it will throw an error:\n // \"Unexpected emit for destroyed `OutputRef`\".\n if (!this.destroyed) {\n this.isVisible.set(isVisible);\n this.ngZone.run(() => this.visible.emit(isVisible));\n this.tpOnHide.emit();\n }\n this.visibleInternal.next(isVisible);\n\n this.globalConfig.onHidden?.(instance);\n }\n\n private onShow(instance: TippyInstance) {\n // In onlyTextOverflow mode the tooltip must not appear when the host is\n // not overflowing. Returning false from onShow prevents tippy from\n // showing regardless of the instance's enabled/disabled state. This\n // acts as a last-resort guard for cases where checkOverflow() hasn't\n // been called yet (e.g. Angular's scheduler hasn't flushed CD between\n // the content/width change and the trigger event).\n if (this.onlyTextOverflow() && !isElementOverflow(this.host())) {\n return false;\n }\n\n // The outer `onShow` must be synchronous so that `return false` above\n // is seen as a boolean by tippy.js (an `async` function always returns\n // a Promise, which is truthy and would never suppress the show).\n this.handleOnShow(instance);\n }\n\n private async handleOnShow(instance: Instance) {\n instance.reference.setAttribute('data-tippy-open', '');\n\n const maybeContent = this.content();\n const isLazyFactory =\n !isComponentClass(maybeContent) && typeof maybeContent === 'function';\n\n let resolvedContent: Type<unknown> | undefined;\n if (isLazyFactory) {\n const loaderComponent = this.globalLoaderComponent;\n if (loaderComponent) {\n const loaderElement = this.ngZone.run(() => {\n this.loaderViewRef = this.viewService.createView(loaderComponent, {\n vcr: this.vcr,\n });\n return this.loaderViewRef.getElement();\n });\n instance.setContent(loaderElement);\n }\n\n const cancelled = Symbol();\n // combineLatest ensures we swap the loader only when both the component\n // is ready AND the timing observable has emitted — guaranteeing the spinner\n // is visible for at least the configured duration regardless of import speed.\n // takeUntil + takeUntilDestroyed cancel if the tooltip hides or the\n // directive is destroyed mid-flight.\n const result = await firstValueFrom(\n combineLatest([\n from((maybeContent as () => Promise<Type<unknown>>)()),\n this.loaderTiming,\n ]).pipe(\n map(([component]) => component),\n takeUntil(this.visibleInternal.pipe(filter((v) => !v))),\n takeUntilDestroyed(this.destroyRef),\n ),\n { defaultValue: cancelled },\n );\n\n this.loaderViewRef?.destroy();\n this.loaderViewRef = null;\n\n if (result === cancelled) return;\n resolvedContent = result as Type<unknown>;\n }\n\n // For non-lazy content this call is fully synchronous — skipping the\n // await avoids a microtask tick that would otherwise cause a visible flicker.\n const content = this.resolveContent(instance, resolvedContent);\n\n if (isString(content)) {\n instance.setProps({ allowHTML: false });\n\n if (content?.trim()) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n instance.setContent(content);\n this.hideOnEscape() && this.handleEscapeButton();\n\n this.clearInstanceWidth(instance);\n if (this.useHostWidth()) {\n this.setInstanceWidth(instance, this.hostWidth);\n } else if (this.popperWidth()) {\n this.setInstanceWidth(instance, this.popperWidth()!);\n }\n this.globalConfig.onShow?.(instance);\n this.tpOnShow.emit();\n }\n\n private isOverflowing$() {\n const host = this.host();\n const notifiers$ = [overflowChanges(host)];\n\n // We need to handle cases where the host has a static width but the content might change\n if (this.staticWidthHost()) {\n notifiers$.push(\n this.contentChanged.pipe(\n // We need to wait for the content to be rendered before we can check if it's overflowing.\n switchMap(() => {\n return new Observable<boolean>((subscriber) => {\n const id = window.requestAnimationFrame(() => {\n subscriber.next(isElementOverflow(host));\n subscriber.complete();\n });\n\n return () => cancelAnimationFrame(id);\n });\n }),\n ),\n );\n }\n\n return merge(...notifiers$);\n }\n\n private setupListeners(): void {\n effect(() => {\n // Capture signal read to track its changes.\n this.content();\n untracked(() => this.contentChanged.next());\n });\n\n effect(() => this.setStatus(this.tippyService.enabled() && this.isEnabled()));\n\n effect(() => {\n const maxWidth = this.useHostWidth() ? this.hostWidth : defaultMaxWidth;\n untracked(() => this.setProps({ ...this.props, maxWidth }));\n });\n\n effect(() => {\n const isVisible = this.isVisible();\n isVisible ? this.show() : this.hide();\n });\n\n effect(() => {\n const hasContent = this.hasContent();\n\n if (hasContent && !this.instance && !this.isLazy() && !this.onlyTextOverflow()) {\n this.createInstance();\n } else if (!hasContent && this.instance) {\n this.instance.destroy();\n this.instance = null as any;\n this.destroyView();\n this.created = false;\n }\n });\n\n effect(() => {\n const tippyProps = this.tippyProps();\n untracked(() => this.instance?.setProps(tippyProps ?? {}));\n });\n }\n}\n\nfunction isComponentClass(\n content: TippyContent | null | undefined,\n): content is Type<any> {\n return (\n typeof content === 'function' &&\n /^class\\s/.test(Function.prototype.toString.call(content))\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["isPromise","map","originalBooleanAttribute"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,oBAAoB,GAC9B,UAAkB,CAAC,qCAAqC,CAAC;IAC1D,UAAU,CAAC,oBAAoB;;ACFjC,IAAI,4BAA4B,GAAG,KAAK;AACxC,IAAI,sBAAsB,GAAG,KAAK;AAElC,IAAI,OAAO,MAAM,KAAK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