@inertiajs/svelte 2.2.7 → 2.2.9
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/components/App.svelte.d.ts +3 -3
- package/dist/components/Form.svelte +1 -1
- package/dist/components/Form.svelte.d.ts +3 -5
- package/dist/components/InfiniteScroll.svelte +5 -5
- package/dist/components/InfiniteScroll.svelte.d.ts +2 -1
- package/dist/createInertiaApp.d.ts +7 -21
- package/dist/createInertiaApp.js +10 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/link.d.ts +3 -4
- package/dist/link.js +2 -2
- package/dist/page.d.ts +7 -5
- package/dist/page.js +4 -1
- package/dist/useForm.d.ts +4 -2
- package/dist/useForm.js +26 -20
- package/package.json +8 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { ComponentResolver, ResolvedComponent } from '../types';
|
|
3
|
-
import { type Page } from '@inertiajs/core';
|
|
4
|
-
export interface InertiaAppProps {
|
|
3
|
+
import { type Page, type PageProps } from '@inertiajs/core';
|
|
4
|
+
export interface InertiaAppProps<SharedProps extends PageProps = PageProps> {
|
|
5
5
|
initialComponent: ResolvedComponent;
|
|
6
|
-
initialPage: Page
|
|
6
|
+
initialPage: Page<SharedProps>;
|
|
7
7
|
resolveComponent: ComponentResolver;
|
|
8
8
|
}
|
|
9
9
|
declare const __propDef: {
|
|
@@ -34,7 +34,7 @@ const form = useForm({});
|
|
|
34
34
|
let formElement;
|
|
35
35
|
let isDirty = false;
|
|
36
36
|
let defaultData = new FormData();
|
|
37
|
-
$: _method = isUrlMethodPair(action) ? action.method : method.toLowerCase();
|
|
37
|
+
$: _method = isUrlMethodPair(action) ? action.method : (method ?? "get").toLowerCase();
|
|
38
38
|
$: _action = isUrlMethodPair(action) ? action.url : action;
|
|
39
39
|
function getFormData() {
|
|
40
40
|
return new FormData(formElement);
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type Errors, type FormDataConvertible } from '@inertiajs/core';
|
|
2
|
+
import { type Errors, type Method, type FormDataConvertible } from '@inertiajs/core';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
action?: string | import("@inertiajs/core").UrlMethodPair | undefined;
|
|
7
|
-
method?:
|
|
7
|
+
method?: Method | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
|
|
8
8
|
headers?: Record<string, string> | undefined;
|
|
9
9
|
queryStringArrayFormat?: "indices" | "brackets" | undefined;
|
|
10
10
|
errorBag?: string | null | undefined;
|
|
11
11
|
showProgress?: boolean | undefined;
|
|
12
12
|
transform?: ((data: Record<string, FormDataConvertible>) => Record<string, FormDataConvertible>) | undefined;
|
|
13
13
|
options?: import("@inertiajs/core").FormComponentOptions | undefined;
|
|
14
|
-
onCancelToken?: (
|
|
15
|
-
cancel: VoidFunction;
|
|
16
|
-
}) => void) | undefined;
|
|
14
|
+
onCancelToken?: import("@inertiajs/core").CancelTokenCallback | undefined;
|
|
17
15
|
onBefore?: import("@inertiajs/core").GlobalEventCallback<"before", import("@inertiajs/core").RequestPayload> | undefined;
|
|
18
16
|
onStart?: import("@inertiajs/core").GlobalEventCallback<"start", import("@inertiajs/core").RequestPayload> | undefined;
|
|
19
17
|
onProgress?: import("@inertiajs/core").GlobalEventCallback<"progress", import("@inertiajs/core").RequestPayload> | undefined;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
useInfiniteScroll
|
|
4
4
|
} from "@inertiajs/core";
|
|
5
5
|
import { onDestroy, onMount } from "svelte";
|
|
6
|
-
export let data
|
|
6
|
+
export let data;
|
|
7
7
|
export let buffer = 0;
|
|
8
8
|
export let as = "div";
|
|
9
9
|
export let manual = false;
|
|
@@ -99,12 +99,12 @@ function setupInfiniteScrollInstance() {
|
|
|
99
99
|
infiniteScrollInstance = useInfiniteScroll({
|
|
100
100
|
// Data
|
|
101
101
|
getPropName: () => data,
|
|
102
|
-
inReverseMode: () => reverse,
|
|
102
|
+
inReverseMode: () => reverse ?? false,
|
|
103
103
|
shouldFetchNext: () => !onlyPrevious,
|
|
104
104
|
shouldFetchPrevious: () => !onlyNext,
|
|
105
|
-
shouldPreserveUrl: () => preserveUrl,
|
|
105
|
+
shouldPreserveUrl: () => preserveUrl ?? false,
|
|
106
106
|
// Elements
|
|
107
|
-
getTriggerMargin: () => buffer,
|
|
107
|
+
getTriggerMargin: () => buffer ?? 0,
|
|
108
108
|
getStartElement: () => resolvedStartElement,
|
|
109
109
|
getEndElement: () => resolvedEndElement,
|
|
110
110
|
getItemsElement: () => resolvedItemsElement2,
|
|
@@ -130,7 +130,7 @@ function setupInfiniteScrollInstance() {
|
|
|
130
130
|
scrollToBottom();
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
$: manualMode = manual || manualAfter > 0 && requestCount >= manualAfter;
|
|
133
|
+
$: manualMode = manual || manualAfter !== void 0 && manualAfter > 0 && requestCount >= manualAfter;
|
|
134
134
|
$: autoLoad = !manualMode;
|
|
135
135
|
$: headerAutoMode = autoLoad && !onlyNext;
|
|
136
136
|
$: footerAutoMode = autoLoad && !onlyPrevious;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type InfiniteScrollComponentBaseProps } from '@inertiajs/core';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
[x: string]: any;
|
|
5
|
-
data
|
|
6
|
+
data: InfiniteScrollComponentBaseProps["data"];
|
|
6
7
|
buffer?: number | undefined;
|
|
7
8
|
as?: string | undefined;
|
|
8
9
|
manual?: boolean | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type InertiaAppResponse, type
|
|
2
|
-
import type { ComponentType } from 'svelte';
|
|
1
|
+
import { type CreateInertiaAppOptionsForCSR, type InertiaAppResponse, type PageProps } from '@inertiajs/core';
|
|
3
2
|
import App, { type InertiaAppProps } from './components/App.svelte';
|
|
4
3
|
import type { ComponentResolver } from './types';
|
|
5
4
|
type SvelteRenderResult = {
|
|
@@ -9,24 +8,11 @@ type SvelteRenderResult = {
|
|
|
9
8
|
code: string;
|
|
10
9
|
};
|
|
11
10
|
};
|
|
12
|
-
type
|
|
13
|
-
|
|
11
|
+
type SetupOptions<SharedProps extends PageProps> = {
|
|
12
|
+
el: HTMLElement | null;
|
|
13
|
+
App: typeof App;
|
|
14
|
+
props: InertiaAppProps<SharedProps>;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
resolve: ComponentResolver;
|
|
18
|
-
setup: (props: {
|
|
19
|
-
el: HTMLElement | null;
|
|
20
|
-
App: AppComponent;
|
|
21
|
-
props: InertiaAppProps;
|
|
22
|
-
}) => void | App | SvelteRenderResult;
|
|
23
|
-
progress?: false | {
|
|
24
|
-
delay?: number;
|
|
25
|
-
color?: string;
|
|
26
|
-
includeCSS?: boolean;
|
|
27
|
-
showSpinner?: boolean;
|
|
28
|
-
};
|
|
29
|
-
page?: Page;
|
|
30
|
-
}
|
|
31
|
-
export default function createInertiaApp({ id, resolve, setup, progress, page, }: CreateInertiaAppProps): InertiaAppResponse;
|
|
16
|
+
type InertiaAppOptions<SharedProps extends PageProps> = CreateInertiaAppOptionsForCSR<SharedProps, ComponentResolver, SetupOptions<SharedProps>, SvelteRenderResult | void>;
|
|
17
|
+
export default function createInertiaApp<SharedProps extends PageProps = PageProps>({ id, resolve, setup, progress, page, }: InertiaAppOptions<SharedProps>): InertiaAppResponse;
|
|
32
18
|
export {};
|
package/dist/createInertiaApp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { router, setupProgress } from '@inertiajs/core';
|
|
1
|
+
import { router, setupProgress, } from '@inertiajs/core';
|
|
2
2
|
import { escape } from 'lodash-es';
|
|
3
3
|
import App, {} from './components/App.svelte';
|
|
4
4
|
export default async function createInertiaApp({ id = 'app', resolve, setup, progress = {}, page, }) {
|
|
@@ -6,24 +6,24 @@ export default async function createInertiaApp({ id = 'app', resolve, setup, pro
|
|
|
6
6
|
const el = isServer ? null : document.getElementById(id);
|
|
7
7
|
const initialPage = page || JSON.parse(el?.dataset.page || '{}');
|
|
8
8
|
const resolveComponent = (name) => Promise.resolve(resolve(name));
|
|
9
|
-
const
|
|
9
|
+
const svelteApp = await Promise.all([
|
|
10
10
|
resolveComponent(initialPage.component),
|
|
11
11
|
router.decryptHistory().catch(() => { }),
|
|
12
|
-
])
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
]).then(([initialComponent]) => {
|
|
13
|
+
return setup({
|
|
14
|
+
el,
|
|
15
|
+
App,
|
|
16
|
+
props: { initialPage, initialComponent, resolveComponent },
|
|
17
|
+
});
|
|
18
18
|
});
|
|
19
|
-
if (isServer) {
|
|
19
|
+
if (isServer && svelteApp) {
|
|
20
20
|
const { html, head, css } = svelteApp;
|
|
21
21
|
return {
|
|
22
22
|
body: `<div data-server-rendered="true" id="${id}" data-page="${escape(JSON.stringify(initialPage))}">${html}</div>`,
|
|
23
23
|
head: [head, css ? `<style data-vite-css>${css.code}</style>` : ''],
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
if (progress) {
|
|
26
|
+
if (!isServer && progress) {
|
|
27
27
|
setupProgress(progress);
|
|
28
28
|
}
|
|
29
29
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { default as Link } from './components/Link.svelte';
|
|
|
6
6
|
export { default as WhenVisible } from './components/WhenVisible.svelte';
|
|
7
7
|
export { default as createInertiaApp } from './createInertiaApp';
|
|
8
8
|
export { default as inertia } from './link';
|
|
9
|
-
export { default as page } from './page';
|
|
9
|
+
export { default as page, usePage } from './page';
|
|
10
10
|
export { type ResolvedComponent } from './types';
|
|
11
11
|
export { default as useForm, type InertiaForm, type InertiaFormProps } from './useForm';
|
|
12
12
|
export { default as usePoll } from './usePoll';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { default as Link } from './components/Link.svelte';
|
|
|
6
6
|
export { default as WhenVisible } from './components/WhenVisible.svelte';
|
|
7
7
|
export { default as createInertiaApp } from './createInertiaApp';
|
|
8
8
|
export { default as inertia } from './link';
|
|
9
|
-
export { default as page } from './page';
|
|
9
|
+
export { default as page, usePage } from './page';
|
|
10
10
|
export {} from './types';
|
|
11
11
|
export { default as useForm } from './useForm';
|
|
12
12
|
export { default as usePoll } from './usePoll';
|
package/dist/link.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type GlobalEventsMap, type LinkComponentBaseProps, type VisitOptions } from '@inertiajs/core';
|
|
2
|
-
import type { CancelTokenSource } from 'axios';
|
|
1
|
+
import { type CancelToken, type GlobalEventsMap, type LinkComponentBaseProps, type VisitOptions } from '@inertiajs/core';
|
|
3
2
|
import type { ActionReturn } from 'svelte/action';
|
|
4
3
|
interface ActionElement extends HTMLElement {
|
|
5
4
|
href?: string;
|
|
@@ -10,8 +9,8 @@ type SelectedGlobalEventsMap = Pick<GlobalEventsMap, SelectedEventKeys>;
|
|
|
10
9
|
type ActionAttributes = {
|
|
11
10
|
[K in keyof SelectedGlobalEventsMap as `on:${K}` | `on${K}`]?: (event: CustomEvent<SelectedGlobalEventsMap[K]['details']>) => void;
|
|
12
11
|
} & {
|
|
13
|
-
'on:cancel-token'?: (event: CustomEvent<
|
|
14
|
-
oncanceltoken?: (event: CustomEvent<
|
|
12
|
+
'on:cancel-token'?: (event: CustomEvent<CancelToken>) => void;
|
|
13
|
+
oncanceltoken?: (event: CustomEvent<CancelToken>) => void;
|
|
15
14
|
};
|
|
16
15
|
declare function link(node: ActionElement, initialParams?: ActionParameters): ActionReturn<ActionParameters, ActionAttributes>;
|
|
17
16
|
export default link;
|
package/dist/link.js
CHANGED
|
@@ -31,7 +31,7 @@ function link(node, initialParams = {}) {
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
keydown: (event) => {
|
|
34
|
-
if (
|
|
34
|
+
if (shouldNavigate(event)) {
|
|
35
35
|
event.preventDefault();
|
|
36
36
|
prefetch();
|
|
37
37
|
}
|
|
@@ -71,7 +71,7 @@ function link(node, initialParams = {}) {
|
|
|
71
71
|
}
|
|
72
72
|
return 30_000;
|
|
73
73
|
})();
|
|
74
|
-
cacheTags = cacheTagValues;
|
|
74
|
+
cacheTags = Array.isArray(cacheTagValues) ? cacheTagValues : [cacheTagValues];
|
|
75
75
|
method = isUrlMethodPair(params.href) ? params.href.method : params.method?.toLowerCase() || 'get';
|
|
76
76
|
[href, data] = hrefAndData(method, params);
|
|
77
77
|
if (node.tagName === 'A') {
|
package/dist/page.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { type Page } from '@inertiajs/core';
|
|
2
|
-
type
|
|
3
|
-
|
|
1
|
+
import { type Page, type PageProps, type SharedPageProps } from '@inertiajs/core';
|
|
2
|
+
import { type Readable } from 'svelte/store';
|
|
3
|
+
type SveltePage<TPageProps extends PageProps = PageProps> = Omit<Page<TPageProps & SharedPageProps>, 'props'> & {
|
|
4
|
+
props: Page<TPageProps & SharedPageProps>['props'] & {
|
|
4
5
|
[key: string]: any;
|
|
5
6
|
};
|
|
6
7
|
};
|
|
7
|
-
export declare const setPage: (this: void, value: SveltePage) => void;
|
|
8
|
+
export declare const setPage: (this: void, value: SveltePage<PageProps>) => void;
|
|
8
9
|
declare const _default: {
|
|
9
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<SveltePage
|
|
10
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<SveltePage<PageProps>>, invalidate?: import("svelte/store").Invalidator<SveltePage<PageProps>> | undefined) => import("svelte/store").Unsubscriber;
|
|
10
11
|
};
|
|
11
12
|
export default _default;
|
|
13
|
+
export declare function usePage<TPageProps extends PageProps = PageProps>(): Readable<SveltePage<TPageProps>>;
|
package/dist/page.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {} from '@inertiajs/core';
|
|
2
|
-
import { writable } from 'svelte/store';
|
|
2
|
+
import { derived, writable } from 'svelte/store';
|
|
3
3
|
const { set, subscribe } = writable();
|
|
4
4
|
export const setPage = set;
|
|
5
5
|
export default { subscribe };
|
|
6
|
+
export function usePage() {
|
|
7
|
+
return derived({ subscribe }, ($page) => $page);
|
|
8
|
+
}
|
package/dist/useForm.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { ErrorValue, FormDataErrors, FormDataKeys, FormDataType, FormDataVa
|
|
|
2
2
|
import { type Writable } from 'svelte/store';
|
|
3
3
|
type InertiaFormStore<TForm extends object> = Writable<InertiaForm<TForm>> & InertiaForm<TForm>;
|
|
4
4
|
type FormOptions = Omit<VisitOptions, 'data'>;
|
|
5
|
+
type SubmitArgs = [Method, string, FormOptions?] | [UrlMethodPair, FormOptions?];
|
|
6
|
+
type TransformCallback<TForm> = (data: TForm) => object;
|
|
5
7
|
export interface InertiaFormProps<TForm extends object> {
|
|
6
8
|
isDirty: boolean;
|
|
7
9
|
errors: FormDataErrors<TForm>;
|
|
@@ -13,7 +15,7 @@ export interface InertiaFormProps<TForm extends object> {
|
|
|
13
15
|
setStore(data: TForm): void;
|
|
14
16
|
setStore<T extends FormDataKeys<TForm>>(key: T, value: FormDataValues<TForm, T>): void;
|
|
15
17
|
data(): TForm;
|
|
16
|
-
transform(callback:
|
|
18
|
+
transform(callback: TransformCallback<TForm>): this;
|
|
17
19
|
defaults(): this;
|
|
18
20
|
defaults(fields: Partial<TForm>): this;
|
|
19
21
|
defaults<T extends FormDataKeys<TForm>>(field: T, value: FormDataValues<TForm, T>): this;
|
|
@@ -22,7 +24,7 @@ export interface InertiaFormProps<TForm extends object> {
|
|
|
22
24
|
resetAndClearErrors<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
23
25
|
setError<K extends FormDataKeys<TForm>>(field: K, value: ErrorValue): this;
|
|
24
26
|
setError(errors: FormDataErrors<TForm>): this;
|
|
25
|
-
submit: (...args:
|
|
27
|
+
submit: (...args: SubmitArgs) => void;
|
|
26
28
|
get(url: string, options?: FormOptions): void;
|
|
27
29
|
post(url: string, options?: FormOptions): void;
|
|
28
30
|
put(url: string, options?: FormOptions): void;
|
package/dist/useForm.js
CHANGED
|
@@ -13,6 +13,9 @@ export default function useForm(rememberKeyOrData, maybeData) {
|
|
|
13
13
|
let recentlySuccessfulTimeoutId = null;
|
|
14
14
|
let transform = (data) => data;
|
|
15
15
|
let defaultsCalledInOnSuccess = false;
|
|
16
|
+
const setFormState = (key, value) => {
|
|
17
|
+
store.update((form) => ({ ...form, [key]: value }));
|
|
18
|
+
};
|
|
16
19
|
const store = writable({
|
|
17
20
|
...(restored ? restored.data : data),
|
|
18
21
|
isDirty: false,
|
|
@@ -64,14 +67,14 @@ export default function useForm(rememberKeyOrData, maybeData) {
|
|
|
64
67
|
return this;
|
|
65
68
|
},
|
|
66
69
|
setError(fieldOrFields, maybeValue) {
|
|
67
|
-
|
|
70
|
+
setFormState('errors', {
|
|
68
71
|
...this.errors,
|
|
69
72
|
...(typeof fieldOrFields === 'string' ? { [fieldOrFields]: maybeValue } : fieldOrFields),
|
|
70
73
|
});
|
|
71
74
|
return this;
|
|
72
75
|
},
|
|
73
76
|
clearErrors(...fields) {
|
|
74
|
-
|
|
77
|
+
setFormState('errors', Object.keys(this.errors).reduce((carry, field) => ({
|
|
75
78
|
...carry,
|
|
76
79
|
...(fields.length > 0 && !fields.includes(field) ? { [field]: this.errors[field] } : {}),
|
|
77
80
|
}), {}));
|
|
@@ -98,8 +101,8 @@ export default function useForm(rememberKeyOrData, maybeData) {
|
|
|
98
101
|
}
|
|
99
102
|
},
|
|
100
103
|
onBefore: (visit) => {
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
setFormState('wasSuccessful', false);
|
|
105
|
+
setFormState('recentlySuccessful', false);
|
|
103
106
|
if (recentlySuccessfulTimeoutId) {
|
|
104
107
|
clearTimeout(recentlySuccessfulTimeoutId);
|
|
105
108
|
}
|
|
@@ -108,48 +111,51 @@ export default function useForm(rememberKeyOrData, maybeData) {
|
|
|
108
111
|
}
|
|
109
112
|
},
|
|
110
113
|
onStart: (visit) => {
|
|
111
|
-
|
|
114
|
+
setFormState('processing', true);
|
|
112
115
|
if (options.onStart) {
|
|
113
116
|
return options.onStart(visit);
|
|
114
117
|
}
|
|
115
118
|
},
|
|
116
119
|
onProgress: (event) => {
|
|
117
|
-
|
|
120
|
+
setFormState('progress', event || null);
|
|
118
121
|
if (options.onProgress) {
|
|
119
122
|
return options.onProgress(event);
|
|
120
123
|
}
|
|
121
124
|
},
|
|
122
125
|
onSuccess: async (page) => {
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
setFormState('processing', false);
|
|
127
|
+
setFormState('progress', null);
|
|
125
128
|
this.clearErrors();
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
recentlySuccessfulTimeoutId = setTimeout(() =>
|
|
129
|
+
setFormState('wasSuccessful', true);
|
|
130
|
+
setFormState('recentlySuccessful', true);
|
|
131
|
+
recentlySuccessfulTimeoutId = setTimeout(() => setFormState('recentlySuccessful', false), 2000);
|
|
129
132
|
const onSuccess = options.onSuccess ? await options.onSuccess(page) : null;
|
|
130
133
|
if (!defaultsCalledInOnSuccess) {
|
|
131
|
-
|
|
134
|
+
store.update((form) => {
|
|
135
|
+
this.defaults(cloneDeep(form.data()));
|
|
136
|
+
return form;
|
|
137
|
+
});
|
|
132
138
|
}
|
|
133
139
|
return onSuccess;
|
|
134
140
|
},
|
|
135
141
|
onError: (errors) => {
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
setFormState('processing', false);
|
|
143
|
+
setFormState('progress', null);
|
|
138
144
|
this.clearErrors().setError(errors);
|
|
139
145
|
if (options.onError) {
|
|
140
146
|
return options.onError(errors);
|
|
141
147
|
}
|
|
142
148
|
},
|
|
143
149
|
onCancel: () => {
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
setFormState('processing', false);
|
|
151
|
+
setFormState('progress', null);
|
|
146
152
|
if (options.onCancel) {
|
|
147
153
|
return options.onCancel();
|
|
148
154
|
}
|
|
149
155
|
},
|
|
150
156
|
onFinish: (visit) => {
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
setFormState('processing', false);
|
|
158
|
+
setFormState('progress', null);
|
|
153
159
|
cancelToken = null;
|
|
154
160
|
if (options.onFinish) {
|
|
155
161
|
return options.onFinish(visit);
|
|
@@ -184,11 +190,11 @@ export default function useForm(rememberKeyOrData, maybeData) {
|
|
|
184
190
|
});
|
|
185
191
|
store.subscribe((form) => {
|
|
186
192
|
if (form.isDirty === isEqual(form.data(), defaults)) {
|
|
187
|
-
|
|
193
|
+
setFormState('isDirty', !form.isDirty);
|
|
188
194
|
}
|
|
189
195
|
const hasErrors = Object.keys(form.errors).length > 0;
|
|
190
196
|
if (form.hasErrors !== hasErrors) {
|
|
191
|
-
|
|
197
|
+
setFormState('hasErrors', !form.hasErrors);
|
|
192
198
|
}
|
|
193
199
|
if (rememberKey) {
|
|
194
200
|
router.remember({ data: form.data(), errors: form.errors }, rememberKey);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiajs/svelte",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Svelte adapter for Inertia.js",
|
|
6
6
|
"contributors": [
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@sveltejs/adapter-auto": "^3.3.1",
|
|
39
|
-
"@sveltejs/kit": "^2.
|
|
39
|
+
"@sveltejs/kit": "^2.47.2",
|
|
40
40
|
"@sveltejs/package": "^2.5.4",
|
|
41
41
|
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
|
42
42
|
"axios": "^1.12.2",
|
|
43
|
-
"es-check": "^9.
|
|
43
|
+
"es-check": "^9.4.4",
|
|
44
44
|
"publint": "^0.2.12",
|
|
45
45
|
"svelte": "^4.2.20",
|
|
46
|
-
"svelte-check": "^4.3.
|
|
46
|
+
"svelte-check": "^4.3.3",
|
|
47
47
|
"tslib": "^2.8.1",
|
|
48
|
-
"typescript": "^5.9.
|
|
49
|
-
"vite": "^5.4.
|
|
48
|
+
"typescript": "^5.9.3",
|
|
49
|
+
"vite": "^5.4.21"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"svelte": "^4.0.0 || ^5.0.0"
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@types/lodash-es": "^4.17.12",
|
|
56
56
|
"lodash-es": "^4.17.21",
|
|
57
|
-
"@inertiajs/core": "2.2.
|
|
57
|
+
"@inertiajs/core": "2.2.9"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
-
"build": "pnpm package && publint",
|
|
60
|
+
"build": "pnpm package && svelte-check --tsconfig ./tsconfig.json && publint",
|
|
61
61
|
"build:with-deps": "svelte-kit sync && vite build --config vite-with-deps.config.js",
|
|
62
62
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
63
63
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|