Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
reinink committed Apr 16, 2024
1 parent bfc7de6 commit 5e9c52a
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/router.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AxiosResponse, default as Axios } from 'axios'
import { default as Axios, AxiosResponse } from 'axios'
import debounce from './debounce'
import {
fireBeforeEvent,
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/Head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ const Head: InertiaHead = function ({ children, title }) {
}

function renderNodes(nodes) {
const computed = React.Children.toArray(nodes).filter((node) => node).map((node) => renderNode(node))
const computed = React.Children.toArray(nodes)
.filter((node) => node)
.map((node) => renderNode(node))
if (title && !computed.find((tag) => tag.startsWith('<title'))) {
computed.push(`<title inertia>${title}</title>`)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/createInertiaApp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Page, PageProps, PageResolver, setupProgress } from '@inertiajs/core'
import { ComponentType, createElement, FunctionComponent, Key, ReactElement, ReactNode } from 'react'
import { ComponentType, FunctionComponent, Key, ReactElement, ReactNode, createElement } from 'react'
import { renderToString } from 'react-dom/server'
import App from './App'

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { router as Router } from '@inertiajs/core'

export const router = Router
export { default as createInertiaApp } from './createInertiaApp'
export { default as Head } from './Head'
export { default as Link, InertiaLinkProps } from './Link'
export { InertiaLinkProps, default as Link } from './Link'
export { default as createInertiaApp } from './createInertiaApp'
export { default as useForm } from './useForm'
export { default as usePage } from './usePage'
export { default as useRemember } from './useRemember'
2 changes: 1 addition & 1 deletion packages/react/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useRemember from './useRemember'
type setDataByObject<TForm> = (data: TForm) => void
type setDataByMethod<TForm> = (data: (previousData: TForm) => TForm) => void
type setDataByKeyValuePair<TForm> = <K extends keyof TForm>(key: K, value: TForm[K]) => void
type FormDataType = object;
type FormDataType = object

export interface InertiaFormProps<TForm extends FormDataType> {
data: TForm
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export { router } from '@inertiajs/core'
export { default as Link } from './Link.svelte'
export { default as createInertiaApp } from './createInertiaApp'
export { default as inertia } from './link'
export { default as Link } from './Link.svelte'
export { default as page } from './page'
export { default as remember } from './remember'
export { default as useForm } from './useForm'
2 changes: 1 addition & 1 deletion packages/svelte/src/useForm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { router } from '@inertiajs/core'
import isEqual from 'lodash.isequal'
import cloneDeep from 'lodash.clonedeep'
import isEqual from 'lodash.isequal'
import { writable } from 'svelte/store'

function useForm(...args) {
Expand Down
4 changes: 2 additions & 2 deletions packages/vue2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ 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 { InertiaLinkProps, default as Link } from './link'
export * from './types'
export { default as useForm, InertiaForm } from './useForm'
export { InertiaForm, default as useForm } from './useForm'
7 changes: 5 additions & 2 deletions packages/vue2/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cloneDeep from 'lodash.clonedeep'
import isEqual from 'lodash.isequal'
import { reactive, watch } from 'vue'

type FormDataType = object;
type FormDataType = object

interface InertiaFormProps<TForm extends FormDataType> {
isDirty: boolean
Expand Down Expand Up @@ -39,7 +39,10 @@ export interface InertiaFormTrait {
}

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 default function useForm<TForm extends FormDataType>(
rememberKey: string,
data: TForm | (() => TForm),
): InertiaForm<TForm>
export default function useForm<TForm extends FormDataType>(...args): InertiaForm<TForm> {
const rememberKey = typeof args[0] === 'string' ? args[0] : null
const data = (typeof args[0] === 'string' ? args[1] : args[0]) || {}
Expand Down
2 changes: 1 addition & 1 deletion packages/vue2/tests/app/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion packages/vue3/src/createInertiaApp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Page, setupProgress } from '@inertiajs/core'
import { App as VueApp, createSSRApp, DefineComponent, h, Plugin } from 'vue'
import { DefineComponent, Plugin, App as VueApp, createSSRApp, h } from 'vue'
import App, { InertiaApp, InertiaAppProps, plugin } from './app'

interface CreateInertiaAppProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/vue3/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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 { InertiaLinkProps, default as Link } from './link'
export * from './types'
export { default as useForm, InertiaForm } from './useForm'
export { InertiaForm, default as useForm } from './useForm'
export { default as useRemember } from './useRemember'
2 changes: 1 addition & 1 deletion packages/vue3/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cloneDeep from 'lodash.clonedeep'
import isEqual from 'lodash.isequal'
import { reactive, watch } from 'vue'

type FormDataType = object;
type FormDataType = object

interface InertiaFormProps<TForm extends FormDataType> {
isDirty: boolean
Expand Down

0 comments on commit 5e9c52a

Please sign in to comment.