inertiax-core 10.2.2 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5337 -16
- package/dist/index.js.map +4 -4
- package/dist/server.js +312 -1
- package/dist/server.js.map +4 -4
- package/dist/ssrErrors.js +197 -0
- package/dist/ssrErrors.js.map +7 -0
- package/package.json +42 -26
- package/readme.md +2 -2
- package/types/axiosHttpClient.d.ts +13 -0
- package/types/config.d.ts +24 -0
- package/types/debug.d.ts +1 -1
- package/types/dialog.d.ts +8 -0
- package/types/domUtils.d.ts +4 -0
- package/types/eventHandler.d.ts +11 -10
- package/types/events.d.ts +4 -2
- package/types/files.d.ts +1 -0
- package/types/formData.d.ts +2 -2
- package/types/formObject.d.ts +5 -0
- package/types/head.d.ts +2 -7
- package/types/history.d.ts +49 -37
- package/types/http.d.ts +38 -0
- package/types/httpErrors.d.ts +17 -0
- package/types/httpHandlers.d.ts +15 -0
- package/types/index.d.ts +22 -5
- package/types/infiniteScroll/data.d.ts +19 -0
- package/types/infiniteScroll/elements.d.ts +15 -0
- package/types/infiniteScroll/queryString.d.ts +13 -0
- package/types/infiniteScroll/scrollPreservation.d.ts +18 -0
- package/types/infiniteScroll.d.ts +12 -0
- package/types/initialVisit.d.ts +6 -5
- package/types/intersectionObservers.d.ts +7 -0
- package/types/layout.d.ts +32 -0
- package/types/navigationEvents.d.ts +15 -0
- package/types/objectUtils.d.ts +2 -1
- package/types/page.d.ts +80 -10
- package/types/partialReload.d.ts +6 -0
- package/types/poll.d.ts +18 -3
- package/types/polls.d.ts +4 -2
- package/types/prefetched.d.ts +7 -2
- package/types/progress-component.d.ts +2 -2
- package/types/progress.d.ts +16 -8
- package/types/queryString.d.ts +13 -0
- package/types/request.d.ts +18 -6
- package/types/requestParams.d.ts +6 -4
- package/types/requestStream.d.ts +8 -4
- package/types/resetFormFields.d.ts +2 -0
- package/types/response.d.ts +28 -5
- package/types/router.d.ts +58 -34
- package/types/scroll.d.ts +9 -5
- package/types/server.d.ts +3 -1
- package/types/ssrErrors.d.ts +29 -0
- package/types/ssrUtils.d.ts +2 -0
- package/types/time.d.ts +2 -1
- package/types/types.d.ts +496 -83
- package/types/url.d.ts +10 -3
- package/types/useFormUtils.d.ts +48 -0
- package/types/xhrHttpClient.d.ts +12 -0
- package/dist/index.esm.js +0 -68
- package/dist/index.esm.js.map +0 -7
- package/dist/server.esm.js +0 -2
- package/dist/server.esm.js.map +0 -7
- package/types/modal.d.ts +0 -8
- package/types/shouldIntercept.d.ts +0 -1
package/types/page.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Component, Page, PageEvent, PageHandler, PageResolver,
|
|
2
|
-
|
|
3
|
-
protected
|
|
1
|
+
import { Component, FlashData, Page, PageEvent, PageHandler, PageResolver, RouterInitParams, Visit } from './types';
|
|
2
|
+
declare class CurrentFramePage {
|
|
3
|
+
protected readonly frameId: string;
|
|
4
4
|
protected page: Page;
|
|
5
|
-
protected swapComponent: PageHandler
|
|
5
|
+
protected swapComponent: PageHandler<any>;
|
|
6
6
|
protected resolveComponent: PageResolver;
|
|
7
|
+
protected onFlashCallback?: (flash: Page['flash']) => void;
|
|
7
8
|
protected componentId: {};
|
|
8
9
|
protected listeners: {
|
|
9
10
|
event: PageEvent;
|
|
@@ -11,24 +12,93 @@ export declare class CurrentPage {
|
|
|
11
12
|
}[];
|
|
12
13
|
protected isFirstPageLoad: boolean;
|
|
13
14
|
protected cleared: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
protected pendingDeferredProps: Pick<Page, 'deferredProps' | 'url' | 'component'> | null;
|
|
16
|
+
protected historyQuotaExceeded: boolean;
|
|
17
|
+
protected optimisticBaseline: Partial<Page['props']>;
|
|
18
|
+
protected pendingOptimistics: {
|
|
19
|
+
id: number;
|
|
20
|
+
callback: (props: Page['props']) => Partial<Page['props']> | void;
|
|
21
|
+
}[];
|
|
22
|
+
protected optimisticCounter: number;
|
|
23
|
+
constructor(frameId: string);
|
|
24
|
+
init<ComponentType = Component>({ initialPage, swapComponent, resolveComponent, onFlash, }: RouterInitParams<ComponentType>): this;
|
|
25
|
+
set(page: Page, { replace, updateBrowserUrl, preserveScroll, preserveState, viewTransition, }?: {
|
|
26
|
+
replace?: boolean;
|
|
27
|
+
updateBrowserUrl?: boolean;
|
|
28
|
+
preserveScroll?: boolean;
|
|
29
|
+
preserveState?: boolean;
|
|
30
|
+
viewTransition?: Visit['viewTransition'];
|
|
31
|
+
}): Promise<void>;
|
|
16
32
|
setQuietly(page: Page, { preserveState, }?: {
|
|
17
|
-
preserveState?:
|
|
33
|
+
preserveState?: boolean;
|
|
18
34
|
}): Promise<unknown>;
|
|
19
35
|
clear(): void;
|
|
20
36
|
isCleared(): boolean;
|
|
21
37
|
get(): Page;
|
|
38
|
+
getWithoutFlashData(): Page;
|
|
39
|
+
hasOnceProps(): boolean;
|
|
22
40
|
merge(data: Partial<Page>): void;
|
|
41
|
+
setPropsQuietly(props: Page['props']): Promise<unknown>;
|
|
42
|
+
setFlash(flash: FlashData): void;
|
|
23
43
|
setUrlHash(hash: string): void;
|
|
24
44
|
remember(data: Page['rememberedState']): void;
|
|
25
|
-
swap({ component, page, preserveState, }: {
|
|
45
|
+
swap({ component, page, preserveState, viewTransition, }: {
|
|
26
46
|
component: Component;
|
|
27
47
|
page: Page;
|
|
28
|
-
preserveState:
|
|
48
|
+
preserveState: boolean;
|
|
49
|
+
viewTransition: Visit['viewTransition'];
|
|
29
50
|
}): Promise<unknown>;
|
|
30
|
-
resolve(component: string): Promise<Component>;
|
|
51
|
+
resolve(component: string, page?: Page): Promise<Component>;
|
|
52
|
+
nextOptimisticId(): number;
|
|
53
|
+
setBaseline(key: string, value: unknown): void;
|
|
54
|
+
updateBaseline(key: string, value: unknown): void;
|
|
55
|
+
hasBaseline(key: string): boolean;
|
|
56
|
+
registerOptimistic(id: number, callback: (props: Page['props']) => Partial<Page['props']> | void): void;
|
|
57
|
+
unregisterOptimistic(id: number): void;
|
|
58
|
+
replayOptimistics(): Partial<Page['props']>;
|
|
59
|
+
pendingOptimisticCount(): number;
|
|
60
|
+
clearOptimisticState(): void;
|
|
31
61
|
isTheSame(page: Page): boolean;
|
|
32
62
|
on(event: PageEvent, callback: VoidFunction): VoidFunction;
|
|
33
63
|
fireEventsFor(event: PageEvent): void;
|
|
64
|
+
mergeOncePropsIntoResponse(response: Page, { force }?: {
|
|
65
|
+
force?: boolean;
|
|
66
|
+
}): void;
|
|
67
|
+
}
|
|
68
|
+
declare class PageStore {
|
|
69
|
+
protected frames: Map<string, CurrentFramePage>;
|
|
70
|
+
protected forFrame(frameId?: string): CurrentFramePage;
|
|
71
|
+
init<ComponentType = Component>(params: RouterInitParams<ComponentType>, frameId?: string): CurrentFramePage;
|
|
72
|
+
set(page: Page, options?: Parameters<CurrentFramePage['set']>[1], frameId?: string): Promise<void>;
|
|
73
|
+
setQuietly(page: Page, options?: Parameters<CurrentFramePage['setQuietly']>[1], frameId?: string): Promise<unknown>;
|
|
74
|
+
clear(frameId?: string): void;
|
|
75
|
+
isCleared(frameId?: string): boolean;
|
|
76
|
+
get(frameId?: string): Page;
|
|
77
|
+
getWithoutFlashData(frameId?: string): Page;
|
|
78
|
+
hasOnceProps(frameId?: string): boolean;
|
|
79
|
+
merge(data: Partial<Page>, frameId?: string): void;
|
|
80
|
+
setPropsQuietly(props: Page['props'], frameId?: string): Promise<unknown>;
|
|
81
|
+
setFlash(flash: FlashData, frameId?: string): void;
|
|
82
|
+
setUrlHash(hash: string, frameId?: string): void;
|
|
83
|
+
remember(data: Page['rememberedState'], frameId?: string): void;
|
|
84
|
+
swap(args: Parameters<CurrentFramePage['swap']>[0], frameId?: string): Promise<unknown>;
|
|
85
|
+
resolve(component: string, page?: Page, frameId?: string): Promise<Component>;
|
|
86
|
+
nextOptimisticId(frameId?: string): number;
|
|
87
|
+
setBaseline(key: string, value: unknown, frameId?: string): void;
|
|
88
|
+
updateBaseline(key: string, value: unknown, frameId?: string): void;
|
|
89
|
+
hasBaseline(key: string, frameId?: string): boolean;
|
|
90
|
+
registerOptimistic(id: number, callback: (props: Page['props']) => Partial<Page['props']> | void, frameId?: string): void;
|
|
91
|
+
unregisterOptimistic(id: number, frameId?: string): void;
|
|
92
|
+
replayOptimistics(frameId?: string): Partial<Page['props']>;
|
|
93
|
+
pendingOptimisticCount(frameId?: string): number;
|
|
94
|
+
clearOptimisticState(frameId?: string): void;
|
|
95
|
+
isTheSame(page: Page, frameId?: string): boolean;
|
|
96
|
+
on(event: PageEvent, callback: VoidFunction, frameId?: string): VoidFunction;
|
|
97
|
+
fireEventsFor(event: PageEvent, frameId?: string): void;
|
|
98
|
+
mergeOncePropsIntoResponse(response: Page, options?: {
|
|
99
|
+
force?: boolean;
|
|
100
|
+
}, frameId?: string): void;
|
|
101
|
+
deleteFrame(frameId: string): void;
|
|
34
102
|
}
|
|
103
|
+
export declare const page: PageStore;
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActiveVisit } from './types';
|
|
2
|
+
type VisitFilter = Pick<ActiveVisit, 'only' | 'except'>;
|
|
3
|
+
export declare const isPathOrSubPath: (path: string, candidate: string) => boolean;
|
|
4
|
+
export declare const partialReloadRequestsProp: (visit: VisitFilter, prop: string) => boolean;
|
|
5
|
+
export declare const partialReloadRequestsSomeProps: (visit: VisitFilter, props: string[]) => boolean;
|
|
6
|
+
export {};
|
package/types/poll.d.ts
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { PollOptions } from './types';
|
|
2
|
+
type PollHooks = {
|
|
3
|
+
onStart: (cancel: VoidFunction) => void;
|
|
4
|
+
onFinish: VoidFunction;
|
|
5
|
+
};
|
|
6
|
+
export type PollCallback = (hooks: PollHooks) => void;
|
|
2
7
|
export declare class Poll {
|
|
3
|
-
protected
|
|
8
|
+
protected intervalId: number | null;
|
|
9
|
+
protected timeoutId: number | null;
|
|
4
10
|
protected throttle: boolean;
|
|
5
11
|
protected keepAlive: boolean;
|
|
6
|
-
protected cb:
|
|
12
|
+
protected cb: PollCallback;
|
|
7
13
|
protected interval: number;
|
|
8
14
|
protected cbCount: number;
|
|
9
|
-
|
|
15
|
+
protected mode: 'overlap' | 'cancel' | 'rest';
|
|
16
|
+
protected inFlight: boolean;
|
|
17
|
+
protected currentCancel: VoidFunction | null;
|
|
18
|
+
protected stopped: boolean;
|
|
19
|
+
protected instanceId: number;
|
|
20
|
+
constructor(interval: number, cb: PollCallback, options: PollOptions);
|
|
10
21
|
stop(): void;
|
|
11
22
|
start(): void;
|
|
12
23
|
isInBackground(hidden: boolean): void;
|
|
24
|
+
protected scheduleNext(): void;
|
|
25
|
+
protected tick(): void;
|
|
26
|
+
protected fire(): void;
|
|
13
27
|
}
|
|
28
|
+
export {};
|
package/types/polls.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Poll } from './poll';
|
|
1
|
+
import { Poll, PollCallback } from './poll';
|
|
2
2
|
import { PollOptions } from './types';
|
|
3
3
|
declare class Polls {
|
|
4
4
|
protected polls: Poll[];
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
get count(): number;
|
|
7
|
+
add(interval: number, cb: PollCallback, options: PollOptions): {
|
|
7
8
|
stop: VoidFunction;
|
|
8
9
|
start: VoidFunction;
|
|
10
|
+
destroy: VoidFunction;
|
|
9
11
|
};
|
|
10
12
|
clear(): void;
|
|
11
13
|
protected setupVisibilityListener(): void;
|
package/types/prefetched.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Response } from './response';
|
|
2
|
-
import { ActiveVisit, CacheForOption, InFlightPrefetch, InternalActiveVisit, PrefetchedResponse, PrefetchOptions, PrefetchRemovalTimer } from './types';
|
|
2
|
+
import { ActiveVisit, CacheForOption, InFlightPrefetch, InternalActiveVisit, Page, PrefetchedResponse, PrefetchOptions, PrefetchRemovalTimer } from './types';
|
|
3
3
|
declare class PrefetchedRequests {
|
|
4
4
|
protected cached: PrefetchedResponse[];
|
|
5
5
|
protected inFlightRequests: InFlightPrefetch[];
|
|
6
6
|
protected removalTimers: PrefetchRemovalTimer[];
|
|
7
7
|
protected currentUseId: string | null;
|
|
8
|
-
add(params: ActiveVisit, sendFunc: (params: InternalActiveVisit) => void, { cacheFor }: PrefetchOptions): Promise<void> | Promise<Response>;
|
|
8
|
+
add(params: ActiveVisit, sendFunc: (params: InternalActiveVisit) => void, { cacheFor, cacheTags }: PrefetchOptions): Promise<void> | Promise<Response>;
|
|
9
9
|
removeAll(): void;
|
|
10
|
+
removeByTags(tags: string[]): void;
|
|
10
11
|
remove(params: ActiveVisit): void;
|
|
12
|
+
protected removeFromInFlight(params: ActiveVisit): void;
|
|
11
13
|
protected extractStaleValues(cacheFor: PrefetchOptions['cacheFor']): [number, number];
|
|
12
14
|
protected cacheForToStaleAndExpires(cacheFor: PrefetchOptions['cacheFor']): [CacheForOption, CacheForOption];
|
|
13
15
|
protected clearTimer(params: ActiveVisit): void;
|
|
@@ -17,7 +19,10 @@ declare class PrefetchedRequests {
|
|
|
17
19
|
protected removeSingleUseItems(params: ActiveVisit): void;
|
|
18
20
|
findCached(params: ActiveVisit): PrefetchedResponse | null;
|
|
19
21
|
findInFlight(params: ActiveVisit): InFlightPrefetch | null;
|
|
22
|
+
protected withoutPurposePrefetchHeader(params: ActiveVisit): ActiveVisit;
|
|
20
23
|
protected paramsAreEqual(params1: ActiveVisit, params2: ActiveVisit): boolean;
|
|
24
|
+
updateCachedOncePropsFromCurrentPage(frameId?: string): void;
|
|
25
|
+
protected getShortestOncePropTtl(page: Page): number | null;
|
|
21
26
|
}
|
|
22
27
|
export declare const prefetchedRequests: PrefetchedRequests;
|
|
23
28
|
export {};
|
|
@@ -2,12 +2,12 @@ import { ProgressSettings } from './types';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
configure: (options: Partial<ProgressSettings>) => void;
|
|
4
4
|
isStarted: () => boolean;
|
|
5
|
-
done: (force?: boolean
|
|
5
|
+
done: (force?: boolean) => void;
|
|
6
6
|
set: (n: number) => void;
|
|
7
7
|
remove: () => void;
|
|
8
8
|
start: () => void;
|
|
9
9
|
status: null;
|
|
10
|
-
show: () =>
|
|
10
|
+
show: () => void;
|
|
11
11
|
hide: () => void;
|
|
12
12
|
};
|
|
13
13
|
export default _default;
|
package/types/progress.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ProgressOptions } from './types';
|
|
2
|
+
declare class Progress {
|
|
3
|
+
hideCount: number;
|
|
4
|
+
start(): void;
|
|
5
|
+
reveal(force?: boolean): void;
|
|
6
|
+
hide(): void;
|
|
7
|
+
set(status: number): void;
|
|
8
|
+
finish(): void;
|
|
9
|
+
reset(): void;
|
|
10
|
+
remove(): void;
|
|
11
|
+
isStarted(): boolean;
|
|
12
|
+
getStatus(): number | null;
|
|
13
|
+
}
|
|
14
|
+
export declare const progress: Progress;
|
|
15
|
+
export default function setupProgress({ delay, color, includeCSS, showSpinner, popover, }?: ProgressOptions): void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QueryStringArrayFormatOption } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if the given URL query string contains indexed array parameters.
|
|
4
|
+
*/
|
|
5
|
+
export declare function hasIndices(url: URL): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Parse a query string into a nested object.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parse(query: string): Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Convert an object to a query string.
|
|
12
|
+
*/
|
|
13
|
+
export declare function stringify(data: Record<string, unknown>, arrayFormat: QueryStringArrayFormatOption): string;
|
package/types/request.d.ts
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
import { AxiosProgressEvent, AxiosRequestConfig } from 'axios';
|
|
2
1
|
import { RequestParams } from './requestParams';
|
|
3
2
|
import { Response } from './response';
|
|
4
|
-
import {
|
|
3
|
+
import type { Router } from './router';
|
|
4
|
+
import type { ActiveVisit, Page } from './types';
|
|
5
|
+
import { HttpProgressEvent, HttpRequestHeaders } from './types';
|
|
5
6
|
export declare class Request {
|
|
6
7
|
protected page: Page;
|
|
7
8
|
protected response: Response;
|
|
8
9
|
protected cancelToken: AbortController;
|
|
9
10
|
protected requestParams: RequestParams;
|
|
10
11
|
protected requestHasFinished: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
protected optimistic: boolean;
|
|
13
|
+
protected router?: Router;
|
|
14
|
+
constructor(params: ActiveVisit, page: Page, { optimistic, router }?: {
|
|
15
|
+
optimistic?: boolean;
|
|
16
|
+
router?: Router;
|
|
17
|
+
});
|
|
18
|
+
static create(params: ActiveVisit, page: Page, options?: {
|
|
19
|
+
optimistic?: boolean;
|
|
20
|
+
router?: Router;
|
|
21
|
+
}): Request;
|
|
22
|
+
isPrefetch(): boolean;
|
|
23
|
+
isOptimistic(): boolean;
|
|
24
|
+
isPendingOptimistic(): boolean;
|
|
13
25
|
send(): Promise<void | undefined>;
|
|
14
26
|
protected finish(): void;
|
|
15
27
|
protected fireFinishEvents(): void;
|
|
@@ -17,6 +29,6 @@ export declare class Request {
|
|
|
17
29
|
cancelled?: boolean;
|
|
18
30
|
interrupted?: boolean;
|
|
19
31
|
}): void;
|
|
20
|
-
protected onProgress(progress:
|
|
21
|
-
protected getHeaders():
|
|
32
|
+
protected onProgress(progress: HttpProgressEvent): void;
|
|
33
|
+
protected getHeaders(): HttpRequestHeaders;
|
|
22
34
|
}
|
package/types/requestParams.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
1
|
import { Response } from './response';
|
|
3
|
-
import { ActiveVisit, InternalActiveVisit, Page, PreserveStateOption, VisitCallbacks } from './types';
|
|
2
|
+
import { ActiveVisit, HttpRequestHeaders, InternalActiveVisit, Page, PreserveStateOption, VisitCallbacks } from './types';
|
|
4
3
|
export declare class RequestParams {
|
|
5
4
|
protected callbacks: {
|
|
6
5
|
name: keyof VisitCallbacks;
|
|
@@ -12,6 +11,8 @@ export declare class RequestParams {
|
|
|
12
11
|
data(): import("./types").RequestPayload | null;
|
|
13
12
|
queryParams(): import("./types").RequestPayload;
|
|
14
13
|
isPartial(): boolean;
|
|
14
|
+
isPrefetch(): boolean;
|
|
15
|
+
isDeferredPropsRequest(): boolean;
|
|
15
16
|
onCancelToken(cb: VoidFunction): void;
|
|
16
17
|
markAsFinished(): void;
|
|
17
18
|
markAsCancelled({ cancelled, interrupted }: {
|
|
@@ -23,12 +24,13 @@ export declare class RequestParams {
|
|
|
23
24
|
onStart(): void;
|
|
24
25
|
onPrefetching(): void;
|
|
25
26
|
onPrefetchResponse(response: Response): void;
|
|
27
|
+
onPrefetchError(error: Error): void;
|
|
26
28
|
all(): InternalActiveVisit;
|
|
27
|
-
headers():
|
|
29
|
+
headers(): HttpRequestHeaders;
|
|
28
30
|
setPreserveOptions(page: Page): void;
|
|
29
31
|
runCallbacks(): void;
|
|
30
32
|
merge(toMerge: Partial<ActiveVisit>): void;
|
|
31
33
|
protected wrapCallback(params: ActiveVisit, name: keyof VisitCallbacks): (...args: any[]) => void;
|
|
32
34
|
protected recordCallback(name: keyof VisitCallbacks, args: any[]): void;
|
|
33
|
-
|
|
35
|
+
static resolvePreserveOption(value: PreserveStateOption, page: Page): boolean;
|
|
34
36
|
}
|
package/types/requestStream.d.ts
CHANGED
|
@@ -9,10 +9,14 @@ export declare class RequestStream {
|
|
|
9
9
|
});
|
|
10
10
|
send(request: Request): void;
|
|
11
11
|
interruptInFlight(): void;
|
|
12
|
-
cancelInFlight(
|
|
13
|
-
|
|
12
|
+
cancelInFlight({ prefetch, optimistic }?: {
|
|
13
|
+
prefetch?: boolean | undefined;
|
|
14
|
+
optimistic?: boolean | undefined;
|
|
15
|
+
}): void;
|
|
16
|
+
protected cancel({ cancelled, interrupted }?: {
|
|
14
17
|
cancelled?: boolean | undefined;
|
|
15
18
|
interrupted?: boolean | undefined;
|
|
16
|
-
}
|
|
17
|
-
protected shouldCancel(
|
|
19
|
+
}, force?: boolean): void;
|
|
20
|
+
protected shouldCancel(): boolean;
|
|
21
|
+
hasPendingOptimistic(): boolean;
|
|
18
22
|
}
|
package/types/response.d.ts
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import { AxiosResponse } from 'axios';
|
|
2
1
|
import { RequestParams } from './requestParams';
|
|
3
|
-
import {
|
|
2
|
+
import type { Router } from './router';
|
|
3
|
+
import { ActiveVisit, ErrorBag, Errors, HttpResponse, Page, PageProps } from './types';
|
|
4
4
|
export declare class Response {
|
|
5
5
|
protected requestParams: RequestParams;
|
|
6
|
-
protected response:
|
|
6
|
+
protected response: HttpResponse;
|
|
7
7
|
protected originatingPage: Page;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
protected router?: Router | undefined;
|
|
9
|
+
protected wasPrefetched: boolean;
|
|
10
|
+
protected processed: boolean;
|
|
11
|
+
constructor(requestParams: RequestParams, response: HttpResponse, originatingPage: Page, router?: Router | undefined);
|
|
12
|
+
static create(params: RequestParams, response: HttpResponse, originatingPage: Page, router?: Router): Response;
|
|
13
|
+
isProcessed(): boolean;
|
|
10
14
|
handlePrefetch(): Promise<void>;
|
|
11
15
|
handle(): Promise<void>;
|
|
12
16
|
process(): Promise<boolean | void>;
|
|
13
17
|
mergeParams(params: ActiveVisit): void;
|
|
18
|
+
getPageResponse(): Page;
|
|
14
19
|
protected handleNonInertiaResponse(): Promise<boolean | void>;
|
|
15
20
|
protected isInertiaResponse(): boolean;
|
|
21
|
+
protected isHttpException(): boolean;
|
|
16
22
|
protected hasStatus(status: number): boolean;
|
|
17
23
|
protected getHeader(header: string): string;
|
|
18
24
|
protected hasHeader(header: string): boolean;
|
|
25
|
+
protected isInertiaRedirect(): boolean;
|
|
19
26
|
protected isLocationVisit(): boolean;
|
|
20
27
|
/**
|
|
21
28
|
* @link https://inertiajs.com/redirects#external-redirects
|
|
@@ -25,7 +32,23 @@ export declare class Response {
|
|
|
25
32
|
protected getDataFromResponse(response: any): any;
|
|
26
33
|
protected shouldSetPage(pageResponse: Page): boolean;
|
|
27
34
|
protected pageUrl(pageResponse: Page): string;
|
|
35
|
+
protected preserveOptimisticProps(pageResponse: Page): void;
|
|
36
|
+
protected preserveEqualProps(pageResponse: Page): void;
|
|
28
37
|
protected mergeProps(pageResponse: Page): void;
|
|
38
|
+
protected mergeRescuedProps(pageResponse: Page): string[];
|
|
39
|
+
/**
|
|
40
|
+
* By default, the Laravel adapter shares validation errors via Inertia::always(),
|
|
41
|
+
* so responses always include errors, even when empty. Components like
|
|
42
|
+
* InfiniteScroll and WhenVisible, as well as loading deferred props,
|
|
43
|
+
* perform async requests that should practically never reset errors.
|
|
44
|
+
*/
|
|
45
|
+
protected shouldPreserveErrors(pageResponse: Page): boolean;
|
|
46
|
+
protected isObject(item: any): boolean;
|
|
47
|
+
protected deepMergeObjects(target: PageProps, source: PageProps): PageProps;
|
|
48
|
+
protected mergeOrMatchItems(existingItems: any[], newItems: any[], matchProp: string, matchPropsOn: string[], shouldAppend?: boolean): any[];
|
|
49
|
+
protected appendWithMatching(existingItems: any[], newItems: any[], newItemsMap: Map<any, any>, uniqueProperty: string): any[];
|
|
50
|
+
protected prependWithMatching(existingItems: any[], newItems: any[], newItemsMap: Map<any, any>, uniqueProperty: string): any[];
|
|
51
|
+
protected hasUniqueProperty(item: any, property: string): boolean;
|
|
29
52
|
protected setRememberedState(pageResponse: Page): Promise<void>;
|
|
30
53
|
protected getScopedErrors(errors: Errors & ErrorBag): Errors;
|
|
31
54
|
}
|
package/types/router.d.ts
CHANGED
|
@@ -1,50 +1,74 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CurrentPage } from './page';
|
|
1
|
+
import Queue from './queue';
|
|
3
2
|
import { RequestStream } from './requestStream';
|
|
4
|
-
import { ActiveVisit, ClientSideVisitOptions, GlobalEvent, GlobalEventNames, GlobalEventResult, InFlightPrefetch,
|
|
3
|
+
import { ActiveVisit, ClientSideVisitOptions, Component, FlashData, GlobalEvent, GlobalEventNames, GlobalEventResult, InFlightPrefetch, OptimisticCallback, Page, PageFlashData, PendingVisit, PollOptions, PrefetchedResponse, PrefetchOptions, ReloadOptions, RequestPayload, RouterInitParams, UrlMethodPair, VisitCallbacks, VisitHelperOptions, VisitOptions } from './types';
|
|
5
4
|
export declare class Router {
|
|
6
|
-
|
|
7
|
-
currentPage: CurrentPage;
|
|
5
|
+
readonly frameId: string;
|
|
8
6
|
protected syncRequestStream: RequestStream;
|
|
9
7
|
protected asyncRequestStream: RequestStream;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}):
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
get<T extends RequestPayload = RequestPayload>(url: URL | string, data?: T, options?: VisitHelperOptions<T>): void;
|
|
19
|
-
post<T extends RequestPayload = RequestPayload>(url: URL | string, data?: T, options?: VisitHelperOptions<T>): void;
|
|
20
|
-
put<T extends RequestPayload = RequestPayload>(url: URL | string, data?: T, options?: VisitHelperOptions<T>): void;
|
|
21
|
-
patch<T extends RequestPayload = RequestPayload>(url: URL | string, data?: T, options?: VisitHelperOptions<T>): void;
|
|
22
|
-
delete<T extends RequestPayload = RequestPayload>(url: URL | string, options?: Omit<VisitOptions<T>, 'method'>): void;
|
|
8
|
+
protected clientVisitQueue: Queue<Promise<void>>;
|
|
9
|
+
protected pendingOptimisticCallback: OptimisticCallback | undefined;
|
|
10
|
+
protected removePopstateHandler?: VoidFunction;
|
|
11
|
+
protected removePageshowHandler?: VoidFunction;
|
|
12
|
+
constructor(frameId?: string);
|
|
13
|
+
init<ComponentType = Component>({ initialPage, resolveComponent, swapComponent, onFlash, }: RouterInitParams<ComponentType>): void;
|
|
14
|
+
protected handleHistoryPopstate(state: any): void;
|
|
15
|
+
optimistic<TProps>(callback: OptimisticCallback<TProps>): this;
|
|
16
|
+
get<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, data?: T, options?: VisitHelperOptions<T>): void;
|
|
17
|
+
post<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, data?: T, options?: VisitHelperOptions<T>): void;
|
|
18
|
+
put<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, data?: T, options?: VisitHelperOptions<T>): void;
|
|
19
|
+
patch<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, data?: T, options?: VisitHelperOptions<T>): void;
|
|
20
|
+
delete<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, options?: Omit<VisitOptions<T>, 'method'>): void;
|
|
23
21
|
reload<T extends RequestPayload = RequestPayload>(options?: ReloadOptions<T>): void;
|
|
22
|
+
protected doReload<T extends RequestPayload = RequestPayload>(options?: ReloadOptions<T> & {
|
|
23
|
+
deferredProps?: boolean;
|
|
24
|
+
}): void;
|
|
24
25
|
remember(data: unknown, key?: string): void;
|
|
25
|
-
restore(key?: string):
|
|
26
|
+
restore<T = unknown>(key?: string): T | undefined;
|
|
26
27
|
on<TEventName extends GlobalEventNames>(type: TEventName, callback: (event: GlobalEvent<TEventName>) => GlobalEventResult<TEventName>): VoidFunction;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
once<TEventName extends GlobalEventNames>(type: TEventName, callback: (event: GlobalEvent<TEventName>) => GlobalEventResult<TEventName>): VoidFunction;
|
|
29
|
+
hasPendingOptimistic(): boolean;
|
|
30
|
+
get activePolls(): number;
|
|
31
|
+
cancelAll({ async, prefetch, sync }?: {
|
|
32
|
+
async?: boolean | undefined;
|
|
33
|
+
prefetch?: boolean | undefined;
|
|
34
|
+
sync?: boolean | undefined;
|
|
35
|
+
}): void;
|
|
36
|
+
/**
|
|
37
|
+
* Clean up all resources held by this router instance. Call this when the
|
|
38
|
+
* frame that owns this router is unmounted. Safe to call multiple times.
|
|
39
|
+
*/
|
|
40
|
+
destroy(): void;
|
|
41
|
+
poll(interval: number, requestOptions?: ReloadOptions | (() => ReloadOptions), options?: PollOptions): {
|
|
30
42
|
stop: VoidFunction;
|
|
31
43
|
start: VoidFunction;
|
|
44
|
+
destroy: VoidFunction;
|
|
32
45
|
};
|
|
33
|
-
visit<T extends RequestPayload = RequestPayload>(href: string | URL, options?: VisitOptions<T>): void;
|
|
34
|
-
getCached(href: string | URL, options?: VisitOptions): InFlightPrefetch | PrefetchedResponse | null;
|
|
35
|
-
flush(href: string | URL, options?: VisitOptions): void;
|
|
46
|
+
visit<T extends RequestPayload = RequestPayload>(href: string | URL | UrlMethodPair, options?: VisitOptions<T>): void;
|
|
47
|
+
getCached(href: string | URL | UrlMethodPair, options?: VisitOptions): InFlightPrefetch | PrefetchedResponse | null;
|
|
48
|
+
flush(href: string | URL | UrlMethodPair, options?: VisitOptions): void;
|
|
36
49
|
flushAll(): void;
|
|
37
|
-
|
|
38
|
-
|
|
50
|
+
flushByCacheTags(tags: string | string[]): void;
|
|
51
|
+
getPrefetching(href: string | URL | UrlMethodPair, options?: VisitOptions): InFlightPrefetch | PrefetchedResponse | null;
|
|
52
|
+
prefetch(href: string | URL | UrlMethodPair, options?: VisitOptions, prefetchOptions?: Partial<PrefetchOptions>): void;
|
|
39
53
|
clearHistory(): void;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
decryptHistory(): Promise<Page>;
|
|
55
|
+
resolveComponent(component: string, page?: Page): Promise<Component>;
|
|
56
|
+
replace<TProps = Page['props']>(params: ClientSideVisitOptions<TProps>): void;
|
|
57
|
+
replaceProp<TProps = Page['props']>(name: string, value: unknown | ((oldValue: unknown, props: TProps) => unknown), options?: Pick<ClientSideVisitOptions, 'onError' | 'onFinish' | 'onSuccess'>): void;
|
|
58
|
+
appendToProp<TProps = Page['props']>(name: string, value: unknown | unknown[] | ((oldValue: unknown, props: TProps) => unknown | unknown[]), options?: Pick<ClientSideVisitOptions, 'onError' | 'onFinish' | 'onSuccess'>): void;
|
|
59
|
+
prependToProp<TProps = Page['props']>(name: string, value: unknown | unknown[] | ((oldValue: unknown, props: TProps) => unknown | unknown[]), options?: Pick<ClientSideVisitOptions, 'onError' | 'onFinish' | 'onSuccess'>): void;
|
|
60
|
+
push<TProps = Page['props']>(params: ClientSideVisitOptions<TProps>): void;
|
|
61
|
+
flash<TFlash extends PageFlashData = PageFlashData>(keyOrData: string | ((flash: FlashData) => TFlash) | TFlash, value?: unknown): void;
|
|
62
|
+
protected clientVisit<TProps = Page['props']>(params: ClientSideVisitOptions<TProps>, { replace }?: {
|
|
44
63
|
replace?: boolean;
|
|
45
64
|
}): void;
|
|
46
|
-
protected
|
|
47
|
-
|
|
65
|
+
protected performClientVisit<TProps = Page['props']>(params: ClientSideVisitOptions<TProps>, { replace }?: {
|
|
66
|
+
replace?: boolean;
|
|
67
|
+
}): Promise<void>;
|
|
68
|
+
protected performInstantSwap(visit: PendingVisit): Promise<void>;
|
|
69
|
+
protected getPrefetchParams(href: string | URL | UrlMethodPair, options: VisitOptions): ActiveVisit;
|
|
70
|
+
protected getPendingVisit(href: string | URL | UrlMethodPair, options: VisitOptions): PendingVisit;
|
|
48
71
|
protected getVisitEvents(options: VisitOptions): VisitCallbacks;
|
|
49
|
-
protected
|
|
72
|
+
protected applyOptimisticUpdate(optimistic: OptimisticCallback, events: VisitCallbacks): void;
|
|
73
|
+
protected loadDeferredProps(deferred: Page['deferredProps']): void;
|
|
50
74
|
}
|
package/types/scroll.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { ScrollRegion } from './types';
|
|
2
2
|
export declare class Scroll {
|
|
3
|
-
static save(): void;
|
|
3
|
+
static save(frameId?: string): void;
|
|
4
|
+
static getScrollRegions(): ScrollRegion[];
|
|
4
5
|
protected static regions(): NodeListOf<Element>;
|
|
5
|
-
static
|
|
6
|
-
static
|
|
7
|
-
static
|
|
6
|
+
static scrollToTop(): void;
|
|
7
|
+
static reset(): void;
|
|
8
|
+
static scrollToAnchor(): void;
|
|
9
|
+
static restore(scrollRegions: ScrollRegion[], frameId?: string): void;
|
|
10
|
+
static restoreScrollRegions(scrollRegions: ScrollRegion[]): void;
|
|
11
|
+
static restoreDocument(frameId?: string): void;
|
|
8
12
|
static onScroll(event: Event): void;
|
|
9
|
-
static onWindowScroll(): void;
|
|
13
|
+
static onWindowScroll(frameId?: string): void;
|
|
10
14
|
}
|
package/types/server.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { InertiaAppResponse, Page } from './types';
|
|
|
2
2
|
type AppCallback = (page: Page) => InertiaAppResponse;
|
|
3
3
|
type ServerOptions = {
|
|
4
4
|
port?: number;
|
|
5
|
+
host?: string;
|
|
5
6
|
cluster?: boolean;
|
|
7
|
+
formatErrors?: boolean;
|
|
6
8
|
};
|
|
7
9
|
type Port = number;
|
|
8
|
-
declare const _default: (render: AppCallback, options?: Port | ServerOptions) =>
|
|
10
|
+
declare const _default: (render: AppCallback, options?: Port | ServerOptions) => AppCallback;
|
|
9
11
|
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR Error Classification
|
|
3
|
+
*
|
|
4
|
+
* This module detects common SSR errors and provides helpful hints
|
|
5
|
+
* to developers on how to fix them. The most common issue is using
|
|
6
|
+
* browser-specific APIs (like window, document) that don't exist
|
|
7
|
+
* in the Node.js server environment.
|
|
8
|
+
*/
|
|
9
|
+
export type SSRErrorType = 'browser-api' | 'component-resolution' | 'render' | 'unknown';
|
|
10
|
+
type SourceMapResolver = (file: string, line: number, column: number) => {
|
|
11
|
+
file: string;
|
|
12
|
+
line: number;
|
|
13
|
+
column: number;
|
|
14
|
+
} | null;
|
|
15
|
+
export declare function setSourceMapResolver(resolver: SourceMapResolver | null): void;
|
|
16
|
+
export interface ClassifiedSSRError {
|
|
17
|
+
error: string;
|
|
18
|
+
type: SSRErrorType;
|
|
19
|
+
component?: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
browserApi?: string;
|
|
22
|
+
hint: string;
|
|
23
|
+
stack?: string;
|
|
24
|
+
sourceLocation?: string;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function classifySSRError(error: Error, component?: string, url?: string): ClassifiedSSRError;
|
|
28
|
+
export declare function formatConsoleError(classified: ClassifiedSSRError, root?: string, formatErrors?: boolean, suppressedWarnings?: string[]): string;
|
|
29
|
+
export {};
|
package/types/time.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { CacheForOption } from './types';
|
|
2
|
+
export declare const timeToMs: (time: CacheForOption) => number;
|