foldkit-bundle-surface 0.7.0 → 0.9.0
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 +25 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -80,15 +80,37 @@ its path.
|
|
|
80
80
|
|
|
81
81
|
## Reading a placement: projections and Mirrors
|
|
82
82
|
|
|
83
|
-
A placement's state is part of the parent Model, so its
|
|
83
|
+
A placement's state is part of the parent Model, so its slice is already a ref in
|
|
84
84
|
the application's ref tree. Observing one needs no bundle API:
|
|
85
|
-
`App.model.search
|
|
85
|
+
`App.model.search`, `ModelRef.focus(App.model.search).select(projection)`.
|
|
86
|
+
The tree reaches the slice's own fields (`App.model.search.query`) only where
|
|
87
|
+
the Model declares the slice as a Struct, as a `Link.wrapper` over one does; a
|
|
88
|
+
field from `Bundle.declare` carries the bundle's Model as a codec, and the tree
|
|
89
|
+
stops at the slice.
|
|
86
90
|
|
|
87
|
-
For an application
|
|
91
|
+
For an application whose `search` and `filter` slices are Structs, the following
|
|
88
92
|
integration fragment gives each mirror its own keys. Import `Mirror` from
|
|
89
93
|
`foldkit-mirror`; the first example above defines only `search`:
|
|
90
94
|
|
|
95
|
+
<!-- docs-check standalone
|
|
96
|
+
import { Schema } from 'effect'
|
|
97
|
+
import { defineMessageUnion } from 'foldkit/message'
|
|
98
|
+
import { Link } from 'foldkit-bundle'
|
|
99
|
+
import { Surface } from 'foldkit-surface'
|
|
100
|
+
const SearchModel = Schema.Struct({ query: Schema.String })
|
|
101
|
+
const SearchMessage = defineMessageUnion({ Typed: { query: Schema.String } })
|
|
102
|
+
const GotSearchMessage = Link.wrapper('GotSearchMessage', SearchMessage)
|
|
103
|
+
const GotFilterMessage = Link.wrapper('GotFilterMessage', SearchMessage)
|
|
104
|
+
const Model = Schema.Struct({ search: SearchModel, filter: SearchModel })
|
|
105
|
+
type Model = typeof Model.Type
|
|
106
|
+
const Message = defineMessageUnion({ ...GotSearchMessage.cases, ...GotFilterMessage.cases })
|
|
107
|
+
const initial: Model = { search: { query: '' }, filter: { query: '' } }
|
|
108
|
+
const App = Surface.application({ Model, Message, initial, update: model => ({ model }) })
|
|
109
|
+
-->
|
|
110
|
+
|
|
91
111
|
```ts
|
|
112
|
+
import { Mirror } from 'foldkit-mirror'
|
|
113
|
+
|
|
92
114
|
const SearchUrl = Mirror.url(App, {
|
|
93
115
|
name: 'search',
|
|
94
116
|
fields: [App.model.search.query],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-bundle-surface",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "foldkit-bundle placements as foldkit-surface Module contracts: each placement owns its Model path, validated with every other owner.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"LICENSE"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"foldkit-bundle": "0.
|
|
41
|
-
"foldkit-surface": "0.
|
|
40
|
+
"foldkit-bundle": "0.13.0",
|
|
41
|
+
"foldkit-surface": "0.14.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"effect": "^4.1.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"jsdom": "30.1.3",
|
|
52
52
|
"tsdown": "^0.23.1",
|
|
53
53
|
"typescript": "7.0.2",
|
|
54
|
-
"foldkit-mirror": "0.
|
|
54
|
+
"foldkit-mirror": "0.10.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "node ../../scripts/declarations.mjs . && tsdown && node ../../scripts/declared-any.mjs .",
|