Merge branch 'dillbo' of https://github.com/urbit/urbit into dillbo

This commit is contained in:
C. Guy Yarvin 2015-04-07 15:12:44 -07:00
commit b81d2891e2
12 changed files with 292 additions and 63 deletions

View File

@ -149,7 +149,7 @@
[%mess p=hasp q=mark r=wire s=json]
[%poll p=@uvH]
[%spur p=spur]
[%subs p=?(%put %delt) q=[p=hasp %json q=path]]
[%subs p=?(%put %delt) q=[hasp %json wire path]]
[%view p=ixor q=[~ u=@ud]]
==
::
@ -468,7 +468,10 @@
=. our ?~(hov our u.hov) :: XX
?- &2.sih
%crud +>.$(mow [[hen %slip %d %flog +.sih] mow])
%dumb (emule |.(~|(%gall-stub !!)))
%dumb
=. +> ?+(tee +> [%of ^] pop-duct:(ire-ix p.tee))
(emule |.(~|(gall-dumb/tee !!)))
::
%went +>.$
%thou
?> ?=([%ay ^] tee)
@ -783,7 +786,8 @@
::
%to
?> =('/' (need-body (ot wire/so ~):jo)) :: XX custom
=- [%mess [- +<]:dir +>.dir / (need-body (ot:jo xyro/some ~))]
=- :^ %mess [- +<]:dir +>.dir
(need-body (ot wire/(cu stab so) xyro/some ~):jo)
^= dir
=+ ful=(read but %p %tas %tas ~)
?^ ful u.ful
@ -805,7 +809,9 @@
?: ((sane %tas) i.but)
$(but [(scot %p our) but])
?> ?=(?(%delt %put) mef)
[%subs mef [(slav %p i.but) (slav %tas -.t.but)] u.p.pok +.t.but]
=+ :- hap=[(slav %p i.but) (slav %tas -.t.but)]
wir=(need-body (ot wire/(cu stab so) ~):jo)
[%subs mef hap u.p.pok wir +.t.but]
::
%auth
:- %auth
@ -876,8 +882,6 @@
[%& %js (add-json (joba %poll (jape polling-url)) poll:js)]
::
%subs
?> =((spud q.q.hem) (trip (need-body (ot wire/so ~):jo)))
:: XX custom wire
?- p.hem
%put [%| ((teba add-subs:for-view) q.hem)]
%delt [%| ((teba del-subs:for-view) q.hem)]
@ -1084,11 +1088,11 @@
(hurl-note [a b] [%g %mess [- + ~]:a him c])
::
++ add-subs
|= [a=hasp %json b=path] ^+ ..ix
(hurl-note [a b] [%g %show [- + ~]:a him b])
|= [a=hasp %json b=wire c=path] ^+ ..ix
(hurl-note [a b] [%g %show [- + ~]:a him c])
::
++ del-subs
|= [a=hasp %json b=path] ^+ ..ix
++ del-subs :: XX per path?
|= [a=hasp %json b=wire c=path] ^+ ..ix
(hurl-note [a b] [%g %nuke [- + ~]:a him])
::
++ get-rush
@ -1101,13 +1105,11 @@
%mean
?~ p.b :: XX actually a yawn-told-full
(get-even %mean [[(slav %p p.a) q.a] r.a] p.b)
=^ ned med ~(get to med)
(mean-json:abet(hen ned) 500 p.b)
(mean-json:pop-duct 500 p.b)
::
%nice
?: =(~ med) ~& resp-lost/ire ..ix
=^ ned med ~(get to med)
(nice-json:abet(hen ned))
(nice-json:pop-duct)
==
::
++ get-even
@ -1137,6 +1139,7 @@
|= a=[p=hasp wire]
(pass-note(hen `~) [%of ire (gsig a)] [%g %took [- + ~]:p.a him])
::
++ pop-duct =^(ned med ~(get to med) abet(hen ned))
++ poll
|= a=@u ^+ ..ix
?: =(a p.eve)

142
main/lib/console/core.hook Normal file
View File

@ -0,0 +1,142 @@
::
:::: /hook/core/console/lib
::
:: This file is in the public domain.
::
/? 310
/- *console
!:
::::
::
|%
++ cs :: shared-state engine
|_ console-share
++ abet +<
++ apply
|= ted=console-edit
^+ +>
?- -.ted
%del +>.$(buf (weld (scag p.ted buf) (slag +(p.ted) buf)))
%ins +>.$(buf (weld (scag p.ted buf) `_buf`[q.ted (slag p.ted buf)]))
%mor |- ^+ +>.^$
?~ p.ted
+>.^$
$(p.ted t.p.ted, +>.^$ ^$(ted i.p.ted))
%nop +>.$
%set +>.$(buf p.ted)
==
::
::::
:: ++transmute: symmetric operational transformation.
::
:: for any console state +>, obeys
::
:: =+ [x=(transmute a b) y=(transmute b a)]
:: .= (apply:(apply b) x)
:: (apply:(apply a) y)
::
++ transmute :: dex as after sin
|= [sin=console-edit dex=console-edit]
^- console-edit
?: ?=(%mor -.sin)
|- ^- console-edit
?~ p.sin dex
$(p.sin t.p.sin, dex ^$(sin i.p.sin))
::
?: ?=(%mor -.dex)
:- %mor
|- ^- (list console-edit)
?~ p.dex ~
[^$(dex i.p.dex) $(p.dex t.p.dex)]
::
?: |(?=(%nop -.sin) ?=(%nop -.dex)) dex
?: ?=(%set -.sin) [%nop ~]
?: ?=(%set -.dex) dex
::
?- -.sin
%del
?- -.dex
%del ?: =(p.sin p.dex) [%nop ~]
?:((lth p.sin p.dex) dex(p (dec p.dex)) dex)
%ins ?:((lte p.sin p.dex) dex(p (dec p.dex)) dex)
==
::
%ins
?- -.dex
%del ?:((lte p.sin p.dex) dex(p +(p.dex)) dex)
%ins ?: =(p.sin p.dex)
?:((gth q.sin q.dex) dex dex(p +(p.dex)))
?:((lte p.sin p.dex) dex(p +(p.dex)) dex)
==
==
::
++ commit :: local change
|= ted=console-edit
^- console-share
abet:(apply(own.ven +(own.ven), leg [ted leg]) ted)
::
::::
:: ++inverse: inverse of change in context.
::
:: for any console state +>, obeys
::
:: =(+> (apply:(apply a) (inverse a)))
::
++ inverse :: relative inverse
|= ted=console-edit
^- console-edit
=. ted ?.(?=([%mor * ~] ted) ted i.p.ted)
?- -.ted
%del [%ins p.ted (snag p.ted buf)]
%ins [%del p.ted]
%mor :- %mor
%- flop
|- ^- (list console-edit)
?~ p.ted ~
:- ^$(ted i.p.ted)
$(p.ted t.p.ted, +>.^$ (apply i.p.ted))
%nop [%nop ~]
%set [%set buf]
==
::
++ receive :: naturalize event
|= console-change
^- [console-edit console-share]
?> &(=(his.ler his.ven) (lte own.ler own.ven))
?> &(=(his.ler his.ven) (lte own.ler own.ven))
?> |(!=(own.ler own.ven) =(haw (sham buf)))
=. leg (scag (sub own.ven own.ler) leg)
:: ~? !=(own.ler own.ven) [%miss-leg leg]
=+ dat=(transmute [%mor leg] ted)
:: ~? !=(~ leg) [%transmute from/ted to/dat ~]
[dat abet:(apply(his.ven +(his.ven)) dat)]
::
++ remit :: conditional accept
|= [cal=console-change ask=$+((list ,@c) ?)]
^- [(unit console-change) console-share]
=+ old=buf
=^ dat +>+<.$ (receive cal)
?: (ask buf)
[~ +>+<.$]
=^ lic +>+<.$ (transmit (inverse(buf old) dat))
[`lic +>+<.$]
::
++ transmit :: outgoing change
|= ted=console-edit
^- [console-change console-share]
[[[his.ven own.ven] (sham buf) ted] (commit ted)]
::
++ transceive :: receive and invert
|= console-change
^- [console-edit console-share]
=+ old=buf
=^ dat +>+<.$ (receive +<.$)
[(inverse(buf old) dat) +>+<.$]
::
++ transpose :: adjust position
|= pos=@ud
=+ dat=(transmute [%mor leg] [%ins pos `@c`0])
?> ?=(%ins -.dat)
p.dat
--
--

3
main/lib/shu/core.hook Normal file
View File

@ -0,0 +1,3 @@
:: Alias
/+ sh-utils
.

View File

@ -103,6 +103,8 @@ window.urb.poll = function(params) {
return document.location.reload() // XX check autoreload
case "rush":
case "mean":
if(res.data.type == "mean")
err = res.data.data
var fn = $this.gsig(res.data.from)
if($this.cabs[fn])
$this.cabs[fn].call(this,err,

View File

@ -107,8 +107,13 @@ body {
.time {
font-size: 0.6rem;
letter-spacing: 0;
}
.time {
font-weight: 200;
}
#length {
font-weight: 500;
}
input.join,
.iden,
.audi,
@ -400,7 +405,7 @@ body {
outline: none;
overflow: hidden;
}
#audi.valid-false {
.valid-false {
color: #ff2f2f;
}
#scrolling {
@ -432,6 +437,17 @@ body {
}
}
@media only screen and (max-width: 1170px) {
#station-container.open {
max-height: 30rem;
height: auto;
-webkit-transition: max-height 0.2s;
}
#station-container.open #where .caret {
transform: rotate(90deg);
transform-origin: 0 50%;
-webkit-transform: rotate(90deg);
-webkit-transition: -webkit-transform 0.2s;
}
#c,
#station-container {
width: 96%;

View File

@ -29,8 +29,13 @@ body
.time
font-size .6rem
letter-spacing 0
.time
font-weight 200
#length
font-weight 500
input.join
.iden
.audi
@ -343,7 +348,7 @@ body
outline none
overflow hidden
#audi.valid-false
.valid-false
color #ff2f2f
//

View File

@ -13,6 +13,17 @@
/* laptops / small screens ----------- */
@media only screen and (max-width: 1170px)
#station-container.open
max-height 30rem
height auto
-webkit-transition max-height .2s
#station-container.open #where .caret
transform rotate(90deg)
transform-origin 0 50%
-webkit-transform rotate(90deg)
-webkit-transition -webkit-transform .2s
#c
#station-container
width 96%

View File

@ -23,11 +23,6 @@ module.exports = recl
valid:StationStore.getValidAudience()
s.audi = _.without s.audi, window.util.mainStationPath window.urb.user
s.ludi = _.without s.ludi, window.util.mainStationPath window.urb.user
console.log 'set'
console.log s.audi
console.log s.ludi
s
getInitialState: -> @stateFromStore()
@ -68,10 +63,16 @@ module.exports = recl
,0
return false
_writingKeyUp: (e) ->
txt = @$writing.text()
@$length.toggleClass('valid-false',(txt.length > 62))
_writingKeyDown: (e) ->
if e.keyCode is 13
txt = @$writing.text()
e.preventDefault()
@sendMessage()
if txt.length > 0 and txt.length < 63
@sendMessage()
return false
@_input()
@set()
@ -85,12 +86,7 @@ module.exports = recl
for url in urls
length -= url.length
length += 10
@$length.text "#{length}/69"
if length >= 69
@$writing.text(@$writing.text().substr(0,69))
@cursorAtEnd()
e.preventDefault() if e
return false
@$length.text "#{length}/62"
_setFocus: -> @$writing.focus()
@ -173,9 +169,6 @@ module.exports = recl
audi = if @state.audi.length is 0 then @state.ludi else @state.audi
audi = window.util.clipAudi audi
console.log 'audi'
console.log audi
k = "writing"
div {className:k}, [
@ -198,6 +191,7 @@ module.exports = recl
onInput: @_input
onPaste: @_input
onKeyDown: @_writingKeyDown
onKeyUp: @_writingKeyUp
onFocus: @cursorAtEnd
}, "")
div {id:"length"}, "0/69"

