mirror of
https://github.com/urbit/shrub.git
synced 2024-12-12 10:29:01 +03:00
odds and ends
This commit is contained in:
parent
c49871551e
commit
381d7ec483
26
pub/tree/src/js/components/Reactify.coffee
Normal file
26
pub/tree/src/js/components/Reactify.coffee
Normal 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}"
|
@ -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])]
|
||||
--
|
Loading…
Reference in New Issue
Block a user