Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Commit 438a755

Browse files
committed
chore: make README.md prettier
1 parent 379b302 commit 438a755

File tree

5 files changed

+91
-11
lines changed

5 files changed

+91
-11
lines changed

.changeset/mighty-yaks-compete.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte-query-pocketbase': patch
3+
---
4+
5+
chore: make README.md prettier

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ node_modules
1111
pnpm-lock.yaml
1212
package-lock.json
1313
yarn.lock
14+
15+
# README.md

README.md

Lines changed: 76 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Creates a TanStack Query that updates a Pocketbase record in realtime. View the
1414

1515
### Simple Example
1616

17+
<details>
18+
<summary>View Code</summary>
19+
1720
```svelte
1821
<script lang="ts">
1922
import Pocketbase from 'pocketbase';
@@ -47,8 +50,13 @@ Creates a TanStack Query that updates a Pocketbase record in realtime. View the
4750
{/if}
4851
```
4952

53+
</details>
54+
5055
### With Query Params
5156

57+
<details>
58+
<summary>View Code</summary>
59+
5260
```svelte
5361
<script lang="ts">
5462
import Pocketbase from 'pocketbase';
@@ -83,12 +91,17 @@ Creates a TanStack Query that updates a Pocketbase record in realtime. View the
8391
{/if}
8492
```
8593

94+
</details>
95+
8696
### Using SSR
8797

