@inertiajs/svelte 2.2.15 → 2.2.17

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.
@@ -59,6 +59,7 @@ export function submit() {
59
59
  };
60
60
  const submitOptions = {
61
61
  headers,
62
+ queryStringArrayFormat,
62
63
  errorBag,
63
64
  showProgress,
64
65
  invalidateCacheTags,
@@ -6,7 +6,7 @@ declare const __propDef: {
6
6
  action?: string | import("@inertiajs/core").UrlMethodPair | undefined;
7
7
  method?: Method | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
8
8
  headers?: Record<string, string> | undefined;
9
- queryStringArrayFormat?: "indices" | "brackets" | undefined;
9
+ queryStringArrayFormat?: import("@inertiajs/core").QueryStringArrayFormatOption | undefined;
10
10
  errorBag?: string | null | undefined;
11
11
  showProgress?: boolean | undefined;
12
12
  transform?: ((data: Record<string, FormDataConvertible>) => Record<string, FormDataConvertible>) | undefined;
@@ -13,7 +13,7 @@ declare const __propDef: {
13
13
  only?: string[] | undefined;
14
14
  except?: string[] | undefined;
15
15
  headers?: Record<string, string> | undefined;
16
- queryStringArrayFormat?: "indices" | "brackets" | undefined;
16
+ queryStringArrayFormat?: import("@inertiajs/core").QueryStringArrayFormatOption | undefined;
17
17
  async?: boolean | undefined;
18
18
  prefetch?: boolean | import("@inertiajs/core").LinkPrefetchOption | import("@inertiajs/core").LinkPrefetchOption[] | undefined;
19
19
  cacheFor?: import("@inertiajs/core").CacheForOption | import("@inertiajs/core").CacheForOption[] | undefined;
@@ -1,5 +1,6 @@
1
1
  <script>import { router } from "@inertiajs/core";
2
- import { onDestroy, onMount } from "svelte";
2
+ import { onDestroy } from "svelte";
3
+ import { usePage } from "../page";
3
4
  export let data = "";
4
5
  export let params = {};
5
6
  export let buffer = 0;
@@ -9,21 +10,32 @@ let loaded = false;
9
10
  let fetching = false;
10
11
  let el;
11
12
  let observer = null;
12
- onMount(() => {
13
- if (!el) {
14
- return;
13
+ const page = usePage();
14
+ $: {
15
+ if (Array.isArray(data)) {
16
+ if (data.some((key) => $page.props[key] === void 0)) {
17
+ loaded = false;
18
+ }
19
+ } else if ($page.props[data] === void 0) {
20
+ loaded = false;
15
21
  }
22
+ }
23
+ $: if (el) {
24
+ registerObserver();
25
+ }
26
+ function registerObserver() {
27
+ observer?.disconnect();
16
28
  observer = new IntersectionObserver(
17
29
  (entries) => {
18
30
  if (!entries[0].isIntersecting) {
19
31
  return;
20
32
  }
21
- if (!always) {
22
- observer?.disconnect();
23
- }
24
33
  if (fetching) {
25
34
  return;
26
35
  }
36
+ if (!always && loaded) {
37
+ return;
38
+ }
27
39
  fetching = true;
28
40
  const reloadParams = getReloadParams();
29
41
  router.reload({
@@ -36,6 +48,9 @@ onMount(() => {
36
48
  loaded = true;
37
49
  fetching = false;
38
50
  reloadParams.onFinish?.(event);
51
+ if (!always) {
52
+ observer?.disconnect();
53
+ }
39
54
  }
40
55
  });
41
56
  },
@@ -44,7 +59,7 @@ onMount(() => {
44
59
  }
45
60
  );
46
61
  observer.observe(el);
47
- });
62
+ }
48
63
  onDestroy(() => {
49
64
  observer?.disconnect();
50
65
  });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { progress, router } from '@inertiajs/core';
2
+ export { default as App } from './components/App.svelte';
2
3
  export { default as Deferred } from './components/Deferred.svelte';
3
4
  export { default as Form } from './components/Form.svelte';
4
5
  export { default as InfiniteScroll } from './components/InfiniteScroll.svelte';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { config as coreConfig } from '@inertiajs/core';
2
2
  export { progress, router } from '@inertiajs/core';
3
+ export { default as App } from './components/App.svelte';
3
4
  export { default as Deferred } from './components/Deferred.svelte';
4
5
  export { default as Form } from './components/Form.svelte';
5
6
  export { default as InfiniteScroll } from './components/InfiniteScroll.svelte';
package/dist/link.js CHANGED
@@ -38,8 +38,10 @@ function link(node, initialParams = {}) {
38
38
  }
39
39
  },
40
40
  mouseup: (event) => {
41
- event.preventDefault();
42
- router.visit(href, visitParams);
41
+ if (shouldIntercept(event)) {
42
+ event.preventDefault();
43
+ router.visit(href, visitParams);
44
+ }
43
45
  },
44
46
  keyup: (event) => {
45
47
  if (shouldNavigate(event)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inertiajs/svelte",
3
- "version": "2.2.15",
3
+ "version": "2.2.17",
4
4
  "license": "MIT",
5
5
  "description": "The Svelte adapter for Inertia.js",
6
6
  "contributors": [
@@ -36,14 +36,14 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@sveltejs/adapter-auto": "^3.3.1",
39
- "@sveltejs/kit": "^2.47.2",
39
+ "@sveltejs/kit": "^2.48.4",
40
40
  "@sveltejs/package": "^2.5.4",
41
41
  "@sveltejs/vite-plugin-svelte": "^3.1.2",
42
- "axios": "^1.12.2",
42
+ "axios": "^1.13.2",
43
43
  "es-check": "^9.4.4",
44
44
  "publint": "^0.2.12",
45
45
  "svelte": "^4.2.20",
46
- "svelte-check": "^4.3.3",
46
+ "svelte-check": "^4.3.4",
47
47
  "tslib": "^2.8.1",
48
48
  "typescript": "^5.9.3",
49
49
  "vite": "^5.4.21"
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@types/lodash-es": "^4.17.12",
56
56
  "lodash-es": "^4.17.21",
57
- "@inertiajs/core": "2.2.15"
57
+ "@inertiajs/core": "2.2.17"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "pnpm package && svelte-check --tsconfig ./tsconfig.json && publint",