import { ContextAwareStateOptions } from '../core'; /** * Config for the {@link SelectQueryParam} decorator * @public * @group Navigation */ export interface SelectQueryParamOptions extends ContextAwareStateOptions { /** * The query param to select */ selector: string; } /** * Decorator that subscribes to a specific query parameter from the {@link Navigator}. * * This decorator automatically updates the decorated property whenever the specified * query parameter changes in the URL. It's useful for components that need to react * to URL changes without manually parsing the location. It's the recommended approach * over manual subscriptions as it handles subscription lifecycle automatically. * * @param options - Configuration including the query param selector and state transformation via {@link SelectQueryParamOptions} * @returns A PropertyDecorator that sets up automatic subscription to the query parameter * * @remarks * Subscribes to: {@link Navigator} * * Updates: The decorated property with the query parameter value. The value is * parsed with `JSON.parse()` when possible, so the type may be `string`, * `number`, `boolean`, an array, an object, or `undefined` if the parameter * is not present * * URL-aware: Automatically updates when the URL changes * * Lifecycle: Automatically subscribes in `connectedCallback` and * unsubscribes in `disconnectedCallback` * * @example Get query parameter value * ```ts * import { State } from '@stencil/core'; * import { SelectQueryParam } from '@limetech/lime-web-components'; * * class SearchComponent { * @State() * @SelectQueryParam({ selector: 'query' }) * private searchQuery: string; * } * ``` * * @example Parse and transform query parameter * ```ts * import { State } from '@stencil/core'; * import { SelectQueryParam } from '@limetech/lime-web-components'; * * class PagedList { * // A numeric value like `?page=2` arrives already parsed as a number * @State() * @SelectQueryParam({ * selector: 'page', * map: [(page) => (typeof page === 'number' ? page : 1)], * }) * private currentPage: number; * } * ``` * * @public * @group Navigation */ export declare function SelectQueryParam(options: SelectQueryParamOptions): PropertyDecorator;