diff --git a/examples/svelte/auto-refetching/src/routes/+page.svelte b/examples/svelte/auto-refetching/src/routes/+page.svelte index c0cb2f056d..f9eba882b2 100644 --- a/examples/svelte/auto-refetching/src/routes/+page.svelte +++ b/examples/svelte/auto-refetching/src/routes/+page.svelte @@ -5,19 +5,19 @@ createMutation, } from '@tanstack/svelte-query' - let intervalMs = 1000 - let value = '' + let intervalMs = $state(1000) + let value = $state('') const client = useQueryClient() const endpoint = 'http://localhost:5173/api/data' - const todos = createQuery<{ items: string[] }>({ + const todos = createQuery<{ items: string[] }>(() => ({ queryKey: ['refetch'], queryFn: async () => await fetch(endpoint).then((r) => r.json()), // Refetch the data every second refetchInterval: intervalMs, - }) + })) const addMutation = createMutation({ mutationFn: (value: string) => diff --git a/examples/svelte/auto-refetching/svelte.config.js b/examples/svelte/auto-refetching/svelte.config.js index 2dee2d78a1..d6b43b0085 100644 --- a/examples/svelte/auto-refetching/svelte.config.js +++ b/examples/svelte/auto-refetching/svelte.config.js @@ -3,13 +3,13 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors preprocess: vitePreprocess(), - kit: { adapter: adapter(), }, + compilerOptions: { + runes: true, + }, } export default config diff --git a/examples/svelte/basic/svelte.config.js b/examples/svelte/basic/svelte.config.js index 2dee2d78a1..d6b43b0085 100644 --- a/examples/svelte/basic/svelte.config.js +++ b/examples/svelte/basic/svelte.config.js @@ -3,13 +3,13 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors preprocess: vitePreprocess(), - kit: { adapter: adapter(), }, + compilerOptions: { + runes: true, + }, } export default config diff --git a/examples/svelte/load-more-infinite-scroll/src/app.css b/examples/svelte/load-more-infinite-scroll/src/app.css index c57658b1ef..d301f1b2a3 100644 --- a/examples/svelte/load-more-infinite-scroll/src/app.css +++ b/examples/svelte/load-more-infinite-scroll/src/app.css @@ -48,7 +48,7 @@ main { text-align: center; } -button { +.button { border-radius: 8px; border: 1px solid transparent; padding: 0.6em 1.2em; @@ -59,11 +59,11 @@ button { cursor: pointer; transition: border-color 0.25s; } -button:hover { +.button:hover { border-color: #646cff; } -button:focus, -button:focus-visible { +.button:focus, +.button:focus-visible { outline: 4px auto -webkit-focus-ring-color; } @@ -75,7 +75,7 @@ button:focus-visible { a:hover { color: #747bff; } - button { + .button { background-color: #f9f9f9; } } diff --git a/examples/svelte/load-more-infinite-scroll/svelte.config.js b/examples/svelte/load-more-infinite-scroll/svelte.config.js index 0aa6cba937..d6b43b0085 100644 --- a/examples/svelte/load-more-infinite-scroll/svelte.config.js +++ b/examples/svelte/load-more-infinite-scroll/svelte.config.js @@ -3,13 +3,13 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://kit.svelte.dev/docs/integrations#preprocessors - // for more information about preprocessors preprocess: vitePreprocess(), - kit: { adapter: adapter(), }, + compilerOptions: { + runes: true, + }, } export default config diff --git a/examples/svelte/optimistic-updates/src/routes/+page.svelte b/examples/svelte/optimistic-updates/src/routes/+page.svelte index ccfba333ef..f61aedcfd5 100644 --- a/examples/svelte/optimistic-updates/src/routes/+page.svelte +++ b/examples/svelte/optimistic-updates/src/routes/+page.svelte @@ -16,7 +16,7 @@ ts: number } - let text = '' + let text = $state('') const client = useQueryClient() diff --git a/examples/svelte/optimistic-updates/svelte.config.js b/examples/svelte/optimistic-updates/svelte.config.js index 2dee2d78a1..d6b43b0085 100644 --- a/examples/svelte/optimistic-updates/svelte.config.js +++ b/examples/svelte/optimistic-updates/svelte.config.js @@ -3,13 +3,13 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors preprocess: vitePreprocess(), - kit: { adapter: adapter(), }, + compilerOptions: { + runes: true, + }, } export default config diff --git a/examples/svelte/playground/src/lib/stores.svelte.ts b/examples/svelte/playground/src/lib/stores.svelte.ts new file mode 100644 index 0000000000..18f0232ebb --- /dev/null +++ b/examples/svelte/playground/src/lib/stores.svelte.ts @@ -0,0 +1,37 @@ +export function ref(initial: T) { + let value = $state(initial) + + return { + get value() { + return value + }, + set value(newValue) { + value = newValue + }, + } +} + +export const staleTime = ref(1000) +export const gcTime = ref(3000) +export const errorRate = ref(0.05) +export const queryTimeMin = ref(1000) +export const queryTimeMax = ref(2000) + +export const editingIndex = ref(null) +export const views = ref(['', 'fruit', 'grape']) + +let initialId = 0 +const initialList = [ + 'apple', + 'banana', + 'pineapple', + 'grapefruit', + 'dragonfruit', + 'grapes', +].map((d) => ({ id: initialId++, name: d, notes: 'These are some notes' })) + +export const list = ref(initialList) +export const id = ref(initialId) + +export type Todos = typeof initialList +export type Todo = Todos[0] diff --git a/examples/svelte/playground/src/lib/stores.ts b/examples/svelte/playground/src/lib/stores.ts deleted file mode 100644 index 2dcdd669a6..0000000000 --- a/examples/svelte/playground/src/lib/stores.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { writable } from 'svelte/store' - -export const staleTime = writable(1000) -export const gcTime = writable(3000) -export const errorRate = writable(0.05) -export const queryTimeMin = writable(1000) -export const queryTimeMax = writable(2000) - -export const editingIndex = writable(null) -export const views = writable(['', 'fruit', 'grape']) - -let initialId = 0 -const initialList = [ - 'apple', - 'banana', - 'pineapple', - 'grapefruit', - 'dragonfruit', - 'grapes', -].map((d) => ({ id: initialId++, name: d, notes: 'These are some notes' })) - -export const list = writable(initialList) -export const id = writable(initialId) - -export type Todos = typeof initialList -export type Todo = Todos[0] diff --git a/examples/svelte/playground/src/routes/+page.svelte b/examples/svelte/playground/src/routes/+page.svelte index 4830d01eb3..cec4a24208 100644 --- a/examples/svelte/playground/src/routes/+page.svelte +++ b/examples/svelte/playground/src/routes/+page.svelte @@ -6,15 +6,15 @@ errorRate, queryTimeMin, queryTimeMax, - } from '../lib/stores' + } from '../lib/stores.svelte' import App from './App.svelte' const queryClient = useQueryClient() queryClient.setDefaultOptions({ queries: { - staleTime: $staleTime, - gcTime: $gcTime, + staleTime: staleTime.value, + gcTime: gcTime.value, }, }) @@ -29,7 +29,7 @@ type="number" min="0" step="1000" - bind:value={$staleTime} + bind:value={staleTime.value} style="width: 100px" /> @@ -39,7 +39,7 @@ type="number" min="0" step="1000" - bind:value={$gcTime} + bind:value={gcTime.value} style="width: 100px" /> @@ -51,7 +51,7 @@ min="0" max="1" step=".05" - bind:value={$errorRate} + bind:value={errorRate.value} style="width: 100px" /> @@ -61,7 +61,7 @@ type="number" min="1" step="500" - bind:value={$queryTimeMin} + bind:value={queryTimeMin.value} style="width: 100px" />{' '} @@ -71,7 +71,7 @@ type="number" min="1" step="500" - bind:value={$queryTimeMax} + bind:value={queryTimeMax.value} style="width: 100px" /> diff --git a/examples/svelte/playground/src/routes/AddTodo.svelte b/examples/svelte/playground/src/routes/AddTodo.svelte index 5a56cdee2e..23ec3e5b78 100644 --- a/examples/svelte/playground/src/routes/AddTodo.svelte +++ b/examples/svelte/playground/src/routes/AddTodo.svelte @@ -7,28 +7,29 @@ list, id, type Todo, - } from '../lib/stores' + } from '../lib/stores.svelte' const queryClient = useQueryClient() - let name = '' + let name = $state('') const postTodo = async ({ name, notes }: Omit) => { console.info('postTodo', { name, notes }) return new Promise((resolve, reject) => { setTimeout( () => { - if (Math.random() < $errorRate) { + if (Math.random() < errorRate.value) { return reject( new Error(JSON.stringify({ postTodo: { name, notes } }, null, 2)), ) } - const todo = { name, notes, id: $id } - id.set($id + 1) - list.set([...$list, todo]) + const todo = { name, notes, id: id.value } + id.value = id.value + 1 + list.value = [...list.value, todo] resolve(todo) }, - $queryTimeMin + Math.random() * ($queryTimeMax - $queryTimeMin), + queryTimeMin.value + + Math.random() * (queryTimeMax.value - queryTimeMin.value), ) }) } @@ -42,20 +43,20 @@
- +
- {$addMutation.status === 'pending' + {addMutation.status === 'pending' ? 'Saving...' - : $addMutation.status === 'error' - ? $addMutation.error.message + : addMutation.status === 'error' + ? addMutation.error.message : 'Saved!'}
diff --git a/examples/svelte/playground/src/routes/App.svelte b/examples/svelte/playground/src/routes/App.svelte index 6796833167..04ddbb9b40 100644 --- a/examples/svelte/playground/src/routes/App.svelte +++ b/examples/svelte/playground/src/routes/App.svelte @@ -3,7 +3,7 @@ import TodosList from './TodosList.svelte' import EditTodo from './EditTodo.svelte' import AddTodo from './AddTodo.svelte' - import { views, editingIndex } from '../lib/stores' + import { views, editingIndex } from '../lib/stores.svelte' const queryClient = useQueryClient() @@ -17,7 +17,7 @@

- {#each $views as view} + {#each views.value as view}

@@ -26,14 +26,14 @@
- {#if $editingIndex !== null} + {#if editingIndex.value !== null}
{/if} diff --git a/examples/svelte/playground/src/routes/EditTodo.svelte b/examples/svelte/playground/src/routes/EditTodo.svelte index 577ee323b0..b4b959eab6 100644 --- a/examples/svelte/playground/src/routes/EditTodo.svelte +++ b/examples/svelte/playground/src/routes/EditTodo.svelte @@ -11,22 +11,20 @@ list, editingIndex, type Todo, - } from '$lib/stores' - import { derived } from 'svelte/store' + } from '$lib/stores.svelte' const queryClient = useQueryClient() const fetchTodoById = async ({ id }: { id: number }): Promise => { - console.info('fetchTodoById', { id }) return new Promise((resolve, reject) => { setTimeout( () => { - if (Math.random() < $errorRate) { + if (Math.random() < errorRate.value) { return reject( new Error(JSON.stringify({ fetchTodoById: { id } }, null, 2)), ) } - const todo = $list.find((d) => d.id === id) + const todo = $state.snapshot(list.value.find((d) => d.id === id)) if (!todo) { return reject( new Error(JSON.stringify({ fetchTodoById: { id } }, null, 2)), @@ -34,7 +32,8 @@ } resolve(todo) }, - $queryTimeMin + Math.random() * ($queryTimeMax - $queryTimeMin), + queryTimeMin.value + + Math.random() * (queryTimeMax.value - queryTimeMin.value), ) }) } @@ -44,7 +43,7 @@ return new Promise((resolve, reject) => { setTimeout( () => { - if (Math.random() < $errorRate) { + if (Math.random() < errorRate.value) { return reject( new Error(JSON.stringify({ patchTodo: todo }, null, 2)), ) @@ -54,28 +53,25 @@ new Error(JSON.stringify({ patchTodo: todo }, null, 2)), ) } - list.set( - $list.map((d) => { - if (d.id === todo.id) { - return todo - } - return d - }), - ) + list.value = list.value.map((d) => { + if (d.id === todo.id) { + return todo + } + return d + }) resolve(todo) }, - $queryTimeMin + Math.random() * ($queryTimeMax - $queryTimeMin), + queryTimeMin.value + + Math.random() * (queryTimeMax.value - queryTimeMin.value), ) }) } - const query = createQuery( - derived(editingIndex, ($editingIndex) => ({ - queryKey: ['todo', { id: $editingIndex }], - queryFn: () => fetchTodoById({ id: $editingIndex || 0 }), - enabled: $editingIndex !== null, - })), - ) + const query = createQuery({ + queryKey: ['todo', { id: editingIndex.value }], + queryFn: () => fetchTodoById({ id: editingIndex.value || 0 }), + enabled: editingIndex.value !== null, + }) const saveMutation = createMutation({ mutationFn: patchTodo, @@ -86,28 +82,29 @@ }, }) - $: todo = $query.data + const todo = $derived(query.data) const onSave = () => { - $saveMutation.mutate(todo) + saveMutation.mutate(todo) } - $: disableEditSave = - $query.status === 'pending' || $saveMutation.status === 'pending' + const disableEditSave = $derived( + query.status === 'pending' || saveMutation.status === 'pending', + )
- {#if $query.data} - Editing Todo - "{$query.data.name}" (#{$editingIndex}) + {#if query.data} + Editing + Todo "{query.data.name}" (#{editingIndex.value}) {/if}
- {#if $query.status === 'pending'} - Loading... (Attempt: {$query.failureCount + 1}) - {:else if $query.error} + {#if query.status === 'pending'} + Loading... (Attempt: {query.failureCount + 1}) + {:else if query.error} - Error! + Error! {:else if todo}
- {$saveMutation.status === 'pending' + {saveMutation.status === 'pending' ? 'Saving...' - : $saveMutation.status === 'error' - ? $saveMutation.error.message + : saveMutation.status === 'error' + ? saveMutation.error.message : 'Saved!'}
- {#if $query.isFetching} + {#if query.isFetching} - Background Refreshing... (Attempt: {$query.failureCount + 1}) + Background Refreshing... (Attempt: {query.failureCount + 1}) {:else}   diff --git a/examples/svelte/playground/src/routes/TodosList.svelte b/examples/svelte/playground/src/routes/TodosList.svelte index c02d3cc0f7..43e06c7cf4 100644 --- a/examples/svelte/playground/src/routes/TodosList.svelte +++ b/examples/svelte/playground/src/routes/TodosList.svelte @@ -7,67 +7,65 @@ list, editingIndex, type Todos, - } from '$lib/stores' - import { derived, writable } from 'svelte/store' + } from '$lib/stores.svelte' - export let initialFilter: string + let { initialFilter }: { initialFilter: string } = $props() - let filter = writable(initialFilter) + let filter = $state(initialFilter) const fetchTodos = async ({ filter }: { filter: string }): Promise => { return new Promise((resolve, reject) => { setTimeout( () => { - if (Math.random() < $errorRate) { + if (Math.random() < errorRate.value) { return reject( new Error(JSON.stringify({ fetchTodos: { filter } }, null, 2)), ) } - resolve($list.filter((d) => d.name.includes(filter))) + resolve(list.value.filter((d) => d.name.includes(filter))) }, - $queryTimeMin + Math.random() * ($queryTimeMax - $queryTimeMin), + queryTimeMin.value + + Math.random() * (queryTimeMax.value - queryTimeMin.value), ) }) } - const query = createQuery( - derived(filter, ($filter) => ({ - queryKey: ['todos', { filter: $filter }], - queryFn: () => fetchTodos({ filter: $filter }), - })), - ) + const query = createQuery(() => ({ + queryKey: ['todos', { filter: filter }], + queryFn: () => fetchTodos({ filter: filter }), + }))
-{#if $query.status === 'pending'} - Loading... (Attempt: {$query.failureCount + 1}) -{:else if $query.status === 'error'} +{#if query.status === 'pending'} + Loading... (Attempt: {query.failureCount + 1}) +{:else if query.status === 'error'} - Error: {$query.error.message} + Error: {query.error.message}
- +
{:else}
    - {#if $query.data} - {#each $query.data as todo} + {#if query.data} + {#each query.data as todo}
  • {todo.name}{' '} - +
  • {/each} {/if}
- {#if $query.isFetching} + {#if query.isFetching} - Background Refreshing... (Attempt: {$query.failureCount + 1}) + Background Refreshing... (Attempt: {query.failureCount + 1}) {:else}   diff --git a/examples/svelte/playground/svelte.config.js b/examples/svelte/playground/svelte.config.js index a52aed3a7b..d6b43b0085 100644 --- a/examples/svelte/playground/svelte.config.js +++ b/examples/svelte/playground/svelte.config.js @@ -4,10 +4,12 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' /** @type {import('@sveltejs/kit').Config} */ const config = { preprocess: vitePreprocess(), - kit: { adapter: adapter(), }, + compilerOptions: { + runes: true, + }, } export default config diff --git a/examples/svelte/simple/src/main.ts b/examples/svelte/simple/src/main.ts index 7ad46094a0..eeb0a0bcec 100644 --- a/examples/svelte/simple/src/main.ts +++ b/examples/svelte/simple/src/main.ts @@ -1,7 +1,8 @@ +import { mount } from 'svelte' import './app.css' import App from './App.svelte' -const app = new App({ +const app = mount(App, { target: document.querySelector('#app')!, }) diff --git a/examples/svelte/simple/svelte.config.js b/examples/svelte/simple/svelte.config.js index ec6a224d76..64c513012f 100644 --- a/examples/svelte/simple/svelte.config.js +++ b/examples/svelte/simple/svelte.config.js @@ -1,7 +1,8 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' export default { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors preprocess: vitePreprocess(), + compilerOptions: { + runes: true, + }, } diff --git a/examples/svelte/ssr/src/lib/Posts.svelte b/examples/svelte/ssr/src/lib/Posts.svelte index 38ff753da7..2a84ff17d4 100644 --- a/examples/svelte/ssr/src/lib/Posts.svelte +++ b/examples/svelte/ssr/src/lib/Posts.svelte @@ -4,7 +4,7 @@ const client = useQueryClient() - let limit = 10 + const limit = 10 const posts = createQuery< { id: number; title: string; body: string }[], diff --git a/examples/svelte/ssr/svelte.config.js b/examples/svelte/ssr/svelte.config.js index 2dee2d78a1..d6b43b0085 100644 --- a/examples/svelte/ssr/svelte.config.js +++ b/examples/svelte/ssr/svelte.config.js @@ -3,13 +3,13 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors preprocess: vitePreprocess(), - kit: { adapter: adapter(), }, + compilerOptions: { + runes: true, + }, } export default config diff --git a/examples/svelte/star-wars/svelte.config.js b/examples/svelte/star-wars/svelte.config.js index a52aed3a7b..d6b43b0085 100644 --- a/examples/svelte/star-wars/svelte.config.js +++ b/examples/svelte/star-wars/svelte.config.js @@ -4,10 +4,12 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' /** @type {import('@sveltejs/kit').Config} */ const config = { preprocess: vitePreprocess(), - kit: { adapter: adapter(), }, + compilerOptions: { + runes: true, + }, } export default config diff --git a/examples/svelte/svelte-melt/.gitignore b/examples/svelte/svelte-melt/.gitignore deleted file mode 100644 index 6635cf5542..0000000000 --- a/examples/svelte/svelte-melt/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -.DS_Store -node_modules -/build -/.svelte-kit -/package -.env -.env.* -!.env.example -vite.config.js.timestamp-* -vite.config.ts.timestamp-* diff --git a/examples/svelte/svelte-melt/README.md b/examples/svelte/svelte-melt/README.md deleted file mode 100644 index 5ce676612e..0000000000 --- a/examples/svelte/svelte-melt/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# create-svelte - -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). - -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```bash -# create a new project in the current directory -npm create svelte@latest - -# create a new project in my-app -npm create svelte@latest my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. diff --git a/examples/svelte/svelte-melt/package.json b/examples/svelte/svelte-melt/package.json deleted file mode 100644 index 65d614c43e..0000000000 --- a/examples/svelte/svelte-melt/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "svelte-melt", - "private": true, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --check . && eslint .", - "format": "prettier --write ." - }, - "dependencies": { - "@tanstack/query-sync-storage-persister": "^5.51.1", - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1", - "@tanstack/svelte-query-persist-client": "^5.51.1" - }, - "devDependencies": { - "@sveltejs/adapter-auto": "^3.2.2", - "@sveltejs/kit": "^2.5.18", - "@sveltejs/vite-plugin-svelte": "^4.0.0-next.4", - "svelte": "5.0.0-next.192", - "svelte-check": "^3.8.4", - "typescript": "5.3.3", - "vite": "^5.3.3" - } -} diff --git a/examples/svelte/svelte-melt/src/app.d.ts b/examples/svelte/svelte-melt/src/app.d.ts deleted file mode 100644 index 367926a580..0000000000 --- a/examples/svelte/svelte-melt/src/app.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// See https://kit.svelte.dev/docs/types#app -// for information about these interfaces -declare global { - namespace App { - // interface Error {} - // interface Locals {} - // interface PageData {} - // interface PageState {} - // interface Platform {} - } -} - -export {} diff --git a/examples/svelte/svelte-melt/src/app.html b/examples/svelte/svelte-melt/src/app.html deleted file mode 100644 index 84ffad1665..0000000000 --- a/examples/svelte/svelte-melt/src/app.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - %sveltekit.head% - - -
%sveltekit.body%
- - diff --git a/examples/svelte/svelte-melt/src/routes/+layout.svelte b/examples/svelte/svelte-melt/src/routes/+layout.svelte deleted file mode 100644 index 9fdebff85f..0000000000 --- a/examples/svelte/svelte-melt/src/routes/+layout.svelte +++ /dev/null @@ -1,39 +0,0 @@ - - - - -
- {@render children()} -
-
diff --git a/examples/svelte/svelte-melt/src/routes/+page.svelte b/examples/svelte/svelte-melt/src/routes/+page.svelte deleted file mode 100644 index a0568538e8..0000000000 --- a/examples/svelte/svelte-melt/src/routes/+page.svelte +++ /dev/null @@ -1,31 +0,0 @@ - - -isReTORING:{isRes()} - - - diff --git a/examples/svelte/svelte-melt/src/routes/+page.ts b/examples/svelte/svelte-melt/src/routes/+page.ts deleted file mode 100644 index 977abb90f4..0000000000 --- a/examples/svelte/svelte-melt/src/routes/+page.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const ssr = false -export const csr = true diff --git a/examples/svelte/svelte-melt/src/routes/CreateQueries.svelte b/examples/svelte/svelte-melt/src/routes/CreateQueries.svelte deleted file mode 100644 index 7b8338af55..0000000000 --- a/examples/svelte/svelte-melt/src/routes/CreateQueries.svelte +++ /dev/null @@ -1,25 +0,0 @@ - - -{JSON.stringify(combinedQueries)} diff --git a/examples/svelte/svelte-melt/src/routes/cacheUpdate.svelte b/examples/svelte/svelte-melt/src/routes/cacheUpdate.svelte deleted file mode 100644 index 509ba26ff2..0000000000 --- a/examples/svelte/svelte-melt/src/routes/cacheUpdate.svelte +++ /dev/null @@ -1,77 +0,0 @@ - - - - -{data.fetchStatus} -{data.isLoading} -{data.isFetching} -{data.isRefetching} - - -{bookFilterStore.paginate.page} -
{JSON.stringify(data.data, null, 1)}
-{#each data?.data ?? [] as item} -
{item.title}
-{/each} diff --git a/examples/svelte/svelte-melt/src/routes/derivedQuery.svelte b/examples/svelte/svelte-melt/src/routes/derivedQuery.svelte deleted file mode 100644 index 0775006704..0000000000 --- a/examples/svelte/svelte-melt/src/routes/derivedQuery.svelte +++ /dev/null @@ -1,68 +0,0 @@ - - -

testing derived query with list

- -isFetching {isFetching()} -isMutating {isMutating()} - -{data.fetchStatus} -{data.isLoading} -{data.isFetching} -{data.isRefetching} - - -{bookFilterStore.paginate.page} -{p.derived_state} -{#each data?.data ?? [] as item} -
{item.title}
-{/each} diff --git a/examples/svelte/svelte-melt/src/routes/external.svelte.ts b/examples/svelte/svelte-melt/src/routes/external.svelte.ts deleted file mode 100644 index 5cae384af7..0000000000 --- a/examples/svelte/svelte-melt/src/routes/external.svelte.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { createQuery } from '@tanstack/svelte-query' -export function useSvelteExtensionQuery(props) { - const enabled = $derived({ - queryKey: ['sv-externel', props], - queryFn: () => { - return Date.now() - }, - enabled: () => props.paginate.page > 0, - }) - return createQuery(enabled) -} diff --git a/examples/svelte/svelte-melt/src/routes/external.ts b/examples/svelte/svelte-melt/src/routes/external.ts deleted file mode 100644 index d318d314e1..0000000000 --- a/examples/svelte/svelte-melt/src/routes/external.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { createQuery } from '@tanstack/svelte-query' - -export function useQuery(props) { - return createQuery({ - queryKey: ['eternal', props], - queryFn: () => { - return Date.now() - }, - enabled: props.paginate.page > 0, - }) -} diff --git a/examples/svelte/svelte-melt/src/routes/paginate.svelte b/examples/svelte/svelte-melt/src/routes/paginate.svelte deleted file mode 100644 index fe632aac79..0000000000 --- a/examples/svelte/svelte-melt/src/routes/paginate.svelte +++ /dev/null @@ -1,64 +0,0 @@ - - -

testing create query with list

- -{data.fetchStatus} -{data.isLoading} -{data.isFetching} -{data.isRefetching} - - -{bookFilterStore.paginate.page} -{#each data?.data ?? [] as item} -
{item.title}
-{/each} - - diff --git a/examples/svelte/svelte-melt/src/routes/queries.svelte b/examples/svelte/svelte-melt/src/routes/queries.svelte deleted file mode 100644 index 0139637378..0000000000 --- a/examples/svelte/svelte-melt/src/routes/queries.svelte +++ /dev/null @@ -1,769 +0,0 @@ - - - - -
-

Create Queries

-

- QueryOptions: {JSON.stringify([ - { queryFn: () => 1, queryKey: keys }, - { queryFn: () => 2, queryKey: ['aa'] }, - ])} -

- - - -
Result: {JSON.stringify(data)}
-
-
Data: {JSON.stringify(data.data)}
-
-
isError: {JSON.stringify(data)}
-
- -C -
{JSON.stringify(dat1, null, 3)}
diff --git a/examples/svelte/svelte-melt/src/routes/store.svelte.ts b/examples/svelte/svelte-melt/src/routes/store.svelte.ts deleted file mode 100644 index f34ebeb186..0000000000 --- a/examples/svelte/svelte-melt/src/routes/store.svelte.ts +++ /dev/null @@ -1,19 +0,0 @@ -const init = { - paginate: { - page: 1, - asc: false, - orderWith: 'like_count', - start: 0, - end: 10, - size: 12, - totalSize: 20, - }, - filter: { - tags: [], - category: 'fiction', - updated_at: 'yesterday', - created_at: 'last 300 days', - }, - search: {}, -} -export const bookFilterStore = $state({ ...init }) diff --git a/examples/svelte/svelte-melt/src/routes/test.svelte b/examples/svelte/svelte-melt/src/routes/test.svelte deleted file mode 100644 index 1c5afacbd2..0000000000 --- a/examples/svelte/svelte-melt/src/routes/test.svelte +++ /dev/null @@ -1,793 +0,0 @@ - - -
-
-

Create Query

- -

- Cases for different type of query key -
-
    -
  • String key:{createQueryKey}
  • -
  • arr Key{createQueryKeyDeep}
  • -
  • Object Key{JSON.stringify(createQueryKeyDeepArr)}
  • -
-

- - - - - -
Result: {JSON.stringify(data.data, null, 3)}
-
-
Data: {JSON.stringify(data.data)}
-
-
isError: {data.isError}
-
fetchStatus: {data.fetchStatus}
- -
- -
- -
-

mutation

- -
diff --git a/examples/svelte/svelte-melt/static/favicon.png b/examples/svelte/svelte-melt/static/favicon.png deleted file mode 100644 index 825b9e65af..0000000000 Binary files a/examples/svelte/svelte-melt/static/favicon.png and /dev/null differ diff --git a/examples/svelte/svelte-melt/svelte.config.js b/examples/svelte/svelte-melt/svelte.config.js deleted file mode 100644 index 6acad8bac2..0000000000 --- a/examples/svelte/svelte-melt/svelte.config.js +++ /dev/null @@ -1,18 +0,0 @@ -import adapter from '@sveltejs/adapter-auto' -import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' - -/** @type {import('@sveltejs/kit').Config} */ -const config = { - // Consult https://kit.svelte.dev/docs/integrations#preprocessors - // for more information about preprocessors - preprocess: vitePreprocess(), - - kit: { - // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. - // If your environment is not supported or you settled on a specific environment, switch out the adapter. - // See https://kit.svelte.dev/docs/adapters for more information about adapters. - adapter: adapter(), - }, -} - -export default config diff --git a/examples/svelte/svelte-melt/tsconfig.json b/examples/svelte/svelte-melt/tsconfig.json deleted file mode 100644 index 34aadc0285..0000000000 --- a/examples/svelte/svelte-melt/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "./.svelte-kit/tsconfig.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "moduleResolution": "bundler" - } - // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias - // - // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes - // from the referenced tsconfig.json - TypeScript does not merge them in -} diff --git a/examples/svelte/svelte-melt/vite.config.ts b/examples/svelte/svelte-melt/vite.config.ts deleted file mode 100644 index dd1b8b7fa1..0000000000 --- a/examples/svelte/svelte-melt/vite.config.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { sveltekit } from '@sveltejs/kit/vite' -import { defineConfig } from 'vite' - -export default defineConfig({ - plugins: [sveltekit()], -})