ng-primitives 0.99.5 → 0.99.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -222,9 +222,10 @@ function injectStyleInjector() {
222
222
  * @returns The resize event as an Observable.
223
223
  */
224
224
  function fromResizeEvent(element, { disabled = signal(false), injector } = {}) {
225
+ const platformId = injector?.get(PLATFORM_ID) ?? inject(PLATFORM_ID);
225
226
  return new Observable(observable => {
226
227
  // ResizeObserver may not be available in all environments, so check for its existence
227
- if (isUndefined(window?.ResizeObserver)) {
228
+ if (isPlatformServer(platformId) || isUndefined(window?.ResizeObserver)) {
228
229
  // ResizeObserver is not available (SSR or unsupported browser)
229
230
  // Complete the observable without emitting any values
230
231
  observable.complete();
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-internal.mjs","sources":["../../../../packages/ng-primitives/internal/src/utilities/element-ref.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation-manager.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation.ts","../../../../packages/ng-primitives/internal/src/signals/explicit-effect.ts","../../../../packages/ng-primitives/internal/src/style-injector/style-injector.ts","../../../../packages/ng-primitives/internal/src/utilities/resize.ts","../../../../packages/ng-primitives/internal/src/utilities/dom-removal.ts","../../../../packages/ng-primitives/internal/src/utilities/mutation-observer.ts","../../../../packages/ng-primitives/internal/src/utilities/overflow.ts","../../../../packages/ng-primitives/internal/src/utilities/scrolling.ts","../../../../packages/ng-primitives/internal/src/ng-primitives-internal.ts"],"sourcesContent":["import { ElementRef, inject } from '@angular/core';\n\n/**\n * A simple utility function to inject an element reference with less boilerplate.\n * @returns The element reference.\n */\nexport function injectElementRef<T extends HTMLElement>(): ElementRef<T> {\n return inject(ElementRef);\n}\n","import { ClassProvider, inject, Injectable } from '@angular/core';\nimport type { NgpExitAnimation } from './exit-animation';\n\n@Injectable()\nexport class NgpExitAnimationManager {\n /** Store the instances of the exit animation directive. */\n private readonly instances: NgpExitAnimation[] = [];\n\n /** Add an instance to the manager. */\n add(instance: NgpExitAnimation): void {\n this.instances.push(instance);\n }\n\n /** Remove an instance from the manager. */\n remove(instance: NgpExitAnimation): void {\n const index = this.instances.indexOf(instance);\n if (index !== -1) {\n this.instances.splice(index, 1);\n }\n }\n\n /** Exit all instances. */\n async exit(): Promise<void> {\n await Promise.all(this.instances.map(instance => instance.exit()));\n }\n}\n\nexport function provideExitAnimationManager(): ClassProvider {\n return { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager };\n}\n\nexport function injectExitAnimationManager(): NgpExitAnimationManager {\n return inject(NgpExitAnimationManager);\n}\n","import { Directive, OnDestroy } from '@angular/core';\nimport { injectElementRef } from '../utilities/element-ref';\nimport { injectExitAnimationManager } from './exit-animation-manager';\n\n@Directive({\n selector: '[ngpExitAnimation]',\n exportAs: 'ngpExitAnimation',\n})\nexport class NgpExitAnimation implements OnDestroy {\n /** The animation manager. */\n private readonly animationManager = injectExitAnimationManager();\n /** Access the element reference. */\n protected readonly elementRef = injectElementRef();\n\n /** Exist animation reference. */\n protected readonly ref = setupExitAnimation({ element: this.elementRef.nativeElement });\n\n constructor() {\n this.animationManager.add(this);\n }\n\n ngOnDestroy(): void {\n this.animationManager.remove(this);\n }\n\n /** Mark the element as exiting. */\n async exit(): Promise<void> {\n await this.ref.exit();\n }\n}\n\ninterface NgpExitAnimationOptions {\n /** The element to animate. */\n element: HTMLElement;\n}\n\nexport interface NgpExitAnimationRef {\n /** Mark the element as exiting and wait for the animation to finish. */\n exit: () => Promise<void>;\n}\n\nexport function setupExitAnimation({ element }: NgpExitAnimationOptions): NgpExitAnimationRef {\n let state: 'enter' | 'exit' = 'enter';\n\n function setState(newState: 'enter' | 'exit') {\n state = newState;\n\n // remove all current animation state attributes\n element.removeAttribute('data-enter');\n element.removeAttribute('data-exit');\n\n // add the new animation state attribute\n if (state === 'enter') {\n element.setAttribute('data-enter', '');\n } else if (state === 'exit') {\n element.setAttribute('data-exit', '');\n }\n }\n\n // Set the initial state to 'enter'\n requestAnimationFrame(() => setState('enter'));\n\n return {\n exit: () => {\n return new Promise((resolve, reject) => {\n setState('exit');\n\n const animations = element.getAnimations();\n\n // Wait for the exit animations to finish\n if (animations.length > 0) {\n Promise.all(animations.map(anim => anim.finished))\n .then(() => resolve())\n .catch(err => {\n if (err instanceof Error && err.name !== 'AbortError') {\n return reject(err);\n }\n // Ignore abort errors as they are expected when the animation is interrupted\n // by the removal of the element - e.g. when the user navigates away to another page\n resolve();\n });\n } else {\n resolve();\n }\n });\n },\n };\n}\n","/**\n * This implementation is heavily inspired by the great work on ngextension!\n * https://github.com/ngxtension/ngxtension-platform/blob/main/libs/ngxtension/explicit-effect/src/explicit-effect.ts\n */\nimport {\n CreateEffectOptions,\n EffectCleanupRegisterFn,\n EffectRef,\n effect,\n untracked,\n} from '@angular/core';\n\n/**\n * We want to have the Tuple in order to use the types in the function signature\n */\ntype ExplicitEffectValues<T> = {\n [K in keyof T]: () => T[K];\n};\n\n/**\n * This explicit effect function will take the dependencies and the function to run when the dependencies change.\n * @param deps - The dependencies that the effect will run on\n * @param fn - The function to run when the dependencies change\n * @param options - The options for the effect with the addition of defer (it allows the computation to run on first change, not immediately)\n */\nexport function explicitEffect<Input extends readonly unknown[], Params = Input>(\n deps: readonly [...ExplicitEffectValues<Input>],\n fn: (deps: Params, onCleanup: EffectCleanupRegisterFn) => void,\n options?: CreateEffectOptions,\n): EffectRef {\n return effect(onCleanup => {\n const depValues = deps.map(s => s());\n untracked(() => fn(depValues as Params, onCleanup));\n }, options);\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { CSP_NONCE, inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n/**\n * A utility service for injecting styles into the document.\n * Angular doesn't allow directives to specify styles, only components.\n * As we ship directives, occasionally we need to associate styles with them.\n * This service allows us to programmatically inject styles into the document.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class StyleInjector {\n /**\n * Access the CSP nonce\n */\n private readonly cspNonce = inject(CSP_NONCE, { optional: true });\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Detect the platform.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n /**\n * Store the map of style elements with their unique identifiers.\n */\n private readonly styleElements = new Map<string, HTMLStyleElement>();\n\n constructor() {\n if (isPlatformBrowser(this.platformId)) {\n this.collectServerStyles();\n }\n }\n\n /**\n * Inject a style into the document.\n * @param id The unique identifier for the style.\n * @param style The style to inject.\n */\n add(id: string, style: string): void {\n if (this.styleElements.has(id)) {\n return;\n }\n\n const styleElement = this.document.createElement('style');\n styleElement.setAttribute('data-ngp-style', id);\n styleElement.textContent = style;\n\n // If a CSP nonce is provided, set it on the style element\n if (this.cspNonce) {\n styleElement.setAttribute('nonce', this.cspNonce);\n }\n\n this.document.head.appendChild(styleElement);\n this.styleElements.set(id, styleElement);\n }\n\n /**\n * Remove a style from the document.\n * @param id The unique identifier for the style.\n */\n remove(id: string): void {\n const styleElement = this.styleElements.get(id);\n\n if (styleElement) {\n this.document.head.removeChild(styleElement);\n this.styleElements.delete(id);\n }\n }\n\n /**\n * Collect any styles that were rendered by the server.\n */\n private collectServerStyles(): void {\n const styleElements = this.document.querySelectorAll<HTMLStyleElement>('style[data-ngp-style]');\n\n styleElements.forEach(styleElement => {\n const id = styleElement.getAttribute('data-ngp-style');\n\n if (id) {\n this.styleElements.set(id, styleElement);\n }\n });\n }\n}\n\nexport function injectStyleInjector(): StyleInjector {\n return inject(StyleInjector);\n}\n","import { DestroyRef, effect, inject, Injector, signal, Signal, untracked } from '@angular/core';\nimport { isUndefined, safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { Observable, Subscription } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { explicitEffect } from '../signals/explicit-effect';\nimport { injectElementRef } from './element-ref';\n\ninterface NgpResizeObserverOptions {\n /**\n * Whether to listen for events.\n */\n disabled?: Signal<boolean>;\n\n /**\n * The injector to use when called from outside of the injector context.\n */\n injector?: Injector;\n}\n\n/**\n * A simple helper function to create a resize observer as an RxJS Observable.\n * @param element The element to observe for resize events.\n * @returns The resize event as an Observable.\n */\nexport function fromResizeEvent(\n element: HTMLElement,\n { disabled = signal(false), injector }: NgpResizeObserverOptions = {},\n): Observable<Dimensions> {\n return new Observable(observable => {\n // ResizeObserver may not be available in all environments, so check for its existence\n if (isUndefined(window?.ResizeObserver)) {\n // ResizeObserver is not available (SSR or unsupported browser)\n // Complete the observable without emitting any values\n observable.complete();\n return;\n }\n\n let observer: ResizeObserver | null = null;\n\n function setupOrTeardownObserver() {\n if (disabled()) {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n return;\n }\n\n if (!observer) {\n observer = new ResizeObserver(entries => {\n // if there are no entries, ignore the event\n if (!entries.length) {\n return;\n }\n\n // otherwise, take the first entry and emit the dimensions\n const entry = entries[0];\n\n let width: number, height: number;\n\n if ('borderBoxSize' in entry) {\n const borderSizeEntry = entry['borderBoxSize'];\n // this may be different across browsers so normalize it\n const borderSize = Array.isArray(borderSizeEntry)\n ? borderSizeEntry[0]\n : borderSizeEntry;\n\n width = borderSize['inlineSize'];\n height = borderSize['blockSize'];\n } else {\n // fallback for browsers that don't support borderBoxSize\n width = element.offsetWidth;\n height = element.offsetHeight;\n }\n\n // For inline elements, ResizeObserver may report 0,0 dimensions\n // Use getBoundingClientRect as fallback for inline elements with zero dimensions\n if ((width === 0 || height === 0) && getComputedStyle(element).display === 'inline') {\n const rect = element.getBoundingClientRect();\n width = rect.width;\n height = rect.height;\n }\n\n observable.next({ width, height });\n });\n\n observer.observe(element);\n }\n }\n\n setupOrTeardownObserver();\n\n explicitEffect([disabled], () => setupOrTeardownObserver(), { injector });\n\n return () => observer?.disconnect();\n });\n}\n\n/**\n * A utility function to observe any element for resize events and return the dimensions as a signal.\n */\nexport function observeResize(elementFn: () => HTMLElement | undefined): Signal<Dimensions> {\n const dimensions = signal<Dimensions>({ width: 0, height: 0 });\n const injector = inject(Injector);\n const destroyRef = inject(DestroyRef);\n\n // store the subscription to the resize event\n let subscription: Subscription | null = null;\n\n effect(() => {\n const targetElement = elementFn();\n\n untracked(() => {\n if (!targetElement) {\n return;\n }\n\n // if we already have a subscription, unsubscribe from it\n subscription?.unsubscribe();\n\n // create a new subscription to the resize event\n subscription = fromResizeEvent(targetElement, { injector })\n .pipe(safeTakeUntilDestroyed(destroyRef))\n .subscribe(event => dimensions.set({ width: event.width, height: event.height }));\n });\n });\n\n return dimensions;\n}\n\nexport interface Dimensions {\n width: number;\n height: number;\n}\n\n/**\n * A simple utility to get the dimensions of an element as a signal.\n */\nexport function injectDimensions(): Signal<Dimensions> {\n const elementRef = injectElementRef<HTMLElement>();\n const destroyRef = inject(DestroyRef);\n const dimensions = signal<Dimensions>({ width: 0, height: 0 });\n\n fromResizeEvent(elementRef.nativeElement)\n .pipe(\n safeTakeUntilDestroyed(destroyRef),\n map(({ width, height }) => ({ width, height })),\n )\n .subscribe(event => dimensions.set(event));\n\n return dimensions;\n}\n","import { isPlatformServer } from '@angular/common';\nimport { inject, PLATFORM_ID } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { fromResizeEvent } from './resize';\n\n/**\n * Whenever an element is removed from the DOM, we call the callback.\n * @param element The element to watch for removal.\n * @param callback The callback to call when the element is removed.\n */\nexport function onDomRemoval(element: HTMLElement, callback: () => void): void {\n const platform = inject(PLATFORM_ID);\n\n // Dont run this on the server\n if (isPlatformServer(platform)) {\n return;\n }\n\n // This is a bit of a hack, but it works. If the element dimensions become zero,\n // it's likely that the element has been removed from the DOM.\n fromResizeEvent(element)\n .pipe(safeTakeUntilDestroyed())\n .subscribe(dimensions => {\n // we check the dimensions first to short-circuit the check as it's faster\n if (dimensions.width === 0 && dimensions.height === 0 && !document.body.contains(element)) {\n callback();\n }\n });\n}\n","import { Injector, Signal, signal } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { explicitEffect } from '../signals/explicit-effect';\n\ninterface NgpMutationObserverOptions {\n /**\n * Whether to listen for events.\n */\n disabled?: Signal<boolean>;\n /**\n * The injector to use when called from outside of the injector context.\n */\n injector?: Injector;\n /**\n * Whether the childList should be observed.\n */\n childList?: boolean;\n /**\n * Whether the subtree should be observed.\n */\n subtree?: boolean;\n /**\n * Whether the attributes should be observed.\n */\n attributes?: boolean;\n /**\n * Whether the characterData should be observed.\n */\n characterData?: boolean;\n /**\n * Whether the attributeFilter should be observed.\n */\n attributeFilter?: string[];\n}\n\n/**\n * This function sets up a mutation observer to listen for changes in the DOM.\n * It will stop listening when the `disabled` signal is true, and re-enable when it is false.\n * @param options - Options for the mutation observer\n */\nexport function fromMutationObserver(\n element: HTMLElement,\n {\n childList,\n subtree,\n attributes,\n characterData,\n disabled = signal(false),\n injector,\n }: NgpMutationObserverOptions = {},\n): Observable<MutationRecord[]> {\n return new Observable<MutationRecord[]>(observable => {\n let observer: MutationObserver | null = null;\n\n function setupOrTeardownObserver() {\n if (disabled()) {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n return;\n }\n\n observer = new MutationObserver(mutations => observable.next(mutations));\n observer.observe(element, { childList, subtree, attributes, characterData });\n }\n\n setupOrTeardownObserver();\n\n // any time the disabled state changes, we need to re-evaluate the observer\n explicitEffect([disabled], () => setupOrTeardownObserver(), { injector });\n\n return () => observer?.disconnect();\n });\n}\n","import { DestroyRef, inject, Injector, Signal, signal } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { merge } from 'rxjs';\nimport { fromMutationObserver } from './mutation-observer';\nimport { fromResizeEvent } from './resize';\n\ninterface NgpOverflowListenerOptions {\n /**\n * Whether to listen for overflow changes.\n */\n disabled?: Signal<boolean>;\n /**\n * The injector to use when called from outside of the injector context.\n */\n injector?: Injector;\n}\n\nexport function setupOverflowListener(\n element: HTMLElement,\n { disabled = signal(false), injector }: NgpOverflowListenerOptions,\n): Signal<boolean> {\n const hasOverflow = signal<boolean>(false);\n const destroyRef = injector?.get(DestroyRef) ?? inject(DestroyRef);\n\n // Merge both observables and update hasOverflow on any event\n\n merge(\n fromResizeEvent(element, { disabled, injector }),\n fromMutationObserver(element, { disabled, injector, characterData: true }),\n )\n .pipe(safeTakeUntilDestroyed(destroyRef))\n .subscribe(() =>\n hasOverflow.set(\n element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight,\n ),\n );\n\n return hasOverflow;\n}\n","function getScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let parent = element.parentElement;\n while (parent) {\n const style = window.getComputedStyle(parent);\n if (/(auto|scroll)/.test(style.overflowY) || /(auto|scroll)/.test(style.overflowX)) {\n return parent;\n }\n parent = parent.parentElement;\n }\n return null;\n}\n\nexport function scrollIntoViewIfNeeded(element: HTMLElement): void {\n const scrollableAncestor = getScrollableAncestor(element);\n if (!scrollableAncestor) return;\n\n const parentRect = scrollableAncestor.getBoundingClientRect();\n const elementRect = element.getBoundingClientRect();\n\n if (elementRect.top < parentRect.top) {\n scrollableAncestor.scrollTop -= parentRect.top - elementRect.top;\n } else if (elementRect.bottom > parentRect.bottom) {\n scrollableAncestor.scrollTop += elementRect.bottom - parentRect.bottom;\n }\n\n if (elementRect.left < parentRect.left) {\n scrollableAncestor.scrollLeft -= parentRect.left - elementRect.left;\n } else if (elementRect.right > parentRect.right) {\n scrollableAncestor.scrollLeft += elementRect.right - parentRect.right;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAEA;;;AAGG;SACa,gBAAgB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC;AAC3B;;MCJa,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;;QAGmB,IAAA,CAAA,SAAS,GAAuB,EAAE;AAmBpD,IAAA;;AAhBC,IAAA,GAAG,CAAC,QAA0B,EAAA;AAC5B,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC/B;;AAGA,IAAA,MAAM,CAAC,QAA0B,EAAA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;AAEzB,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,qBAAqB,EAAE;AAC7D,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,qBAAqB,EAAE;IAEnD,IAAI,WAAW,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE;QACpC,kBAAkB,CAAC,SAAS,IAAI,UAAU,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG;IAClE;SAAO,IAAI,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE;QACjD,kBAAkB,CAAC,SAAS,IAAI,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM;IACxE;IAEA,IAAI,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE;QACtC,kBAAkB,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI;IACrE;SAAO,IAAI,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE;QAC/C,kBAAkB,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK;IACvE;AACF;;AC9BA;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-internal.mjs","sources":["../../../../packages/ng-primitives/internal/src/utilities/element-ref.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation-manager.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation.ts","../../../../packages/ng-primitives/internal/src/signals/explicit-effect.ts","../../../../packages/ng-primitives/internal/src/style-injector/style-injector.ts","../../../../packages/ng-primitives/internal/src/utilities/resize.ts","../../../../packages/ng-primitives/internal/src/utilities/dom-removal.ts","../../../../packages/ng-primitives/internal/src/utilities/mutation-observer.ts","../../../../packages/ng-primitives/internal/src/utilities/overflow.ts","../../../../packages/ng-primitives/internal/src/utilities/scrolling.ts","../../../../packages/ng-primitives/internal/src/ng-primitives-internal.ts"],"sourcesContent":["import { ElementRef, inject } from '@angular/core';\n\n/**\n * A simple utility function to inject an element reference with less boilerplate.\n * @returns The element reference.\n */\nexport function injectElementRef<T extends HTMLElement>(): ElementRef<T> {\n return inject(ElementRef);\n}\n","import { ClassProvider, inject, Injectable } from '@angular/core';\nimport type { NgpExitAnimation } from './exit-animation';\n\n@Injectable()\nexport class NgpExitAnimationManager {\n /** Store the instances of the exit animation directive. */\n private readonly instances: NgpExitAnimation[] = [];\n\n /** Add an instance to the manager. */\n add(instance: NgpExitAnimation): void {\n this.instances.push(instance);\n }\n\n /** Remove an instance from the manager. */\n remove(instance: NgpExitAnimation): void {\n const index = this.instances.indexOf(instance);\n if (index !== -1) {\n this.instances.splice(index, 1);\n }\n }\n\n /** Exit all instances. */\n async exit(): Promise<void> {\n await Promise.all(this.instances.map(instance => instance.exit()));\n }\n}\n\nexport function provideExitAnimationManager(): ClassProvider {\n return { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager };\n}\n\nexport function injectExitAnimationManager(): NgpExitAnimationManager {\n return inject(NgpExitAnimationManager);\n}\n","import { Directive, OnDestroy } from '@angular/core';\nimport { injectElementRef } from '../utilities/element-ref';\nimport { injectExitAnimationManager } from './exit-animation-manager';\n\n@Directive({\n selector: '[ngpExitAnimation]',\n exportAs: 'ngpExitAnimation',\n})\nexport class NgpExitAnimation implements OnDestroy {\n /** The animation manager. */\n private readonly animationManager = injectExitAnimationManager();\n /** Access the element reference. */\n protected readonly elementRef = injectElementRef();\n\n /** Exist animation reference. */\n protected readonly ref = setupExitAnimation({ element: this.elementRef.nativeElement });\n\n constructor() {\n this.animationManager.add(this);\n }\n\n ngOnDestroy(): void {\n this.animationManager.remove(this);\n }\n\n /** Mark the element as exiting. */\n async exit(): Promise<void> {\n await this.ref.exit();\n }\n}\n\ninterface NgpExitAnimationOptions {\n /** The element to animate. */\n element: HTMLElement;\n}\n\nexport interface NgpExitAnimationRef {\n /** Mark the element as exiting and wait for the animation to finish. */\n exit: () => Promise<void>;\n}\n\nexport function setupExitAnimation({ element }: NgpExitAnimationOptions): NgpExitAnimationRef {\n let state: 'enter' | 'exit' = 'enter';\n\n function setState(newState: 'enter' | 'exit') {\n state = newState;\n\n // remove all current animation state attributes\n element.removeAttribute('data-enter');\n element.removeAttribute('data-exit');\n\n // add the new animation state attribute\n if (state === 'enter') {\n element.setAttribute('data-enter', '');\n } else if (state === 'exit') {\n element.setAttribute('data-exit', '');\n }\n }\n\n // Set the initial state to 'enter'\n requestAnimationFrame(() => setState('enter'));\n\n return {\n exit: () => {\n return new Promise((resolve, reject) => {\n setState('exit');\n\n const animations = element.getAnimations();\n\n // Wait for the exit animations to finish\n if (animations.length > 0) {\n Promise.all(animations.map(anim => anim.finished))\n .then(() => resolve())\n .catch(err => {\n if (err instanceof Error && err.name !== 'AbortError') {\n return reject(err);\n }\n // Ignore abort errors as they are expected when the animation is interrupted\n // by the removal of the element - e.g. when the user navigates away to another page\n resolve();\n });\n } else {\n resolve();\n }\n });\n },\n };\n}\n","/**\n * This implementation is heavily inspired by the great work on ngextension!\n * https://github.com/ngxtension/ngxtension-platform/blob/main/libs/ngxtension/explicit-effect/src/explicit-effect.ts\n */\nimport {\n CreateEffectOptions,\n EffectCleanupRegisterFn,\n EffectRef,\n effect,\n untracked,\n} from '@angular/core';\n\n/**\n * We want to have the Tuple in order to use the types in the function signature\n */\ntype ExplicitEffectValues<T> = {\n [K in keyof T]: () => T[K];\n};\n\n/**\n * This explicit effect function will take the dependencies and the function to run when the dependencies change.\n * @param deps - The dependencies that the effect will run on\n * @param fn - The function to run when the dependencies change\n * @param options - The options for the effect with the addition of defer (it allows the computation to run on first change, not immediately)\n */\nexport function explicitEffect<Input extends readonly unknown[], Params = Input>(\n deps: readonly [...ExplicitEffectValues<Input>],\n fn: (deps: Params, onCleanup: EffectCleanupRegisterFn) => void,\n options?: CreateEffectOptions,\n): EffectRef {\n return effect(onCleanup => {\n const depValues = deps.map(s => s());\n untracked(() => fn(depValues as Params, onCleanup));\n }, options);\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { CSP_NONCE, inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n/**\n * A utility service for injecting styles into the document.\n * Angular doesn't allow directives to specify styles, only components.\n * As we ship directives, occasionally we need to associate styles with them.\n * This service allows us to programmatically inject styles into the document.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class StyleInjector {\n /**\n * Access the CSP nonce\n */\n private readonly cspNonce = inject(CSP_NONCE, { optional: true });\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Detect the platform.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n /**\n * Store the map of style elements with their unique identifiers.\n */\n private readonly styleElements = new Map<string, HTMLStyleElement>();\n\n constructor() {\n if (isPlatformBrowser(this.platformId)) {\n this.collectServerStyles();\n }\n }\n\n /**\n * Inject a style into the document.\n * @param id The unique identifier for the style.\n * @param style The style to inject.\n */\n add(id: string, style: string): void {\n if (this.styleElements.has(id)) {\n return;\n }\n\n const styleElement = this.document.createElement('style');\n styleElement.setAttribute('data-ngp-style', id);\n styleElement.textContent = style;\n\n // If a CSP nonce is provided, set it on the style element\n if (this.cspNonce) {\n styleElement.setAttribute('nonce', this.cspNonce);\n }\n\n this.document.head.appendChild(styleElement);\n this.styleElements.set(id, styleElement);\n }\n\n /**\n * Remove a style from the document.\n * @param id The unique identifier for the style.\n */\n remove(id: string): void {\n const styleElement = this.styleElements.get(id);\n\n if (styleElement) {\n this.document.head.removeChild(styleElement);\n this.styleElements.delete(id);\n }\n }\n\n /**\n * Collect any styles that were rendered by the server.\n */\n private collectServerStyles(): void {\n const styleElements = this.document.querySelectorAll<HTMLStyleElement>('style[data-ngp-style]');\n\n styleElements.forEach(styleElement => {\n const id = styleElement.getAttribute('data-ngp-style');\n\n if (id) {\n this.styleElements.set(id, styleElement);\n }\n });\n }\n}\n\nexport function injectStyleInjector(): StyleInjector {\n return inject(StyleInjector);\n}\n","import { isPlatformServer } from '@angular/common';\nimport {\n DestroyRef,\n effect,\n inject,\n Injector,\n PLATFORM_ID,\n signal,\n Signal,\n untracked,\n} from '@angular/core';\nimport { isUndefined, safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { Observable, Subscription } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { explicitEffect } from '../signals/explicit-effect';\nimport { injectElementRef } from './element-ref';\n\ninterface NgpResizeObserverOptions {\n /**\n * Whether to listen for events.\n */\n disabled?: Signal<boolean>;\n\n /**\n * The injector to use when called from outside of the injector context.\n */\n injector?: Injector;\n}\n\n/**\n * A simple helper function to create a resize observer as an RxJS Observable.\n * @param element The element to observe for resize events.\n * @returns The resize event as an Observable.\n */\nexport function fromResizeEvent(\n element: HTMLElement,\n { disabled = signal(false), injector }: NgpResizeObserverOptions = {},\n): Observable<Dimensions> {\n const platformId = injector?.get(PLATFORM_ID) ?? inject(PLATFORM_ID);\n\n return new Observable(observable => {\n // ResizeObserver may not be available in all environments, so check for its existence\n if (isPlatformServer(platformId) || isUndefined(window?.ResizeObserver)) {\n // ResizeObserver is not available (SSR or unsupported browser)\n // Complete the observable without emitting any values\n observable.complete();\n return;\n }\n\n let observer: ResizeObserver | null = null;\n\n function setupOrTeardownObserver() {\n if (disabled()) {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n return;\n }\n\n if (!observer) {\n observer = new ResizeObserver(entries => {\n // if there are no entries, ignore the event\n if (!entries.length) {\n return;\n }\n\n // otherwise, take the first entry and emit the dimensions\n const entry = entries[0];\n\n let width: number, height: number;\n\n if ('borderBoxSize' in entry) {\n const borderSizeEntry = entry['borderBoxSize'];\n // this may be different across browsers so normalize it\n const borderSize = Array.isArray(borderSizeEntry)\n ? borderSizeEntry[0]\n : borderSizeEntry;\n\n width = borderSize['inlineSize'];\n height = borderSize['blockSize'];\n } else {\n // fallback for browsers that don't support borderBoxSize\n width = element.offsetWidth;\n height = element.offsetHeight;\n }\n\n // For inline elements, ResizeObserver may report 0,0 dimensions\n // Use getBoundingClientRect as fallback for inline elements with zero dimensions\n if ((width === 0 || height === 0) && getComputedStyle(element).display === 'inline') {\n const rect = element.getBoundingClientRect();\n width = rect.width;\n height = rect.height;\n }\n\n observable.next({ width, height });\n });\n\n observer.observe(element);\n }\n }\n\n setupOrTeardownObserver();\n\n explicitEffect([disabled], () => setupOrTeardownObserver(), { injector });\n\n return () => observer?.disconnect();\n });\n}\n\n/**\n * A utility function to observe any element for resize events and return the dimensions as a signal.\n */\nexport function observeResize(elementFn: () => HTMLElement | undefined): Signal<Dimensions> {\n const dimensions = signal<Dimensions>({ width: 0, height: 0 });\n const injector = inject(Injector);\n const destroyRef = inject(DestroyRef);\n\n // store the subscription to the resize event\n let subscription: Subscription | null = null;\n\n effect(() => {\n const targetElement = elementFn();\n\n untracked(() => {\n if (!targetElement) {\n return;\n }\n\n // if we already have a subscription, unsubscribe from it\n subscription?.unsubscribe();\n\n // create a new subscription to the resize event\n subscription = fromResizeEvent(targetElement, { injector })\n .pipe(safeTakeUntilDestroyed(destroyRef))\n .subscribe(event => dimensions.set({ width: event.width, height: event.height }));\n });\n });\n\n return dimensions;\n}\n\nexport interface Dimensions {\n width: number;\n height: number;\n}\n\n/**\n * A simple utility to get the dimensions of an element as a signal.\n */\nexport function injectDimensions(): Signal<Dimensions> {\n const elementRef = injectElementRef<HTMLElement>();\n const destroyRef = inject(DestroyRef);\n const dimensions = signal<Dimensions>({ width: 0, height: 0 });\n\n fromResizeEvent(elementRef.nativeElement)\n .pipe(\n safeTakeUntilDestroyed(destroyRef),\n map(({ width, height }) => ({ width, height })),\n )\n .subscribe(event => dimensions.set(event));\n\n return dimensions;\n}\n","import { isPlatformServer } from '@angular/common';\nimport { inject, PLATFORM_ID } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { fromResizeEvent } from './resize';\n\n/**\n * Whenever an element is removed from the DOM, we call the callback.\n * @param element The element to watch for removal.\n * @param callback The callback to call when the element is removed.\n */\nexport function onDomRemoval(element: HTMLElement, callback: () => void): void {\n const platform = inject(PLATFORM_ID);\n\n // Dont run this on the server\n if (isPlatformServer(platform)) {\n return;\n }\n\n // This is a bit of a hack, but it works. If the element dimensions become zero,\n // it's likely that the element has been removed from the DOM.\n fromResizeEvent(element)\n .pipe(safeTakeUntilDestroyed())\n .subscribe(dimensions => {\n // we check the dimensions first to short-circuit the check as it's faster\n if (dimensions.width === 0 && dimensions.height === 0 && !document.body.contains(element)) {\n callback();\n }\n });\n}\n","import { Injector, Signal, signal } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { explicitEffect } from '../signals/explicit-effect';\n\ninterface NgpMutationObserverOptions {\n /**\n * Whether to listen for events.\n */\n disabled?: Signal<boolean>;\n /**\n * The injector to use when called from outside of the injector context.\n */\n injector?: Injector;\n /**\n * Whether the childList should be observed.\n */\n childList?: boolean;\n /**\n * Whether the subtree should be observed.\n */\n subtree?: boolean;\n /**\n * Whether the attributes should be observed.\n */\n attributes?: boolean;\n /**\n * Whether the characterData should be observed.\n */\n characterData?: boolean;\n /**\n * Whether the attributeFilter should be observed.\n */\n attributeFilter?: string[];\n}\n\n/**\n * This function sets up a mutation observer to listen for changes in the DOM.\n * It will stop listening when the `disabled` signal is true, and re-enable when it is false.\n * @param options - Options for the mutation observer\n */\nexport function fromMutationObserver(\n element: HTMLElement,\n {\n childList,\n subtree,\n attributes,\n characterData,\n disabled = signal(false),\n injector,\n }: NgpMutationObserverOptions = {},\n): Observable<MutationRecord[]> {\n return new Observable<MutationRecord[]>(observable => {\n let observer: MutationObserver | null = null;\n\n function setupOrTeardownObserver() {\n if (disabled()) {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n return;\n }\n\n observer = new MutationObserver(mutations => observable.next(mutations));\n observer.observe(element, { childList, subtree, attributes, characterData });\n }\n\n setupOrTeardownObserver();\n\n // any time the disabled state changes, we need to re-evaluate the observer\n explicitEffect([disabled], () => setupOrTeardownObserver(), { injector });\n\n return () => observer?.disconnect();\n });\n}\n","import { DestroyRef, inject, Injector, Signal, signal } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { merge } from 'rxjs';\nimport { fromMutationObserver } from './mutation-observer';\nimport { fromResizeEvent } from './resize';\n\ninterface NgpOverflowListenerOptions {\n /**\n * Whether to listen for overflow changes.\n */\n disabled?: Signal<boolean>;\n /**\n * The injector to use when called from outside of the injector context.\n */\n injector?: Injector;\n}\n\nexport function setupOverflowListener(\n element: HTMLElement,\n { disabled = signal(false), injector }: NgpOverflowListenerOptions,\n): Signal<boolean> {\n const hasOverflow = signal<boolean>(false);\n const destroyRef = injector?.get(DestroyRef) ?? inject(DestroyRef);\n\n // Merge both observables and update hasOverflow on any event\n\n merge(\n fromResizeEvent(element, { disabled, injector }),\n fromMutationObserver(element, { disabled, injector, characterData: true }),\n )\n .pipe(safeTakeUntilDestroyed(destroyRef))\n .subscribe(() =>\n hasOverflow.set(\n element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight,\n ),\n );\n\n return hasOverflow;\n}\n","function getScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let parent = element.parentElement;\n while (parent) {\n const style = window.getComputedStyle(parent);\n if (/(auto|scroll)/.test(style.overflowY) || /(auto|scroll)/.test(style.overflowX)) {\n return parent;\n }\n parent = parent.parentElement;\n }\n return null;\n}\n\nexport function scrollIntoViewIfNeeded(element: HTMLElement): void {\n const scrollableAncestor = getScrollableAncestor(element);\n if (!scrollableAncestor) return;\n\n const parentRect = scrollableAncestor.getBoundingClientRect();\n const elementRect = element.getBoundingClientRect();\n\n if (elementRect.top < parentRect.top) {\n scrollableAncestor.scrollTop -= parentRect.top - elementRect.top;\n } else if (elementRect.bottom > parentRect.bottom) {\n scrollableAncestor.scrollTop += elementRect.bottom - parentRect.bottom;\n }\n\n if (elementRect.left < parentRect.left) {\n scrollableAncestor.scrollLeft -= parentRect.left - elementRect.left;\n } else if (elementRect.right > parentRect.right) {\n scrollableAncestor.scrollLeft += elementRect.right - parentRect.right;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"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372
372
  removeFormControl: () => void;
373
373
  removeLabel: (label: string) => void;
374
374
  removeDescription: (description: string) => void;
375
- }> | Signal<{
375
+ } | null> | Signal<{
376
376
  labels: _angular_core.WritableSignal<string[]>;
377
377
  descriptions: _angular_core.WritableSignal<string[]>;
378
378
  formControl: _angular_core.WritableSignal<string | null>;
@@ -390,7 +390,7 @@ declare const injectFormFieldState: {
390
390
  removeFormControl: () => void;
391
391
  removeLabel: (label: string) => void;
392
392
  removeDescription: (description: string) => void;
393
- } | null>;
393
+ }>;
394
394
  };
395
395
  declare const provideFormFieldState: (opts?: {
396
396
  inherit?: boolean;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ng-primitives",
3
3
  "description": "Angular Primitives is a low-level headless UI component library with a focus on accessibility, customization, and developer experience. ",
4
4
  "license": "Apache-2.0",
5
- "version": "0.99.5",
5
+ "version": "0.99.6",
6
6
  "keywords": [
7
7
  "angular",
8
8
  "primitives",
@@ -16,7 +16,8 @@
16
16
  "homepage": "https://angularprimitives.com",
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "https://github.com/ng-primitives/ng-primitives.git"
19
+ "url": "git+https://github.com/ng-primitives/ng-primitives.git",
20
+ "directory": "packages/ng-primitives"
20
21
  },
21
22
  "bugs": {
22
23
  "url": "https://github.com/ng-primitives/ng-primitives/issues"