git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit b68094abcbd7db121bfdca8c06131dda2443c8a9

replace insert-css with mutant style element

Matt McKegg committed on 10/25/2017, 11:48:53 PM
Parent: 9eb189371121ad5ec8de841694d1c3b8e4db1a4d

Files changed

main-window.jschanged
package.jsonchanged
main-window.jsView
@@ -5,9 +5,9 @@
55 var when = require('mutant/when')
66 var onceTrue = require('mutant/once-true')
77 var computed = require('mutant/computed')
88 var catchLinks = require('./lib/catch-links')
9-var insertCss = require('insert-css')
9+var themes = require('./styles')
1010 var nest = require('depnest')
1111 var LatestUpdate = require('./lib/latest-update')
1212 var ref = require('ssb-ref')
1313 var setupContextMenuAndSpellCheck = require('./lib/context-menu-and-spellcheck')
@@ -71,19 +71,16 @@
7171 watch(pendingCount, count => {
7272 electron.remote.app.setBadgeCount(count)
7373 })
7474
75+ document.head.appendChild(
76+ h('style', {
77+ innerHTML: computed(api.settings.obs.get('patchwork.theme', 'light'), themeName => {
78+ return themes[themeName] || themes['light']
79+ })
80+ })
81+ )
7582
76- watch(api.settings.obs.get('patchwork.theme', 'light'), name => {
77- Array.from(document.head.children)
78- .filter(c => c.tagName == 'STYLE')
79- .forEach(c => c.innerText = '')
80-
81- var theme = require('./styles')[name]
82- if (!theme) theme = require('./styles')['light']
83- insertCss(theme)
84- })
85-
8683 var container = h(`MainWindow -${process.platform}`, [
8784 h('div.top', [
8885 h('span.history', [
8986 h('a', {
package.jsonView
@@ -29,9 +29,8 @@
2929 "flumeview-level": "^2.0.3",
3030 "hashlru": "^2.2.0",
3131 "human-time": "0.0.1",
3232 "i18n": "^0.8.3",
33- "insert-css": "~2.0.0",
3433 "level": "~1.7.0",
3534 "lrucache": "^1.0.2",
3635 "micro-css": "^2.0.1",
3736 "mime-types": "^2.1.15",

Built with git-ssb-web