import { RawParams, TargetState, TransitionOptions } from "@uirouter/core"; import { noChange, nothing, AttributePart } from "lit"; import { PartInfo } from "lit/directive.js"; import type { DirectiveResult } from "lit/directive.js"; import { AsyncDirective } from "lit/async-directive.js"; import { UIRouterLit } from "./core.js"; import { UiView } from "./ui-view.js"; /** * The attribute-part sibling of {@link UiSrefDirective}: the same link, bound * where the `href` lives instead of on the element. * * `render()` is a function of the router and the arguments alone — it returns * the `href` and touches no DOM — which is the shape a server renderer needs, * since it runs `render()` and never `update()`. It finds its router from the * element in a document and from the server's render-scoped router under * `@lit-labs/ssr`. Everything else that needs the element (the click handler, * the target event for an enclosing `uiSrefActive`) lives in `update()`, which * only a live document runs. * * @see {@link srefHref} for the public API * * @category directives */ export declare class SrefHrefDirective extends AsyncDirective { /** the target state name from the last render */ state: string | null; /** the target state params from the last render */ params: RawParams; /** the transition options from the last render */ options: TransitionOptions; /** @internal */ element: Element | null; /** @internal */ uiRouter: UIRouterLit | undefined; /** @internal */ parentView: UiView | null; /** the href computed for the target, or null when there is none */ href: string | null; /** the resolved target, or null until the router is found */ targetState: TargetState | null; /** whether the router seek has run — see {@link UiSrefDirective} */ private _seekedRouter; private _firstUpdated; /** @internal */ unsubscribe: (() => void) | undefined; /** @internal */ constructor(partInfo: PartInfo); /** @internal */ getOptions(opts?: TransitionOptions): TransitionOptions; /** * The `href` for the target state; `nothing` when the state has no url; * `noChange` until a router is found, so an attribute a server wrote * survives hydration untouched. * * The scoped slot is read per render rather than cached: a server directive * instance renders once, and a client one never finds a scoped router. */ render(state: string, params?: RawParams, options?: TransitionOptions): string | typeof nothing | typeof noChange; /** @internal */ update(part: AttributePart, [state, params, options]: [string, RawParams?, TransitionOptions?]): ReturnType; /** @internal */ firstUpdated(): void; /** @internal */ doRender: () => void; /** @internal */ onClick: (event: MouseEvent) => void; private warnMissingRouter; /** @internal */ disconnected(): void; /** @internal */ reconnected(): void; } /** * Binds a state's `href` to an attribute: the attribute-part form of * {@link uiSref}. * * The two do the same job — generate the `href`, navigate on click, announce * the target to an enclosing {@link uiSrefActive} — and differ only in where * they sit. `uiSref` is an element part, which only a live browser can see; * this one *is* the `href`, so a static analyser reads the link the way the * browser does, and a server renderer can once it has a router to offer. * Use one or the other on an element, never both. * * **Arguments** are {@link uiSref}'s: the state name, its params, and core's * transition options. There is no `assignHref` — the attribute is the * binding, so it is written wherever it was bound. * * @example * ```ts * import { srefHref } from 'lit-ui-router'; * import { html } from 'lit'; * * html`View User` * ``` * * @example With srefActiveClass and srefAriaCurrent * ```ts * html`Users` * ``` * * @see {@link uiSref} * @see {@link srefActiveClass} * @see {@link srefAriaCurrent} * * @category directives */ export declare const srefHref: (state: string, params?: RawParams, options?: TransitionOptions) => DirectiveResult; //# sourceMappingURL=sref-href.d.ts.map