foldkit-mirror 0.2.1 → 0.2.2
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 +19 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -224,6 +224,11 @@ const subscriptions = Subscription.make<Model, Message>()(() => ({
|
|
|
224
224
|
}))
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
At runtime, also reduce the initial URL before the first render and map later
|
|
228
|
+
navigation into `Message.UrlChanged`. The Subscription writes outward; it does
|
|
229
|
+
not replace those inbound steps. The assembly-based version below wires them
|
|
230
|
+
through `Filters.wiring('UrlChanged')` and `placements.url(...)`.
|
|
231
|
+
|
|
227
232
|
That is the entire URL loop:
|
|
228
233
|
|
|
229
234
|
```text
|
|
@@ -234,7 +239,20 @@ URL -> UrlChanged -> reduce -> Model
|
|
|
234
239
|
## Add remembered local state with `Mirror.kv`
|
|
235
240
|
|
|
236
241
|
For state that should survive reload but does not belong in the URL, use an
|
|
237
|
-
Effect `KeyValueStore
|
|
242
|
+
Effect `KeyValueStore`. This extends the earlier Model with `sidebar` and
|
|
243
|
+
`draft`, and its initial value with `'open'` and `''`, respectively. The snippets
|
|
244
|
+
in this section replace the earlier Message and update definitions:
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
const Model = Schema.Struct({
|
|
248
|
+
filter: Schema.Literals(['all', 'active', 'done']),
|
|
249
|
+
page: Schema.Number,
|
|
250
|
+
sidebar: Schema.Literals(['open', 'closed']),
|
|
251
|
+
draft: Schema.String,
|
|
252
|
+
})
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Rebuild `App` from that Model before selecting the added fields:
|
|
238
256
|
|
|
239
257
|
```ts
|
|
240
258
|
import { Projection } from 'foldkit-surface'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-mirror",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A Foldkit Model slice kept in the URL or a key-value store: written when the slice changes, read back on navigation or cold load.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"LICENSE"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"foldkit-surface": "0.
|
|
41
|
+
"foldkit-surface": "0.4.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"effect": "^4.0.0-rc.112",
|