@inertiajs/core 3.0.0-beta.2 → 3.0.0-beta.3
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 +81 -42
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/types/page.d.ts +15 -2
- package/types/types.d.ts +12 -9
package/package.json
CHANGED
package/types/page.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ declare class CurrentPage {
|
|
|
13
13
|
protected cleared: boolean;
|
|
14
14
|
protected pendingDeferredProps: Pick<Page, 'deferredProps' | 'url' | 'component'> | null;
|
|
15
15
|
protected historyQuotaExceeded: boolean;
|
|
16
|
+
protected optimisticBaseline: Partial<Page['props']>;
|
|
17
|
+
protected pendingOptimistics: {
|
|
18
|
+
id: number;
|
|
19
|
+
callback: (props: Page['props']) => Partial<Page['props']> | void;
|
|
20
|
+
}[];
|
|
21
|
+
protected optimisticCounter: number;
|
|
16
22
|
init<ComponentType = Component>({ initialPage, swapComponent, resolveComponent, onFlash, }: RouterInitParams<ComponentType>): this;
|
|
17
23
|
set(page: Page, { replace, preserveScroll, preserveState, viewTransition, }?: {
|
|
18
24
|
replace?: boolean;
|
|
@@ -40,8 +46,15 @@ declare class CurrentPage {
|
|
|
40
46
|
viewTransition: Visit['viewTransition'];
|
|
41
47
|
}): Promise<unknown>;
|
|
42
48
|
resolve(component: string, page?: Page): Promise<Component>;
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
nextOptimisticId(): number;
|
|
50
|
+
setBaseline(key: string, value: unknown): void;
|
|
51
|
+
updateBaseline(key: string, value: unknown): void;
|
|
52
|
+
hasBaseline(key: string): boolean;
|
|
53
|
+
registerOptimistic(id: number, callback: (props: Page['props']) => Partial<Page['props']> | void): void;
|
|
54
|
+
unregisterOptimistic(id: number): void;
|
|
55
|
+
replayOptimistics(): Partial<Page['props']>;
|
|
56
|
+
pendingOptimisticCount(): number;
|
|
57
|
+
clearOptimisticState(): void;
|
|
45
58
|
isTheSame(page: Page): boolean;
|
|
46
59
|
on(event: PageEvent, callback: VoidFunction): VoidFunction;
|
|
47
60
|
fireEventsFor(event: PageEvent): void;
|
package/types/types.d.ts
CHANGED
|
@@ -48,6 +48,9 @@ export type DefaultInertiaConfig = {
|
|
|
48
48
|
* @see {@link DefaultInertiaConfig} for keys to override
|
|
49
49
|
* @example
|
|
50
50
|
* ```ts
|
|
51
|
+
* // global.d.ts
|
|
52
|
+
* import '@inertiajs/core'
|
|
53
|
+
*
|
|
51
54
|
* declare module '@inertiajs/core' {
|
|
52
55
|
* export interface InertiaConfig {
|
|
53
56
|
* errorValueType: string[]
|
|
@@ -159,9 +162,9 @@ export interface ClientSideVisitOptions<TProps = Page['props']> {
|
|
|
159
162
|
onError?: (errors: Errors) => void;
|
|
160
163
|
onFinish?: (visit: ClientSideVisitOptions<TProps>) => void;
|
|
161
164
|
onFlash?: (flash: FlashData) => void;
|
|
162
|
-
onSuccess?: (page: Page) => void;
|
|
165
|
+
onSuccess?: (page: Page<SharedPageProps>) => void;
|
|
163
166
|
}
|
|
164
|
-
export type PageResolver = (name: string, page?: Page) => Component;
|
|
167
|
+
export type PageResolver = (name: string, page?: Page<SharedPageProps>) => Component;
|
|
165
168
|
export type PageHandler<ComponentType = Component> = ({ component, page, preserveState, }: {
|
|
166
169
|
component: ComponentType;
|
|
167
170
|
page: Page;
|
|
@@ -238,23 +241,23 @@ export type GlobalEventsMap<T extends RequestPayload = RequestPayload> = {
|
|
|
238
241
|
result: void;
|
|
239
242
|
};
|
|
240
243
|
beforeUpdate: {
|
|
241
|
-
parameters: [Page];
|
|
244
|
+
parameters: [Page<SharedPageProps>];
|
|
242
245
|
details: {
|
|
243
|
-
page: Page
|
|
246
|
+
page: Page<SharedPageProps>;
|
|
244
247
|
};
|
|
245
248
|
result: void;
|
|
246
249
|
};
|
|
247
250
|
navigate: {
|
|
248
|
-
parameters: [Page];
|
|
251
|
+
parameters: [Page<SharedPageProps>];
|
|
249
252
|
details: {
|
|
250
|
-
page: Page
|
|
253
|
+
page: Page<SharedPageProps>;
|
|
251
254
|
};
|
|
252
255
|
result: void;
|
|
253
256
|
};
|
|
254
257
|
success: {
|
|
255
|
-
parameters: [Page];
|
|
258
|
+
parameters: [Page<SharedPageProps>];
|
|
256
259
|
details: {
|
|
257
|
-
page: Page
|
|
260
|
+
page: Page<SharedPageProps>;
|
|
258
261
|
};
|
|
259
262
|
result: void;
|
|
260
263
|
};
|
|
@@ -492,7 +495,7 @@ export type ProgressSettings = {
|
|
|
492
495
|
export type UrlMethodPair = {
|
|
493
496
|
url: string;
|
|
494
497
|
method: Method;
|
|
495
|
-
component?: string | string
|
|
498
|
+
component?: string | Record<string, string>;
|
|
496
499
|
};
|
|
497
500
|
export type UseFormTransformCallback<TForm> = (data: TForm) => object;
|
|
498
501
|
export type UseFormWithPrecognitionArguments = [Method | (() => Method), string | (() => string)] | [UrlMethodPair | (() => UrlMethodPair)];
|