View File

@ -601,9 +601,6 @@ module.exports = recl({
};
s.audi = _.without(s.audi, window.util.mainStationPath(window.urb.user));
s.ludi = _.without(s.ludi, window.util.mainStationPath(window.urb.user));
console.log('set');
console.log(s.audi);
console.log(s.ludi);
return s;
},
getInitialState: function() {
@ -650,10 +647,19 @@ module.exports = recl({
return false;
}
},
_writingKeyUp: function(e) {
var txt;
txt = this.$writing.text();
return this.$length.toggleClass('valid-false', txt.length > 62);
},
_writingKeyDown: function(e) {
var txt;
if (e.keyCode === 13) {
txt = this.$writing.text();
e.preventDefault();
this.sendMessage();
if (txt.length > 0 && txt.length < 63) {
this.sendMessage();
}
return false;
}
this._input();
@ -672,15 +678,7 @@ module.exports = recl({
length += 10;
}
}
this.$length.text(length + "/69");
if (length >= 69) {
this.$writing.text(this.$writing.text().substr(0, 69));
this.cursorAtEnd();
if (e) {
e.preventDefault();
}
return false;
}
return this.$length.text(length + "/62");
},
_setFocus: function() {
return this.$writing.focus();
@ -781,8 +779,6 @@ module.exports = recl({
name = iden ? iden.name : "";
audi = this.state.audi.length === 0 ? this.state.ludi : this.state.audi;
audi = window.util.clipAudi(audi);
console.log('audi');
console.log(audi);
k = "writing";
return div({
className: k
@ -807,6 +803,7 @@ module.exports = recl({
onInput: this._input,
onPaste: this._input,
onKeyDown: this._writingKeyDown,
onKeyUp: this._writingKeyUp,
onFocus: this.cursorAtEnd
}, ""), div({
id: "length"
@ -5423,12 +5420,23 @@ MessageActions = require('../actions/MessageActions.coffee');
module.exports = {
listenStation: function(station, since) {
var $this;
$this = this;
console.log('listen station');
console.log(arguments);
return window.urb.subscribe({
appl: "talk",
path: "/f/" + station + "/" + since
}, function(err, res) {
var ref, ref1;
console.log('m subscription updates');
if (err || !res.data) {
console.log('/f/ err!');
console.log(err);
console.log(res);
$this.listenStation(station, since);
return;
}
console.log('/f/');
console.log(res.data);
if (res.data.ok === true) {
MessageActions.listeningStation(station);
@ -5444,7 +5452,12 @@ module.exports = {
path: "/f/" + station + "/" + end + "/" + start
}, function(err, res) {
var ref, ref1;
console.log('get');
if (err || !res.data) {
console.log('/f/ /e/s err');
console.log(err);
return;
}
console.log('/f/ /e/s');
console.log(res);
if ((ref = res.data) != null ? (ref1 = ref.grams) != null ? ref1.tele : void 0 : void 0) {
MessageActions.loadMessages(res.data.grams, true);
@ -5534,7 +5547,7 @@ module.exports = {
}
};
return window.urb.send(send, function(err, res) {
console.log('add source updates');
console.log('talk-command');
return console.log(arguments);
});
},
@ -5544,7 +5557,12 @@ module.exports = {
path: "/a/court"
}, function(err, res) {
var ref, ref1;
console.log('membership updates');
if (err || !res) {
console.log('/a/ err');
console.log(err);
return;
}
console.log('/a/');
console.log(res.data);
if ((ref = res.data) != null ? (ref1 = ref.group) != null ? ref1.global : void 0 : void 0) {
return StationActions.loadMembers(res.data.group.global);
@ -5556,7 +5574,12 @@ module.exports = {
appl: "talk",
path: "/"
}, function(err, res) {
console.log('house updates');
if (err || !res.data) {
console.log('/ err');
console.log(err);
return;
}
console.log('/');
console.log(res.data);
if (res.data.house) {
return StationActions.loadStations(res.data.house);
@ -5569,7 +5592,12 @@ module.exports = {
path: "/ax/" + station
}, function(err, res) {
var ref;
console.log('station subscription updates');
if (err || !res) {
console.log('/ax/ err');
console.log(err);
return;
}
console.log('/ax/');
console.log(res.data);
if (res.data.ok === true) {
StationActions.listeningStation(station);

View File

@ -2,11 +2,20 @@ MessageActions = require '../actions/MessageActions.coffee'
module.exports =
listenStation: (station,since) ->
$this = this
console.log 'listen station'
console.log arguments
window.urb.subscribe {
appl:"talk"
path:"/f/#{station}/#{since}"
}, (err,res) ->
console.log('m subscription updates')
if err or not res.data
console.log '/f/ err!'
console.log err
console.log res
$this.listenStation station,since
return
console.log('/f/')
console.log(res.data)
if res.data.ok is true
MessageActions.listeningStation station
@ -18,7 +27,11 @@ module.exports =
appl:"talk"
path:"/f/#{station}/#{end}/#{start}"
}, (err,res) ->
console.log 'get'
if err or not res.data
console.log '/f/ /e/s err'
console.log err
return
console.log '/f/ /e/s'
console.log res
if res.data?.grams?.tele
MessageActions.loadMessages res.data.grams,true

View File

@ -36,7 +36,7 @@ module.exports =
caption:""
cordon:{posture:"white", list:[]}
window.urb.send send, (err,res) ->
console.log 'add source updates'
console.log 'talk-command'
console.log arguments
members: ->
@ -44,7 +44,11 @@ module.exports =
appl:"talk"
path:"/a/court"
}, (err,res) ->
console.log 'membership updates'
if err or not res
console.log '/a/ err'
console.log err
return
console.log '/a/'
console.log res.data
if res.data?.group?.global
StationActions.loadMembers res.data.group.global
@ -54,7 +58,11 @@ module.exports =
appl:"talk"
path:"/"
}, (err,res) ->
console.log 'house updates'
if err or not res.data
console.log '/ err'
console.log err
return
console.log '/'
console.log res.data
if res.data.house
StationActions.loadStations res.data.house
@ -64,7 +72,11 @@ module.exports =
appl:"talk"
path:"/ax/#{station}"
}, (err,res) ->
console.log('station subscription updates')
if err or not res
console.log '/ax/ err'
console.log err
return
console.log('/ax/')
console.log(res.data)
if res.data.ok is true
StationActions.listeningStation station

View File

@ -37,10 +37,10 @@
$% [%twitter p=@t] :: twitter
== ::
++ posture :: security posture
$? %black :: channel
%white :: village
%green :: journal
%brown :: mailbox
$? %black :: public
%white :: private
%green :: readonly
%brown :: writeonly
== ::
++ presence ?(%gone %hear %talk) :: status type
++ register (pair atlas (map partner atlas)) :: ping me, ping srcs