8898
Read [TanStack Query's docs on this](https://tanstack.com/query/v4/docs/svelte/ssr) first. The examples below are modified versions of the examples on that page.
8999

90100
#### Using `initialData`
91101

102+
<details>
103+
<summary>View Code</summary>
104+
92105
**src/routes/+page.ts**
93106

94107
```ts
@@ -138,8 +151,13 @@ export const load: PageLoad = async () => {
138151
</script>
139152
```
140153

154+
</details>
155+
141156
#### Using `prefetchQuery`
142157

158+
<details>
159+
<summary>View Code</summary>
160+
143161
**src/routes/+layout.ts**
144162

145163
_Same as TanStack Query's docs_
@@ -201,12 +219,17 @@ export const load: PageLoad = async ({ parent }) => {
201219
</script>
202220
```
203221

222+
</details>
223+
204224
## Collection Query
205225

206226
Creates a TanStack Query that updates an array of Pocketbase records in realtime. View the JSDoc for the relevant functions for more documentation on their available options.
207227

208228
### Simple Example
209229

230+
<details>
231+
<summary>View Code</summary>
232+
210233
```svelte
211234
<script lang="ts">
212235
import Pocketbase from 'pocketbase';
@@ -239,8 +262,13 @@ Creates a TanStack Query that updates an array of Pocketbase records in realtime
239262
{/if}
240263
```
241264

265+
</details>
266+
242267
### With Query Params
243268

269+
<details>
270+
<summary>View Code</summary>
271+
244272
```svelte
245273
<script lang="ts">
246274
import Pocketbase from 'pocketbase';
@@ -261,9 +289,9 @@ Creates a TanStack Query that updates an array of Pocketbase records in realtime
261289
sort: '-created', // sort by date created, descending
262290
filter: 'created >= "2022-01-01 00:00:00"'
263291
},
264-
// sortFunction and filterFunction are applied after a realtime update is applied
292+
// sortFunction and filterFunction are applied after a realtime update is applied
265293
sortFunction: (a, b) => new Date(a.created) - new Date(b.created) // sort by date created, descending
266-
filterFunction: (record) => new Date(record.created) >= new Date("2022-01-01 00:00:00")
294+
filterFunction: (record) => new Date(record.created) >= new Date("2022-01-01 00:00:00")
267295
}
268296
);
269297
</script>
@@ -286,12 +314,17 @@ Creates a TanStack Query that updates an array of Pocketbase records in realtime
286314
{/if}
287315
```
288316

317+
</details>
318+
289319
### Using SSR
290320

291321
Read [TanStack Query's docs on this](https://tanstack.com/query/v4/docs/svelte/ssr) first. The examples below are modified versions of the examples on that page.
292322

293323
#### Using `initialData`
294324

325+
<details>
326+
<summary>View Code</summary>
327+
295328
**src/routes/+page.ts**
296329

297330
```ts
@@ -339,8 +372,13 @@ export const load: PageLoad = async () => {
339372
</script>
340373
```
341374

375+
</details>
376+
342377
#### Using `prefetchQuery`
343378

379+
<details>
380+
<summary>View Code</summary>
381+
344382
**src/routes/+layout.ts**
345383

346384
_Same as TanStack Query's docs_
@@ -400,12 +438,17 @@ export const load: PageLoad = async ({ parent }) => {
400438
</script>
401439
```
402440

441+
</details>
442+
403443
## Infinite Collection Query
404444

405445
Creates a TanStack Infinite Query that updates paginated Pocketbase records in realtime. View the JSDoc for the relevant functions for more documentation on their available options.
406446

407447
### Simple Example
408448

449+
<details>
450+
<summary>View Code</summary>
451+
409452
```svelte
410453
<script lang="ts">
411454
import Pocketbase from 'pocketbase';
@@ -447,8 +490,13 @@ Creates a TanStack Infinite Query that updates paginated Pocketbase records in r
447490
{/if}
448491
```
449492

493+
</details>
494+
450495
### With Query Params
451496

497+
<details>
498+
<summary>View Code</summary>
499+
452500
```svelte
453501
<script lang="ts">
454502
import Pocketbase from 'pocketbase';
@@ -469,9 +517,9 @@ Creates a TanStack Infinite Query that updates paginated Pocketbase records in r
469517
sort: '-created', // sort by date created, descending
470518
filter: 'created >= "2022-01-01 00:00:00"'
471519
},
472-
// sortFunction and filterFunction are applied after a realtime update is applied
520+
// sortFunction and filterFunction are applied after a realtime update is applied
473521
sortFunction: (a, b) => new Date(a.created) - new Date(b.created) // sort by date created, descending
474-
filterFunction: (record) => new Date(record.created) >= new Date("2022-01-01 00:00:00")
522+
filterFunction: (record) => new Date(record.created) >= new Date("2022-01-01 00:00:00")
475523
}
476524
);
477525
</script>
@@ -503,12 +551,17 @@ Creates a TanStack Infinite Query that updates paginated Pocketbase records in r
503551
{/if}
504552
```
505553

554+
</details>
555+
506556
### Using SSR
507557

508558
Read [TanStack Query's docs on this](https://tanstack.com/query/v4/docs/svelte/ssr) first. The examples below are modified versions of the examples on that page.
509559

510560
#### Using `initialData`
511561

562+
<details>
563+
<summary>View Code</summary>
564+
512565
**src/routes/+page.ts**
513566

514567
```ts
@@ -557,8 +610,13 @@ export const load: PageLoad = async () => {
557610
</script>
558611
```
559612

613+
</details>
614+
560615
#### Using `prefetchQuery`
561616

617+
<details>
618+
<summary>View Code</summary>
619+
562620
**src/routes/+layout.ts**
563621

564622
_Same as TanStack Query's docs_
@@ -618,12 +676,17 @@ export const load: PageLoad = async ({ parent }) => {
618676
</script>
619677
```
620678

679+
</details>
680+
621681
## User Store
622682

623683
Svelte store wrapper around the authenticated Pocketbase user that updates in realtime.
624684

625685
### Using Default Auth Store
626686

687+
<details>
688+
<summary>View Code</summary>
689+
627690
```svelte
628691
<script lang="ts">
629692
import Pocketbase from 'pocketbase';
@@ -653,12 +716,17 @@ Svelte store wrapper around the authenticated Pocketbase user that updates in re
653716
<p>Welcome, {$user.name}:</p>
654717
<pre>{JSON.stringify($user, null, 2)}</pre>
655718
{:else}
656-
You are not logged in.
719+
<p>You are not logged in.</p>
657720
{/if}
658721
```
659722

723+
</details>
724+
660725
### Using Local Auth Store
661726

727+
<details>
728+
<summary>View Code</summary>
729+
662730
```svelte
663731
<script lang="ts">
664732
import Pocketbase, { LocalAuthStore } from 'pocketbase';
@@ -688,6 +756,8 @@ Svelte store wrapper around the authenticated Pocketbase user that updates in re
688756
<p>Welcome, {$user.name}:</p>
689757
<pre>{JSON.stringify($user, null, 2)}</pre>
690758
{:else}
691-
You are not logged in.
759+
<p>You are not logged in.</p>
692760
{/if}
693761
```
762+
763+
</details>

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@tanstack/svelte-query": "^4.22.2",
21+
"immer": "^9.0.19",
2122
"pocketbase": "^0.10.0",
2223
"svelte": "^3.54.0"
2324
},
@@ -37,7 +38,6 @@
3738
"eslint-config-prettier": "8.6.0",
3839
"eslint-plugin-svelte3": "4.0.0",
3940
"husky": "8.0.3",
40-
"immer": "9.0.19",
4141
"lodash": "4.17.21",
4242
"postcss": "8.4.21",
4343
"prettier": "2.8.3",
@@ -55,9 +55,12 @@
5555
"src/lib/index.ts"
5656
],
5757
"format": [
58-
"esm"
58+
"esm",
59+
"cjs",
60+
"iife"
5961
],
6062
"sourcemap": true,
63+
"minify": true,
6164
"clean": true,
6265
"dts": true
6366
},

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)