Thanks to @geotre and @jyapayne , Maybe, I can update any single style with 
Karax for now. So I tried updating a style which has more than 2 attributes.

Using style constructor, this worked. 
    
    
    include karax / prelude
    import karax / [vstyles]
    
    var mystyle = style([
      (transform, kstring"translateX(0px)"),
      (backgroundColor, kstring"cyan")
      ])
    var t: string = "For many years, computer programmer have been"
    
    proc mainHtml(): VNode =
      bulidHtml(main(id="main", class="main", style = mystyle)):
        text t
        proc onclick(ev: Event, n: VNode) =
          t = "working hard to reduce their works..."
          mystyle = mystyle.merge(style(transform, "translateX(100px)"))
    
    proc main(): VNode =
      return bulidHtml(tdiv): mainHtml()
    setRenderer main
    
    
    Run

and this did **NOT** work. 
    
    
    ...
    var offset: kstring = "translateX(0px)"
    var mystyle = style([
      (transform, offset),
      (backgroundColor, "cyan")
      ])
    ...
    # inside callbak
          t = "working hard to reduce their works..." #this changes
          offset = "translateX(150px)" #this doesn't change
    
    
    Run

Reply via email to