storybook 10.0.0-beta.1 → 10.0.0-beta.2

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.
Files changed (73) hide show
  1. package/dist/_node-chunks/{builder-manager-EXW4ETLN.js → builder-manager-KCNW2J74.js} +13 -13
  2. package/dist/_node-chunks/{camelcase-VZZFWA2L.js → camelcase-FH5EGUIB.js} +7 -7
  3. package/dist/_node-chunks/{chunk-F5J33SXQ.js → chunk-2E5IZBC2.js} +7 -7
  4. package/dist/_node-chunks/{chunk-ZMV3WY6R.js → chunk-2VH25RMB.js} +7 -7
  5. package/dist/_node-chunks/{chunk-FZP2YGG3.js → chunk-2VOEBWNF.js} +7 -7
  6. package/dist/_node-chunks/{chunk-24TGL6EX.js → chunk-63VGATS4.js} +7 -7
  7. package/dist/_node-chunks/{chunk-ICPKUV5G.js → chunk-6A2WP6N7.js} +7 -7
  8. package/dist/_node-chunks/{chunk-5ZX5SJOP.js → chunk-6B3CXS7K.js} +7 -7
  9. package/dist/_node-chunks/{chunk-QJTT4OC2.js → chunk-6FPFMFFH.js} +8 -8
  10. package/dist/_node-chunks/{chunk-VNLBDN2Z.js → chunk-7DWWXKIE.js} +6 -6
  11. package/dist/_node-chunks/{chunk-2QZOLZDJ.js → chunk-B7L5A4BQ.js} +9 -9
  12. package/dist/_node-chunks/{chunk-32JYCD74.js → chunk-CGY2ITTD.js} +8 -8
  13. package/dist/_node-chunks/{chunk-EDBXIJN5.js → chunk-CIIY3F53.js} +7 -7
  14. package/dist/_node-chunks/{chunk-2G5THETV.js → chunk-CMFB2H3U.js} +12 -12
  15. package/dist/_node-chunks/{chunk-6CCUFDHU.js → chunk-DPF2NDLD.js} +7 -7
  16. package/dist/_node-chunks/{chunk-U45F2NP6.js → chunk-FXPYWCQE.js} +7 -7
  17. package/dist/_node-chunks/{chunk-3SGKBLOL.js → chunk-HSI4BG2J.js} +8 -8
  18. package/dist/_node-chunks/{chunk-CM3UGTR5.js → chunk-HSS67Y6T.js} +7 -7
  19. package/dist/_node-chunks/chunk-IAAPNJG4.js +62 -0
  20. package/dist/_node-chunks/{chunk-LAUOYAOX.js → chunk-IBC4BVDB.js} +7 -7
  21. package/dist/_node-chunks/{chunk-QC5FE2D7.js → chunk-JWFNAC5N.js} +7 -7
  22. package/dist/_node-chunks/{chunk-WDKWVNL2.js → chunk-JZ7ZEAK6.js} +7 -7
  23. package/dist/_node-chunks/{chunk-5V6QH7WC.js → chunk-KDKM7KMS.js} +7 -7
  24. package/dist/_node-chunks/{chunk-EO4S3VXL.js → chunk-MX77OTGN.js} +22 -22
  25. package/dist/_node-chunks/chunk-NNJMYLJM.js +18 -0
  26. package/dist/_node-chunks/{chunk-XTSBFCVE.js → chunk-NTXIDMDM.js} +7 -7
  27. package/dist/_node-chunks/{chunk-PMEEE3UE.js → chunk-NUODGCJN.js} +7 -7
  28. package/dist/_node-chunks/{chunk-GVCXNIAA.js → chunk-NWTLWMJN.js} +8 -8
  29. package/dist/_node-chunks/{chunk-SUMFFLGF.js → chunk-PTT3CRNJ.js} +6 -6
  30. package/dist/_node-chunks/{chunk-PL2PKDRO.js → chunk-RSG3AEWL.js} +16 -16
  31. package/dist/_node-chunks/{chunk-V2ZF4DUD.js → chunk-TLM4ECJN.js} +9 -9
  32. package/dist/_node-chunks/{chunk-WP7DV5JT.js → chunk-WBRWBEAS.js} +10 -10
  33. package/dist/_node-chunks/{chunk-3ZKQWDCG.js → chunk-XWJNZVOR.js} +8 -8
  34. package/dist/_node-chunks/{chunk-4WNZYNQY.js → chunk-ZF6AXYHM.js} +7 -7
  35. package/dist/_node-chunks/{default-browser-id-JNATP42X.js → default-browser-id-YRAH7IMC.js} +7 -7
  36. package/dist/_node-chunks/{dist-VZL6D6Y3.js → dist-G5THJIW5.js} +9 -9
  37. package/dist/_node-chunks/{globby-GZXJJ4W6.js → globby-FGF2JG5Z.js} +9 -9
  38. package/dist/_node-chunks/{lib-PHT5GCV2.js → lib-OPOVJQIO.js} +7 -7
  39. package/dist/_node-chunks/{mdx-N42X6CFJ-EPDIV4A2.js → mdx-N42X6CFJ-N5MJA4NM.js} +8 -8
  40. package/dist/_node-chunks/{p-limit-AJIFSZTI.js → p-limit-JNDYEQZX.js} +8 -8
  41. package/dist/_node-chunks/{plugin-AV4OEKYM.js → plugin-6GW4GYGS.js} +10 -10
  42. package/dist/_node-chunks/{plugin-3VI56CEF.js → plugin-ZL4ZLDWE.js} +10 -10
  43. package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-E7J5FKLA.js → webpack-inject-mocker-runtime-plugin-F6BXWV4R.js} +10 -10
  44. package/dist/_node-chunks/{webpack-mock-plugin-VTYGW7HO.js → webpack-mock-plugin-5QNP4V3B.js} +9 -9
  45. package/dist/babel/index.js +11 -11
  46. package/dist/bin/core.js +11 -11
  47. package/dist/bin/dispatcher.js +11 -11
  48. package/dist/bin/loader.js +8 -8
  49. package/dist/cli/index.js +20 -20
  50. package/dist/common/index.js +22 -22
  51. package/dist/components/index.d.ts +228 -1
  52. package/dist/core-server/index.d.ts +515 -14
  53. package/dist/core-server/index.js +36 -36
  54. package/dist/core-server/presets/common-override-preset.js +9 -9
  55. package/dist/core-server/presets/common-preset.js +22 -31
  56. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
  57. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
  58. package/dist/csf-tools/index.js +9 -9
  59. package/dist/manager/globals-runtime.js +1 -1
  60. package/dist/manager/runtime.js +1 -12
  61. package/dist/manager-api/index.d.ts +502 -1
  62. package/dist/manager-api/index.js +1 -1
  63. package/dist/manager-errors.d.ts +501 -0
  64. package/dist/node-logger/index.js +14 -14
  65. package/dist/preview-errors.d.ts +501 -0
  66. package/dist/router/index.d.ts +668 -10
  67. package/dist/server-errors.d.ts +501 -0
  68. package/dist/server-errors.js +10 -10
  69. package/dist/telemetry/index.js +25 -25
  70. package/dist/types/index.d.ts +523 -9
  71. package/package.json +1 -3
  72. package/dist/_node-chunks/chunk-GE6I3YYG.js +0 -62
  73. package/dist/_node-chunks/chunk-KXCNXWXI.js +0 -18
