foldkit-mixins-surface 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/README.md +12 -4
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -96,16 +96,24 @@ const TodoBehavior = Behavior.forSlots(TodoSlots)<
96
96
  })
97
97
 
98
98
  const TodoListView = SurfaceView.define(TodoList, TodoSlots, (model, slots, h) =>
99
- h.ul(
100
- slots.root.attrs(),
101
- model.todos.map(todo => h.li([], [todo.title])),
102
- ),
99
+ h.section(slots.root.attrs(), [
100
+ h.ul([], model.todos.map(todo => h.li([], [todo.title]))),
101
+ h.button(
102
+ slots.archive.attrs([h.Disabled(model.selectedId === null)]),
103
+ ['Archive selected'],
104
+ ),
105
+ ]),
103
106
  ).pipe(Style.attach(TodoStyle), Behavior.attach(TodoBehavior))
104
107
 
105
108
  // `toRenderer` adapts a SlotView to what `Surface.view`/`Surface.rootView` take.
106
109
  const renderer = Surface.view(TodoList, SurfaceView.toRenderer(TodoListView))
107
110
  ```
108
111
 
112
+ `slots.archive.attrs(...)` is where the attached click behavior reaches a
113
+ real element. Declaring a slot or attaching a Behavior alone renders nothing.
114
+ With no selection the button is disabled; with a selection its click emits
115
+ `ArchivedTodo`, and the application's reducer performs the transition.
116
+
109
117
  The useful part is what the render callback does **not** repeat: no type
110
118
  annotation on `model` or `h`, no second Message union, and no root-Model input
111
119
  type. `SurfaceView.define` gets those from the Surface.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit-mixins-surface",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Bridge foldkit-surface's projected Model and Message subset to foldkit-mixins SlotViews.",
5
5
  "keywords": [
6
6
  "foldkit",
@@ -40,17 +40,17 @@
40
40
  "effect": "^4.0.0-rc.112",
41
41
  "foldkit": "^0.158.2",
42
42
  "foldkit-mixins": "^0.3.0",
43
- "foldkit-surface": "^0.2.0"
43
+ "foldkit-surface": "^0.4.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@foldkit/ui": "0.158.2",
47
47
  "effect": "4.0.0-rc.112",
48
48
  "foldkit": "0.158.2",
49
49
  "tsdown": "^0.23.0",
50
- "typescript": "^5.7.2",
50
+ "typescript": "5.9.3",
51
51
  "foldkit-mixins": "0.3.0",
52
52
  "foldkit-mixins-ui": "0.3.0",
53
- "foldkit-surface": "0.2.0"
53
+ "foldkit-surface": "0.4.0"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsdown",