@inertiajs/svelte 2.3.17 → 3.0.0-beta.1
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 +120 -44
- package/dist/components/App.svelte.d.ts +10 -19
- package/dist/components/Deferred.svelte +68 -9
- package/dist/components/Deferred.svelte.d.ts +9 -20
- package/dist/components/Form.svelte +358 -242
- package/dist/components/Form.svelte.d.ts +51 -96
- package/dist/components/InfiniteScroll.svelte +227 -167
- package/dist/components/InfiniteScroll.svelte.d.ts +29 -116
- package/dist/components/Link.svelte +96 -48
- package/dist/components/Link.svelte.d.ts +49 -56
- package/dist/components/Render.svelte +62 -21
- package/dist/components/Render.svelte.d.ts +9 -25
- package/dist/components/WhenVisible.svelte +83 -66
- package/dist/components/WhenVisible.svelte.d.ts +11 -26
- package/dist/components/createForm.d.ts +8 -0
- package/dist/components/createForm.js +4 -0
- package/dist/components/formContext.d.ts +3 -3
- package/dist/components/formContext.js +9 -3
- package/dist/createInertiaApp.d.ts +12 -7
- package/dist/createInertiaApp.js +63 -24
- package/dist/index.d.ts +8 -5
- package/dist/index.js +8 -5
- package/dist/layoutProps.svelte.d.ts +6 -0
- package/dist/layoutProps.svelte.js +25 -0
- package/dist/link.js +13 -2
- package/dist/page.svelte.d.ts +10 -0
- package/dist/page.svelte.js +14 -0
- package/dist/types.d.ts +11 -4
- package/dist/types.js +1 -1
- package/dist/{useForm.d.ts → useForm.svelte.d.ts} +4 -4
- package/dist/useForm.svelte.js +116 -0
- package/dist/useFormState.svelte.d.ts +84 -0
- package/dist/useFormState.svelte.js +290 -0
- package/dist/useHttp.svelte.d.ts +61 -0
- package/dist/useHttp.svelte.js +154 -0
- package/dist/usePrefetch.svelte.d.ts +7 -0
- package/dist/{usePrefetch.js → usePrefetch.svelte.js} +18 -13
- package/dist/useRemember.svelte.d.ts +1 -0
- package/dist/useRemember.svelte.js +10 -0
- package/package.json +11 -11
- package/dist/page.d.ts +0 -13
- package/dist/page.js +0 -8
- package/dist/useForm.js +0 -356
- package/dist/usePrefetch.d.ts +0 -7
- package/dist/useRemember.d.ts +0 -1
- package/dist/useRemember.js +0 -11
|
@@ -1,117 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
hasNext?: (() => boolean) | undefined;
|
|
23
|
-
};
|
|
24
|
-
events: {
|
|
25
|
-
[evt: string]: CustomEvent<any>;
|
|
26
|
-
};
|
|
27
|
-
slots: {
|
|
28
|
-
previous: {
|
|
29
|
-
loadingPrevious: boolean;
|
|
30
|
-
loadingNext: boolean;
|
|
31
|
-
hasPrevious: boolean;
|
|
32
|
-
hasNext: boolean;
|
|
33
|
-
loading: boolean;
|
|
34
|
-
fetch: (options?: any) => void;
|
|
35
|
-
autoMode: boolean;
|
|
36
|
-
manualMode: boolean;
|
|
37
|
-
hasMore: boolean;
|
|
38
|
-
exposedPrevious: {
|
|
39
|
-
loadingPrevious: boolean;
|
|
40
|
-
loadingNext: boolean;
|
|
41
|
-
hasPrevious: boolean;
|
|
42
|
-
hasNext: boolean;
|
|
43
|
-
loading: boolean;
|
|
44
|
-
fetch: (options?: any) => void;
|
|
45
|
-
autoMode: boolean;
|
|
46
|
-
manualMode: boolean;
|
|
47
|
-
hasMore: boolean;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
loading: {
|
|
51
|
-
loadingPrevious: boolean;
|
|
52
|
-
loadingNext: boolean;
|
|
53
|
-
hasPrevious: boolean;
|
|
54
|
-
hasNext: boolean;
|
|
55
|
-
loading: boolean;
|
|
56
|
-
fetch: (options?: any) => void;
|
|
57
|
-
autoMode: boolean;
|
|
58
|
-
manualMode: boolean;
|
|
59
|
-
hasMore: boolean;
|
|
60
|
-
exposedNext: {
|
|
61
|
-
loadingPrevious: boolean;
|
|
62
|
-
loadingNext: boolean;
|
|
63
|
-
hasPrevious: boolean;
|
|
64
|
-
hasNext: boolean;
|
|
65
|
-
loading: boolean;
|
|
66
|
-
fetch: (options?: any) => void;
|
|
67
|
-
autoMode: boolean;
|
|
68
|
-
manualMode: boolean;
|
|
69
|
-
hasMore: boolean;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
next: {
|
|
73
|
-
loadingPrevious: boolean;
|
|
74
|
-
loadingNext: boolean;
|
|
75
|
-
hasPrevious: boolean;
|
|
76
|
-
hasNext: boolean;
|
|
77
|
-
loading: boolean;
|
|
78
|
-
fetch: (options?: any) => void;
|
|
79
|
-
autoMode: boolean;
|
|
80
|
-
manualMode: boolean;
|
|
81
|
-
hasMore: boolean;
|
|
82
|
-
exposedNext: {
|
|
83
|
-
loadingPrevious: boolean;
|
|
84
|
-
loadingNext: boolean;
|
|
85
|
-
hasPrevious: boolean;
|
|
86
|
-
hasNext: boolean;
|
|
87
|
-
loading: boolean;
|
|
88
|
-
fetch: (options?: any) => void;
|
|
89
|
-
autoMode: boolean;
|
|
90
|
-
manualMode: boolean;
|
|
91
|
-
hasMore: boolean;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
default: {
|
|
95
|
-
loading: boolean;
|
|
96
|
-
loadingPrevious: boolean;
|
|
97
|
-
loadingNext: boolean;
|
|
98
|
-
exposedSlot: {
|
|
99
|
-
loading: boolean;
|
|
100
|
-
loadingPrevious: boolean;
|
|
101
|
-
loadingNext: boolean;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
exports?: undefined;
|
|
106
|
-
bindings?: undefined;
|
|
107
|
-
};
|
|
108
|
-
export type InfiniteScrollProps = typeof __propDef.props;
|
|
109
|
-
export type InfiniteScrollEvents = typeof __propDef.events;
|
|
110
|
-
export type InfiniteScrollSlots = typeof __propDef.slots;
|
|
111
|
-
export default class InfiniteScroll extends SvelteComponent<InfiniteScrollProps, InfiniteScrollEvents, InfiniteScrollSlots> {
|
|
112
|
-
get fetchPrevious(): (options?: any) => void;
|
|
113
|
-
get fetchNext(): (options?: any) => void;
|
|
114
|
-
get hasPrevious(): () => boolean;
|
|
115
|
-
get hasNext(): () => boolean;
|
|
1
|
+
import { type InfiniteScrollComponentBaseProps, type ReloadOptions } from '@inertiajs/core';
|
|
2
|
+
interface Props {
|
|
3
|
+
data: InfiniteScrollComponentBaseProps['data'];
|
|
4
|
+
buffer?: InfiniteScrollComponentBaseProps['buffer'];
|
|
5
|
+
as?: InfiniteScrollComponentBaseProps['as'];
|
|
6
|
+
manual?: InfiniteScrollComponentBaseProps['manual'];
|
|
7
|
+
manualAfter?: InfiniteScrollComponentBaseProps['manualAfter'];
|
|
8
|
+
preserveUrl?: InfiniteScrollComponentBaseProps['preserveUrl'];
|
|
9
|
+
reverse?: InfiniteScrollComponentBaseProps['reverse'];
|
|
10
|
+
autoScroll?: InfiniteScrollComponentBaseProps['autoScroll'];
|
|
11
|
+
startElement?: string | (() => HTMLElement | null) | null;
|
|
12
|
+
endElement?: string | (() => HTMLElement | null) | null;
|
|
13
|
+
itemsElement?: string | (() => HTMLElement | null) | null;
|
|
14
|
+
params?: ReloadOptions;
|
|
15
|
+
onlyNext?: boolean;
|
|
16
|
+
onlyPrevious?: boolean;
|
|
17
|
+
previous?: import('svelte').Snippet<[any]>;
|
|
18
|
+
loading?: import('svelte').Snippet<[any]>;
|
|
19
|
+
next?: import('svelte').Snippet<[any]>;
|
|
20
|
+
children?: import('svelte').Snippet<[any]>;
|
|
21
|
+
[key: string]: any;
|
|
116
22
|
}
|
|
117
|
-
|
|
23
|
+
declare const InfiniteScroll: import("svelte").Component<Props, {
|
|
24
|
+
fetchPrevious: (options?: any) => void;
|
|
25
|
+
fetchNext: (options?: any) => void;
|
|
26
|
+
hasPrevious: () => boolean;
|
|
27
|
+
hasNext: () => boolean;
|
|
28
|
+
}, "">;
|
|
29
|
+
type InfiniteScroll = ReturnType<typeof InfiniteScroll>;
|
|
30
|
+
export default InfiniteScroll;
|
|
@@ -1,32 +1,97 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { isUrlMethodPair, resolveUrlMethodPairComponent } from '@inertiajs/core'
|
|
3
|
+
import type { LinkComponentBaseProps } from '@inertiajs/core'
|
|
4
|
+
import { inertia } from '../index'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
href?: LinkComponentBaseProps['href']
|
|
8
|
+
as?: keyof HTMLElementTagNameMap
|
|
9
|
+
data?: LinkComponentBaseProps['data']
|
|
10
|
+
method?: LinkComponentBaseProps['method']
|
|
11
|
+
replace?: LinkComponentBaseProps['replace']
|
|
12
|
+
preserveScroll?: LinkComponentBaseProps['preserveScroll']
|
|
13
|
+
preserveState?: LinkComponentBaseProps['preserveState'] | null
|
|
14
|
+
preserveUrl?: LinkComponentBaseProps['preserveUrl']
|
|
15
|
+
only?: LinkComponentBaseProps['only']
|
|
16
|
+
except?: LinkComponentBaseProps['except']
|
|
17
|
+
headers?: LinkComponentBaseProps['headers']
|
|
18
|
+
queryStringArrayFormat?: LinkComponentBaseProps['queryStringArrayFormat']
|
|
19
|
+
async?: LinkComponentBaseProps['async']
|
|
20
|
+
prefetch?: LinkComponentBaseProps['prefetch']
|
|
21
|
+
cacheFor?: LinkComponentBaseProps['cacheFor']
|
|
22
|
+
cacheTags?: LinkComponentBaseProps['cacheTags']
|
|
23
|
+
viewTransition?: LinkComponentBaseProps['viewTransition']
|
|
24
|
+
component?: LinkComponentBaseProps['component']
|
|
25
|
+
instant?: LinkComponentBaseProps['instant']
|
|
26
|
+
pageProps?: LinkComponentBaseProps['pageProps']
|
|
27
|
+
children?: import('svelte').Snippet
|
|
28
|
+
[key: string]: any
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Are these defined anywhere else?
|
|
32
|
+
type Callbacks = {
|
|
33
|
+
onfocus?: () => void
|
|
34
|
+
onblur?: () => void
|
|
35
|
+
onclick?: () => void
|
|
36
|
+
ondblclick?: () => void
|
|
37
|
+
onmousedown?: () => void
|
|
38
|
+
onmousemove?: () => void
|
|
39
|
+
onmouseout?: () => void
|
|
40
|
+
onmouseover?: () => void
|
|
41
|
+
onmouseup?: () => void
|
|
42
|
+
'oncancel-token'?: () => void
|
|
43
|
+
onbefore?: () => void
|
|
44
|
+
onstart?: () => void
|
|
45
|
+
onprogress?: () => void
|
|
46
|
+
onfinish?: () => void
|
|
47
|
+
oncancel?: () => void
|
|
48
|
+
onsuccess?: () => void
|
|
49
|
+
onerror?: () => void
|
|
50
|
+
onprefetching?: () => void
|
|
51
|
+
onprefetched?: () => void
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let {
|
|
55
|
+
href = '',
|
|
56
|
+
as = 'a',
|
|
57
|
+
data = {},
|
|
58
|
+
method = 'get',
|
|
59
|
+
replace = false,
|
|
60
|
+
preserveScroll = false,
|
|
61
|
+
preserveState = null,
|
|
62
|
+
preserveUrl = false,
|
|
63
|
+
only = [],
|
|
64
|
+
except = [],
|
|
65
|
+
headers = {},
|
|
66
|
+
queryStringArrayFormat = 'brackets',
|
|
67
|
+
async = false,
|
|
68
|
+
prefetch = false,
|
|
69
|
+
cacheFor = 0,
|
|
70
|
+
cacheTags = [],
|
|
71
|
+
viewTransition = false,
|
|
72
|
+
component = undefined,
|
|
73
|
+
instant = false,
|
|
74
|
+
pageProps = null,
|
|
75
|
+
children,
|
|
76
|
+
...rest
|
|
77
|
+
}: Props & Callbacks = $props()
|
|
78
|
+
|
|
79
|
+
let _method = $derived(isUrlMethodPair(href) ? href.method : method)
|
|
80
|
+
let _href = $derived(isUrlMethodPair(href) ? href.url : href)
|
|
81
|
+
let resolvedComponent = $derived(
|
|
82
|
+
component ? component : instant && isUrlMethodPair(href) ? resolveUrlMethodPairComponent(href) : null,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
let asProp = $derived(_method !== 'get' ? 'button' : as.toLowerCase())
|
|
86
|
+
let elProps = $derived(
|
|
87
|
+
{
|
|
88
|
+
a: { href: _href },
|
|
89
|
+
button: { type: 'button' },
|
|
90
|
+
}[asProp] || {},
|
|
91
|
+
)
|
|
27
92
|
</script>
|
|
28
93
|
|
|
29
|
-
<!-- svelte-ignore
|
|
94
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
30
95
|
<svelte:element
|
|
31
96
|
this={asProp}
|
|
32
97
|
use:inertia={{
|
|
@@ -46,28 +111,11 @@ $: elProps = {
|
|
|
46
111
|
cacheFor,
|
|
47
112
|
cacheTags,
|
|
48
113
|
viewTransition,
|
|
114
|
+
component: resolvedComponent,
|
|
115
|
+
pageProps,
|
|
49
116
|
}}
|
|
50
|
-
{
|
|
117
|
+
{...rest}
|
|
51
118
|
{...elProps}
|
|
52
|
-
on:focus
|
|
53
|
-
on:blur
|
|
54
|
-
on:click
|
|
55
|
-
on:dblclick
|
|
56
|
-
on:mousedown
|
|
57
|
-
on:mousemove
|
|
58
|
-
on:mouseout
|
|
59
|
-
on:mouseover
|
|
60
|
-
on:mouseup
|
|
61
|
-
on:cancel-token
|
|
62
|
-
on:before
|
|
63
|
-
on:start
|
|
64
|
-
on:progress
|
|
65
|
-
on:finish
|
|
66
|
-
on:cancel
|
|
67
|
-
on:success
|
|
68
|
-
on:error
|
|
69
|
-
on:prefetching
|
|
70
|
-
on:prefetched
|
|
71
119
|
>
|
|
72
|
-
|
|
120
|
+
{@render children?.()}
|
|
73
121
|
</svelte:element>
|
|
@@ -1,57 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
blur: FocusEvent;
|
|
26
|
-
click: PointerEvent;
|
|
27
|
-
dblclick: MouseEvent;
|
|
28
|
-
mousedown: MouseEvent;
|
|
29
|
-
mousemove: MouseEvent;
|
|
30
|
-
mouseout: MouseEvent;
|
|
31
|
-
mouseover: MouseEvent;
|
|
32
|
-
mouseup: MouseEvent;
|
|
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
|
-
progress: ProgressEvent<EventTarget>;
|
|
37
|
-
finish: InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
38
|
-
cancel: Event;
|
|
39
|
-
success: InputEvent | UIEvent | Event | SubmitEvent | ProgressEvent<EventTarget> | ErrorEvent | FormDataEvent | AnimationEvent | PointerEvent | MouseEvent | ToggleEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | KeyboardEvent | SecurityPolicyViolationEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
40
|
-
error: ErrorEvent;
|
|
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
|
-
} & {
|
|
44
|
-
[evt: string]: CustomEvent<any>;
|
|
45
|
-
};
|
|
46
|
-
slots: {
|
|
47
|
-
default: {};
|
|
48
|
-
};
|
|
49
|
-
exports?: undefined;
|
|
50
|
-
bindings?: undefined;
|
|
51
|
-
};
|
|
52
|
-
export type LinkProps = typeof __propDef.props;
|
|
53
|
-
export type LinkEvents = typeof __propDef.events;
|
|
54
|
-
export type LinkSlots = typeof __propDef.slots;
|
|
55
|
-
export default class Link extends SvelteComponent<LinkProps, LinkEvents, LinkSlots> {
|
|
1
|
+
import type { LinkComponentBaseProps } from '@inertiajs/core';
|
|
2
|
+
interface Props {
|
|
3
|
+
href?: LinkComponentBaseProps['href'];
|
|
4
|
+
as?: keyof HTMLElementTagNameMap;
|
|
5
|
+
data?: LinkComponentBaseProps['data'];
|
|
6
|
+
method?: LinkComponentBaseProps['method'];
|
|
7
|
+
replace?: LinkComponentBaseProps['replace'];
|
|
8
|
+
preserveScroll?: LinkComponentBaseProps['preserveScroll'];
|
|
9
|
+
preserveState?: LinkComponentBaseProps['preserveState'] | null;
|
|
10
|
+
preserveUrl?: LinkComponentBaseProps['preserveUrl'];
|
|
11
|
+
only?: LinkComponentBaseProps['only'];
|
|
12
|
+
except?: LinkComponentBaseProps['except'];
|
|
13
|
+
headers?: LinkComponentBaseProps['headers'];
|
|
14
|
+
queryStringArrayFormat?: LinkComponentBaseProps['queryStringArrayFormat'];
|
|
15
|
+
async?: LinkComponentBaseProps['async'];
|
|
16
|
+
prefetch?: LinkComponentBaseProps['prefetch'];
|
|
17
|
+
cacheFor?: LinkComponentBaseProps['cacheFor'];
|
|
18
|
+
cacheTags?: LinkComponentBaseProps['cacheTags'];
|
|
19
|
+
viewTransition?: LinkComponentBaseProps['viewTransition'];
|
|
20
|
+
component?: LinkComponentBaseProps['component'];
|
|
21
|
+
instant?: LinkComponentBaseProps['instant'];
|
|
22
|
+
pageProps?: LinkComponentBaseProps['pageProps'];
|
|
23
|
+
children?: import('svelte').Snippet;
|
|
24
|
+
[key: string]: any;
|
|
56
25
|
}
|
|
57
|
-
|
|
26
|
+
type Callbacks = {
|
|
27
|
+
onfocus?: () => void;
|
|
28
|
+
onblur?: () => void;
|
|
29
|
+
onclick?: () => void;
|
|
30
|
+
ondblclick?: () => void;
|
|
31
|
+
onmousedown?: () => void;
|
|
32
|
+
onmousemove?: () => void;
|
|
33
|
+
onmouseout?: () => void;
|
|
34
|
+
onmouseover?: () => void;
|
|
35
|
+
onmouseup?: () => void;
|
|
36
|
+
'oncancel-token'?: () => void;
|
|
37
|
+
onbefore?: () => void;
|
|
38
|
+
onstart?: () => void;
|
|
39
|
+
onprogress?: () => void;
|
|
40
|
+
onfinish?: () => void;
|
|
41
|
+
oncancel?: () => void;
|
|
42
|
+
onsuccess?: () => void;
|
|
43
|
+
onerror?: () => void;
|
|
44
|
+
onprefetching?: () => void;
|
|
45
|
+
onprefetched?: () => void;
|
|
46
|
+
};
|
|
47
|
+
type $$ComponentProps = Props & Callbacks;
|
|
48
|
+
declare const Link: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
49
|
+
type Link = ReturnType<typeof Link>;
|
|
50
|
+
export default Link;
|
|
@@ -1,34 +1,75 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { PageProps } from '@inertiajs/core'
|
|
3
|
+
import type { Component } from 'svelte'
|
|
4
|
+
|
|
5
|
+
export type RenderProps = {
|
|
6
|
+
component: Component
|
|
7
|
+
props?: PageProps
|
|
8
|
+
children?: RenderProps[]
|
|
9
|
+
key?: number | null
|
|
10
|
+
name?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type RenderFunction = {
|
|
14
|
+
(component: Component, props?: PageProps, children?: RenderProps[], key?: number | null): RenderProps
|
|
15
|
+
(component: Component, children?: RenderProps[], key?: number | null): RenderProps
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const h: RenderFunction = (component, propsOrChildren, childrenOrKey, key: number | null = null) => {
|
|
19
|
+
const hasProps = typeof propsOrChildren === 'object' && propsOrChildren !== null && !Array.isArray(propsOrChildren)
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
component,
|
|
23
|
+
key: hasProps ? key : typeof childrenOrKey === 'number' ? childrenOrKey : null,
|
|
24
|
+
props: hasProps ? propsOrChildren : {},
|
|
25
|
+
children: hasProps
|
|
26
|
+
? ((Array.isArray(childrenOrKey)
|
|
27
|
+
? childrenOrKey
|
|
28
|
+
: childrenOrKey !== null
|
|
29
|
+
? [childrenOrKey]
|
|
30
|
+
: []) as RenderProps[])
|
|
31
|
+
: ((Array.isArray(propsOrChildren)
|
|
32
|
+
? propsOrChildren
|
|
33
|
+
: propsOrChildren !== null
|
|
34
|
+
? [propsOrChildren]
|
|
35
|
+
: []) as RenderProps[]),
|
|
36
|
+
}
|
|
37
|
+
}
|
|
10
38
|
</script>
|
|
11
39
|
|
|
12
|
-
<script>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
40
|
+
<script lang="ts">
|
|
41
|
+
import Render from './Render.svelte'
|
|
42
|
+
import { setContext } from 'svelte'
|
|
43
|
+
import { LAYOUT_CONTEXT_KEY } from '../layoutProps.svelte'
|
|
44
|
+
|
|
45
|
+
// svelte-ignore state_referenced_locally
|
|
46
|
+
const { component, props = {}, children = [], key = null, name }: RenderProps = $props()
|
|
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
|
+
}
|
|
16
59
|
</script>
|
|
17
60
|
|
|
18
61
|
{#if component}
|
|
19
|
-
<!--
|
|
20
|
-
Add the `key` only to the last (page) component in the tree.
|
|
21
|
-
This ensures that the page component re-renders when `preserveState` is disabled,
|
|
22
|
-
while the layout components are persisted across page changes. -->
|
|
23
62
|
{#key children?.length === 0 ? key : null}
|
|
24
63
|
{#if children.length > 0}
|
|
25
|
-
|
|
64
|
+
{@const SvelteComponent = component}
|
|
65
|
+
<SvelteComponent {...props}>
|
|
26
66
|
{#each children as child}
|
|
27
|
-
<
|
|
67
|
+
<Render {...child} />
|
|
28
68
|
{/each}
|
|
29
|
-
</
|
|
69
|
+
</SvelteComponent>
|
|
30
70
|
{:else}
|
|
31
|
-
|
|
71
|
+
{@const SvelteComponent_1 = component}
|
|
72
|
+
<SvelteComponent_1 {...props} />
|
|
32
73
|
{/if}
|
|
33
74
|
{/key}
|
|
34
75
|
{/if}
|
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { PageProps } from '@inertiajs/core';
|
|
3
|
-
import type {
|
|
2
|
+
import type { Component } from 'svelte';
|
|
4
3
|
export type RenderProps = {
|
|
5
|
-
component:
|
|
4
|
+
component: Component;
|
|
6
5
|
props?: PageProps;
|
|
7
6
|
children?: RenderProps[];
|
|
8
7
|
key?: number | null;
|
|
8
|
+
name?: string;
|
|
9
9
|
};
|
|
10
10
|
export type RenderFunction = {
|
|
11
|
-
(component:
|
|
12
|
-
(component:
|
|
11
|
+
(component: Component, props?: PageProps, children?: RenderProps[], key?: number | null): RenderProps;
|
|
12
|
+
(component: Component, children?: RenderProps[], key?: number | null): RenderProps;
|
|
13
13
|
};
|
|
14
14
|
export declare const h: RenderFunction;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
children?: RenderProps[];
|
|
20
|
-
key?: number | null;
|
|
21
|
-
};
|
|
22
|
-
events: {
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
};
|
|
25
|
-
slots: {};
|
|
26
|
-
exports?: {} | undefined;
|
|
27
|
-
bindings?: string | undefined;
|
|
28
|
-
};
|
|
29
|
-
type RenderProps_ = typeof __propDef.props;
|
|
30
|
-
export type RenderEvents = typeof __propDef.events;
|
|
31
|
-
export type RenderSlots = typeof __propDef.slots;
|
|
32
|
-
export default class Render extends SvelteComponent<RenderProps_, RenderEvents, RenderSlots> {
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
15
|
+
import Render from './Render.svelte';
|
|
16
|
+
declare const Render: Component<RenderProps, {}, "">;
|
|
17
|
+
type Render = ReturnType<typeof Render>;
|
|
18
|
+
export default Render;
|