mirror of
https://github.com/urbit/shrub.git
synced 2024-12-02 08:55:07 +03:00
Merge branches 'Fang-short-ship-names' and 'ohAitch-talk-refix-presence', remote-tracking branches 'joemfb/colors', 'ohAitch/fix-gall-nest', 'joemfb/signin-everywhere', 'ohAitch/show-redirect', 'ohAitch/logout-clear-ship', 'joemfb/cass-cuss', 'joemfb/key-by-correct', 'joemfb/rm-dup-arms', 'joemfb/gaf-by-print-once', 'joemfb/apt-set', 'joemfb/snag-cast', 'origin/ohAitch-help-text-tweak', 'ohAitch/informative-block' and 'ohAitch/refactor--elem-to-react-json'
Conflicts: lib/react.hoon Short ship names in terminal prompt Fix talk presence again Terminal color support Use compiler cache in ++ap-slam check Serve css from the current desk Show redirect page for cross-ship redirects Clear ship cookie on /~/away Normalize ++cass and ++cuss Fix +-key:by Prune duplicate arms Remove +-gaf:by Fix ++apt Add cast to ++snag Suggest +help %hood Show path in "blocking not beam" error Rename lib/react to lib/elem-to-react-json
This commit is contained in:
@ -32,7 +32,7 @@
|
||||
$womb *part:womb ::
|
||||
$write *part:write ::
|
||||
== ::
|
||||
++ hood-part-old ?(hood-part) :: drum-part-old ::
|
||||
++ hood-part-old ?(hood-part drum-part-old) ::
|
||||
++ hood-port ::
|
||||
|= paw/hood-part-old ^- hood-part ::
|
||||
?+ -.paw paw ::
|
||||
@ -40,7 +40,7 @@
|
||||
== ::
|
||||
:: ::
|
||||
++ hood-part ::
|
||||
$% {$drum $1 drum-pith-1} ::
|
||||
$% {$drum $2 drum-pith-2} ::
|
||||
{$helm $0 helm-pith} ::
|
||||
{$kiln $0 kiln-pith} ::
|
||||
{$womb $1 pith:womb} ::
|
||||
|
122
app/talk.hoon
122
app/talk.hoon
@ -138,6 +138,46 @@
|
||||
==
|
||||
--
|
||||
--
|
||||
|%
|
||||
:: old protocol workaround door
|
||||
++ timed
|
||||
|_ a/(map partner atlas) :: XX (map partner (pair @da atlas))
|
||||
++ strip
|
||||
(~(run by a) |=(b/atlas (~(del by b) `@p`%timed-sub)))
|
||||
::
|
||||
++ put :: XX put:by
|
||||
|= {b/partner c/@da d/atlas}
|
||||
=/ sta/status [%gone [~ (some (scot %da c))]]
|
||||
(~(put by a) b (~(put by d) `@p`%timed-sub sta))
|
||||
::
|
||||
++ decode-status
|
||||
|= a/status ^- (unit @da)
|
||||
?. ?=({$gone $~ $~ tym/@t} a) ~
|
||||
=> .(a `{$gone $~ $~ tym/@t}`a)
|
||||
(slaw %da tym.a)
|
||||
::
|
||||
++ uni
|
||||
|= b/_a ^+ a
|
||||
:: XX efficiency
|
||||
%- ~(uni by a)
|
||||
%- ~(urn by b)
|
||||
|= nb/{p/partner q/atlas}
|
||||
?. (~(has by a) p.nb) q.nb
|
||||
=/ qna (~(got by a) p.nb)
|
||||
:: XX p.qna p.q.nb
|
||||
=/ pqna (biff (~(get by qna) `@p`%timed-sub) decode-status)
|
||||
?~ pqna q.nb
|
||||
=/ pqnb (biff (~(get by q.nb) `@p`%timed-sub) decode-status)
|
||||
?~ pqnb qna
|
||||
?: (gth u.pqna u.pqnb) qna
|
||||
?: (gth u.pqnb u.pqna) q.nb
|
||||
:: unfortunately, multiple reports on the same channel can
|
||||
:: be sent on the same event, necessitating last-wins
|
||||
:: ~| uni-timed+[n.a n.b]
|
||||
:: ?> =(n.a n.b)
|
||||
q.nb
|
||||
--
|
||||
--
|
||||
|_ {hid/bowl house}
|
||||
++ ra :: per transaction
|
||||
|_ moves/(list move)
|
||||
@ -458,19 +498,25 @@
|
||||
|- ^+ ret
|
||||
?~ eno ret
|
||||
=. ret $(eno t.eno)
|
||||
?: =(%gone p.q.i.eno) ret
|
||||
=+ unt=(~(get by two) p.i.eno)
|
||||
?~ unt
|
||||
ret(old [i.eno old.ret])
|
||||
?: =(q.i.eno u.unt) ret
|
||||
?: =(%gone p.u.unt)
|
||||
ret(old [i.eno old.ret])
|
||||
?: =(q.i.eno u.unt) ret
|
||||
ret(cha [[p.i.eno u.unt] cha.ret])
|
||||
=. ret
|
||||
=+ owt=(~(tap by two))
|
||||
|- ^+ ret
|
||||
?~ owt ret
|
||||
=. ret $(owt t.owt)
|
||||
?: (~(has by one) p.i.owt)
|
||||
ret
|
||||
ret(new [i.owt new.ret])
|
||||
?: =(%gone p.q.i.owt) ret
|
||||
?. (~(has by one) p.i.owt)
|
||||
ret(new [i.owt new.ret])
|
||||
?: =(%gone p:(~(got by one) p.i.owt))
|
||||
ret(new [i.owt new.ret])
|
||||
ret
|
||||
ret
|
||||
::
|
||||
++ sh-repo-cabal-diff
|
||||
@ -508,6 +554,8 @@
|
||||
new/(list (pair partner atlas))
|
||||
cha/(list (pair partner atlas))
|
||||
==
|
||||
=. one ~(strip timed one)
|
||||
=. two ~(strip timed two)
|
||||
^+ ret
|
||||
=. ret
|
||||
=+ eno=(~(tap by one))
|
||||
@ -1011,8 +1059,6 @@
|
||||
::
|
||||
++ who :: %who
|
||||
|= pan/(set partner) ^+ ..sh-work
|
||||
=+ foo=`(list (pair partner atlas))`(~(tap by q.owners.she))
|
||||
=+ bar=`(list (pair partner atlas))`(sort foo aor)
|
||||
=< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .))
|
||||
|= {pon/partner alt/atlas} ^- (unit sole-effect)
|
||||
?. |(=(~ pan) (~(has in pan) pon)) ~
|
||||
@ -1636,10 +1682,15 @@
|
||||
++ pa-report-group :: update presence
|
||||
|= vew/(set bone)
|
||||
%^ pa-report vew %group
|
||||
:_ remotes
|
||||
|- ^- atlas
|
||||
?~ locals ~
|
||||
[[p.n.locals q.q.n.locals] $(locals l.locals) $(locals r.locals)]
|
||||
:- %- ~(run by locals)
|
||||
|=({@ a/status} a)
|
||||
%- ~(urn by remotes) :: XX preformance
|
||||
|= {pan/partner atl/atlas} ^- atlas
|
||||
?. &(?=($& -.pan) =(our.hid p.p.pan)) atl
|
||||
=+ (~(get by stories) q.p.pan)
|
||||
?~ - atl
|
||||
%- ~(run by locals.u)
|
||||
|=({@ a/status} a)
|
||||
::
|
||||
++ pa-report-cabal :: update config
|
||||
(pa-report cabalers %cabal shape mirrors)
|
||||
@ -1744,39 +1795,17 @@
|
||||
++ pa-notify :: local presence
|
||||
|= {her/ship saz/status}
|
||||
^+ +>
|
||||
=+ ^= nol
|
||||
?: =(%gone p.saz)
|
||||
(~(del by locals) her)
|
||||
(~(put by locals) her now.hid saz)
|
||||
=/ nol (~(put by locals) her now.hid saz)
|
||||
?: =(nol locals) +>.$
|
||||
(pa-report-group(locals nol) groupers)
|
||||
::
|
||||
++ pa-remind :: remote presence
|
||||
|= {tay/partner loc/atlas rem/(map partner atlas)}
|
||||
=+ ^= buk
|
||||
=+ mer=(turn (~(tap by rem) ~) |=({* a/atlas} a))
|
||||
|- ^- atlas
|
||||
?~ mer loc
|
||||
=. loc $(mer t.mer)
|
||||
=+ dur=`(list (pair ship status))`(~(tap by i.mer) ~)
|
||||
|- ^- atlas
|
||||
?~ dur loc
|
||||
=. loc $(dur t.dur)
|
||||
=+ fuy=(~(get by loc) p.i.dur)
|
||||
?~ fuy (~(put by loc) p.i.dur q.i.dur)
|
||||
?: =(`presence`p.q.i.dur `presence`p.u.fuy)
|
||||
loc
|
||||
?- p.u.fuy
|
||||
$gone (~(del by loc) p.i.dur q.i.dur)
|
||||
$talk loc
|
||||
$hear (~(put by loc) p.i.dur q.i.dur)
|
||||
==
|
||||
=+ gub=(~(get by remotes) tay)
|
||||
:: ~& [%pa-remind tay gub buk]
|
||||
?. |(?=($~ gub) !=(buk u.gub))
|
||||
+>.$
|
||||
=. remotes (~(put by remotes) tay buk)
|
||||
(pa-report-group groupers)
|
||||
=. rem (~(del by rem) %& our.hid man) :: superceded by local data
|
||||
=/ buk (~(uni timed remotes) rem) :: XX drop?
|
||||
=. buk (~(put timed buk) tay now.hid loc)
|
||||
?: =(~(strip timed buk) ~(strip timed remotes)) +>.$
|
||||
(pa-report-group(remotes buk) groupers)
|
||||
::
|
||||
++ pa-start :: start stream
|
||||
|= riv/river
|
||||
@ -1922,21 +1951,8 @@
|
||||
++ sn-curt :: render name in 14
|
||||
|= mup/?
|
||||
^- tape
|
||||
=+ rac=(clan p.one)
|
||||
=+ raw=(scow %p p.one)
|
||||
=. raw ?.(mup raw ['*' (slag 2 raw)])
|
||||
?- rac
|
||||
$czar (weld " " raw)
|
||||
$king (weld " " raw)
|
||||
$duke raw
|
||||
$earl ;: welp
|
||||
(scag 1 raw)
|
||||
(scag 6 (slag 15 raw))
|
||||
"^"
|
||||
(scag 6 (slag 22 raw))
|
||||
==
|
||||
$pawn :(welp (scag 7 raw) "_" (scag 6 (slag 51 raw)))
|
||||
==
|
||||
=+ raw=(cite p.one)
|
||||
(runt [(sub 14 (lent raw)) ' '] raw)
|
||||
::
|
||||
++ sn-nick
|
||||
|. ^- tape
|
||||
|
@ -76,9 +76,6 @@
|
||||
$% {$nice $~} ::
|
||||
{$init p/ship} ::
|
||||
== ::
|
||||
++ sign-gall :: see %gall
|
||||
$% {$onto p/(unit tang)} ::
|
||||
== ::
|
||||
++ sign-clay ::
|
||||
$% {$mere p/(each (set path) (pair term tang))} ::
|
||||
{$note p/@tD q/tank} ::
|
||||
@ -180,14 +177,84 @@
|
||||
[%lin see]
|
||||
[%hop pos]
|
||||
==
|
||||
?: ?=($klr -.bit)
|
||||
%+ done %blit
|
||||
:~ [%lin (cvrt:ansi p.bit)]
|
||||
[%mor ~]
|
||||
[%lin see]
|
||||
[%hop pos]
|
||||
==
|
||||
?: ?=($pro -.bit)
|
||||
(done(see p.bit) %blit [[%lin p.bit] [%hop pos] ~])
|
||||
?: ?=($pom -.bit)
|
||||
=. see (cvrt:ansi p.bit)
|
||||
(done %blit [[%lin see] [%hop pos] ~])
|
||||
?: ?=($hop -.bit)
|
||||
(done(pos p.bit) %blit [bit ~])
|
||||
?: ?=($qit -.bit)
|
||||
(dump %logo ~)
|
||||
(done %blit [bit ~])
|
||||
::
|
||||
++ ansi
|
||||
|%
|
||||
++ cvrt :: stub to (list @c)
|
||||
|= a/stub :: with ANSI codes
|
||||
^- (list @c)
|
||||
%- zing %+ turn a
|
||||
|= a/(pair stye (list @c))
|
||||
^- (list @c)
|
||||
;: weld
|
||||
?: =(0 ~(wyt in p.p.a)) ~
|
||||
`(list @c)`(zing (turn (~(tap in p.p.a)) ef))
|
||||
(bg p.q.p.a)
|
||||
(fg q.q.p.a)
|
||||
q.a
|
||||
?~(p.p.a ~ (ef ~))
|
||||
(bg ~)
|
||||
(fg ~)
|
||||
==
|
||||
::
|
||||
++ ef |=(a/^deco (scap (deco a))) :: ANSI effect
|
||||
::
|
||||
++ fg |=(a/^tint (scap (tint a))) :: ANSI foreground
|
||||
::
|
||||
++ bg :: ANSI background
|
||||
|= a/^tint
|
||||
%- scap
|
||||
=>((tint a) [+(p) q]) :: (add 10 fg)
|
||||
::
|
||||
++ scap :: ANSI escape seq
|
||||
|= a/$^((pair @ @) @)
|
||||
%- (list @c)
|
||||
:+ 27 '[' :: "\033[{a}m"
|
||||
?@(a :~(a 'm') :~(p.a q.a 'm'))
|
||||
::
|
||||
++ deco :: ANSI effects
|
||||
|= a/^deco ^- @
|
||||
?- a
|
||||
$~ '0'
|
||||
$br '1'
|
||||
$un '4'
|
||||
$bl '5'
|
||||
==
|
||||
::
|
||||
++ tint :: ANSI colors (fg)
|
||||
|= a/^tint
|
||||
^- (pair @ @)
|
||||
:- '3'
|
||||
?- a
|
||||
$k '0'
|
||||
$r '1'
|
||||
$g '2'
|
||||
$y '3'
|
||||
$b '4'
|
||||
$m '5'
|
||||
$c '6'
|
||||
$w '7'
|
||||
$~ '9'
|
||||
==
|
||||
--
|
||||
::
|
||||
++ heft
|
||||
%_ .
|
||||
moz
|
||||
|
@ -173,7 +173,7 @@
|
||||
|= hed/(list {p/@t q/@t}) ^- math
|
||||
%+ roll hed
|
||||
|= {a/{p/cord q/cord} b/math}
|
||||
=. p.a (cass (trip p.a))
|
||||
=. p.a (crip (cass (trip p.a)))
|
||||
(~(add ja b) p.a q.a)
|
||||
::
|
||||
++ fcgi :: credential caboose
|
||||
@ -423,15 +423,25 @@
|
||||
}
|
||||
|
||||
urb.foreign = /^\/~\/am/.test(window.location.pathname)
|
||||
urb.redir = function(ship){
|
||||
if(ship) document.location.pathname =
|
||||
document.location.pathname.replace(/^\/~~|\/~\/as\/any/,'/~/as/~'+ship)
|
||||
else document.location =
|
||||
urb.redirTo = function(url){
|
||||
document.title = "Redirecting"
|
||||
var mount = document.getElementById("pass") || document.body
|
||||
mount.outerHTML = "Redirecting to <a href=\""+url+"\">"+url+"</a>"
|
||||
document.location = url
|
||||
}
|
||||
urb.redir = function(ship){
|
||||
if(ship){
|
||||
var location = new URL(document.location)
|
||||
location.pathname = location.pathname.replace(/^\/~~|\/~\/as\/any/,'/~/as/~'+ship)
|
||||
urb.redirTo(location)
|
||||
}
|
||||
else urb.redirTo(
|
||||
document.location.hash.match(/#[^?]+/)[0].slice(1) +
|
||||
document.location.pathname.replace(
|
||||
/^\/~\/am\/[^/]+/,
|
||||
'/~/as/~' + urb.ship) +
|
||||
document.location.search
|
||||
)
|
||||
}
|
||||
if(urb.foreign && urb.auth.indexOf(urb.ship) !== -1){
|
||||
req("/~/auth.json?PUT",
|
||||
@ -465,6 +475,16 @@
|
||||
;body:"You may now close this window."
|
||||
==
|
||||
::
|
||||
++ redir
|
||||
|= url/tape
|
||||
;html
|
||||
;head:title:"Redirecting..."
|
||||
;body
|
||||
;p: Redirecting to ;{a/"{url}" "{url}"}
|
||||
;script: setTimeout(function()\{document.location = {(pojo (jape url))}}, 3000)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ login-page
|
||||
%+ titl 'Sign in - Urbit'
|
||||
;= ;div.container.top
|
||||
@ -553,8 +573,8 @@
|
||||
;title:"{(trip a)}"
|
||||
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/".
|
||||
"libs/jquery/2.1.1/jquery.min.js");
|
||||
;link(rel "stylesheet", href "/=home=/web/lib/css/fonts.css");
|
||||
;link(rel "stylesheet", href "/=home=/web/lib/css/bootstrap.css");
|
||||
;link(rel "stylesheet", href "/===/web/lib/css/fonts.css");
|
||||
;link(rel "stylesheet", href "/===/web/lib/css/bootstrap.css");
|
||||
==
|
||||
;body:"*{b}"
|
||||
==
|
||||
@ -853,8 +873,9 @@
|
||||
(fail 404 p.sih p.q.sih)
|
||||
=* cay p.q.sih
|
||||
?: ?=($red-quri p.cay)
|
||||
=+ url=((hard quri) q.q.cay)
|
||||
(give-thou 307 [location+(crip (apex:earn url))]~ ~)
|
||||
=+ url=(apex:earn ((hard quri) q.q.cay))
|
||||
(give-thou 307 [location+(crip url)]~ ~)
|
||||
:: (give-html:abet 200 ~ (redir:xml url))
|
||||
?. ?=($mime p.cay)
|
||||
=+ bek=(norm-beak -:(need (tome p.tee)))
|
||||
=+ tee-ses=?~(ses tee [%ac u.ses tee])
|
||||
@ -1129,7 +1150,7 @@
|
||||
^- (unit perk)
|
||||
=. mef
|
||||
?. ?=($post mef) mef
|
||||
?+ (skim quy |=({a/@t b/@t} &(=('' b) =(a (cuss (trip a))))))
|
||||
?+ (skim quy |=({a/@t b/@t} &(=('' b) =(a (crip (cuss (trip a)))))))
|
||||
~|(bad-quy+[req='"?PUT" or "?DELETE"' quy] !!)
|
||||
$~ mef
|
||||
{{$'DELETE' $~} $~} %delt
|
||||
@ -1339,13 +1360,13 @@
|
||||
[%| (resolve ~ p.pez(p [%at ses.yac p.p.pez]))]
|
||||
::
|
||||
$js
|
||||
=^ jon ..ya stat-json.yac
|
||||
=^ jon ..ya stat-json.yac
|
||||
[%| (resolve cug.yac p.pez(p (add-json jon p.p.pez)))]
|
||||
==
|
||||
::
|
||||
$del
|
||||
=. ..ya (logoff:yac p.ham)
|
||||
=+ cug=[(set-cookie cookie-prefix '~')]~
|
||||
=+ cug=~[(set-cookie cookie-prefix '~') (set-cookie %ship '~')]
|
||||
[%| (give-json 200 cug (joba %ok %b &))]
|
||||
::
|
||||
$get
|
||||
@ -1475,8 +1496,7 @@
|
||||
q.q.pul ['~' %am ses q.q.pul]
|
||||
==
|
||||
=+ url=(welp (earn pul(p hat)) '#' (head:earn p.pul))
|
||||
%- give-thou:abet
|
||||
(add-cookies cug [307 [location+(crip url)]~ ~])
|
||||
(give-html:abet 200 cug (redir:xml url))
|
||||
::
|
||||
++ logon
|
||||
|= her/ship
|
||||
|
@ -450,10 +450,10 @@
|
||||
?~ pax (err "blocking empty")
|
||||
=+ ren=((soft care) (rsh 3 1 i.pax))
|
||||
?~ ren
|
||||
(err "blocking not care")
|
||||
(err "blocking not care: {<i.pax>}")
|
||||
=+ zis=(tome t.pax)
|
||||
?~ zis
|
||||
(err "blocking not beam")
|
||||
(err "blocking not beam: {<t.pax>}")
|
||||
?: ?=($g (end 3 1 i.pax))
|
||||
?- -.nex
|
||||
$& [%& [%g u.ren u.zis] p.nex]
|
||||
|
@ -1178,15 +1178,16 @@
|
||||
|= {cog/term gat/vase arg/vase}
|
||||
^- {(each vase tang) _+>}
|
||||
=+ ^= wyz %- mule |.
|
||||
(~(play wa vel) [%cell p.gat p.arg] [%open [%$ ~] [%$ 2] [%$ 3] ~])
|
||||
(~(mint wa vel) [%cell p.gat p.arg] [%open [%$ ~] [%$ 2] [%$ 3] ~])
|
||||
?: ?=($| -.wyz)
|
||||
%- =+ sam=(~(peek ut p.gat) %free 6)
|
||||
(slog >%ap-slam-mismatch< ~(duck ut p.arg) ~(duck ut sam) ~)
|
||||
:_(+>.$ [%| (ap-suck "call: {<cog>}: type mismatch")])
|
||||
:_ +>.$(vel +>.wyz)
|
||||
=+ ton=(mong [q.gat q.arg] ap-sled)
|
||||
=+ [typ nok]=+<.wyz
|
||||
=+ ton=(mock [[q.gat q.arg] nok] ap-sled)
|
||||
?- -.ton
|
||||
$0 [%& +<.wyz p.ton]
|
||||
$0 [%& typ p.ton]
|
||||
$1 [%| (turn p.ton |=(a/* (smyt (path a))))]
|
||||
$2 [%| p.ton]
|
||||
==
|
||||
|
@ -798,7 +798,7 @@
|
||||
++ snag :: index
|
||||
~/ %snag
|
||||
|* {a/@ b/(list)}
|
||||
|-
|
||||
|- ^+ ?>(?=(^ b) i.b)
|
||||
?~ b
|
||||
~|('snag-fail' !!)
|
||||
?: =(0 a) i.b
|
||||
@ -2388,10 +2388,13 @@
|
||||
::
|
||||
++ apt :: set invariant
|
||||
|= a/(tree)
|
||||
?~ a
|
||||
&
|
||||
?& ?~(l.a & ?&((vor n.a n.l.a) (hor n.l.a n.a) $(a l.a)))
|
||||
?~(r.a & ?&((vor n.a n.r.a) (hor n.a n.r.a) $(a r.a)))
|
||||
=| {l/(unit) r/(unit)}
|
||||
|- ^- ?
|
||||
?~ a &
|
||||
?& ?~(l & (hor n.a u.l))
|
||||
?~(r & (hor u.r n.a))
|
||||
?~(l.a & ?&((vor n.a n.l.a) $(a l.a, l `n.a)))
|
||||
?~(r.a & ?&((vor n.a n.r.a) $(a r.a, r `n.a)))
|
||||
==
|
||||
::
|
||||
++ in :: set engine
|
||||
@ -2583,11 +2586,14 @@
|
||||
:: section 2dB, maps ::
|
||||
::
|
||||
++ ept :: map invariant
|
||||
|= a/(tree {p/* q/*})
|
||||
?~ a
|
||||
&
|
||||
?& ?~(l.a & ?&((vor p.n.a p.n.l.a) (gor p.n.l.a p.n.a) $(a l.a)))
|
||||
?~(r.a & ?&((vor p.n.a p.n.r.a) (gor p.n.a p.n.r.a) $(a l.a)))
|
||||
|= a/(tree (pair))
|
||||
=| {l/(unit) r/(unit)}
|
||||
|- ^- ?
|
||||
?~ a &
|
||||
?& ?~(l & (gor p.n.a u.l))
|
||||
?~(r & (gor u.r p.n.a))
|
||||
?~(l.a & ?&((vor p.n.a p.n.l.a) $(a l.a, l `p.n.a)))
|
||||
?~(r.a & ?&((vor p.n.a p.n.r.a) $(a r.a, r `p.n.a)))
|
||||
==
|
||||
::
|
||||
++ ja :: jar engine
|
||||
@ -2731,16 +2737,6 @@
|
||||
a
|
||||
$(b t.b, a (put p.i.b q.i.b))
|
||||
::
|
||||
+- gaf :: concat, fail on dupe
|
||||
~/ %gaf
|
||||
|= b/(list _?>(?=(^ a) n.a))
|
||||
|- ^+ a
|
||||
?~ b
|
||||
a
|
||||
~| duplicate-key+p.i.b
|
||||
?< (has p.i.b)
|
||||
$(b t.b, a (put p.i.b q.i.b))
|
||||
::
|
||||
+- get :: grab value by key
|
||||
~/ %get
|
||||
|= b/*
|
||||
@ -2871,9 +2867,10 @@
|
||||
?~(a 0 +((add $(a l.a) $(a r.a))))
|
||||
::
|
||||
+- key :: set of keys
|
||||
|- ^- (set _?>(?=(^ a) p.n.a))
|
||||
?~ a ~
|
||||
[n=p.n.a l=$(a l.a) r=$(a r.a)]
|
||||
=| b/(set _?>(?=(^ a) p.n.a))
|
||||
|- ^+ b
|
||||
?~ a b
|
||||
$(a r.a, b $(a l.a, b (~(put in b) p.n.a)))
|
||||
::
|
||||
+- val :: list of vals
|
||||
=| b/(list _?>(?=(^ a) q.n.a))
|
||||
@ -3589,13 +3586,12 @@
|
||||
::
|
||||
++ cass :: lowercase
|
||||
|= vib/tape
|
||||
%+ rap 3
|
||||
^- tape
|
||||
(turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
|
||||
::
|
||||
++ cuss :: uppercase
|
||||
|= vib/tape
|
||||
^- @t
|
||||
%+ rap 3
|
||||
^- tape
|
||||
(turn vib |=(a/@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
|
||||
::
|
||||
++ crip |=(a/tape `@t`(rap 3 a)) :: tape to cord
|
||||
@ -5009,7 +5005,7 @@
|
||||
$d [%d q.q.don p.q.don]
|
||||
==
|
||||
::
|
||||
++ hump :: general prepatch
|
||||
++ hemp :: general prepatch
|
||||
|= {pum/umph src/*} ^- *
|
||||
?+ pum ~|(%unsupported !!)
|
||||
$a src
|
||||
|
@ -1983,7 +1983,7 @@
|
||||
%+ sear
|
||||
|= a/@ta
|
||||
?.(=('-' (rsh 3 (dec (met 3 a)) a)) [~ u=a] ~)
|
||||
%+ cook cass
|
||||
%+ cook |=(a/tape (crip (cass a)))
|
||||
;~(plug aln (star alp))
|
||||
::
|
||||
++ fque (cook crip (plus pquo)) :: normal query field
|
||||
@ -2004,7 +2004,7 @@
|
||||
hep dot ket cab tec bar sig
|
||||
==
|
||||
++ scem :: 2396 scheme
|
||||
%+ cook cass
|
||||
%+ cook |=(a/tape (crip (cass a)))
|
||||
;~(plug alf (star ;~(pose aln lus hep dot)))
|
||||
::
|
||||
++ smeg (cook crip (plus pcar)) :: 2396 segment
|
||||
@ -2071,6 +2071,25 @@
|
||||
?: (lte wid 8) %earl
|
||||
?> (lte wid 16) %pawn
|
||||
::
|
||||
++ cite :: ship short name
|
||||
|= who/@p
|
||||
^- tape
|
||||
=+ kind=(clan who)
|
||||
=+ name=(scow %p who)
|
||||
?: =(%earl kind)
|
||||
=+ park=(clan (sein who))
|
||||
;: weld
|
||||
"~"
|
||||
?: =(park %duke)
|
||||
(swag [(sub (lent name) 13) 6] name)
|
||||
~
|
||||
"^"
|
||||
(swag [(sub (lent name) 6) 6] name)
|
||||
==
|
||||
?: =(%pawn kind)
|
||||
:(weld (swag [0 7] name) "_" (swag [(sub (lent name) 6) 6] name))
|
||||
name
|
||||
::
|
||||
++ glam :: carrier names
|
||||
|= zar/@pD ^- tape
|
||||
(weld "galaxy " (scow %p zar))
|
||||
@ -2290,13 +2309,6 @@
|
||||
heg/(map hand code) :: proposed
|
||||
qim/(map hand code) :: inbound
|
||||
== ::
|
||||
++ coal * :: untyped vase
|
||||
++ code @uvI :: symmetric key
|
||||
++ cone :: reconfiguration
|
||||
$% {$& p/twig} :: transform
|
||||
{$| p/(list @tas)} :: alter
|
||||
== ::
|
||||
++ chum @uvI :: hashed passcode
|
||||
++ claw :: startup chain
|
||||
$: joy/(unit coal) :: local context
|
||||
ran/(unit coal) :: arguments
|
||||
@ -2309,7 +2321,7 @@
|
||||
++ coal * :: untyped vase
|
||||
++ code @uvI :: symmetric key
|
||||
++ cone :: reconfiguration
|
||||
$% {$& p/twig} :: transform
|
||||
$% {$& p/twig} :: transform
|
||||
{$| p/(list @tas)} :: alter
|
||||
== ::
|
||||
++ coop (unit ares) :: e2e ack
|
||||
@ -2327,6 +2339,7 @@
|
||||
cip/(each @if @is) :: client IP
|
||||
cum/(map @tas *) :: custom dirt
|
||||
== ::
|
||||
++ deco ?($~ $bl $br $un) :: text decoration
|
||||
++ deed {p/@ q/step r/?} :: sig stage fake?
|
||||
++ dome :: project state
|
||||
$: ank/ankh :: state
|
||||
@ -2609,9 +2622,15 @@
|
||||
++ sock {p/ship q/ship} :: outgoing [from to]
|
||||
++ spur path :: ship desk case spur
|
||||
++ step {p/bray q/gens r/pass} :: identity stage
|
||||
++ stub (list (pair stye (list @c))) :: styled tuba
|
||||
++ stye (pair (set deco) (pair tint tint)) :: decos/bg/fg
|
||||
++ styl ::
|
||||
(pair (unit deco) (pair (unit tint) (unit tint))) :: cascading stye
|
||||
++ styx (list $@(@t (pair styl styx))) :: styled text
|
||||
++ suba (list {p/path q/misu}) :: delta
|
||||
++ tako @ :: yaki ref
|
||||
++ tick @ud :: process id
|
||||
++ tint ?($~ $r $g $b $c $m $y $k $w) :: text color
|
||||
++ toro {p/@ta q/nori} :: general change
|
||||
++ town :: all security state
|
||||
$: lit/@ud :: imperial modulus
|
||||
@ -2750,9 +2769,11 @@
|
||||
++ dill-blit :: new blit
|
||||
$% {$bel $~} :: make a noise
|
||||
{$clr $~} :: clear the screen
|
||||
{$klr p/stub} :: styled text
|
||||
{$hop p/@ud} :: set cursor position
|
||||
{$mor p/(list dill-blit)} :: multiple blits
|
||||
{$pro p/(list @c)} :: show as cursor+line
|
||||
{$pom p/stub} :: styled prompt
|
||||
{$qit $~} :: close console
|
||||
{$out p/(list @c)} :: send output line
|
||||
{$sag p/path q/*} :: save to jamfile
|
||||
|
@ -1,4 +1,4 @@
|
||||
:: List available comands
|
||||
:: Describe available comands: +help, +help %tree, +help %hood
|
||||
::
|
||||
:::: /hoon/help/gen
|
||||
::
|
||||
|
@ -41,11 +41,11 @@
|
||||
view-source webcal wtai wyciwyg xfire xri ymsgr
|
||||
'''
|
||||
::
|
||||
++ uri-skem (sear (flit |=(a/tape (~(has in skem-set) (cass a)))) skem-symb)
|
||||
++ uri-skem (sear (flit |=(a/tape (~(has in skem-set) (crip (cass a))))) skem-symb)
|
||||
--
|
||||
::
|
||||
::::
|
||||
::
|
||||
::
|
||||
|%
|
||||
++ nal (just `@`10)
|
||||
++ end (full (easy ~))
|
||||
@ -273,8 +273,8 @@
|
||||
;~(plug pel (cook welp ;~(plug (star chu) per ^$)))
|
||||
(easy ~)
|
||||
==
|
||||
++ text
|
||||
=- (ifix sel^ser (cook cass (star -)))
|
||||
++ text
|
||||
=- (ifix sel^ser (cook |=(a/tape (crip (cass a))) (star -)))
|
||||
;~ pose
|
||||
(cook |=(a/char (cat 3 '\\' a)) esc)
|
||||
(cold ' ' (plus gah))
|
||||
@ -494,8 +494,8 @@
|
||||
%script %section %style %table %tbody %td %textarea %tfoot
|
||||
%th %thead %tr %ul %video
|
||||
==
|
||||
++ htm-head =+ blu=(flit ~(has in (silt `wain`blok)))
|
||||
=+ blo=(sear blu (cook cass (star aln)))
|
||||
++ htm-head =+ blu=(flit ~(has in (silt `wain`blok)))
|
||||
=+ blo=(sear blu (cook |=(a/tape (crip (cass a))) (star aln)))
|
||||
%+ stag %html
|
||||
;~ plug gal
|
||||
;~ pose
|
||||
|
138
lib/drum.hoon
138
lib/drum.hoon
@ -9,10 +9,18 @@
|
||||
:::: :: ::
|
||||
:: :: ::
|
||||
|% :: ::
|
||||
++ drum-part {$drum $1 drum-pith-1} ::
|
||||
++ drum-part-old {$drum $0 drum-pith-0} ::
|
||||
++ drum-pith-0 _!! :: forgotten
|
||||
++ drum-pith-1 ::
|
||||
++ drum-part {$drum $2 drum-pith-2} ::
|
||||
++ drum-part-old {$drum $1 drum-pith-1} ::
|
||||
:: ::
|
||||
++ drum-pith-1 :: pre-style
|
||||
%+ cork drum-pith-2 ::
|
||||
|=(drum-pith-2 +<(bin *(map bone source-1))) ::
|
||||
:: ::
|
||||
++ source-1 ::
|
||||
%+ cork source ::
|
||||
|=(source +<(mir *(pair @ud (list @c)))) :: style-less mir
|
||||
:: ::
|
||||
++ drum-pith-2 ::
|
||||
$: sys/(unit bone) :: local console
|
||||
eel/(set gill) :: connect to
|
||||
ray/(set well) ::
|
||||
@ -38,7 +46,7 @@
|
||||
kil/kill :: kill buffer
|
||||
inx/@ud :: ring index
|
||||
fug/(map gill (unit target)) :: connections
|
||||
mir/(pair @ud (list @c)) :: mirrored terminal
|
||||
mir/(pair @ud stub) :: mirrored terminal
|
||||
== ::
|
||||
++ history :: past input
|
||||
$: pos/@ud :: input position
|
||||
@ -85,7 +93,7 @@
|
||||
|= our/ship
|
||||
^- drum-part
|
||||
:* %drum
|
||||
%1
|
||||
%2
|
||||
~ :: sys
|
||||
(deft-fish our) :: eel
|
||||
(deft-apes our) :: ray
|
||||
@ -96,8 +104,13 @@
|
||||
++ drum-port
|
||||
|= old/?(drum-part drum-part-old) ^- drum-part
|
||||
?- &2.old
|
||||
$1 old
|
||||
$0 !! :: XX unreachable, see issue #242
|
||||
$2 old
|
||||
$1 %= old
|
||||
&2 %2
|
||||
bin %- ~(run by bin.old)
|
||||
|= source-1 ^- source
|
||||
+<(mir [(add 20 p.mir) [[*stye q.mir] ~]])
|
||||
==
|
||||
==
|
||||
::
|
||||
++ drum-path :: encode path
|
||||
@ -387,18 +400,18 @@
|
||||
(se-emit [u.sys %diff %dill-blit bil])
|
||||
::
|
||||
++ se-show :: show buffer, raw
|
||||
|= lin/(pair @ud (list @c))
|
||||
|= lin/(pair @ud stub)
|
||||
^+ +>
|
||||
?: =(mir lin) +>
|
||||
=. +> ?:(=(q.mir q.lin) +> (se-blit %pro q.lin))
|
||||
=. +> ?:(=(p.mir p.lin) +> (se-blit %hop p.lin))
|
||||
=. +> ?:(=(p.mir p.lin) +> (se-blit %hop (add p.lin (lent-stye:klr q.lin))))
|
||||
=. +> ?:(=(q.mir q.lin) +> (se-blit %pom q.lin))
|
||||
+>(mir lin)
|
||||
::
|
||||
++ se-just :: adjusted buffer
|
||||
|= lin/(pair @ud (list @c))
|
||||
|= lin/(pair @ud stub)
|
||||
^+ +>
|
||||
=. off ?:((lth p.lin edg) 0 (sub p.lin edg))
|
||||
(se-show (sub p.lin off) (scag edg (slag off q.lin)))
|
||||
(se-show (sub p.lin off) (scag:klr edg (slag:klr off q.lin)))
|
||||
::
|
||||
++ se-view :: flush buffer
|
||||
^+ .
|
||||
@ -587,6 +600,7 @@
|
||||
{$clr *} +>(..ta (se-blit fec))
|
||||
{$det *} (ta-got +.fec)
|
||||
{$err *} (ta-err p.fec)
|
||||
{$klr *} +>(..ta (se-blit %klr (make:klr p.fec)))
|
||||
{$mor *} |- ^+ +>.^$
|
||||
?~ p.fec +>.^$
|
||||
$(p.fec t.p.fec, +>.^$ ^$(fec i.p.fec))
|
||||
@ -782,7 +796,7 @@
|
||||
::
|
||||
++ ta-pro :: set prompt
|
||||
|= pom/sole-prompt
|
||||
+>(pom pom(cad :(welp (scow %p p.gyl) ":" (trip q.gyl) cad.pom)))
|
||||
+>(pom pom(cad :(welp ?.(?=($earl (clan p.gyl)) (cite p.gyl) (scow %p p.gyl)) ":" (trip q.gyl) cad.pom)))
|
||||
::
|
||||
++ ta-ret :: hear return
|
||||
(ta-act %ret ~)
|
||||
@ -812,9 +826,11 @@
|
||||
(ta-hom (cat:edit pos.inp txt))
|
||||
::
|
||||
++ ta-vew :: computed prompt
|
||||
|- ^- (pair @ud (list @c))
|
||||
=; vew/(pair (list @c) tape)
|
||||
[(add pos.inp (lent q.vew)) (weld (tuba q.vew) p.vew)]
|
||||
^- (pair @ud stub)
|
||||
=; vew/(pair (list @c) styx)
|
||||
=+ lin=(make:klr q.vew)
|
||||
:_ (welp lin [*stye p.vew]~)
|
||||
(add pos.inp (lent-char:klr lin))
|
||||
?: vis.pom
|
||||
:- buf.say.inp :: default prompt
|
||||
?~ ris
|
||||
@ -891,4 +907,92 @@
|
||||
?: |(?=($~ a) (alnm i.a)) i
|
||||
$(i +(i), a t.a)
|
||||
--
|
||||
::
|
||||
++ klr :: styx/stub engine
|
||||
|%
|
||||
++ make :: stub from styx
|
||||
|= a/styx ^- stub
|
||||
=| b/stye
|
||||
%+ reel
|
||||
|- ^- stub
|
||||
%- zing %+ turn a
|
||||
|= a/$@(@t (pair styl styx))
|
||||
?@ a [b (tuba (trip a))]~
|
||||
^$(a q.a, b (styd p.a b))
|
||||
::
|
||||
|= {a/(pair stye (list @c)) b/stub}
|
||||
?~ b [a ~]
|
||||
?. =(p.a p.i.b) [a b]
|
||||
[[p.a (weld q.a q.i.b)] t.b]
|
||||
::
|
||||
++ styd :: stye from styl
|
||||
|= {a/styl b/stye} ^+ b :: with inheritance
|
||||
:+ ?~ p.a p.b
|
||||
?~ u.p.a ~
|
||||
(~(put in p.b) u.p.a)
|
||||
(fall p.q.a p.q.b)
|
||||
(fall q.q.a q.q.b)
|
||||
::
|
||||
++ lent-stye
|
||||
|= a/stub ^- @
|
||||
(roll (lnts-stye a) add)
|
||||
::
|
||||
++ lent-char
|
||||
|= a/stub ^- @
|
||||
(roll (lnts-char a) add)
|
||||
::
|
||||
++ lnts-stye :: stub pair head lengths
|
||||
|= a/stub ^- (list @)
|
||||
%+ turn a
|
||||
|= a/(pair stye (list @c))
|
||||
;: add :: presumes impl of cvrt:ansi in %dill
|
||||
(mul 5 2) :: bg
|
||||
(mul 5 2) :: fg
|
||||
=+ b=~(wyt in p.p.a) :: effect
|
||||
?:(=(0 b) 0 (mul 4 +(b)))
|
||||
==
|
||||
::
|
||||
++ lnts-char :: stub pair tail lengths
|
||||
|= a/stub ^- (list @)
|
||||
%+ turn a
|
||||
|= a/(pair stye (list @c))
|
||||
(lent q.a)
|
||||
::
|
||||
++ brek :: index + incl-len of
|
||||
|= {a/@ b/(list @)} :: stub pair w/ idx a
|
||||
=| {c/@ i/@}
|
||||
|- ^- (unit (pair @ @))
|
||||
?~ b ~
|
||||
=. c (add c i.b)
|
||||
?: (gte c a)
|
||||
`[i c]
|
||||
$(i +(i), b t.b)
|
||||
::
|
||||
++ slag :: slag stub, keep stye
|
||||
|= {a/@ b/stub}
|
||||
^- stub
|
||||
=+ c=(lnts-char b)
|
||||
=+ i=(brek a c)
|
||||
?~ i b
|
||||
=+ r=(^slag +(p.u.i) b)
|
||||
?: =(a q.u.i)
|
||||
r
|
||||
=+ n=(snag p.u.i b)
|
||||
:_ r :- p.n
|
||||
(^slag (sub (snag p.u.i c) (sub q.u.i a)) q.n)
|
||||
::
|
||||
++ scag :: scag stub, keep stye
|
||||
|= {a/@ b/stub}
|
||||
^- stub
|
||||
=+ c=(lnts-char b)
|
||||
=+ i=(brek a c)
|
||||
?~ i b
|
||||
?: =(a q.u.i)
|
||||
(^scag +(p.u.i) b)
|
||||
%+ welp
|
||||
(^scag p.u.i b)
|
||||
=+ n=(snag p.u.i b)
|
||||
:_ ~ :- p.n
|
||||
(^scag (sub (snag p.u.i c) (sub q.u.i a)) q.n)
|
||||
--
|
||||
--
|
||||
|
78
lib/elem-to-react-json.hoon
Normal file
78
lib/elem-to-react-json.hoon
Normal file
@ -0,0 +1,78 @@
|
||||
:: Serialize &elem as &json, with special handling for urb:* attributes
|
||||
::
|
||||
:::: /hoon/elem-to-react-json/lib
|
||||
::
|
||||
/? 310
|
||||
|%
|
||||
++ react-attrs :: uppercase mapping
|
||||
~+ ^- (map term cord)
|
||||
%- molt ^- (list (pair term cord))
|
||||
:- [%class 'className']
|
||||
=- (rash - (more next (cook |=(a/tape [(cass a) (crip a)]) (star alf))))
|
||||
'''
|
||||
accept acceptCharset accessKey action allowFullScreen allowTransparency alt
|
||||
async autoComplete autoFocus autoPlay cellPadding cellSpacing charSet checked
|
||||
classID className colSpan cols content contentEditable contextMenu controls
|
||||
coords crossOrigin data dateTime defer dir disabled download draggable encType
|
||||
form formAction formEncType formMethod formNoValidate formTarget frameBorder
|
||||
headers height hidden high href hrefLang htmlFor httpEquiv icon id label lang
|
||||
list loop low manifest marginHeight marginWidth max maxLength media mediaGroup
|
||||
method min multiple muted name noValidate open optimum pattern placeholder
|
||||
poster preload radioGroup readOnly rel required role rowSpan rows sandbox
|
||||
scope scoped scrolling seamless selected shape size sizes span spellCheck
|
||||
src srcDoc srcSet start step style tabIndex target title type useMap value
|
||||
width wmode
|
||||
'''
|
||||
::
|
||||
:: special handling for <pre urb:codemirror>foo</pre>
|
||||
++ urb-codemirror :: render code blocks
|
||||
|= src/manx ^- manx
|
||||
?> ?=({{$pre *} _;/(**) $~} src)
|
||||
;codemirror(value "{v.i.a.g.i.c.src}");
|
||||
::
|
||||
:: special handling for <pre urb:exec>foo</pre>
|
||||
++ urb-exec :: eval inline hoon
|
||||
|= src/manx
|
||||
?> ?=({{$pre *} _;/(**) $~} src) :: verify it's only a text node
|
||||
=* code v.i.a.g.i.c.src
|
||||
=+ =< result=(mule .)
|
||||
!.(|.((slap !>(.) (ream (crip code))))) :: compile and run safely
|
||||
=+ claz=?-(-.result $& "rancode", $| "failedcode")
|
||||
;div(class "{claz}")
|
||||
;pre:"{code}"
|
||||
;+ ?- -.result
|
||||
$& ;code:"{~(ram re (sell p.result))}"
|
||||
$| ;pre
|
||||
;div:"error"
|
||||
;* %+ turn p.result
|
||||
|= a/tank
|
||||
^- manx
|
||||
;div:"{~(ram re a)}"
|
||||
== == ==
|
||||
::
|
||||
++ elem-to-react-json :: serialize DOM as json
|
||||
|= src/manx ^- json
|
||||
?: ?=(_;/(**) src)
|
||||
(jape v.i.a.g.src)
|
||||
=+ atr=(molt `(list (pair mane tape))`a.g.src)
|
||||
?: (~(has by atr) [%urb %codemirror])
|
||||
$(src (urb-codemirror src))
|
||||
?: (~(has by atr) [%urb %exec]) :: runnable code attribute tag
|
||||
$(src (urb-exec src))
|
||||
%- jobe :~
|
||||
c+a+(turn c.src ..$)
|
||||
gn+s+(mane-to-cord n.g.src)
|
||||
=< ga+(jobe (turn a.g.src .))
|
||||
|= {a/mane b/tape} ^- {cord json}
|
||||
:_ (jape b)
|
||||
?^ a (mane-to-cord a)
|
||||
(fall (~(get by react-attrs) a) a)
|
||||
==
|
||||
::
|
||||
++ mane-to-cord :: namespaced xml names
|
||||
|=(a/mane `cord`?@(a a (rap 3 -.a ':' +.a ~)))
|
||||
--
|
||||
::
|
||||
::::
|
||||
::
|
||||
elem-to-react-json :: export conversion gate
|
@ -177,7 +177,7 @@
|
||||
|= {med/meth url/purl qen/quay-enc} ^- tape
|
||||
=. qen (sort qen aor)
|
||||
%- join-urle
|
||||
:~ (trip (cuss (trip `@t`med)))
|
||||
:~ (cuss (trip `@t`med))
|
||||
(earn url)
|
||||
(joint "&" qen)
|
||||
==
|
||||
|
137
lib/react.hoon
137
lib/react.hoon
@ -1,137 +0,0 @@
|
||||
::
|
||||
:::: /hoon/react/lib
|
||||
::
|
||||
/? 310
|
||||
|%
|
||||
++ react-elems :: XX /~
|
||||
~+ %- silt ^- (list term)
|
||||
:~ %a %abbr %address %area %article %aside %audio %b %base
|
||||
%bdi %bdo %big %blockquote %body %br %button %canvas %caption
|
||||
%cite %code %col %colgroup %data %datalist %dd %del %details
|
||||
%dfn %dialog %div %dl %dt %em %embed %fieldset %figcaption
|
||||
%figure %footer %form %h1 %h2 %h3 %h4 %h5 %h6 %head %header
|
||||
%hr %html %i %iframe %img %input %ins %kbd %keygen %label
|
||||
%legend %li %link %main %map %mark %menu %menuitem %meta
|
||||
%meter %nav %noscript %object %ol %optgroup %option %output %p
|
||||
%param %picture %pre %progress %q %rp %rt %ruby %s %samp
|
||||
%script %section %select %small %source %span %strong %style
|
||||
%sub %summary %sup %table %tbody %td %textarea %tfoot %th
|
||||
%thead %time %title %tr %track %u %ul %var %video %wbr
|
||||
%circle %defs %ellipse %g %line %linear-gradient %mask %path
|
||||
%pattern %polygon %polyline %radial-gradient %rect %stop %svg
|
||||
%text %tspan
|
||||
==
|
||||
++ react-attrs
|
||||
~+ ^- (map term cord)
|
||||
%- molt ^- (list (pair term cord))
|
||||
:- [%class 'className']
|
||||
=- (rash - (more next (cook |=(a/tape [(cass a) (crip a)]) (star alf))))
|
||||
'''
|
||||
accept acceptCharset accessKey action allowFullScreen allowTransparency alt
|
||||
async autoComplete autoFocus autoPlay cellPadding cellSpacing charSet checked
|
||||
classID className colSpan cols content contentEditable contextMenu controls
|
||||
coords crossOrigin data dateTime defer dir disabled download draggable encType
|
||||
form formAction formEncType formMethod formNoValidate formTarget frameBorder
|
||||
headers height hidden high href hrefLang htmlFor httpEquiv icon id label lang
|
||||
list loop low manifest marginHeight marginWidth max maxLength media mediaGroup
|
||||
method min multiple muted name noValidate open optimum pattern placeholder
|
||||
poster preload radioGroup readOnly rel required role rowSpan rows sandbox
|
||||
scope scoped scrolling seamless selected shape size sizes span spellCheck
|
||||
src srcDoc srcSet start step style tabIndex target title type useMap value
|
||||
width wmode
|
||||
'''
|
||||
++ react-vale
|
||||
~(has in react-elems)
|
||||
::
|
||||
++ react-to-json
|
||||
|= src/manx ^- json
|
||||
?: ?=(_;/(**) src)
|
||||
(jape v.i.a.g.src)
|
||||
=+ atr=(molt `(list (pair mane tape))`a.g.src)
|
||||
?: (~(has by atr) [%urb %codemirror])
|
||||
?> ?=({{$pre *} _;/(**) $~} src)
|
||||
=. a.g.src
|
||||
[value+v.i.a.g.i.c.src (skip a.g.src |=({a/mane *} ?=(^ a)))]
|
||||
$(src [[%codemirror a.g.src] ~])
|
||||
?: (~(has by atr) [%urb %exec]) :: runnable code attribute tag
|
||||
?> ?=({{$pre *} _;/(**) $~} src) :: verify its only a text node
|
||||
=* code v.i.a.g.i.c.src
|
||||
%_ $
|
||||
src
|
||||
=+ =< result=(mule .)
|
||||
!.(|.((slap !>(.) (ream (crip code))))) :: compile and run safely
|
||||
=+ claz=?:(-.result "rancode" "failedcode")
|
||||
;div(class "{claz}")
|
||||
;pre:"{code}"
|
||||
;+ ?: ?=($& -.result)
|
||||
;code:"{~(ram re (sell p.result))}"
|
||||
;pre
|
||||
;div:"error"
|
||||
;* %+ turn p.result
|
||||
|= a/tank
|
||||
^- manx
|
||||
;div:"{~(ram re a)}"
|
||||
== ==
|
||||
==
|
||||
%- jobe :~
|
||||
c+a+(turn c.src ..$)
|
||||
gn+s+(mane-to-cord n.g.src)
|
||||
=< ga+(jobe (turn a.g.src .))
|
||||
|= {a/mane b/tape} ^- {cord json}
|
||||
:_ (jape b)
|
||||
?^ a (mane-to-cord a)
|
||||
(fall (~(get by react-attrs) a) a)
|
||||
==
|
||||
::
|
||||
++ mane-to-cord |=(a/mane `cord`?@(a a (rap 3 -.a ':' +.a ~)))
|
||||
:: generates React javascript XX deprecated
|
||||
++ react-to-tape
|
||||
|= src/manx ^- tape
|
||||
?: (~(has by (molt `(list (pair mane tape))`a.g.src)) [%urb %codemirror])
|
||||
?> ?=({{$pre *} _;/(**) $~} src)
|
||||
$(src ;codemirror(value "{v.i.a.g.i.c.src}");)
|
||||
?: (~(has by (molt `(list (pair mane tape))`a.g.src)) [%urb %exec])
|
||||
?> ?=({{$pre *} _;/(**) $~} src) :: verify its only a text node
|
||||
=* code v.i.a.g.i.c.src
|
||||
=+ ^= result
|
||||
(mule |.((slap !>(.) (ream (crip code))))) :: compile and run safely
|
||||
?: ?=($.y -.result) :: it was ok
|
||||
=+ ^= new
|
||||
;div(class "rancode")
|
||||
;pre:"{code}"
|
||||
;code:"{~(ram re (sell p.result))}"
|
||||
==
|
||||
$(src new)
|
||||
=+ ^= error
|
||||
;div(class "failedcode")
|
||||
;pre:"{code}"
|
||||
;pre
|
||||
;div:"error"
|
||||
;* %+ turn
|
||||
(scag (dec (lent p.result)) p.result) :: hide react trace
|
||||
|= a/tank
|
||||
^- manx
|
||||
;div:"{~(ram re a)}"
|
||||
==
|
||||
==
|
||||
$(src error)
|
||||
;: weld
|
||||
"React.createElement("
|
||||
?^ n.g.src !! :: namespaces unsupported
|
||||
?: (react-vale n.g.src)
|
||||
"'{(trip n.g.src)}'"
|
||||
(trip n.g.src)
|
||||
", "
|
||||
=- (pojo (jobe (turn a.g.src -)))
|
||||
|= {a/mane b/tape}
|
||||
=. a ?+(a a $class 'className')
|
||||
?^(a !! [a (jape b)])
|
||||
", "
|
||||
=< ~(ram re %rose [", " "[" "]"] (turn c.src .))
|
||||
|= a/manx
|
||||
?: ?=(_;/(**) a)
|
||||
leaf+(pojo (jape v.i.a.g.a))
|
||||
leaf+^$(src a)
|
||||
")"
|
||||
==
|
||||
--
|
@ -2,7 +2,7 @@
|
||||
:::: /hoon/comments/tree/mar
|
||||
::
|
||||
/? 310
|
||||
/+ react, time-to-id
|
||||
/+ elem-to-react-json, time-to-id
|
||||
!:
|
||||
::::
|
||||
::
|
||||
@ -16,7 +16,7 @@
|
||||
(sort all |=({a/* b/*} (lor b a)))
|
||||
|= {a/time b/ship c/marl} ^- ^json
|
||||
=+ bod=[[%div id+(time-to-id a) ~] c]
|
||||
(jobe time+(jode a) user+(jape +:<b>) body+(react-to-json:react bod) ~)
|
||||
(jobe time+(jode a) user+(jape +:<b>) body+(elem-to-react-json bod) ~)
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
++ noun (list {time manx}) :: clam from %noun
|
||||
|
@ -2,8 +2,8 @@
|
||||
:::: /hoon/index/tree/mar
|
||||
::
|
||||
/? 310
|
||||
/+ tree,react,map-to-json
|
||||
[. tree react]
|
||||
/+ tree,map-to-json,elem-to-react-json
|
||||
[. tree]
|
||||
!:
|
||||
::::
|
||||
::
|
||||
@ -15,7 +15,7 @@
|
||||
%. all
|
||||
%+ map-to-json
|
||||
|=(a/path (crip (spud a)))
|
||||
|=(a/marl [%a (turn a react-to-json)])
|
||||
|=(a/marl [%a (turn a elem-to-react-json)])
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
++ noun (map path marl) :: clam from %noun
|
||||
|
@ -3,7 +3,7 @@
|
||||
::
|
||||
/? 310
|
||||
/- tree-include
|
||||
/+ react
|
||||
/+ elem-to-react-json
|
||||
/= mime /mime/
|
||||
/= body /tree-elem/
|
||||
/= sect /&json&/tree-index/
|
||||
@ -15,7 +15,7 @@
|
||||
/tree-comments/
|
||||
!:
|
||||
^- tree-include
|
||||
=+ rj=react-to-json:react
|
||||
=* rj elem-to-react-json
|
||||
:* mime
|
||||
(rj body)
|
||||
(rj /h1 hed.snip) :: head
|
||||
|
@ -15,8 +15,6 @@
|
||||
|= gas/epic ^- {? ?} :: check if the query
|
||||
:- (~(has by qix.gas) 'dbg.nopack') :: dictates separate files
|
||||
(~(has by qix.gas) 'dbg.nomin') :: and/or unminified assets
|
||||
/= extras /: /===/ren/tree/head/extras :: additional scripts
|
||||
/^ (map knot cord) /_ /js/
|
||||
::
|
||||
|%
|
||||
++ cdnjs
|
||||
@ -47,7 +45,6 @@
|
||||
;script(type "text/javascript", src "{(cdnjs "react/0.14.6/react")}");
|
||||
;script(type "text/javascript", src "{(cdnjs "react/0.14.6/react-dom")}");
|
||||
;script(type "text/javascript", src "{(cdnjs "flux/2.1.1/Flux")}");
|
||||
;* (turn (~(tap by extras)) |=({@ a/@t} ;script(type "text/javascript"):"{(trip a)}"))
|
||||
:: ;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/codemirror/4.3.0/codemirror.js");
|
||||
:: ;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/".
|
||||
:: "codemirror/4.3.0/mode/markdown/markdown.min.js");
|
||||
|
@ -28,6 +28,7 @@
|
||||
{$clr $~} :: clear screen
|
||||
{$det sole-change} :: edit command
|
||||
{$err p/@ud} :: error point
|
||||
{$klr p/styx} :: styled text line
|
||||
{$mor p/(list sole-effect)} :: multiple effects
|
||||
{$nex $~} :: save clear command
|
||||
{$pro sole-prompt} :: set prompt
|
||||
@ -45,7 +46,7 @@
|
||||
++ sole-prompt :: prompt definition
|
||||
$: vis/? :: command visible
|
||||
tag/term :: history mode
|
||||
cad/tape :: caption
|
||||
cad/styx :: caption
|
||||
== ::
|
||||
++ sole-share :: symmetric state
|
||||
$: ven/sole-clock :: our vector clock
|
||||
|
Loading…
Reference in New Issue
Block a user