Skip to content

Commit

Permalink
style(prettier): run the prettier command
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopalopes24 committed Feb 3, 2025
1 parent 69a0f03 commit 2ef415a
Show file tree
Hide file tree
Showing 23 changed files with 66 additions and 98 deletions.
17 changes: 2 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/svelte/src/createInertiaApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default async function createInertiaApp({
const svelteApp = setup({
el,
App: App as unknown as AppComponent,
props
props,
})

if (isServer) {
Expand Down
10 changes: 2 additions & 8 deletions packages/svelte/test-app/Layouts/SWR.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@
<div>
<a href="/prefetch/swr/2" use:inertia={{ prefetch: true, cacheFor: '1s' }}>1s Expired</a>
<a href="/prefetch/swr/3" use:inertia={{ prefetch: true, cacheFor: 1000 }}>1s Expired (Number)</a>
<a
href="/prefetch/swr/4"
style="margin: 0 20px"
use:inertia={{ prefetch: true, cacheFor: ['1s', '3s'] }}
>
<a href="/prefetch/swr/4" style="margin: 0 20px" use:inertia={{ prefetch: true, cacheFor: ['1s', '3s'] }}>
1s Stale, 2s Expired
</a>
<a href="/prefetch/swr/5" use:inertia={{ prefetch: true, cacheFor: [1000, 3000] }}>
1s Stale, 2s Expired (Number)
</a>
<a href="/prefetch/swr/5" use:inertia={{ prefetch: true, cacheFor: [1000, 3000] }}> 1s Stale, 2s Expired (Number) </a>
<div>
<slot />
</div>
Expand Down
12 changes: 6 additions & 6 deletions packages/svelte/test-app/Pages/ClientSideVisit/Page1.svelte
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<script>
import { router } from '@inertiajs/svelte'
export let foo;
export let bar;
export let foo
export let bar
const replace = () => {
router.replace({
props: (props) => ({ ...props, foo: 'foo from client' }),
});
};
})
}
const push = () => {
router.push({
url: '/client-side-visit-2',
component: 'ClientSideVisit/Page2',
props: { baz: 'baz from client' },
});
};
})
}
</script>

<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
export let baz;
export let baz
</script>

<div>{baz}</div>
4 changes: 2 additions & 2 deletions packages/svelte/test-app/Pages/History/Page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { inertia, router } from '@inertiajs/svelte'
export let pageNumber
export let multiByte
export let multiByte
</script>

<a href="/history/1" use:inertia>Page 1</a>
Expand All @@ -14,4 +14,4 @@
<button on:click={() => router.clearHistory()}>Clear History</button>

<div>This is page {pageNumber}.</div>
<div>Multi byte character: { multiByte }</div>
<div>Multi byte character: {multiByte}</div>
8 changes: 3 additions & 5 deletions packages/svelte/test-app/Pages/Links/PropUpdate.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<script>
import { Link } from '@inertiajs/svelte'
let href = '/sleep';
let href = '/sleep'
const changeUrl = () => {
href = '/something-else';
href = '/something-else'
}
</script>

<div>
<button on:click={changeUrl}>Change URL</button>
<Link href={href} class="get">
The Link
</Link>
<Link {href} class="get">The Link</Link>
</div>
20 changes: 4 additions & 16 deletions packages/svelte/test-app/Pages/Svelte/PropsAndPageStore.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,11 @@
</script>

<div>
<input id="input" type="text" bind:value={$form.foo}>
<input id="input" type="text" bind:value={$form.foo} />
<p>foo prop is {foo}</p>
<p>$page.props.foo is {$page.props.foo}</p>

<a
href="/svelte/props-and-page-store"
use:inertia={{ data: { foo: 'bar' } }}
>
Bar
</a>
<a
href="/svelte/props-and-page-store"
use:inertia={{ data: { foo: 'baz' } }}
>
Baz
</a>
<a href="/" use:inertia>
Home
</a>
<a href="/svelte/props-and-page-store" use:inertia={{ data: { foo: 'bar' } }}> Bar </a>
<a href="/svelte/props-and-page-store" use:inertia={{ data: { foo: 'baz' } }}> Baz </a>
<a href="/" use:inertia> Home </a>
</div>
14 changes: 6 additions & 8 deletions packages/svelte/test-app/Pages/Visits/ReloadOnMount.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<script>
import { router } from '@inertiajs/svelte'
import { onMount } from 'svelte'
import { router } from '@inertiajs/svelte'
import { onMount } from 'svelte'
export let name = undefined;
onMount(() => {
router.reload({only: ['name']})
})
export let name = undefined
onMount(() => {
router.reload({ only: ['name'] })
})
</script>


<div>Name is {name}</div>
15 changes: 9 additions & 6 deletions packages/svelte/test-app/Pages/WhenVisible.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@
</div>

