Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a73674e
chore: scaffold svelte app
wobsoriano May 14, 2025
a730379
feat: add Svelte support
wobsoriano May 15, 2025
3ca1f6d
chore: fix tests
wobsoriano May 17, 2025
7900bf1
chore: adjust effect roots
wobsoriano May 17, 2025
558af77
chore: remove unused packages
wobsoriano May 17, 2025
f555db5
chore: run dedupe
wobsoriano May 17, 2025
1d7c2dd
chore: update scripts
wobsoriano May 17, 2025
4be68d6
chore: remove unused packages
wobsoriano May 17, 2025
013ac28
chore: add changeset
wobsoriano May 17, 2025
546ef4e
chore: update readme
wobsoriano May 17, 2025
8e8804f
chore: prettier fix
wobsoriano May 17, 2025
0aad000
chore: update changeset
wobsoriano May 17, 2025
248180a
chore: update vite config
wobsoriano May 17, 2025
e83cd59
chore: remove use of store
wobsoriano May 17, 2025
284a807
chore: remove unused package
wobsoriano May 17, 2025
b8444cd
chore: add todo
wobsoriano May 17, 2025
a27b54a
chore: Remove TanStack store
wobsoriano Jul 21, 2025
7839fd5
chore: remove extra states
wobsoriano Jul 21, 2025
e4611bf
chore: update JSDoc to use svelte examples
wobsoriano Jul 21, 2025
8263f40
Merge remote-tracking branch 'origin/main' into rob/svelte-support
wobsoriano Jul 21, 2025
43408cb
chore: update tests
wobsoriano Jul 22, 2025
85dd1dc
chore: update changeset
wobsoriano Jul 22, 2025
c38d858
chore: update readme
wobsoriano Jul 22, 2025
3a55f3f
chore: add type test script
wobsoriano Jul 22, 2025
352ff73
chore: clean up jsdoc
wobsoriano Jul 22, 2025
04a07bc
chore: fix build
wobsoriano Jul 22, 2025
7973e3f
Merge branch 'main' into rob/svelte-support
KyleAMathews Jul 23, 2025
c8c940b
prettier
KyleAMathews Jul 23, 2025
1700b2d
prettier again
KyleAMathews Jul 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .changeset/khaki-ties-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
"@tanstack/svelte-db": patch
---

Add Svelte support

Usage example:

```svelte
<script lang="ts">
import { useLiveQuery } from "@tanstack/svelte-db"
import { eq } from "@tanstack/db"
import { todoCollection } from "$lib/collections"

const todosQuery = useLiveQuery((query) =>
query
.from({ todos: todoCollection })
.where(({ todos }) => eq(todos.completed, false))
)
</script>


<List items={todosQuery.data} />
```
24 changes: 24 additions & 0 deletions packages/svelte-db/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
node_modules

# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/build
/dist

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
3 changes: 3 additions & 0 deletions packages/svelte-db/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @tanstack/svelte-db

Svelte helpers for TanStack DB. See [TanStack/db](https://github.com/TanStack/db) for more details.
47 changes: 47 additions & 0 deletions packages/svelte-db/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@tanstack/svelte-db",
"description": "Svelte integration for @tanstack/db",
"version": "0.0.0",
"scripts": {
"build": "svelte-package --input ./src --output ./dist --tsconfig ./tsconfig.build.json",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using the shared tanstackViteConfig here as we want to use svelte-package to correctly process .svelte.ts and .svelte files.

This is also what the TanStack Svelte 5 adapter does

"test": "npx vitest --run",
"test:types": "svelte-check --tsconfig ./tsconfig.json",
"lint": "eslint . --fix"
},
"files": [
"dist",
"!dist/**/*.test.*",
"!dist/**/*.spec.*"
],
"sideEffects": [
"**/*.css"
],
"svelte": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"svelte": "./dist/index.js"
}
},
"dependencies": {
"@tanstack/db": "workspace:*"
},
"peerDependencies": {
"svelte": "^5.0.0"
},
"devDependencies": {
"@sveltejs/package": "^2.4.0",
"@vitest/coverage-istanbul": "^3.0.9",
"@sveltejs/vite-plugin-svelte": "^6.1.0",
"publint": "^0.3.2",
"svelte": "^5.28.6",
"svelte-check": "^4.3.0"
},
"keywords": [
"optimistic",
"svelte",
"typescript"
]
}
9 changes: 9 additions & 0 deletions packages/svelte-db/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Re-export all public APIs
export * from "./useLiveQuery.svelte.js"

// Re-export everything from @tanstack/db
export * from "@tanstack/db"

// Re-export some stuff explicitly to ensure the type & value is exported
export type { Collection } from "@tanstack/db"
export { createTransaction } from "@tanstack/db"
Loading
Loading