@inertiajs/svelte 2.3.11 → 2.3.12
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.
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
<script>import { page } from "../index";
|
|
2
|
-
import { onDestroy } from "svelte";
|
|
3
2
|
export let data;
|
|
4
3
|
const keys = Array.isArray(data) ? data : [data];
|
|
5
|
-
|
|
6
|
-
const isServer = typeof window === "undefined";
|
|
7
|
-
if (!isServer) {
|
|
8
|
-
const unsubscribe = page.subscribe(({ props }) => {
|
|
9
|
-
window.queueMicrotask(() => {
|
|
10
|
-
loaded = keys.every((key) => typeof props[key] !== "undefined");
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
onDestroy(() => {
|
|
14
|
-
unsubscribe();
|
|
15
|
-
});
|
|
16
|
-
}
|
|
4
|
+
$: loaded = keys.every((key) => typeof $page.props[key] !== "undefined");
|
|
17
5
|
if (!$$slots.fallback) {
|
|
18
6
|
throw new Error('`<Deferred>` requires a `<svelte:fragment slot="fallback">` slot');
|
|
19
7
|
}
|
|
@@ -75,6 +75,11 @@ function updateDirtyState(event) {
|
|
|
75
75
|
}
|
|
76
76
|
export function submit(submitter) {
|
|
77
77
|
const [url, data] = getUrlAndData(submitter);
|
|
78
|
+
const formTarget = submitter?.getAttribute("formtarget");
|
|
79
|
+
if (formTarget === "_blank" && _method === "get") {
|
|
80
|
+
window.open(url, "_blank");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
78
83
|
const maybeReset = (resetOption) => {
|
|
79
84
|
if (!resetOption) {
|
|
80
85
|
return;
|
|
@@ -30,16 +30,16 @@ declare const __propDef: {
|
|
|
30
30
|
mouseout: MouseEvent;
|
|
31
31
|
mouseover: MouseEvent;
|
|
32
32
|
mouseup: MouseEvent;
|
|
33
|
-
'cancel-token':
|
|
34
|
-
before:
|
|
35
|
-
start:
|
|
33
|
+
'cancel-token': InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
34
|
+
before: InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
35
|
+
start: InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
36
36
|
progress: ProgressEvent<EventTarget>;
|
|
37
|
-
finish:
|
|
37
|
+
finish: InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
38
38
|
cancel: Event;
|
|
39
|
-
success:
|
|
39
|
+
success: InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
40
40
|
error: ErrorEvent;
|
|
41
|
-
prefetching:
|
|
42
|
-
prefetched:
|
|
41
|
+
prefetching: InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
42
|
+
prefetched: InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
43
43
|
} & {
|
|
44
44
|
[evt: string]: CustomEvent<any>;
|
|
45
45
|
};
|
package/dist/useForm.js
CHANGED
|
@@ -263,7 +263,8 @@ export default function useForm(...args) {
|
|
|
263
263
|
onError: (errors) => {
|
|
264
264
|
setFormState('processing', false);
|
|
265
265
|
setFormState('progress', null);
|
|
266
|
-
|
|
266
|
+
setFormState('errors', errors);
|
|
267
|
+
validatorRef?.setErrors(errors);
|
|
267
268
|
if (options.onError) {
|
|
268
269
|
return options.onError(errors);
|
|
269
270
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiajs/svelte",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Svelte adapter for Inertia.js",
|
|
6
6
|
"contributors": [
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@types/lodash-es": "^4.17.12",
|
|
56
56
|
"laravel-precognition": "^1.0.0",
|
|
57
|
-
"lodash-es": "^4.17.
|
|
58
|
-
"@inertiajs/core": "2.3.
|
|
57
|
+
"lodash-es": "^4.17.23",
|
|
58
|
+
"@inertiajs/core": "2.3.12"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "pnpm package && svelte-check --tsconfig ./tsconfig.json && publint",
|