@inertiajs/svelte 3.0.0-beta.2 → 3.0.0-beta.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.
- package/dist/components/App.svelte +30 -3
- package/dist/components/Deferred.svelte +1 -1
- package/dist/components/Form.svelte +1 -1
- package/dist/components/InfiniteScroll.svelte +5 -2
- package/dist/components/Render.svelte +1 -15
- package/dist/components/WhenVisible.svelte +1 -1
- package/dist/createInertiaApp.d.ts +12 -4
- package/dist/createInertiaApp.js +16 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/layoutProps.svelte.d.ts +7 -5
- package/dist/layoutProps.svelte.js +13 -15
- package/dist/types.d.ts +4 -3
- package/dist/useForm.svelte.js +1 -1
- package/dist/useFormState.svelte.js +2 -1
- package/dist/useHttp.svelte.d.ts +6 -6
- package/dist/useHttp.svelte.js +2 -2
- package/dist/useRemember.svelte.js +1 -1
- package/package.json +5 -6
- package/resources/boost/skills/inertia-svelte-development/SKILL.blade.php +2 -2
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { router } from '@inertiajs/core'
|
|
18
18
|
import Render, { h, type RenderProps } from './Render.svelte'
|
|
19
19
|
import { setPage } from '../page.svelte'
|
|
20
|
-
import { resetLayoutProps } from '../layoutProps.svelte'
|
|
20
|
+
import { resetLayoutProps, storeState } from '../layoutProps.svelte'
|
|
21
21
|
|
|
22
22
|
interface Props {
|
|
23
23
|
initialComponent: InertiaAppProps['initialComponent']
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
let page = $state({ ...initialPage, flash: initialPage.flash ?? {} })
|
|
36
36
|
let renderProps = $derived.by<RenderProps>(() => resolveRenderProps(component, page, key))
|
|
37
37
|
|
|
38
|
+
// Synchronous initialization so the global page store is populated during SSR
|
|
39
|
+
// ($effect.pre does not run during Svelte 5 SSR)
|
|
40
|
+
setPage(page)
|
|
41
|
+
|
|
38
42
|
// Reactively update the global page state when local page state changes
|
|
39
43
|
$effect.pre(() => {
|
|
40
44
|
setPage(page)
|
|
@@ -94,7 +98,18 @@
|
|
|
94
98
|
return (component.layout as LayoutResolver)(h, child)
|
|
95
99
|
}
|
|
96
100
|
|
|
97
|
-
|
|
101
|
+
let effectiveLayout: LayoutType | undefined
|
|
102
|
+
const layoutValue = component.layout
|
|
103
|
+
|
|
104
|
+
if (
|
|
105
|
+
typeof layoutValue === 'function' &&
|
|
106
|
+
(layoutValue as Function).length <= 1 &&
|
|
107
|
+
typeof (layoutValue as Function).prototype === 'undefined'
|
|
108
|
+
) {
|
|
109
|
+
effectiveLayout = (layoutValue as Function)(page.props) as LayoutType | undefined
|
|
110
|
+
} else {
|
|
111
|
+
effectiveLayout = (layoutValue ?? defaultLayout?.(page.component, page)) as LayoutType | undefined
|
|
112
|
+
}
|
|
98
113
|
|
|
99
114
|
return effectiveLayout ? resolveLayout(effectiveLayout, child, page.props, key, !!component.layout) : child
|
|
100
115
|
}
|
|
@@ -113,9 +128,21 @@
|
|
|
113
128
|
const layouts = normalizeLayouts(layout, isComponent, isFromPage ? isRenderFunction : undefined)
|
|
114
129
|
|
|
115
130
|
if (layouts.length > 0) {
|
|
131
|
+
const dynamicProps = isServer ? { shared: {}, named: {} } : { shared: storeState.shared, named: storeState.named }
|
|
132
|
+
|
|
116
133
|
return layouts.reduceRight((child, layout) => {
|
|
117
134
|
return {
|
|
118
|
-
...h(
|
|
135
|
+
...h(
|
|
136
|
+
layout.component,
|
|
137
|
+
{
|
|
138
|
+
...pageProps,
|
|
139
|
+
...layout.props,
|
|
140
|
+
...dynamicProps.shared,
|
|
141
|
+
...(layout.name ? dynamicProps.named[layout.name] || {} : {}),
|
|
142
|
+
},
|
|
143
|
+
[child],
|
|
144
|
+
key,
|
|
145
|
+
),
|
|
119
146
|
name: layout.name,
|
|
120
147
|
}
|
|
121
148
|
}, child)
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
UseFormUtils,
|
|
17
17
|
} from '@inertiajs/core'
|
|
18
18
|
import { type NamedInputEvent, type ValidationConfig, type Validator } from 'laravel-precognition'
|
|
19
|
-
import { isEqual } from '
|
|
19
|
+
import { isEqual } from 'es-toolkit'
|
|
20
20
|
import { onMount } from 'svelte'
|
|
21
21
|
import { setFormContext } from './formContext'
|
|
22
22
|
import useForm from '../useForm.svelte'
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
useInfiniteScroll,
|
|
10
10
|
} from '@inertiajs/core'
|
|
11
11
|
import { onDestroy, onMount } from 'svelte'
|
|
12
|
+
import { usePage } from '../page.svelte'
|
|
12
13
|
|
|
13
14
|
interface Props {
|
|
14
15
|
data: InfiniteScrollComponentBaseProps['data']
|
|
@@ -57,11 +58,13 @@
|
|
|
57
58
|
let itemsElementRef: HTMLElement = $state(null!)
|
|
58
59
|
let startElementRef: HTMLElement = $state(null!)
|
|
59
60
|
let endElementRef: HTMLElement = $state(null!)
|
|
61
|
+
const scrollProp = usePage().scrollProps?.[data]
|
|
62
|
+
|
|
60
63
|
let loadingPrevious = $state(false)
|
|
61
64
|
let loadingNext = $state(false)
|
|
62
65
|
let requestCount = $state(0)
|
|
63
|
-
let hasPreviousPage = $state(
|
|
64
|
-
let hasNextPage = $state(
|
|
66
|
+
let hasPreviousPage = $state(!!scrollProp?.previousPage)
|
|
67
|
+
let hasNextPage = $state(!!scrollProp?.nextPage)
|
|
65
68
|
|
|
66
69
|
let infiniteScrollInstance: UseInfiniteScrollProps = $state(null!)
|
|
67
70
|
|
|
@@ -39,23 +39,9 @@
|
|
|
39
39
|
|
|
40
40
|
<script lang="ts">
|
|
41
41
|
import Render from './Render.svelte'
|
|
42
|
-
import { setContext } from 'svelte'
|
|
43
|
-
import { LAYOUT_CONTEXT_KEY } from '../layoutProps.svelte'
|
|
44
42
|
|
|
45
43
|
// svelte-ignore state_referenced_locally
|
|
46
|
-
const { component, props = {}, children = [], key = null
|
|
47
|
-
|
|
48
|
-
// svelte-ignore state_referenced_locally
|
|
49
|
-
if (children.length > 0) {
|
|
50
|
-
setContext(LAYOUT_CONTEXT_KEY, {
|
|
51
|
-
get staticProps() {
|
|
52
|
-
return props
|
|
53
|
-
},
|
|
54
|
-
get name() {
|
|
55
|
-
return name
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
}
|
|
44
|
+
const { component, props = {}, children = [], key = null }: RenderProps = $props()
|
|
59
45
|
</script>
|
|
60
46
|
|
|
61
47
|
{#if component}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreateInertiaAppOptions, type CreateInertiaAppOptionsForCSR, type InertiaAppSSRResponse, type Page, type PageProps } from '@inertiajs/core';
|
|
1
|
+
import { type CreateInertiaAppOptions, type CreateInertiaAppOptionsForCSR, type InertiaAppSSRResponse, type Page, type PageProps, type SharedPageProps } from '@inertiajs/core';
|
|
2
2
|
import App, { type InertiaAppProps } from './components/App.svelte';
|
|
3
3
|
import type { ComponentResolver, SvelteInertiaAppConfig } from './types';
|
|
4
4
|
type SvelteRenderResult = {
|
|
@@ -10,14 +10,22 @@ type SetupOptions<SharedProps extends PageProps> = {
|
|
|
10
10
|
App: typeof App;
|
|
11
11
|
props: InertiaAppProps<SharedProps>;
|
|
12
12
|
};
|
|
13
|
-
type InertiaAppOptionsForCSR<SharedProps extends PageProps> = CreateInertiaAppOptionsForCSR<SharedProps, ComponentResolver, SetupOptions<SharedProps>, SvelteRenderResult | void, SvelteInertiaAppConfig
|
|
13
|
+
type InertiaAppOptionsForCSR<SharedProps extends PageProps> = CreateInertiaAppOptionsForCSR<SharedProps, ComponentResolver, SetupOptions<SharedProps>, SvelteRenderResult | void, SvelteInertiaAppConfig> & {
|
|
14
|
+
withApp?: (context: Map<any, any>, options: {
|
|
15
|
+
ssr: boolean;
|
|
16
|
+
}) => void;
|
|
17
|
+
};
|
|
14
18
|
type InertiaAppOptionsAuto<SharedProps extends PageProps> = CreateInertiaAppOptions<ComponentResolver, SetupOptions<SharedProps>, SvelteRenderResult | void, SvelteInertiaAppConfig> & {
|
|
15
19
|
page?: Page<SharedProps>;
|
|
20
|
+
withApp?: (context: Map<any, any>, options: {
|
|
21
|
+
ssr: boolean;
|
|
22
|
+
}) => void;
|
|
16
23
|
};
|
|
17
24
|
type SvelteServerRender = (component: typeof App, options: {
|
|
18
25
|
props: InertiaAppProps<PageProps>;
|
|
26
|
+
context?: Map<any, any>;
|
|
19
27
|
}) => SvelteRenderResult;
|
|
20
28
|
type RenderFunction<SharedProps extends PageProps> = (page: Page<SharedProps>, render: SvelteServerRender) => Promise<InertiaAppSSRResponse>;
|
|
21
|
-
export default function createInertiaApp<SharedProps extends PageProps = PageProps>(options: InertiaAppOptionsForCSR<SharedProps>): Promise<InertiaAppSSRResponse | void>;
|
|
22
|
-
export default function createInertiaApp<SharedProps extends PageProps = PageProps>(options?: InertiaAppOptionsAuto<SharedProps>): Promise<void | RenderFunction<SharedProps>>;
|
|
29
|
+
export default function createInertiaApp<SharedProps extends PageProps = PageProps & SharedPageProps>(options: InertiaAppOptionsForCSR<SharedProps>): Promise<InertiaAppSSRResponse | void>;
|
|
30
|
+
export default function createInertiaApp<SharedProps extends PageProps = PageProps & SharedPageProps>(options?: InertiaAppOptionsAuto<SharedProps>): Promise<void | RenderFunction<SharedProps>>;
|
|
23
31
|
export {};
|
package/dist/createInertiaApp.js
CHANGED
|
@@ -2,7 +2,7 @@ import { buildSSRBody, getInitialPageFromDOM, http as httpModule, router, setupP
|
|
|
2
2
|
import { hydrate, mount } from 'svelte';
|
|
3
3
|
import App, {} from './components/App.svelte';
|
|
4
4
|
import { config } from './index';
|
|
5
|
-
export default async function createInertiaApp({ id = 'app', resolve, setup, progress = {}, page, defaults = {}, http, layout, } = {}) {
|
|
5
|
+
export default async function createInertiaApp({ id = 'app', resolve, setup, progress = {}, page, defaults = {}, http, layout, withApp, } = {}) {
|
|
6
6
|
config.replace(defaults);
|
|
7
7
|
if (http) {
|
|
8
8
|
httpModule.setClient(http);
|
|
@@ -27,7 +27,11 @@ export default async function createInertiaApp({ id = 'app', resolve, setup, pro
|
|
|
27
27
|
svelteApp = result;
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
|
|
30
|
+
const context = new Map();
|
|
31
|
+
if (withApp) {
|
|
32
|
+
withApp(context, { ssr: true });
|
|
33
|
+
}
|
|
34
|
+
svelteApp = render(App, { props, context });
|
|
31
35
|
}
|
|
32
36
|
const body = buildSSRBody(id, page, svelteApp.body);
|
|
33
37
|
return {
|
|
@@ -60,11 +64,17 @@ export default async function createInertiaApp({ id = 'app', resolve, setup, pro
|
|
|
60
64
|
if (setup) {
|
|
61
65
|
await setup({ el: target, App, props });
|
|
62
66
|
}
|
|
63
|
-
else if (target.hasAttribute('data-server-rendered')) {
|
|
64
|
-
hydrate(App, { target, props });
|
|
65
|
-
}
|
|
66
67
|
else {
|
|
67
|
-
|
|
68
|
+
const context = new Map();
|
|
69
|
+
if (withApp) {
|
|
70
|
+
withApp(context, { ssr: false });
|
|
71
|
+
}
|
|
72
|
+
if (target.hasAttribute('data-server-rendered')) {
|
|
73
|
+
hydrate(App, { target, props, context });
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
mount(App, { target, props, context });
|
|
77
|
+
}
|
|
68
78
|
}
|
|
69
79
|
if (progress) {
|
|
70
80
|
setupProgress(progress);
|
package/dist/index.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ export { default as InfiniteScroll } from './components/InfiniteScroll.svelte';
|
|
|
8
8
|
export { default as Link } from './components/Link.svelte';
|
|
9
9
|
export { default as WhenVisible } from './components/WhenVisible.svelte';
|
|
10
10
|
export { default as createInertiaApp } from './createInertiaApp';
|
|
11
|
-
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor
|
|
11
|
+
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor } from './layoutProps.svelte';
|
|
12
12
|
export { default as inertia } from './link';
|
|
13
13
|
export { default as page, usePage } from './page.svelte';
|
|
14
|
-
export { type ResolvedComponent, type SvelteInertiaAppConfig } from './types';
|
|
14
|
+
export { type LayoutCallback, type ResolvedComponent, type SvelteInertiaAppConfig } from './types';
|
|
15
15
|
export { default as useForm, type InertiaForm, type InertiaFormProps, type InertiaPrecognitiveForm, } from './useForm.svelte';
|
|
16
16
|
export { default as useHttp } from './useHttp.svelte';
|
|
17
17
|
export { default as usePoll } from './usePoll';
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { default as InfiniteScroll } from './components/InfiniteScroll.svelte';
|
|
|
9
9
|
export { default as Link } from './components/Link.svelte';
|
|
10
10
|
export { default as WhenVisible } from './components/WhenVisible.svelte';
|
|
11
11
|
export { default as createInertiaApp } from './createInertiaApp';
|
|
12
|
-
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor
|
|
12
|
+
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor } from './layoutProps.svelte';
|
|
13
13
|
export { default as inertia } from './link';
|
|
14
14
|
export { default as page, usePage } from './page.svelte';
|
|
15
15
|
export {} from './types';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare
|
|
3
|
-
|
|
1
|
+
import { type LayoutProps, type NamedLayoutProps } from '@inertiajs/core';
|
|
2
|
+
export declare const storeState: {
|
|
3
|
+
shared: Record<string, unknown>;
|
|
4
|
+
named: Record<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
export declare function setLayoutProps(props: Partial<LayoutProps>): void;
|
|
7
|
+
export declare function setLayoutPropsFor<K extends keyof NamedLayoutProps>(name: K, props: Partial<NamedLayoutProps[K]>): void;
|
|
4
8
|
export declare function resetLayoutProps(): void;
|
|
5
|
-
export declare const LAYOUT_CONTEXT_KEY: unique symbol;
|
|
6
|
-
export declare function useLayoutProps<T extends Record<string, unknown>>(defaults: T): Readable<T>;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { createLayoutPropsStore
|
|
2
|
-
import { getContext } from 'svelte';
|
|
3
|
-
import { readable } from 'svelte/store';
|
|
1
|
+
import { createLayoutPropsStore } from '@inertiajs/core';
|
|
4
2
|
const store = createLayoutPropsStore();
|
|
3
|
+
export const storeState = $state({
|
|
4
|
+
shared: {},
|
|
5
|
+
named: {},
|
|
6
|
+
});
|
|
7
|
+
store.subscribe(() => {
|
|
8
|
+
const snapshot = store.get();
|
|
9
|
+
storeState.shared = snapshot.shared;
|
|
10
|
+
storeState.named = snapshot.named;
|
|
11
|
+
});
|
|
5
12
|
export function setLayoutProps(props) {
|
|
6
13
|
store.set(props);
|
|
7
14
|
}
|
|
@@ -10,16 +17,7 @@ export function setLayoutPropsFor(name, props) {
|
|
|
10
17
|
}
|
|
11
18
|
export function resetLayoutProps() {
|
|
12
19
|
store.reset();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const context = getContext(LAYOUT_CONTEXT_KEY);
|
|
17
|
-
const resolve = () => {
|
|
18
|
-
const staticProps = context?.staticProps ?? {};
|
|
19
|
-
const name = context?.name;
|
|
20
|
-
const { shared, named } = store.get();
|
|
21
|
-
const dynamicProps = name ? { ...shared, ...named[name] } : shared;
|
|
22
|
-
return mergeLayoutProps(defaults, staticProps, dynamicProps);
|
|
23
|
-
};
|
|
24
|
-
return readable(resolve(), (set) => store.subscribe(() => set(resolve())));
|
|
20
|
+
const snapshot = store.get();
|
|
21
|
+
storeState.shared = snapshot.shared;
|
|
22
|
+
storeState.named = snapshot.named;
|
|
25
23
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { type Page } from '@inertiajs/core';
|
|
1
|
+
import { type Page, type SharedPageProps } from '@inertiajs/core';
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { RenderFunction, RenderProps } from './components/Render.svelte';
|
|
4
|
-
export type ComponentResolver = (name: string, page?: Page) => ResolvedComponent | Promise<ResolvedComponent>;
|
|
4
|
+
export type ComponentResolver = (name: string, page?: Page<SharedPageProps>) => ResolvedComponent | Promise<ResolvedComponent>;
|
|
5
5
|
export type LayoutResolver = (h: RenderFunction, page: RenderProps) => RenderProps;
|
|
6
|
+
export type LayoutCallback = (props: SharedPageProps) => unknown;
|
|
6
7
|
export type LayoutTuple = [Component, Record<string, unknown>?];
|
|
7
8
|
export type LayoutObject = {
|
|
8
9
|
component: Component;
|
|
9
10
|
props?: Record<string, unknown>;
|
|
10
11
|
};
|
|
11
12
|
export type NamedLayouts = Record<string, Component | LayoutTuple | LayoutObject>;
|
|
12
|
-
export type LayoutType = LayoutResolver | Component | Component[] | LayoutTuple | LayoutObject | NamedLayouts | (Component | LayoutTuple | LayoutObject)[];
|
|
13
|
+
export type LayoutType = LayoutResolver | LayoutCallback | Component | Component[] | LayoutTuple | LayoutObject | NamedLayouts | (Component | LayoutTuple | LayoutObject)[];
|
|
13
14
|
export type ResolvedComponent = {
|
|
14
15
|
default: Component;
|
|
15
16
|
layout?: LayoutType;
|
package/dist/useForm.svelte.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { router, UseFormUtils } from '@inertiajs/core';
|
|
2
|
+
import { cloneDeep, isEqual } from 'es-toolkit';
|
|
3
|
+
import { get, has, set } from 'es-toolkit/compat';
|
|
2
4
|
import { createValidator, resolveName, toSimpleValidationErrors } from 'laravel-precognition';
|
|
3
|
-
import { cloneDeep, get, has, isEqual, set } from 'lodash-es';
|
|
4
5
|
import { config } from '.';
|
|
5
6
|
export default function useFormState(options) {
|
|
6
7
|
const { data: dataOption, rememberKey, precognitionEndpoint: initialPrecognitionEndpoint } = options;
|
package/dist/useHttp.svelte.d.ts
CHANGED
|
@@ -21,12 +21,12 @@ export interface UseHttpProps<TForm extends object, TResponse = unknown> {
|
|
|
21
21
|
resetAndClearErrors<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
22
22
|
setError<K extends FormDataKeys<TForm>>(field: K, value: ErrorValue): this;
|
|
23
23
|
setError(errors: FormDataErrors<TForm>): this;
|
|
24
|
-
submit(...args: UseHttpSubmitArguments<
|
|
25
|
-
get(url: string, options?: UseHttpSubmitOptions<
|
|
26
|
-
post(url: string, options?: UseHttpSubmitOptions<
|
|
27
|
-
put(url: string, options?: UseHttpSubmitOptions<
|
|
28
|
-
patch(url: string, options?: UseHttpSubmitOptions<
|
|
29
|
-
delete(url: string, options?: UseHttpSubmitOptions<
|
|
24
|
+
submit<R = TResponse>(...args: UseHttpSubmitArguments<R, TForm>): Promise<R>;
|
|
25
|
+
get<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
26
|
+
post<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
27
|
+
put<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
28
|
+
patch<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
29
|
+
delete<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
30
30
|
cancel(): void;
|
|
31
31
|
dontRemember<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
32
32
|
optimistic(callback: (currentData: TForm) => Partial<TForm>): this;
|
package/dist/useHttp.svelte.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hasFiles, http, HttpCancelledError, HttpResponseError, mergeDataIntoQueryString, objectToFormData, UseFormUtils, } from '@inertiajs/core';
|
|
2
|
+
import { cloneDeep } from 'es-toolkit';
|
|
2
3
|
import { toSimpleValidationErrors } from 'laravel-precognition';
|
|
3
|
-
import { cloneDeep } from 'lodash-es';
|
|
4
4
|
import useFormState, {} from './useFormState.svelte';
|
|
5
5
|
export default function useHttp(...args) {
|
|
6
6
|
const { rememberKey, data, precognitionEndpoint } = UseFormUtils.parseUseFormArguments(...args);
|
|
@@ -72,7 +72,7 @@ export default function useHttp(...args) {
|
|
|
72
72
|
options.onProgress?.(event);
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
|
-
const responseData = JSON.parse(response.data);
|
|
75
|
+
const responseData = (response.data ? JSON.parse(response.data) : null);
|
|
76
76
|
if (response.status >= 200 && response.status < 300) {
|
|
77
77
|
markAsSuccessful();
|
|
78
78
|
setFormState('response', responseData);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { router } from '@inertiajs/core';
|
|
2
|
-
import { cloneDeep } from '
|
|
2
|
+
import { cloneDeep } from 'es-toolkit';
|
|
3
3
|
export default function useRemember(initialState, key) {
|
|
4
4
|
const restored = router.restore(key);
|
|
5
5
|
const state = $state(restored !== undefined ? cloneDeep(restored) : initialState);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiajs/svelte",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Svelte adapter for Inertia.js",
|
|
6
6
|
"contributors": [
|
|
@@ -53,10 +53,9 @@
|
|
|
53
53
|
"svelte": "^5.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"
|
|
57
|
-
"laravel-precognition": "2.0.0-beta.
|
|
58
|
-
"
|
|
59
|
-
"@inertiajs/core": "3.0.0-beta.2"
|
|
56
|
+
"es-toolkit": "^1.33.0",
|
|
57
|
+
"laravel-precognition": "2.0.0-beta.5",
|
|
58
|
+
"@inertiajs/core": "3.0.0-beta.4"
|
|
60
59
|
},
|
|
61
60
|
"scripts": {
|
|
62
61
|
"build": "pnpm package && svelte-check --tsconfig ./tsconfig.json && publint",
|
|
@@ -64,7 +63,7 @@
|
|
|
64
63
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
65
64
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
66
65
|
"dev": "pnpm package --watch",
|
|
67
|
-
"
|
|
66
|
+
"es2022-check": "pnpm build:with-deps && es-check es2022 \"dist/**/*.js\" --checkFeatures --module --noCache --verbose",
|
|
68
67
|
"package": "svelte-kit sync && svelte-package --input src"
|
|
69
68
|
}
|
|
70
69
|
}
|
|
@@ -389,8 +389,8 @@ const layout = useLayoutProps({
|
|
|
389
389
|
let { children } = $props()
|
|
390
390
|
</script>
|
|
391
391
|
|
|
392
|
-
<header>{
|
|
393
|
-
{#if
|
|
392
|
+
<header>{layout.title}</header>
|
|
393
|
+
{#if layout.showSidebar}
|
|
394
394
|
<aside>Sidebar</aside>
|
|
395
395
|
{/if}
|
|
396
396
|
<main>
|