This commit is contained in:
TiclemFR
2023-12-29 17:47:40 +01:00
parent 936d5f15d9
commit 076ec32c3b
565 changed files with 339154 additions and 110 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Jonathan Reinink <jonathan@reinink.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
import{default as f}from"@inertiajs/core/server";export{f as default};
//# sourceMappingURL=server.esm.js.map
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/server.ts"],
"sourcesContent": ["export { default as default } from '@inertiajs/core/server'\n"],
"mappings": "AAAA,OAAoB,WAAXA,MAA0B",
"names": ["default"]
}
+2
View File
@@ -0,0 +1,2 @@
var u=Object.create;var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var b=(a,e)=>{for(var f in e)d(a,f,{get:e[f],enumerable:!0})},o=(a,e,f,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!x.call(a,t)&&t!==f&&d(a,t,{get:()=>e[t],enumerable:!(l=m(e,t))||l.enumerable});return a};var c=(a,e,f)=>(f=a!=null?u(s(a)):{},o(e||!a||!a.__esModule?d(f,"default",{value:a,enumerable:!0}):f,a)),g=a=>o(d({},"__esModule",{value:!0}),a);var h={};b(h,{default:()=>r.default});module.exports=g(h);var r=c(require("@inertiajs/core/server"),1);0&&(module.exports={});
//# sourceMappingURL=server.js.map
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/server.ts"],
"sourcesContent": ["export { default as default } from '@inertiajs/core/server'\n"],
"mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wCAAAE,EAAAF,GAAA,IAAAG,EAAmC",
"names": ["server_exports", "__export", "__toCommonJS", "import_server"]
}
+63
View File
@@ -0,0 +1,63 @@
{
"name": "@inertiajs/vue3",
"version": "1.0.14",
"license": "MIT",
"description": "The Vue 3 adapter for Inertia.js",
"contributors": [
"Jonathan Reinink <jonathan@reinink.ca>"
],
"homepage": "https://inertiajs.com/",
"repository": {
"type": "git",
"url": "https://github.com/inertiajs/inertia.git",
"directory": "packages/vue3"
},
"bugs": {
"url": "https://github.com/inertiajs/inertia/issues"
},
"files": [
"dist",
"types"
],
"type": "module",
"main": "dist/index.js",
"types": "types/index.d.ts",
"exports": {
".": {
"types": "./types/index.d.ts",
"import": "./dist/index.esm.js",
"require": "./dist/index.js"
},
"./server": {
"types": "./types/server.d.ts",
"import": "./dist/server.esm.js",
"require": "./dist/server.js"
}
},
"typesVersions": {
"*": {
"server": [
"types/server.d.ts"
]
}
},
"scripts": {
"dev": "./build.js --watch",
"build": "npm run clean && ./build.js && tsc --emitDeclarationOnly",
"clean": "rm -rf types && rm -rf dist",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"esbuild": "^0.16.13",
"typescript": "^4.9.4",
"vue": "^3.0.0"
},
"peerDependencies": {
"vue": "^3.0.0"
},
"dependencies": {
"@inertiajs/core": "1.0.14",
"lodash.clonedeep": "^4.5.0",
"lodash.isequal": "^4.5.0"
}
}
+3
View File
@@ -0,0 +1,3 @@
# Inertia.js Vue 3 Adapter
Visit [inertiajs.com](https://inertiajs.com/) to learn more.
+14
View File
@@ -0,0 +1,14 @@
import { Page, PageProps } from '@inertiajs/core';
import { DefineComponent, Plugin } from 'vue';
export interface InertiaAppProps {
initialPage: Page;
initialComponent?: object;
resolveComponent?: (name: string) => DefineComponent | Promise<DefineComponent>;
titleCallback?: (title: string) => string;
onHeadUpdate?: (elements: string[]) => void;
}
export type InertiaApp = DefineComponent<InertiaAppProps>;
declare const App: InertiaApp;
export default App;
export declare const plugin: Plugin;
export declare function usePage<SharedProps extends PageProps>(): Page<SharedProps>;
+29
View File
@@ -0,0 +1,29 @@
import { Page } from '@inertiajs/core';
import { App as VueApp, DefineComponent, Plugin } from 'vue';
import { InertiaApp, InertiaAppProps } from './app';
interface CreateInertiaAppProps {
id?: string;
resolve: (name: string) => DefineComponent | Promise<DefineComponent> | {
default: DefineComponent;
};
setup: (props: {
el: Element;
App: InertiaApp;
props: InertiaAppProps;
plugin: Plugin;
}) => void | VueApp;
title?: (title: string) => string;
progress?: false | {
delay?: number;
color?: string;
includeCSS?: boolean;
showSpinner?: boolean;
};
page?: Page;
render?: (app: VueApp) => Promise<string>;
}
export default function createInertiaApp({ id, resolve, setup, title, progress, page, render, }: CreateInertiaAppProps): Promise<{
head: string[];
body: string;
}>;
export {};
+6
View File
@@ -0,0 +1,6 @@
import { DefineComponent } from 'vue';
export type InertiaHead = DefineComponent<{
title?: string;
}>;
declare const Head: InertiaHead;
export default Head;
+8
View File
@@ -0,0 +1,8 @@
export { router } from '@inertiajs/core';
export { usePage } from './app';
export { default as createInertiaApp } from './createInertiaApp';
export { default as Head } from './head';
export { default as Link, InertiaLinkProps } from './link';
export * from './types';
export { default as useForm, InertiaForm } from './useForm';
export { default as useRemember } from './useRemember';
+25
View File
@@ -0,0 +1,25 @@
import { Method, PageProps, Progress } from '@inertiajs/core';
import { DefineComponent } from 'vue';
export interface InertiaLinkProps {
as?: string;
data?: object;
href: string;
method?: Method;
headers?: object;
onClick?: (event: MouseEvent) => void;
preserveScroll?: boolean | ((props: PageProps) => boolean);
preserveState?: boolean | ((props: PageProps) => boolean) | null;
replace?: boolean;
only?: string[];
onCancelToken?: (cancelToken: import('axios').CancelTokenSource) => void;
onBefore?: () => void;
onStart?: () => void;
onProgress?: (progress: Progress) => void;
onFinish?: () => void;
onCancel?: () => void;
onSuccess?: () => void;
queryStringArrayFormat?: 'brackets' | 'indices';
}
type InertiaLink = DefineComponent<InertiaLinkProps>;
declare const Link: InertiaLink;
export default Link;
+3
View File
@@ -0,0 +1,3 @@
import { ComponentOptions } from 'vue';
declare const remember: ComponentOptions;
export default remember;
+1
View File
@@ -0,0 +1 @@
export { default as default } from '@inertiajs/core/server';
+24
View File
@@ -0,0 +1,24 @@
import { createHeadManager, Page, PageHandler, router } from '@inertiajs/core';
import { ComponentPublicInstance } from 'vue';
import useForm from './useForm';
export type VuePageHandlerArgs = Parameters<PageHandler>[0] & {
component: ComponentPublicInstance | Promise<ComponentPublicInstance>;
};
declare module '@inertiajs/core' {
interface Router {
form: typeof useForm;
}
}
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$inertia: typeof router;
$page: Page;
$headManager: ReturnType<typeof createHeadManager>;
}
interface ComponentCustomOptions {
remember?: string | string[] | {
data: string | string[];
key?: string | (() => string);
};
}
}
+31
View File
@@ -0,0 +1,31 @@
import { FormDataConvertible, Method, Progress, VisitOptions } from '@inertiajs/core';
type FormDataType = object;
interface InertiaFormProps<TForm extends FormDataType> {
isDirty: boolean;
errors: Partial<Record<keyof TForm, string>>;
hasErrors: boolean;
processing: boolean;
progress: Progress | null;
wasSuccessful: boolean;
recentlySuccessful: boolean;
data(): TForm;
transform(callback: (data: TForm) => object): this;
defaults(): this;
defaults(field: keyof TForm, value: FormDataConvertible): this;
defaults(fields: Partial<TForm>): this;
reset(...fields: (keyof TForm)[]): this;
clearErrors(...fields: (keyof TForm)[]): this;
setError(field: keyof TForm, value: string): this;
setError(errors: Record<keyof TForm, string>): this;
submit(method: Method, url: string, options?: Partial<VisitOptions>): void;
get(url: string, options?: Partial<VisitOptions>): void;
post(url: string, options?: Partial<VisitOptions>): void;
put(url: string, options?: Partial<VisitOptions>): void;
patch(url: string, options?: Partial<VisitOptions>): void;
delete(url: string, options?: Partial<VisitOptions>): void;
cancel(): void;
}
export type InertiaForm<TForm extends FormDataType> = TForm & InertiaFormProps<TForm>;
export default function useForm<TForm extends FormDataType>(data: TForm | (() => TForm)): InertiaForm<TForm>;
export default function useForm<TForm extends FormDataType>(rememberKey: string, data: TForm | (() => TForm)): InertiaForm<TForm>;
export {};
+6
View File
@@ -0,0 +1,6 @@
import { Ref } from 'vue';
export default function useRemember<T extends object>(data: T & {
__rememberable?: boolean;
__remember?: Function;
__restore?: Function;
}, key?: string): Ref<T> | T;