<div style="margin-top: 6000px">
<WhenVisible always params={{
data: {
<WhenVisible
always
params={{
data: {
count,
},
onSuccess() {
},
onSuccess() {
count += 1
}
}}>
},
}}
>
<svelte:fragment slot="fallback">
<div>Loading fifth one...</div>
</svelte:fragment>
Expand Down
2 changes: 1 addition & 1 deletion packages/vue3/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default function useForm<TForm extends FormDataType>(
defaults = clonedData
Object.assign(this, resolvedData)
} else {
(fields as Array<FormDataKeys<TForm>>)
;(fields as Array<FormDataKeys<TForm>>)
.filter((key) => has(clonedData, key))
.forEach((key) => {
set(defaults, key, get(clonedData, key))
Expand Down
4 changes: 2 additions & 2 deletions packages/vue3/test-app/Pages/DeferredProps/Page1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { Deferred, Link } from '@inertiajs/vue3'
defineProps<{
foo?: {text: string }
bar?: {text: string }
foo?: { text: string }
bar?: { text: string }
}>()
</script>

Expand Down
2 changes: 1 addition & 1 deletion playgrounds/svelte4/resources/js/Components/Spinner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
</svg>
</svg>
2 changes: 1 addition & 1 deletion playgrounds/svelte4/resources/js/Pages/Defer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<h1 class="text-3xl">Deferred Props</h1>

<div class="p-4 mt-6 bg-yellow-200 border border-yellow-500 rounded">
<div class="mt-6 rounded border border-yellow-500 bg-yellow-200 p-4">
<p>Page is loaded!</p>
</div>

Expand Down
16 changes: 8 additions & 8 deletions playgrounds/svelte4/resources/js/Pages/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<h1 class="text-3xl">Home</h1>

<div class="mt-6 space-y-4">
<div>
<a href="/article#far-down" use:inertia class="text-blue-700 underline">Link to bottom of article page</a>
</div>
<div>
<a href="/article#far-down" use:inertia class="text-blue-700 underline">Link to bottom of article page</a>
</div>

<div>
<button type="button" class="rounded-lg bg-blue-500 px-4 py-2 text-white" on:click={() => router.clearHistory()}>
Clear history
</button>
</div>
<div>
<button type="button" class="rounded-lg bg-blue-500 px-4 py-2 text-white" on:click={() => router.clearHistory()}>
Clear history
</button>
</div>
</div>
2 changes: 1 addition & 1 deletion playgrounds/svelte4/resources/js/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ createServer((page) =>
},
setup({ App, props }) {
return App.render(props)
}
},
}),
)
12 changes: 6 additions & 6 deletions playgrounds/svelte4/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'

const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
};
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
}

export default config;
export default config
2 changes: 1 addition & 1 deletion playgrounds/svelte5/resources/js/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ createServer((page) =>
},
setup({ App, props }) {
return render(App, { props })
}
},
}),
)
2 changes: 1 addition & 1 deletion playgrounds/vue3/resources/js/Pages/Defer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defineProps<{
<template>
<Head title="Async Request" />
<h1 class="text-3xl">Deferred Props</h1>
<div class="p-4 mt-6 bg-yellow-200 border border-yellow-500 rounded">
<div class="mt-6 rounded border border-yellow-500 bg-yellow-200 p-4">
<p>Page is loaded!</p>
</div>
<TestGrid>
Expand Down
10 changes: 5 additions & 5 deletions playgrounds/vue3/resources/js/Pages/InfiniteScroll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ const setItemType = (type: string) => {
v-for="type in item_types"
@click="setItemType(type)"
:key="type"
class="px-4 py-1 bg-gray-200 rounded-lg hover:bg-gray-300"
class="rounded-lg bg-gray-200 px-4 py-1 hover:bg-gray-300"
>
{{ type }}
</button>
</div>

<div class="w-full max-w-2xl mt-6 overflow-hidden border rounded shadow-sm">
<div class="mt-6 w-full max-w-2xl overflow-hidden rounded border shadow-sm">
<table class="w-full text-left">
<thead>
<tr>
Expand All @@ -64,7 +64,7 @@ const setItemType = (type: string) => {
</tbody>
</table>

<div v-if="!items" class="p-4 text-center bg-gray-100">Loading items...</div>
<div v-if="!items" class="bg-gray-100 p-4 text-center">Loading items...</div>
<WhenVisible
v-else
:once="false"
Expand All @@ -79,10 +79,10 @@ const setItemType = (type: string) => {
}"
>
<template #fallback>
<div class="p-4 text-center bg-gray-100">Fetching more items...</div>
<div class="bg-gray-100 p-4 text-center">Fetching more items...</div>
</template>

<div class="p-4 text-center bg-gray-100">Fetching more items...</div>
<div class="bg-gray-100 p-4 text-center">Fetching more items...</div>
</WhenVisible>
</div>
</template>
2 changes: 1 addition & 1 deletion playgrounds/vue3/resources/js/Pages/Users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defineProps({ users: Array, date: String })
<span v-if="isPrefetching" class="text-red-500"> refreshing...</span>
</div>

<div class="w-full max-w-2xl mt-6 overflow-hidden border rounded shadow-sm">
<div class="mt-6 w-full max-w-2xl overflow-hidden rounded border shadow-sm">
<table class="w-full text-left">
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion tests/events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ test.describe('Events', () => {

test('can delay onFinish from firing by returning a promise (link)', async ({ page }) => {
test.skip(process.env.PACKAGE === 'svelte', 'Feature not supported by the Svelte adapter')

await page.getByRole('button', { exact: true, name: 'Error Event Link (delaying onFinish w/ Promise)' }).click()

await page.waitForTimeout(25)
Expand Down
2 changes: 1 addition & 1 deletion tests/svelte.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ test('props and page store are in sync', async ({ page }) => {
await expect(consoleMessages.messages[3]).toBe('[reactive expression] $page.props.foo is baz')
await expect(consoleMessages.messages[4]).toBe('[onMount] foo prop is baz')
await expect(consoleMessages.messages[5]).toBe('[onMount] $page.props.foo is baz')
})
})

0 comments on commit 2ef415a

Please sign in to comment.