Area restrita - Questionario

This commit is contained in:
2026-06-08 23:50:59 -03:00
parent f2e2400637
commit ef968f10ae
6972 changed files with 23454 additions and 2267883 deletions
+120 -37
View File
@@ -64,7 +64,7 @@ interface Location<State = any> extends Path {
* The masked location displayed in the URL bar, which differs from the URL the
* router is operating on
*/
unstable_mask: Path | undefined;
mask?: Path;
}
/**
* A change to the current location.
@@ -357,19 +357,19 @@ interface DataFunctionArgs<Context> {
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
request: Request;
/**
* A URL instance representing the application location being navigated to or fetched.
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
* With `future.unstable_passThroughRequests` enabled, this is a normalized
* URL with React-Router-specific implementation details removed (`.data`
* suffixes, `index`/`_routes` search params).
* The URL includes the origin from the request for convenience.
* A URL instance representing the application location being navigated to or
* fetched. By default, this matches `request.url`.
*
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
* normalized URL with React-Router-specific implementation details removed
* (`.data` suffixes, `index`/`_routes` search params).
*/
unstable_url: URL;
url: URL;
/**
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
*/
unstable_pattern: string;
pattern: string;
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
@@ -756,6 +756,7 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
* A data route object, which is just a RouteObject with a required unique ID
*/
type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
/**
* The parameters that were parsed from the URL path.
*/
@@ -839,6 +840,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
*/
handle: Handle;
}
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
relativePath: string;
caseSensitive: boolean;
childrenIndex: number;
route: RouteObjectType;
}
/**
* @private
* PRIVATE - DO NOT USE
*
* A "branch" of routes that match a given route pattern.
* This is an internal interface not intended for direct external usage.
*/
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
path: string;
score: number;
routesMeta: RouteMeta<RouteObjectType>[];
}
declare class DataWithResponseInit<D> {
type: string;
data: D;
@@ -878,6 +897,9 @@ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
* Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
*
* This utility accepts absolute URLs and can navigate to external domains, so
* the application should validate any user-supplied inputs to redirects.
*
* @example
* import { redirect } from "react-router";
*
@@ -907,6 +929,9 @@ declare const redirect$1: RedirectFunction;
* and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
*
* This utility accepts absolute URLs and can navigate to external domains, so
* the application should validate any user-supplied inputs to redirects.
*
* ```tsx filename=routes/logout.tsx
* import { redirectDocument } from "react-router";
*
@@ -1006,25 +1031,25 @@ interface AppLoadContext {
[key: string]: unknown;
}
type unstable_ServerInstrumentation = {
handler?: unstable_InstrumentRequestHandlerFunction;
route?: unstable_InstrumentRouteFunction;
type ServerInstrumentation = {
handler?: InstrumentRequestHandlerFunction;
route?: InstrumentRouteFunction;
};
type unstable_ClientInstrumentation = {
router?: unstable_InstrumentRouterFunction;
route?: unstable_InstrumentRouteFunction;
type ClientInstrumentation = {
router?: InstrumentRouterFunction;
route?: InstrumentRouteFunction;
};
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
type unstable_InstrumentationHandlerResult = {
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
type InstrumentationHandlerResult = {
status: "success";
error: undefined;
} | {
status: "error";
error: Error;
};
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
type ReadonlyRequest = {
method: string;
url: string;
@@ -1050,7 +1075,7 @@ type RouteLazyInstrumentationInfo = undefined;
type RouteHandlerInstrumentationInfo = Readonly<{
request: ReadonlyRequest;
params: LoaderFunctionArgs["params"];
unstable_pattern: string;
pattern: string;
context: ReadonlyContext;
}>;
type InstrumentableRouter = {
@@ -1120,6 +1145,20 @@ interface Router {
* Return the routes for this router instance
*/
get routes(): DataRouteObject[];
/**
* @private
* PRIVATE - DO NOT USE
*
* Return the route branches for this router instance
*/
get branches(): RouteBranch<DataRouteObject>[] | undefined;
/**
* @private
* PRIVATE - DO NOT USE
*
* Return the manifest for this router instance
*/
get manifest(): RouteManifest;
/**
* @private
* PRIVATE - DO NOT USE
@@ -1367,7 +1406,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
* Future flags to toggle new feature behavior
*/
interface FutureConfig {
unstable_passThroughRequests: boolean;
}
/**
* Initialization options for createRouter
@@ -1377,7 +1415,7 @@ interface RouterInit {
history: History;
basename?: string;
getContext?: () => MaybePromise<RouterContextProvider>;
unstable_instrumentations?: unstable_ClientInstrumentation[];
instrumentations?: ClientInstrumentation[];
mapRouteProperties?: MapRoutePropertiesFunction;
future?: Partial<FutureConfig>;
hydrationRouteProperties?: string[];
@@ -1405,7 +1443,33 @@ interface StaticHandlerContext {
* A StaticHandler instance manages a singular SSR navigation/fetch event
*/
interface StaticHandler {
/**
* The set of data routes managed by this handler
*/
dataRoutes: DataRouteObject[];
/**
* @private
* PRIVATE - DO NOT USE
*
* The route branches derived from the data routes, used for internal route
* matching in Framework Mode
*/
_internalRouteBranches: RouteBranch<DataRouteObject>[];
/**
* Perform a query for a given request - executing all matched route
* loaders/actions. Used for document requests.
*
* @param request The request to query
* @param opts Optional query options
* @param opts.dataStrategy Alternate dataStrategy implementation
* @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
* to generate a response to bubble back up the middleware chain
* @param opts.requestContext Context object to pass to loaders/actions
* @param opts.skipLoaderErrorBubbling Skip loader error bubbling
* @param opts.skipRevalidation Skip revalidation after action submission
* @param opts.normalizePath Normalize the request path
*/
query(request: Request, opts?: {
requestContext?: unknown;
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
@@ -1415,14 +1479,27 @@ interface StaticHandler {
generateMiddlewareResponse?: (query: (r: Request, args?: {
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
unstable_normalizePath?: (request: Request) => Path;
normalizePath?: (request: Request) => Path;
}): Promise<StaticHandlerContext | Response>;
/**
* Perform a query for a specific route. Used for resource requests.
*
* @param request The request to query
* @param opts Optional queryRoute options
* @param opts.dataStrategy Alternate dataStrategy implementation
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
* to generate a response to bubble back up the middleware chain
* @param opts.requestContext Context object to pass to loaders/actions
* @param opts.routeId The ID of the route to query
* @param opts.normalizePath Normalize the request path
*/
queryRoute(request: Request, opts?: {
routeId?: string;
requestContext?: unknown;
dataStrategy?: DataStrategyFunction<unknown>;
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
unstable_normalizePath?: (request: Request) => Path;
normalizePath?: (request: Request) => Path;
}): Promise<any>;
}
type ViewTransitionOpts = {
@@ -1466,14 +1543,14 @@ type BaseNavigateOrFetchOptions = {
preventScrollReset?: boolean;
relative?: RelativeRoutingType;
flushSync?: boolean;
unstable_defaultShouldRevalidate?: boolean;
defaultShouldRevalidate?: boolean;
};
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
replace?: boolean;
state?: any;
fromRouteId?: string;
viewTransition?: boolean;
unstable_mask?: To;
mask?: To;
};
type BaseSubmissionOptions = {
formMethod?: HTMLFormMethod;
@@ -1516,6 +1593,8 @@ type NavigationStates = {
Idle: {
state: "idle";
location: undefined;
matches: undefined;
historyAction: undefined;
formMethod: undefined;
formAction: undefined;
formEncType: undefined;
@@ -1526,6 +1605,8 @@ type NavigationStates = {
Loading: {
state: "loading";
location: Location;
matches: DataRouteMatch[];
historyAction: Action;
formMethod: Submission["formMethod"] | undefined;
formAction: Submission["formAction"] | undefined;
formEncType: Submission["formEncType"] | undefined;
@@ -1536,6 +1617,8 @@ type NavigationStates = {
Submitting: {
state: "submitting";
location: Location;
matches: DataRouteMatch[];
historyAction: Action;
formMethod: Submission["formMethod"];
formAction: Submission["formAction"];
formEncType: Submission["formEncType"];
@@ -1649,7 +1732,7 @@ type BlockerFunction = (args: {
interface CreateStaticHandlerOptions {
basename?: string;
mapRouteProperties?: MapRoutePropertiesFunction;
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
instrumentations?: Pick<ServerInstrumentation, "route">[];
future?: Partial<FutureConfig>;
}
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
@@ -1799,14 +1882,14 @@ type ClientDataFunctionArgs<Params> = {
**/
request: Request;
/**
* A URL instance representing the application location being navigated to or fetched.
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
* With `future.unstable_passThroughRequests` enabled, this is a normalized
* URL with React-Router-specific implementation details removed (`.data`
* pathnames, `index`/`_routes` search params).
* The URL includes the origin from the request for convenience.
* A URL instance representing the application location being navigated to or
* fetched. By default, this matches `request.url`.
*
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
* normalized URL with React-Router-specific implementation details removed
* (`.data` suffixes, `index`/`_routes` search params).
*/
unstable_url: URL;
url: URL;
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
@@ -1826,7 +1909,7 @@ type ClientDataFunctionArgs<Params> = {
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
*/
unstable_pattern: string;
pattern: string;
/**
* When `future.v8_middleware` is not enabled, this is undefined.
*
@@ -1975,7 +2058,7 @@ type MetaDescriptor = {
httpEquiv: string;
content: string;
} | {
"script:ld+json": LdJsonObject;
"script:ld+json": LdJsonObject | LdJsonObject[];
} | {
tagName: "meta" | "link";
[name: string]: string;