import * as i0 from '@angular/core'; import { ElementRef, OnDestroy, Type, InjectionToken, FactoryProvider, ValueProvider, TemplateRef, ViewContainerRef } from '@angular/core'; import { Observable, Subscriber, MonoTypeOperatorFunction } from 'rxjs'; export { coerceArray, coerceCssPixelValue, coerceElement, coerceStringArray } from '@angular/cdk/coercion'; /** * A decorator that transforms a class method or getter into a pure function. For methods, it caches the result * of the first invocation with a given set of arguments and returns the cached result on subsequent invocations * with the same arguments. For getters, it caches the result of the first access and returns the cached value * on subsequent accesses. * * This decorator is intended to improve performance by avoiding unnecessary recalculations or processing * when the inputs have not changed. * * @template T The type of the property being decorated. * @param {object} _target The prototype of the class. * @param {string} propertyKey The name of the method or getter. * @param {TypedPropertyDescriptor} descriptor The property descriptor for the method or getter. * @throws {Error} Throws an error if applied to non-function properties. * @returns {TypedPropertyDescriptor} A new descriptor with the getter or method patched for pure behavior. * * @example * Usage with a getter: * ```ts * class ExampleClass { * private _value: number = Math.random(); * * @Pure * get value(): number { * console.log('Getter called'); * return this._value; * } * } * * const example = new ExampleClass(); * console.log(example.value); // Logs 'Getter called' and the value * console.log(example.value); // Logs only the value, without calling the getter again * ``` * * Usage with a method: * ```ts * class Counter { * private count = 0; * * @Pure * increment(step: number) { * console.log('Increment called'); * return (this.count += step); * } * } * * const counter = new Counter(); * console.log(counter.increment(1)); // Logs 'Increment called' and 1 * console.log(counter.increment(1)); // Logs 1 without calling increment again * ``` */ declare function Pure(_target: object, propertyKey: string, { get, enumerable, value }: TypedPropertyDescriptor): TypedPropertyDescriptor; /** * Binds an observable to toggle a CSS class on the host element based on the truthiness of the emitted values. * The subscription automatically ends when the component is destroyed. * * @template T The type of items emitted by the source observable. * @param {Observable | null | undefined} source$ The observable source emitting truthy or falsy values. * @param {string} cssClass The CSS class to toggle based on the emitted values. */ declare function reactiveClassBinding(source$: Observable | null | undefined, cssClass: string): void; /** * Binds an observable to update attributes on the host element with the emitted values. * The subscription automatically ends when the component is destroyed. * * @template T The type of items emitted by the source observable. * @param {Observable | null | undefined} source$ The observable source. * @param {...string[]} attributes The attributes to set on the host element based on the emitted values. */ declare function reactiveAttributeBinding(source$: Observable | null | undefined, ...attributes: string[]): void; /** * Injects the ElementRef of the host element in an Angular component or directive. * * @template T The expected type of the native element. * @returns {ElementRef} The injected ElementRef instance. */ declare function injectElement(): ElementRef; /** * Waits for all animations on the given element (and optionally its descendants) to finish. * * @param {Element|null} [element] - The DOM element to check for animations. If not provided or invalid, the function resolves to an empty array. * @param {boolean} [subtree=false] - Whether to include animations from child elements (subtree) of the given element. * @returns {Promise} A promise that resolves with an array of finished animations or an empty array if no animations are found. * * @example * // Wait for animations on a specific element and its subtree to complete * waitForAnimations(document.querySelector('.my-element'), true).then(() => { * console.log('All animations are finished'); * }); */ declare function waitForAnimations(element?: Element | null, subtree?: boolean): Promise; /** * Extracts the values of a specified key from each object in an array. * * @template T - The type of the objects in the array. * @template K - The type of the keys of `T`. * @param {T[]} arr - The array of objects to pluck values from. * @param {K} key - The key whose values are to be plucked from each object in the array. * @returns {Array} An array of values corresponding to the specified key from each object. * @example * ```ts * const users = [{ name: 'Alice' }, { name: 'Bob' }]; * const names = pluckFromArray(users, 'name'); // ['Alice', 'Bob'] * ``` */ declare function pluckFromArray(arr: T[], key: K): Array; type OrderByDirection = 'ASC' | 'DESC'; /** * Creates a compare function for sorting an array of objects based on a specified key and direction. * * @template T - The type of the objects in the array. * @param {keyof T} key - The key to sort by. * @param {OrderByDirection} [direction='ASC'] - The direction to sort ('ASC' for ascending, 'DESC' for descending). * @returns {(a: T, b: T) => number} A compare function that can be used in the array sort method. * @example * ```ts * const items = [{ value: 10 }, { value: 5 }, { value: 7 }]; * const sortedItems = items.sort(orderBy('value', 'ASC')); // Sorted by value in ascending order * ``` */ declare function orderBy(key: keyof T, direction?: OrderByDirection): (a: T, b: T) => number; /** * Constructs a URL string from provided segments, ensuring proper slash separation without duplications. * It gracefully handles `null`, `undefined`, and symbol values by omitting them from the final URL. * Additionally, the function preserves the protocol part of the URL, if specified. * * @param {...Array} args - The segments to concatenate into a URL. * Can be a mix of strings, numbers, symbols (converted to strings), or `null`/`undefined` (which are omitted). * @returns {string} The constructed URL string with correctly formatted slashes. * * @example * ```ts * // Basic usage * console.log(buildUrl('http://example.com', 'path', 'to', 'resource')); * // Outputs: "http://example.com/path/to/resource" * * // Removing duplicate slashes * console.log(buildUrl('http://example.com/', '/path/', '//to', '/resource/')); * // Outputs: "http://example.com/path/to/resource/" * ``` */ declare function buildUrl(...args: Array): string; /** * A constant representing the base URL for the Draeger website. * @constant * @type {string} * @default 'https://www.draeger.com' */ declare const DRAEGER_WEBSITE_URL = "https://www.draeger.com"; /** * Constructs a full URL for the Draeger website by appending the provided path segments to the base URL. * This function is a utility for creating fully qualified URLs to various resources or pages within the Draeger website. * * @function buildWebsiteUrl * @param {...(string | number | symbol | null | undefined)} segments - The path segments to append to the base URL. * These can include strings, numbers, symbols, or null/undefined values (the latter two are ignored). * @returns {string} The fully constructed URL, including the base URL and all provided path segments. * * @example * ```ts * // Returns 'https://www.draeger.com/about-us' * const url = buildWebsiteUrl('about-us'); * * // Can also handle multiple segments, returning 'https://www.draeger.com/products/search/123' * const productUrl = buildWebsiteUrl('products', 'search', 123); * ``` */ declare function buildWebsiteUrl(...segments: Array): string; /** * The HTTP 'Etag' header, used for web cache validation. */ declare const HTTP_ETAG_HEADER = "Etag"; /** * The HTTP 'If-None-Match' header, used in conditional requests to compare against the ETag. */ declare const HTTP_IF_NONE_MATCH_HEADER = "If-None-Match"; /** * The HTTP 'Cache-Control' header, used to specify directives for caching mechanisms in requests and responses. */ declare const HTTP_CACHE_CONTROL_HEADER = "Cache-Control"; /** * A client for managing cache storage for web applications. It simplifies interactions with the Cache Storage API, * allowing for the caching, retrieval, and deletion of request responses. This class uses HTTP caching headers to * optimize network requests and cache management. * * @example * ```ts * // Creating an instance of CacheStorageClient * const cacheClient = new CacheStorageClient('my-cache'); * * // Requesting and caching data * cacheClient.request('https://api.example.com/data').then(data => { * console.log(data); * }); * * // Deleting a specific cache entry * cacheClient.delete('https://api.example.com/data'); * * // Clearing all cache entries * cacheClient.deleteAll(); * ``` */ declare class CacheStorageClient { private readonly cacheKey; private readonly cacheStorage; constructor(cacheKey: string, cacheStorage?: CacheStorage); /** * Deletes a specific cache entry. * * @param {RequestInfo | URL} request - The request or URL to delete from the cache. * @returns {Promise} A promise that resolves to a boolean indicating whether the deletion was successful. */ delete(request: RequestInfo | URL): Promise; /** * Deletes all entries from the cache. * * @returns {Promise} A promise that resolves when all entries have been deleted. */ deleteAll(): Promise; /** * Performs a request, caching the response if applicable. If a response is cached for the request and still valid, * it returns the cached response instead of making a new network request. * * @template T - The expected response data type. * @param {RequestInfo | URL} requestInfo - The request information or URL to fetch and cache. * @param {(response: Response) => boolean} [shouldDelete=({ status }) => status >= 400 && status < 500] - An optional function to determine if the cache entry should be deleted based on the response. * @returns {Promise} A promise that resolves to the response data, or null if the request fails. */ request(requestInfo: RequestInfo | URL, shouldDelete?: ({ status }: Response) => boolean): Promise; protected getCache(): Promise; protected prepareRequest(cache: Cache, requestInfo: RequestInfo | URL): Promise; protected sendRequest(cache: Cache, request: Request): Promise; } /** * Coerces a value to an array. If the value is already an array, it is returned directly. * If the value is not an array, it is wrapped in an array. This utility is useful for * handling values that can be either single values or arrays, ensuring consistent array handling. * * @param {string | string[]} value - The value to coerce to an array. Can be a single string or an array of strings. * @returns {string[]} The coerced value as an array of strings. * * @example * ```ts * // Coercing a single string to an array * console.log(arrayAttribute('singleValue')); // Outputs: ['singleValue'] * * // Returning an array directly * console.log(arrayAttribute(['value1', 'value2'])); // Outputs: ['value1', 'value2'] * ``` */ declare function arrayAttribute(value: string | string[]): string[]; /** * Creates a debounced function that delays invoking the provided function until after `delay` milliseconds * have elapsed since the last time the debounced function was invoked. Optionally, the function can be * triggered immediately on the first call, then debounced for subsequent calls. * * @template Args - A tuple representing the types of arguments the `func` accepts. * @param {(...args: Args) => void} func - The function to debounce. * @param {number} delay - The number of milliseconds to delay. * @param {boolean} [immediate=false] - Whether to trigger the function immediately on the first call, * and then debounce subsequent calls. * @returns {(...args: Args) => void} A new, debounced function. * * @example * ```ts * // Example usage with a window resize event * const handleResize = debounce(() => { * console.log('Window resized'); * }, 250); * window.addEventListener('resize', handleResize); * * // Example using immediate invocation * const processKeyPress = debounce((event) => { * console.log('Key pressed:', event.key); * }, 200, true); * document.addEventListener('keypress', processKeyPress); * ``` */ declare function debounce(func: (...args: Args) => void, delay: number, immediate?: boolean): (...args: Args) => void; /** * Defers the execution of a function until the current call stack is clear. * This is achieved by using `setTimeout` with a delay of `0`, effectively placing the function * at the end of the event queue and allowing the browser to complete any pending tasks before execution. * * @param {() => void} fn - The function to be deferred. * * @example * ```ts * // Deferring a simple function * deferFn(() => console.log('This will be logged after the current execution context completes.')); * * // Using deferFn to update the UI after a synchronous operation * function updateUI() { * // UI update logic here * } * // Assume we're inside a synchronous block of code that updates data * deferFn(updateUI); // Ensures UI is updated after data changes are fully applied * ``` */ declare function deferFn(fn: () => void): void; /** * Applies a set of CSS styles to an HTML element. * * @param {HTMLElement} element - The element to apply styles to. * @param {Partial>} styles - An object containing CSS properties and values to apply. */ declare function applyStyles(element: HTMLElement, styles: Partial>): void; /** * Converts a boolean value to a corresponding attribute string. * * @param {boolean} state - The boolean state to convert. * @returns {string} 'true' if the state is true; otherwise, 'false'. */ declare function booleanToAttributeString(state: boolean): string; /** * Converts a boolean value to 'true' or null, useful for setting attributes based on boolean conditions. * * @param {boolean} state - The boolean state to convert. * @returns {string | null} 'true' if the state is true; otherwise, null. */ declare function booleanToOptionalAttributeString(state: boolean): string | null; /** * Converts a numeric value to a pixel string, appending 'px' to the number. * * @param {unknown} value - The value to convert to pixels. * @returns {`${number}px`} The value in pixels, or '0px' if the input is not a number. */ declare function px(value: unknown): `${number}px`; /** * Generates a CSS translate3d string for given x and y values. * * @param {string | 0} x - The translation value along the x-axis. * @param {string | 0} y - The translation value along the y-axis. * @returns {`translate3d(${string | 0}, ${string | 0}, 0)`} The CSS translate3d value. */ declare function cssTranslate(x: string | 0, y: string | 0): `translate3d(${string | 0}, ${string | 0}, 0)`; /** * Disables or re-enables CSS transitions on an element. * * @param {HTMLElement} element - The element to modify. * @param {boolean} disabled - Whether to disable CSS transitions. */ declare function disableCSSTransitions(element: HTMLElement, disabled: boolean): void; /** * Forces the browser to reflow the layout, useful for triggering CSS transitions or animations. * * @param {HTMLElement} element - The element to force a reflow on. */ declare function forceLayoutReflow(element: HTMLElement): number; /** * Sets an attribute on an HTML element, converting the value to a string if necessary. * * @param {HTMLElement} element - The element to set the attribute on. * @param {string} attribute - The name of the attribute to set. * @param {unknown} value - The value of the attribute; will be converted to a string if it's not null or undefined. */ declare function setAttribute(element: HTMLElement, attribute: string, value?: unknown): void; /** * Creates a ResizeObserver instance safely, falling back to a dummy if the API is not supported. * * @param {ResizeObserverCallback} callback - The callback to execute when an observed element's size changes. * @returns {ResizeObserver} A ResizeObserver instance or a dummy object with no-op methods if unsupported. */ declare function createResizeObserver(callback: ResizeObserverCallback): ResizeObserver; /** * Creates a MutationObserver instance safely, falling back to a dummy if the API is not supported. * * @param {Subscriber} observer - The RxJS Subscriber to emit next values to. * @param {(mutations: MutationRecord[]) => boolean} callback - The callback that determines whether to notify the observer based on mutations. * @returns {MutationObserver} A MutationObserver instance or a dummy object with no-op methods if unsupported. */ declare function createMutationObserver(observer: Subscriber, callback: (mutations: MutationRecord[]) => boolean): MutationObserver; /** * Checks whether one element contains another in the DOM tree. * * @param {Element | null} parent - The parent element. * @param {Element | null} other - The element to check for containment. * @param {boolean} [inclusive=true] - Whether to consider an element as containing itself. * @returns {boolean} True if the parent contains the other element; false otherwise. */ declare function containsElement(parent?: Element | null, other?: Element | null, inclusive?: boolean): boolean; declare class EventManager implements OnDestroy { private readonly element; private readonly renderer; private readonly listeners; destroyListeners(): void; destroyListener(listenerReferenceKey: string): void; register(eventNames: Array, callback: (event?: T) => void, target?: 'document' | 'window' | EventTarget | null): Array; ngOnDestroy(): void; getActiveListenersNames(): string[]; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } type Axis = (typeof Axis)[keyof typeof Axis]; declare const Axis: { readonly X: "x"; readonly Y: "y"; }; type MarkFunctionPropertyNames = { [Key in keyof T]: T[Key] extends CallableFunction ? never : Key; }[keyof T]; type GetProperties = Pick>; type Position = (typeof Position)[keyof typeof Position]; declare const Position: { readonly TOP: "top"; readonly TOP_START: "top-start"; readonly TOP_END: "top-end"; readonly RIGHT: "right"; readonly RIGHT_START: "right-start"; readonly RIGHT_END: "right-end"; readonly BOTTOM: "bottom"; readonly BOTTOM_START: "bottom-start"; readonly BOTTOM_END: "bottom-end"; readonly LEFT: "left"; readonly LEFT_START: "left-start"; readonly LEFT_END: "left-end"; }; type Side = (typeof Side)[keyof typeof Side]; declare const Side: { readonly TOP: "top"; readonly RIGHT: "right"; readonly BOTTOM: "bottom"; readonly LEFT: "left"; }; /** * Determines the axis associated with a given position. The function first extracts the side from the position, * then evaluates whether that side corresponds to the X-axis (left or right) or the Y-axis (top or bottom). * * @param {Position} position - The position string, which includes a side (top, bottom, left, right) and possibly an alignment. * @returns {Axis} The axis (X or Y) associated with the given position's side. * * @example * ```ts * // Determining the axis for different positions * console.log(getAxis('top-left')); // Outputs: 'Y' * console.log(getAxis('right')); // Outputs: 'X' * * // Using getAxis in UI element positioning logic * const elementPosition = 'bottom'; * const axis = getAxis(elementPosition); * // Assuming a function that adjusts UI elements based on the axis * adjustElementAlongAxis(axis); * ``` */ declare function getAxis(position: Position): Axis; /** * Extracts the language code from a language string that may include both a language and a region code. * The function supports language strings formatted with either a hyphen (`-`) or an underscore (`_`) as the separator. * * @param {string} language - The complete language string, potentially including both language and region codes. * @returns {string} The extracted language code, converted to lower case. * * @example * ```ts * // Extracting language code from a language-region string * console.log(getLanguageCode('en-US')); // Outputs: 'en' * console.log(getLanguageCode('zh_CN')); // Outputs: 'zh' * * // Handling language codes without region codes * console.log(getLanguageCode('fr')); // Outputs: 'fr' * ``` */ declare function getLanguageCode(language: string): string; /** * Determines the opposite side for a given position. This function is useful for scenarios * where you need to dynamically calculate the positioning or alignment opposite to the current one, * such as inverting tooltips, popovers, or any UI elements that adjust based on available viewport space. * * @param {Position} position - The position string, which includes a side and possibly an alignment. * @returns {Side} The opposite side relative to the provided position's side. * * @example * ```ts * // Getting the opposite side of a given position * console.log(getOppositeSide('top-left')); // Outputs: 'bottom' * console.log(getOppositeSide('right')); // Outputs: 'left' * * // Using getOppositeSide to adjust UI elements * const currentSide = 'left'; * const newPosition = getOppositeSide(currentSide); * // Assuming an element's position or orientation needs to be dynamically updated * updateElementPosition(newPosition); * ``` */ declare function getOppositeSide(position: Position): Side; /** * Extracts the side part from a position string. The position format generally combines * a side (e.g., "top", "bottom", "left", "right") with an optional alignment * (e.g., "left", "center", "right" for vertical positions or "top", "middle", "bottom" for horizontal positions). * * @param {Position} position - The position string from which to extract the side. * @returns {Side} The side part of the position, indicating the general placement direction. * * @example * ```ts * // Extracting the side from a position with alignment * console.log(getSide('top-left')); // Outputs: 'top' * * // Extracting the side from a simple position * console.log(getSide('bottom')); // Outputs: 'bottom' * ``` */ declare function getSide(position: Position): Side; /** * Generates a unique identifier for a given key. If the key has previously been used, * the function increments a counter associated with that key to ensure uniqueness. * The generated ID is in the format of `${key}-${counter}`. * * @param {string} key - The key for which to generate a unique identifier. * @returns {string} A unique identifier string based on the provided key. * * @example * ```ts * const id1 = getUniqueId('component'); * console.log(id1); // Outputs: "component-1" * * const id2 = getUniqueId('component'); * console.log(id2); // Outputs: "component-2" * ``` */ declare function getUniqueId(key: string): string; /** * Clears the cache used by `getUniqueId` to generate unique identifiers. This function * resets all counters associated with each key, effectively restarting the generation * of unique IDs from their initial state. * * This can be useful in scenarios such as testing or when starting a new session that * requires resetting the state of unique ID generation. * * @example * ```ts * getUniqueId('component'); // Returns "component-1" * getUniqueId('component'); // Returns "component-2" * clearUniqueIdCache(); * getUniqueId('component'); // Returns "component-1" after cache reset * ``` */ declare function clearUniqueIdCache(): void; /** * Checks if a given value is a valid URL matcher, which can be either a string or a regular expression. * This function serves as a type guard to facilitate URL matching operations by verifying the type of the filter. * * @param {unknown} value - The value to check for being a valid URL matcher. * @returns {value is string | RegExp} `true` if the value is a string or RegExp, indicating it can be used for URL matching; otherwise, `false`. * * @example * ```ts * // Checking a string URL matcher * console.log(isUrlMatcher('https://example.com')); // true * * // Checking a RegExp URL matcher * console.log(isUrlMatcher(/https:\/\/example\.com/)); // true * * // Checking a non-matcher value * console.log(isUrlMatcher(123)); // false * ``` */ declare function isUrlMatcher(value: unknown): value is string | RegExp; /** * Determines if a given URL matches a specified filter, which can be either a string or a regular expression. * For string filters, the function checks if the URL starts with the filter value. For RegExp filters, * it checks if the URL matches the regular expression pattern. * * @param {string} url - The URL to be checked against the filter. * @param {string | RegExp} filter - The filter used to match the URL, which can be a prefix string or a RegExp pattern. * @returns {boolean} `true` if the URL matches the filter; otherwise, `false`. * * @example * ```ts * // Matching a URL with a string filter * console.log(matchUrl('https://example.com/page', 'https://example.com')); // true * * // Matching a URL with a RegExp filter * console.log(matchUrl('https://example.com/page', /example\.com\/page/)); // true * * // A non-matching example * console.log(matchUrl('https://example.com/page', 'https://another.com')); // false * ``` */ declare function matchUrl(url: string, filter: string | RegExp): boolean; /** * Represents a typed version of Angular's `SimpleChanges` object, describing the changes to each * property of a component or directive. This utility enhances type safety when working with Angular's * change detection mechanism by providing specific property types. * * @template C - The component or directive class. * @template Properties - The properties of the component or directive, inferred from `C` by default. * @type {Object} - A mapping from property names to change information for each property. * * @example * ```ts * interface MyComponent { * name: string; * age: number; * } * * function ngOnChanges(changes: NgChanges) { * if (changes.name) { * console.log('Name changed from', changes.name.previousValue, 'to', changes.name.currentValue); * } * } * ``` */ type NgChanges> = { [Key in keyof Properties]: { previousValue: Properties[Key]; currentValue: Properties[Key]; firstChange: boolean; isFirstChange(): boolean; }; }; /** * Checks if the specified property or properties have changed in the current change detection cycle. * Optionally ignores changes that occur during the first change detection cycle (e.g., initialization). * * @template U - The component or directive class. * @template T - The type representing the changes, typically `NgChanges`. * @template K - The key or keys representing the properties to check for changes. * @param {T} changes - The `NgChanges` object containing information about all changes. * @param {K | K[]} keyOrKeys - The property name(s) to check for changes. * @param {boolean} [ignoreFirstChange=true] - Whether to ignore changes that occur during the first change detection cycle. * @returns {boolean} `true` if the specified property or properties have changed, otherwise `false`. * * @example * ```ts * // Example usage within an Angular component's `ngOnChanges` method * ngOnChanges(changes: NgChanges): void { * if (hasChanged(changes, 'name')) { * console.log('Name has changed'); * } * } * * // Checking multiple properties for changes * ngOnChanges(changes: NgChanges): void { * if (hasChanged(changes, ['name', 'age'], false)) { * console.log('Name or age has changed (including first change)'); * } * } * ``` */ declare function hasChanged, T extends NgChanges, K extends keyof T>(changes: T, keyOrKeys: K | K[], ignoreFirstChange?: boolean): boolean; interface ConfigFactoryProvider { useFactory: (...args: { [I in keyof D]: D[I] extends Type ? InstanceType : D[I] extends InjectionToken ? any : never; }) => T; deps?: [...D]; } type ConfigDependencies = ReadonlyArray | InjectionToken>; type ConfigProvider = ConfigFactoryProvider | T; type ConfigTransformFn = (config: Partial) => Partial; /** * Provides a configuration object or a factory for creating the configuration object, optionally applying a transformation function. * This utility simplifies the process of defining and injecting configuration objects throughout an Angular application. * * @template T - The type of the configuration object. * @template D - The dependencies required by the configuration factory, if any. * @param {InjectionToken | string} token - The injection token or string token associated with the configuration. * @param {ConfigProvider} config - The configuration object or a factory provider that produces the configuration. * @param {ConfigTransformFn} [transform=() => ({}))] - An optional transformation function to apply to the configuration object. * @returns {FactoryProvider | ValueProvider} - An Angular provider object for the given configuration. * * @example * ```ts * // Define a simple configuration object * const appConfig = { apiEndpoint: 'https://api.example.com' }; * * // Provide the configuration with an optional transformation function * provideConfig(appConfigToken, appConfig, (config) => ({ * ...config, * apiEndpoint: `${config.apiEndpoint}/v2`, * })); * * // Using a factory provider for dynamic configuration * provideConfig(appConfigToken, { * useFactory: (envService) => ({ apiEndpoint: envService.getApiEndpoint() }), * deps: [EnvironmentService], * }); * ``` */ declare function provideConfig(token: InjectionToken | string, config: ConfigProvider, transform?: ConfigTransformFn): FactoryProvider | ValueProvider; /** * Generates a set of configuration-related tokens and utility functions for managing configuration in an Angular application. * This function creates a standardized way to define, provide, and inject configurations, including defaults and transformations. * * @template T - The type of the configuration object. * @template N - The name of the configuration, used to generate token names and utility functions. * @param {N} name - The name of the configuration. * @param {string} prefix - A prefix for the injection token to ensure uniqueness across the application. * @param {T} defaultValue - The default value for the configuration. * @param {ConfigTransformFn} [transform] - An optional transformation function to be applied to the configuration. * @returns An object containing the generated injection token, default configuration, and utility functions for the configuration. * * @example * ```ts * // Create configuration tokens and utilities for "appConfig" with a default value and optional transform function * const { appConfigConfig, provideAppConfigConfig } = createConfigTokens('appConfig', 'myPrefix', { debug: false }, (config) => ({ * ...config, * debug: true, // Enable debug mode by default * })); * * // Later, in a module or component, provide the customized configuration * @NgModule({ * providers: [provideAppConfigConfig({ apiEndpoint: 'https://api.example.com' })] * }) * class AppModule {} * ``` */ declare function createConfigTokens(name: N, prefix: string, defaultValue: T, transform?: ConfigTransformFn): Record<`${N}Config`, InjectionToken>> & Record<`${N}DefaultConfig`, T> & Record<`inject${N}Config`, () => T> & Record<`provide${N}Config`, >>(config: ConfigProvider, D>) => FactoryProvider | ValueProvider>; type QueueItemId = string | number; type QueueItem = T & { id: QueueItemId; }; /** * A class representing a queue structure with advanced functionalities including adding, removing, * updating items, and observing changes through RxJS observables. It supports generic queue item types, * allowing for flexible usage across different contexts. * * @template T - The type of items stored in the queue. Each item must extend an object containing a unique `id`. */ declare class Queue { private readonly queue; private readonly events$$; private values; private firstItem; private lastItem; /** * An observable that emits when an item is added to the queue. * * @type {Observable} */ readonly onAdd$: Observable; /** * An observable that emits when an item in the queue is updated. * * @type {Observable} */ readonly onUpdate$: Observable; /** * An observable that emits when an item is removed from the queue. * * @type {Observable} */ readonly onRemove$: Observable; /** * An observable representing the current state of the queue as an array of items. * * @type {Observable[]>} */ readonly value$: Observable[]>; /** * An observable that emits the current size of the queue. * * @type {Observable} */ readonly size$: Observable; /** * Gets the size of the queue. * * @returns {number} - The number of elements in the queue. */ get size(): number; /** * Checks if the specified item is the first item in the queue. * * @param {QueueItem} item - The item to check. * @returns {boolean} - Returns `true` if the item is the first item in the queue, `false` otherwise. */ isFirst({ id }: QueueItem): boolean; /** * Checks if the specified item is the last item in the queue. * * @param {QueueItem} item - The item to check. * @returns {boolean} - Returns true if the item is the last item, otherwise returns false. */ isLast({ id }: QueueItem): boolean; /** * Retrieves a queue item from the queue based on the provided item or item ID. * * @param {QueueItem | QueueItemId} itemOrId - The queue item or item ID to retrieve. * @returns {QueueItem | null} - The queue item if found, or `null` if not found. */ get(itemOrId: QueueItem | QueueItemId): QueueItem | null; /** * Adds an item to the queue, optionally emitting an event. * * @param {QueueItem} item - The item to add. * @param {boolean} [emitEvent=true] - Whether to emit an event for this action. * @returns {QueueItem} The item added to the queue. */ add(item: QueueItem, emitEvent?: boolean): QueueItem; /** * Adds multiple items to the queue. * * @param {Array>} items - An array of items to be added to the queue. * @param {boolean} emitEvent - (Optional) A boolean indicating whether to emit an event after adding the items. Default is true. * @returns {Array>} An array of added items. */ addMany(items: Array>, emitEvent?: boolean): Array>; /** * Removes an item from the queue. * * @param {Array | QueueItemId>} itemOrId - The item or ID of the item to be removed. * @param {boolean} emitEvent - Whether to emit an event after removing the item. Default is `true`. * @returns The removed item, or `null` if the item was not found. */ remove(itemOrId: QueueItem | QueueItemId, emitEvent?: boolean): QueueItem | null; /** * Removes multiple items from the queue based on the provided item or item IDs. * * @param {Array | QueueItemId>} itemOrIds - An array of QueueItem or QueueItemId objects representing the items to be removed. * @param {boolean} emitEvent - A boolean indicating whether to emit an event after removing the items. Default is true. * @returns {Array | null>} An array of removed QueueItem objects or null values. */ removeMany(itemOrIds: Array | QueueItemId>, emitEvent?: boolean): Array | null>; /** * Clears the queue by removing all items. * * @param {boolean} emitEvent - Whether to emit an event after clearing the queue. Default is true. */ clear(emitEvent?: boolean): void; /** * Returns an array representation of the queue. * * @returns {QueueItem[]} An array containing all the items in the queue. */ toArray(): QueueItem[]; private notify; private createEventObserver; } /** * Options for creating a sorter function. Can be used for arrays of objects (with `keyFn`) * or arrays of primitives (if `keyFn` is omitted). * @template T The type of items to be sorted. */ interface SorterOptions { sortDirection?: SortDirection; locale?: string; collatorOptions?: Intl.CollatorOptions; /** * Optional function to extract the sortable value from an item. * If not provided, the item itself is used for comparison (suitable for arrays of primitives). * The extracted value should be a string, number, boolean, null, or undefined. * @default (item: T) => item */ keyFn?: (item: T) => string | number | boolean | null | undefined; } /** * Defines the possible directions for sorting. * It is used to specify how elements should be ordered. * * - `ASC`: Represents "ascending" order (e.g., A to Z, 1 to 10). * - `DESC`: Represents "descending" order (e.g., Z to A, 10 to 1). */ type SortDirection = (typeof SortDirection)[keyof typeof SortDirection]; /** * Constant object representing the available sort directions. * @property {string} ASC - Sort in ascending order. * @property {string} DESC - Sort in descending order. * @readonly */ declare const SortDirection: { readonly ASC: "asc"; readonly DESC: "desc"; }; /** * Creates a comparison function suitable for Array.prototype.sort(), * based on the provided sort parameters. * Uses Intl.Collator for string comparison. * Can sort arrays of objects by an extracted value (via `keyFn`) or arrays of primitives directly. * * Behavior for `null` and `undefined` values (either direct or returned by `keyFn`): * - `undefined` values are **always** sorted to the end of the array, regardless of the sort direction. * - `null` values are sorted to the beginning of the array for ASC sort. * - For DESC sort, `null` values are sorted to the end of the array, but before any `undefined` values. * * @template T The type of items in the array. * @param options Optional sorting options. If `keyFn` is not provided, items are compared directly. * @returns A comparison function `(a: T, b: T) => number`. */ declare function createSorter(options?: SorterOptions): (a: T, b: T) => number; /** * Checks if the given value is a `ViewContainerRef`. * * @param {unknown} value - The value to check. * @returns {value is ViewContainerRef} `true` if the value is a `ViewContainerRef`, otherwise `false`. */ declare function isViewContainer(value: unknown): value is ViewContainerRef; /** * Checks if the given value is a `TemplateRef`. * * @template T - The embedded view type. * @param {unknown} value - The value to check. * @returns {value is TemplateRef} `true` if the value is a `TemplateRef`, otherwise `false`. */ declare function isTemplateRef(value: unknown): value is TemplateRef; /** * Checks if the given value is an Angular component class. * * @template T - The component class type. * @param {unknown} value - The value to check. * @returns {value is Type} `true` if the value is a component class, otherwise `false`. */ declare function isComponent(value: unknown): value is Type; /** * Checks if the given value is a string. * * @param {unknown} value - The value to check. * @returns {value is string} `true` if the value is a string, otherwise `false`. */ declare function isString(value: unknown): value is string; /** * Checks if the given value is a non-empty string. * * @param {unknown} value - The value to check. * @returns {value is string} `true` if the value is a non-empty string, otherwise `false`. */ declare function isNonEmptyString(value: unknown): value is string; /** * Checks if the given value is a boolean. * * @param {unknown} value - The value to check. * @returns {value is boolean} `true` if the value is a boolean, otherwise `false`. */ declare function isBoolean(value: unknown): value is boolean; /** * Checks if the given value is a function. * * @param {unknown} value - The value to check. * @returns {value is CallableFunction} `true` if the value is a function, otherwise `false`. */ declare function isFunction(value: unknown): value is CallableFunction; /** * Checks if the given value is present (not null or undefined). * * @template T - The value type. * @param {T | null | undefined} value - The value to check. * @returns {value is NonNullable} `true` if the value is present, otherwise `false`. */ declare function isPresent(value: T | null | undefined): value is NonNullable; /** * Checks if the given value is a number. * * @param {unknown} value - The value to check. * @returns {value is number} `true` if the value is a number, otherwise `false`. */ declare function isNumber(value: unknown): value is number; /** * Creates a MonoTypeOperatorFunction that automatically unsubscribes from observables when the host component or service is destroyed. * It uses Angular's `DestroyRef` to detect when the component or service is destroyed and triggers the unsubscription at that point. * This utility function helps in managing subscriptions and prevents memory leaks by ensuring observables are unsubscribed when no longer needed. * * @returns A function that returns a `MonoTypeOperatorFunction`, which can be used in an RxJS pipe to automatically unsubscribe * based on the component's or service's lifecycle. * * @example * ```ts * // In an Angular component or service * import { Component } from '@angular/core'; * import { Observable } from 'rxjs'; * import { untilDestroyed } from './path/to/untilDestroyed'; * * @Component({ * selector: 'app-example', * template: `
Example Component
`, * }) * export class ExampleComponent { * private readonly takeUntilDestroyed = untilDestroyed(); * * constructor() { * const exampleObservable$ = new Observable(observer => { * // Observable logic here * }); * * exampleObservable$.pipe( * this.takeUntilDestroyed(), * ).subscribe(data => { * // Subscription logic here * }); * } * * // No need to manually implement ngOnDestroy to unsubscribe * } * ``` */ declare function untilDestroyed(): () => MonoTypeOperatorFunction; export { Axis, CacheStorageClient, DRAEGER_WEBSITE_URL, EventManager, HTTP_CACHE_CONTROL_HEADER, HTTP_ETAG_HEADER, HTTP_IF_NONE_MATCH_HEADER, Position, Pure, Queue, Side, SortDirection, applyStyles, arrayAttribute, booleanToAttributeString, booleanToOptionalAttributeString, buildUrl, buildWebsiteUrl, clearUniqueIdCache, containsElement, createConfigTokens, createMutationObserver, createResizeObserver, createSorter, cssTranslate, debounce, deferFn, disableCSSTransitions, forceLayoutReflow, getAxis, getLanguageCode, getOppositeSide, getSide, getUniqueId, hasChanged, injectElement, isBoolean, isComponent, isFunction, isNonEmptyString, isNumber, isPresent, isString, isTemplateRef, isUrlMatcher, isViewContainer, matchUrl, orderBy, pluckFromArray, provideConfig, px, reactiveAttributeBinding, reactiveClassBinding, setAttribute, untilDestroyed, waitForAnimations }; export type { ConfigDependencies, ConfigProvider, ConfigTransformFn, GetProperties, NgChanges, OrderByDirection, SorterOptions };