@wentools/simmer-svelte 0.1.4 → 0.1.5
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 +20 -11
- package/package.json +14 -1
package/README.md
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
# @wentools/simmer-svelte
|
|
2
2
|
|
|
3
|
-
Svelte 5 adapters for [@wentools/simmer](https://
|
|
3
|
+
Svelte 5 adapters for [@wentools/simmer](https://www.npmjs.com/package/@wentools/simmer).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
npm install @wentools/simmer-svelte @wentools/simmer
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Svelte 5 and `@wentools/simmer` are peer dependencies. The package ships its Svelte rune source
|
|
12
|
+
(`.svelte.ts`), so your build has to compile it. In a Vite or SvelteKit project, exclude it from
|
|
13
|
+
dependency pre-bundling:
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
```typescript
|
|
16
|
+
// vite.config.ts
|
|
17
|
+
optimizeDeps: {
|
|
18
|
+
exclude: ['@wentools/simmer-svelte']
|
|
19
|
+
}
|
|
13
20
|
```
|
|
14
21
|
|
|
22
|
+
It is published to npm only. An older 0.1.1 build remains on JSR, but it is no longer updated.
|
|
23
|
+
|
|
15
24
|
## Usage
|
|
16
25
|
|
|
17
26
|
### `createEventualState`
|
|
@@ -26,19 +35,19 @@ arrives.
|
|
|
26
35
|
|
|
27
36
|
let { data } = $props()
|
|
28
37
|
|
|
29
|
-
// data.
|
|
30
|
-
const
|
|
38
|
+
// data.profile is EventualResult<Profile>
|
|
39
|
+
const profile = createEventualState(() => data.profile)
|
|
31
40
|
</script>
|
|
32
41
|
|
|
33
42
|
<!-- Renders immediately with cached data -->
|
|
34
|
-
<
|
|
43
|
+
<ProfileCard profile={profile.value} />
|
|
35
44
|
|
|
36
|
-
{#if
|
|
45
|
+
{#if profile.isRefreshing}
|
|
37
46
|
<LoadingSpinner />
|
|
38
47
|
{/if}
|
|
39
48
|
|
|
40
|
-
{#if
|
|
41
|
-
<p>Failed to refresh: {
|
|
49
|
+
{#if profile.error}
|
|
50
|
+
<p>Failed to refresh: {profile.error.message}</p>
|
|
42
51
|
{/if}
|
|
43
52
|
```
|
|
44
53
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wentools/simmer-svelte",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Svelte 5 adapters for @wentools/simmer: bridges an eventual result into reactive rune state",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://gitlab.com/wentools/simmer-svelte"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"svelte",
|
|
12
|
+
"svelte5",
|
|
13
|
+
"runes",
|
|
14
|
+
"stale-while-revalidate",
|
|
15
|
+
"async"
|
|
16
|
+
],
|
|
4
17
|
"type": "module",
|
|
5
18
|
"svelte": "./src/mod.ts",
|
|
6
19
|
"exports": {
|