Merge remote-tracking branches 'dhaffey/time', 'joemfb/meta-dot', 'ohaitch/lens-whitespace', 'Fang/bsp-clear-change' and 'galenwp/details'

:time app, measures time between poke and subsequent wakeup
fixes meta-. to capture to whitespace instead of by word
permit whitespace in urb.py -d
change "backspace at start of line" to "backspace on empty line" for clear
tree@db321b0 and talk@11013ec
This commit is contained in:
Raymond Pasco 2016-08-10 15:08:53 -07:00
7 changed files with 164 additions and 153 deletions

View File

@ -1000,7 +1000,10 @@
:- num :- num
?- -.source.com ?- -.source.com
$data [%ex %sand %t data.source.com] $data [%ex %sand %t data.source.com]
$dojo (rash command.source.com dp-build:dp) $dojo
%+ rash command.source.com
(ifix [(punt gap) (punt gap)] dp-build:dp)
::
$clay $clay
:- %ex :- %ex
:* %wish :* %wish

19
app/time.hoon Normal file
View File

@ -0,0 +1,19 @@
::
:::: /hoon/time/app
::
/? 310
|%
++ card {$wait wire @da}
--
|_ {bowl $~}
++ poke-noun
|= *
:_ +>.$ :_ ~
[ost %wait /(scot %da now) +(now)]
::
++ wake
|= {wir/wire $~}
?> ?=({@ $~} wir)
~& [%took `@dr`(sub now (slav %da i.wir))]
[~ +>.$]
--

View File

@ -617,8 +617,10 @@
ta-bel ta-bel
.(str.u.ris (scag (dec (lent str.u.ris)) str.u.ris)) .(str.u.ris (scag (dec (lent str.u.ris)) str.u.ris))
?: =(0 pos.inp) ?: =(0 pos.inp)
(ta-act %clr ~) ?: =(0 (lent buf.say.inp))
:: .(+> (se-blit %bel ~)) (ta-act %clr ~)
:: .(+> (se-blit %bel ~))
ta-bel
=+ pre=(dec pos.inp) =+ pre=(dec pos.inp)
(ta-hom %del pre) (ta-hom %del pre)
:: ::
@ -848,9 +850,9 @@
$dot ?. &(?=(^ old.hit) ?=(^ -.old.hit)) $dot ?. &(?=(^ old.hit) ?=(^ -.old.hit))
ta-bel ta-bel
=+ old=`(list @c)`-.old.hit =+ old=`(list @c)`-.old.hit
=+ b=(bwrd (lent old) old nedg) =+ b=(bwrd (lent old) old nace)
%- ta-hom(ris ~) %- ta-hom(ris ~)
(ta-cat pos.inp (slag b old)) (ta-cat pos.inp (slag (add b =(0 b)) old))
:: ::
$bac ?: =(0 pos.inp) $bac ?: =(0 pos.inp)
ta-bel ta-bel

View File

