@inertiajs/core 1.0.0-beta.2 → 1.0.0-beta.4
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/dist/index.esm.js +72 -1
- package/dist/index.esm.js.map +7 -1
- package/dist/index.js +72 -1
- package/dist/index.js.map +7 -1
- package/dist/server.esm.js +1 -40
- package/dist/server.esm.js.map +7 -1
- package/dist/server.js +1 -40
- package/dist/server.js.map +7 -1
- package/package.json +18 -12
- package/types/debounce.d.ts +1 -1
- package/types/events.d.ts +10 -10
- package/types/files.d.ts +2 -2
- package/types/formData.d.ts +2 -2
- package/types/head.d.ts +7 -7
- package/types/index.d.ts +8 -7
- package/types/modal.d.ts +8 -8
- package/types/progress.d.ts +6 -6
- package/types/router.d.ts +59 -58
- package/types/server.d.ts +4 -4
- package/types/shouldIntercept.d.ts +1 -1
- package/types/types.d.ts +176 -173
- package/types/url.d.ts +4 -4
package/types/types.d.ts
CHANGED
|
@@ -1,173 +1,176 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
export
|
|
129
|
-
export
|
|
130
|
-
export
|
|
131
|
-
export
|
|
132
|
-
export
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
};
|
|
155
|
-
export
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
'inertia:
|
|
167
|
-
'inertia:
|
|
168
|
-
'inertia:
|
|
169
|
-
'inertia:
|
|
170
|
-
'inertia:
|
|
171
|
-
'inertia:
|
|
172
|
-
|
|
173
|
-
|
|
1
|
+
import { AxiosProgressEvent, AxiosResponse } from 'axios';
|
|
2
|
+
declare module 'axios' {
|
|
3
|
+
interface AxiosProgressEvent {
|
|
4
|
+
percentage: number | undefined;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export type Errors = Record<string, string>;
|
|
8
|
+
export type ErrorBag = Record<string, Errors>;
|
|
9
|
+
export type FormDataConvertible = Array<FormDataConvertible> | Blob | FormDataEntryValue | Date | boolean | number | null | undefined;
|
|
10
|
+
export declare enum Method {
|
|
11
|
+
GET = "get",
|
|
12
|
+
POST = "post",
|
|
13
|
+
PUT = "put",
|
|
14
|
+
PATCH = "patch",
|
|
15
|
+
DELETE = "delete"
|
|
16
|
+
}
|
|
17
|
+
export type RequestPayload = Record<string, FormDataConvertible> | FormData;
|
|
18
|
+
export interface PageProps {
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface Page<SharedProps = PageProps> {
|
|
22
|
+
component: string;
|
|
23
|
+
props: PageProps & SharedProps & {
|
|
24
|
+
errors: Errors & ErrorBag;
|
|
25
|
+
};
|
|
26
|
+
url: string;
|
|
27
|
+
version: string | null;
|
|
28
|
+
scrollRegions: Array<{
|
|
29
|
+
top: number;
|
|
30
|
+
left: number;
|
|
31
|
+
}>;
|
|
32
|
+
rememberedState: Record<string, unknown>;
|
|
33
|
+
resolvedErrors: Errors;
|
|
34
|
+
}
|
|
35
|
+
export type PageResolver = (name: string) => Component;
|
|
36
|
+
export type PageHandler = ({ component, page, preserveState, }: {
|
|
37
|
+
component: Component;
|
|
38
|
+
page: Page;
|
|
39
|
+
preserveState: PreserveStateOption;
|
|
40
|
+
}) => Promise<unknown>;
|
|
41
|
+
export type PreserveStateOption = boolean | string | ((page: Page) => boolean);
|
|
42
|
+
export type Progress = AxiosProgressEvent;
|
|
43
|
+
export type LocationVisit = {
|
|
44
|
+
preserveScroll: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type Visit = {
|
|
47
|
+
method: Method;
|
|
48
|
+
data: RequestPayload;
|
|
49
|
+
replace: boolean;
|
|
50
|
+
preserveScroll: PreserveStateOption;
|
|
51
|
+
preserveState: PreserveStateOption;
|
|
52
|
+
only: Array<string>;
|
|
53
|
+
headers: Record<string, string>;
|
|
54
|
+
errorBag: string | null;
|
|
55
|
+
forceFormData: boolean;
|
|
56
|
+
queryStringArrayFormat: 'indices' | 'brackets';
|
|
57
|
+
};
|
|
58
|
+
export type GlobalEventsMap = {
|
|
59
|
+
before: {
|
|
60
|
+
parameters: [PendingVisit];
|
|
61
|
+
details: {
|
|
62
|
+
visit: PendingVisit;
|
|
63
|
+
};
|
|
64
|
+
result: boolean | void;
|
|
65
|
+
};
|
|
66
|
+
start: {
|
|
67
|
+
parameters: [PendingVisit];
|
|
68
|
+
details: {
|
|
69
|
+
visit: PendingVisit;
|
|
70
|
+
};
|
|
71
|
+
result: void;
|
|
72
|
+
};
|
|
73
|
+
progress: {
|
|
74
|
+
parameters: [Progress | undefined];
|
|
75
|
+
details: {
|
|
76
|
+
progress: Progress | undefined;
|
|
77
|
+
};
|
|
78
|
+
result: void;
|
|
79
|
+
};
|
|
80
|
+
finish: {
|
|
81
|
+
parameters: [ActiveVisit];
|
|
82
|
+
details: {
|
|
83
|
+
visit: ActiveVisit;
|
|
84
|
+
};
|
|
85
|
+
result: void;
|
|
86
|
+
};
|
|
87
|
+
cancel: {
|
|
88
|
+
parameters: [];
|
|
89
|
+
details: {};
|
|
90
|
+
result: void;
|
|
91
|
+
};
|
|
92
|
+
navigate: {
|
|
93
|
+
parameters: [Page];
|
|
94
|
+
details: {
|
|
95
|
+
page: Page;
|
|
96
|
+
};
|
|
97
|
+
result: void;
|
|
98
|
+
};
|
|
99
|
+
success: {
|
|
100
|
+
parameters: [Page];
|
|
101
|
+
details: {
|
|
102
|
+
page: Page;
|
|
103
|
+
};
|
|
104
|
+
result: void;
|
|
105
|
+
};
|
|
106
|
+
error: {
|
|
107
|
+
parameters: [Errors];
|
|
108
|
+
details: {
|
|
109
|
+
errors: Errors;
|
|
110
|
+
};
|
|
111
|
+
result: void;
|
|
112
|
+
};
|
|
113
|
+
invalid: {
|
|
114
|
+
parameters: [AxiosResponse];
|
|
115
|
+
details: {
|
|
116
|
+
response: AxiosResponse;
|
|
117
|
+
};
|
|
118
|
+
result: boolean | void;
|
|
119
|
+
};
|
|
120
|
+
exception: {
|
|
121
|
+
parameters: [Error];
|
|
122
|
+
details: {
|
|
123
|
+
exception: Error;
|
|
124
|
+
};
|
|
125
|
+
result: boolean | void;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
export type GlobalEventNames = keyof GlobalEventsMap;
|
|
129
|
+
export type GlobalEvent<TEventName extends GlobalEventNames> = CustomEvent<GlobalEventDetails<TEventName>>;
|
|
130
|
+
export type GlobalEventParameters<TEventName extends GlobalEventNames> = GlobalEventsMap[TEventName]['parameters'];
|
|
131
|
+
export type GlobalEventResult<TEventName extends GlobalEventNames> = GlobalEventsMap[TEventName]['result'];
|
|
132
|
+
export type GlobalEventDetails<TEventName extends GlobalEventNames> = GlobalEventsMap[TEventName]['details'];
|
|
133
|
+
export type GlobalEventTrigger<TEventName extends GlobalEventNames> = (...params: GlobalEventParameters<TEventName>) => GlobalEventResult<TEventName>;
|
|
134
|
+
export type GlobalEventCallback<TEventName extends GlobalEventNames> = (...params: GlobalEventParameters<TEventName>) => GlobalEventResult<TEventName>;
|
|
135
|
+
export type VisitOptions = Partial<Visit & {
|
|
136
|
+
onCancelToken: {
|
|
137
|
+
({ cancel }: {
|
|
138
|
+
cancel: VoidFunction;
|
|
139
|
+
}): void;
|
|
140
|
+
};
|
|
141
|
+
onBefore: GlobalEventCallback<'before'>;
|
|
142
|
+
onStart: GlobalEventCallback<'start'>;
|
|
143
|
+
onProgress: GlobalEventCallback<'progress'>;
|
|
144
|
+
onFinish: GlobalEventCallback<'finish'>;
|
|
145
|
+
onCancel: GlobalEventCallback<'cancel'>;
|
|
146
|
+
onSuccess: GlobalEventCallback<'success'>;
|
|
147
|
+
onError: GlobalEventCallback<'error'>;
|
|
148
|
+
}>;
|
|
149
|
+
export type PendingVisit = Visit & {
|
|
150
|
+
url: URL;
|
|
151
|
+
completed: boolean;
|
|
152
|
+
cancelled: boolean;
|
|
153
|
+
interrupted: boolean;
|
|
154
|
+
};
|
|
155
|
+
export type ActiveVisit = PendingVisit & Required<VisitOptions> & {
|
|
156
|
+
cancelToken: AbortController;
|
|
157
|
+
};
|
|
158
|
+
export type VisitId = unknown;
|
|
159
|
+
export type Component = unknown;
|
|
160
|
+
export type InertiaAppResponse = Promise<{
|
|
161
|
+
head: string[];
|
|
162
|
+
body: string;
|
|
163
|
+
} | void>;
|
|
164
|
+
declare global {
|
|
165
|
+
interface DocumentEventMap {
|
|
166
|
+
'inertia:before': GlobalEvent<'before'>;
|
|
167
|
+
'inertia:start': GlobalEvent<'start'>;
|
|
168
|
+
'inertia:progress': GlobalEvent<'progress'>;
|
|
169
|
+
'inertia:success': GlobalEvent<'success'>;
|
|
170
|
+
'inertia:error': GlobalEvent<'error'>;
|
|
171
|
+
'inertia:invalid': GlobalEvent<'invalid'>;
|
|
172
|
+
'inertia:exception': GlobalEvent<'exception'>;
|
|
173
|
+
'inertia:finish': GlobalEvent<'finish'>;
|
|
174
|
+
'inertia:navigate': GlobalEvent<'navigate'>;
|
|
175
|
+
}
|
|
176
|
+
}
|
package/types/url.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormDataConvertible, Method } from './types';
|
|
2
|
-
export declare function hrefToUrl(href: string | URL): URL;
|
|
3
|
-
export declare function mergeDataIntoQueryString(method: Method, href: URL | string, data: Record<string, FormDataConvertible>, qsArrayFormat?: 'indices' | 'brackets'): [string, Record<string, FormDataConvertible>];
|
|
4
|
-
export declare function urlWithoutHash(url: URL | Location): URL;
|
|
1
|
+
import { FormDataConvertible, Method } from './types';
|
|
2
|
+
export declare function hrefToUrl(href: string | URL): URL;
|
|
3
|
+
export declare function mergeDataIntoQueryString(method: Method, href: URL | string, data: Record<string, FormDataConvertible>, qsArrayFormat?: 'indices' | 'brackets'): [string, Record<string, FormDataConvertible>];
|
|
4
|
+
export declare function urlWithoutHash(url: URL | Location): URL;
|