odds and ends

This commit is contained in:
Anton Dyudin 2015-08-03 21:08:29 -07:00
parent c49871551e
commit 381d7ec483
2 changed files with 26 additions and 40 deletions

View File

@ -0,0 +1,26 @@
recl = React.createClass
span = React.DOM.span
load = require './LoadComponent.coffee'
codemirror = React.createFactory require './CodeMirror.coffee'
list = React.createFactory require './ListComponent.coffee'
kids = React.createFactory require './KidsComponent.coffee'
lost = React.createFactory recl render: -> (div {}, "lost")
components =
kids:kids
list:list
lost:lost
codemirror:codemirror
module.exports = recl
displayName: "Virtual"
render: -> @walk @props.manx
walk: (obj,key) -> switch
# manx: {fork: ["string", {gn:"string" ga:{dict:"string"} c:{list:"manx"}}]}
when !obj? then (span {className:"loading"}, (load {}, ""))
when typeof obj == "string" then obj
when obj.gn?
React.createElement components[obj.gn] ? obj.gn,
$.extend {key}, obj.ga
obj.c.map @walk
else throw "Bad react-json #{JSON.stringify obj}"

View File

@ -1,40 +0,0 @@
!:
|_ gas=epic
++ get-path
^- path
(tope bem.gas(s but.gas))
::
++ get-parent
^- path
(tope bem.gas(s (slag 1 but.gas)))
::
++ get-tree
^- arch
((hard arch) .^(%cy get-path))
++ kids-json
|= kids=(list ,@ta)
:- %a
%+ turn kids
|= kid=@t [%s kid]
++ bread-json
|= kids=(list path)
:- %a
%+ turn kids
|= kid=path [%s (spat (flop kid))]
++ parent-json |=(pax=path [%s (spat (slag 3 pax))])
++ get-kids
%- sort :_ aor
^- (list span)
%+ murn (~(tap by r:get-tree))
=+ pax=get-path
|= [kid=span ~] ^- (unit span)
=+ ark=;;(arch .^(%cy (welp pax /[kid])))
?~ r.ark ~
(some kid)
::
++ get-bread
=+ [pax=`path`/pub paf=(flop but.gas)]
|- ^- (list path)
?~ paf ~[pax]
[pax $(paf t.paf, pax [i.paf pax])]
--