import dom, vdom, karax, karaxdsl, jdict, jstrutils, kajax type HomeState {.importc.} = ref object TableItemState {.importc.} = ref object id: int active: bool props: seq[cstring] TableState {.importc.} = ref object items: seq[TableItemState] AnimBoxState {.importc.} = ref object id: int time: int AnimState {.importc.} = ref object items: seq[AnimBoxState] TreeNodeState {.importc.} = ref object id: int container: bool children: seq[TreeNodeState] TreeState {.importc.} = ref object root: TreeNodeState AppState {.importc.} = ref object location: cstring home: HomeState table: TableState anim: AnimState tree: TreeState var appState: AppState proc createTableCell(id: cstring): VNode = proc tableCellClick(ev: karax.Event; n: VNode) = kout "Clicked" & id result = buildHtml(td(class="TableCell", onclick=tableCellClick)): text id proc createTableRow(item: TableItemState): VNode = let className = if item.active: cstring"TableRow active" else: cstring"TableRow" result = buildHtml(tr(class=className, `data-id` = &item.id, track = item.id)): createTableCell("#" & &item.id) for i in 0.." & myToJson(samples) & cstring"" proc init*(a: cstring, b: cstring) {.importc: "uibench.init", nodecl.} proc run*(a: proc(state: AppState), b: proc(samples: RootRef)) {.importc: "uibench.run", nodecl.} init(cstring"Nim-karax", cstring"0.6.1") setRendererOnly update run(a, b)