more progress
This commit is contained in:
parent
1ad978804c
commit
41df9b769f
2 changed files with 16 additions and 19 deletions
|
|
@ -9,5 +9,8 @@
|
||||||
<div id="App"></div>
|
<div id="App"></div>
|
||||||
<script src="https://localvoid.github.io/uibench-base/0.1.0/uibench.js"></script>
|
<script src="https://localvoid.github.io/uibench-base/0.1.0/uibench.js"></script>
|
||||||
<script src="nimcache/nim_uibench.js" type="text/javascript"></script>
|
<script src="nimcache/nim_uibench.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<div id="ROOT"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -41,12 +41,11 @@ proc createTableCell(id: cstring): VNode =
|
||||||
result = buildHtml(td(className="TableCell", onclick=tableCellClick)):
|
result = buildHtml(td(className="TableCell", onclick=tableCellClick)):
|
||||||
text id
|
text id
|
||||||
|
|
||||||
|
|
||||||
proc createTableRow(item: TableItemState): VNode =
|
proc createTableRow(item: TableItemState): VNode =
|
||||||
var children = createTableCell("#" & &item.id)
|
var children = createTableCell("#" & &item.id)
|
||||||
for i in 0..<len(item.props):
|
for i in 0..<len(item.props):
|
||||||
children.add(createTableCell(item.props[i]))
|
children.add(createTableCell(item.props[i]))
|
||||||
var dataId = cstring($item.id)
|
var dataId = &item.id
|
||||||
|
|
||||||
proc createRow(): VNode =
|
proc createRow(): VNode =
|
||||||
var className = cstring"TableRow"
|
var className = cstring"TableRow"
|
||||||
|
|
@ -58,17 +57,10 @@ proc createTableRow(item: TableItemState): VNode =
|
||||||
|
|
||||||
|
|
||||||
proc tableCreateVNode(data: TableState): VNode =
|
proc tableCreateVNode(data: TableState): VNode =
|
||||||
var childrens: seq[VNode] = @[]
|
result = buildHtml(table(class="Table")):
|
||||||
for i in 0..<len(data.items):
|
tbody:
|
||||||
childrens.add createTableRow(data.items[i])
|
for child in data.items:
|
||||||
|
createTableRow(child)
|
||||||
proc createTable(): VNode =
|
|
||||||
result = buildHtml(table(class="Table")):
|
|
||||||
tbody:
|
|
||||||
for child in childrens:
|
|
||||||
child
|
|
||||||
|
|
||||||
result = createTable()
|
|
||||||
|
|
||||||
proc createAnimBox(item: AnimBoxState): VNode =
|
proc createAnimBox(item: AnimBoxState): VNode =
|
||||||
var time = item.time
|
var time = item.time
|
||||||
|
|
@ -115,17 +107,19 @@ proc update(): VNode =
|
||||||
children = animCreateVNode(appState.anim)
|
children = animCreateVNode(appState.anim)
|
||||||
elif location == cstring"tree":
|
elif location == cstring"tree":
|
||||||
children = treeCreateVNode(appState.tree)
|
children = treeCreateVNode(appState.tree)
|
||||||
proc createMain(): VNode =
|
kout cstring"update", children
|
||||||
result = buildHtml(tdiv(class="Main")): children
|
result = buildHtml():
|
||||||
result = createMain()
|
tdiv(class="Main"):
|
||||||
|
children
|
||||||
|
|
||||||
proc a(state: AppState) =
|
proc a(state: AppState) =
|
||||||
appState = state
|
appState = state
|
||||||
|
redraw()
|
||||||
|
|
||||||
proc b(samples: RootRef) =
|
proc b(samples: RootRef) =
|
||||||
document.body.innerHTML = cstring"<pre>" & toJson(samples) & cstring"</pre>"
|
#document.body.innerHTML = cstring"<pre>" & toJson(samples) & cstring"</pre>"
|
||||||
redraw()
|
#redraw()
|
||||||
|
discard
|
||||||
|
|
||||||
kout cstring"updating"
|
kout cstring"updating"
|
||||||
setRenderer update
|
setRenderer update
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue