@inertiajs/core 2.2.19 → 2.2.20
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 +597 -502
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +802 -707
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/types/domUtils.d.ts +1 -0
- package/types/index.d.ts +1 -1
- package/types/page.d.ts +4 -0
- package/types/prefetched.d.ts +3 -1
- package/types/requestParams.d.ts +1 -0
- package/types/response.d.ts +1 -0
- package/types/router.d.ts +8 -0
- package/types/types.d.ts +7 -0
package/package.json
CHANGED
package/types/domUtils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const getScrollableParent: (element: HTMLElement | null) => HTMLElement | null;
|
|
2
2
|
export declare const getElementsInViewportFromCollection: (elements: HTMLElement[], referenceElement?: HTMLElement) => HTMLElement[];
|
|
3
3
|
export declare const requestAnimationFrame: (cb: () => void, times?: number) => void;
|
|
4
|
+
export declare const getInitialPageFromDOM: <T>(id: string, useScriptElement?: boolean) => T | null;
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Config } from './config';
|
|
2
2
|
import { Router } from './router';
|
|
3
3
|
export { config } from './config';
|
|
4
|
-
export { getScrollableParent } from './domUtils';
|
|
4
|
+
export { getInitialPageFromDOM, getScrollableParent } from './domUtils';
|
|
5
5
|
export { objectToFormData } from './formData';
|
|
6
6
|
export { formDataToObject } from './formObject';
|
|
7
7
|
export { default as createHeadManager } from './head';
|
package/types/page.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare class CurrentPage {
|
|
|
24
24
|
clear(): void;
|
|
25
25
|
isCleared(): boolean;
|
|
26
26
|
get(): Page;
|
|
27
|
+
hasOnceProps(): boolean;
|
|
27
28
|
merge(data: Partial<Page>): void;
|
|
28
29
|
setUrlHash(hash: string): void;
|
|
29
30
|
remember(data: Page['rememberedState']): void;
|
|
@@ -37,6 +38,9 @@ declare class CurrentPage {
|
|
|
37
38
|
isTheSame(page: Page): boolean;
|
|
38
39
|
on(event: PageEvent, callback: VoidFunction): VoidFunction;
|
|
39
40
|
fireEventsFor(event: PageEvent): void;
|
|
41
|
+
mergeOncePropsIntoResponse(response: Page, { force }?: {
|
|
42
|
+
force?: boolean;
|
|
43
|
+
}): void;
|
|
40
44
|
}
|
|
41
45
|
export declare const page: CurrentPage;
|
|
42
46
|
export {};
|
package/types/prefetched.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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[];
|
|
@@ -21,6 +21,8 @@ declare class PrefetchedRequests {
|
|
|
21
21
|
findInFlight(params: ActiveVisit): InFlightPrefetch | null;
|
|
22
22
|
protected withoutPurposePrefetchHeader(params: ActiveVisit): ActiveVisit;
|
|
23
23
|
protected paramsAreEqual(params1: ActiveVisit, params2: ActiveVisit): boolean;
|
|
24
|
+
updateCachedOncePropsFromCurrentPage(): void;
|
|
25
|
+
protected getShortestOncePropTtl(page: Page): number | null;
|
|
24
26
|
}
|
|
25
27
|
export declare const prefetchedRequests: PrefetchedRequests;
|
|
26
28
|
export {};
|
package/types/requestParams.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class RequestParams {
|
|
|
12
12
|
data(): import("./types").RequestPayload | null;
|
|
13
13
|
queryParams(): import("./types").RequestPayload;
|
|
14
14
|
isPartial(): boolean;
|
|
15
|
+
isDeferredPropsRequest(): boolean;
|
|
15
16
|
onCancelToken(cb: VoidFunction): void;
|
|
16
17
|
markAsFinished(): void;
|
|
17
18
|
markAsCancelled({ cancelled, interrupted }: {
|
package/types/response.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class Response {
|
|
|
12
12
|
handle(): Promise<void>;
|
|
13
13
|
process(): Promise<boolean | void>;
|
|
14
14
|
mergeParams(params: ActiveVisit): void;
|
|
15
|
+
getPageResponse(): Page;
|
|
15
16
|
protected handleNonInertiaResponse(): Promise<boolean | void>;
|
|
16
17
|
protected isInertiaResponse(): boolean;
|
|
17
18
|
protected hasStatus(status: number): boolean;
|
package/types/router.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import Queue from './queue';
|
|
1
2
|
import { RequestStream } from './requestStream';
|
|
2
3
|
import { ActiveVisit, ClientSideVisitOptions, Component, GlobalEvent, GlobalEventNames, GlobalEventResult, InFlightPrefetch, Page, PendingVisit, PendingVisitOptions, PollOptions, PrefetchedResponse, PrefetchOptions, ReloadOptions, RequestPayload, RouterInitParams, UrlMethodPair, VisitCallbacks, VisitHelperOptions, VisitOptions } from './types';
|
|
3
4
|
export declare class Router {
|
|
4
5
|
protected syncRequestStream: RequestStream;
|
|
5
6
|
protected asyncRequestStream: RequestStream;
|
|
7
|
+
protected clientVisitQueue: Queue<Promise<void>>;
|
|
6
8
|
init<ComponentType = Component>({ initialPage, resolveComponent, swapComponent, }: RouterInitParams<ComponentType>): void;
|
|
7
9
|
get<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, data?: T, options?: VisitHelperOptions<T>): void;
|
|
8
10
|
post<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, data?: T, options?: VisitHelperOptions<T>): void;
|
|
@@ -10,6 +12,9 @@ export declare class Router {
|
|
|
10
12
|
patch<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, data?: T, options?: VisitHelperOptions<T>): void;
|
|
11
13
|
delete<T extends RequestPayload = RequestPayload>(url: URL | string | UrlMethodPair, options?: Omit<VisitOptions<T>, 'method'>): void;
|
|
12
14
|
reload<T extends RequestPayload = RequestPayload>(options?: ReloadOptions<T>): void;
|
|
15
|
+
protected doReload<T extends RequestPayload = RequestPayload>(options?: ReloadOptions<T> & {
|
|
16
|
+
deferredProps?: boolean;
|
|
17
|
+
}): void;
|
|
13
18
|
remember(data: unknown, key?: string): void;
|
|
14
19
|
restore<T = unknown>(key?: string): T | undefined;
|
|
15
20
|
on<TEventName extends GlobalEventNames>(type: TEventName, callback: (event: GlobalEvent<TEventName>) => GlobalEventResult<TEventName>): VoidFunction;
|
|
@@ -37,6 +42,9 @@ export declare class Router {
|
|
|
37
42
|
protected clientVisit<TProps = Page['props']>(params: ClientSideVisitOptions<TProps>, { replace }?: {
|
|
38
43
|
replace?: boolean;
|
|
39
44
|
}): void;
|
|
45
|
+
protected performClientVisit<TProps = Page['props']>(params: ClientSideVisitOptions<TProps>, { replace }?: {
|
|
46
|
+
replace?: boolean;
|
|
47
|
+
}): Promise<void>;
|
|
40
48
|
protected getPrefetchParams(href: string | URL | UrlMethodPair, options: VisitOptions): ActiveVisit;
|
|
41
49
|
protected getPendingVisit(href: string | URL | UrlMethodPair, options: VisitOptions, pendingVisitOptions?: Partial<PendingVisitOptions>): PendingVisit;
|
|
42
50
|
protected getVisitEvents(options: VisitOptions): VisitCallbacks;
|
package/types/types.d.ts
CHANGED
|
@@ -93,6 +93,10 @@ export interface Page<SharedProps extends PageProps = PageProps> {
|
|
|
93
93
|
deepMergeProps?: string[];
|
|
94
94
|
matchPropsOn?: string[];
|
|
95
95
|
scrollProps?: Record<keyof PageProps, ScrollProp>;
|
|
96
|
+
onceProps?: Record<string, {
|
|
97
|
+
prop: keyof PageProps;
|
|
98
|
+
expiresAt?: number | null;
|
|
99
|
+
}>;
|
|
96
100
|
/** @internal */
|
|
97
101
|
rememberedState: Record<string, unknown>;
|
|
98
102
|
}
|
|
@@ -289,6 +293,7 @@ export type ActiveVisit<T extends RequestPayload = RequestPayload> = PendingVisi
|
|
|
289
293
|
export type InternalActiveVisit = ActiveVisit & {
|
|
290
294
|
onPrefetchResponse?: (response: Response) => void;
|
|
291
295
|
onPrefetchError?: (error: Error) => void;
|
|
296
|
+
deferredProps?: boolean;
|
|
292
297
|
};
|
|
293
298
|
export type VisitId = unknown;
|
|
294
299
|
export type Component = unknown;
|
|
@@ -352,6 +357,7 @@ export type InertiaAppConfig = {
|
|
|
352
357
|
preserveEqualProps: boolean;
|
|
353
358
|
useDataInertiaHeadAttribute: boolean;
|
|
354
359
|
useDialogForErrorModal: boolean;
|
|
360
|
+
useScriptElementForInitialPage: boolean;
|
|
355
361
|
};
|
|
356
362
|
prefetch: {
|
|
357
363
|
cacheFor: CacheForOption | CacheForOption[];
|
|
@@ -381,6 +387,7 @@ export type PrefetchCancellationToken = {
|
|
|
381
387
|
export type PrefetchedResponse = PrefetchObject & {
|
|
382
388
|
staleTimestamp: number;
|
|
383
389
|
timestamp: number;
|
|
390
|
+
expiresAt: number;
|
|
384
391
|
singleUse: boolean;
|
|
385
392
|
inFlight: false;
|
|
386
393
|
tags: string[];
|