@inertiajs/svelte 3.1.0 → 3.2.0
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,6 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type { ComponentResolver, ResolvedComponent } from '../types'
|
|
3
2
|
import { type Page, type PageProps } from '@inertiajs/core'
|
|
3
|
+
import type { ComponentResolver, ResolvedComponent } from '../types'
|
|
4
4
|
|
|
5
5
|
export interface InertiaAppProps<SharedProps extends PageProps = PageProps> {
|
|
6
6
|
initialComponent: ResolvedComponent
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
14
|
-
import type { Component } from 'svelte'
|
|
15
|
-
import type { LayoutType, LayoutResolver } from '../types'
|
|
16
14
|
import { isPropsObjectOrCallback, isPropsObject, normalizeLayouts } from '@inertiajs/core'
|
|
17
15
|
import { router } from '@inertiajs/core'
|
|
18
|
-
import
|
|
19
|
-
import { setPage } from '../page.svelte'
|
|
16
|
+
import type { Component } from 'svelte'
|
|
20
17
|
import { resetLayoutProps, storeState } from '../layoutProps.svelte'
|
|
18
|
+
import { setPage } from '../page.svelte'
|
|
19
|
+
import type { LayoutType, LayoutResolver } from '../types'
|
|
20
|
+
import Render, { h, type RenderProps } from './Render.svelte'
|
|
21
21
|
|
|
22
22
|
interface Props {
|
|
23
23
|
initialComponent: InertiaAppProps['initialComponent']
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentResolver, ResolvedComponent } from '../types';
|
|
2
1
|
import { type Page, type PageProps } from '@inertiajs/core';
|
|
2
|
+
import type { ComponentResolver, ResolvedComponent } from '../types';
|
|
3
3
|
export interface InertiaAppProps<SharedProps extends PageProps = PageProps> {
|
|
4
4
|
initialComponent: ResolvedComponent;
|
|
5
5
|
initialPage: Page<SharedProps>;
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
resolveUrlMethodPairComponent,
|
|
16
16
|
UseFormUtils,
|
|
17
17
|
} from '@inertiajs/core'
|
|
18
|
-
import { type NamedInputEvent, type ValidationConfig, type Validator } from 'laravel-precognition'
|
|
19
18
|
import { isEqual } from 'es-toolkit'
|
|
19
|
+
import { type NamedInputEvent, type ValidationConfig, type Validator } from 'laravel-precognition'
|
|
20
20
|
import { onMount } from 'svelte'
|
|
21
|
-
import { setFormContext } from './formContext'
|
|
22
|
-
import useForm from '../useForm.svelte'
|
|
23
21
|
import { config } from '..'
|
|
22
|
+
import useForm from '../useForm.svelte'
|
|
23
|
+
import { setFormContext } from './formContext'
|
|
24
24
|
|
|
25
25
|
const noop = () => undefined
|
|
26
26
|
|
|
@@ -152,13 +152,19 @@
|
|
|
152
152
|
// Request callbacks
|
|
153
153
|
onBeforePreviousRequest: () => (loadingPrevious = true),
|
|
154
154
|
onBeforeNextRequest: () => (loadingNext = true),
|
|
155
|
-
onCompletePreviousRequest: () => {
|
|
155
|
+
onCompletePreviousRequest: ({ completed }) => {
|
|
156
156
|
loadingPrevious = false
|
|
157
|
-
|
|
157
|
+
|
|
158
|
+
if (completed) {
|
|
159
|
+
syncStateFromDataManager()
|
|
160
|
+
}
|
|
158
161
|
},
|
|
159
|
-
onCompleteNextRequest: () => {
|
|
162
|
+
onCompleteNextRequest: ({ completed }) => {
|
|
160
163
|
loadingNext = false
|
|
161
|
-
|
|
164
|
+
|
|
165
|
+
if (completed) {
|
|
166
|
+
syncStateFromDataManager()
|
|
167
|
+
}
|
|
162
168
|
},
|
|
163
169
|
onDataReset: syncStateFromDataManager,
|
|
164
170
|
})
|
package/dist/usePoll.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PollOptions, type ReloadOptions } from '@inertiajs/core';
|
|
2
|
-
export default function usePoll(interval: number, requestOptions?: ReloadOptions, options?: PollOptions): {
|
|
2
|
+
export default function usePoll(interval: number, requestOptions?: ReloadOptions | (() => ReloadOptions), options?: PollOptions): {
|
|
3
3
|
stop: VoidFunction;
|
|
4
4
|
start: VoidFunction;
|
|
5
5
|
};
|
package/dist/usePoll.js
CHANGED
|
@@ -4,7 +4,7 @@ export default function usePoll(interval, requestOptions = {}, options = {
|
|
|
4
4
|
keepAlive: false,
|
|
5
5
|
autoStart: true,
|
|
6
6
|
}) {
|
|
7
|
-
const { stop, start } = router.poll(interval, requestOptions, {
|
|
7
|
+
const { stop, start, destroy } = router.poll(interval, requestOptions, {
|
|
8
8
|
...options,
|
|
9
9
|
autoStart: false,
|
|
10
10
|
});
|
|
@@ -14,7 +14,7 @@ export default function usePoll(interval, requestOptions = {}, options = {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
onDestroy(() => {
|
|
17
|
-
|
|
17
|
+
destroy();
|
|
18
18
|
});
|
|
19
19
|
return { stop, start };
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiajs/svelte",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Svelte adapter for Inertia.js",
|
|
6
6
|
"contributors": [
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
40
|
-
"@sveltejs/kit": "^2.
|
|
40
|
+
"@sveltejs/kit": "^2.60.1",
|
|
41
41
|
"@sveltejs/package": "^2.5.7",
|
|
42
42
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
43
43
|
"axios": "^1.15.2",
|
|
44
44
|
"es-check": "9.5.3",
|
|
45
45
|
"publint": "^0.3.17",
|
|
46
|
-
"svelte": "^5.
|
|
47
|
-
"svelte-check": "^4.4.
|
|
46
|
+
"svelte": "^5.55.7",
|
|
47
|
+
"svelte-check": "^4.4.8",
|
|
48
48
|
"tslib": "^2.8.1",
|
|
49
|
-
"typescript": "^
|
|
49
|
+
"typescript": "^6.0.3",
|
|
50
50
|
"vite": "^8.0.10"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"es-toolkit": "^1.33.0",
|
|
57
57
|
"laravel-precognition": "^2.0.0",
|
|
58
|
-
"@inertiajs/core": "3.
|
|
58
|
+
"@inertiajs/core": "3.2.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "pnpm package && svelte-check --tsconfig ./tsconfig.json && publint",
|