-
Notifications
You must be signed in to change notification settings - Fork 88
feat: add Svelte support #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 a730379
feat: add Svelte support
wobsoriano 3ca1f6d
chore: fix tests
wobsoriano 7900bf1
chore: adjust effect roots
wobsoriano 558af77
chore: remove unused packages
wobsoriano f555db5
chore: run dedupe
wobsoriano 1d7c2dd
chore: update scripts
wobsoriano 4be68d6
chore: remove unused packages
wobsoriano 013ac28
chore: add changeset
wobsoriano 546ef4e
chore: update readme
wobsoriano 8e8804f
chore: prettier fix
wobsoriano 0aad000
chore: update changeset
wobsoriano 248180a
chore: update vite config
wobsoriano e83cd59
chore: remove use of store
wobsoriano 284a807
chore: remove unused package
wobsoriano b8444cd
chore: add todo
wobsoriano a27b54a
chore: Remove TanStack store
wobsoriano 7839fd5
chore: remove extra states
wobsoriano e4611bf
chore: update JSDoc to use svelte examples
wobsoriano 8263f40
Merge remote-tracking branch 'origin/main' into rob/svelte-support
wobsoriano 43408cb
chore: update tests
wobsoriano 85dd1dc
chore: update changeset
wobsoriano c38d858
chore: update readme
wobsoriano 3a55f3f
chore: add type test script
wobsoriano 352ff73
chore: clean up jsdoc
wobsoriano 04a07bc
chore: fix build
wobsoriano 7973e3f
Merge branch 'main' into rob/svelte-support
KyleAMathews c8c940b
prettier
KyleAMathews 1700b2d
prettier again
KyleAMathews File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} /> | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
"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" | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 usesvelte-package
to correctly process.svelte.ts
and.svelte
files.This is also what the TanStack Svelte 5 adapter does