@inertiajs/svelte 2.1.3 → 2.1.4
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,7 +1,8 @@
|
|
|
1
1
|
<script>import {
|
|
2
2
|
formDataToObject,
|
|
3
3
|
resetFormFields,
|
|
4
|
-
mergeDataIntoQueryString
|
|
4
|
+
mergeDataIntoQueryString,
|
|
5
|
+
isUrlMethodPair
|
|
5
6
|
} from "@inertiajs/core";
|
|
6
7
|
import { isEqual } from "lodash-es";
|
|
7
8
|
import { onMount } from "svelte";
|
|
@@ -33,8 +34,8 @@ const form = useForm({});
|
|
|
33
34
|
let formElement;
|
|
34
35
|
let isDirty = false;
|
|
35
36
|
let defaultData = new FormData();
|
|
36
|
-
$: _method =
|
|
37
|
-
$: _action =
|
|
37
|
+
$: _method = isUrlMethodPair(action) ? action.method : method.toLowerCase();
|
|
38
|
+
$: _action = isUrlMethodPair(action) ? action.url : action;
|
|
38
39
|
function getFormData() {
|
|
39
40
|
return new FormData(formElement);
|
|
40
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { isUrlMethodPair } from "@inertiajs/core";
|
|
2
|
+
import { inertia } from "../index";
|
|
2
3
|
export let href = "";
|
|
3
4
|
export let as = "a";
|
|
4
5
|
export let data = {};
|
|
@@ -14,8 +15,8 @@ export let async = false;
|
|
|
14
15
|
export let prefetch = false;
|
|
15
16
|
export let cacheFor = 0;
|
|
16
17
|
export let cacheTags = [];
|
|
17
|
-
$: _method =
|
|
18
|
-
$: _href =
|
|
18
|
+
$: _method = isUrlMethodPair(href) ? href.method : method;
|
|
19
|
+
$: _href = isUrlMethodPair(href) ? href.url : href;
|
|
19
20
|
$: asProp = _method !== "get" ? "button" : as.toLowerCase();
|
|
20
21
|
$: elProps = {
|
|
21
22
|
a: { href: _href },
|
package/dist/createInertiaApp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { router, setupProgress } from '@inertiajs/core';
|
|
2
|
-
import escape from '
|
|
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, }) {
|
|
5
5
|
const isServer = typeof window === 'undefined';
|
package/dist/link.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeDataIntoQueryString, router, shouldIntercept, shouldNavigate, } from '@inertiajs/core';
|
|
1
|
+
import { isUrlMethodPair, mergeDataIntoQueryString, router, shouldIntercept, shouldNavigate, } from '@inertiajs/core';
|
|
2
2
|
function link(node, initialParams = {}) {
|
|
3
3
|
let inFlightCount = 0;
|
|
4
4
|
let hoverTimeout;
|
|
@@ -72,7 +72,7 @@ function link(node, initialParams = {}) {
|
|
|
72
72
|
return 30_000;
|
|
73
73
|
})();
|
|
74
74
|
cacheTags = cacheTagValues;
|
|
75
|
-
method =
|
|
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') {
|
|
78
78
|
node.href = href;
|
|
@@ -115,7 +115,7 @@ function link(node, initialParams = {}) {
|
|
|
115
115
|
return node.dispatchEvent(new CustomEvent(type, detail));
|
|
116
116
|
}
|
|
117
117
|
function hrefAndData(method, params) {
|
|
118
|
-
return mergeDataIntoQueryString(method,
|
|
118
|
+
return mergeDataIntoQueryString(method, isUrlMethodPair(params.href) ? params.href.url : node.href || params.href || '', params.data || {}, params.queryStringArrayFormat || 'brackets');
|
|
119
119
|
}
|
|
120
120
|
function prefetch() {
|
|
121
121
|
router.prefetch(href, {
|
package/dist/useForm.js
CHANGED
|
@@ -83,7 +83,7 @@ export default function useForm(rememberKeyOrData, maybeData) {
|
|
|
83
83
|
return this;
|
|
84
84
|
},
|
|
85
85
|
submit(...args) {
|
|
86
|
-
const objectPassed = typeof args[0] === 'object';
|
|
86
|
+
const objectPassed = args[0] !== null && typeof args[0] === 'object';
|
|
87
87
|
const method = objectPassed ? args[0].method : args[0];
|
|
88
88
|
const url = objectPassed ? args[0].url : args[1];
|
|
89
89
|
const options = (objectPassed ? args[1] : args[2]) ?? {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiajs/svelte",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Svelte adapter for Inertia.js",
|
|
6
6
|
"contributors": [
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"@sveltejs/kit": "^2.36.3",
|
|
40
40
|
"@sveltejs/package": "^2.3.4",
|
|
41
41
|
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
|
42
|
-
"@types/html-escape": "^2.0.2",
|
|
43
42
|
"axios": "^1.11.0",
|
|
44
43
|
"es-check": "^9.3.1",
|
|
45
44
|
"publint": "^0.2.10",
|
|
@@ -54,9 +53,8 @@
|
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
55
|
"@types/lodash-es": "^4.17.12",
|
|
57
|
-
"html-escape": "^2.0.0",
|
|
58
56
|
"lodash-es": "^4.17.21",
|
|
59
|
-
"@inertiajs/core": "2.1.
|
|
57
|
+
"@inertiajs/core": "2.1.4"
|
|
60
58
|
},
|
|
61
59
|
"scripts": {
|
|
62
60
|
"build": "pnpm package && publint",
|