import { type MouseEvent, type ReactNode } from 'react'; /** * Whether an address leaves this interface. * * A scheme in front of it is one answer: a path is a screen here and anything * with `https:` or `mailto:` ahead of it is somebody else's site. Two leading * slashes are the other, and it is the one worth stating out loud — `//host` * and `/\host` read as paths and resolve as absolute addresses on somebody * else's origin, so an address of that shape kept in the app is a foreign host * fetched with our referrer attached and no new tab. Where a screen draws a * link out of a proposal, a token record or anything else it did not write, * that shape is what arrives. * * It sits beside the rule about which clicks are ours because it is the same * question asked one step earlier — a link handed to the router that turns out * to be a foreign host is a host fed to the router, and a link kept from it * that was ours is a document fetched again. */ export declare const away: (href: string) => boolean; /** * How an app moves between its own screens without fetching the document again. * * The router is the app's, and it is the only part of following a link that * this package cannot know. A build that states nothing gets ordinary anchors, * which always work: the page is fetched again, which is slower and correct. */ export type Go = (to: string) => void; /** * The router a tree walks with. One at an app's root. * * A provider rather than a prop on every link: how this app moves between * screens is one fact stated once, and repeating it down fifteen screens is * fifteen chances for one of them to disagree about what a cmd-click means. */ export declare const Walk: ({ value, children }: { value: Go; children: ReactNode; }) => import("react").FunctionComponentElement>; /** * The click handler for an address inside this app, or nothing where no router * was stated. * * The rule about which clicks are ours lives here rather than in each part * because a row in a table leaves for another screen the same way a nav link * does. Two copies of it are two answers waiting to disagree. * * `done` is for a link that closes what it sits in — a menu, a sheet — which * has to happen after the navigation rather than instead of it. */ export declare function useWalk(done?: () => void): (to: string) => ((e: MouseEvent) => void) | undefined; export declare function Link({ href, label, prose, children, }: { href: string; /** * What it is read out as, where the words alone will not do. A table whose * every row links "Open" gives a screen reader the same link a dozen times * with nothing to tell them apart. */ label?: string; /** * Set inside a sentence rather than standing on its own. * * A link offered as a control is one atomic thing; a linked phrase is not, * and five words that cannot break widen the document rather than wrapping * inside it — on a phone at a large type scale that is the whole page * scrolling sideways. So the phrase keeps the sentence's own line breaking. * * The height is kept as well, as padding rather than as a box: the anchor * measures the same tier a finger is asked for everywhere else, the * difference sits either side of the type where it costs nothing, and the * sentence goes on breaking where it would have broken. */ prose?: boolean; /** * The words. Optional because a link set inside a translated sentence is * handed in as an element with nothing in it — the catalogue holds the * phrase, and the runtime puts it between these tags when it draws the * sentence. */ children?: ReactNode; }): import("react").JSX.Element; //# sourceMappingURL=link.d.ts.map