@inertiajs/vue3 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/index.js +279 -277
- package/dist/index.js.map +3 -3
- package/package.json +5 -6
- package/types/app.d.ts +2 -1
- package/types/createInertiaApp.d.ts +17 -8
- package/types/deferred.d.ts +3 -9
- package/types/index.d.ts +2 -2
- package/types/layoutProps.d.ts +13 -12
- package/types/types.d.ts +3 -1
- package/types/useHttp.d.ts +6 -6
- package/types/whenVisible.d.ts +5 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiajs/vue3",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Vue 3 adapter for Inertia.js",
|
|
6
6
|
"contributors": [
|
|
@@ -52,10 +52,9 @@
|
|
|
52
52
|
"vue": "^3.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"
|
|
56
|
-
"laravel-precognition": "2.0.0-beta.
|
|
57
|
-
"
|
|
58
|
-
"@inertiajs/core": "3.0.0-beta.2"
|
|
55
|
+
"es-toolkit": "^1.33.0",
|
|
56
|
+
"laravel-precognition": "2.0.0-beta.5",
|
|
57
|
+
"@inertiajs/core": "3.0.0-beta.4"
|
|
59
58
|
},
|
|
60
59
|
"scripts": {
|
|
61
60
|
"build": "pnpm clean && ./build.js && tsc",
|
|
@@ -64,6 +63,6 @@
|
|
|
64
63
|
"dev": "pnpx concurrently -c \"#ffcf00,#3178c6\" \"pnpm dev:build\" \"pnpm dev:types\" --names build,types",
|
|
65
64
|
"dev:build": "./build.js --watch",
|
|
66
65
|
"dev:types": "tsc --watch --preserveWatchOutput",
|
|
67
|
-
"
|
|
66
|
+
"es2022-check": "pnpm build:with-deps && es-check es2022 \"dist/index.js\" --checkFeatures --module --noCache --verbose"
|
|
68
67
|
}
|
|
69
68
|
}
|
package/types/app.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HeadManagerOnUpdateCallback, HeadManagerTitleCallback, Page, PageProps, SharedPageProps } from '@inertiajs/core';
|
|
1
|
+
import { HeadManager, HeadManagerOnUpdateCallback, HeadManagerTitleCallback, Page, PageProps, SharedPageProps } from '@inertiajs/core';
|
|
2
2
|
import { DefineComponent, Plugin } from 'vue';
|
|
3
3
|
export interface InertiaAppProps<SharedProps extends PageProps = PageProps> {
|
|
4
4
|
initialPage: Page<SharedProps>;
|
|
@@ -9,6 +9,7 @@ export interface InertiaAppProps<SharedProps extends PageProps = PageProps> {
|
|
|
9
9
|
defaultLayout?: (name: string, page: Page) => unknown;
|
|
10
10
|
}
|
|
11
11
|
export type InertiaApp = DefineComponent<InertiaAppProps>;
|
|
12
|
+
export declare let headManager: HeadManager;
|
|
12
13
|
declare const App: InertiaApp;
|
|
13
14
|
export default App;
|
|
14
15
|
export declare const plugin: Plugin;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { CreateInertiaAppOptions, CreateInertiaAppOptionsForCSR, CreateInertiaAppOptionsForSSR, InertiaAppSSRResponse, Page, PageProps } from '@inertiajs/core';
|
|
1
|
+
import { CreateInertiaAppOptions, CreateInertiaAppOptionsForCSR, CreateInertiaAppOptionsForSSR, InertiaAppSSRResponse, Page, PageProps, SharedPageProps } from '@inertiajs/core';
|
|
2
2
|
import { DefineComponent, Plugin, App as VueApp } from 'vue';
|
|
3
|
-
import { renderToString } from 'vue/server-renderer';
|
|
4
3
|
import { InertiaApp, InertiaAppProps } from './app';
|
|
5
4
|
import { VueInertiaAppConfig } from './types';
|
|
6
|
-
type ComponentResolver = (name: string, page?: Page) => DefineComponent | Promise<DefineComponent> | {
|
|
5
|
+
type ComponentResolver = (name: string, page?: Page<SharedPageProps>) => DefineComponent | Promise<DefineComponent> | {
|
|
7
6
|
default: DefineComponent;
|
|
8
7
|
};
|
|
9
8
|
type SetupOptions<ElementType, SharedProps extends PageProps> = {
|
|
@@ -12,17 +11,27 @@ type SetupOptions<ElementType, SharedProps extends PageProps> = {
|
|
|
12
11
|
props: InertiaAppProps<SharedProps>;
|
|
13
12
|
plugin: Plugin;
|
|
14
13
|
};
|
|
15
|
-
type InertiaAppOptionsForCSR<SharedProps extends PageProps> = CreateInertiaAppOptionsForCSR<SharedProps, ComponentResolver, SetupOptions<HTMLElement, SharedProps>, void, VueInertiaAppConfig
|
|
14
|
+
type InertiaAppOptionsForCSR<SharedProps extends PageProps> = CreateInertiaAppOptionsForCSR<SharedProps, ComponentResolver, SetupOptions<HTMLElement, SharedProps>, void, VueInertiaAppConfig> & {
|
|
15
|
+
withApp?: (app: VueApp, options: {
|
|
16
|
+
ssr: boolean;
|
|
17
|
+
}) => void;
|
|
18
|
+
};
|
|
16
19
|
type InertiaAppOptionsForSSR<SharedProps extends PageProps> = CreateInertiaAppOptionsForSSR<SharedProps, ComponentResolver, SetupOptions<null, SharedProps>, VueApp, VueInertiaAppConfig> & {
|
|
17
|
-
render:
|
|
20
|
+
render: (app: VueApp) => Promise<string>;
|
|
21
|
+
withApp?: (app: VueApp, options: {
|
|
22
|
+
ssr: boolean;
|
|
23
|
+
}) => void;
|
|
18
24
|
};
|
|
19
25
|
type InertiaAppOptionsAuto<SharedProps extends PageProps> = CreateInertiaAppOptions<ComponentResolver, SetupOptions<HTMLElement | null, SharedProps>, VueApp | void, VueInertiaAppConfig> & {
|
|
20
26
|
page?: Page<SharedProps>;
|
|
21
27
|
render?: undefined;
|
|
28
|
+
withApp?: (app: VueApp, options: {
|
|
29
|
+
ssr: boolean;
|
|
30
|
+
}) => void;
|
|
22
31
|
};
|
|
23
32
|
type RenderToString = (app: VueApp) => Promise<string>;
|
|
24
33
|
type RenderFunction<SharedProps extends PageProps> = (page: Page<SharedProps>, renderToString: RenderToString) => Promise<InertiaAppSSRResponse>;
|
|
25
|
-
export default function createInertiaApp<SharedProps extends PageProps = PageProps>(options: InertiaAppOptionsForCSR<SharedProps>): Promise<void>;
|
|
26
|
-
export default function createInertiaApp<SharedProps extends PageProps = PageProps>(options: InertiaAppOptionsForSSR<SharedProps>): Promise<InertiaAppSSRResponse>;
|
|
27
|
-
export default function createInertiaApp<SharedProps extends PageProps = PageProps>(options?: InertiaAppOptionsAuto<SharedProps>): Promise<void | RenderFunction<SharedProps>>;
|
|
34
|
+
export default function createInertiaApp<SharedProps extends PageProps = PageProps & SharedPageProps>(options: InertiaAppOptionsForCSR<SharedProps>): Promise<void>;
|
|
35
|
+
export default function createInertiaApp<SharedProps extends PageProps = PageProps & SharedPageProps>(options: InertiaAppOptionsForSSR<SharedProps>): Promise<InertiaAppSSRResponse>;
|
|
36
|
+
export default function createInertiaApp<SharedProps extends PageProps = PageProps & SharedPageProps>(options?: InertiaAppOptionsAuto<SharedProps>): Promise<void | RenderFunction<SharedProps>>;
|
|
28
37
|
export {};
|
package/types/deferred.d.ts
CHANGED
|
@@ -17,15 +17,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
17
17
|
})[];
|
|
18
18
|
required: true;
|
|
19
19
|
};
|
|
20
|
-
}>, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
default: import("vue").Slot<{
|
|
24
|
-
reloading: boolean;
|
|
25
|
-
}>;
|
|
26
|
-
fallback: import("vue").Slot<{}>;
|
|
27
|
-
}>;
|
|
28
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
23
|
data: {
|
|
30
24
|
type: (StringConstructor | {
|
|
31
25
|
(arrayLength: number): String[];
|
package/types/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export { default as Deferred } from './deferred';
|
|
|
5
5
|
export { createForm, default as Form, useFormContext } from './form';
|
|
6
6
|
export { default as Head } from './head';
|
|
7
7
|
export { default as InfiniteScroll } from './infiniteScroll';
|
|
8
|
-
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor
|
|
8
|
+
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor } from './layoutProps';
|
|
9
9
|
export { InertiaLinkProps, default as Link } from './link';
|
|
10
|
-
export { type VueInertiaAppConfig, type VuePageHandlerArgs } from './types';
|
|
10
|
+
export { type LayoutCallback, type VueInertiaAppConfig, type VuePageHandlerArgs } from './types';
|
|
11
11
|
export { InertiaForm, InertiaFormProps, InertiaPrecognitiveForm, default as useForm } from './useForm';
|
|
12
12
|
export { default as useHttp } from './useHttp';
|
|
13
13
|
export { default as usePoll } from './usePoll';
|
package/types/layoutProps.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
|
|
1
|
+
import { type LayoutProps, type NamedLayoutProps } from '@inertiajs/core';
|
|
2
|
+
export declare const state: import("vue").Ref<{
|
|
3
|
+
shared: Record<string, unknown>;
|
|
4
|
+
named: Record<string, Record<string, unknown>>;
|
|
5
|
+
}, {
|
|
6
|
+
shared: Record<string, unknown>;
|
|
7
|
+
named: Record<string, Record<string, unknown>>;
|
|
8
|
+
} | {
|
|
9
|
+
shared: Record<string, unknown>;
|
|
10
|
+
named: Record<string, Record<string, unknown>>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function setLayoutProps(props: Partial<LayoutProps>): void;
|
|
13
|
+
export declare function setLayoutPropsFor<K extends keyof NamedLayoutProps>(name: K, props: Partial<NamedLayoutProps[K]>): void;
|
|
4
14
|
export declare function resetLayoutProps(): void;
|
|
5
|
-
export declare const LAYOUT_CONTEXT_KEY: InjectionKey<string | undefined>;
|
|
6
|
-
export declare const LayoutProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
|
-
layoutName: StringConstructor;
|
|
8
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
|
-
layoutName: StringConstructor;
|
|
12
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
-
export declare function useLayoutProps<T extends Record<string, unknown>>(defaults: T): ComputedRef<T>;
|
package/types/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createHeadManager, Page, PageHandler, PageProps, router, SharedPageProps } from '@inertiajs/core';
|
|
2
|
-
import { DefineComponent } from 'vue';
|
|
2
|
+
import { Component, DefineComponent } from 'vue';
|
|
3
3
|
import useForm from './useForm';
|
|
4
4
|
export type VuePageHandlerArgs = Parameters<PageHandler<DefineComponent>>[0];
|
|
5
5
|
export type VueInertiaAppConfig = {};
|
|
6
|
+
export type LayoutCallback = (props: SharedPageProps) => unknown;
|
|
6
7
|
declare module '@inertiajs/core' {
|
|
7
8
|
interface Router {
|
|
8
9
|
form: typeof useForm;
|
|
@@ -15,6 +16,7 @@ declare module 'vue' {
|
|
|
15
16
|
$headManager: ReturnType<typeof createHeadManager>;
|
|
16
17
|
}
|
|
17
18
|
interface ComponentCustomOptions {
|
|
19
|
+
layout?: Component | Component[] | LayoutCallback;
|
|
18
20
|
remember?: string | string[] | {
|
|
19
21
|
data: string | string[];
|
|
20
22
|
key?: string | (() => string);
|
package/types/useHttp.d.ts
CHANGED
|
@@ -19,12 +19,12 @@ export interface UseHttpProps<TForm extends object, TResponse = unknown> {
|
|
|
19
19
|
resetAndClearErrors<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
20
20
|
setError<K extends FormDataKeys<TForm>>(field: K, value: ErrorValue): this;
|
|
21
21
|
setError(errors: FormDataErrors<TForm>): this;
|
|
22
|
-
submit(...args: UseHttpSubmitArguments<
|
|
23
|
-
get(url: string, options?: UseHttpSubmitOptions<
|
|
24
|
-
post(url: string, options?: UseHttpSubmitOptions<
|
|
25
|
-
put(url: string, options?: UseHttpSubmitOptions<
|
|
26
|
-
patch(url: string, options?: UseHttpSubmitOptions<
|
|
27
|
-
delete(url: string, options?: UseHttpSubmitOptions<
|
|
22
|
+
submit<R = TResponse>(...args: UseHttpSubmitArguments<R, TForm>): Promise<R>;
|
|
23
|
+
get<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
24
|
+
post<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
25
|
+
put<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
26
|
+
patch<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
27
|
+
delete<R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>): Promise<R>;
|
|
28
28
|
cancel(): void;
|
|
29
29
|
dontRemember<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
30
30
|
optimistic(callback: (currentData: TForm) => Partial<TForm>): this;
|
package/types/whenVisible.d.ts
CHANGED
|
@@ -32,16 +32,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
32
32
|
type: BooleanConstructor;
|
|
33
33
|
default: boolean;
|
|
34
34
|
};
|
|
35
|
-
}>,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, {
|
|
40
|
-
keys(): string[];
|
|
41
|
-
}, {
|
|
42
|
-
registerObserver(): void;
|
|
43
|
-
getReloadParams(): Partial<ReloadOptions>;
|
|
44
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
35
|
+
}>, () => (import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}>[] | null)[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
40
|
data: {
|
|
46
41
|
type: (StringConstructor | {
|
|
47
42
|
(arrayLength: number): String[];
|