@ -51,6 +51,10 @@ div.input.valid-false {
.grams .meta:hover { .grams .meta:hover {
overflow: visible; } overflow: visible; }
.gram:hover {
z-index: 2;
position: relative; }
div.gram.first:first-of-type { div.gram.first:first-of-type {
margin-top: 0; } margin-top: 0; }
@ -242,6 +246,7 @@ input.action:focus:-ms-input-placeholder {
.length { .length {
display: inline-block; display: inline-block;
width: 120px;
margin-left: 2rem; margin-left: 2rem;
line-height: 2rem; line-height: 2rem;
font-family: 'bau'; font-family: 'bau';

View File

@ -286,8 +286,8 @@ ref = React.DOM, div = ref.div, input = ref.input, textarea = ref.textarea;
module.exports = recl({ module.exports = recl({
displayName: "Member", displayName: "Member",
render: function() { render: function() {
var k, ship; var k, ref1, ship;
ship = this.props.ship; ship = (ref1 = this.props.ship) != null ? ref1 : "";
k = "ship"; k = "ship";
if (this.props.presence) { if (this.props.presence) {
k += " " + this.props.presence; k += " " + this.props.presence;

View File

@ -1319,6 +1319,11 @@ ol > li:before {
line-height: 1rem; line-height: 1rem;
margin-bottom: 1rem; } margin-bottom: 1rem; }
@media (max-width: 767px) {
.urbit .post h1.title,
.urbit .post img {
max-width: 100%; } }
.urbit.post .person { .urbit.post .person {
margin-bottom: 2rem; } margin-bottom: 2rem; }
.urbit.post .person:first-of-type { .urbit.post .person:first-of-type {
@ -1341,6 +1346,11 @@ ol > li:before {
.urbit .post img { .urbit .post img {
max-width: 32rem; } max-width: 32rem; }
@media (max-width: 767px) {
.urbit .post img {
max-width: 100%;
border-width: 6px; } }
.urbit.post .preview { .urbit.post .preview {
display: none; } display: none; }

View File

@ -1,5 +1,5 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var TreeDispatcher, TreePersistence, _initialLoad; var TreeDispatcher, TreePersistence, _initialLoad, _initialLoadDedup;
TreeDispatcher = require('../dispatcher/Dispatcher.coffee'); TreeDispatcher = require('../dispatcher/Dispatcher.coffee');
@ -7,6 +7,8 @@ TreePersistence = require('../persistence/TreePersistence.coffee');
_initialLoad = true; _initialLoad = true;
_initialLoadDedup = {};
module.exports = { module.exports = {
loadPath: function(path, data) { loadPath: function(path, data) {
return TreeDispatcher.handleServerAction({ return TreeDispatcher.handleServerAction({
@ -24,17 +26,23 @@ module.exports = {
}, },
clearData: function() { clearData: function() {
_initialLoad = false; _initialLoad = false;
_initialLoadDedup = {};
TreePersistence.refresh(); TreePersistence.refresh();
return TreeDispatcher.handleServerAction({ return TreeDispatcher.handleServerAction({
type: "clearData" type: "clearData"
}); });
}, },
sendQuery: function(path, query) { sendQuery: function(path, query) {
var key;
if (query == null) { if (query == null) {
return; return;
} }
if (_initialLoad) { if (_initialLoad) {
console.warn("Requesting data druing initial page load", JSON.stringify(path), query); key = path + (JSON.stringify(query));
if (!_initialLoadDedup[key]) {
_initialLoadDedup[key] = true;
console.warn("Requesting data during initial page load", JSON.stringify(path), query);
}
} }
if (path.slice(-1) === "/") { if (path.slice(-1) === "/") {
path = path.slice(0, -1); path = path.slice(0, -1);
@ -104,7 +112,7 @@ module.exports = {
}, },
setCurr: function(path, init) { setCurr: function(path, init) {
if (init == null) { if (init == null) {
init = true; init = false;
} }
_initialLoad &= init; _initialLoad &= init;
return TreeDispatcher.handleViewAction({ return TreeDispatcher.handleViewAction({
@ -915,10 +923,12 @@ module.exports = name("ImagePanel", function(arg) {
},{}],10:[function(require,module,exports){ },{}],10:[function(require,module,exports){
var a, clas, div, hr, li, query, reactify, recl, ref, ul; var a, clas, div, hr, li, query, reactify, recl, ref, ul, util;
clas = require('classnames'); clas = require('classnames');
util = require('../utils/util.coffee');
reactify = require('./Reactify.coffee'); reactify = require('./Reactify.coffee');
query = require('./Async.coffee'); query = require('./Async.coffee');
@ -929,6 +939,8 @@ ref = React.DOM, div = ref.div, a = ref.a, ul = ref.ul, li = ref.li, hr = ref.hr
module.exports = query({ module.exports = query({
kids: { kids: {
name: 't',
bump: 't',
body: 'r', body: 'r',
meta: 'j', meta: 'j',
path: 't' path: 't'
@ -936,44 +948,8 @@ module.exports = query({
}, recl({ }, recl({
displayName: "Kids", displayName: "Kids",
render: function() { render: function() {
var _k, body, d, elem, k, keyed, keys, kidClas, kidsClas, ref1, ref2, ref3, ref4, sorted, str, v; var body, elem, kidClas, kids, kidsClas;
sorted = true; kids = util.sortKids(this.props.kids, this.props.sortBy);
keyed = {};
ref1 = this.props.kids;
for (k in ref1) {
v = ref1[k];
if (this.props.sortBy) {
if (this.props.sortBy === 'date') {
if (((ref2 = v.meta) != null ? ref2.date : void 0) == null) {
sorted = false;
continue;
}
d = v.meta.date.slice(1).split(".");
if (d.length < 3) {
sorted = false;
continue;
}
str = d[0] + "-" + d[1] + "-" + d[2];
if (d.length > 3) {
str += " " + d[3] + ":" + d[4] + ":" + d[5];
}
_k = Number(new Date(str));
keyed[_k] = k;
}
} else {
if (((ref3 = v.meta) != null ? ref3.sort : void 0) == null) {
sorted = false;
}
keyed[Number((ref4 = v.meta) != null ? ref4.sort : void 0)] = k;
}
}
if (sorted === false) {
keyed = _.keys(this.props.kids);
}
keys = _.keys(keyed).sort();
if (this.props.sortBy === 'date') {
keys.reverse();
}
kidsClas = clas({ kidsClas = clas({
kids: true kids: true
}, this.props.className); }, this.props.className);
@ -984,29 +960,28 @@ module.exports = query({
className: kidsClas, className: kidsClas,
key: "kids" key: "kids"
}, (function() { }, (function() {
var i, len, ref5, results; var i, len, results;
results = []; results = [];
for (i = 0, len = keys.length; i < len; i++) { for (i = 0, len = kids.length; i < len; i++) {
k = keys[i]; elem = kids[i];
elem = (ref5 = this.props.kids[keyed[k]]) != null ? ref5 : ""; body = reactify(elem.body, null, {
body = reactify(elem.body, k, {
basePath: elem.path basePath: elem.path
}); });
results.push([ results.push([
div({ div({
key: keyed[k], key: elem.name,
id: keyed[k], id: elem.name,
className: kidClas className: kidClas
}, body), hr({}) }, body), hr({})
]); ]);
} }
return results; return results;
}).call(this)); })());
} }
})); }));
},{"./Async.coffee":2,"./Reactify.coffee":18,"classnames":31}],11:[function(require,module,exports){ },{"../utils/util.coffee":30,"./Async.coffee":2,"./Reactify.coffee":18,"classnames":31}],11:[function(require,module,exports){
var a, clas, div, h1, li, pre, query, reactify, recl, ref, span, ul, util; var a, clas, div, h1, li, pre, query, reactify, recl, ref, span, ul, util;
clas = require('classnames'); clas = require('classnames');
@ -1039,7 +1014,7 @@ module.exports = query({
}, this.props.dataType, { }, this.props.dataType, {
"default": this.props['data-source'] === 'default' "default": this.props['data-source'] === 'default'
}, this.props.className); }, this.props.className);
kids = this.renderList(this.sortedKids()); kids = this.renderList(util.sortKids(this.props.kids, this.props.sortBy));
if (!(kids.length === 0 && (this.props.is404 != null))) { if (!(kids.length === 0 && (this.props.is404 != null))) {
return ul({ return ul({
className: k className: k
@ -1051,48 +1026,15 @@ module.exports = query({
className: 'red inverse block error' className: 'red inverse block error'
}, 'Error: Empty path'), div({}, pre({}, this.props.path), span({}, 'is either empty or does not exist.'))); }, 'Error: Empty path'), div({}, pre({}, this.props.path), span({}, 'is either empty or does not exist.')));
}, },
sortedKids: function() {
var _k, _keys, k, ref1, ref2, ref3, ref4, sorted, v;
if (this.props.sortBy === 'bump') {
return _.sortBy(this.props.kids, function(arg) {
var bump, name;
bump = arg.bump, name = arg.name;
return bump || name;
}).reverse();
}
sorted = true;
_keys = [];
ref1 = this.props.kids;
for (k in ref1) {
v = ref1[k];
if (this.props.sortBy) {
if (this.props.sortBy === 'date') {
if (((ref2 = v.meta) != null ? ref2.date : void 0) == null) {
return _.keys(this.props.kids).sort();
}
_k = Number(v.meta.date.slice(1).replace(/\./g, ""));
_keys[_k] = k;
}
} else {
if (((ref3 = v.meta) != null ? ref3.sort : void 0) == null) {
return _.keys(this.props.kids).sort();
}
_keys[Number((ref4 = v.meta) != null ? ref4.sort : void 0)] = k;
}
}
if (this.props.sortBy === 'date') {
_keys.reverse();
}
return _.values(_keys);
},
renderList: function(elems) { renderList: function(elems) {
var _date, author, cont, date, elem, href, i, image, item, len, linked, node, parts, path, preview, ref1, results, title; var _date, author, cont, date, elem, href, i, image, item, len, linked, meta, node, parts, path, preview, ref1, results, title;
results = []; results = [];
for (i = 0, len = elems.length; i < len; i++) { for (i = 0, len = elems.length; i < len; i++) {
elem = elems[i]; elem = elems[i];
item = elem.name; item = elem.name;
meta = (ref1 = elem.meta) != null ? ref1 : {};
path = this.props.path + "/" + item; path = this.props.path + "/" + item;
if (elem.meta.hide != null) { if (meta.hide != null) {
continue; continue;
} }
href = util.basepath(path); href = util.basepath(path);
@ -1102,12 +1044,12 @@ module.exports = query({
if (this.props.childIsFragment != null) { if (this.props.childIsFragment != null) {
href = (util.basepath(this.props.path)) + "#" + item; href = (util.basepath(this.props.path)) + "#" + item;
} }
if (elem.meta.link) { if (meta.link) {
href = elem.meta.link; href = meta.link;
} }
parts = []; parts = [];
title = null; title = null;
if ((ref1 = elem.meta) != null ? ref1.title : void 0) { if (meta.title) {
if (this.props.dataType === 'post') { if (this.props.dataType === 'post') {
title = { title = {
gn: 'a', gn: 'a',
@ -1120,7 +1062,7 @@ module.exports = query({
ga: { ga: {
className: 'title' className: 'title'
}, },
c: [elem.meta.title] c: [meta.title]
} }
] ]
}; };
@ -1130,7 +1072,7 @@ module.exports = query({
ga: { ga: {
className: 'title' className: 'title'
}, },
c: [elem.meta.title] c: [meta.title]
}; };
} }
} }
@ -1147,7 +1089,7 @@ module.exports = query({
}; };
} }
if (!this.props.titlesOnly) { if (!this.props.titlesOnly) {
_date = elem.meta.date; _date = meta.date;
if (!_date || _date.length === 0) { if (!_date || _date.length === 0) {
_date = ""; _date = "";
} }
@ -1163,7 +1105,7 @@ module.exports = query({
parts.push(title); parts.push(title);
if (!this.props.titlesOnly) { if (!this.props.titlesOnly) {
if (this.props.dataType === 'post') { if (this.props.dataType === 'post') {
if (elem.meta.image) { if (meta.image) {
image = { image = {
gn: 'a', gn: 'a',
ga: { ga: {
@ -1173,7 +1115,7 @@ module.exports = query({
{ {
gn: 'img', gn: 'img',
ga: { ga: {
src: elem.meta.image src: meta.image
} }
} }
] ]
@ -1182,16 +1124,16 @@ module.exports = query({
} }
} }
if (this.props.dataPreview) { if (this.props.dataPreview) {
if (!elem.meta.preview) { if (!meta.preview) {
parts.push.apply(parts, elem.snip.c.slice(0, 2)); parts.push.apply(parts, elem.snip.c.slice(0, 2));
} else { } else {
if (elem.meta.preview) { if (meta.preview) {
preview = { preview = {
gn: 'p', gn: 'p',
ga: { ga: {
className: 'preview' className: 'preview'
}, },
c: [elem.meta.preview] c: [meta.preview]
}; };
} else { } else {
preview = elem.snip; preview = elem.snip;
@ -1200,13 +1142,13 @@ module.exports = query({
} }
} }
if (this.props.dataType === 'post') { if (this.props.dataType === 'post') {
if (elem.meta.author) { if (meta.author) {
author = { author = {
gn: 'h3', gn: 'h3',
ga: { ga: {
className: 'author' className: 'author'
}, },
c: [elem.meta.author] c: [meta.author]
}; };
parts.push(author); parts.push(author);
} }
@ -2370,10 +2312,11 @@ recl = React.createClass;
ref = React.DOM, ul = ref.ul, li = ref.li, a = ref.a; ref = React.DOM, ul = ref.ul, li = ref.li, a = ref.a;
module.exports = query({ module.exports = query({
path: 't',
kids: { kids: {
head: 'r', head: 'r',
meta: 'j' meta: 'j',
name: 't',
path: 't'
} }
}, recl({ }, recl({
displayName: "Siblings", displayName: "Siblings",
@ -2389,8 +2332,8 @@ module.exports = query({
}); });
}, },
render: function() { render: function() {
var keys, navClas; var kids, navClas;
keys = util.getKeys(this.props.kids); kids = util.sortKids(this.props.kids);
navClas = { navClas = {
nav: true, nav: true,
'col-md-12': this.props.meta.navmode === 'navbar' 'col-md-12': this.props.meta.navmode === 'navbar'
@ -2401,32 +2344,30 @@ module.exports = query({
navClas = clas(navClas); navClas = clas(navClas);
return ul({ return ul({
className: navClas className: navClas
}, keys.map((function(_this) { }, kids.map((function(_this) {
return function(key) { return function(arg) {
var className, data, head, href, selected; var className, head, href, meta, name, path, ref1, selected;
selected = key === _this.props.curr; head = arg.head, meta = (ref1 = arg.meta) != null ? ref1 : {}, name = arg.name, path = arg.path;
selected = name === _this.props.curr;
if (_this.props.meta.navselect) { if (_this.props.meta.navselect) {
selected = key === _this.props.meta.navselect; selected = name === _this.props.meta.navselect;
}
href = util.basepath(_this.props.path + "/" + key);
data = _this.props.kids[key];
if (data.meta) {
head = data.meta.title;
} }
href = util.basepath(path);
head = meta.title;
if (head == null) { if (head == null) {
head = _this.toText(data.head); head = _this.toText(head);
} }
head || (head = key); head || (head = name);
className = clas({ className = clas({
"nav-item": true, "nav-item": true,
selected: selected selected: selected
}); });
if (data.meta.sibsclass) { if (meta.sibsclass) {
className += " " + clas(data.meta.sibsclass.split(",")); className += " " + clas(meta.sibsclass.split(","));
} }
return li({ return li({
className: className, className: className,
key: key key: name
}, a({ }, a({
className: "nav-link", className: "nav-link",
href: href, href: href,
@ -3092,11 +3033,6 @@ scroll = {
} }
this.cs = $(window).scrollTop(); this.cs = $(window).scrollTop();
this.cwh = window.innerHeight; this.cwh = window.innerHeight;
if ((this.ls - this.cs) < 0 && this.cwh !== this.lwh) {
console.log('current scroll: ' + this.cs);
console.log('last scroll: ' + this.ls);
console.log('window.innerHeight: ' + window.innerHeight);
}
if (this.w > 767) { if (this.w > 767) {
this.clearNav(); this.clearNav();
} }
@ -3208,24 +3144,64 @@ module.exports = {
return ship.slice(0, 6) + "_" + ship.slice(-6); return ship.slice(0, 6) + "_" + ship.slice(-6);
} }
}, },
getKeys: function(kids) { dateFromAtom: function(date) {
var k, keys, ref, ref1, ref2, sorted, v; var __, day, hor, min, mon, ref, sec, str, yer;
sorted = true; ref = date.slice(1).split("."), yer = ref[0], mon = ref[1], day = ref[2], __ = ref[3], hor = ref[4], min = ref[5], sec = ref[6];
keys = []; if (day != null) {
for (k in kids) { str = yer + "-" + mon + "-" + day;
v = kids[k]; if (hor != null) {
if ((ref = v.meta) != null ? ref.hide : void 0) { str += " " + hor + ":" + min + ":" + sec;
continue;
} }
if (((ref1 = v.meta) != null ? ref1.sort : void 0) == null) { return new Date(str);
sorted = false;
}
keys[Number((ref2 = v.meta) != null ? ref2.sort : void 0)] = k;
} }
if (sorted !== true) { },
return keys = _.keys(kids).sort(); getKeys: function(kids) {
} else { return _.map(this.sortKids(kids), 'name');
return keys = _.values(keys); },
sortKids: function(kids, sortBy) {
var _k, _kids, date, k, ref, ref1, v;
if (sortBy == null) {
sortBy = null;
}
kids = _.filter(kids, function(arg) {
var meta;
meta = arg.meta;
return !(meta != null ? meta.hide : void 0);
});
switch (sortBy) {
case 'bump':
return _.sortBy(kids, function(arg) {
var bump, name;
bump = arg.bump, name = arg.name;
return bump || name;
}).reverse();
case 'date':
_kids = [];
for (k in kids) {
v = kids[k];
if (((ref = v.meta) != null ? ref.date : void 0) == null) {
return _.sortBy(kids, 'name');
}
date = this.dateFromAtom(v.meta.date);
if (date == null) {
return _.sortBy(kids, 'name');
}
_k = Number(new Date(date));
_kids[_k] = v;
}
return _.values(_kids).reverse();
case null:
_kids = [];
for (k in kids) {
v = kids[k];
if (((ref1 = v.meta) != null ? ref1.sort : void 0) == null) {
return _.sortBy(kids, 'name');
}
_kids[Number(v.meta.sort)] = v;
}
return _.values(_kids);
default:
throw new Error("Unknown sort: " + sortBy);
} }
} }
}; };
@ -3341,12 +3317,8 @@ EventEmitter.prototype.emit = function(type) {
er = arguments[1]; er = arguments[1];
if (er instanceof Error) { if (er instanceof Error) {
throw er; // Unhandled 'error' event throw er; // Unhandled 'error' event
} else {
// At least give some kind of context to the user
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
err.context = er;
throw err;
} }
throw TypeError('Uncaught, unspecified "error" event.');
} }
} }