@inertiajs/svelte 2.0.0 → 2.0.2

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/useForm.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Errors, FormDataConvertible, Method, Progress, VisitOptions } from '@inertiajs/core';
2
2
  import { type Writable } from 'svelte/store';
3
3
  type FormDataType = Record<string, FormDataConvertible>;
4
+ type FormOptions = Omit<VisitOptions, 'data'>;
4
5
  export interface InertiaFormProps<TForm extends FormDataType> {
5
6
  isDirty: boolean;
6
7
  errors: Partial<Record<keyof TForm, string>>;
@@ -20,12 +21,12 @@ export interface InertiaFormProps<TForm extends FormDataType> {
20
21
  clearErrors(...fields: (keyof TForm)[]): this;
21
22
  setError(field: keyof TForm, value: string): this;
22
23
  setError(errors: Errors): this;
23
- submit(method: Method, url: string, options?: Partial<VisitOptions>): void;
24
- get(url: string, options?: Partial<VisitOptions>): void;
25
- post(url: string, options?: Partial<VisitOptions>): void;
26
- put(url: string, options?: Partial<VisitOptions>): void;
27
- patch(url: string, options?: Partial<VisitOptions>): void;
28
- delete(url: string, options?: Partial<VisitOptions>): void;
24
+ submit(method: Method, url: string, options?: FormOptions): void;
25
+ get(url: string, options?: FormOptions): void;
26
+ post(url: string, options?: FormOptions): void;
27
+ put(url: string, options?: FormOptions): void;
28
+ patch(url: string, options?: FormOptions): void;
29
+ delete(url: string, options?: FormOptions): void;
29
30
  cancel(): void;
30
31
  }
31
32
  export type InertiaForm<TForm extends FormDataType> = InertiaFormProps<TForm> & TForm;
package/dist/useForm.js CHANGED
@@ -4,7 +4,7 @@ import isEqual from 'lodash/isEqual';
4
4
  import { writable } from 'svelte/store';
5
5
  export default function useForm(rememberKeyOrData, maybeData) {
6
6
  const rememberKey = typeof rememberKeyOrData === 'string' ? rememberKeyOrData : null;
7
- const inputData = typeof rememberKeyOrData === 'string' ? maybeData : rememberKeyOrData;
7
+ const inputData = (typeof rememberKeyOrData === 'string' ? maybeData : rememberKeyOrData) ?? {};
8
8
  const data = typeof inputData === 'function' ? inputData() : inputData;
9
9
  const restored = rememberKey
10
10
  ? router.restore(rememberKey)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inertiajs/svelte",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "license": "MIT",
5
5
  "description": "The Svelte adapter for Inertia.js",
6
6
  "contributors": [
@@ -43,7 +43,7 @@
43
43
  "svelte": "^4.0.0 || ^5.0.0 || ^5.0.0-next.244"
44
44
  },
45
45
  "dependencies": {
46
- "@inertiajs/core": "2.0.0",
46
+ "@inertiajs/core": "2.0.2",
47
47
  "html-escape": "^2.0.0",
48
48
  "lodash": "^4.5.0"
49
49
  },