@opentf/afw 0.36.0 → 0.38.0

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.
@@ -47,6 +47,30 @@ export function registerLoaderRoutes(paths: any): void;
47
47
  export function setRouteData(data: any): void;
48
48
  /** Layout entries that wrap `route`, outermost (root) first. */
49
49
  export function layoutChain(route: any): any[];
50
+ /** The folders of the layouts wrapping `route`, outermost first (aligned with `layoutChain`). */
51
+ export function layoutFolders(route: string | null): string[];
52
+ /** Does the layout at `folder` wrap `route`? */
53
+ export function layoutWraps(folder: string, route: string | null): boolean;
54
+ /** The `error.jsx` for an error: the page's nearest, or for a broken layout the nearest above it. */
55
+ export function routeErrorSite(route: string | null, brokenLayout?: string | null): { entry: unknown };
56
+ /** The nearest `loading.jsx` / `error.jsx` entry for `route`: its folder, then each parent. */
57
+ export function nearestRouteFile(table: Record<string, unknown>, route: string | null): unknown;
58
+ /** How long a navigation waits before showing `loading.jsx` (milliseconds). */
59
+ export const LOADING_DELAY: number;
60
+ /** Props an `error.jsx` receives. */
61
+ export interface RouteErrorProps {
62
+ /** What failed. After a server render, `status` is set and the message is generic in production. */
63
+ error: Error & { status?: number };
64
+ /** Load the page again: rerun its loader and rebuild it. */
65
+ retry: () => void;
66
+ params: Record<string, string | string[]>;
67
+ query: Record<string, string>;
68
+ }
69
+ /** Props a `loading.jsx` receives. */
70
+ export interface RouteLoadingProps {
71
+ params: Record<string, string | string[]>;
72
+ query: Record<string, string>;
73
+ }
50
74
  /** Resolve a route entry (module namespace or lazy loader) to its factory. */
51
75
  export function resolveFactory(entry: any): Promise<any>;
52
76
  /**
@@ -55,10 +79,11 @@ export function resolveFactory(entry: any): Promise<any>;
55
79
  * the ordered `nodes` list (page → … → root) so callers can run lifecycle on each.
56
80
  * Each factory owns a reactive scope, disposed with its node on navigation.
57
81
  */
58
- export function buildRouteNode(match: any, query?: {}): Promise<{
82
+ export function buildRouteNode(match: any, query?: {}, options?: { error?: unknown; loadingShown?: boolean }): Promise<{
59
83
  node: any;
60
84
  nodes: any[];
61
85
  modules: any[];
86
+ region: any;
62
87
  }>;
63
88
  /**
64
89
  * Adopt a matched route's server-rendered DOM (docs/HYDRATION.md §3.4, 2.1c) — the hydrate
@@ -70,7 +95,7 @@ export function buildRouteNode(match: any, query?: {}): Promise<{
70
95
  * caller then falls back to a clean CSR build. A thrown `HydrationMismatch` propagates up,
71
96
  * disposing each layer's partial wiring on the way (each `hydrateAt` has its own guard).
72
97
  */
73
- export function hydrateRouteNode(match: any, query: any, rootEl: any): Promise<{
98
+ export function hydrateRouteNode(match: any, query: any, rootEl: any, options?: { error?: unknown }): Promise<{
74
99
  nodes: any[];
75
100
  } | null>;
76
101
  /** Resolve a route entry (lazy loader or module namespace) to its module. */
@@ -123,17 +148,24 @@ export function refreshHotRoute(factory: any): Promise<void>;
123
148
  * @param {string[]} [opts.loaders] route patterns that have a server loader
124
149
  * (docs/DATA.md) — navigation fetches `<path>/__data.json` for these.
125
150
  */
126
- export function mountApp({ pages, target, guard: g, i18n, nav, loaders }?: {
151
+ export function mountApp({ pages, target, guard: g, i18n, nav, loaders, viewTransitions }?: {
127
152
  i18n?: { locales: string[]; defaultLocale?: string };
128
153
  pages: Object;
129
154
  target?: Element | undefined;
130
155
  guard?: Function | undefined;
131
156
  nav?: "spa" | "mpa" | undefined;
132
157
  loaders?: string[] | undefined;
158
+ /**
159
+ * Run client navigations inside `document.startViewTransition()`. Skipped on the
160
+ * first paint, with `prefers-reduced-motion: reduce`, and where unsupported. Default false.
161
+ */
162
+ viewTransitions?: boolean | undefined;
133
163
  }): Promise<void>;
134
164
  export namespace routes {
135
165
  let pages: {};
136
166
  let layouts: {};
167
+ let loading: {};
168
+ let errors: {};
137
169
  let notFound: null;
138
170
  let loaderRoutes: Set<any>;
139
171
  }