@inertiajs/core 2.3.22 → 2.3.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inertiajs/core",
3
- "version": "2.3.22",
3
+ "version": "2.3.24",
4
4
  "license": "MIT",
5
5
  "description": "A framework for creating server-driven single page apps.",
6
6
  "contributors": [
@@ -1,10 +1,19 @@
1
1
  import { UseInfiniteScrollDataManager } from '../types';
2
+ export type InfiniteScrollPageIdentifier = string | number | null;
3
+ export type InfiniteScrollOnCompleteDetails = {
4
+ page: InfiniteScrollPageIdentifier;
5
+ completed: boolean;
6
+ };
2
7
  export declare const useInfiniteScrollData: (options: {
3
8
  getPropName: () => string;
4
9
  onBeforeUpdate: () => void;
5
10
  onBeforePreviousRequest: () => void;
6
11
  onBeforeNextRequest: () => void;
7
- onCompletePreviousRequest: (loadedPage: string | number | null) => void;
8
- onCompleteNextRequest: (loadedPage: string | number | null) => void;
12
+ onCompletePreviousRequest: (
13
+ /** @deprecated Use `details.page` instead. */
14
+ loadedPage: InfiniteScrollPageIdentifier, details: InfiniteScrollOnCompleteDetails) => void;
15
+ onCompleteNextRequest: (
16
+ /** @deprecated Use `details.page` instead. */
17
+ loadedPage: InfiniteScrollPageIdentifier, details: InfiniteScrollOnCompleteDetails) => void;
9
18
  onReset?: () => void;
10
19
  }) => UseInfiniteScrollDataManager;
package/types/modal.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  declare const _default: {
2
2
  modal: null;
3
3
  listener: null;
4
+ previousBodyOverflow: null;
4
5
  createIframeAndPage(html: Record<string, unknown> | string): {
5
6
  iframe: HTMLIFrameElement;
6
7
  page: HTMLElement;
@@ -1 +1,2 @@
1
+ export declare const stripTopLevelUndefined: <T extends Record<string, unknown>>(obj: T) => T;
1
2
  export declare const objectsAreEqual: <T extends Record<string, any>>(obj1: T, obj2: T, excludeKeys: { [K in keyof T]: K; }[keyof T][]) => boolean;
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 id: number | null;
8
+ protected intervalId: number | null;
9
+ protected timeoutId: number | null;
4
10
  protected throttle: boolean;
5
11
  protected keepAlive: boolean;
6
- protected cb: VoidFunction;
12
+ protected cb: PollCallback;
7
13
  protected interval: number;
8
14
  protected cbCount: number;
9
- constructor(interval: number, cb: VoidFunction, options: PollOptions);
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
- add(interval: number, cb: VoidFunction, options: PollOptions): {
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/router.d.ts CHANGED
@@ -22,14 +22,16 @@ export declare class Router {
22
22
  * @deprecated Use cancelAll() instead.
23
23
  */
24
24
  cancel(): void;
25
+ get activePolls(): number;
25
26
  cancelAll({ async, prefetch, sync }?: {
26
27
  async?: boolean | undefined;
27
28
  prefetch?: boolean | undefined;
28
29
  sync?: boolean | undefined;
29
30
  }): void;
30
- poll(interval: number, requestOptions?: ReloadOptions, options?: PollOptions): {
31
+ poll(interval: number, requestOptions?: ReloadOptions | (() => ReloadOptions), options?: PollOptions): {
31
32
  stop: VoidFunction;
32
33
  start: VoidFunction;
34
+ destroy: VoidFunction;
33
35
  };
34
36
  visit<T extends RequestPayload = RequestPayload>(href: string | URL | UrlMethodPair, options?: VisitOptions<T>): void;
35
37
  getCached(href: string | URL | UrlMethodPair, options?: VisitOptions): InFlightPrefetch | PrefetchedResponse | null;
package/types/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AxiosProgressEvent, AxiosResponse } from 'axios';
2
2
  import { NamedInputEvent, ValidationConfig, Validator } from 'laravel-precognition';
3
+ import { InfiniteScrollOnCompleteDetails, InfiniteScrollPageIdentifier } from './infiniteScroll/data';
3
4
  import { Response } from './response';
4
5
  declare module 'axios' {
5
6
  interface AxiosProgressEvent {
@@ -83,9 +84,9 @@ export interface PageProps {
83
84
  }
84
85
  export type ScrollProp = {
85
86
  pageName: string;
86
- previousPage: number | string | null;
87
- nextPage: number | string | null;
88
- currentPage: number | string | null;
87
+ previousPage: InfiniteScrollPageIdentifier;
88
+ nextPage: InfiniteScrollPageIdentifier;
89
+ currentPage: InfiniteScrollPageIdentifier;
89
90
  reset: boolean;
90
91
  };
91
92
  export interface Page<SharedProps extends PageProps = PageProps> {
@@ -298,6 +299,7 @@ export type ReloadOptions<T extends RequestPayload = RequestPayload> = Omit<Visi
298
299
  export type PollOptions = {
299
300
  keepAlive?: boolean;
300
301
  autoStart?: boolean;
302
+ mode?: 'overlap' | 'cancel' | 'rest';
301
303
  };
302
304
  export type VisitHelperOptions<T extends RequestPayload = RequestPayload> = Omit<VisitOptions<T>, 'method' | 'data'>;
303
305
  export type RouterInitParams<ComponentType = Component> = {
@@ -507,12 +509,12 @@ export interface UseInfiniteScrollOptions {
507
509
  getScrollableParent: () => HTMLElement | null;
508
510
  onBeforePreviousRequest: () => void;
509
511
  onBeforeNextRequest: () => void;
510
- onCompletePreviousRequest: () => void;
511
- onCompleteNextRequest: () => void;
512
+ onCompletePreviousRequest: (details: InfiniteScrollOnCompleteDetails) => void;
513
+ onCompleteNextRequest: (details: InfiniteScrollOnCompleteDetails) => void;
512
514
  onDataReset?: () => void;
513
515
  }
514
516
  export interface UseInfiniteScrollDataManager {
515
- getLastLoadedPage: () => number | string | null;
517
+ getLastLoadedPage: () => InfiniteScrollPageIdentifier;
516
518
  getPageName: () => string;
517
519
  getRequestCount: () => number;
518
520
  hasPrevious: () => boolean;
@@ -528,7 +530,7 @@ export interface UseInfiniteScrollElementManager {
528
530
  refreshTriggers: () => void;
529
531
  flushAll: () => void;
530
532
  processManuallyAddedElements: () => void;
531
- processServerLoadedElements: (loadedPage: string | number | null) => void;
533
+ processServerLoadedElements: (loadedPage: InfiniteScrollPageIdentifier) => void;
532
534
  }
533
535
  export interface UseInfiniteScrollProps {
534
536
  dataManager: UseInfiniteScrollDataManager;