git ssb

7+

dinoworm 🐛 / patchcore



Commit 0baf5414ce7a4d8be1f75148ec7dce869d876d66

modules oh my

Michael Williams committed on 2/13/2017, 1:07:22 PM
Parent: c18b233c6d62741496978cd8dc1f34a093946f8b

Files changed

feed/html.jschanged
message/html/action/reply.jschanged
message/html/decorate/data-id.jschanged
message/html/layout/default.jschanged
message/html/layout/mini.jschanged
message/html/meta/channel.jschanged
message/html/render/post.jschanged
message/html/render/vote.jschanged
message/html/render/zz_fallback.jschanged
feed/html.jsView
@@ -1,27 +1,22 @@
11 const pull = require('pull-stream')
22 const h = require('mutant/h')
3 +const nest = require('depnest')
34
4-exports.needs = {
5- message_render: 'first',
6- sbot_log: 'first'
7-}
5 +exports.needs = nest({
6 + 'message.html.render': 'first',
7 + 'sbot.pull.log': 'first'
8 +})
89
9-exports.gives = {
10- render_feed: true
11-}
10 +exports.gives = nest('feed.html.render')
1211
1312 exports.create = function (api) {
14- return {
15- render_feed
16- }
17-
18- function render_feed (stream) {
13 + return nest('feed.html.render', function renderFeed (stream) {
1914 const container = h('div')
2015
2116 pull(
2217 stream({reverse: true, limit: 100}),
23- pull.drain(msg => container.appendChild(api.message_render(msg)))
18 + pull.drain(msg => container.appendChild(api.message.html.render(msg)))
2419 )
2520
2621 return container
2722 }
message/html/action/reply.jsView
@@ -1,9 +1,10 @@
11 var h = require('mutant/h')
2 +var nest = require('depnest')
23
3-exports.gives = 'message_action'
4 +exports.gives = nest('message.html.action')
45
5-exports.create = function () {
6 +exports.create = nest('message.html.action', (api) => {
67 return function reply (msg) {
78 return h('a', { href: '#' + msg.key }, 'Reply')
89 }
910 }
message/html/decorate/data-id.jsView
@@ -1,7 +1,7 @@
1-exports.gives = 'message_decorate'
1 +exports.gives = nest('message.html.decorate')
22
3-exports.create = function (api) {
3 +exports.create = nest('message.html.decorate', (api) => {
44 return function (element, { msg }) {
55 element.dataset.id = msg.key
66 return element
77 }
message/html/layout/default.jsView
@@ -1,37 +1,32 @@
11 const h = require('mutant/h')
2 +var nest = require('depnest')
23
3-exports.needs = {
4- message_backlinks: 'first',
5- message_author: 'first',
6- message_meta: 'map',
7- message_action: 'map',
8- message: {
9- timestamp: 'first'
10- }
11-}
4 +exports.needs = nest('message.html', {
5 + backlinks: 'first',
6 + author: 'first',
7 + meta: 'map',
8 + action: 'map',
9 + timestamp: 'first'
10 +})
1211
13-exports.gives = {
14- message_layout: true
15-}
12 +exports.gives = nest('message.html.layout')
1613
17-exports.create = function (api) {
18- return {
19- message_layout
20- }
14 +exports.create = nest('message.html.layout', (api) => {
15 + return message_layout
2116
2217 function message_layout (msg, opts) {
2318 if (!(opts.layout === undefined || opts.layout === 'default')) return
2419 return h('div', {
2520 classList: 'Message'
2621 }, [
27- h('header.author', {}, api.message_author(msg)),
28- h('section.timestamp', {}, api.message.timestamp(msg)),
22 + h('header.author', {}, api.message.html.author(msg)),
23 + h('section.timestamp', {}, api.message.html.timestamp(msg)),
2924 h('section.title', {}, opts.title),
30- h('section.meta', {}, api.message_meta(msg)),
25 + h('section.meta', {}, api.message.html.meta(msg)),
3126 h('section.content', {}, opts.content),
3227 h('section.raw-content'),
33- h('section.action', {}, api.message_action(msg)),
34- h('footer.backlinks', {}, api.message_backlinks(msg))
28 + h('section.action', {}, api.message.html.action(msg)),
29 + h('footer.backlinks', {}, api.message.html.backlinks(msg))
3530 ])
3631 }
3732 }
message/html/layout/mini.jsView
@@ -1,33 +1,28 @@
11 const h = require('mutant/h')
2 +const nest = require('depnest')
23
3-exports.needs = {
4- message_backlinks: 'first',
5- message_author: 'first',
6- message_meta: 'map',
7- message: {
8- timestamp: 'first'
9- }
10-}
4 +exports.needs = nest('message.html', {
5 + backlinks: 'first',
6 + author: 'first',
7 + meta: 'map',
8 + timestamp: 'first'
9 +})
1110
12-exports.gives = {
13- message_layout: true
14-}
11 +exports.gives = nest('message.html.layout')
1512
16-exports.create = function (api) {
17- return {
18- message_layout
19- }
13 +exports.create = nest('message.html.layout', (api) => {
14 + return message_layout
2015
2116 function message_layout (msg, opts) {
2217 if (opts.layout !== 'mini') return
2318 return h('div', {
2419 classList: 'Message -mini'
2520 }, [
26- h('header.author', {}, api.message_author(msg, { size: 'mini' })),
27- h('section.timestamp', {}, api.message.timestamp(msg)),
28- h('section.meta', {}, api.message_meta(msg)),
21 + h('header.author', {}, api.message.html.author(msg, { size: 'mini' })),
22 + h('section.timestamp', {}, api.message.html.timestamp(msg)),
23 + h('section.meta', {}, api.message.html.meta(msg)),
2924 h('section.content', {}, opts.content),
3025 h('section.raw-content')
3126 ])
3227 }
33-}
28 +})
message/html/meta/channel.jsView
@@ -1,9 +1,10 @@
11 const h = require('mutant/h')
2 +const nest = require('depnest')
23
3-exports.gives = 'message_meta'
4 +exports.gives = nest('message.html.meta')
45
5-exports.create = function (api) {
6 +exports.create = nest('message.html.meta', (api) => {
67 return function channel (msg) {
78 const { channel } = msg.value.content
89 if (channel) return h('span', {}, ['#' + channel])
910 }
message/html/render/post.jsView
@@ -1,39 +1,36 @@
11 var h = require('mutant/h')
2 +var nest = require('depnest')
23
3-exports.needs = {
4- message_decorate: 'reduce',
5- message_layout: 'first',
6- message_link: 'first',
7- markdown: 'first'
4 +exports.needs = nest({
5 + 'message.html': {
6 + decorate: 'reduce',
7 + layout: 'first',
8 + link: 'first',
9 + markdown: 'first'
10 + }
811 }
912
10-exports.gives = {
11- message_render: true
12-}
13 +exports.gives = nest('message.html.render')
1314
1415 exports.create = function (api) {
15- return {
16- message_render
17- }
18-
19- function message_render (msg) {
16 + return nest('message.html.render', function renderMessage (msg) {
2017 if (msg.value.content.type !== 'post') return
21- var element = api.message_layout(msg, {
22- title: message_title(msg),
23- content: message_content(msg),
18 + var element = api.message.html.layout(msg, {
19 + title: messageTitle(msg),
20 + content: messageContent(msg),
2421 layout: 'default'
2522 })
2623
27- return api.message_decorate(element, { msg })
24 + return api.messageDecorate(element, { msg })
2825 }
2926
30- function message_content (data) {
27 + function messageContent (data) {
3128 if (!data.value.content || !data.value.content.text) return
32- return h('div', {}, api.markdown(data.value.content))
29 + return h('div', {}, api.message.html.markdown(data.value.content))
3330 }
3431
35- function message_title (data) {
32 + function messageTitle (data) {
3633 var root = data.value.content && data.value.content.root
37- return !root ? null : h('span', ['re: ', api.message_link(root)])
34 + return !root ? null : h('span', ['re: ', api.message.html.link(root)])
3835 }
3936 }
message/html/render/vote.jsView
@@ -1,35 +1,34 @@
11 var h = require('mutant/h')
2 +var nest = require('depnest')
23
3-exports.needs = {
4- message_layout: 'first',
5- message_decorate: 'reduce',
6- message_link: 'first',
7- markdown: 'first'
4 +exports.needs = nest({
5 + 'message.html': {
6 + decorate: 'reduce',
7 + layout: 'first',
8 + link: 'first',
9 + markdown: 'first'
10 + }
811 }
912
10-exports.gives = {
11- message_render: true
12-}
13 +exports.gives = nest('message.html.render')
1314
1415 exports.create = function (api) {
15- return {
16- message_render
17- }
16 + return nest('message.html.render', message_render)
1817
1918 function message_render (msg) {
2019 if (msg.value.content.type !== 'vote') return
21- var element = api.message_layout(msg, {
20 + var element = api.message.html.layout(msg, {
2221 content: render_vote(msg),
2322 layout: 'mini'
2423 })
2524
26- return api.message_decorate(element, { msg })
25 + return api.message.html.decorate(element, { msg })
2726 }
2827
2928 function render_vote (msg) {
3029 var link = msg.value.content.vote.link
3130 return [
32- msg.value.content.vote.value > 0 ? 'dug' : 'undug', ' ', api.message_link(link)
31 + msg.value.content.vote.value > 0 ? 'dug' : 'undug', ' ', api.message.html.link(link)
3332 ]
3433 }
3534 }
message/html/render/zz_fallback.jsView
@@ -1,19 +1,18 @@
11 var h = require('mutant/h')
2 +var nest = require('depnest')
23
3-exports.needs = {
4- message_layout: 'first',
5- message_decorate: 'reduce'
4 +exports.needs = nest({
5 + 'message.html': {
6 + decorate: 'reduce',
7 + layout: 'first'
8 + }
69 }
710
8-exports.gives = {
9- message_render: true
10-}
11 +exports.gives = nest('message.html.render')
1112
1213 exports.create = function (api) {
13- return {
14- message_render
15- }
14 + return nest('message.html.render', message_render)
1615
1716 function message_render (msg) {
1817 var element = api.message_layout(msg, {
1918 content: message_content(msg),

Built with git-ssb-web