| 1 |
|
| 2 | import { PageLinkDescriptor } from "../../router/links.js";
|
| 3 | import { FrameworkContextObject } from "./entry.js";
|
| 4 | import * as React$1 from "react";
|
| 5 |
|
| 6 | //#region lib/dom/ssr/components.d.ts
|
| 7 | declare const FrameworkContext: React$1.Context<FrameworkContextObject | undefined>;
|
| 8 | /**
|
| 9 | * Defines the [lazy route discovery](../../explanation/lazy-route-discovery)
|
| 10 | * behavior of the link/form:
|
| 11 | *
|
| 12 | * - "render" - default, discover the route when the link renders
|
| 13 | * - "none" - don't eagerly discover, only discover if the link is clicked
|
| 14 | */
|
| 15 | type DiscoverBehavior = "render" | "none";
|
| 16 | /**
|
| 17 | * Defines the prefetching behavior of the link:
|
| 18 | *
|
| 19 | * - "none": Never fetched
|
| 20 | * - "intent": Fetched when the user focuses or hovers the link
|
| 21 | * - "render": Fetched when the link is rendered
|
| 22 | * - "viewport": Fetched when the link is in the viewport
|
| 23 | */
|
| 24 | type PrefetchBehavior = "intent" | "render" | "none" | "viewport";
|
| 25 | /**
|
| 26 | * Props for the {@link Links} component.
|
| 27 | *
|
| 28 | * @category Types
|
| 29 | */
|
| 30 | interface LinksProps {
|
| 31 | /**
|
| 32 | * A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
| 33 | * attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
| 34 | * element. If not provided in Framework Mode, it will default to any
|
| 35 | * {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
| 36 | */
|
| 37 | nonce?: string | undefined;
|
| 38 | /**
|
| 39 | * A [`crossOrigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin)
|
| 40 | * attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
| 41 | * element
|
| 42 | */
|
| 43 | crossOrigin?: "anonymous" | "use-credentials";
|
| 44 | }
|
| 45 | /**
|
| 46 | * Renders all the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
| 47 | * tags created by the route module's [`links`](../../start/framework/route-module#links)
|
| 48 | * export. You should render it inside the [`<head>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head)
|
| 49 | * of your document.
|
| 50 | *
|
| 51 | * @example
|
| 52 | * import { Links } from "react-router";
|
| 53 | *
|
| 54 | * export default function Root() {
|
| 55 | * return (
|
| 56 | * <html>
|
| 57 | * <head>
|
| 58 | * <Links />
|
| 59 | * </head>
|
| 60 | * <body></body>
|
| 61 | * </html>
|
| 62 | * );
|
| 63 | * }
|
| 64 | *
|
| 65 | * @public
|
| 66 | * @category Components
|
| 67 | * @mode framework
|
| 68 | * @param props Props
|
| 69 | * @param {LinksProps.nonce} props.nonce n/a
|
| 70 | * @param {LinksProps.crossOrigin} props.crossOrigin n/a
|
| 71 | * @returns A collection of React elements for [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
| 72 | * tags
|
| 73 | */
|
| 74 | declare function Links({
|
| 75 | nonce,
|
| 76 | crossOrigin
|
| 77 | }: LinksProps): React$1.JSX.Element;
|
| 78 | /**
|
| 79 | * Renders [`<link rel=prefetch|modulepreload>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/rel)
|
| 80 | * tags for modules and data of another page to enable an instant navigation to
|
| 81 | * that page. [`<Link prefetch>`](./Link#prefetch) uses this internally, but you
|
| 82 | * can render it to prefetch a page for any other reason.
|
| 83 | *
|
| 84 | * For example, you may render one of this as the user types into a search field
|
| 85 | * to prefetch search results before they click through to their selection.
|
| 86 | *
|
| 87 | * @example
|
| 88 | * import { PrefetchPageLinks } from "react-router";
|
| 89 | *
|
| 90 | * <PrefetchPageLinks page="/absolute/path" />
|
| 91 | *
|
| 92 | * @public
|
| 93 | * @category Components
|
| 94 | * @mode framework
|
| 95 | * @param props Props
|
| 96 | * @param {PageLinkDescriptor.page} props.page n/a
|
| 97 | * @param props.linkProps Additional props to spread onto the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
| 98 | * tags, such as [`crossOrigin`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/crossOrigin),
|
| 99 | * [`integrity`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/integrity),
|
| 100 | * [`rel`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/rel),
|
| 101 | * etc.
|
| 102 | * @returns A collection of React elements for [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
| 103 | * tags
|
| 104 | */
|
| 105 | declare function PrefetchPageLinks({
|
| 106 | page,
|
| 107 | ...linkProps
|
| 108 | }: PageLinkDescriptor): React$1.JSX.Element | null;
|
| 109 | /**
|
| 110 | * Renders all the [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta)
|
| 111 | * tags created by the route module's [`meta`](../../start/framework/route-module#meta)
|
| 112 | * export. You should render it inside the [`<head>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head)
|
| 113 | * of your document.
|
| 114 | *
|
| 115 | * @example
|
| 116 | * import { Meta } from "react-router";
|
| 117 | *
|
| 118 | * export default function Root() {
|
| 119 | * return (
|
| 120 | * <html>
|
| 121 | * <head>
|
| 122 | * <Meta />
|
| 123 | * </head>
|
| 124 | * </html>
|
| 125 | * );
|
| 126 | * }
|
| 127 | *
|
| 128 | * @public
|
| 129 | * @category Components
|
| 130 | * @mode framework
|
| 131 | * @returns A collection of React elements for [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta)
|
| 132 | * tags
|
| 133 | */
|
| 134 | declare function Meta(): React$1.JSX.Element;
|
| 135 | /**
|
| 136 | * A couple common attributes:
|
| 137 | *
|
| 138 | * - `<Scripts crossOrigin>` for hosting your static assets on a different
|
| 139 | * server than your app.
|
| 140 | * - `<Scripts nonce>` to support a [content security policy for scripts](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src)
|
| 141 | * with [nonce-sources](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#sources)
|
| 142 | * for your [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
|
| 143 | * tags.
|
| 144 | *
|
| 145 | * You cannot pass through attributes such as [`async`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/async),
|
| 146 | * [`defer`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/defer),
|
| 147 | * [`noModule`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/noModule),
|
| 148 | * [`src`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/src),
|
| 149 | * or [`type`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/type),
|
| 150 | * because they are managed by React Router internally.
|
| 151 | *
|
| 152 | * @category Types
|
| 153 | */
|
| 154 | type ScriptsProps = Omit<React$1.HTMLProps<HTMLScriptElement>, "async" | "children" | "dangerouslySetInnerHTML" | "defer" | "noModule" | "src" | "suppressHydrationWarning" | "type"> & {
|
| 155 | /**
|
| 156 | * A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
| 157 | * attribute to render on the [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
|
| 158 | * element. If not provided in Framework Mode, it will default to any
|
| 159 | * {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
| 160 | */
|
| 161 | nonce?: string | undefined;
|
| 162 | };
|
| 163 | /**
|
| 164 | * Renders the client runtime of your app. It should be rendered inside the
|
| 165 | * [`<body>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body)
|
| 166 | * of the document.
|
| 167 | *
|
| 168 | * If server rendering, you can omit `<Scripts/>` and the app will work as a
|
| 169 | * traditional web app without JavaScript, relying solely on HTML and browser
|
| 170 | * behaviors.
|
| 171 | *
|
| 172 | * @example
|
| 173 | * import { Scripts } from "react-router";
|
| 174 | *
|
| 175 | * export default function Root() {
|
| 176 | * return (
|
| 177 | * <html>
|
| 178 | * <head />
|
| 179 | * <body>
|
| 180 | * <Scripts />
|
| 181 | * </body>
|
| 182 | * </html>
|
| 183 | * );
|
| 184 | * }
|
| 185 | *
|
| 186 | * @public
|
| 187 | * @category Components
|
| 188 | * @mode framework
|
| 189 | * @param scriptProps Additional props to spread onto the [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
|
| 190 | * tags, such as [`crossOrigin`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/crossOrigin),
|
| 191 | * [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce),
|
| 192 | * etc.
|
| 193 | * @returns A collection of React elements for [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
|
| 194 | * tags
|
| 195 | */
|
| 196 | declare function Scripts(scriptProps: ScriptsProps): React$1.JSX.Element | null;
|
| 197 | //#endregion
|
| 198 | export { DiscoverBehavior, FrameworkContext, Links, LinksProps, Meta, PrefetchBehavior, PrefetchPageLinks, Scripts, ScriptsProps }; |
| \ | No newline at end of file |