@welshman/store 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
# @welshman/store [](https://npmjs.com/package/@welshman/store)
|
|
2
2
|
|
|
3
3
|
Utilities for dealing with svelte stores when using welshman.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import {Repository, NAMED_PEOPLE, NAMED_TOPICS, type TrustedEvent, readUserList, List} from '@welshman/util'
|
|
7
|
+
import {deriveEventsMapped} from '@welshman/store'
|
|
8
|
+
|
|
9
|
+
const repository = new Repository()
|
|
10
|
+
|
|
11
|
+
// Create a svelte store that performantly maps matching events in the repository to List objects
|
|
12
|
+
const lists = deriveEventsMapped<PublishedUserList>(repository, {
|
|
13
|
+
filters: [{kinds: [NAMED_PEOPLE, NAMED_TOPICS]}],
|
|
14
|
+
eventToItem: (event: TrustedEvent) => (event.tags.length > 1 ? readUserList(event) : null),
|
|
15
|
+
itemToEvent: (list: List) => list.event,
|
|
16
|
+
})
|
|
17
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@welshman/store",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"author": "hodlbod",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A collection of utilities based on svelte/store for use with welshman",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"typescript": "~5.1.6"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@welshman/lib": "~0.0.
|
|
35
|
-
"@welshman/util": "~0.0.
|
|
34
|
+
"@welshman/lib": "~0.0.33",
|
|
35
|
+
"@welshman/util": "~0.0.50",
|
|
36
36
|
"svelte": "^4.2.18"
|
|
37
37
|
}
|
|
38
38
|
}
|