11///|
2- typealias @respo_node .( RespoEvent , RespoNode , DispatchFn , RespoCommonError )
2+ typealias @respo_node .RespoNode
33
44///|
5- fnalias @respo_node .(text_node , textarea , declare_static_style )
5+ fnalias @respo_node .(textarea , static_style )
66
77///|
88fnalias @respo .ui_textarea
@@ -22,38 +22,30 @@ fn comp_container(states : @respo.RespoStatesTree) -> RespoNode[ActionOp] {
2222 class_list = [ui_textarea , style_textbox ],
2323 placeholder = "Question" ,
2424 value = state .draft,
25- event = Map ::of ([
26- (
27- Input ,
28- fn (e , dispatch ) {
29- if e is Input (value ~, ..) {
30- dispatch .set_state! (cursor , ContainerState ::{ draft : value })
31- }
32- },
33- ),
34- (
35- Keydown ,
36- fn (e , dispatch ) {
37- if e is Keyboard (key_code ~, meta_key ~, ..) {
38- if key_code == 13 && meta_key {
39- ask_gemini (state .draft)
40- }
41- }
42- },
43- ),
44- ]),
25+ on_input = fn (e , dispatch ) {
26+ if e is Input (value ~, ..) {
27+ dispatch .set_state! (cursor , ContainerState ::{ draft : value })
28+ }
29+ },
30+ on_keydown = fn (e , _dispatch ) {
31+ if e is Keyboard (key_code ~, meta_key ~, ..) {
32+ if key_code == 13 && meta_key {
33+ ask_gemini (state .draft)
34+ }
35+ }
36+ },
4537 ),
4638 button (
4739 inner_text = "Ask" ,
4840 class_name = ui_button ,
4941 style = respo_style (margin = 4 |> Px ),
50- event = {}.. set ( Click , fn (e , dispatch ) { ask_gemini (state .draft) }) ,
42+ on_click = fn (_e , _dispatch ) { ask_gemini (state .draft) },
5143 ),
5244 ]),
5345 ])
5446}
5547
5648///|
57- let style_textbox : String = declare_static_style ([
49+ let style_textbox : String = static_style ([
5850 ("&" , respo_style (width = 600 |> Px , height = 160 |> Px )),
5951])
0 commit comments