import { type Signal } from '@angular/core'; import { type Params } from '@angular/router'; import { DefaultValueOptions, InjectorOptions, ParseOptions, RequiredOptions } from 'ngxtension/shared'; type QueryParamsTransformFn = (params: Params) => ReadT; /** * The `QueryParamsOptions` type defines options for configuring the behavior of the `injectQueryParams` function. * * @template ReadT - The expected type of the read value. * @template WriteT - The type of the value to be written. * @template DefaultValueT - The type of the default value. */ export type QueryParamsOptions = ParseOptions & DefaultValueOptions & InjectorOptions & RequiredOptions & { /** * The initial value to use if the query parameter is not present or undefined. * * @deprecated Use `defaultValue` as a replacement. */ initialValue?: DefaultValueT; /** * A transformation function to convert the written value to the expected read value. * * @deprecated Use `parse` as a replacement. * @param v - The value to transform. * @returns The transformed value. */ transform?: (v: string | null) => ReadT; }; /** * The `injectQueryParams` function allows you to access and manipulate query parameters from the current route. * * @returns A `Signal` that emits the entire query parameters object. */ export declare function injectQueryParams(): Signal; /** * The `injectQueryParams` function allows you to access and manipulate query parameters from the current route. * * @param {string} key - The name of the query parameter to retrieve. * @returns {Signal} A `Signal` that emits the value of the specified query parameter, or `null` if it's not present. */ export declare function injectQueryParams(key: string): Signal; /** * The `injectQueryParams` function allows you to access and manipulate query parameters from the current route. * * @param {string} key - The name of the query parameter to retrieve. * @param {QueryParamsOptions} options - Configuration options with required flag that ensures a non-null return. * @returns {Signal} A `Signal` that emits the value of the specified query parameter. Throws an error if the query parameter is not present. */ export declare function injectQueryParams(key: string, options: QueryParamsOptions & { required: true; }): Signal; /** * The `injectQueryParams` function allows you to access and manipulate query parameters from the current route. * * @param {string} key - The name of the query parameter to retrieve. * @param {QueryParamsOptions} options - Optional configuration options for the query parameter. * @returns {Signal} A `Signal` that emits the transformed value of the specified query parameter, or `null` if it's not present. */ export declare function injectQueryParams(key?: string, options?: QueryParamsOptions): Signal; /** * The `injectQueryParams` function allows you to access and manipulate query parameters from the current route. * It retrieves the value of a query parameter based on a custom transform function applied to the query parameters object. * * @template ReadT - The expected type of the read value. * @param {QueryParamsTransformFn} fn - A transform function that takes the query parameters object (`params: Params`) and returns the desired value. * @returns {Signal} A `Signal` that emits the transformed value based on the provided custom transform function. * * @example * const searchValue = injectQueryParams((params) => params['search'] as string); */ export declare function injectQueryParams(fn: QueryParamsTransformFn): Signal; /** * The `injectQueryParams` function namespace provides additional functionality for handling array query parameters. */ export declare namespace injectQueryParams { /** * Retrieve an array query parameter with optional configuration options. * * @param {string} key - The name of the array query parameter to retrieve. * @param {QueryParamsOptions} options - Configuration options with required flag that ensures a non-null return. * @returns {Signal} A `Signal` that emits an array of values for the specified query parameter. Throws an error if the query parameter is not present. */ function array(key: string, options: QueryParamsOptions & { required: true; }): Signal; /** * Retrieve an array query parameter with optional configuration options. * * @param {string} key - The name of the array query parameter to retrieve. * @param {QueryParamsOptions} options - Optional configuration options for the array query parameter. * @returns {Signal} A `Signal` that emits an array of values for the specified query parameter, or `null` if it's not present. */ function array(key: string, options?: QueryParamsOptions): Signal; /** * Retrieve an array query parameter with optional configuration options. * * @param {string} key - The name of the array query parameter to retrieve. * @param {QueryParamsOptions} options - Optional configuration options for the array query parameter. * @returns {Signal} A `Signal` that emits an array of values for the specified query parameter, or `null` if it's not present. */ function array(key: string, options?: QueryParamsOptions): Signal; } export {};