storybook 9.0.0-alpha.1 → 9.0.0-alpha.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/README.md +31 -29
- package/assets/browser/favicon.svg +1 -0
- package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-bold.woff2 +0 -0
- package/assets/browser/nunito-sans-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-regular.woff2 +0 -0
- package/assets/docs/addon-controls-args-annotated.png +0 -0
- package/assets/docs/addon-controls-args-background-color.png +0 -0
- package/assets/docs/addon-controls-args-background-string.png +0 -0
- package/assets/docs/addon-controls-args-docs.png +0 -0
- package/assets/docs/addon-controls-args-logging.png +0 -0
- package/assets/docs/addon-controls-args-no-annotation.png +0 -0
- package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
- package/assets/docs/addon-controls-args-reflow.png +0 -0
- package/assets/docs/addon-controls-args-template.png +0 -0
- package/assets/docs/addon-controls-expanded.png +0 -0
- package/assets/docs/addon-controls-hero.gif +0 -0
- package/assets/docs/addon-controls-install.png +0 -0
- package/assets/docs/hero.gif +0 -0
- package/assets/docs/message-reference.png +0 -0
- package/assets/docs/viewport.png +0 -0
- package/assets/server/addon.tsconfig.json +6 -0
- package/assets/server/base-preview-body.html +119 -0
- package/assets/server/base-preview-head.html +451 -0
- package/assets/server/template.ejs +87 -0
- package/bin/index.cjs +1 -1
- package/dist/actions/decorator.d.ts +6 -0
- package/dist/actions/decorator.js +139 -0
- package/dist/actions/index.cjs +127 -0
- package/dist/actions/index.d.ts +105 -0
- package/dist/actions/index.js +112 -0
- package/dist/actions/manager.js +1196 -0
- package/dist/actions/preview.cjs +165 -0
- package/dist/actions/preview.d.ts +55 -0
- package/dist/actions/preview.js +156 -0
- package/dist/babel/index.cjs +54034 -0
- package/dist/babel/index.d.ts +7488 -0
- package/dist/babel/index.js +54044 -0
- package/dist/bin/index.cjs +119 -0
- package/dist/bin/index.js +113 -0
- package/dist/builder-manager/index.cjs +2140 -0
- package/dist/builder-manager/index.d.ts +19 -0
- package/dist/builder-manager/index.js +2162 -0
- package/dist/channels/index.cjs +1913 -0
- package/dist/channels/index.d.ts +108 -0
- package/dist/channels/index.js +1881 -0
- package/dist/cli/bin/index.cjs +2687 -0
- package/dist/cli/bin/index.d.ts +2 -0
- package/dist/cli/bin/index.js +2707 -0
- package/dist/cli/index.cjs +17327 -0
- package/dist/cli/index.d.ts +209 -0
- package/dist/cli/index.js +17349 -0
- package/dist/client-logger/index.cjs +80 -0
- package/dist/client-logger/index.d.ts +29 -0
- package/dist/client-logger/index.js +64 -0
- package/dist/common/index.cjs +20569 -0
- package/dist/common/index.d.ts +949 -0
- package/dist/common/index.js +20654 -0
- package/dist/components/index.cjs +27924 -0
- package/dist/components/index.d.ts +1423 -0
- package/dist/components/index.js +24673 -0
- package/dist/controls/decorator.d.ts +5 -0
- package/dist/controls/decorator.js +8 -0
- package/dist/controls/index.cjs +26 -0
- package/dist/controls/index.d.ts +39 -0
- package/dist/controls/index.js +6 -0
- package/dist/controls/manager.js +5545 -0
- package/dist/controls/preview.cjs +26 -0
- package/dist/controls/preview.d.ts +55 -0
- package/dist/controls/preview.js +9 -0
- package/dist/core-events/index.cjs +167 -0
- package/dist/core-events/index.d.ts +426 -0
- package/dist/core-events/index.js +149 -0
- package/dist/core-server/index.cjs +38183 -0
- package/dist/core-server/index.d.ts +720 -0
- package/dist/core-server/index.js +38272 -0
- package/dist/core-server/presets/common-manager.js +20 -0
- package/dist/core-server/presets/common-override-preset.cjs +4824 -0
- package/dist/core-server/presets/common-override-preset.js +4829 -0
- package/dist/core-server/presets/common-preset.cjs +10231 -0
- package/dist/core-server/presets/common-preset.js +10309 -0
- package/dist/csf/index.cjs +179 -0
- package/dist/csf/index.d.ts +750 -0
- package/dist/csf/index.js +172 -0
- package/dist/csf-tools/index.cjs +1422 -0
- package/dist/csf-tools/index.d.ts +250 -0
- package/dist/csf-tools/index.js +1439 -0
- package/dist/docs-tools/index.cjs +2891 -0
- package/dist/docs-tools/index.d.ts +162 -0
- package/dist/docs-tools/index.js +2876 -0
- package/dist/index.cjs +17 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -7
- package/dist/instrumenter/index.cjs +3485 -0
- package/dist/instrumenter/index.d.ts +104 -0
- package/dist/instrumenter/index.js +4965 -0
- package/dist/manager/globals-module-info.cjs +817 -0
- package/dist/manager/globals-module-info.d.ts +36 -0
- package/dist/manager/globals-module-info.js +804 -0
- package/dist/manager/globals-runtime.js +77536 -0
- package/dist/manager/globals.cjs +47 -0
- package/dist/manager/globals.d.ts +24 -0
- package/dist/manager/globals.js +34 -0
- package/dist/manager/runtime.js +12323 -0
- package/dist/manager-api/index.cjs +11074 -0
- package/dist/manager-api/index.d.ts +1512 -0
- package/dist/manager-api/index.js +4835 -0
- package/dist/manager-errors.d.ts +89 -0
- package/dist/manager-errors.js +99 -0
- package/dist/node-logger/index.cjs +1642 -0
- package/dist/node-logger/index.d.ts +117 -0
- package/dist/node-logger/index.js +1652 -0
- package/dist/preview/globals.cjs +38 -0
- package/dist/preview/globals.d.ts +15 -0
- package/dist/preview/globals.js +25 -0
- package/dist/preview/runtime.js +43629 -0
- package/dist/preview-api/index.cjs +5224 -0
- package/dist/preview-api/index.d.ts +1093 -0
- package/dist/preview-api/index.js +5292 -0
- package/dist/preview-errors.cjs +503 -0
- package/dist/preview-errors.d.ts +212 -0
- package/dist/preview-errors.js +449 -0
- package/dist/router/index.cjs +3296 -0
- package/dist/router/index.d.ts +385 -0
- package/dist/router/index.js +1843 -0
- package/dist/server-errors.cjs +727 -0
- package/dist/server-errors.d.ts +296 -0
- package/dist/server-errors.js +728 -0
- package/dist/telemetry/index.cjs +2756 -0
- package/dist/telemetry/index.d.ts +133 -0
- package/dist/telemetry/index.js +2797 -0
- package/dist/test/index.cjs +35685 -0
- package/dist/test/index.d.ts +186 -0
- package/dist/test/index.js +33751 -0
- package/dist/test/preview.cjs +15869 -0
- package/dist/test/preview.d.ts +54 -0
- package/dist/test/preview.js +14440 -0
- package/dist/test/spy.cjs +257 -0
- package/dist/test/spy.d.ts +66 -0
- package/dist/test/spy.js +239 -0
- package/dist/theming/create.cjs +232 -0
- package/dist/theming/create.d.ts +50 -0
- package/dist/theming/create.js +216 -0
- package/dist/theming/index.cjs +2665 -0
- package/dist/theming/index.d.ts +11939 -0
- package/dist/theming/index.js +2485 -0
- package/dist/types/index.cjs +27 -0
- package/dist/types/index.d.ts +2795 -0
- package/dist/types/index.js +7 -0
- package/dist/viewport/index.cjs +310 -0
- package/dist/viewport/index.d.ts +320 -0
- package/dist/viewport/index.js +290 -0
- package/dist/viewport/manager.js +400 -0
- package/dist/viewport/preview.cjs +35 -0
- package/dist/viewport/preview.d.ts +69 -0
- package/dist/viewport/preview.js +19 -0
- package/package.json +518 -209
- package/.eslintrc.cjs +0 -31
- package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
- package/core/babel/index.cjs +0 -1
- package/core/babel/index.d.ts +0 -2
- package/core/babel/index.js +0 -1
- package/core/builder-manager/index.cjs +0 -1
- package/core/builder-manager/index.d.ts +0 -2
- package/core/builder-manager/index.js +0 -1
- package/core/channels/index.cjs +0 -1
- package/core/channels/index.d.ts +0 -2
- package/core/channels/index.js +0 -1
- package/core/cli/bin/index.cjs +0 -1
- package/core/cli/bin/index.d.ts +0 -2
- package/core/cli/bin/index.js +0 -1
- package/core/cli/index.cjs +0 -1
- package/core/cli/index.d.ts +0 -2
- package/core/cli/index.js +0 -1
- package/core/client-logger/index.cjs +0 -1
- package/core/client-logger/index.d.ts +0 -2
- package/core/client-logger/index.js +0 -1
- package/core/common/index.cjs +0 -1
- package/core/common/index.d.ts +0 -2
- package/core/common/index.js +0 -1
- package/core/components/index.cjs +0 -1
- package/core/components/index.d.ts +0 -2
- package/core/components/index.js +0 -1
- package/core/core-events/index.cjs +0 -1
- package/core/core-events/index.d.ts +0 -2
- package/core/core-events/index.js +0 -1
- package/core/core-server/index.cjs +0 -1
- package/core/core-server/index.d.ts +0 -2
- package/core/core-server/index.js +0 -1
- package/core/core-server/presets/common-manager.js +0 -1
- package/core/core-server/presets/common-override-preset.cjs +0 -1
- package/core/core-server/presets/common-override-preset.js +0 -1
- package/core/core-server/presets/common-preset.cjs +0 -1
- package/core/core-server/presets/common-preset.js +0 -1
- package/core/csf/index.cjs +0 -1
- package/core/csf/index.d.ts +0 -2
- package/core/csf/index.js +0 -1
- package/core/csf-tools/index.cjs +0 -1
- package/core/csf-tools/index.d.ts +0 -2
- package/core/csf-tools/index.js +0 -1
- package/core/docs-tools/index.cjs +0 -1
- package/core/docs-tools/index.d.ts +0 -2
- package/core/docs-tools/index.js +0 -1
- package/core/index.cjs +0 -1
- package/core/index.d.ts +0 -2
- package/core/index.js +0 -1
- package/core/manager/globals-module-info.cjs +0 -1
- package/core/manager/globals-module-info.d.ts +0 -2
- package/core/manager/globals-module-info.js +0 -1
- package/core/manager/globals-runtime.js +0 -1
- package/core/manager/globals.cjs +0 -1
- package/core/manager/globals.d.ts +0 -2
- package/core/manager/globals.js +0 -1
- package/core/manager-api/index.cjs +0 -1
- package/core/manager-api/index.d.ts +0 -2
- package/core/manager-api/index.js +0 -1
- package/core/manager-errors.d.ts +0 -2
- package/core/manager-errors.js +0 -1
- package/core/node-logger/index.cjs +0 -1
- package/core/node-logger/index.d.ts +0 -2
- package/core/node-logger/index.js +0 -1
- package/core/preview/globals.cjs +0 -1
- package/core/preview/globals.d.ts +0 -2
- package/core/preview/globals.js +0 -1
- package/core/preview/runtime.js +0 -1
- package/core/preview-api/index.cjs +0 -1
- package/core/preview-api/index.d.ts +0 -2
- package/core/preview-api/index.js +0 -1
- package/core/preview-errors.cjs +0 -1
- package/core/preview-errors.d.ts +0 -2
- package/core/preview-errors.js +0 -1
- package/core/router/index.cjs +0 -1
- package/core/router/index.d.ts +0 -2
- package/core/router/index.js +0 -1
- package/core/server-errors.cjs +0 -1
- package/core/server-errors.d.ts +0 -2
- package/core/server-errors.js +0 -1
- package/core/telemetry/index.cjs +0 -1
- package/core/telemetry/index.d.ts +0 -2
- package/core/telemetry/index.js +0 -1
- package/core/theming/create.cjs +0 -1
- package/core/theming/create.d.ts +0 -2
- package/core/theming/create.js +0 -1
- package/core/theming/index.cjs +0 -1
- package/core/theming/index.d.ts +0 -2
- package/core/theming/index.js +0 -1
- package/core/types/index.cjs +0 -1
- package/core/types/index.d.ts +0 -2
- package/core/types/index.js +0 -1
- package/core.cjs +0 -0
- package/core.d.ts +0 -0
- package/core.js +0 -1
- package/dist/chunk-OWLSIX54.js +0 -8
- package/dist/core-path.cjs +0 -1
- package/dist/core-path.d.ts +0 -3
- package/dist/core-path.js +0 -9
- package/dist/proxy.cjs +0 -1
- package/dist/proxy.d.ts +0 -2
- package/dist/proxy.js +0 -9
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ReactNode, ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
interface StoryData {
|
|
5
|
+
viewMode?: string;
|
|
6
|
+
storyId?: string;
|
|
7
|
+
refId?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const parsePath: (path: string | undefined) => StoryData;
|
|
10
|
+
interface Args {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
declare const DEEPLY_EQUAL: unique symbol;
|
|
14
|
+
declare const deepDiff: (value: any, update: any) => any;
|
|
15
|
+
declare const buildArgsParam: (initialArgs: Args | undefined, args: Args) => string;
|
|
16
|
+
interface Query {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
declare const queryFromLocation: (location: Partial<Location>) => Query;
|
|
20
|
+
declare const stringifyQuery: (query: Query) => string;
|
|
21
|
+
type Match$1 = {
|
|
22
|
+
path: string;
|
|
23
|
+
};
|
|
24
|
+
declare const getMatch: (current: string, target: string | RegExp, startsWith?: any) => Match$1 | null;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Actions represent the type of change to a location value.
|
|
28
|
+
*
|
|
29
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action
|
|
30
|
+
*/
|
|
31
|
+
declare enum Action {
|
|
32
|
+
/**
|
|
33
|
+
* A POP indicates a change to an arbitrary index in the history stack, such
|
|
34
|
+
* as a back or forward navigation. It does not describe the direction of the
|
|
35
|
+
* navigation, only that the current index changed.
|
|
36
|
+
*
|
|
37
|
+
* Note: This is the default action for newly created history objects.
|
|
38
|
+
*/
|
|
39
|
+
Pop = "POP",
|
|
40
|
+
/**
|
|
41
|
+
* A PUSH indicates a new entry being added to the history stack, such as when
|
|
42
|
+
* a link is clicked and a new page loads. When this happens, all subsequent
|
|
43
|
+
* entries in the stack are lost.
|
|
44
|
+
*/
|
|
45
|
+
Push = "PUSH",
|
|
46
|
+
/**
|
|
47
|
+
* A REPLACE indicates the entry at the current index in the history stack
|
|
48
|
+
* being replaced by a new one.
|
|
49
|
+
*/
|
|
50
|
+
Replace = "REPLACE"
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A URL pathname, beginning with a /.
|
|
54
|
+
*
|
|
55
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname
|
|
56
|
+
*/
|
|
57
|
+
declare type Pathname = string;
|
|
58
|
+
/**
|
|
59
|
+
* A URL search string, beginning with a ?.
|
|
60
|
+
*
|
|
61
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search
|
|
62
|
+
*/
|
|
63
|
+
declare type Search = string;
|
|
64
|
+
/**
|
|
65
|
+
* A URL fragment identifier, beginning with a #.
|
|
66
|
+
*
|
|
67
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash
|
|
68
|
+
*/
|
|
69
|
+
declare type Hash = string;
|
|
70
|
+
/**
|
|
71
|
+
* A unique string associated with a location. May be used to safely store
|
|
72
|
+
* and retrieve data in some other storage API, like `localStorage`.
|
|
73
|
+
*
|
|
74
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.key
|
|
75
|
+
*/
|
|
76
|
+
declare type Key = string;
|
|
77
|
+
/**
|
|
78
|
+
* The pathname, search, and hash values of a URL.
|
|
79
|
+
*/
|
|
80
|
+
interface Path {
|
|
81
|
+
/**
|
|
82
|
+
* A URL pathname, beginning with a /.
|
|
83
|
+
*
|
|
84
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname
|
|
85
|
+
*/
|
|
86
|
+
pathname: Pathname;
|
|
87
|
+
/**
|
|
88
|
+
* A URL search string, beginning with a ?.
|
|
89
|
+
*
|
|
90
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search
|
|
91
|
+
*/
|
|
92
|
+
search: Search;
|
|
93
|
+
/**
|
|
94
|
+
* A URL fragment identifier, beginning with a #.
|
|
95
|
+
*
|
|
96
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash
|
|
97
|
+
*/
|
|
98
|
+
hash: Hash;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* An entry in a history stack. A location contains information about the
|
|
102
|
+
* URL path, as well as possibly some arbitrary state and a key.
|
|
103
|
+
*
|
|
104
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location
|
|
105
|
+
*/
|
|
106
|
+
interface Location$2 extends Path {
|
|
107
|
+
/**
|
|
108
|
+
* A value of arbitrary data associated with this location.
|
|
109
|
+
*
|
|
110
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.state
|
|
111
|
+
*/
|
|
112
|
+
state: unknown;
|
|
113
|
+
/**
|
|
114
|
+
* A unique string associated with this location. May be used to safely store
|
|
115
|
+
* and retrieve data in some other storage API, like `localStorage`.
|
|
116
|
+
*
|
|
117
|
+
* Note: This value is always "default" on the initial location.
|
|
118
|
+
*
|
|
119
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.key
|
|
120
|
+
*/
|
|
121
|
+
key: Key;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A change to the current location.
|
|
125
|
+
*/
|
|
126
|
+
interface Update {
|
|
127
|
+
/**
|
|
128
|
+
* The action that triggered the change.
|
|
129
|
+
*/
|
|
130
|
+
action: Action;
|
|
131
|
+
/**
|
|
132
|
+
* The new location.
|
|
133
|
+
*/
|
|
134
|
+
location: Location$2;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A function that receives notifications about location changes.
|
|
138
|
+
*/
|
|
139
|
+
interface Listener {
|
|
140
|
+
(update: Update): void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A change to the current location that was blocked. May be retried
|
|
144
|
+
* after obtaining user confirmation.
|
|
145
|
+
*/
|
|
146
|
+
interface Transition extends Update {
|
|
147
|
+
/**
|
|
148
|
+
* Retries the update to the current location.
|
|
149
|
+
*/
|
|
150
|
+
retry(): void;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A function that receives transitions when navigation is blocked.
|
|
154
|
+
*/
|
|
155
|
+
interface Blocker {
|
|
156
|
+
(tx: Transition): void;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Describes a location that is the destination of some navigation, either via
|
|
160
|
+
* `history.push` or `history.replace`. May be either a URL or the pieces of a
|
|
161
|
+
* URL path.
|
|
162
|
+
*/
|
|
163
|
+
declare type To = string | Partial<Path>;
|
|
164
|
+
/**
|
|
165
|
+
* A history is an interface to the navigation stack. The history serves as the
|
|
166
|
+
* source of truth for the current location, as well as provides a set of
|
|
167
|
+
* methods that may be used to change it.
|
|
168
|
+
*
|
|
169
|
+
* It is similar to the DOM's `window.history` object, but with a smaller, more
|
|
170
|
+
* focused API.
|
|
171
|
+
*/
|
|
172
|
+
interface History {
|
|
173
|
+
/**
|
|
174
|
+
* The last action that modified the current location. This will always be
|
|
175
|
+
* Action.Pop when a history instance is first created. This value is mutable.
|
|
176
|
+
*
|
|
177
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.action
|
|
178
|
+
*/
|
|
179
|
+
readonly action: Action;
|
|
180
|
+
/**
|
|
181
|
+
* The current location. This value is mutable.
|
|
182
|
+
*
|
|
183
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.location
|
|
184
|
+
*/
|
|
185
|
+
readonly location: Location$2;
|
|
186
|
+
/**
|
|
187
|
+
* Returns a valid href for the given `to` value that may be used as
|
|
188
|
+
* the value of an <a href> attribute.
|
|
189
|
+
*
|
|
190
|
+
* @param to - The destination URL
|
|
191
|
+
*
|
|
192
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.createHref
|
|
193
|
+
*/
|
|
194
|
+
createHref(to: To): string;
|
|
195
|
+
/**
|
|
196
|
+
* Pushes a new location onto the history stack, increasing its length by one.
|
|
197
|
+
* If there were any entries in the stack after the current one, they are
|
|
198
|
+
* lost.
|
|
199
|
+
*
|
|
200
|
+
* @param to - The new URL
|
|
201
|
+
* @param state - Data to associate with the new location
|
|
202
|
+
*
|
|
203
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.push
|
|
204
|
+
*/
|
|
205
|
+
push(to: To, state?: any): void;
|
|
206
|
+
/**
|
|
207
|
+
* Replaces the current location in the history stack with a new one. The
|
|
208
|
+
* location that was replaced will no longer be available.
|
|
209
|
+
*
|
|
210
|
+
* @param to - The new URL
|
|
211
|
+
* @param state - Data to associate with the new location
|
|
212
|
+
*
|
|
213
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.replace
|
|
214
|
+
*/
|
|
215
|
+
replace(to: To, state?: any): void;
|
|
216
|
+
/**
|
|
217
|
+
* Navigates `n` entries backward/forward in the history stack relative to the
|
|
218
|
+
* current index. For example, a "back" navigation would use go(-1).
|
|
219
|
+
*
|
|
220
|
+
* @param delta - The delta in the stack index
|
|
221
|
+
*
|
|
222
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.go
|
|
223
|
+
*/
|
|
224
|
+
go(delta: number): void;
|
|
225
|
+
/**
|
|
226
|
+
* Navigates to the previous entry in the stack. Identical to go(-1).
|
|
227
|
+
*
|
|
228
|
+
* Warning: if the current location is the first location in the stack, this
|
|
229
|
+
* will unload the current document.
|
|
230
|
+
*
|
|
231
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.back
|
|
232
|
+
*/
|
|
233
|
+
back(): void;
|
|
234
|
+
/**
|
|
235
|
+
* Navigates to the next entry in the stack. Identical to go(1).
|
|
236
|
+
*
|
|
237
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.forward
|
|
238
|
+
*/
|
|
239
|
+
forward(): void;
|
|
240
|
+
/**
|
|
241
|
+
* Sets up a listener that will be called whenever the current location
|
|
242
|
+
* changes.
|
|
243
|
+
*
|
|
244
|
+
* @param listener - A function that will be called when the location changes
|
|
245
|
+
* @returns unlisten - A function that may be used to stop listening
|
|
246
|
+
*
|
|
247
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.listen
|
|
248
|
+
*/
|
|
249
|
+
listen(listener: Listener): () => void;
|
|
250
|
+
/**
|
|
251
|
+
* Prevents the current location from changing and sets up a listener that
|
|
252
|
+
* will be called instead.
|
|
253
|
+
*
|
|
254
|
+
* @param blocker - A function that will be called when a transition is blocked
|
|
255
|
+
* @returns unblock - A function that may be used to stop blocking
|
|
256
|
+
*
|
|
257
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#history.block
|
|
258
|
+
*/
|
|
259
|
+
block(blocker: Blocker): () => void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* A Navigator is a "location changer"; it's how you get to different locations.
|
|
264
|
+
*
|
|
265
|
+
* Every history instance conforms to the Navigator interface, but the
|
|
266
|
+
* distinction is useful primarily when it comes to the low-level <Router> API
|
|
267
|
+
* where both the location and a navigator must be provided separately in order
|
|
268
|
+
* to avoid "tearing" that may occur in a suspense-enabled app if the action
|
|
269
|
+
* and/or location were to be read directly from the history instance.
|
|
270
|
+
*/
|
|
271
|
+
declare type Navigator = Omit<History, "action" | "location" | "back" | "forward" | "listen" | "block">;
|
|
272
|
+
interface RouterProps {
|
|
273
|
+
basename?: string;
|
|
274
|
+
children?: React.ReactNode;
|
|
275
|
+
location: Partial<Location$2> | string;
|
|
276
|
+
navigationType?: Action;
|
|
277
|
+
navigator: Navigator;
|
|
278
|
+
static?: boolean;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Provides location context for the rest of the app.
|
|
282
|
+
*
|
|
283
|
+
* Note: You usually won't render a <Router> directly. Instead, you'll render a
|
|
284
|
+
* router that is more specific to your environment such as a <BrowserRouter>
|
|
285
|
+
* in web browsers or a <StaticRouter> for server rendering.
|
|
286
|
+
*
|
|
287
|
+
* @see https://reactrouter.com/docs/en/v6/api#router
|
|
288
|
+
*/
|
|
289
|
+
declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp }: RouterProps): React.ReactElement | null;
|
|
290
|
+
interface NavigateOptions$1 {
|
|
291
|
+
replace?: boolean;
|
|
292
|
+
state?: any;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
interface BrowserRouterProps {
|
|
296
|
+
basename?: string;
|
|
297
|
+
children?: React.ReactNode;
|
|
298
|
+
window?: Window;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* A <Router> for use in web browsers. Provides the cleanest URLs.
|
|
302
|
+
*/
|
|
303
|
+
declare function BrowserRouter({ basename, children, window }: BrowserRouterProps): JSX.Element;
|
|
304
|
+
|
|
305
|
+
interface Other extends StoryData {
|
|
306
|
+
path: string;
|
|
307
|
+
singleStory?: boolean;
|
|
308
|
+
}
|
|
309
|
+
type NavigateOptions = NavigateOptions$1 & {
|
|
310
|
+
plain?: boolean;
|
|
311
|
+
};
|
|
312
|
+
type NavigateFunction = (to: To | number, options?: NavigateOptions) => void;
|
|
313
|
+
type RouterData = {
|
|
314
|
+
location: Partial<Location$2>;
|
|
315
|
+
navigate: NavigateFunction;
|
|
316
|
+
} & Other;
|
|
317
|
+
type RenderData = Pick<RouterData, 'location'> & Other;
|
|
318
|
+
interface LinkProps {
|
|
319
|
+
to: string;
|
|
320
|
+
children: ReactNode;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
interface MatchingData {
|
|
324
|
+
match: null | {
|
|
325
|
+
path: string;
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
interface LocationProps {
|
|
329
|
+
children: (renderData: RenderData) => any;
|
|
330
|
+
}
|
|
331
|
+
interface MatchPropsStartsWith {
|
|
332
|
+
path: string;
|
|
333
|
+
startsWith: boolean;
|
|
334
|
+
children: (matchingData: MatchingData) => ReactNode;
|
|
335
|
+
}
|
|
336
|
+
interface MatchPropsDefault {
|
|
337
|
+
path: RegExp;
|
|
338
|
+
startsWith: false;
|
|
339
|
+
children: (matchingData: MatchingData) => ReactNode;
|
|
340
|
+
}
|
|
341
|
+
interface RoutePropsStartsWith {
|
|
342
|
+
path: string;
|
|
343
|
+
startsWith?: boolean;
|
|
344
|
+
children: ReactNode;
|
|
345
|
+
}
|
|
346
|
+
interface RoutePropsDefault {
|
|
347
|
+
path: RegExp;
|
|
348
|
+
startsWith?: false;
|
|
349
|
+
children: ReactNode;
|
|
350
|
+
}
|
|
351
|
+
declare const useNavigate: () => (to: To | number, { plain, ...options }?: NavigateOptions) => void;
|
|
352
|
+
/** A component that will navigate to a new location/path when clicked */
|
|
353
|
+
declare const Link: {
|
|
354
|
+
({ to, children, ...rest }: LinkProps): React__default.JSX.Element;
|
|
355
|
+
displayName: string;
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* A render-prop component where children is called with a location and will be called whenever it
|
|
359
|
+
* changes
|
|
360
|
+
*/
|
|
361
|
+
declare const Location$1: {
|
|
362
|
+
({ children }: LocationProps): React__default.JSX.Element;
|
|
363
|
+
displayName: string;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* A render-prop component for rendering when a certain path is hit. It's immensely similar to
|
|
367
|
+
* `Location` but it receives an addition data property: `match`. match has a truthy value when the
|
|
368
|
+
* path is hit.
|
|
369
|
+
*/
|
|
370
|
+
declare function Match(props: MatchPropsStartsWith): ReactElement;
|
|
371
|
+
declare function Match(props: MatchPropsDefault): ReactElement;
|
|
372
|
+
declare namespace Match {
|
|
373
|
+
var displayName: string;
|
|
374
|
+
}
|
|
375
|
+
/** A component to conditionally render children based on matching a target path */
|
|
376
|
+
declare function Route(props: RoutePropsDefault): ReactElement;
|
|
377
|
+
declare function Route(props: RoutePropsStartsWith): ReactElement;
|
|
378
|
+
declare namespace Route {
|
|
379
|
+
var displayName: string;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
declare const LocationProvider: typeof BrowserRouter;
|
|
383
|
+
declare const BaseLocationProvider: typeof Router;
|
|
384
|
+
|
|
385
|
+
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 };
|