@@ -1,5 +1,5 @@
1
- import React, { ReactNode, ReactElement } from 'react';
2
- import * as R from 'react-router-dom';
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode, ReactElement } from 'react';
3
3
 
4
4
  interface StoryData {
5
5
  viewMode?: string;
@@ -23,16 +23,674 @@ type Match$1 = {
23
23
  };
24
24
  declare const getMatch: (current: string, target: string | RegExp, startsWith?: any) => Match$1 | null;
25
25
 
26
+ /**
27
+ * Actions represent the type of change to a location value.
28
+ */
29
+ declare enum Action {
30
+ /**
31
+ * A POP indicates a change to an arbitrary index in the history stack, such
32
+ * as a back or forward navigation. It does not describe the direction of the
33
+ * navigation, only that the current index changed.
34
+ *
35
+ * Note: This is the default action for newly created history objects.
36
+ */
37
+ Pop = "POP",
38
+ /**
39
+ * A PUSH indicates a new entry being added to the history stack, such as when
40
+ * a link is clicked and a new page loads. When this happens, all subsequent
41
+ * entries in the stack are lost.
42
+ */
43
+ Push = "PUSH",
44
+ /**
45
+ * A REPLACE indicates the entry at the current index in the history stack
46
+ * being replaced by a new one.
47
+ */
48
+ Replace = "REPLACE"
49
+ }
50
+ /**
51
+ * The pathname, search, and hash values of a URL.
52
+ */
53
+ interface Path {
54
+ /**
55
+ * A URL pathname, beginning with a /.
56
+ */
57
+ pathname: string;
58
+ /**
59
+ * A URL search string, beginning with a ?.
60
+ */
61
+ search: string;
62
+ /**
63
+ * A URL fragment identifier, beginning with a #.
64
+ */
65
+ hash: string;
66
+ }
67
+ /**
68
+ * An entry in a history stack. A location contains information about the
69
+ * URL path, as well as possibly some arbitrary state and a key.
70
+ */
71
+ interface Location$2 extends Path {
72
+ /**
73
+ * A value of arbitrary data associated with this location.
74
+ */
75
+ state: any;
76
+ /**
77
+ * A unique string associated with this location. May be used to safely store
78
+ * and retrieve data in some other storage API, like `localStorage`.
79
+ *
80
+ * Note: This value is always "default" on the initial location.
81
+ */
82
+ key: string;
83
+ }
84
+ /**
85
+ * A change to the current location.
86
+ */
87
+ interface Update {
88
+ /**
89
+ * The action that triggered the change.
90
+ */
91
+ action: Action;
92
+ /**
93
+ * The new location.
94
+ */
95
+ location: Location$2;
96
+ /**
97
+ * The delta between this location and the former location in the history stack
98
+ */
99
+ delta: number | null;
100
+ }
101
+ /**
102
+ * A function that receives notifications about location changes.
103
+ */
104
+ interface Listener {
105
+ (update: Update): void;
106
+ }
107
+ /**
108
+ * Describes a location that is the destination of some navigation, either via
109
+ * `history.push` or `history.replace`. May be either a URL or the pieces of a
110
+ * URL path.
111
+ */
112
+ type To = string | Partial<Path>;
113
+ /**
114
+ * A history is an interface to the navigation stack. The history serves as the
115
+ * source of truth for the current location, as well as provides a set of
116
+ * methods that may be used to change it.
117
+ *
118
+ * It is similar to the DOM's `window.history` object, but with a smaller, more
119
+ * focused API.
120
+ */
121
+ interface History {
122
+ /**
123
+ * The last action that modified the current location. This will always be
124
+ * Action.Pop when a history instance is first created. This value is mutable.
125
+ */
126
+ readonly action: Action;
127
+ /**
128
+ * The current location. This value is mutable.
129
+ */
130
+ readonly location: Location$2;
131
+ /**
132
+ * Returns a valid href for the given `to` value that may be used as
133
+ * the value of an <a href> attribute.
134
+ *
135
+ * @param to - The destination URL
136
+ */
137
+ createHref(to: To): string;
138
+ /**
139
+ * Returns a URL for the given `to` value
140
+ *
141
+ * @param to - The destination URL
142
+ */
143
+ createURL(to: To): URL;
144
+ /**
145
+ * Encode a location the same way window.history would do (no-op for memory
146
+ * history) so we ensure our PUSH/REPLACE navigations for data routers
147
+ * behave the same as POP
148
+ *
149
+ * @param to Unencoded path
150
+ */
151
+ encodeLocation(to: To): Path;
152
+ /**
153
+ * Pushes a new location onto the history stack, increasing its length by one.
154
+ * If there were any entries in the stack after the current one, they are
155
+ * lost.
156
+ *
157
+ * @param to - The new URL
158
+ * @param state - Data to associate with the new location
159
+ */
160
+ push(to: To, state?: any): void;
161
+ /**
162
+ * Replaces the current location in the history stack with a new one. The
163
+ * location that was replaced will no longer be available.
164
+ *
165
+ * @param to - The new URL
166
+ * @param state - Data to associate with the new location
167
+ */
168
+ replace(to: To, state?: any): void;
169
+ /**
170
+ * Navigates `n` entries backward/forward in the history stack relative to the
171
+ * current index. For example, a "back" navigation would use go(-1).
172
+ *
173
+ * @param delta - The delta in the stack index
174
+ */
175
+ go(delta: number): void;
176
+ /**
177
+ * Sets up a listener that will be called whenever the current location
178
+ * changes.
179
+ *
180
+ * @param listener - A function that will be called when the location changes
181
+ * @returns unlisten - A function that may be used to stop listening
182
+ */
183
+ listen(listener: Listener): () => void;
184
+ }
185
+
186
+ /**
187
+ * Map of routeId -> data returned from a loader/action/error
188
+ */
189
+ interface RouteData {
190
+ [routeId: string]: any;
191
+ }
192
+ declare enum ResultType {
193
+ data = "data",
194
+ deferred = "deferred",
195
+ redirect = "redirect",
196
+ error = "error"
197
+ }
198
+ /**
199
+ * Successful result from a loader or action
200
+ */
201
+ interface SuccessResult {
202
+ type: ResultType.data;
203
+ data: any;
204
+ statusCode?: number;
205
+ headers?: Headers;
206
+ }
207
+ /**
208
+ * Successful defer() result from a loader or action
209
+ */
210
+ interface DeferredResult {
211
+ type: ResultType.deferred;
212
+ deferredData: DeferredData;
213
+ statusCode?: number;
214
+ headers?: Headers;
215
+ }
216
+ /**
217
+ * Redirect result from a loader or action
218
+ */
219
+ interface RedirectResult {
220
+ type: ResultType.redirect;
221
+ status: number;
222
+ location: string;
223
+ revalidate: boolean;
224
+ reloadDocument?: boolean;
225
+ }
226
+ /**
227
+ * Unsuccessful result from a loader or action
228
+ */
229
+ interface ErrorResult {
230
+ type: ResultType.error;
231
+ error: any;
232
+ headers?: Headers;
233
+ }
234
+ /**
235
+ * Result from a loader or action - potentially successful or unsuccessful
236
+ */
237
+ type DataResult = SuccessResult | DeferredResult | RedirectResult | ErrorResult;
238
+ type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
239
+ type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
240
+ /**
241
+ * Active navigation/fetcher form methods are exposed in lowercase on the
242
+ * RouterState
243
+ */
244
+ type FormMethod = LowerCaseFormMethod;
245
+ /**
246
+ * In v7, active navigation/fetcher form methods are exposed in uppercase on the
247
+ * RouterState. This is to align with the normalization done via fetch().
248
+ */
249
+ type V7_FormMethod = UpperCaseFormMethod;
250
+ type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain";
251
+ type JsonObject = {
252
+ [Key in string]: JsonValue;
253
+ } & {
254
+ [Key in string]?: JsonValue | undefined;
255
+ };
256
+ type JsonArray = JsonValue[] | readonly JsonValue[];
257
+ type JsonPrimitive = string | number | boolean | null;
258
+ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
259
+ /**
260
+ * @private
261
+ * Internal interface to pass around for action submissions, not intended for
262
+ * external consumption
263
+ */
264
+ type Submission = {
265
+ formMethod: FormMethod | V7_FormMethod;
266
+ formAction: string;
267
+ formEncType: FormEncType;
268
+ formData: FormData;
269
+ json: undefined;
270
+ text: undefined;
271
+ } | {
272
+ formMethod: FormMethod | V7_FormMethod;
273
+ formAction: string;
274
+ formEncType: FormEncType;
275
+ formData: undefined;
276
+ json: JsonValue;
277
+ text: undefined;
278
+ } | {
279
+ formMethod: FormMethod | V7_FormMethod;
280
+ formAction: string;
281
+ formEncType: FormEncType;
282
+ formData: undefined;
283
+ json: undefined;
284
+ text: string;
285
+ };
286
+ /**
287
+ * @private
288
+ * Arguments passed to route loader/action functions. Same for now but we keep
289
+ * this as a private implementation detail in case they diverge in the future.
290
+ */
291
+ interface DataFunctionArgs {
292
+ request: Request;
293
+ params: Params;
294
+ context?: any;
295
+ }
296
+ /**
297
+ * Arguments passed to loader functions
298
+ */
299
+ interface LoaderFunctionArgs extends DataFunctionArgs {
300
+ }
301
+ /**
302
+ * Arguments passed to action functions
303
+ */
304
+ interface ActionFunctionArgs extends DataFunctionArgs {
305
+ }
306
+ /**
307
+ * Loaders and actions can return anything except `undefined` (`null` is a
308
+ * valid return value if there is no data to return). Responses are preferred
309
+ * and will ease any future migration to Remix
310
+ */
311
+ type DataFunctionValue = Response | NonNullable<unknown> | null;
312
+ /**
313
+ * Route loader function signature
314
+ */
315
+ interface LoaderFunction {
316
+ (args: LoaderFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
317
+ }
318
+ /**
319
+ * Route action function signature
320
+ */
321
+ interface ActionFunction {
322
+ (args: ActionFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
323
+ }
324
+ /**
325
+ * Route shouldRevalidate function signature. This runs after any submission
326
+ * (navigation or fetcher), so we flatten the navigation/fetcher submission
327
+ * onto the arguments. It shouldn't matter whether it came from a navigation
328
+ * or a fetcher, what really matters is the URLs and the formData since loaders
329
+ * have to re-run based on the data models that were potentially mutated.
330
+ */
331
+ interface ShouldRevalidateFunction {
332
+ (args: {
333
+ currentUrl: URL;
334
+ currentParams: AgnosticDataRouteMatch["params"];
335
+ nextUrl: URL;
336
+ nextParams: AgnosticDataRouteMatch["params"];
337
+ formMethod?: Submission["formMethod"];
338
+ formAction?: Submission["formAction"];
339
+ formEncType?: Submission["formEncType"];
340
+ text?: Submission["text"];
341
+ formData?: Submission["formData"];
342
+ json?: Submission["json"];
343
+ actionResult?: DataResult;
344
+ defaultShouldRevalidate: boolean;
345
+ }): boolean;
346
+ }
347
+ /**
348
+ * Keys we cannot change from within a lazy() function. We spread all other keys
349
+ * onto the route. Either they're meaningful to the router, or they'll get
350
+ * ignored.
351
+ */
352
+ type ImmutableRouteKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
353
+ type RequireOne<T, Key = keyof T> = Exclude<{
354
+ [K in keyof T]: K extends Key ? Omit<T, K> & Required<Pick<T, K>> : never;
355
+ }[keyof T], undefined>;
356
+ /**
357
+ * lazy() function to load a route definition, which can add non-matching
358
+ * related properties to a route
359
+ */
360
+ interface LazyRouteFunction<R extends AgnosticRouteObject> {
361
+ (): Promise<RequireOne<Omit<R, ImmutableRouteKey>>>;
362
+ }
363
+ /**
364
+ * Base RouteObject with common props shared by all types of routes
365
+ */
366
+ type AgnosticBaseRouteObject = {
367
+ caseSensitive?: boolean;
368
+ path?: string;
369
+ id?: string;
370
+ loader?: LoaderFunction;
371
+ action?: ActionFunction;
372
+ hasErrorBoundary?: boolean;
373
+ shouldRevalidate?: ShouldRevalidateFunction;
374
+ handle?: any;
375
+ lazy?: LazyRouteFunction<AgnosticBaseRouteObject>;
376
+ };
377
+ /**
378
+ * Index routes must not have children
379
+ */
380
+ type AgnosticIndexRouteObject = AgnosticBaseRouteObject & {
381
+ children?: undefined;
382
+ index: true;
383
+ };
384
+ /**
385
+ * Non-index routes may have children, but cannot have index
386
+ */
387
+ type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & {
388
+ children?: AgnosticRouteObject[];
389
+ index?: false;
390
+ };
391
+ /**
392
+ * A route object represents a logical route, with (optionally) its child
393
+ * routes organized in a tree-like structure.
394
+ */
395
+ type AgnosticRouteObject = AgnosticIndexRouteObject | AgnosticNonIndexRouteObject;
396
+ type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & {
397
+ id: string;
398
+ };
399
+ type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
400
+ children?: AgnosticDataRouteObject[];
401
+ id: string;
402
+ };
403
+ /**
404
+ * A data route object, which is just a RouteObject with a required unique ID
405
+ */
406
+ type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject;
407
+ /**
408
+ * The parameters that were parsed from the URL path.
409
+ */
410
+ type Params<Key extends string = string> = {
411
+ readonly [key in Key]: string | undefined;
412
+ };
413
+ /**
414
+ * A RouteMatch contains info about how a route matched a URL.
415
+ */
416
+ interface AgnosticRouteMatch<ParamKey extends string = string, RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject> {
417
+ /**
418
+ * The names and values of dynamic parameters in the URL.
419
+ */
420
+ params: Params<ParamKey>;
421
+ /**
422
+ * The portion of the URL pathname that was matched.
423
+ */
424
+ pathname: string;
425
+ /**
426
+ * The portion of the URL pathname that was matched before child routes.
427
+ */
428
+ pathnameBase: string;
429
+ /**
430
+ * The route object that was used to match.
431
+ */
432
+ route: RouteObjectType;
433
+ }
434
+ interface AgnosticDataRouteMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
435
+ }
436
+ declare class DeferredData {
437
+ private pendingKeysSet;
438
+ private controller;
439
+ private abortPromise;
440
+ private unlistenAbortSignal;
441
+ private subscribers;
442
+ data: Record<string, unknown>;
443
+ init?: ResponseInit;
444
+ deferredKeys: string[];
445
+ constructor(data: Record<string, unknown>, responseInit?: ResponseInit);
446
+ private trackPromise;
447
+ private onSettle;
448
+ private emit;
449
+ subscribe(fn: (aborted: boolean, settledKey?: string) => void): () => boolean;
450
+ cancel(): void;
451
+ resolveData(signal: AbortSignal): Promise<boolean>;
452
+ get done(): boolean;
453
+ get unwrappedData(): {};
454
+ get pendingKeys(): string[];
455
+ }
456
+
457
+ /**
458
+ * State maintained internally by the router. During a navigation, all states
459
+ * reflect the the "old" location unless otherwise noted.
460
+ */
461
+ interface RouterState {
462
+ /**
463
+ * The action of the most recent navigation
464
+ */
465
+ historyAction: Action;
466
+ /**
467
+ * The current location reflected by the router
468
+ */
469
+ location: Location$2;
470
+ /**
471
+ * The current set of route matches
472
+ */
473
+ matches: AgnosticDataRouteMatch[];
474
+ /**
475
+ * Tracks whether we've completed our initial data load
476
+ */
477
+ initialized: boolean;
478
+ /**
479
+ * Current scroll position we should start at for a new view
480
+ * - number -> scroll position to restore to
481
+ * - false -> do not restore scroll at all (used during submissions)
482
+ * - null -> don't have a saved position, scroll to hash or top of page
483
+ */
484
+ restoreScrollPosition: number | false | null;
485
+ /**
486
+ * Indicate whether this navigation should skip resetting the scroll position
487
+ * if we are unable to restore the scroll position
488
+ */
489
+ preventScrollReset: boolean;
490
+ /**
491
+ * Tracks the state of the current navigation
492
+ */
493
+ navigation: Navigation;
494
+ /**
495
+ * Tracks any in-progress revalidations
496
+ */
497
+ revalidation: RevalidationState;
498
+ /**
499
+ * Data from the loaders for the current matches
500
+ */
501
+ loaderData: RouteData;
502
+ /**
503
+ * Data from the action for the current matches
504
+ */
505
+ actionData: RouteData | null;
506
+ /**
507
+ * Errors caught from loaders for the current matches
508
+ */
509
+ errors: RouteData | null;
510
+ /**
511
+ * Map of current fetchers
512
+ */
513
+ fetchers: Map<string, Fetcher>;
514
+ /**
515
+ * Map of current blockers
516
+ */
517
+ blockers: Map<string, Blocker>;
518
+ }
519
+ /**
520
+ * Data that can be passed into hydrate a Router from SSR
521
+ */
522
+ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
523
+ type RelativeRoutingType = "route" | "path";
524
+ /**
525
+ * Potential states for state.navigation
526
+ */
527
+ type NavigationStates = {
528
+ Idle: {
529
+ state: "idle";
530
+ location: undefined;
531
+ formMethod: undefined;
532
+ formAction: undefined;
533
+ formEncType: undefined;
534
+ formData: undefined;
535
+ json: undefined;
536
+ text: undefined;
537
+ };
538
+ Loading: {
539
+ state: "loading";
540
+ location: Location$2;
541
+ formMethod: Submission["formMethod"] | undefined;
542
+ formAction: Submission["formAction"] | undefined;
543
+ formEncType: Submission["formEncType"] | undefined;
544
+ formData: Submission["formData"] | undefined;
545
+ json: Submission["json"] | undefined;
546
+ text: Submission["text"] | undefined;
547
+ };
548
+ Submitting: {
549
+ state: "submitting";
550
+ location: Location$2;
551
+ formMethod: Submission["formMethod"];
552
+ formAction: Submission["formAction"];
553
+ formEncType: Submission["formEncType"];
554
+ formData: Submission["formData"];
555
+ json: Submission["json"];
556
+ text: Submission["text"];
557
+ };
558
+ };
559
+ type Navigation = NavigationStates[keyof NavigationStates];
560
+ type RevalidationState = "idle" | "loading";
561
+ /**
562
+ * Potential states for fetchers
563
+ */
564
+ type FetcherStates<TData = any> = {
565
+ Idle: {
566
+ state: "idle";
567
+ formMethod: undefined;
568
+ formAction: undefined;
569
+ formEncType: undefined;
570
+ text: undefined;
571
+ formData: undefined;
572
+ json: undefined;
573
+ data: TData | undefined;
574
+ " _hasFetcherDoneAnything "?: boolean;
575
+ };
576
+ Loading: {
577
+ state: "loading";
578
+ formMethod: Submission["formMethod"] | undefined;
579
+ formAction: Submission["formAction"] | undefined;
580
+ formEncType: Submission["formEncType"] | undefined;
581
+ text: Submission["text"] | undefined;
582
+ formData: Submission["formData"] | undefined;
583
+ json: Submission["json"] | undefined;
584
+ data: TData | undefined;
585
+ " _hasFetcherDoneAnything "?: boolean;
586
+ };
587
+ Submitting: {
588
+ state: "submitting";
589
+ formMethod: Submission["formMethod"];
590
+ formAction: Submission["formAction"];
591
+ formEncType: Submission["formEncType"];
592
+ text: Submission["text"];
593
+ formData: Submission["formData"];
594
+ json: Submission["json"];
595
+ data: TData | undefined;
596
+ " _hasFetcherDoneAnything "?: boolean;
597
+ };
598
+ };
599
+ type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
600
+ interface BlockerBlocked {
601
+ state: "blocked";
602
+ reset(): void;
603
+ proceed(): void;
604
+ location: Location$2;
605
+ }
606
+ interface BlockerUnblocked {
607
+ state: "unblocked";
608
+ reset: undefined;
609
+ proceed: undefined;
610
+ location: undefined;
611
+ }
612
+ interface BlockerProceeding {
613
+ state: "proceeding";
614
+ reset: undefined;
615
+ proceed: undefined;
616
+ location: Location$2;
617
+ }
618
+ type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
619
+
620
+ interface NavigateOptions$1 {
621
+ replace?: boolean;
622
+ state?: any;
623
+ preventScrollReset?: boolean;
624
+ relative?: RelativeRoutingType;
625
+ }
626
+ /**
627
+ * A Navigator is a "location changer"; it's how you get to different locations.
628
+ *
629
+ * Every history instance conforms to the Navigator interface, but the
630
+ * distinction is useful primarily when it comes to the low-level <Router> API
631
+ * where both the location and a navigator must be provided separately in order
632
+ * to avoid "tearing" that may occur in a suspense-enabled app if the action
633
+ * and/or location were to be read directly from the history instance.
634
+ */
635
+ interface Navigator {
636
+ createHref: History["createHref"];
637
+ encodeLocation?: History["encodeLocation"];
638
+ go: History["go"];
639
+ push(to: To, state?: any, opts?: NavigateOptions$1): void;
640
+ replace(to: To, state?: any, opts?: NavigateOptions$1): void;
641
+ }
642
+
643
+ interface FutureConfig {
644
+ v7_startTransition: boolean;
645
+ }
646
+ interface RouterProps {
647
+ basename?: string;
648
+ children?: React.ReactNode;
649
+ location: Partial<Location$2> | string;
650
+ navigationType?: Action;
651
+ navigator: Navigator;
652
+ static?: boolean;
653
+ }
654
+ /**
655
+ * Provides location context for the rest of the app.
656
+ *
657
+ * Note: You usually won't render a <Router> directly. Instead, you'll render a
658
+ * router that is more specific to your environment such as a <BrowserRouter>
659
+ * in web browsers or a <StaticRouter> for server rendering.
660
+ *
661
+ * @see https://reactrouter.com/router-components/router
662
+ */
663
+ declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null;
664
+
665
+ /**
666
+ * NOTE: If you refactor this to split up the modules into separate files,
667
+ * you'll need to update the rollup config for react-router-dom-v5-compat.
668
+ */
669
+
670
+ declare global {
671
+ var __staticRouterHydrationData: HydrationState | undefined;
672
+ }
673
+ interface BrowserRouterProps {
674
+ basename?: string;
675
+ children?: React.ReactNode;
676
+ future?: FutureConfig;
677
+ window?: Window;
678
+ }
679
+ /**
680
+ * A `<Router>` for use in web browsers. Provides the cleanest URLs.
681
+ */
682
+ declare function BrowserRouter({ basename, children, future, window, }: BrowserRouterProps): React.JSX.Element;
683
+
26
684
  interface Other extends StoryData {
27
685
  path: string;
28
686
  singleStory?: boolean;
29
687
  }
30
- type NavigateOptions = R.NavigateOptions & {
688
+ type NavigateOptions = NavigateOptions$1 & {
31
689
  plain?: boolean;
32
690
  };
33
- type NavigateFunction = (to: R.To | number, options?: NavigateOptions) => void;
691
+ type NavigateFunction = (to: To | number, options?: NavigateOptions) => void;
34
692
  type RouterData = {
35
- location: Partial<R.Location>;
693
+ location: Partial<Location$2>;
36
694
  navigate: NavigateFunction;
37
695
  } & Other;
38
696
  type RenderData = Pick<RouterData, 'location'> & Other;
@@ -69,10 +727,10 @@ interface RoutePropsDefault {
69
727
  startsWith?: false;
70
728
  children: ReactNode;
71
729
  }
72
- declare const useNavigate: () => (to: R.To | number, { plain, ...options }?: NavigateOptions) => void;
730
+ declare const useNavigate: () => (to: To | number, { plain, ...options }?: NavigateOptions) => void;
73
731
  /** A component that will navigate to a new location/path when clicked */
74
732
  declare const Link: {
75
- ({ to, children, ...rest }: LinkProps): React.JSX.Element;
733
+ ({ to, children, ...rest }: LinkProps): React__default.JSX.Element;
76
734
  displayName: string;
77
735
  };
78
736
  /**
@@ -80,7 +738,7 @@ declare const Link: {
80
738
  * changes
81
739
  */
82
740
  declare const Location$1: {
83
- ({ children }: LocationProps): React.JSX.Element;
741
+ ({ children }: LocationProps): React__default.JSX.Element;
84
742
  displayName: string;
85
743
  };
86
744
  /**
@@ -100,7 +758,7 @@ declare namespace Route {
100
758
  var displayName: string;
101
759
  }
102
760
 
103
- declare const LocationProvider: typeof R.BrowserRouter;
104
- declare const BaseLocationProvider: typeof R.Router;
761
+ declare const LocationProvider: typeof BrowserRouter;
762
+ declare const BaseLocationProvider: typeof Router;
105
763
 
106
764
  export { BaseLocationProvider, DEEPLY_EQUAL, Link, type LinkProps, Location$1 as Location, LocationProvider, Match, type NavigateFunction, type NavigateOptions, type Other, type RenderData, Route, type RouterData, type StoryData, buildArgsParam, deepDiff, getMatch, parsePath, queryFromLocation, stringifyQuery, useNavigate };