@alchemy.run/sigil 0.0.0-alpha.4 → 0.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -9
- package/THIRD_PARTY_NOTICES.md +39 -1
- package/dist/Text-BobFKi74.d.ts +452 -0
- package/dist/ansi.d.ts +122 -131
- package/dist/ansi.js +86 -6
- package/dist/capabilities.d.ts +5 -0
- package/dist/capabilities.js +3 -0
- package/dist/cell-_ZVhbfl0.js +44 -0
- package/dist/color-CkbalRqK.js +2 -0
- package/dist/color-policy-BMzMwV7Q.d.ts +22 -0
- package/dist/color-policy-SVj1pYTA.js +560 -0
- package/dist/color-profile-DHhQHY55.js +36 -0
- package/dist/color-profile-u0Nhe9Nv.d.ts +97 -0
- package/dist/color.d.ts +21 -0
- package/dist/color.js +3 -0
- package/dist/cursor-position-D2LAkRG0.d.ts +7 -0
- package/dist/detect-Bh4yGP6w.d.ts +186 -0
- package/dist/detect-BuTXtY6e.js +373 -0
- package/dist/env-YVw64yZS.js +9 -0
- package/dist/escapes-CB_6CWOE.d.ts +72 -0
- package/dist/geometry-BxXOzJgo.d.ts +11 -0
- package/dist/index-DZ88EXJv.d.ts +21 -0
- package/dist/index.d.ts +143 -498
- package/dist/index.js +1026 -2244
- package/dist/osc-CCH7xDoS.js +71 -0
- package/dist/osc-Cn0fw77g.d.ts +23 -0
- package/dist/paint-C19minOS.d.ts +81 -0
- package/dist/query-vaIeGOkH.d.ts +152 -0
- package/dist/router.d.ts +392 -0
- package/dist/router.js +709 -0
- package/dist/sample-Cqw1bjUL.js +445 -0
- package/dist/screen-BOSLQ8fF.d.ts +49 -0
- package/dist/screen-CiPytswf.js +342 -0
- package/dist/screen.d.ts +5 -0
- package/dist/screen.js +5 -0
- package/dist/semantic-text-style-DIMzC7xt.js +91 -0
- package/dist/serialize-BTkAZgw1.js +79 -0
- package/dist/session-aZr9O8h3.js +665 -0
- package/dist/sgr-BhwaWAJB.js +246 -0
- package/dist/store-CgrG9K4y.d.ts +72 -0
- package/dist/string-width-CijQwpIk.js +69 -0
- package/dist/strip-BvU4toXG.js +6 -0
- package/dist/terminal.d.ts +118 -0
- package/dist/terminal.js +2 -0
- package/dist/tokenize-AjqbvtiT.js +1242 -0
- package/dist/tokenize-Dx1y_l5H.d.ts +57 -0
- package/dist/truncate-D31fhU6i.js +562 -0
- package/dist/use-focus-BzqAJi0n.js +1337 -0
- package/package.json +41 -9
- package/src/ansi/chalk.ts +5 -3
- package/src/ansi/escapes.ts +14 -0
- package/src/ansi/graphemes.ts +8 -0
- package/src/ansi/hyperlink.ts +44 -0
- package/src/ansi/index.ts +3 -1
- package/src/ansi/osc.ts +77 -0
- package/src/ansi/tokenize.ts +3 -4
- package/src/capabilities/color-policy.ts +34 -0
- package/src/capabilities/detect.ts +594 -0
- package/src/capabilities/index.ts +37 -0
- package/src/capabilities/query.ts +657 -0
- package/src/capabilities/store.ts +379 -0
- package/src/color/index.ts +3 -0
- package/src/color/paint.ts +169 -0
- package/src/color/palette.ts +48 -0
- package/src/color/sample.ts +323 -0
- package/src/color.ts +1 -0
- package/src/components/AnsiText.tsx +42 -0
- package/src/components/App.tsx +98 -10
- package/src/components/BackgroundContext.ts +2 -3
- package/src/components/Box.tsx +0 -8
- package/src/components/CursorContext.ts +1 -1
- package/src/components/Hyperlink.tsx +56 -0
- package/src/components/TerminalOscContext.ts +25 -0
- package/src/components/Text.tsx +22 -45
- package/src/components/Transform.tsx +1 -1
- package/src/dom.ts +11 -2
- package/src/global.d.ts +3 -0
- package/src/hooks/use-capabilities.ts +73 -0
- package/src/hooks/use-cursor.ts +2 -2
- package/src/hooks/use-terminal-osc.ts +59 -0
- package/src/index.ts +45 -1
- package/src/ink.tsx +213 -153
- package/src/{render-node-to-output.ts → paint-tree.ts} +75 -48
- package/src/reconciler.ts +24 -3
- package/src/render-background.ts +36 -15
- package/src/render-border.ts +94 -61
- package/src/render-frame.ts +83 -0
- package/src/render-to-string.ts +21 -6
- package/src/render.ts +15 -6
- package/src/router/components.tsx +343 -0
- package/src/router/context.ts +41 -0
- package/src/router/history.ts +194 -0
- package/src/router/hooks.tsx +391 -0
- package/src/router/index.ts +34 -0
- package/src/router/matcher.ts +571 -0
- package/src/screen/ansi.ts +184 -0
- package/src/screen/canvas.ts +160 -0
- package/src/screen/cell.ts +138 -0
- package/src/screen/color-profile.ts +47 -0
- package/src/screen/geometry.ts +9 -0
- package/src/screen/index.ts +6 -0
- package/src/screen/screen.ts +305 -0
- package/src/screen/serialize.ts +129 -0
- package/src/screen.ts +1 -0
- package/src/semantic-text-style.ts +118 -0
- package/src/squash-text-nodes.ts +2 -5
- package/src/structured-text.ts +325 -0
- package/src/styles.ts +19 -14
- package/src/terminal/index.ts +2 -0
- package/src/terminal/inline-presenter.ts +120 -0
- package/src/terminal/input.ts +86 -0
- package/src/terminal/render-scheduler.ts +37 -0
- package/src/terminal/screen-presenter.ts +188 -0
- package/src/terminal/session.ts +407 -0
- package/src/terminal.ts +1 -0
- package/src/testing/browser.ts +588 -0
- package/src/testing/emulators.ts +205 -0
- package/src/testing/explorer-app/index.html +12 -0
- package/src/testing/explorer-app/main.ts +381 -0
- package/src/testing/explorer-app/style.css +194 -0
- package/src/testing/explorer-app/tsconfig.json +15 -0
- package/src/testing/explorer-app/vite-env.d.ts +1 -0
- package/src/testing/index.ts +26 -0
- package/src/testing/keys.ts +56 -0
- package/src/testing/live.ts +85 -0
- package/src/testing/matchers.ts +70 -0
- package/src/testing/public.ts +94 -0
- package/src/testing/terminal.ts +349 -0
- package/src/testing/vitest.ts +157 -0
- package/src/transform-adapter.ts +14 -0
- package/src/wrap-text.ts +4 -0
- package/dist/sgr-CMfEpjSk.d.ts +0 -91
- package/dist/truncate-Cr6xVFMa.js +0 -2330
- package/src/ansi/supports-color.ts +0 -207
- package/src/colorize.ts +0 -60
- package/src/log-update.ts +0 -370
- package/src/output.ts +0 -308
- package/src/renderer.ts +0 -73
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { t as Props } from "./Text-BobFKi74.js";
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/router/history.d.ts
|
|
4
|
+
/**
|
|
5
|
+
The type of navigation that produced the current location:
|
|
6
|
+
|
|
7
|
+
- `"POP"` — moving through existing history entries (`navigate(-1)`, initial load).
|
|
8
|
+
- `"PUSH"` — a new entry was added to the stack.
|
|
9
|
+
- `"REPLACE"` — the current entry was overwritten.
|
|
10
|
+
*/
|
|
11
|
+
type NavigationType = "POP" | "PUSH" | "REPLACE";
|
|
12
|
+
/**
|
|
13
|
+
The two parseable pieces of a route path. Sigil routes have no hash — a
|
|
14
|
+
terminal has no scroll anchors.
|
|
15
|
+
*/
|
|
16
|
+
type Path = {
|
|
17
|
+
/**
|
|
18
|
+
The path of the screen, beginning with `/`.
|
|
19
|
+
*/
|
|
20
|
+
pathname: string;
|
|
21
|
+
/**
|
|
22
|
+
The query string, beginning with `?`, or an empty string.
|
|
23
|
+
*/
|
|
24
|
+
search: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
An entry in the navigation stack.
|
|
28
|
+
*/
|
|
29
|
+
type Location<State = unknown> = Path & {
|
|
30
|
+
/**
|
|
31
|
+
Arbitrary state attached to this entry via `navigate(to, {state})`. Unlike the
|
|
32
|
+
browser, this is held in memory and never serialized — any value works.
|
|
33
|
+
*/
|
|
34
|
+
state: State;
|
|
35
|
+
/**
|
|
36
|
+
A unique key for this entry, stable across re-renders. Useful as a React
|
|
37
|
+
`key` to remount a screen when re-navigating to the same path.
|
|
38
|
+
*/
|
|
39
|
+
key: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
A destination to navigate to: either a path string (`"/users/123?tab=posts"`)
|
|
43
|
+
or a partial `Path` object.
|
|
44
|
+
*/
|
|
45
|
+
type To = string | Partial<Path>;
|
|
46
|
+
/**
|
|
47
|
+
Splits a path string into its pathname and search parts.
|
|
48
|
+
*/
|
|
49
|
+
declare const parsePath: (path: string) => Partial<Path>;
|
|
50
|
+
/**
|
|
51
|
+
Joins a `Path` back into a single string.
|
|
52
|
+
*/
|
|
53
|
+
declare const createPath: ({ pathname, search }: Partial<Path>) => string;
|
|
54
|
+
/**
|
|
55
|
+
An entry to seed the navigation stack with: a path string or a partial
|
|
56
|
+
`Location` (which may carry `state`).
|
|
57
|
+
*/
|
|
58
|
+
type InitialEntry = string | Partial<Location>;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/router/matcher.d.ts
|
|
61
|
+
/**
|
|
62
|
+
A route definition. Used as JSX via `<Route>` or passed as plain objects to
|
|
63
|
+
`useRoutes`.
|
|
64
|
+
*/
|
|
65
|
+
type RouteObject = {
|
|
66
|
+
/**
|
|
67
|
+
The path pattern to match against the current location, relative to the
|
|
68
|
+
parent route. Supports `:param` dynamic segments, optional segments
|
|
69
|
+
(`:param?`, `edit?`), and a trailing `*` splat.
|
|
70
|
+
*/
|
|
71
|
+
path?: string;
|
|
72
|
+
/**
|
|
73
|
+
An index route renders in its parent's `<Outlet>` at the parent's exact path.
|
|
74
|
+
Index routes cannot have children.
|
|
75
|
+
*/
|
|
76
|
+
index?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
The element to render when this route matches.
|
|
79
|
+
*/
|
|
80
|
+
element?: ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
Nested child routes, rendered into this route's `<Outlet>`.
|
|
83
|
+
*/
|
|
84
|
+
children?: RouteObject[];
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
Parsed params from dynamic segments of a matched path. The splat segment, if
|
|
88
|
+
any, is available under the `"*"` key.
|
|
89
|
+
*/
|
|
90
|
+
type Params<Key extends string = string> = { readonly [key in Key]: string | undefined; };
|
|
91
|
+
/**
|
|
92
|
+
A route object matched against a location, along with the params and the
|
|
93
|
+
portion of the pathname it consumed.
|
|
94
|
+
*/
|
|
95
|
+
type RouteMatch<RouteObjectType extends RouteObject = RouteObject> = {
|
|
96
|
+
params: Params;
|
|
97
|
+
pathname: string;
|
|
98
|
+
pathnameBase: string;
|
|
99
|
+
route: RouteObjectType;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
A pattern for matching some portion of a pathname with `matchPath`.
|
|
103
|
+
*/
|
|
104
|
+
type PathPattern = {
|
|
105
|
+
/**
|
|
106
|
+
The path pattern to match against.
|
|
107
|
+
*/
|
|
108
|
+
path: string;
|
|
109
|
+
/**
|
|
110
|
+
Should be `true` (the default) if the pattern must consume the entire
|
|
111
|
+
pathname; `false` allows matching a prefix.
|
|
112
|
+
*/
|
|
113
|
+
end?: boolean;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
The result of matching a `PathPattern` against a pathname.
|
|
117
|
+
*/
|
|
118
|
+
type PathMatch<ParamKey extends string = string> = {
|
|
119
|
+
params: Params<ParamKey>;
|
|
120
|
+
pathname: string;
|
|
121
|
+
pathnameBase: string;
|
|
122
|
+
pattern: PathPattern;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
Matches a set of (possibly nested) routes against a location and returns the
|
|
126
|
+
chain of matches from the root route down to the leaf, or `null` if nothing
|
|
127
|
+
matches.
|
|
128
|
+
*/
|
|
129
|
+
declare function matchRoutes<RouteObjectType extends RouteObject = RouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string): RouteMatch<RouteObjectType>[] | null;
|
|
130
|
+
/**
|
|
131
|
+
Matches a single path pattern against a pathname. Returns the match with
|
|
132
|
+
extracted params, or `null` if the pattern does not match.
|
|
133
|
+
*/
|
|
134
|
+
declare function matchPath<ParamKey extends string = string>(pattern: PathPattern | string, pathname: string): PathMatch<ParamKey> | null;
|
|
135
|
+
/**
|
|
136
|
+
Interpolates params into a route path pattern.
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
generatePath("/users/:id", { id: "42" }); // "/users/42"
|
|
140
|
+
```
|
|
141
|
+
*/
|
|
142
|
+
declare function generatePath(originalPath: string, params?: Record<string, string | null>): string;
|
|
143
|
+
/**
|
|
144
|
+
Resolves a `To` value against a starting pathname, handling `.` and `..`
|
|
145
|
+
segments.
|
|
146
|
+
*/
|
|
147
|
+
declare function resolvePath(to: To, fromPathname?: string): Path;
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/router/context.d.ts
|
|
150
|
+
/**
|
|
151
|
+
The imperative interface `useNavigate` drives. Backed by the memory history
|
|
152
|
+
inside `<MemoryRouter>`.
|
|
153
|
+
*/
|
|
154
|
+
type Navigator = {
|
|
155
|
+
push: (to: Path, state?: unknown) => void;
|
|
156
|
+
replace: (to: Path, state?: unknown) => void;
|
|
157
|
+
go: (delta: number) => void;
|
|
158
|
+
canGoBack: () => boolean;
|
|
159
|
+
canGoForward: () => boolean;
|
|
160
|
+
};
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/router/hooks.d.ts
|
|
163
|
+
/**
|
|
164
|
+
Returns `true` when rendered inside a `<MemoryRouter>`. Useful for components
|
|
165
|
+
that optionally integrate with routing.
|
|
166
|
+
*/
|
|
167
|
+
declare const useInRouterContext: () => boolean;
|
|
168
|
+
/**
|
|
169
|
+
Returns the current `Location`.
|
|
170
|
+
*/
|
|
171
|
+
declare const useLocation: () => Location;
|
|
172
|
+
/**
|
|
173
|
+
Returns the type of navigation that produced the current location: `"POP"`,
|
|
174
|
+
`"PUSH"`, or `"REPLACE"`.
|
|
175
|
+
*/
|
|
176
|
+
declare const useNavigationType: () => NavigationType;
|
|
177
|
+
type NavigateOptions = {
|
|
178
|
+
/**
|
|
179
|
+
Replace the current entry in the navigation stack instead of pushing a new
|
|
180
|
+
one.
|
|
181
|
+
*/
|
|
182
|
+
replace?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
Arbitrary state to attach to the destination location, readable via
|
|
185
|
+
`useLocation().state`. Held in memory, never serialized.
|
|
186
|
+
*/
|
|
187
|
+
state?: unknown;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
Navigates to a destination, or through the navigation stack when passed a
|
|
191
|
+
number (`navigate(-1)` goes back).
|
|
192
|
+
*/
|
|
193
|
+
type NavigateFunction = {
|
|
194
|
+
(to: To, options?: NavigateOptions): void;
|
|
195
|
+
(delta: number): void;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
Returns a stable function for imperative navigation.
|
|
199
|
+
*/
|
|
200
|
+
declare const useNavigate: () => NavigateFunction;
|
|
201
|
+
/**
|
|
202
|
+
Returns whether the navigation stack has entries behind/ahead of the current
|
|
203
|
+
one — i.e. whether `navigate(-1)` / `navigate(1)` will move anywhere. Handy
|
|
204
|
+
for "Esc goes back, unless at root" bindings.
|
|
205
|
+
*/
|
|
206
|
+
declare const useNavigationStack: () => {
|
|
207
|
+
canGoBack: boolean;
|
|
208
|
+
canGoForward: boolean;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
Returns the params from all dynamic segments matched by the current route and
|
|
212
|
+
its ancestors.
|
|
213
|
+
*/
|
|
214
|
+
declare const useParams: <ParamsOrKey extends Record<string, string | undefined> | string = string>() => Readonly<[ParamsOrKey] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>>;
|
|
215
|
+
/**
|
|
216
|
+
Matches a path pattern against the current location's pathname. Returns the
|
|
217
|
+
match (with params) or `null`.
|
|
218
|
+
*/
|
|
219
|
+
declare const useMatch: <ParamKey extends string = string>(pattern: PathPattern | string) => PathMatch<ParamKey> | null;
|
|
220
|
+
/**
|
|
221
|
+
Resolves a `To` value against the current route, exactly as `useNavigate`
|
|
222
|
+
would. Useful for building navigation UI.
|
|
223
|
+
*/
|
|
224
|
+
declare const useResolvedPath: (to: To) => Path;
|
|
225
|
+
/**
|
|
226
|
+
Returns the element for the child route at this level of the route hierarchy,
|
|
227
|
+
or `null` if there is none. Used internally by `<Outlet>`.
|
|
228
|
+
*/
|
|
229
|
+
declare const useOutlet: (context?: unknown) => ReactElement | null;
|
|
230
|
+
/**
|
|
231
|
+
Returns the value passed to the nearest parent `<Outlet context={...}>`.
|
|
232
|
+
*/
|
|
233
|
+
declare const useOutletContext: <Context = unknown>() => Context;
|
|
234
|
+
type SearchParamsInit = string | string[][] | Record<string, string | string[]> | URLSearchParams;
|
|
235
|
+
/**
|
|
236
|
+
Creates a `URLSearchParams` from common initializer shapes, including
|
|
237
|
+
`{ key: ["a", "b"] }` for repeated keys.
|
|
238
|
+
*/
|
|
239
|
+
declare const createSearchParams: (init?: SearchParamsInit) => URLSearchParams;
|
|
240
|
+
type SetSearchParams = (nextInit: SearchParamsInit | ((prev: URLSearchParams) => SearchParamsInit), navigateOptions?: NavigateOptions) => void;
|
|
241
|
+
/**
|
|
242
|
+
Returns the current location's search params and a setter that navigates to
|
|
243
|
+
the same pathname with the new params.
|
|
244
|
+
*/
|
|
245
|
+
declare const useSearchParams: (defaultInit?: SearchParamsInit) => [URLSearchParams, SetSearchParams];
|
|
246
|
+
/**
|
|
247
|
+
Matches a set of route objects against the current location (or an override)
|
|
248
|
+
and returns the rendered element tree. The plain-object alternative to
|
|
249
|
+
`<Routes>`.
|
|
250
|
+
*/
|
|
251
|
+
declare const useRoutes: (routes: RouteObject[], locationArg?: Partial<Location> | string) => ReactElement | null;
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/router/components.d.ts
|
|
254
|
+
type MemoryRouterProps = {
|
|
255
|
+
/**
|
|
256
|
+
The navigation stack to start with. Defaults to `["/"]`.
|
|
257
|
+
*/
|
|
258
|
+
initialEntries?: InitialEntry[];
|
|
259
|
+
/**
|
|
260
|
+
The index of the initial entry to render. Defaults to the last entry.
|
|
261
|
+
*/
|
|
262
|
+
initialIndex?: number;
|
|
263
|
+
children?: ReactNode;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
The routing container for a Sigil app. Stores the navigation stack in memory —
|
|
267
|
+
routes aren't URLs, they're screen states.
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
<MemoryRouter>
|
|
271
|
+
<Routes>
|
|
272
|
+
<Route path="/" element={<Home />} />
|
|
273
|
+
<Route path="/settings" element={<Settings />} />
|
|
274
|
+
</Routes>
|
|
275
|
+
</MemoryRouter>
|
|
276
|
+
```
|
|
277
|
+
*/
|
|
278
|
+
declare function MemoryRouter({ initialEntries, initialIndex, children }: MemoryRouterProps): import("react").JSX.Element;
|
|
279
|
+
type RouteProps = {
|
|
280
|
+
/**
|
|
281
|
+
The path pattern to match, relative to the parent route. Supports `:param`
|
|
282
|
+
dynamic segments, optional segments (`:param?`, `edit?`), and a trailing
|
|
283
|
+
`*` splat.
|
|
284
|
+
*/
|
|
285
|
+
path?: string;
|
|
286
|
+
/**
|
|
287
|
+
Render this route in the parent's `<Outlet>` at the parent's exact path.
|
|
288
|
+
Index routes cannot have children.
|
|
289
|
+
*/
|
|
290
|
+
index?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
The element to render when this route matches.
|
|
293
|
+
*/
|
|
294
|
+
element?: ReactNode;
|
|
295
|
+
/**
|
|
296
|
+
Nested `<Route>` elements, rendered into this route's `<Outlet>`.
|
|
297
|
+
*/
|
|
298
|
+
children?: ReactNode;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
Declares a route. Only valid as a child of `<Routes>` or another `<Route>`.
|
|
302
|
+
*/
|
|
303
|
+
declare function Route(_props: RouteProps): ReactElement | null;
|
|
304
|
+
type RoutesProps = {
|
|
305
|
+
children?: ReactNode;
|
|
306
|
+
/**
|
|
307
|
+
Match against this location instead of the current one. Useful for
|
|
308
|
+
rendering a screen other than the one navigated to (e.g. transitions).
|
|
309
|
+
*/
|
|
310
|
+
location?: Partial<Location> | string;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
Renders the branch of child `<Route>` elements that best matches the current
|
|
314
|
+
location.
|
|
315
|
+
*/
|
|
316
|
+
declare function Routes({ children, location }: RoutesProps): ReactElement | null;
|
|
317
|
+
type OutletProps = {
|
|
318
|
+
/**
|
|
319
|
+
A value to make available to descendant routes via `useOutletContext()`.
|
|
320
|
+
*/
|
|
321
|
+
context?: unknown;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
Renders the matching child route of a parent route, or nothing if no child
|
|
325
|
+
matches.
|
|
326
|
+
*/
|
|
327
|
+
declare function Outlet(props: OutletProps): ReactElement | null;
|
|
328
|
+
type NavigateProps = {
|
|
329
|
+
to: To;
|
|
330
|
+
replace?: boolean;
|
|
331
|
+
state?: unknown;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
Navigates as soon as it renders. The component form of `useNavigate`, for
|
|
335
|
+
declarative redirects:
|
|
336
|
+
|
|
337
|
+
```tsx
|
|
338
|
+
<Route path="/" element={<Navigate to="/home" replace />} />
|
|
339
|
+
```
|
|
340
|
+
*/
|
|
341
|
+
declare function Navigate({ to, replace, state }: NavigateProps): null;
|
|
342
|
+
type LinkRenderState = {
|
|
343
|
+
/**
|
|
344
|
+
Whether this link currently has focus.
|
|
345
|
+
*/
|
|
346
|
+
isFocused: boolean;
|
|
347
|
+
/**
|
|
348
|
+
Whether the current location is the link's destination or a descendant of
|
|
349
|
+
it.
|
|
350
|
+
*/
|
|
351
|
+
isActive: boolean;
|
|
352
|
+
};
|
|
353
|
+
type LinkProps = Omit<Props, "children"> & {
|
|
354
|
+
/**
|
|
355
|
+
The destination to navigate to when the link is activated.
|
|
356
|
+
*/
|
|
357
|
+
to: To;
|
|
358
|
+
/**
|
|
359
|
+
Replace the current entry in the navigation stack instead of pushing.
|
|
360
|
+
*/
|
|
361
|
+
replace?: boolean;
|
|
362
|
+
/**
|
|
363
|
+
State to attach to the destination location.
|
|
364
|
+
*/
|
|
365
|
+
state?: unknown;
|
|
366
|
+
/**
|
|
367
|
+
Focus this link if nothing else is focused yet.
|
|
368
|
+
*/
|
|
369
|
+
autoFocus?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
An ID for programmatic focus via `useFocusManager().focus(id)`.
|
|
372
|
+
*/
|
|
373
|
+
id?: string;
|
|
374
|
+
/**
|
|
375
|
+
Link content. Pass a function to take full control of rendering based on
|
|
376
|
+
focus and active state.
|
|
377
|
+
*/
|
|
378
|
+
children?: ReactNode | ((state: LinkRenderState) => ReactNode);
|
|
379
|
+
};
|
|
380
|
+
/**
|
|
381
|
+
A focusable navigation element — the terminal's `<a>` tag. Focus it with
|
|
382
|
+
<kbd>Tab</kbd> and activate it with <kbd>Enter</kbd>. By default the focused
|
|
383
|
+
link renders inverse; pass a function as `children` (or any `Text` props) to
|
|
384
|
+
customize.
|
|
385
|
+
|
|
386
|
+
```tsx
|
|
387
|
+
<Link to="/settings">Settings</Link>
|
|
388
|
+
```
|
|
389
|
+
*/
|
|
390
|
+
declare function Link({ to, replace, state, autoFocus, id, children, ...textProps }: LinkProps): import("react").JSX.Element;
|
|
391
|
+
//#endregion
|
|
392
|
+
export { type InitialEntry, Link, type LinkProps, type Location, MemoryRouter, type MemoryRouterProps, Navigate, type NavigateFunction, type NavigateOptions, type NavigateProps, type NavigationType, type Navigator, Outlet, type OutletProps, type Params, type Path, type PathMatch, type PathPattern, Route, type RouteMatch, type RouteObject, type RouteProps, Routes, type RoutesProps, type To, createPath, createSearchParams, generatePath, matchPath, matchRoutes, parsePath, resolvePath, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationStack, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams };
|