storybook 10.0.0-beta.1 → 10.0.0-beta.10
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/assets/server/openBrowser.applescript +94 -0
- package/dist/_browser-chunks/Color-KPLIACXP.js +1569 -0
- package/dist/_browser-chunks/{WithTooltip-ERFLZL6W.js → WithTooltip-SK46ZJ2J.js} +1 -1
- package/dist/_browser-chunks/{chunk-YY5GICNT.js → chunk-6E2SHJSL.js} +175 -32
- package/dist/_browser-chunks/{chunk-EOILZP2R.js → chunk-BOOOPFZF.js} +7 -2
- package/dist/_browser-chunks/{chunk-YWDKX534.js → chunk-FA42P6MO.js} +49 -4
- package/dist/_browser-chunks/chunk-G33S6YM3.js +521 -0
- package/dist/_browser-chunks/{chunk-MZNYTCNT.js → chunk-HMIIJ6UD.js} +6 -6
- package/dist/_browser-chunks/{chunk-4QPX7WIQ.js → chunk-JJZMHC3A.js} +57 -166
- package/dist/_browser-chunks/{chunk-MD2FTHCZ.js → chunk-JVSKG4YS.js} +3 -16
- package/dist/_browser-chunks/{chunk-E7VLET3C.js → chunk-KSCAWCCE.js} +3947 -4291
- package/dist/_browser-chunks/{chunk-PYK5ZTFK.js → chunk-PS3AOQI4.js} +48 -25
- package/dist/_browser-chunks/chunk-QK3L5AXO.js +372 -0
- package/dist/_browser-chunks/chunk-SHR3NNR3.js +5810 -0
- package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +20 -0
- package/dist/_browser-chunks/{chunk-T7RCAJIX.js → chunk-Y3M7TW6K.js} +43 -47
- package/dist/_browser-chunks/{syntaxhighlighter-YYAA4CS4.js → syntaxhighlighter-R46XOLMC.js} +1 -1
- package/dist/_node-chunks/{builder-manager-EXW4ETLN.js → builder-manager-SJGIDEN6.js} +45 -155
- package/dist/_node-chunks/camelcase-VZHWABQV.js +18 -0
- package/dist/_node-chunks/{chunk-F5J33SXQ.js → chunk-6CZW7AGN.js} +7 -7
- package/dist/_node-chunks/{chunk-2G5THETV.js → chunk-6XT5OLNL.js} +12 -12
- package/dist/_node-chunks/{chunk-U45F2NP6.js → chunk-AHRH5RPR.js} +7 -7
- package/dist/_node-chunks/{chunk-ICPKUV5G.js → chunk-AOH6ABSV.js} +7 -7
- package/dist/_node-chunks/chunk-C5V22GP7.js +79 -0
- package/dist/_node-chunks/{chunk-5V6QH7WC.js → chunk-FIROF4DV.js} +7 -7
- package/dist/_node-chunks/{chunk-WDKWVNL2.js → chunk-GUJVZUYI.js} +7 -7
- package/dist/_node-chunks/chunk-IHPLRRAR.js +4741 -0
- package/dist/_node-chunks/{chunk-PMEEE3UE.js → chunk-JMXKCRWR.js} +30 -21
- package/dist/_node-chunks/{chunk-5ZX5SJOP.js → chunk-JUMUXWEV.js} +162 -103
- package/dist/_node-chunks/{chunk-CM3UGTR5.js → chunk-KGX33KXX.js} +7 -7
- package/dist/_node-chunks/{chunk-6CCUFDHU.js → chunk-KLVABNEU.js} +7 -7
- package/dist/_node-chunks/{chunk-EO4S3VXL.js → chunk-OL6DY6BT.js} +653 -775
- package/dist/_node-chunks/{chunk-GVCXNIAA.js → chunk-ONJV3K2L.js} +399 -116
- package/dist/_node-chunks/{chunk-3ZKQWDCG.js → chunk-PTHTD4RO.js} +223 -243
- package/dist/_node-chunks/{chunk-VNLBDN2Z.js → chunk-QQ3Z5KGJ.js} +6 -6
- package/dist/_node-chunks/{chunk-2QZOLZDJ.js → chunk-QRTDDTZJ.js} +9 -9
- package/dist/_node-chunks/chunk-R54K4KSM.js +1540 -0
- package/dist/_node-chunks/{chunk-24TGL6EX.js → chunk-S2LZC6JK.js} +8 -8
- package/dist/_node-chunks/chunk-SFJFSPRT.js +62 -0
- package/dist/_node-chunks/{chunk-SUMFFLGF.js → chunk-SSN5PKIY.js} +6 -6
- package/dist/_node-chunks/{chunk-QC5FE2D7.js → chunk-SXR2DITB.js} +7 -7
- package/dist/_node-chunks/{chunk-FZP2YGG3.js → chunk-TH5QVQRL.js} +7 -7
- package/dist/_node-chunks/chunk-U34NWAU2.js +18 -0
- package/dist/_node-chunks/{chunk-XTSBFCVE.js → chunk-UV3CZ3KS.js} +7 -7
- package/dist/_node-chunks/{chunk-PL2PKDRO.js → chunk-UVUGJDAI.js} +60 -102
- package/dist/_node-chunks/{chunk-EDBXIJN5.js → chunk-VOUNSD2E.js} +7 -7
- package/dist/_node-chunks/{chunk-WP7DV5JT.js → chunk-WFCPBKQJ.js} +583 -180
- package/dist/_node-chunks/{chunk-4WNZYNQY.js → chunk-XHF3WWNP.js} +623 -750
- package/dist/_node-chunks/{chunk-3SGKBLOL.js → chunk-XU45KXNQ.js} +8 -8
- package/dist/_node-chunks/{camelcase-VZZFWA2L.js → chunk-YHO6XR7U.js} +9 -8
- package/dist/_node-chunks/{dist-VZL6D6Y3.js → dist-IIC5PBL7.js} +9 -9
- package/dist/_node-chunks/{globby-GZXJJ4W6.js → globby-CJACC3HJ.js} +17 -13
- package/dist/_node-chunks/{lib-PHT5GCV2.js → lib-ZY4TKSOR.js} +40 -16
- package/dist/_node-chunks/{mdx-N42X6CFJ-EPDIV4A2.js → mdx-N42X6CFJ-3XNW3DFO.js} +8 -8
- package/dist/_node-chunks/{p-limit-AJIFSZTI.js → p-limit-R2OFT5HE.js} +76 -10
- package/dist/_node-chunks/{plugin-3VI56CEF.js → plugin-5XD5R2KD.js} +10 -10
- package/dist/_node-chunks/{plugin-AV4OEKYM.js → plugin-WAWVQMVR.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-E7J5FKLA.js → webpack-inject-mocker-runtime-plugin-SCRGJLIS.js} +1307 -847
- package/dist/_node-chunks/{webpack-mock-plugin-VTYGW7HO.js → webpack-mock-plugin-3VAXEGG2.js} +9 -9
- package/dist/babel/index.d.ts +1 -1
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +638 -187
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +8 -8
- package/dist/cli/index.d.ts +62 -75
- package/dist/cli/index.js +66 -55
- package/dist/common/index.d.ts +3 -1
- package/dist/common/index.js +22 -22
- package/dist/components/index.d.ts +228 -1
- package/dist/components/index.js +74 -5738
- package/dist/core-events/index.d.ts +18 -2
- package/dist/core-events/index.js +7 -1
- package/dist/core-server/index.d.ts +515 -14
- package/dist/core-server/index.js +4647 -4182
- package/dist/core-server/presets/common-manager.js +1570 -1272
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +691 -38
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
- package/dist/csf/index.d.ts +9 -4
- package/dist/csf/index.js +50 -15
- package/dist/csf-tools/index.d.ts +47 -6
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +4 -4
- package/dist/instrumenter/index.js +1 -1
- package/dist/manager/globals-runtime.js +9230 -18109
- package/dist/manager/globals.d.ts +0 -4
- package/dist/manager/globals.js +1 -6
- package/dist/manager/runtime.js +13398 -11573
- package/dist/manager-api/index.d.ts +513 -5
- package/dist/manager-api/index.js +364 -90
- package/dist/manager-errors.d.ts +501 -0
- package/dist/node-logger/index.d.ts +1 -1
- package/dist/node-logger/index.js +1136 -662
- package/dist/preview/globals.js +1 -1
- package/dist/preview/runtime.js +12103 -21579
- package/dist/preview-api/index.d.ts +3 -3
- package/dist/preview-api/index.js +10 -10
- package/dist/preview-errors.d.ts +501 -0
- package/dist/router/index.d.ts +668 -10
- package/dist/router/index.js +2 -2
- package/dist/server-errors.d.ts +501 -0
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +23 -25
- package/dist/test/index.js +1874 -4024
- package/dist/theming/index.d.ts +2 -2
- package/dist/theming/index.js +6 -6
- package/dist/types/index.d.ts +553 -16
- package/dist/viewport/index.d.ts +36 -4
- package/dist/viewport/index.js +1 -1
- package/package.json +9 -46
- package/dist/_browser-chunks/Color-SFYJJKWL.js +0 -605
- package/dist/_browser-chunks/chunk-DHO2SA6L.js +0 -12
- package/dist/_browser-chunks/chunk-WPHPDNUA.js +0 -974
- package/dist/_node-chunks/chunk-32JYCD74.js +0 -80
- package/dist/_node-chunks/chunk-GE6I3YYG.js +0 -62
- package/dist/_node-chunks/chunk-KXCNXWXI.js +0 -18
- package/dist/_node-chunks/chunk-LAUOYAOX.js +0 -87
- package/dist/_node-chunks/chunk-QJTT4OC2.js +0 -266
- package/dist/_node-chunks/chunk-V2ZF4DUD.js +0 -2377
- package/dist/_node-chunks/chunk-ZMV3WY6R.js +0 -9845
- package/dist/_node-chunks/default-browser-id-JNATP42X.js +0 -1719
|
@@ -229,6 +229,18 @@ interface StoryFinishedPayload {
|
|
|
229
229
|
reporters: Report[];
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
type OpenInEditorRequestPayload = {
|
|
233
|
+
file: string;
|
|
234
|
+
line?: number;
|
|
235
|
+
column?: number;
|
|
236
|
+
};
|
|
237
|
+
type OpenInEditorResponsePayload = {
|
|
238
|
+
file: string;
|
|
239
|
+
line?: number;
|
|
240
|
+
column?: number;
|
|
241
|
+
error: string | null;
|
|
242
|
+
};
|
|
243
|
+
|
|
232
244
|
declare enum events {
|
|
233
245
|
CHANNEL_WS_DISCONNECT = "channelWSDisconnect",
|
|
234
246
|
CHANNEL_CREATED = "channelCreated",
|
|
@@ -286,7 +298,9 @@ declare enum events {
|
|
|
286
298
|
ARGTYPES_INFO_REQUEST = "argtypesInfoRequest",
|
|
287
299
|
ARGTYPES_INFO_RESPONSE = "argtypesInfoResponse",
|
|
288
300
|
CREATE_NEW_STORYFILE_REQUEST = "createNewStoryfileRequest",
|
|
289
|
-
CREATE_NEW_STORYFILE_RESPONSE = "createNewStoryfileResponse"
|
|
301
|
+
CREATE_NEW_STORYFILE_RESPONSE = "createNewStoryfileResponse",
|
|
302
|
+
OPEN_IN_EDITOR_REQUEST = "openInEditorRequest",
|
|
303
|
+
OPEN_IN_EDITOR_RESPONSE = "openInEditorResponse"
|
|
290
304
|
}
|
|
291
305
|
|
|
292
306
|
declare const CHANNEL_WS_DISCONNECT: events;
|
|
@@ -346,5 +360,7 @@ declare const SAVE_STORY_REQUEST: events;
|
|
|
346
360
|
declare const SAVE_STORY_RESPONSE: events;
|
|
347
361
|
declare const ARGTYPES_INFO_REQUEST: events;
|
|
348
362
|
declare const ARGTYPES_INFO_RESPONSE: events;
|
|
363
|
+
declare const OPEN_IN_EDITOR_REQUEST: events;
|
|
364
|
+
declare const OPEN_IN_EDITOR_RESPONSE: events;
|
|
349
365
|
|
|
350
|
-
export { ARGTYPES_INFO_REQUEST, ARGTYPES_INFO_RESPONSE, type ArgTypesRequestPayload, type ArgTypesResponsePayload, CHANNEL_CREATED, CHANNEL_WS_DISCONNECT, CONFIG_ERROR, CREATE_NEW_STORYFILE_REQUEST, CREATE_NEW_STORYFILE_RESPONSE, CURRENT_STORY_WAS_SET, type CreateNewStoryErrorPayload, type CreateNewStoryRequestPayload, type CreateNewStoryResponsePayload, DOCS_PREPARED, DOCS_RENDERED, FILE_COMPONENT_SEARCH_REQUEST, FILE_COMPONENT_SEARCH_RESPONSE, FORCE_REMOUNT, FORCE_RE_RENDER, type FileComponentSearchRequestPayload, type FileComponentSearchResponsePayload, GLOBALS_UPDATED, NAVIGATE_URL, PLAY_FUNCTION_THREW_EXCEPTION, PRELOAD_ENTRIES, PREVIEW_BUILDER_PROGRESS, PREVIEW_KEYDOWN, REGISTER_SUBSCRIPTION, REQUEST_WHATS_NEW_DATA, RESET_STORY_ARGS, RESULT_WHATS_NEW_DATA, type RequestData, type ResponseData, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, SELECT_STORY, SET_CONFIG, SET_CURRENT_STORY, SET_FILTER, SET_GLOBALS, SET_INDEX, SET_STORIES, SET_WHATS_NEW_CACHE, SHARED_STATE_CHANGED, SHARED_STATE_SET, STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL, STORY_ARGS_UPDATED, STORY_CHANGED, STORY_ERRORED, STORY_FINISHED, STORY_HOT_UPDATED, STORY_INDEX_INVALIDATED, STORY_MISSING, STORY_PREPARED, STORY_RENDERED, STORY_RENDER_PHASE_CHANGED, STORY_SPECIFIED, STORY_THREW_EXCEPTION, STORY_UNCHANGED, type SaveStoryRequestPayload, type SaveStoryResponsePayload, type StoryFinishedPayload, TELEMETRY_ERROR, TOGGLE_WHATS_NEW_NOTIFICATIONS, UNHANDLED_ERRORS_WHILE_PLAYING, UPDATE_GLOBALS, UPDATE_QUERY_PARAMS, UPDATE_STORY_ARGS, type WhatsNewCache, type WhatsNewData, events as default };
|
|
366
|
+
export { ARGTYPES_INFO_REQUEST, ARGTYPES_INFO_RESPONSE, type ArgTypesRequestPayload, type ArgTypesResponsePayload, CHANNEL_CREATED, CHANNEL_WS_DISCONNECT, CONFIG_ERROR, CREATE_NEW_STORYFILE_REQUEST, CREATE_NEW_STORYFILE_RESPONSE, CURRENT_STORY_WAS_SET, type CreateNewStoryErrorPayload, type CreateNewStoryRequestPayload, type CreateNewStoryResponsePayload, DOCS_PREPARED, DOCS_RENDERED, FILE_COMPONENT_SEARCH_REQUEST, FILE_COMPONENT_SEARCH_RESPONSE, FORCE_REMOUNT, FORCE_RE_RENDER, type FileComponentSearchRequestPayload, type FileComponentSearchResponsePayload, GLOBALS_UPDATED, NAVIGATE_URL, OPEN_IN_EDITOR_REQUEST, OPEN_IN_EDITOR_RESPONSE, type OpenInEditorRequestPayload, type OpenInEditorResponsePayload, PLAY_FUNCTION_THREW_EXCEPTION, PRELOAD_ENTRIES, PREVIEW_BUILDER_PROGRESS, PREVIEW_KEYDOWN, REGISTER_SUBSCRIPTION, REQUEST_WHATS_NEW_DATA, RESET_STORY_ARGS, RESULT_WHATS_NEW_DATA, type RequestData, type ResponseData, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, SELECT_STORY, SET_CONFIG, SET_CURRENT_STORY, SET_FILTER, SET_GLOBALS, SET_INDEX, SET_STORIES, SET_WHATS_NEW_CACHE, SHARED_STATE_CHANGED, SHARED_STATE_SET, STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL, STORY_ARGS_UPDATED, STORY_CHANGED, STORY_ERRORED, STORY_FINISHED, STORY_HOT_UPDATED, STORY_INDEX_INVALIDATED, STORY_MISSING, STORY_PREPARED, STORY_RENDERED, STORY_RENDER_PHASE_CHANGED, STORY_SPECIFIED, STORY_THREW_EXCEPTION, STORY_UNCHANGED, type SaveStoryRequestPayload, type SaveStoryResponsePayload, type StoryFinishedPayload, TELEMETRY_ERROR, TOGGLE_WHATS_NEW_NOTIFICATIONS, UNHANDLED_ERRORS_WHILE_PLAYING, UPDATE_GLOBALS, UPDATE_QUERY_PARAMS, UPDATE_STORY_ARGS, type WhatsNewCache, type WhatsNewData, events as default };
|
|
@@ -59,6 +59,8 @@ var events = /* @__PURE__ */ ((events2) => {
|
|
|
59
59
|
events2["ARGTYPES_INFO_RESPONSE"] = "argtypesInfoResponse";
|
|
60
60
|
events2["CREATE_NEW_STORYFILE_REQUEST"] = "createNewStoryfileRequest";
|
|
61
61
|
events2["CREATE_NEW_STORYFILE_RESPONSE"] = "createNewStoryfileResponse";
|
|
62
|
+
events2["OPEN_IN_EDITOR_REQUEST"] = "openInEditorRequest";
|
|
63
|
+
events2["OPEN_IN_EDITOR_RESPONSE"] = "openInEditorResponse";
|
|
62
64
|
return events2;
|
|
63
65
|
})(events || {});
|
|
64
66
|
var core_events_default = events;
|
|
@@ -119,7 +121,9 @@ var {
|
|
|
119
121
|
SAVE_STORY_REQUEST,
|
|
120
122
|
SAVE_STORY_RESPONSE,
|
|
121
123
|
ARGTYPES_INFO_REQUEST,
|
|
122
|
-
ARGTYPES_INFO_RESPONSE
|
|
124
|
+
ARGTYPES_INFO_RESPONSE,
|
|
125
|
+
OPEN_IN_EDITOR_REQUEST,
|
|
126
|
+
OPEN_IN_EDITOR_RESPONSE
|
|
123
127
|
} = events;
|
|
124
128
|
export {
|
|
125
129
|
ARGTYPES_INFO_REQUEST,
|
|
@@ -138,6 +142,8 @@ export {
|
|
|
138
142
|
FORCE_RE_RENDER,
|
|
139
143
|
GLOBALS_UPDATED,
|
|
140
144
|
NAVIGATE_URL,
|
|
145
|
+
OPEN_IN_EDITOR_REQUEST,
|
|
146
|
+
OPEN_IN_EDITOR_RESPONSE,
|
|
141
147
|
PLAY_FUNCTION_THREW_EXCEPTION,
|
|
142
148
|
PRELOAD_ENTRIES,
|
|
143
149
|
PREVIEW_BUILDER_PROGRESS,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { loadAllPresets } from 'storybook/internal/common';
|
|
2
2
|
export { getPreviewBodyTemplate, getPreviewHeadTemplate } from 'storybook/internal/common';
|
|
3
3
|
import * as storybook_internal_types from 'storybook/internal/types';
|
|
4
|
-
import { CLIOptions, LoadOptions, BuilderOptions, StorybookConfigRaw, IndexInputStats, NormalizedStoriesSpecifier, Path, Indexer, DocsOptions, StoryIndexEntry, DocsIndexEntry, Tag, IndexEntry, StoryIndex, Options, NormalizedProjectAnnotations, ProjectAnnotations, ComposedStoryFn } from 'storybook/internal/types';
|
|
4
|
+
import { CLIOptions, LoadOptions, BuilderOptions, StorybookConfigRaw, IndexInputStats, NormalizedStoriesSpecifier, Path as Path$1, Indexer, DocsOptions, StoryIndexEntry, DocsIndexEntry, Tag, IndexEntry, StoryIndex, Options, NormalizedProjectAnnotations, ProjectAnnotations, ComposedStoryFn } from 'storybook/internal/types';
|
|
5
5
|
import { EventType } from 'storybook/internal/telemetry';
|
|
6
6
|
import { Channel } from 'storybook/internal/channels';
|
|
7
7
|
import { StoryId } from 'storybook/internal/csf';
|
|
@@ -84,7 +84,7 @@ type DocsCacheEntry = DocsIndexEntry;
|
|
|
84
84
|
/** A `_.stories._` file will produce a list of stories and possibly a docs entry */
|
|
85
85
|
type StoriesCacheEntry = {
|
|
86
86
|
entries: (StoryIndexEntryWithExtra | DocsIndexEntry)[];
|
|
87
|
-
dependents: Path[];
|
|
87
|
+
dependents: Path$1[];
|
|
88
88
|
type: 'stories';
|
|
89
89
|
};
|
|
90
90
|
type ErrorEntry = {
|
|
@@ -92,10 +92,10 @@ type ErrorEntry = {
|
|
|
92
92
|
err: IndexingError;
|
|
93
93
|
};
|
|
94
94
|
type CacheEntry = false | StoriesCacheEntry | DocsCacheEntry | ErrorEntry;
|
|
95
|
-
type SpecifierStoriesCache = Record<Path, CacheEntry>;
|
|
95
|
+
type SpecifierStoriesCache = Record<Path$1, CacheEntry>;
|
|
96
96
|
type StoryIndexGeneratorOptions = {
|
|
97
|
-
workingDir: Path;
|
|
98
|
-
configDir: Path;
|
|
97
|
+
workingDir: Path$1;
|
|
98
|
+
configDir: Path$1;
|
|
99
99
|
indexers: Indexer[];
|
|
100
100
|
docs: DocsOptions;
|
|
101
101
|
build?: StorybookConfigRaw['build'];
|
|
@@ -136,28 +136,28 @@ declare class StoryIndexGenerator {
|
|
|
136
136
|
private static getFindMatchingFilesCacheKey;
|
|
137
137
|
/** Clear the findMatchingFiles cache */
|
|
138
138
|
static clearFindMatchingFilesCache(): void;
|
|
139
|
-
static findMatchingFiles(specifier: NormalizedStoriesSpecifier, workingDir: Path, ignoreWarnings?: boolean): Promise<SpecifierStoriesCache>;
|
|
140
|
-
static findMatchingFilesForSpecifiers(specifiers: NormalizedStoriesSpecifier[], workingDir: Path, ignoreWarnings?: boolean): Promise<Array<readonly [NormalizedStoriesSpecifier, SpecifierStoriesCache]>>;
|
|
139
|
+
static findMatchingFiles(specifier: NormalizedStoriesSpecifier, workingDir: Path$1, ignoreWarnings?: boolean): Promise<SpecifierStoriesCache>;
|
|
140
|
+
static findMatchingFilesForSpecifiers(specifiers: NormalizedStoriesSpecifier[], workingDir: Path$1, ignoreWarnings?: boolean): Promise<Array<readonly [NormalizedStoriesSpecifier, SpecifierStoriesCache]>>;
|
|
141
141
|
initialize(): Promise<void>;
|
|
142
142
|
/** Run the updater function over all the empty cache entries */
|
|
143
|
-
updateExtracted(updater: (specifier: NormalizedStoriesSpecifier, absolutePath: Path, existingEntry: CacheEntry) => Promise<CacheEntry>, overwrite?: boolean): Promise<void>;
|
|
144
|
-
isDocsMdx(absolutePath: Path): boolean;
|
|
143
|
+
updateExtracted(updater: (specifier: NormalizedStoriesSpecifier, absolutePath: Path$1, existingEntry: CacheEntry) => Promise<CacheEntry>, overwrite?: boolean): Promise<void>;
|
|
144
|
+
isDocsMdx(absolutePath: Path$1): boolean;
|
|
145
145
|
ensureExtracted({ projectTags, }: {
|
|
146
146
|
projectTags?: Tag[];
|
|
147
147
|
}): Promise<{
|
|
148
148
|
entries: (IndexEntry | ErrorEntry)[];
|
|
149
149
|
stats: IndexStatsSummary;
|
|
150
150
|
}>;
|
|
151
|
-
findDependencies(absoluteImports: Path[]): StoriesCacheEntry[];
|
|
151
|
+
findDependencies(absoluteImports: Path$1[]): StoriesCacheEntry[];
|
|
152
152
|
/**
|
|
153
153
|
* Try to find the component path from a raw import string and return it in the same format as
|
|
154
154
|
* `importPath`. Respect tsconfig paths if available.
|
|
155
155
|
*
|
|
156
156
|
* If no such file exists, assume that the import is from a package and return the raw
|
|
157
157
|
*/
|
|
158
|
-
resolveComponentPath(rawComponentPath: Path, absolutePath: Path, matchPath: MatchPath | undefined): string;
|
|
159
|
-
extractStories(specifier: NormalizedStoriesSpecifier, absolutePath: Path, projectTags?: Tag[]): Promise<StoriesCacheEntry | DocsCacheEntry>;
|
|
160
|
-
extractDocs(specifier: NormalizedStoriesSpecifier, absolutePath: Path, projectTags?: Tag[]): Promise<false | DocsIndexEntry>;
|
|
158
|
+
resolveComponentPath(rawComponentPath: Path$1, absolutePath: Path$1, matchPath: MatchPath | undefined): string;
|
|
159
|
+
extractStories(specifier: NormalizedStoriesSpecifier, absolutePath: Path$1, projectTags?: Tag[]): Promise<StoriesCacheEntry | DocsCacheEntry>;
|
|
160
|
+
extractDocs(specifier: NormalizedStoriesSpecifier, absolutePath: Path$1, projectTags?: Tag[]): Promise<false | DocsIndexEntry>;
|
|
161
161
|
chooseDuplicate(firstEntry: IndexEntry, secondEntry: IndexEntry, projectTags: Tag[]): IndexEntry;
|
|
162
162
|
sortStories(entries: StoryIndex['entries'], storySortParameter: any): Promise<Record<string, IndexEntry>>;
|
|
163
163
|
getIndex(): Promise<StoryIndex>;
|
|
@@ -166,7 +166,7 @@ declare class StoryIndexGenerator {
|
|
|
166
166
|
stats: IndexStatsSummary;
|
|
167
167
|
}>;
|
|
168
168
|
invalidateAll(): void;
|
|
169
|
-
invalidate(specifier: NormalizedStoriesSpecifier, importPath: Path, removed: boolean): void;
|
|
169
|
+
invalidate(specifier: NormalizedStoriesSpecifier, importPath: Path$1, removed: boolean): void;
|
|
170
170
|
getPreviewCode(): Promise<string | undefined>;
|
|
171
171
|
getProjectTags(previewCode?: string): string[];
|
|
172
172
|
static storyFileNames(specifierToCache: Map<NormalizedStoriesSpecifier, SpecifierStoriesCache>): string[];
|
|
@@ -469,6 +469,507 @@ declare class MockUniversalStore<State, CustomEvent extends {
|
|
|
469
469
|
unsubscribeAll(): void;
|
|
470
470
|
}
|
|
471
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Actions represent the type of change to a location value.
|
|
474
|
+
*/
|
|
475
|
+
declare enum Action {
|
|
476
|
+
/**
|
|
477
|
+
* A POP indicates a change to an arbitrary index in the history stack, such
|
|
478
|
+
* as a back or forward navigation. It does not describe the direction of the
|
|
479
|
+
* navigation, only that the current index changed.
|
|
480
|
+
*
|
|
481
|
+
* Note: This is the default action for newly created history objects.
|
|
482
|
+
*/
|
|
483
|
+
Pop = "POP",
|
|
484
|
+
/**
|
|
485
|
+
* A PUSH indicates a new entry being added to the history stack, such as when
|
|
486
|
+
* a link is clicked and a new page loads. When this happens, all subsequent
|
|
487
|
+
* entries in the stack are lost.
|
|
488
|
+
*/
|
|
489
|
+
Push = "PUSH",
|
|
490
|
+
/**
|
|
491
|
+
* A REPLACE indicates the entry at the current index in the history stack
|
|
492
|
+
* being replaced by a new one.
|
|
493
|
+
*/
|
|
494
|
+
Replace = "REPLACE"
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* The pathname, search, and hash values of a URL.
|
|
498
|
+
*/
|
|
499
|
+
interface Path {
|
|
500
|
+
/**
|
|
501
|
+
* A URL pathname, beginning with a /.
|
|
502
|
+
*/
|
|
503
|
+
pathname: string;
|
|
504
|
+
/**
|
|
505
|
+
* A URL search string, beginning with a ?.
|
|
506
|
+
*/
|
|
507
|
+
search: string;
|
|
508
|
+
/**
|
|
509
|
+
* A URL fragment identifier, beginning with a #.
|
|
510
|
+
*/
|
|
511
|
+
hash: string;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* An entry in a history stack. A location contains information about the
|
|
515
|
+
* URL path, as well as possibly some arbitrary state and a key.
|
|
516
|
+
*/
|
|
517
|
+
interface Location extends Path {
|
|
518
|
+
/**
|
|
519
|
+
* A value of arbitrary data associated with this location.
|
|
520
|
+
*/
|
|
521
|
+
state: any;
|
|
522
|
+
/**
|
|
523
|
+
* A unique string associated with this location. May be used to safely store
|
|
524
|
+
* and retrieve data in some other storage API, like `localStorage`.
|
|
525
|
+
*
|
|
526
|
+
* Note: This value is always "default" on the initial location.
|
|
527
|
+
*/
|
|
528
|
+
key: string;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Map of routeId -> data returned from a loader/action/error
|
|
533
|
+
*/
|
|
534
|
+
interface RouteData {
|
|
535
|
+
[routeId: string]: any;
|
|
536
|
+
}
|
|
537
|
+
declare enum ResultType {
|
|
538
|
+
data = "data",
|
|
539
|
+
deferred = "deferred",
|
|
540
|
+
redirect = "redirect",
|
|
541
|
+
error = "error"
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Successful result from a loader or action
|
|
545
|
+
*/
|
|
546
|
+
interface SuccessResult {
|
|
547
|
+
type: ResultType.data;
|
|
548
|
+
data: any;
|
|
549
|
+
statusCode?: number;
|
|
550
|
+
headers?: Headers;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Successful defer() result from a loader or action
|
|
554
|
+
*/
|
|
555
|
+
interface DeferredResult {
|
|
556
|
+
type: ResultType.deferred;
|
|
557
|
+
deferredData: DeferredData;
|
|
558
|
+
statusCode?: number;
|
|
559
|
+
headers?: Headers;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Redirect result from a loader or action
|
|
563
|
+
*/
|
|
564
|
+
interface RedirectResult {
|
|
565
|
+
type: ResultType.redirect;
|
|
566
|
+
status: number;
|
|
567
|
+
location: string;
|
|
568
|
+
revalidate: boolean;
|
|
569
|
+
reloadDocument?: boolean;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Unsuccessful result from a loader or action
|
|
573
|
+
*/
|
|
574
|
+
interface ErrorResult {
|
|
575
|
+
type: ResultType.error;
|
|
576
|
+
error: any;
|
|
577
|
+
headers?: Headers;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Result from a loader or action - potentially successful or unsuccessful
|
|
581
|
+
*/
|
|
582
|
+
type DataResult = SuccessResult | DeferredResult | RedirectResult | ErrorResult;
|
|
583
|
+
type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
|
|
584
|
+
type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
|
|
585
|
+
/**
|
|
586
|
+
* Active navigation/fetcher form methods are exposed in lowercase on the
|
|
587
|
+
* RouterState
|
|
588
|
+
*/
|
|
589
|
+
type FormMethod = LowerCaseFormMethod;
|
|
590
|
+
/**
|
|
591
|
+
* In v7, active navigation/fetcher form methods are exposed in uppercase on the
|
|
592
|
+
* RouterState. This is to align with the normalization done via fetch().
|
|
593
|
+
*/
|
|
594
|
+
type V7_FormMethod = UpperCaseFormMethod;
|
|
595
|
+
type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain";
|
|
596
|
+
type JsonObject = {
|
|
597
|
+
[Key in string]: JsonValue;
|
|
598
|
+
} & {
|
|
599
|
+
[Key in string]?: JsonValue | undefined;
|
|
600
|
+
};
|
|
601
|
+
type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
602
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
603
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
604
|
+
/**
|
|
605
|
+
* @private
|
|
606
|
+
* Internal interface to pass around for action submissions, not intended for
|
|
607
|
+
* external consumption
|
|
608
|
+
*/
|
|
609
|
+
type Submission = {
|
|
610
|
+
formMethod: FormMethod | V7_FormMethod;
|
|
611
|
+
formAction: string;
|
|
612
|
+
formEncType: FormEncType;
|
|
613
|
+
formData: FormData;
|
|
614
|
+
json: undefined;
|
|
615
|
+
text: undefined;
|
|
616
|
+
} | {
|
|
617
|
+
formMethod: FormMethod | V7_FormMethod;
|
|
618
|
+
formAction: string;
|
|
619
|
+
formEncType: FormEncType;
|
|
620
|
+
formData: undefined;
|
|
621
|
+
json: JsonValue;
|
|
622
|
+
text: undefined;
|
|
623
|
+
} | {
|
|
624
|
+
formMethod: FormMethod | V7_FormMethod;
|
|
625
|
+
formAction: string;
|
|
626
|
+
formEncType: FormEncType;
|
|
627
|
+
formData: undefined;
|
|
628
|
+
json: undefined;
|
|
629
|
+
text: string;
|
|
630
|
+
};
|
|
631
|
+
/**
|
|
632
|
+
* @private
|
|
633
|
+
* Arguments passed to route loader/action functions. Same for now but we keep
|
|
634
|
+
* this as a private implementation detail in case they diverge in the future.
|
|
635
|
+
*/
|
|
636
|
+
interface DataFunctionArgs {
|
|
637
|
+
request: Request;
|
|
638
|
+
params: Params;
|
|
639
|
+
context?: any;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Arguments passed to loader functions
|
|
643
|
+
*/
|
|
644
|
+
interface LoaderFunctionArgs extends DataFunctionArgs {
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Arguments passed to action functions
|
|
648
|
+
*/
|
|
649
|
+
interface ActionFunctionArgs extends DataFunctionArgs {
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Loaders and actions can return anything except `undefined` (`null` is a
|
|
653
|
+
* valid return value if there is no data to return). Responses are preferred
|
|
654
|
+
* and will ease any future migration to Remix
|
|
655
|
+
*/
|
|
656
|
+
type DataFunctionValue = Response | NonNullable<unknown> | null;
|
|
657
|
+
/**
|
|
658
|
+
* Route loader function signature
|
|
659
|
+
*/
|
|
660
|
+
interface LoaderFunction {
|
|
661
|
+
(args: LoaderFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Route action function signature
|
|
665
|
+
*/
|
|
666
|
+
interface ActionFunction {
|
|
667
|
+
(args: ActionFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Route shouldRevalidate function signature. This runs after any submission
|
|
671
|
+
* (navigation or fetcher), so we flatten the navigation/fetcher submission
|
|
672
|
+
* onto the arguments. It shouldn't matter whether it came from a navigation
|
|
673
|
+
* or a fetcher, what really matters is the URLs and the formData since loaders
|
|
674
|
+
* have to re-run based on the data models that were potentially mutated.
|
|
675
|
+
*/
|
|
676
|
+
interface ShouldRevalidateFunction {
|
|
677
|
+
(args: {
|
|
678
|
+
currentUrl: URL;
|
|
679
|
+
currentParams: AgnosticDataRouteMatch["params"];
|
|
680
|
+
nextUrl: URL;
|
|
681
|
+
nextParams: AgnosticDataRouteMatch["params"];
|
|
682
|
+
formMethod?: Submission["formMethod"];
|
|
683
|
+
formAction?: Submission["formAction"];
|
|
684
|
+
formEncType?: Submission["formEncType"];
|
|
685
|
+
text?: Submission["text"];
|
|
686
|
+
formData?: Submission["formData"];
|
|
687
|
+
json?: Submission["json"];
|
|
688
|
+
actionResult?: DataResult;
|
|
689
|
+
defaultShouldRevalidate: boolean;
|
|
690
|
+
}): boolean;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Keys we cannot change from within a lazy() function. We spread all other keys
|
|
694
|
+
* onto the route. Either they're meaningful to the router, or they'll get
|
|
695
|
+
* ignored.
|
|
696
|
+
*/
|
|
697
|
+
type ImmutableRouteKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
|
|
698
|
+
type RequireOne<T, Key = keyof T> = Exclude<{
|
|
699
|
+
[K in keyof T]: K extends Key ? Omit<T, K> & Required<Pick<T, K>> : never;
|
|
700
|
+
}[keyof T], undefined>;
|
|
701
|
+
/**
|
|
702
|
+
* lazy() function to load a route definition, which can add non-matching
|
|
703
|
+
* related properties to a route
|
|
704
|
+
*/
|
|
705
|
+
interface LazyRouteFunction<R extends AgnosticRouteObject> {
|
|
706
|
+
(): Promise<RequireOne<Omit<R, ImmutableRouteKey>>>;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Base RouteObject with common props shared by all types of routes
|
|
710
|
+
*/
|
|
711
|
+
type AgnosticBaseRouteObject = {
|
|
712
|
+
caseSensitive?: boolean;
|
|
713
|
+
path?: string;
|
|
714
|
+
id?: string;
|
|
715
|
+
loader?: LoaderFunction;
|
|
716
|
+
action?: ActionFunction;
|
|
717
|
+
hasErrorBoundary?: boolean;
|
|
718
|
+
shouldRevalidate?: ShouldRevalidateFunction;
|
|
719
|
+
handle?: any;
|
|
720
|
+
lazy?: LazyRouteFunction<AgnosticBaseRouteObject>;
|
|
721
|
+
};
|
|
722
|
+
/**
|
|
723
|
+
* Index routes must not have children
|
|
724
|
+
*/
|
|
725
|
+
type AgnosticIndexRouteObject = AgnosticBaseRouteObject & {
|
|
726
|
+
children?: undefined;
|
|
727
|
+
index: true;
|
|
728
|
+
};
|
|
729
|
+
/**
|
|
730
|
+
* Non-index routes may have children, but cannot have index
|
|
731
|
+
*/
|
|
732
|
+
type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & {
|
|
733
|
+
children?: AgnosticRouteObject[];
|
|
734
|
+
index?: false;
|
|
735
|
+
};
|
|
736
|
+
/**
|
|
737
|
+
* A route object represents a logical route, with (optionally) its child
|
|
738
|
+
* routes organized in a tree-like structure.
|
|
739
|
+
*/
|
|
740
|
+
type AgnosticRouteObject = AgnosticIndexRouteObject | AgnosticNonIndexRouteObject;
|
|
741
|
+
type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & {
|
|
742
|
+
id: string;
|
|
743
|
+
};
|
|
744
|
+
type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
|
|
745
|
+
children?: AgnosticDataRouteObject[];
|
|
746
|
+
id: string;
|
|
747
|
+
};
|
|
748
|
+
/**
|
|
749
|
+
* A data route object, which is just a RouteObject with a required unique ID
|
|
750
|
+
*/
|
|
751
|
+
type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject;
|
|
752
|
+
/**
|
|
753
|
+
* The parameters that were parsed from the URL path.
|
|
754
|
+
*/
|
|
755
|
+
type Params<Key extends string = string> = {
|
|
756
|
+
readonly [key in Key]: string | undefined;
|
|
757
|
+
};
|
|
758
|
+
/**
|
|
759
|
+
* A RouteMatch contains info about how a route matched a URL.
|
|
760
|
+
*/
|
|
761
|
+
interface AgnosticRouteMatch<ParamKey extends string = string, RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject> {
|
|
762
|
+
/**
|
|
763
|
+
* The names and values of dynamic parameters in the URL.
|
|
764
|
+
*/
|
|
765
|
+
params: Params<ParamKey>;
|
|
766
|
+
/**
|
|
767
|
+
* The portion of the URL pathname that was matched.
|
|
768
|
+
*/
|
|
769
|
+
pathname: string;
|
|
770
|
+
/**
|
|
771
|
+
* The portion of the URL pathname that was matched before child routes.
|
|
772
|
+
*/
|
|
773
|
+
pathnameBase: string;
|
|
774
|
+
/**
|
|
775
|
+
* The route object that was used to match.
|
|
776
|
+
*/
|
|
777
|
+
route: RouteObjectType;
|
|
778
|
+
}
|
|
779
|
+
interface AgnosticDataRouteMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
|
|
780
|
+
}
|
|
781
|
+
declare class DeferredData {
|
|
782
|
+
private pendingKeysSet;
|
|
783
|
+
private controller;
|
|
784
|
+
private abortPromise;
|
|
785
|
+
private unlistenAbortSignal;
|
|
786
|
+
private subscribers;
|
|
787
|
+
data: Record<string, unknown>;
|
|
788
|
+
init?: ResponseInit;
|
|
789
|
+
deferredKeys: string[];
|
|
790
|
+
constructor(data: Record<string, unknown>, responseInit?: ResponseInit);
|
|
791
|
+
private trackPromise;
|
|
792
|
+
private onSettle;
|
|
793
|
+
private emit;
|
|
794
|
+
subscribe(fn: (aborted: boolean, settledKey?: string) => void): () => boolean;
|
|
795
|
+
cancel(): void;
|
|
796
|
+
resolveData(signal: AbortSignal): Promise<boolean>;
|
|
797
|
+
get done(): boolean;
|
|
798
|
+
get unwrappedData(): {};
|
|
799
|
+
get pendingKeys(): string[];
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* State maintained internally by the router. During a navigation, all states
|
|
804
|
+
* reflect the the "old" location unless otherwise noted.
|
|
805
|
+
*/
|
|
806
|
+
interface RouterState {
|
|
807
|
+
/**
|
|
808
|
+
* The action of the most recent navigation
|
|
809
|
+
*/
|
|
810
|
+
historyAction: Action;
|
|
811
|
+
/**
|
|
812
|
+
* The current location reflected by the router
|
|
813
|
+
*/
|
|
814
|
+
location: Location;
|
|
815
|
+
/**
|
|
816
|
+
* The current set of route matches
|
|
817
|
+
*/
|
|
818
|
+
matches: AgnosticDataRouteMatch[];
|
|
819
|
+
/**
|
|
820
|
+
* Tracks whether we've completed our initial data load
|
|
821
|
+
*/
|
|
822
|
+
initialized: boolean;
|
|
823
|
+
/**
|
|
824
|
+
* Current scroll position we should start at for a new view
|
|
825
|
+
* - number -> scroll position to restore to
|
|
826
|
+
* - false -> do not restore scroll at all (used during submissions)
|
|
827
|
+
* - null -> don't have a saved position, scroll to hash or top of page
|
|
828
|
+
*/
|
|
829
|
+
restoreScrollPosition: number | false | null;
|
|
830
|
+
/**
|
|
831
|
+
* Indicate whether this navigation should skip resetting the scroll position
|
|
832
|
+
* if we are unable to restore the scroll position
|
|
833
|
+
*/
|
|
834
|
+
preventScrollReset: boolean;
|
|
835
|
+
/**
|
|
836
|
+
* Tracks the state of the current navigation
|
|
837
|
+
*/
|
|
838
|
+
navigation: Navigation;
|
|
839
|
+
/**
|
|
840
|
+
* Tracks any in-progress revalidations
|
|
841
|
+
*/
|
|
842
|
+
revalidation: RevalidationState;
|
|
843
|
+
/**
|
|
844
|
+
* Data from the loaders for the current matches
|
|
845
|
+
*/
|
|
846
|
+
loaderData: RouteData;
|
|
847
|
+
/**
|
|
848
|
+
* Data from the action for the current matches
|
|
849
|
+
*/
|
|
850
|
+
actionData: RouteData | null;
|
|
851
|
+
/**
|
|
852
|
+
* Errors caught from loaders for the current matches
|
|
853
|
+
*/
|
|
854
|
+
errors: RouteData | null;
|
|
855
|
+
/**
|
|
856
|
+
* Map of current fetchers
|
|
857
|
+
*/
|
|
858
|
+
fetchers: Map<string, Fetcher>;
|
|
859
|
+
/**
|
|
860
|
+
* Map of current blockers
|
|
861
|
+
*/
|
|
862
|
+
blockers: Map<string, Blocker>;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Data that can be passed into hydrate a Router from SSR
|
|
866
|
+
*/
|
|
867
|
+
type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
|
|
868
|
+
/**
|
|
869
|
+
* Potential states for state.navigation
|
|
870
|
+
*/
|
|
871
|
+
type NavigationStates = {
|
|
872
|
+
Idle: {
|
|
873
|
+
state: "idle";
|
|
874
|
+
location: undefined;
|
|
875
|
+
formMethod: undefined;
|
|
876
|
+
formAction: undefined;
|
|
877
|
+
formEncType: undefined;
|
|
878
|
+
formData: undefined;
|
|
879
|
+
json: undefined;
|
|
880
|
+
text: undefined;
|
|
881
|
+
};
|
|
882
|
+
Loading: {
|
|
883
|
+
state: "loading";
|
|
884
|
+
location: Location;
|
|
885
|
+
formMethod: Submission["formMethod"] | undefined;
|
|
886
|
+
formAction: Submission["formAction"] | undefined;
|
|
887
|
+
formEncType: Submission["formEncType"] | undefined;
|
|
888
|
+
formData: Submission["formData"] | undefined;
|
|
889
|
+
json: Submission["json"] | undefined;
|
|
890
|
+
text: Submission["text"] | undefined;
|
|
891
|
+
};
|
|
892
|
+
Submitting: {
|
|
893
|
+
state: "submitting";
|
|
894
|
+
location: Location;
|
|
895
|
+
formMethod: Submission["formMethod"];
|
|
896
|
+
formAction: Submission["formAction"];
|
|
897
|
+
formEncType: Submission["formEncType"];
|
|
898
|
+
formData: Submission["formData"];
|
|
899
|
+
json: Submission["json"];
|
|
900
|
+
text: Submission["text"];
|
|
901
|
+
};
|
|
902
|
+
};
|
|
903
|
+
type Navigation = NavigationStates[keyof NavigationStates];
|
|
904
|
+
type RevalidationState = "idle" | "loading";
|
|
905
|
+
/**
|
|
906
|
+
* Potential states for fetchers
|
|
907
|
+
*/
|
|
908
|
+
type FetcherStates<TData = any> = {
|
|
909
|
+
Idle: {
|
|
910
|
+
state: "idle";
|
|
911
|
+
formMethod: undefined;
|
|
912
|
+
formAction: undefined;
|
|
913
|
+
formEncType: undefined;
|
|
914
|
+
text: undefined;
|
|
915
|
+
formData: undefined;
|
|
916
|
+
json: undefined;
|
|
917
|
+
data: TData | undefined;
|
|
918
|
+
" _hasFetcherDoneAnything "?: boolean;
|
|
919
|
+
};
|
|
920
|
+
Loading: {
|
|
921
|
+
state: "loading";
|
|
922
|
+
formMethod: Submission["formMethod"] | undefined;
|
|
923
|
+
formAction: Submission["formAction"] | undefined;
|
|
924
|
+
formEncType: Submission["formEncType"] | undefined;
|
|
925
|
+
text: Submission["text"] | undefined;
|
|
926
|
+
formData: Submission["formData"] | undefined;
|
|
927
|
+
json: Submission["json"] | undefined;
|
|
928
|
+
data: TData | undefined;
|
|
929
|
+
" _hasFetcherDoneAnything "?: boolean;
|
|
930
|
+
};
|
|
931
|
+
Submitting: {
|
|
932
|
+
state: "submitting";
|
|
933
|
+
formMethod: Submission["formMethod"];
|
|
934
|
+
formAction: Submission["formAction"];
|
|
935
|
+
formEncType: Submission["formEncType"];
|
|
936
|
+
text: Submission["text"];
|
|
937
|
+
formData: Submission["formData"];
|
|
938
|
+
json: Submission["json"];
|
|
939
|
+
data: TData | undefined;
|
|
940
|
+
" _hasFetcherDoneAnything "?: boolean;
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
|
|
944
|
+
interface BlockerBlocked {
|
|
945
|
+
state: "blocked";
|
|
946
|
+
reset(): void;
|
|
947
|
+
proceed(): void;
|
|
948
|
+
location: Location;
|
|
949
|
+
}
|
|
950
|
+
interface BlockerUnblocked {
|
|
951
|
+
state: "unblocked";
|
|
952
|
+
reset: undefined;
|
|
953
|
+
proceed: undefined;
|
|
954
|
+
location: undefined;
|
|
955
|
+
}
|
|
956
|
+
interface BlockerProceeding {
|
|
957
|
+
state: "proceeding";
|
|
958
|
+
reset: undefined;
|
|
959
|
+
proceed: undefined;
|
|
960
|
+
location: Location;
|
|
961
|
+
}
|
|
962
|
+
type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* NOTE: If you refactor this to split up the modules into separate files,
|
|
966
|
+
* you'll need to update the rollup config for react-router-dom-v5-compat.
|
|
967
|
+
*/
|
|
968
|
+
|
|
969
|
+
declare global {
|
|
970
|
+
var __staticRouterHydrationData: HydrationState | undefined;
|
|
971
|
+
}
|
|
972
|
+
|
|
472
973
|
type TestProviderState = 'test-provider-state:pending' | 'test-provider-state:running' | 'test-provider-state:succeeded' | 'test-provider-state:crashed';
|
|
473
974
|
type TestProviderId = string;
|
|
474
975
|
type TestProviderStateByProviderId = Record<TestProviderId, TestProviderState>;
|