export { CommonErrorCode } from '@atlasng/common/errors'; import * as _angular_core from '@angular/core'; import { Signal, Injector, EnvironmentProviders } from '@angular/core'; import * as _atlasng_common from '@atlasng/common'; import { UrlCreationOptions, UrlTree, NavigationBehaviorOptions, IsActiveMatchOptions, Params, QueryParamsHandling, ActivatedRoute } from '@angular/router'; import { Feature } from '@atlasng/core'; /** * Command input for link preparation. * * Extends Angular URL creation options and adds the target route command. */ interface LinkCommand extends UrlCreationOptions { /** * Route command represented as a path string, command array, or prebuilt `UrlTree`. */ command: string | readonly unknown[] | UrlTree; } /** * Anchor-relevant attributes that can be applied to prepared links. */ interface LinkAttributes { /** * Browser target for link navigation. */ target?: string; /** * Relationship hint used for link security and semantics. */ rel?: string; /** * Optional filename used for download behavior. */ download?: string; } /** * Link attributes where each value may be `null`. * * `null` indicates that the attribute should be removed from the host element * instead of falling back to its initial value. */ type NullableLinkAttributes = { [TKey in keyof LinkAttributes]: LinkAttributes[TKey] | null; }; /** * A link value resolved by a `LinkHandler`. * * Includes the final URL and optional DOM attributes. */ interface PreparedLink { /** * Final navigation URL. */ href: string; /** * Optional attributes to apply to the host element. */ attributes?: NullableLinkAttributes; } /** * URL parts that count as a change for {@link LinkHandler.currentUrl}. The path always counts. */ interface UrlChangeMatchOptions { /** * Whether matrix parameter changes count. Defaults to `true`. */ matrixParams?: boolean; /** * Whether query parameter changes count. Defaults to `true`. */ queryParams?: boolean; /** * Whether fragment changes count. Defaults to `true`. */ fragment?: boolean; } /** * Base strategy for preparing and executing link navigation. */ declare abstract class LinkHandler { /** * Tracks the current URL, including changes from browser back and forward. * * The signal only notifies when the path or a part enabled in `matchOptions` changes. Its value is the full URL * as of the last notified change, so disabled parts may be stale. The URL format is handler specific. * * @param matchOptions URL parts that count as a change. All parts count by default. * @returns A signal holding the current URL. */ abstract currentUrl(matchOptions?: UrlChangeMatchOptions): Signal; /** * Resolves command and element inputs into a navigable link descriptor. * * @param command Navigation command and URL creation options. * @param element Host element associated with the link. * @param attributes Optional link attributes from directive inputs. * @param injector Optional injector for advanced handler scenarios. * @returns A prepared link payload consumed by `navigateTo`. */ abstract prepareLink(command: LinkCommand, element?: Element, attributes?: LinkAttributes, injector?: Injector): TLink; /** * Performs navigation for a previously prepared link. * * @param link Prepared link payload. * @param event Triggering DOM event. * @param options Navigation behavior options. * @returns `true` when native navigation should continue, `false` when handled internally, * or `void` for implementations that do not provide a continuation signal. */ abstract navigateTo(link: TLink, event: Event, options: NavigationBehaviorOptions): boolean | void; /** * Checks if a prepared link is active based on the current state. * * @param link Prepared link metadata. * @param matchOptions Options for matching the active state. * @returns A signal indicating if the link is active. */ abstract isActive(link: TLink, matchOptions?: Partial): Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵprov: _angular_core.ɵɵInjectableDeclaration>; } /** * Generic navigation directive that works with both internal Angular routes and external URLs. */ declare class AnyLink { #private; /** Primary link command input. */ readonly command: _angular_core.InputSignalWithTransform; /** Optional browsing context target, e.g. `_blank`. */ readonly target: _angular_core.InputSignal; /** Optional `rel` attribute value forwarded to the rendered link. */ readonly rel: _angular_core.InputSignal; /** Optional `download` attribute value forwarded to the rendered link. */ readonly download: _angular_core.InputSignal; /** Router query params used when the command resolves to an Angular route. */ readonly queryParams: _angular_core.InputSignal; /** Strategy for merging provided query params with the current URL query params. */ readonly queryParamsHandling: _angular_core.InputSignal; /** URL fragment to apply during navigation. */ readonly fragment: _angular_core.InputSignal; /** Preserves the current fragment when true. */ readonly preserveFragment: _angular_core.InputSignalWithTransform; /** Navigates without pushing a new browser history entry when true. */ readonly skipLocationChange: _angular_core.InputSignalWithTransform; /** Route used as a base for relative navigation commands. */ readonly relativeTo: _angular_core.InputSignal; /** Optional browser-visible URL override for router navigation. */ readonly browserUrl: _angular_core.InputSignal; /** Replaces the current history entry instead of pushing a new one when true. */ readonly replaceUrl: _angular_core.InputSignalWithTransform; /** Optional history state object passed to the router. */ readonly state: _angular_core.InputSignal | undefined>; /** Optional router navigation extras info payload. */ readonly info: _angular_core.InputSignal; /** Prepared link model derived from command inputs and current directive state. */ readonly preparedLink: _angular_core.Signal; /** Resolved `href` host attribute value. */ protected readonly hrefAttribute: _angular_core.Signal; /** Resolved `target` host attribute value. */ protected readonly targetAttribute: _angular_core.Signal; /** Resolved `rel` host attribute value. */ protected readonly relAttribute: _angular_core.Signal; /** Resolved `download` host attribute value. */ protected readonly downloadAttribute: _angular_core.Signal; /** Resolved `tabindex` host attribute value for keyboard accessibility on non-anchor hosts. */ protected readonly tabIndexAttribute: _angular_core.Signal; /** Resolved `role` host attribute value, announcing non-anchor hosts without their own role as links. */ protected readonly roleAttribute: _angular_core.Signal; /** * Initializes the directive and asserts against invalid input combinations in development mode. */ constructor(); /** * Delegates click handling to `LinkHandler` when a command is configured. * * @param event Event emitted by the host click or keyboard interaction. * @returns `true` to keep default browser behavior, or `false` to suppress it. */ protected onClick(event: Event): boolean; /** * Activates non-anchor, non-button hosts with the Enter key, matching native link behavior. * * Anchor-like hosts and buttons already turn Enter into a click, and key presses from descendants * such as nested form controls are ignored. * * @param event Keyboard event emitted by the host. * @returns `true` to keep default browser behavior, or `false` to suppress it. */ protected onEnterKey(event: Event): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** CSS classes accepted by {@link AnyLinkActive}. */ type AnyLinkActiveClassList = string | string[] | null | undefined; /** Route-matching configuration accepted by {@link AnyLinkActive}. */ type AnyLinkActiveOptions = { exact: boolean; } | Partial | null | undefined; /** Values supported by the WAI-ARIA `aria-current` attribute. */ type AriaCurrent = 'page' | 'step' | 'location' | 'date' | 'time' | true | false; /** * Applies classes and optional `aria-current` metadata when an associated * {@link AnyLink} is active. * * The directive can share a host with one link or be placed on an ancestor to * monitor any number of descendant links. */ declare class AnyLinkActive { #private; /** CSS classes applied to the host while at least one associated link is active. */ readonly classes: _angular_core.InputSignalWithTransform; /** Route-matching behavior, or `null` to disable active-state matching. */ readonly options: _angular_core.InputSignal; /** Value assigned to `aria-current` while active. */ readonly ariaCurrentWhenActive: _angular_core.InputSignal; /** Emits an initially active state and every subsequent active-state change. */ readonly isActiveChange: _angular_core.OutputEmitterRef; /** Whether the host link or at least one descendant link is currently active. */ readonly isActive: Signal; /** Descendant links monitored when this directive is placed on an ancestor. */ protected readonly links: Signal; /** Watches the aggregate active state and emits changes to consumers. */ constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Input accepted by {@link AnyLink} for configuring navigation. * * Shorthand route values are normalized to a {@link LinkCommand}, while `null` * and `undefined` represent a link without a navigation command. */ type AnyLinkCommand = string | readonly unknown[] | UrlTree | LinkCommand | null | undefined; /** * Checks whether a value can be used as an {@link AnyLinkCommand}. * * @param value Value to inspect. * @returns `true` when the value is a supported shorthand, a `UrlTree`, a * {@link LinkCommand}, or an empty command value. */ declare function isAnyLinkCommand(value: unknown): value is AnyLinkCommand; /** * Normalizes an {@link AnyLinkCommand} into the object form consumed by link handlers. * * Existing {@link LinkCommand} objects are returned unchanged so their URL creation * options are preserved. * * @param value Command input to normalize. * @returns A link command, or `undefined` when no command was supplied. */ declare function commandAttribute(value: AnyLinkCommand): LinkCommand | undefined; /** * Configures how IDs are composed by {@link IdGenerator}. */ interface IdGeneratorConfig { /** * An infix to include in generated IDs. * If `true`, a random hexadecimal infix will be used. With server-side rendering, the server's infix * is transferred to the browser so that hydrated IDs match. * If `false`, no infix will be included. */ infix?: string | boolean; } /** * Provides the {@link IdGeneratorConfig} for the application. * * @param config Configuration values to provide. * @returns Provider for the configuration. */ declare const provideIdGeneratorConfig: (config: IdGeneratorConfig | (() => IdGeneratorConfig)) => _angular_core.Provider; /** * Generates stable, incrementing DOM-safe IDs. */ declare class IdGenerator { #private; /** Configuration for the ID generator. */ readonly config: { readonly infix: string | boolean; }; /** * Builds a unique ID using the provided prefix and generator configuration. * * @param prefix Prefix for the ID. * @returns A hyphen-delimited identifier. */ getId(prefix: string): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Provider bundle returned by link-handler feature helpers. */ type LinkHandlerFeature = Feature; /** * Link handler feature variants supported by {@link provideLinkHandler}. */ declare enum LinkHandlerFeatureKind { /** Feature that installs a caller-supplied {@link LinkHandler}. */ Custom = 0, /** Feature that installs the Angular Router-aware handler. */ Router = 1, /** Feature that keeps the default routerless handler. */ Routerless = 2 } /** * Configures link navigation with a custom handler factory. * * @param handlerFactory Factory that creates the custom link handler. * @returns Link handler feature consumed by {@link provideLinkHandler}. */ declare function withCustomHandler(handlerFactory: () => LinkHandler): LinkHandlerFeature; /** * Configures link navigation to use Angular Router for route commands. * * @returns Link handler feature consumed by {@link provideLinkHandler}. */ declare function withRouterHandler(): LinkHandlerFeature; /** * Explicitly selects the default routerless link handler. * * @returns Link handler feature consumed by {@link provideLinkHandler}. */ declare function withRouterlessHandler(): LinkHandlerFeature; /** * Creates Angular environment providers for the selected link handler features. * * @param features Link handler features to install. * @returns Environment providers that register the selected handler. * @throws When more than one handler feature is configured in development mode. */ declare function provideLinkHandler(...features: LinkHandlerFeature[]): EnvironmentProviders; /** * Link metadata prepared by the default routerless handler. */ interface RouterlessPreparedLink extends PreparedLink { /** * Indicates whether the host element can use native anchor navigation. */ isAnchorLikeElement: boolean; } /** * Default link handler that navigates through `window.location` without Angular Router navigation. * * Active state tracks the browser URL through `popstate` and `hashchange` events, the Navigation API's * `currententrychange` event when the browser supports it, and the handler's own navigations. */ declare class RouterlessLinkHandler implements LinkHandler { #private; /** * Starts tracking browser URL changes for reactive active-state checks. */ constructor(); /** * Builds a `PreparedLink` from the given command and element context. * * @param command Navigation command and URL creation options. * @param element Host element associated with the link. * @param attributes Optional link attributes. * @param _injector Unused injector placeholder for API parity. * @returns Prepared link metadata used by `navigateTo`. */ prepareLink(command: LinkCommand, element?: Element, attributes?: LinkAttributes, _injector?: Injector): RouterlessPreparedLink; /** * Navigates to a prepared link using native anchor behavior or `window.location`. * * URLs with a scheme outside the safe allowlist (for example `javascript:`) are ignored. * * @param link Prepared link to navigate to. * @param _event Triggering event (unused). * @param options Navigation behavior options. * @returns `true` when native navigation should continue, otherwise `false`. Always `true` without a browser location. */ navigateTo(link: RouterlessPreparedLink, _event: Event, options: NavigationBehaviorOptions): boolean; /** * Tracks the browser URL (`location.href`). * * @param matchOptions URL parts that count as a change. All parts count by default. * @returns A signal holding the URL as of the last change that counted. */ currentUrl(matchOptions?: UrlChangeMatchOptions): Signal; /** * Checks if a prepared link is active based on the current state. * * @param link Prepared link metadata. * @param matchOptions Options for matching the active state. * @returns A signal indicating if the link is active. */ isActive(link: RouterlessPreparedLink, matchOptions?: Partial): Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Link metadata prepared by the Angular Router-aware handler. */ interface RouterPreparedLink extends RouterlessPreparedLink { /** * Parsed router URL used for Angular Router navigation. * * Omitted when the command resolves to an absolute external URL. */ urlTree?: UrlTree; } /** * Link handler that supports Angular Router commands while delegating absolute URLs to the routerless handler. */ declare class RouterLinkHandler implements LinkHandler { #private; /** * Starts tracking URL changes reported by Angular's `Location`. */ constructor(); /** * Prepares a link payload that supports both absolute URLs and Angular Router commands. * * @param command Navigation command and URL creation options. * @param element Host element associated with the link. * @param attributes Optional link attributes from directive inputs. * @param injector Optional injector used to resolve router state for relative commands. * @returns Prepared link metadata used by {@link navigateTo}. */ prepareLink(command: LinkCommand, element?: Element, attributes?: LinkAttributes, injector?: Injector): RouterPreparedLink; /** * Navigates to a prepared link using Angular Router when a `UrlTree` is available. * * Preserves native browser behavior for modified clicks, non-`_self` targets, * downloads, and absolute URLs delegated to the routerless handler. * * @param link Prepared link metadata from {@link prepareLink}. * @param event Triggering DOM event. * @param options Angular Router navigation behavior options. * @returns `true` when native navigation should continue, otherwise `false` or `void`. */ navigateTo(link: RouterPreparedLink, event: Event, options: NavigationBehaviorOptions): boolean | void; /** * Tracks the browser-visible URL reported by Angular's `Location`. * * @param matchOptions URL parts that count as a change. All parts count by default. * @returns A signal holding the URL, in the same format as prepared link hrefs, as of the last change that counted. */ currentUrl(matchOptions?: UrlChangeMatchOptions): Signal; /** * Checks if a prepared link is active based on the current state. * * @param link Prepared link metadata. * @param matchOptions Options for matching the active state. * @returns A signal indicating if the link is active. */ isActive(link: RouterPreparedLink, matchOptions?: Partial): Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } export { AnyLink, AnyLinkActive, IdGenerator, LinkHandler, LinkHandlerFeatureKind, RouterLinkHandler, RouterlessLinkHandler, commandAttribute, isAnyLinkCommand, provideIdGeneratorConfig, provideLinkHandler, withCustomHandler, withRouterHandler, withRouterlessHandler }; export type { AnyLinkActiveClassList, AnyLinkActiveOptions, AnyLinkCommand, AriaCurrent, IdGeneratorConfig, LinkAttributes, LinkCommand, LinkHandlerFeature, NullableLinkAttributes, PreparedLink, RouterPreparedLink, RouterlessPreparedLink, UrlChangeMatchOptions };