From 7cbb744e5f2fd70032d0ea9f37494e89cd9943ef Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 14 Jul 2020 00:23:21 +1000 Subject: [PATCH 001/371] basic mod structure --- repo/core/mod.js | 23 +++++++++++++++++++++++ repo/core/styles.css | 0 2 files changed, 23 insertions(+) create mode 100644 repo/core/mod.js create mode 100644 repo/core/styles.css diff --git a/repo/core/mod.js b/repo/core/mod.js new file mode 100644 index 0000000..fcdee48 --- /dev/null +++ b/repo/core/mod.js @@ -0,0 +1,23 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/) under the MIT license + */ + +module.exports = { + id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', + meta: { + type: 'extension', + name: 'notion-enhancer core', + version: require('../../package.json').version, + author: 'dragonwocky', + thumb: + 'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067', + }, + options: [], + code: { + styles: 'styles.css', + electron: () => {}, + client: () => {}, + }, +}; diff --git a/repo/core/styles.css b/repo/core/styles.css new file mode 100644 index 0000000..e69de29 From 5c648be5ebb9c051a8513670b06b599cf505cecc Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 14 Jul 2020 13:01:07 +1000 Subject: [PATCH 002/371] document mod.js, prepare to load --- repo/core/mod.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/repo/core/mod.js b/repo/core/mod.js index fcdee48..2d261c8 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -6,18 +6,15 @@ module.exports = { id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', - meta: { - type: 'extension', - name: 'notion-enhancer core', - version: require('../../package.json').version, - author: 'dragonwocky', - thumb: - 'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067', - }, + type: 'core', + name: 'notion-enhancer', + version: require('../../package.json').version, + author: 'dragonwocky', + thumb: + 'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067', options: [], - code: { - styles: 'styles.css', - electron: () => {}, - client: () => {}, - }, + styles: 'styles.css', + electron: () => {}, + client: () => {}, + hack: () => {}, }; From 2cb52722dd99a3322dc6e90def73c7f22d859893 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 14 Jul 2020 21:28:05 +1000 Subject: [PATCH 003/371] redesign module system after considerations of what is most technologically friendly (both to implement and use) --- repo/core/{mod.js => meta.js} | 4 ---- 1 file changed, 4 deletions(-) rename repo/core/{mod.js => meta.js} (87%) diff --git a/repo/core/mod.js b/repo/core/meta.js similarity index 87% rename from repo/core/mod.js rename to repo/core/meta.js index 2d261c8..135c53e 100644 --- a/repo/core/mod.js +++ b/repo/core/meta.js @@ -13,8 +13,4 @@ module.exports = { thumb: 'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067', options: [], - styles: 'styles.css', - electron: () => {}, - client: () => {}, - hack: () => {}, }; From 8925234dc5775afbbb8fe3b357f8c9e7c6d4b04d Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Thu, 16 Jul 2020 23:14:41 +1000 Subject: [PATCH 004/371] modloader insertion --- repo/core/{meta.js => mod.js} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename repo/core/{meta.js => mod.js} (94%) diff --git a/repo/core/meta.js b/repo/core/mod.js similarity index 94% rename from repo/core/meta.js rename to repo/core/mod.js index 135c53e..61f9573 100644 --- a/repo/core/meta.js +++ b/repo/core/mod.js @@ -7,7 +7,7 @@ module.exports = { id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', type: 'core', - name: 'notion-enhancer', + name: 'notion-enhancer core', version: require('../../package.json').version, author: 'dragonwocky', thumb: From 8440a3dcca8ee3147d9391ffab1a601d198ec975 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Thu, 16 Jul 2020 23:48:09 +1000 Subject: [PATCH 005/371] add store to loader, bugfix homedir with wsl --- repo/core/mod.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/repo/core/mod.js b/repo/core/mod.js index 61f9573..1b3d9cc 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -8,9 +8,18 @@ module.exports = { id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', type: 'core', name: 'notion-enhancer core', + desc: + 'the modloader itself, including: the CLI, the menu, and enabling/disabling/insertion/updating of mods.', version: require('../../package.json').version, author: 'dragonwocky', thumb: 'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067', options: [], + hacks: { + 'renderer/preload.js': function (store) { + const data = store({ name: 'dragonwocky' }); + console.log(data.name); + data.name = 'tom'; + }, + }, }; From 48fa62d75d902116bcf1114b325d3bc58581908a Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sat, 18 Jul 2020 23:21:55 +1000 Subject: [PATCH 006/371] tray failing: every time something starts working everything else falls apart :/ --- repo/core/mac+linux.png | Bin 0 -> 7192 bytes repo/core/mod.js | 8 ++++ repo/core/tray.js | 81 ++++++++++++++++++++++++++++++++++++++++ repo/core/windows.ico | Bin 0 -> 112696 bytes 4 files changed, 89 insertions(+) create mode 100644 repo/core/mac+linux.png create mode 100644 repo/core/tray.js create mode 100644 repo/core/windows.ico diff --git a/repo/core/mac+linux.png b/repo/core/mac+linux.png new file mode 100644 index 0000000000000000000000000000000000000000..83412d4389f76c295c72992f782dfb3d9f987542 GIT binary patch literal 7192 zcmb_Ac{r49zxT{A_9YaJZAwu>Dm$4`h)Bwsol3T3%~J7%qD7Qa$=1vJW~U^D7^Eb7 z*~&7urVta^mpS({eAoHTcU|ZFb>_Nwe*68~p5J{x_YG5%BRrf0P5=Opp@Hs60I(3m z0(KVoaPSrLg%6f&SXcpk^K;>-$h;%S4E#{dYG1^|fyUa@0x;$TfW{*L zgng3BPG~^}*2Ugt#WfBltW>zsF#U+=D>Ks>@CW+%qNc7Qh`l8UH38U`E&WURp4YJGCDl|({o zfK_0jJ%iT2%_4W4)!u@A=UtPWjvTYXV*IhBfQ~%9T+93=+b5R!Ny_6nhLNEq9>F)+ zdw6GTN^EAwl-*vlF4|(&?B$b`vv7F!9`#R-Cez3EmHf;(KqUXjB3^K4nf^U17biM0 z@79rdr%L3|z_IS~uBa=V$weO;*(l)9RO)E9;9PJIxoJS`ZjobO>gcj^Zk>#2GskjI zNR5P)a4_XGKZhnixt@B;q=uIT!Z)#3@!`53R0f(0~i>+KUKYqt0aTpalNCuVO( z;f@I|omBgMWC?Q3+6SoPkdzv*eTzZ&iH{*5hr|WY=kAxTf+%;R&l||1)JmPN&r9?gJiQ8W->M#vH6BKMj|r-~FtGv{4IM zr<8{EViKKhR5R+cUN97~k@uwDq%M{U#eX4no$l z`f{82hwq`~pO?=)D$TKAY^FMvCfM-owu^70%FjCbdjIJ^wdQv(?PB!eLE?`;Vw#)e z5AwC*vcn(iXnVG2>d{zKH$;;H=`iS#`Yu#v-c9!AW z6`+(=`K35H>Y$A0@F+&UgT$d}IepJmTV97Tu(a55SyZf`)W!Liz_@avmVV@zR?6s( z36YFyuX0A`z>!)v4p$X|aogI=sy0DiBEHRy-hJ+6{}`;kTx{%Z{BRoMiF8T_HS7^) zT!iPnCPOvW!&l>Wn^Oplk#m4U+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z?~A=^(&FtP=Ayp&Y3;^5H{30Us;R~niSy_A>7UV@6LtbWI zshrUSdaT + * (c) 2020 TarasokUA + * (https://dragonwocky.me/) under the MIT license + */ + +let tray; +const electron = require('electron'), + path = require('path'), + is_mac = process.platform === 'darwin', + is_win = process.platform === 'win32', + settings = {}; + +electron.app.on('ready', () => { + tray = new electron.Tray( + is_win + ? path.resolve(__dirname, 'windows.ico') + : new electron.nativeImage.createFromPath( + path.resolve(__dirname, 'mac+linux.png') + ).resize({ + width: 16, + height: 16, + }) + ); + + const contextMenu = electron.Menu.buildFromTemplate([ + { + type: 'normal', + label: 'Bug Report', + }, + { + type: 'normal', + label: 'Feature Request', + }, + { + type: 'separator', + }, + { + type: 'normal', + label: 'Docs', + }, + { + type: 'normal', + label: 'Enhancements', + }, + { + type: 'separator', + }, + { + label: 'Quit', + role: 'quit', + }, + ]); + tray.setContextMenu(contextMenu); + tray.setToolTip('Notion'); + + function showWindows() { + const windows = electron.BrowserWindow.getAllWindows(); + if (is_mac) electron.app.show(); + if (settings.maximized) windows.forEach((win) => [win.maximize()]); + else windows.forEach((win) => win.show()); + electron.app.focus({ steal: true }); + } + function hideWindows() { + const windows = electron.BrowserWindow.getAllWindows(); + windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); + if (is_mac) electron.app.hide(); + } + tray.on('click', () => { + const windows = electron.BrowserWindow.getAllWindows(); + if (windows.some((win) => win.isVisible())) hideWindows(); + else showWindows(); + }); + electron.globalShortcut.register(settings.hotkey, () => { + const windows = electron.BrowserWindow.getAllWindows(); + if (windows.some((win) => win.isFocused() && win.isVisible())) + hideWindows(); + else showWindows(); + }); +}); diff --git a/repo/core/windows.ico b/repo/core/windows.ico new file mode 100644 index 0000000000000000000000000000000000000000..b46f68cf8ad88d1dc489d49700ca4da9b7cc473f GIT binary patch literal 112696 zcmeEv2Rv8b|38_@&WKbpBZMLmMKp|3MxE;%5;7mj`aF@8 zemp&)XRv)Vgp$e`^ZM0%FB-uvEH>XOZ`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2020 23:50:56 +1000 Subject: [PATCH 007/371] de-async-ifying stuff = tray fixed! --- repo/core/mod.js | 2 +- repo/core/tray.js | 144 ++++++++++++++++++++++++---------------------- 2 files changed, 75 insertions(+), 71 deletions(-) diff --git a/repo/core/mod.js b/repo/core/mod.js index 05a8f88..295e0d7 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -23,7 +23,7 @@ module.exports = { 'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067', options: [], hacks: { - // 'main/main.js': require('./tray.js')(defaults), + 'main/main.js': require('./tray.js')(defaults), 'renderer/preload.js': function (store) { const data = store({ name: 'dragonwocky' }); console.log(data.name); diff --git a/repo/core/tray.js b/repo/core/tray.js index 729680c..0423260 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -6,76 +6,80 @@ */ let tray; -const electron = require('electron'), - path = require('path'), - is_mac = process.platform === 'darwin', - is_win = process.platform === 'win32', - settings = {}; -electron.app.on('ready', () => { - tray = new electron.Tray( - is_win - ? path.resolve(__dirname, 'windows.ico') - : new electron.nativeImage.createFromPath( - path.resolve(__dirname, 'mac+linux.png') - ).resize({ - width: 16, - height: 16, - }) - ); +module.exports = (defaults) => + function (store) { + const electron = require('electron'), + path = require('path'), + is_mac = process.platform === 'darwin', + is_win = process.platform === 'win32', + settings = store(defaults); - const contextMenu = electron.Menu.buildFromTemplate([ - { - type: 'normal', - label: 'Bug Report', - }, - { - type: 'normal', - label: 'Feature Request', - }, - { - type: 'separator', - }, - { - type: 'normal', - label: 'Docs', - }, - { - type: 'normal', - label: 'Enhancements', - }, - { - type: 'separator', - }, - { - label: 'Quit', - role: 'quit', - }, - ]); - tray.setContextMenu(contextMenu); - tray.setToolTip('Notion'); + electron.app.on('ready', () => { + tray = new electron.Tray( + is_win + ? path.normalize(`${__dirname}/windows.ico`) + : new electron.nativeImage.createFromPath( + path.normalize(`${__dirname}/mac+linux.png`) + ).resize({ + width: 16, + height: 16, + }) + ); - function showWindows() { - const windows = electron.BrowserWindow.getAllWindows(); - if (is_mac) electron.app.show(); - if (settings.maximized) windows.forEach((win) => [win.maximize()]); - else windows.forEach((win) => win.show()); - electron.app.focus({ steal: true }); - } - function hideWindows() { - const windows = electron.BrowserWindow.getAllWindows(); - windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); - if (is_mac) electron.app.hide(); - } - tray.on('click', () => { - const windows = electron.BrowserWindow.getAllWindows(); - if (windows.some((win) => win.isVisible())) hideWindows(); - else showWindows(); - }); - electron.globalShortcut.register(settings.hotkey, () => { - const windows = electron.BrowserWindow.getAllWindows(); - if (windows.some((win) => win.isFocused() && win.isVisible())) - hideWindows(); - else showWindows(); - }); -}); + const contextMenu = electron.Menu.buildFromTemplate([ + { + type: 'normal', + label: 'Bug Report', + }, + { + type: 'normal', + label: 'Feature Request', + }, + { + type: 'separator', + }, + { + type: 'normal', + label: 'Docs', + }, + { + type: 'normal', + label: 'Enhancements', + }, + { + type: 'separator', + }, + { + label: 'Quit', + role: 'quit', + }, + ]); + tray.setContextMenu(contextMenu); + tray.setToolTip('Notion'); + + function showWindows() { + const windows = electron.BrowserWindow.getAllWindows(); + if (is_mac) electron.app.show(); + if (settings.maximized) windows.forEach((win) => [win.maximize()]); + else windows.forEach((win) => win.show()); + electron.app.focus({ steal: true }); + } + function hideWindows() { + const windows = electron.BrowserWindow.getAllWindows(); + windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); + if (is_mac) electron.app.hide(); + } + tray.on('click', () => { + const windows = electron.BrowserWindow.getAllWindows(); + if (windows.some((win) => win.isVisible())) hideWindows(); + else showWindows(); + }); + electron.globalShortcut.register(settings.hotkey, () => { + const windows = electron.BrowserWindow.getAllWindows(); + if (windows.some((win) => win.isFocused() && win.isVisible())) + hideWindows(); + else showWindows(); + }); + }); + }; From a3e55c61218123b9514cab9fc44eab87eb0b6087 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 19 Jul 2020 16:24:34 +1000 Subject: [PATCH 008/371] taken control of createWindow --- repo/core/icons/alwaysontop_off.svg | 1 + repo/core/icons/alwaysontop_on.svg | 1 + repo/core/icons/close.svg | 1 + repo/core/{ => icons}/mac+linux.png | Bin repo/core/icons/maximise_off.svg | 1 + repo/core/icons/maximise_on.svg | 1 + repo/core/icons/minimise.svg | 1 + repo/core/{ => icons}/windows.ico | Bin repo/core/mod.js | 14 +++-- repo/core/tray.js | 22 ++++++- repo/core/window.js | 85 ++++++++++++++++++++++++++++ 11 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 repo/core/icons/alwaysontop_off.svg create mode 100644 repo/core/icons/alwaysontop_on.svg create mode 100644 repo/core/icons/close.svg rename repo/core/{ => icons}/mac+linux.png (100%) create mode 100644 repo/core/icons/maximise_off.svg create mode 100644 repo/core/icons/maximise_on.svg create mode 100644 repo/core/icons/minimise.svg rename repo/core/{ => icons}/windows.ico (100%) create mode 100644 repo/core/window.js diff --git a/repo/core/icons/alwaysontop_off.svg b/repo/core/icons/alwaysontop_off.svg new file mode 100644 index 0000000..e731f9b --- /dev/null +++ b/repo/core/icons/alwaysontop_off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/repo/core/icons/alwaysontop_on.svg b/repo/core/icons/alwaysontop_on.svg new file mode 100644 index 0000000..b9befcd --- /dev/null +++ b/repo/core/icons/alwaysontop_on.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/repo/core/icons/close.svg b/repo/core/icons/close.svg new file mode 100644 index 0000000..7268fb0 --- /dev/null +++ b/repo/core/icons/close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/repo/core/mac+linux.png b/repo/core/icons/mac+linux.png similarity index 100% rename from repo/core/mac+linux.png rename to repo/core/icons/mac+linux.png diff --git a/repo/core/icons/maximise_off.svg b/repo/core/icons/maximise_off.svg new file mode 100644 index 0000000..e79979f --- /dev/null +++ b/repo/core/icons/maximise_off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/repo/core/icons/maximise_on.svg b/repo/core/icons/maximise_on.svg new file mode 100644 index 0000000..038b21e --- /dev/null +++ b/repo/core/icons/maximise_on.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/repo/core/icons/minimise.svg b/repo/core/icons/minimise.svg new file mode 100644 index 0000000..e40cd84 --- /dev/null +++ b/repo/core/icons/minimise.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/repo/core/windows.ico b/repo/core/icons/windows.ico similarity index 100% rename from repo/core/windows.ico rename to repo/core/icons/windows.ico diff --git a/repo/core/mod.js b/repo/core/mod.js index 295e0d7..d8e90e5 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -7,7 +7,8 @@ const defaults = { openhidden: false, maximized: false, - tray: false, + close_to_tray: false, + frameless: true, hotkey: 'CmdOrCtrl+Shift+A', }; @@ -24,10 +25,13 @@ module.exports = { options: [], hacks: { 'main/main.js': require('./tray.js')(defaults), - 'renderer/preload.js': function (store) { - const data = store({ name: 'dragonwocky' }); - console.log(data.name); - data.name = 'tom'; + 'main/createWindow.js': require('./window.js')(defaults), + 'renderer/preload.js': function (store, __exports) { + const window = require('electron').remote.getCurrentWindow(); + document.defaultView.addEventListener('keyup', (event) => { + if (event.code === 'F5') window.reload(); + // if (event.code === 'F4' && event.altKey) window.close(); + }); }, }, }; diff --git a/repo/core/tray.js b/repo/core/tray.js index 0423260..0a9175d 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -8,7 +8,7 @@ let tray; module.exports = (defaults) => - function (store) { + function (store, __exports) { const electron = require('electron'), path = require('path'), is_mac = process.platform === 'darwin', @@ -18,9 +18,9 @@ module.exports = (defaults) => electron.app.on('ready', () => { tray = new electron.Tray( is_win - ? path.normalize(`${__dirname}/windows.ico`) + ? path.resolve(`${__dirname}/icons/windows.ico`) : new electron.nativeImage.createFromPath( - path.normalize(`${__dirname}/mac+linux.png`) + path.resolve(`${__dirname}/icons/mac+linux.png`) ).resize({ width: 16, height: 16, @@ -31,10 +31,20 @@ module.exports = (defaults) => { type: 'normal', label: 'Bug Report', + click: () => { + electron.shell.openExternal( + 'https://github.com/dragonwocky/notion-enhancer/issues/new?labels=bug&template=bug-report.md' + ); + }, }, { type: 'normal', label: 'Feature Request', + click: () => { + electron.shell.openExternal( + 'https://github.com/dragonwocky/notion-enhancer/issues/new?labels=enhancement&template=feature-request.md' + ); + }, }, { type: 'separator', @@ -42,6 +52,11 @@ module.exports = (defaults) => { type: 'normal', label: 'Docs', + click: () => { + electron.shell.openExternal( + 'https://github.com/dragonwocky/notion-enhancer/tree/js' + ); + }, }, { type: 'normal', @@ -70,6 +85,7 @@ module.exports = (defaults) => windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); if (is_mac) electron.app.hide(); } + tray.on('click', () => { const windows = electron.BrowserWindow.getAllWindows(); if (windows.some((win) => win.isVisible())) hideWindows(); diff --git a/repo/core/window.js b/repo/core/window.js new file mode 100644 index 0000000..82ddc49 --- /dev/null +++ b/repo/core/window.js @@ -0,0 +1,85 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/) under the MIT license + */ + +module.exports = (defaults) => + function (store, __exports) { + const electron = require('electron'), + allWindows = electron.BrowserWindow.getAllWindows, + createWindow = __exports.createWindow, + path = require('path'), + is_mac = process.platform === 'darwin', + settings = store(defaults), + helpers = require('../../pkg/helpers.js'), + __notion = helpers.getNotion(); + + __exports.createWindow = function (relativeUrl) { + if (!relativeUrl) relativeUrl = ''; + const window_state = require(`${__notion.replace( + /\\/g, + '/' + )}/app/node_modules/electron-window-state/index.js`)({ + defaultWidth: 1320, + defaultHeight: 860, + }), + rect = { + x: window_state.x, + y: window_state.y, + width: window_state.width, + height: window_state.height, + }, + focused_window = electron.BrowserWindow.getFocusedWindow(); + if (focused_window && !focused_window.isMaximized()) { + rect.x = focused_window.getPosition()[0] + 20; + rect.y = focused_window.getPosition()[1] + 20; + rect.width = focused_window.getSize()[0]; + rect.height = focused_window.getSize()[1]; + } + const window = new electron.BrowserWindow({ + show: false, + backgroundColor: '#ffffff', + titleBarStyle: 'hiddenInset', + frame: !settings.frameless, + webPreferences: { + preload: path.resolve(`${__notion}/app/renderer/index.js`), + webviewTag: true, + session: electron.session.fromPartition('persist:notion'), + }, + ...rect, + }); + window.once('ready-to-show', function () { + if ( + !settings.openhidden || + allWindows().some((win) => win.isVisible() && win.id != window.id) + ) { + window.show(); + if (settings.maximized) window.maximize(); + if ( + (focused_window && focused_window.isFullScreen()) || + window_state.isFullScreen + ) + window.setFullScreen(true); + } + }); + let intended_quit = false; + window.on('close', (e) => { + if ( + intended_quit || + !settings.close_to_tray || + allWindows().length > 1 + ) { + window_state.saveState(window); + window = null; + } else { + e.preventDefault(); + window.hide(); + } + }); + electron.app.on('before-quit', () => (intended_quit = true)); + window.loadURL(__exports.getIndexUrl(relativeUrl)); + return window; + }; + }; From 35a411b97721c0bcb300e71f0939e355805de5ad Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 19 Jul 2020 22:50:59 +1000 Subject: [PATCH 009/371] titlebar + scrollbars --- .../{maximise_off.svg => maximize_off.svg} | 0 .../{maximise_on.svg => maximize_on.svg} | 0 .../core/icons/{minimise.svg => minimize.svg} | 0 repo/core/mod.js | 13 +- repo/core/scrollbars.css | 34 +++++ repo/core/styles.css | 9 ++ repo/core/titlebar.css | 86 +++++++++++ repo/core/titlebar.js | 137 ++++++++++++++++++ repo/core/tray.js | 1 + repo/core/window.js | 3 +- 10 files changed, 272 insertions(+), 11 deletions(-) rename repo/core/icons/{maximise_off.svg => maximize_off.svg} (100%) rename repo/core/icons/{maximise_on.svg => maximize_on.svg} (100%) rename repo/core/icons/{minimise.svg => minimize.svg} (100%) create mode 100644 repo/core/scrollbars.css create mode 100644 repo/core/titlebar.css create mode 100644 repo/core/titlebar.js diff --git a/repo/core/icons/maximise_off.svg b/repo/core/icons/maximize_off.svg similarity index 100% rename from repo/core/icons/maximise_off.svg rename to repo/core/icons/maximize_off.svg diff --git a/repo/core/icons/maximise_on.svg b/repo/core/icons/maximize_on.svg similarity index 100% rename from repo/core/icons/maximise_on.svg rename to repo/core/icons/maximize_on.svg diff --git a/repo/core/icons/minimise.svg b/repo/core/icons/minimize.svg similarity index 100% rename from repo/core/icons/minimise.svg rename to repo/core/icons/minimize.svg diff --git a/repo/core/mod.js b/repo/core/mod.js index d8e90e5..b951b1f 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -5,10 +5,11 @@ */ const defaults = { - openhidden: false, + openhidden: true, maximized: false, - close_to_tray: false, + close_to_tray: true, frameless: true, + smooth_scrollbars: true, hotkey: 'CmdOrCtrl+Shift+A', }; @@ -26,12 +27,6 @@ module.exports = { hacks: { 'main/main.js': require('./tray.js')(defaults), 'main/createWindow.js': require('./window.js')(defaults), - 'renderer/preload.js': function (store, __exports) { - const window = require('electron').remote.getCurrentWindow(); - document.defaultView.addEventListener('keyup', (event) => { - if (event.code === 'F5') window.reload(); - // if (event.code === 'F4' && event.altKey) window.close(); - }); - }, + 'renderer/preload.js': require('./titlebar.js')(defaults), }, }; diff --git a/repo/core/scrollbars.css b/repo/core/scrollbars.css new file mode 100644 index 0000000..f512b59 --- /dev/null +++ b/repo/core/scrollbars.css @@ -0,0 +1,34 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/) under the MIT license + */ + +.smooth-scrollbars .notion-scroller { + cursor: auto; +} +.smooth-scrollbars ::-webkit-scrollbar { + width: 8px; /* vertical */ + height: 8px; /* horizontal */ +} +.smooth-scrollbars ::-webkit-scrollbar-corner { + background-color: transparent; /* overlap */ +} +.smooth-scrollbars ::-webkit-scrollbar-thumb { + border-radius: 5px; +} + +.smooth-scrollbars .notion-light-theme ::-webkit-scrollbar-thumb { + background-color: #d9d8d6; + border: 1px solid #cacac8; +} +.smooth-scrollbars .notion-light-theme ::-webkit-scrollbar-thumb:hover { + background: #cacac8; +} +.smooth-scrollbars .notion-dark-theme ::-webkit-scrollbar-thumb { + background-color: #505457; +} +.smooth-scrollbars .notion-dark-theme ::-webkit-scrollbar-thumb:hover { + background: #696d6f; +} diff --git a/repo/core/styles.css b/repo/core/styles.css index e69de29..041fcae 100644 --- a/repo/core/styles.css +++ b/repo/core/styles.css @@ -0,0 +1,9 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/) under the MIT license + */ + +@import './scrollbars.css'; +@import './titlebar.css'; diff --git a/repo/core/titlebar.css b/repo/core/titlebar.css new file mode 100644 index 0000000..1e91e2d --- /dev/null +++ b/repo/core/titlebar.css @@ -0,0 +1,86 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/) under the MIT license + */ + +.frameless .notion-topbar { + height: 55px !important; +} + +.frameless .window-dragarea { + height: 10px; + width: 100%; +} +.frameless .notion-light-theme .window-dragarea { + background: #e6e6e6; +} +.frameless .notion-dark-theme .window-dragarea { + background: #272d2f; +} + +.window-buttons-area { + display: flex; + align-items: center; + font-size: 14px; +} +@media (max-width: 760px) { + .notion-topbar { + height: 95px !important; + } + .notion-topbar > :nth-child(2) { + display: grid !important; + height: 85px !important; + grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr; + } + .window-buttons-area { + grid-row: 1; + grid-column: 9 / span end; + justify-content: flex-end; + } + .notion-topbar-breadcrumb { + grid-row: 2; + grid-column: 1 / span 8; + } + .notion-topbar-actions { + grid-row: 2; + grid-column: 9 / span end; + justify-content: flex-end; + } +} + +.window-button { + background: transparent; + border: 0; + margin: 0px 0px 0px 9px; + width: 32px; + line-height: 26px; + border-radius: 4px; + font-size: 16px; + transition: background 0.2s; + cursor: default; +} +.window-button svg { + margin-top: 8px; + width: 14px; + height: 14px; +} +.window-button svg path { + fill: currentColor; +} +.window-button svg line { + stroke: currentColor; +} +.notion-light-theme .window-button:hover { + background: rgb(239, 239, 239); +} +.notion-dark-theme .window-button:hover { + background: rgb(71, 76, 80); +} +.window-button.btn-close:hover { + background: #e81123; +} +.window-button.btn-close:hover svg line { + stroke: white; +} diff --git a/repo/core/titlebar.js b/repo/core/titlebar.js new file mode 100644 index 0000000..3133026 --- /dev/null +++ b/repo/core/titlebar.js @@ -0,0 +1,137 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/) under the MIT license + */ + +module.exports = (defaults) => + function (store, __exports) { + const electron = require('electron'), + browser = electron.remote.getCurrentWindow(), + path = require('path'), + fs = require('fs-extra'), + is_mac = process.platform === 'darwin', + settings = store(defaults); + + document.defaultView.addEventListener('keyup', (event) => { + if (event.code === 'F5') window.reload(); + // if (event.code === 'F4' && event.altKey) window.close(); + }); + + const attempt = setInterval(enhance, 500); + async function enhance() { + if (!document.querySelector('.notion-frame')) return; + clearInterval(attempt); + + if (settings.smooth_scrollbars) + document.body.classList.add('smooth-scrollbars'); + + if (settings.frameless) { + document.body.classList.add('frameless'); + const dragarea = document.createElement('div'); + dragarea.className = 'window-dragarea'; + document.querySelector('.notion-topbar').prepend(dragarea); + } + + const buttons = { + element: document.createElement('span'), + insert: ['alwaysontop'], + icons: { + raw: { + alwaysontop: { + on: fs.readFile( + path.resolve(`${__dirname}/icons/alwaysontop_on.svg`) + ), + off: fs.readFile( + path.resolve(`${__dirname}/icons/alwaysontop_off.svg`) + ), + }, + minimize: fs.readFile( + path.resolve(`${__dirname}/icons/minimize.svg`) + ), + maximize: { + on: fs.readFile( + path.resolve(`${__dirname}/icons/maximize_on.svg`) + ), + off: fs.readFile( + path.resolve(`${__dirname}/icons/maximize_off.svg`) + ), + }, + close: fs.readFile(path.resolve(`${__dirname}/icons/close.svg`)), + }, + alwaysontop() { + return browser.isAlwaysOnTop() + ? buttons.icons.raw.alwaysontop.on + : buttons.icons.raw.alwaysontop.off; // '🠙' : '🠛' + }, + minimize() { + return buttons.icons.raw.minimize; // '⚊' + }, + maximize() { + return browser.isMaximized() + ? buttons.icons.raw.maximize.on + : buttons.icons.raw.maximize.off; // '🗗' : '🗖' + }, + close() { + return buttons.icons.raw.close; // '⨉' + }, + }, + actions: { + async alwaysontop() { + browser.setAlwaysOnTop(!browser.isAlwaysOnTop()); + this.innerHTML = await buttons.icons.alwaysontop(); + }, + minimize() { + browser.minimize(); + }, + async maximize() { + browser.isMaximized() ? browser.unmaximize() : browser.maximize(); + this.innerHTML = await buttons.icons.maximize(); + }, + close(event = null) { + if ( + settings.close_to_tray && + electron.remote.BrowserWindow.getAllWindows().length === 1 + ) { + if (event) event.preventDefault(); + browser.hide(); + } else browser.close(); + }, + }, + }; + + if (settings.frameless && !is_mac) + buttons.insert.push('minimize', 'maximize', 'close'); + buttons.element.className = 'window-buttons-area'; + for (let btn of buttons.insert) { + buttons.element.innerHTML += ``; + } + + document + .querySelector('.notion-topbar > div[style*="display: flex"]') + .appendChild(buttons.element); + document + .querySelector('.notion-history-back-button') + .parentElement.nextElementSibling.classList.add( + 'notion-topbar-breadcrumb' + ); + document + .querySelector('.notion-topbar-share-menu') + .parentElement.classList.add('notion-topbar-actions'); + + for (let btn of buttons.insert) { + document.querySelector(`.window-button.btn-${btn}`).onclick = + buttons.actions[btn]; + } + + // if (!isMac) { + // setInterval(() => { + // if (button_elements.maximize.innerHTML != buttons.icons.maximize()) + // button_elements.maximize.innerHTML = buttons.icons.maximize(); + // }, 1000); + // } + } + }; diff --git a/repo/core/tray.js b/repo/core/tray.js index 0a9175d..53525b3 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -61,6 +61,7 @@ module.exports = (defaults) => { type: 'normal', label: 'Enhancements', + // will open menu }, { type: 'separator', diff --git a/repo/core/window.js b/repo/core/window.js index 82ddc49..73c7b4a 100644 --- a/repo/core/window.js +++ b/repo/core/window.js @@ -9,9 +9,8 @@ module.exports = (defaults) => function (store, __exports) { const electron = require('electron'), allWindows = electron.BrowserWindow.getAllWindows, - createWindow = __exports.createWindow, + // createWindow = __exports.createWindow, path = require('path'), - is_mac = process.platform === 'darwin', settings = store(defaults), helpers = require('../../pkg/helpers.js'), __notion = helpers.getNotion(); From 9a012eb3a73c132b794d09921aa0ae3e6c95dd60 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 21 Jul 2020 00:09:24 +1000 Subject: [PATCH 010/371] configurable dragarea size --- repo/core/dragarea.js | 31 +++++++++++++++++++++++++++++++ repo/core/mod.js | 2 ++ repo/core/titlebar.css | 12 ++++++------ repo/core/titlebar.js | 35 +++++++++++++++++++++++++---------- 4 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 repo/core/dragarea.js diff --git a/repo/core/dragarea.js b/repo/core/dragarea.js new file mode 100644 index 0000000..1720035 --- /dev/null +++ b/repo/core/dragarea.js @@ -0,0 +1,31 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/) under the MIT license + */ + +module.exports = (defaults) => + function (store, __exports) { + const __start = window['__start'], + settings = store(defaults); + + window['__start'] = function () { + __start(); + const dragarea = document.querySelector( + '#root [style*="-webkit-app-region: drag"]' + ), + default_styles = dragarea.getAttribute('style'); + + document + .getElementById('notion') + .addEventListener('ipc-message', (event) => { + if (event.channel.startsWith('enhancer:sidebar-width-')) + dragarea.setAttribute( + 'style', + `${default_styles} left: height: ${ + settings.dragarea_height + }px; ${event.channel.slice('enhancer:sidebar-width-'.length)};` + ); + }); + }; + }; diff --git a/repo/core/mod.js b/repo/core/mod.js index b951b1f..813df8d 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -9,6 +9,7 @@ const defaults = { maximized: false, close_to_tray: true, frameless: true, + dragarea_height: 12.5, smooth_scrollbars: true, hotkey: 'CmdOrCtrl+Shift+A', }; @@ -27,6 +28,7 @@ module.exports = { hacks: { 'main/main.js': require('./tray.js')(defaults), 'main/createWindow.js': require('./window.js')(defaults), + 'renderer/index.js': require('./dragarea.js')(defaults), 'renderer/preload.js': require('./titlebar.js')(defaults), }, }; diff --git a/repo/core/titlebar.css b/repo/core/titlebar.css index 1e91e2d..7988bf4 100644 --- a/repo/core/titlebar.css +++ b/repo/core/titlebar.css @@ -6,11 +6,11 @@ */ .frameless .notion-topbar { - height: 55px !important; + height: calc(var(--dragarea-height, 10px) + 45px) !important; } .frameless .window-dragarea { - height: 10px; + height: var(--dragarea-height, 10px); width: 100%; } .frameless .notion-light-theme .window-dragarea { @@ -26,12 +26,12 @@ font-size: 14px; } @media (max-width: 760px) { - .notion-topbar { - height: 95px !important; + .frameless .notion-topbar { + height: calc(var(--dragarea-height, 10px) + 80px) !important; } - .notion-topbar > :nth-child(2) { + .frameless .notion-topbar > :nth-child(2) { + height: 80px !important; display: grid !important; - height: 85px !important; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr; } .window-buttons-area { diff --git a/repo/core/titlebar.js b/repo/core/titlebar.js index 3133026..44fcb6e 100644 --- a/repo/core/titlebar.js +++ b/repo/core/titlebar.js @@ -14,9 +14,9 @@ module.exports = (defaults) => is_mac = process.platform === 'darwin', settings = store(defaults); + // additional hotkeys document.defaultView.addEventListener('keyup', (event) => { if (event.code === 'F5') window.reload(); - // if (event.code === 'F4' && event.altKey) window.close(); }); const attempt = setInterval(enhance, 500); @@ -24,16 +24,37 @@ module.exports = (defaults) => if (!document.querySelector('.notion-frame')) return; clearInterval(attempt); + // scrollbars if (settings.smooth_scrollbars) document.body.classList.add('smooth-scrollbars'); + // frameless if (settings.frameless) { document.body.classList.add('frameless'); - const dragarea = document.createElement('div'); + + // draggable area + const dragarea = document.createElement('div'), + sidebar = document.querySelector('.notion-sidebar'); dragarea.className = 'window-dragarea'; document.querySelector('.notion-topbar').prepend(dragarea); + document.documentElement.style.setProperty( + '--dragarea-height', + `${settings.dragarea_height}px` + ); + let sidebar_width; + setInterval(() => { + let new_width = + sidebar.style.opacity === '0' ? '0px' : sidebar.style.width; + if (sidebar_width !== new_width) { + sidebar_width = new_width; + electron.ipcRenderer.sendToHost( + `enhancer:sidebar-width-${sidebar_width}` + ); + } + }, 100); } + // window buttons const buttons = { element: document.createElement('span'), insert: ['alwaysontop'], @@ -89,14 +110,8 @@ module.exports = (defaults) => browser.isMaximized() ? browser.unmaximize() : browser.maximize(); this.innerHTML = await buttons.icons.maximize(); }, - close(event = null) { - if ( - settings.close_to_tray && - electron.remote.BrowserWindow.getAllWindows().length === 1 - ) { - if (event) event.preventDefault(); - browser.hide(); - } else browser.close(); + close() { + browser.close(); }, }, }; From 8a1709c559fa0476f9aae45421f3eb72d83970f5 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 21 Jul 2020 09:47:19 +1000 Subject: [PATCH 011/371] maximise icon updates as needed --- repo/core/dragarea.js | 5 ++--- repo/core/titlebar.js | 19 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/repo/core/dragarea.js b/repo/core/dragarea.js index 1720035..b204f4b 100644 --- a/repo/core/dragarea.js +++ b/repo/core/dragarea.js @@ -22,9 +22,8 @@ module.exports = (defaults) => if (event.channel.startsWith('enhancer:sidebar-width-')) dragarea.setAttribute( 'style', - `${default_styles} left: height: ${ - settings.dragarea_height - }px; ${event.channel.slice('enhancer:sidebar-width-'.length)};` + `${default_styles} height: ${settings.dragarea_height}px; left: ${ + event.channel.slice('enhancer:sidebar-width-'.length)};` ); }); }; diff --git a/repo/core/titlebar.js b/repo/core/titlebar.js index 44fcb6e..4c26ca1 100644 --- a/repo/core/titlebar.js +++ b/repo/core/titlebar.js @@ -33,8 +33,7 @@ module.exports = (defaults) => document.body.classList.add('frameless'); // draggable area - const dragarea = document.createElement('div'), - sidebar = document.querySelector('.notion-sidebar'); + const dragarea = document.createElement('div'); dragarea.className = 'window-dragarea'; document.querySelector('.notion-topbar').prepend(dragarea); document.documentElement.style.setProperty( @@ -43,8 +42,9 @@ module.exports = (defaults) => ); let sidebar_width; setInterval(() => { + const sidebar = document.querySelector('.notion-sidebar'); let new_width = - sidebar.style.opacity === '0' ? '0px' : sidebar.style.width; + sidebar.style.height === 'auto' ? '0px' : sidebar.style.width; if (sidebar_width !== new_width) { sidebar_width = new_width; electron.ipcRenderer.sendToHost( @@ -124,6 +124,12 @@ module.exports = (defaults) => btn ]()}`; } + if (settings.frameless && !is_mac) + setInterval(async () => { + const icon = await buttons.icons.maximize(), + el = buttons.element.querySelector('.btn-maximize'); + if (el.innerHTML != icon) el.innerHTML = icon; + }, 100); document .querySelector('.notion-topbar > div[style*="display: flex"]') @@ -141,12 +147,5 @@ module.exports = (defaults) => document.querySelector(`.window-button.btn-${btn}`).onclick = buttons.actions[btn]; } - - // if (!isMac) { - // setInterval(() => { - // if (button_elements.maximize.innerHTML != buttons.icons.maximize()) - // button_elements.maximize.innerHTML = buttons.icons.maximize(); - // }, 1000); - // } } }; From 2d37b807eafb8acf54501a10a439bf5268f1463e Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Wed, 22 Jul 2020 23:45:59 +1000 Subject: [PATCH 012/371] collect theme variables: dark colours --- repo/core/scrollbars.css | 20 ++-- repo/core/styles.css | 1 + repo/core/theme.css | 243 +++++++++++++++++++++++++++++++++++++++ repo/core/titlebar.css | 51 ++++---- repo/core/titlebar.js | 2 +- 5 files changed, 286 insertions(+), 31 deletions(-) create mode 100644 repo/core/theme.css diff --git a/repo/core/scrollbars.css b/repo/core/scrollbars.css index f512b59..7402d8c 100644 --- a/repo/core/scrollbars.css +++ b/repo/core/scrollbars.css @@ -19,16 +19,18 @@ border-radius: 5px; } -.smooth-scrollbars .notion-light-theme ::-webkit-scrollbar-thumb { - background-color: #d9d8d6; - border: 1px solid #cacac8; -} -.smooth-scrollbars .notion-light-theme ::-webkit-scrollbar-thumb:hover { - background: #cacac8; -} .smooth-scrollbars .notion-dark-theme ::-webkit-scrollbar-thumb { - background-color: #505457; + background-color: var(--theme_dark-scrollbar); + border: var(--theme_dark-scrollbar-border); } .smooth-scrollbars .notion-dark-theme ::-webkit-scrollbar-thumb:hover { - background: #696d6f; + background: var(--theme_dark-scrollbar_hover); +} + +.smooth-scrollbars .notion-light-theme ::-webkit-scrollbar-thumb { + background-color: var(--theme_light-scrollbar); + border: 1px solid var(--theme_light-scrollbar-border); +} +.smooth-scrollbars .notion-light-theme ::-webkit-scrollbar-thumb:hover { + background: var(--theme_light-scrollbar_hover); } diff --git a/repo/core/styles.css b/repo/core/styles.css index 041fcae..3019d73 100644 --- a/repo/core/styles.css +++ b/repo/core/styles.css @@ -5,5 +5,6 @@ * (https://dragonwocky.me/) under the MIT license */ +@import './theme.css'; @import './scrollbars.css'; @import './titlebar.css'; diff --git a/repo/core/theme.css b/repo/core/theme.css new file mode 100644 index 0000000..2aa8999 --- /dev/null +++ b/repo/core/theme.css @@ -0,0 +1,243 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/) under the MIT license + */ + +:root { + /** light **/ + + --theme_light-dragarea: #e6e6e6; + --theme_light-button_hover: rgb(239, 239, 239); + --theme_light-button_hover-border: transparent; + --theme_light-button_close: #e81123; + --theme_light-button_close-fill: white; + + --theme_light-scrollbar: #d9d8d6; + --theme_light-scrollbar-border: #cacac8; + --theme_light-scrollbar_hover: #cacac8; + + /** dark **/ + + --theme_dark-main: rgb(47, 52, 55); + --theme_dark-sidebar: rgb(55, 60, 63); + --theme_dark-dragarea: #272d2f; + --theme_dark-primary: rgb(46, 170, 220); + --theme_dark-primary_hover: rgb(6, 156, 205); + --theme_dark-primary_click: rgb(0, 141, 190); + --theme_dark-primary_indicator: rgb(235, 87, 87); + + --theme_dark-card: rgb(63, 68, 71); + --theme_dark-card_border: rgb(63, 68, 71); + --theme_dark-button_hover: rgb(71, 76, 80); + --theme_dark-button_close: #e81123; + --theme_dark-button_close-fill: white; + --theme_dark-button_hover-border: transparent; + --theme_dark-table_border: rgba(255, 255, 255, 0.1); + + --theme_dark-scrollbar: #505457; + --theme_dark-scrollbar-border: transparent; + --theme_dark-scrollbar_hover: #696d6f; + + --theme_dark-text_gray: rgba(151, 154, 155, 0.95); + --theme_dark-text_brown: rgb(147, 114, 100); + --theme_dark-text_orange: rgb(255, 163, 68); + --theme_dark-text_yellow: rgb(255, 220, 73); + --theme_dark-text_green: rgb(77, 171, 154); + --theme_dark-text_blue: rgb(82, 156, 202); + --theme_dark-text_purple: rgb(154, 109, 215); + --theme_dark-text_pink: rgb(226, 85, 161); + --theme_dark-text_red: rgb(255, 115, 105); + --theme_dark-bg_gray: rgba(151, 154, 155, 0.5); + --theme_dark-bg_brown: rgba(147, 114, 100, 0.5); + --theme_dark-bg_orange: rgba(255, 163, 68, 0.5); + --theme_dark-bg_yellow: rgba(255, 220, 73, 0.5); + --theme_dark-bg_green: rgba(77, 171, 154, 0.5); + --theme_dark-bg_blue: rgba(82, 156, 202, 0.5); + --theme_dark-bg_purple: rgba(154, 109, 215, 0.5); + --theme_dark-bg_pink: rgba(226, 85, 161, 0.5); + --theme_dark-bg_red: rgba(255, 115, 105, 0.5); + --theme_dark-line_gray: rgb(69, 75, 78); + --theme_dark-line_brown: rgb(67, 64, 64); + --theme_dark-line_orange: rgb(89, 74, 58); + --theme_dark-line_yellow: rgb(89, 86, 59); + --theme_dark-line_green: rgb(53, 76, 75); + --theme_dark-line_blue: rgb(54, 73, 84); + --theme_dark-line_purple: rgb(68, 63, 87); + --theme_dark-line_pink: rgb(83, 59, 76); + --theme_dark-line_red: rgb(89, 65, 65); +} + +/** backgrounds **/ + +.notion-dark-theme [style*='background: rgb(55, 60, 63)'], +.notion-dark-theme [style*='background: rgba(69, 75, 78, 0.3)'] { + background: var(--theme_dark-sidebar) !important; +} +.notion-body.dark, +.notion-dark-theme [style*='background: rgb(47, 52, 55)'] { + background: var(--theme_dark-main) !important; +} + +/** databases **/ + +.notion-dark-theme [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px'] { + box-shadow: none !important; +} +.notion-dark-theme .notion-table-view > :first-child > :first-child, +.notion-dark-theme [style*='background: rgb(71, 76, 80)'], +.notion-dark-theme [style*='background: rgb(80, 85, 88)'], +.notion-dark-theme [style*='background: rgb(98, 102, 104)'] { + background: var(--theme_dark-button_hover) !important; + box-shadow: 0 0 0 0.5px var(--theme_dark-button_hover-border); +} + +.notion-dark-theme [style*='background: rgb(63, 68, 71)'] { + background: var(--theme_dark-card) !important; +} +.notion-dark-theme .notion-frame [style*='background: rgb(63, 68, 71)'] { + border: 0.5px solid var(--theme_dark-card_border); +} + +.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255, 0.14)'], +.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255, 0.07)'] { + border-top: 1px solid var(--theme_dark-table_border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) -1px 0px 0px'] { + box-shadow: var(--theme_dark-table_border) -1px 0px 0px !important; +} +.notion-dark-theme + [style*='border-bottom: 1px solid rgba(255, 255, 255, 0.14)'], +.notion-dark-theme + [style*='border-bottom: 1px solid rgba(255, 255, 255, 0.07)'] { + border-bottom: 1px solid var(--theme_dark-table_border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px'] { + box-shadow: var(--theme_dark-table_border) 0px 1px 0px !important; +} +.notion-dark-theme [style*='border-right: 1px solid rgba(255, 255, 255, 0.14)'], +.notion-dark-theme + [style*='border-right: 1px solid rgba(255, 255, 255, 0.07)'] { + border-right: 1px solid var(--theme_dark-table_border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { + box-shadow: var(--theme_dark-table_border) 0px -1px 0px !important; +} +.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255, 0.14)'], +.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255, 0.07)'] { + border-left: 1px solid var(--theme_dark-table_border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'] { + box-shadow: var(--theme_dark-table_border) 0px 1px 0px inset !important; +} + +/** colours **/ + +.notion-dark-theme [style*='background: rgb(46, 170, 220)'] { + background: var(--theme_dark-primary) !important; +} +.notion-dark-theme [style*='background: rgb(6, 156, 205)'] { + background: var(--theme_dark-primary_hover) !important; +} +.notion-dark-theme [style*='background: rgb(0, 141, 190)'] { + background: var(--theme_dark-primary_click) !important; +} +.notion-dark-theme [style*='background: rgb(235, 87, 87)'] { + background: var(--theme_dark-primary_indicator) !important; +} + +.notion-dark-theme [style*='color:rgba(151,154,155,0.95)'] { + color: var(--theme_dark-text_gray) !important; +} +.notion-dark-theme [style*='background: rgba(151, 154, 155, 0.5)'], +.notion-dark-theme [style*='background:rgb(69,75,78)'] { + background: var(--theme_dark-bg_gray) !important; +} +.notion-dark-theme [style*='background: rgb(69, 75, 78)'] { + background: var(--theme_dark-line_gray) !important; +} +.notion-dark-theme [style*='color:rgb(147,114,100)'] { + color: var(--theme_dark-text_brown) !important; +} +.notion-dark-theme [style*='background: rgba(147, 114, 100, 0.5)'], +.notion-dark-theme [style*='background:rgb(67,64,64)'] { + background: var(--theme_dark-bg_brown) !important; +} +.notion-dark-theme [style*='background: rgb(67, 64, 64)'] { + background: var(--theme_dark-line_brown) !important; +} +.notion-dark-theme [style*='color:rgb(255,163,68)'] { + color: var(--theme_dark-text_orange) !important; +} +.notion-dark-theme [style*='background: rgba(255, 163, 68, 0.5)'], +.notion-dark-theme [style*='background:rgb(89,74,58)'] { + background: var(--theme_dark-bg_orange) !important; +} +.notion-dark-theme [style*='background: rgb(89, 74, 58)'] { + background: var(--theme_dark-line_orange) !important; +} +.notion-dark-theme [style*='color:rgb(255,220,73)'] { + color: var(--theme_dark-text_yellow) !important; +} +.notion-dark-theme [style*='background: rgba(255, 220, 73, 0.5)'], +.notion-dark-theme [style*='background:rgb(89,86,59)'] { + background: var(--theme_dark-bg_yellow) !important; +} +.notion-dark-theme [style*='background: rgb(89, 86, 59)'] { + background: var(--theme_dark-line_yellow) !important; +} +.notion-dark-theme [style*='color:rgb(77,171,154)'] { + color: var(--theme_dark-text_green) !important; +} +.notion-dark-theme [style*='background: rgba(77, 171, 154, 0.5)'], +.notion-dark-theme [style*='background:rgb(53,76,75)'] { + background: var(--theme_dark-bg_green) !important; +} +.notion-dark-theme [style*='background: rgb(53, 76, 75)'] { + background: var(--theme_dark-line_green) !important; +} +.notion-dark-theme [style*='color:rgb(82,156,202)'] { + color: var(--theme_dark-text_blue) !important; +} +.notion-dark-theme [style*='background: rgba(82, 156, 202, 0.5)'], +.notion-dark-theme [style*='background:rgb(54,73,84)'] { + background: var(--theme_dark-bg_blue) !important; +} +.notion-dark-theme [style*='background: rgb(54, 73, 84)'] { + background: var(--theme_dark-line_blue) !important; +} +.notion-dark-theme [style*='color:rgb(154,109,215)'] { + color: var(--theme_dark-text_purple) !important; +} +.notion-dark-theme [style*='background: rgba(154, 109, 215, 0.5)'], +.notion-dark-theme [style*='background:rgb(68,63,87)'] { + background: var(--theme_dark-bg_purple) !important; +} +.notion-dark-theme [style*='background: rgb(68, 63, 87)'] { + background: var(--theme_dark-line_purple) !important; +} +.notion-dark-theme [style*='color:rgb(226,85,161)'] { + color: var(--theme_dark-text_pink) !important; +} +.notion-dark-theme [style*='background: rgba(226, 85, 161, 0.5)'], +.notion-dark-theme [style*='background:rgb(83,59,76)'] { + background: var(--theme_dark-bg_pink) !important; +} +.notion-dark-theme [style*='background: rgb(83, 59, 76)'] { + background: var(--theme_dark-line_pink) !important; +} +.notion-dark-theme [style*='color:rgb(255,115,105)'] { + color: var(--theme_dark-text_red) !important; +} +.notion-dark-theme [style*='background: rgba(255, 115, 105, 0.5);'], +.notion-dark-theme [style*='background:rgb(89,65,65)'] { + background: var(--theme_dark-bg_red) !important; +} +.notion-dark-theme [style*='background: rgb(89, 65, 65)'] { + background: var(--theme_dark-line_red) !important; +} diff --git a/repo/core/titlebar.css b/repo/core/titlebar.css index 7988bf4..83f5810 100644 --- a/repo/core/titlebar.css +++ b/repo/core/titlebar.css @@ -6,28 +6,22 @@ */ .frameless .notion-topbar { - height: calc(var(--dragarea-height, 10px) + 45px) !important; + height: calc(var(--configured-dragarea_height, 10px) + 45px) !important; } - .frameless .window-dragarea { - height: var(--dragarea-height, 10px); + height: var(--configured-dragarea_height, 10px); width: 100%; } -.frameless .notion-light-theme .window-dragarea { - background: #e6e6e6; -} .frameless .notion-dark-theme .window-dragarea { - background: #272d2f; + background: var(--theme_dark-dragarea); +} +.frameless .notion-light-theme .window-dragarea { + background: var(--theme_light-dragarea); } -.window-buttons-area { - display: flex; - align-items: center; - font-size: 14px; -} @media (max-width: 760px) { .frameless .notion-topbar { - height: calc(var(--dragarea-height, 10px) + 80px) !important; + height: calc(var(--configured-dragarea_height, 10px) + 80px) !important; } .frameless .notion-topbar > :nth-child(2) { height: 80px !important; @@ -50,6 +44,11 @@ } } +.window-buttons-area { + display: flex; + align-items: center; + font-size: 14px; +} .window-button { background: transparent; border: 0; @@ -72,15 +71,25 @@ .window-button svg line { stroke: currentColor; } -.notion-light-theme .window-button:hover { - background: rgb(239, 239, 239); -} + .notion-dark-theme .window-button:hover { - background: rgb(71, 76, 80); + background: var(--theme_dark-button_hover); + box-shadow: 0 0 0 0.5px var(--theme_dark-button_hover-border); } -.window-button.btn-close:hover { - background: #e81123; +.notion-dark-theme .window-button.btn-close:hover { + background: var(--theme_dark-button_close); } -.window-button.btn-close:hover svg line { - stroke: white; +.notion-dark-theme .window-button.btn-close:hover svg line { + stroke: var(--theme_dark-button_close-fill); +} + +.notion-light-theme .window-button.btn-close:hover { + background: var(--theme_light-button_close); +} +.notion-light-theme .window-button.btn-close:hover svg line { + stroke: var(--theme_light-button_close-fill); +} +.notion-light-theme .window-button:hover { + background: var(--theme_light-button_hover); + box-shadow: 0 0 0 0.5px var(--theme_light-button_hover-border); } diff --git a/repo/core/titlebar.js b/repo/core/titlebar.js index 4c26ca1..aa3e711 100644 --- a/repo/core/titlebar.js +++ b/repo/core/titlebar.js @@ -37,7 +37,7 @@ module.exports = (defaults) => dragarea.className = 'window-dragarea'; document.querySelector('.notion-topbar').prepend(dragarea); document.documentElement.style.setProperty( - '--dragarea-height', + '--configured-dragarea_height', `${settings.dragarea_height}px` ); let sidebar_width; From 830492e181874bbcc6edd73de8def67b49fe1686 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Thu, 23 Jul 2020 23:33:09 +1000 Subject: [PATCH 013/371] more dark theme stuff, inc. bugfixes + code higlight --- repo/core/theme.css | 280 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 227 insertions(+), 53 deletions(-) diff --git a/repo/core/theme.css b/repo/core/theme.css index 2aa8999..04dcf82 100644 --- a/repo/core/theme.css +++ b/repo/core/theme.css @@ -8,6 +8,18 @@ :root { /** light **/ + --theme_light-main-height: 100%; + + --theme_light-font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', + Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', + 'Segoe UI Symbol'; + --theme_light-font_serif: Lyon-Text, Georgia, YuMincho, 'Yu Mincho', + 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', 'Songti TC', 'Songti SC', + SimSun, 'Nanum Myeongjo', NanumMyeongjo, Batang, serif; + --theme_light-font_mono: iawriter-mono, Nitti, Menlo, Courier, monospace; + --theme_light-font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, + Courier, monospace; + --theme_light-dragarea: #e6e6e6; --theme_light-button_hover: rgb(239, 239, 239); --theme_light-button_hover-border: transparent; @@ -21,25 +33,42 @@ /** dark **/ --theme_dark-main: rgb(47, 52, 55); + --theme_dark-main-height: 100%; --theme_dark-sidebar: rgb(55, 60, 63); --theme_dark-dragarea: #272d2f; - --theme_dark-primary: rgb(46, 170, 220); - --theme_dark-primary_hover: rgb(6, 156, 205); - --theme_dark-primary_click: rgb(0, 141, 190); - --theme_dark-primary_indicator: rgb(235, 87, 87); + --theme_dark-preview-width: 977px; + --theme_dark-preview_banner-height: 20vh; + --theme_dark-page_banner-height: 30vh; - --theme_dark-card: rgb(63, 68, 71); - --theme_dark-card_border: rgb(63, 68, 71); - --theme_dark-button_hover: rgb(71, 76, 80); - --theme_dark-button_close: #e81123; - --theme_dark-button_close-fill: white; - --theme_dark-button_hover-border: transparent; - --theme_dark-table_border: rgba(255, 255, 255, 0.1); + --theme_dark-font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', + Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', + 'Segoe UI Symbol'; + --theme_dark-font_serif: Lyon-Text, Georgia, YuMincho, 'Yu Mincho', + 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', 'Songti TC', 'Songti SC', + SimSun, 'Nanum Myeongjo', NanumMyeongjo, Batang, serif; + --theme_dark-font_mono: iawriter-mono, Nitti, Menlo, Courier, monospace; + --theme_dark-font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, + Courier, monospace; --theme_dark-scrollbar: #505457; --theme_dark-scrollbar-border: transparent; --theme_dark-scrollbar_hover: #696d6f; + --theme_dark-card: rgb(63, 68, 71); + --theme_dark-card-border: rgb(63, 68, 71); + --theme_dark-table-border: rgba(255, 255, 255, 0.1); + --theme_dark-button_hover: rgb(71, 76, 80); + --theme_dark-button_close: #e81123; + --theme_dark-button_close-fill: white; + --theme_dark-button_hover-border: transparent; + + --theme_dark-block-selected: rgba(139, 220, 46, 0.2); + --theme_dark-primary: rgb(46, 170, 220); + --theme_dark-primary_hover: rgb(6, 156, 205); + --theme_dark-primary_click: rgb(0, 141, 190); + --theme_dark-primary_indicator: rgb(235, 87, 87); + + --theme_dark-text: rgba(255, 255, 255, 0.9); --theme_dark-text_gray: rgba(151, 154, 155, 0.95); --theme_dark-text_brown: rgb(147, 114, 100); --theme_dark-text_orange: rgb(255, 163, 68); @@ -67,9 +96,24 @@ --theme_dark-line_purple: rgb(68, 63, 87); --theme_dark-line_pink: rgb(83, 59, 76); --theme_dark-line_red: rgb(89, 65, 65); + + --theme_dark-text_code: rgba(255, 255, 255, 0.9); + --theme_dark-code-background: rgb(63, 68, 71); + --theme_dark-code_function: rgba(255, 255, 255, 0.9); + --theme_dark-code_keyword: hsl(350, 40%, 70%); + --theme_dark-code_tag: hsl(350, 40%, 70%); + --theme_dark-code_operator: hsl(40, 90%, 60%); + --theme_dark-code_builtin: hsl(75, 70%, 60%); + --theme_dark-code_attr-name: hsl(75, 70%, 60%); + --theme_dark-code_comment: hsl(30, 20%, 50%); + --theme_dark-code_punctuation: rgba(255, 255, 255, 0.9); + --theme_dark-code_doctype: hsl(30, 20%, 50%); + --theme_dark-code_number: hsl(350, 40%, 70%); + --theme_dark-code_string: hsl(75, 70%, 60%); + --theme_dark-code_attr-value: hsl(350, 40%, 70%); } -/** backgrounds **/ +/** general ui **/ .notion-dark-theme [style*='background: rgb(55, 60, 63)'], .notion-dark-theme [style*='background: rgba(69, 75, 78, 0.3)'] { @@ -80,12 +124,108 @@ background: var(--theme_dark-main) !important; } +.notion-dark-theme .notion-frame { + height: var(--theme_dark-main-height) !important; +} +.notion-light-theme .notion-frame { + height: var(--theme_light-main-height) !important; +} + +.notion-peek-renderer > div:nth-child(2) { + max-width: var(--theme_dark-preview-width) !important; +} +.notion-peek-renderer + .notion-scroller.vertical + [style*='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 20vh;'], +.notion-peek-renderer + .notion-scroller.vertical + [style*='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 20vh;'] + img { + height: var(--theme_dark-preview_banner-height) !important; +} +[style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'], +[style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'] + img { + height: var(--theme_dark-page_banner-height) !important; +} + +.notion-dark-theme [style*='Segoe UI'] { + font-family: var(--theme_dark-font_sans) !important; +} +.notion-dark-theme [style*='Georgia'] { + font-family: var(--theme_dark-font_serif) !important; +} +.notion-dark-theme [style*='iawriter-mono'] { + font-family: var(--theme_dark-font_mono) !important; +} +.notion-dark-theme [style*='SFMono-Regular'] { + font-family: var(--theme_dark-font_code) !important; +} + +.notion-light-theme [style*='Segoe UI'] { + font-family: var(--theme_light-font_sans) !important; +} +.notion-light-theme [style*='Georgia'] { + font-family: var(--theme_light-font_serif) !important; +} +.notion-light-theme [style*='iawriter-mono'] { + font-family: var(--theme_light-font_mono) !important; +} +.notion-light-theme [style*='SFMono-Regular'] { + font-family: var(--theme_light-font_code) !important; +} + /** databases **/ -.notion-dark-theme [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px'] { - box-shadow: none !important; +.notion-dark-theme [style*='background: rgb(63, 68, 71)'] { + background: var(--theme_dark-card) !important; } -.notion-dark-theme .notion-table-view > :first-child > :first-child, +.notion-dark-theme .notion-frame [style*='background: rgb(63, 68, 71)'] { + border: 0.5px solid var(--theme_dark-card-border); +} + +.notion-dark-theme + [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px, rgba(255, 255, 255, 0.14) 0px 1px 0px'] { + box-shadow: var(--theme_dark-main) -3px 0px 0px, + var(--theme_dark-table-border) 0px 1px 0px !important; +} + +.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255, 0.14)'], +.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255, 0.07)'] { + border-top: 1px solid var(--theme_dark-table-border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) -1px 0px 0px'] { + box-shadow: var(--theme_dark-table-border) -1px 0px 0px !important; +} +.notion-dark-theme + [style*='border-bottom: 1px solid rgba(255, 255, 255, 0.14)'], +.notion-dark-theme + [style*='border-bottom: 1px solid rgba(255, 255, 255, 0.07)'] { + border-bottom: 1px solid var(--theme_dark-table-border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px'] { + box-shadow: var(--theme_dark-table-border) 0px 1px 0px !important; +} +.notion-dark-theme [style*='border-right: 1px solid rgba(255, 255, 255, 0.14)'], +.notion-dark-theme + [style*='border-right: 1px solid rgba(255, 255, 255, 0.07)'] { + border-right: 1px solid var(--theme_dark-table-border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { + box-shadow: var(--theme_dark-table-border) 0px -1px 0px !important; +} +.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255, 0.14)'], +.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255, 0.07)'] { + border-left: 1px solid var(--theme_dark-table-border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'] { + box-shadow: var(--theme_dark-table-border) 0px 1px 0px inset !important; +} + .notion-dark-theme [style*='background: rgb(71, 76, 80)'], .notion-dark-theme [style*='background: rgb(80, 85, 88)'], .notion-dark-theme [style*='background: rgb(98, 102, 104)'] { @@ -93,51 +233,39 @@ box-shadow: 0 0 0 0.5px var(--theme_dark-button_hover-border); } -.notion-dark-theme [style*='background: rgb(63, 68, 71)'] { - background: var(--theme_dark-card) !important; +/* fix inline-tables in pages */ +.notion-page-content .notion-collection_view-block { + width: 100% !important; } -.notion-dark-theme .notion-frame [style*='background: rgb(63, 68, 71)'] { - border: 0.5px solid var(--theme_dark-card_border); +.notion-page-content .notion-collection_view-block > div:first-child { + padding-left: 0px !important; + padding-right: 0px !important; } - -.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255, 0.14)'], -.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255, 0.07)'] { - border-top: 1px solid var(--theme_dark-table_border) !important; +.notion-page-content + .notion-collection_view-block + [style*='min-width: calc(100% - 192px);'], +.notion-page-content + .notion-collection_view-block + [style*='min-width: 708px;'] { + min-width: 100% !important; } -.notion-dark-theme - [style*='box-shadow: rgba(255, 255, 255, 0.14) -1px 0px 0px'] { - box-shadow: var(--theme_dark-table_border) -1px 0px 0px !important; -} -.notion-dark-theme - [style*='border-bottom: 1px solid rgba(255, 255, 255, 0.14)'], -.notion-dark-theme - [style*='border-bottom: 1px solid rgba(255, 255, 255, 0.07)'] { - border-bottom: 1px solid var(--theme_dark-table_border) !important; -} -.notion-dark-theme - [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px'] { - box-shadow: var(--theme_dark-table_border) 0px 1px 0px !important; -} -.notion-dark-theme [style*='border-right: 1px solid rgba(255, 255, 255, 0.14)'], -.notion-dark-theme - [style*='border-right: 1px solid rgba(255, 255, 255, 0.07)'] { - border-right: 1px solid var(--theme_dark-table_border) !important; -} -.notion-dark-theme - [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { - box-shadow: var(--theme_dark-table_border) 0px -1px 0px !important; -} -.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255, 0.14)'], -.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255, 0.07)'] { - border-left: 1px solid var(--theme_dark-table_border) !important; -} -.notion-dark-theme - [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'] { - box-shadow: var(--theme_dark-table_border) 0px 1px 0px inset !important; +.notion-page-content .notion-collection_view-block .notion-table-view { + padding-left: 0px !important; + padding-right: 0px !important; } /** colours **/ +[style*='background: rgba(46, 170, 220, 0.2)'], +[style*='background-color: rgba(46, 170, 220, 0.2)'] { + background: var(--theme_dark-block-selected) !important; +} + +.notion-dark-theme .notion-page-content [style*='color: inherit;'], +.notion-dark-theme .notion-frame .notion-page-block { + color: var(--theme_dark-text) !important; +} + .notion-dark-theme [style*='background: rgb(46, 170, 220)'] { background: var(--theme_dark-primary) !important; } @@ -241,3 +369,49 @@ .notion-dark-theme [style*='background: rgb(89, 65, 65)'] { background: var(--theme_dark-line_red) !important; } + +/* code */ + +.notion-dark-theme + [style*='flex-grow: 1; border-radius: 3px; text-align: left; position: relative; background: rgb(63, 68, 71); min-width: 0px; width: 100%;'] { + background: var(--theme_dark-code-background) !important; +} +.notion-dark-theme .notion-code-block > div { + color: var(--theme_dark-text_code) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.function { + color: var(--theme_dark-code_function) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.keyword { + color: var(--theme_dark-code_keyword) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.tag { + color: var(--theme_dark-code_tag) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.operator { + color: var(--theme_dark-code_operator) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.builtin { + color: var(--theme_dark-code_builtin) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.attr-name { + color: var(--theme_dark-code_attr-name) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.attr-value { + color: var(--theme_dark-code_attr-value) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.comment { + color: var(--theme_dark-code_comment) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.punctuation { + color: var(--theme_dark-code_punctuation) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.doctype { + color: var(--theme_dark-code_doctype) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.number { + color: var(--theme_dark-code_number) !important; +} +.notion-dark-theme .notion-dark-theme .notion-code-block .token.string { + color: var(--theme_dark-code_string) !important; +} From 2f74449189898d424c39b711a2f4a0e93806ebed Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Fri, 24 Jul 2020 23:52:21 +1000 Subject: [PATCH 014/371] dark theme variables complete (?) + scrollbar fix + titlebar tweaks --- repo/bracketed-links/styles.css | 24 +++++ repo/core/{titlebar.js => client.js} | 31 ++++-- repo/core/dragarea.js | 7 +- repo/core/mod.js | 4 +- repo/core/theme.css | 137 ++++++++++++++++++++------- repo/core/titlebar.css | 17 ++++ 6 files changed, 175 insertions(+), 45 deletions(-) create mode 100644 repo/bracketed-links/styles.css rename repo/core/{titlebar.js => client.js} (83%) diff --git a/repo/bracketed-links/styles.css b/repo/bracketed-links/styles.css new file mode 100644 index 0000000..3087e62 --- /dev/null +++ b/repo/bracketed-links/styles.css @@ -0,0 +1,24 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 Arecsu + * (https://dragonwocky.me/) under the MIT license + */ + +.notion-link-token span { + border-bottom: none !important; +} +.notion-link-token:before { + content: '['; + opacity: 0.7; + transition: opacity 100ms ease-in; +} +.notion-link-token:after { + content: ']'; + opacity: 0.7; + transition: opacity 100ms ease-in; +} +.notion-link-token:hover::before, +.notion-link-token:hover::after { + opacity: 1; +} diff --git a/repo/core/titlebar.js b/repo/core/client.js similarity index 83% rename from repo/core/titlebar.js rename to repo/core/client.js index aa3e711..ecdfb4b 100644 --- a/repo/core/titlebar.js +++ b/repo/core/client.js @@ -19,14 +19,29 @@ module.exports = (defaults) => if (event.code === 'F5') window.reload(); }); - const attempt = setInterval(enhance, 500); + const interval_attempts = { + enhance: setInterval(enhance, 500), + }; async function enhance() { if (!document.querySelector('.notion-frame')) return; - clearInterval(attempt); + clearInterval(interval_attempts.enhance); // scrollbars - if (settings.smooth_scrollbars) + if (settings.smooth_scrollbars) { document.body.classList.add('smooth-scrollbars'); + interval_attempts.patchScrollbars = setInterval(patchScrollbars, 50); + function patchScrollbars() { + const sidebar = document.querySelector( + '.notion-scroller.vertical[style*="overflow: hidden auto;"]' + ); + if (!sidebar) return; + clearInterval(interval_attempts.patchScrollbars); + sidebar.style.overflow = ''; + setTimeout(() => { + sidebar.style.overflow = 'hidden auto'; + }, 1); + } + } // frameless if (settings.frameless) { @@ -38,11 +53,14 @@ module.exports = (defaults) => document.querySelector('.notion-topbar').prepend(dragarea); document.documentElement.style.setProperty( '--configured-dragarea_height', - `${settings.dragarea_height}px` + `${settings.dragarea_height + 2}px` ); let sidebar_width; - setInterval(() => { + interval_attempts.patchDragarea = setInterval(patchDragarea, 50); + function patchDragarea() { const sidebar = document.querySelector('.notion-sidebar'); + if (!sidebar) return; + clearInterval(interval_attempts.patchDragarea); let new_width = sidebar.style.height === 'auto' ? '0px' : sidebar.style.width; if (sidebar_width !== new_width) { @@ -51,7 +69,8 @@ module.exports = (defaults) => `enhancer:sidebar-width-${sidebar_width}` ); } - }, 100); + } + setInterval(() => {}, 100); } // window buttons diff --git a/repo/core/dragarea.js b/repo/core/dragarea.js index b204f4b..13656c1 100644 --- a/repo/core/dragarea.js +++ b/repo/core/dragarea.js @@ -22,8 +22,11 @@ module.exports = (defaults) => if (event.channel.startsWith('enhancer:sidebar-width-')) dragarea.setAttribute( 'style', - `${default_styles} height: ${settings.dragarea_height}px; left: ${ - event.channel.slice('enhancer:sidebar-width-'.length)};` + `${default_styles} top: 2px; height: ${ + settings.dragarea_height + }px; left: ${event.channel.slice( + 'enhancer:sidebar-width-'.length + )};` ); }); }; diff --git a/repo/core/mod.js b/repo/core/mod.js index 813df8d..5e6ed8c 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -9,7 +9,7 @@ const defaults = { maximized: false, close_to_tray: true, frameless: true, - dragarea_height: 12.5, + dragarea_height: 15, smooth_scrollbars: true, hotkey: 'CmdOrCtrl+Shift+A', }; @@ -29,6 +29,6 @@ module.exports = { 'main/main.js': require('./tray.js')(defaults), 'main/createWindow.js': require('./window.js')(defaults), 'renderer/index.js': require('./dragarea.js')(defaults), - 'renderer/preload.js': require('./titlebar.js')(defaults), + 'renderer/preload.js': require('./client.js')(defaults), }, }; diff --git a/repo/core/theme.css b/repo/core/theme.css index 04dcf82..97a8854 100644 --- a/repo/core/theme.css +++ b/repo/core/theme.css @@ -2,14 +2,14 @@ * notion-enhancer * (c) 2020 dragonwocky * (c) 2020 TarasokUA + * (c) 2020 Arecsu + * (c) 2020 u/zenith_illinois * (https://dragonwocky.me/) under the MIT license */ :root { /** light **/ - --theme_light-main-height: 100%; - --theme_light-font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; @@ -33,7 +33,6 @@ /** dark **/ --theme_dark-main: rgb(47, 52, 55); - --theme_dark-main-height: 100%; --theme_dark-sidebar: rgb(55, 60, 63); --theme_dark-dragarea: #272d2f; --theme_dark-preview-width: 977px; @@ -62,13 +61,23 @@ --theme_dark-button_close-fill: white; --theme_dark-button_hover-border: transparent; - --theme_dark-block-selected: rgba(139, 220, 46, 0.2); + --theme_dark-selected: rgba(46, 170, 220, 0.2); --theme_dark-primary: rgb(46, 170, 220); --theme_dark-primary_hover: rgb(6, 156, 205); --theme_dark-primary_click: rgb(0, 141, 190); --theme_dark-primary_indicator: rgb(235, 87, 87); + --theme_dark-todo_empty-border: currentColor; + --theme_dark-todo_ticked: currentColor; + --theme_dark-todo_ticked-background: var(--theme_dark-primary); + --theme_dark-todo_hover-background: rgb(71, 76, 80); + + --theme_dark-danger_text: rgb(235, 87, 87); + --theme_dark-danger_border: rgba(235, 87, 87, 0.5); + --theme_dark-text: rgba(255, 255, 255, 0.9); + --theme_dark-text_ui: rgba(255, 255, 255, 0.6); + --theme_dark-text_ui_dark: rgba(255, 255, 255, 0.4); --theme_dark-text_gray: rgba(151, 154, 155, 0.95); --theme_dark-text_brown: rgb(147, 114, 100); --theme_dark-text_orange: rgb(255, 163, 68); @@ -97,7 +106,9 @@ --theme_dark-line_pink: rgb(83, 59, 76); --theme_dark-line_red: rgb(89, 65, 65); - --theme_dark-text_code: rgba(255, 255, 255, 0.9); + --theme_dark-code_inline-text: #eb5757; + --theme_dark-code_inline-background: rgba(135, 131, 120, 0.15); + --theme_dark-code_text: rgba(255, 255, 255, 0.9); --theme_dark-code-background: rgb(63, 68, 71); --theme_dark-code_function: rgba(255, 255, 255, 0.9); --theme_dark-code_keyword: hsl(350, 40%, 70%); @@ -120,17 +131,11 @@ background: var(--theme_dark-sidebar) !important; } .notion-body.dark, -.notion-dark-theme [style*='background: rgb(47, 52, 55)'] { +.notion-dark-theme [style*='background: rgb(47, 52, 55)'], +.notion-dark-theme [style*='background-color: rgb(47, 52, 55)'] { background: var(--theme_dark-main) !important; } -.notion-dark-theme .notion-frame { - height: var(--theme_dark-main-height) !important; -} -.notion-light-theme .notion-frame { - height: var(--theme_light-main-height) !important; -} - .notion-peek-renderer > div:nth-child(2) { max-width: var(--theme_dark-preview-width) !important; } @@ -175,6 +180,14 @@ font-family: var(--theme_light-font_code) !important; } +/* prevent block hover options overlaying topbar */ +*:not([style*='z-index']) { + z-index: 1; +} +.notion-dark-theme .notion-topbar { + background: var(--theme_dark-main); +} + /** databases **/ .notion-dark-theme [style*='background: rgb(63, 68, 71)'] { @@ -184,41 +197,37 @@ border: 0.5px solid var(--theme_dark-card-border); } +.notion-dark-theme [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px'] { + box-shadow: var(--theme_dark-main) -3px 0px 0px !important; +} .notion-dark-theme [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px, rgba(255, 255, 255, 0.14) 0px 1px 0px'] { box-shadow: var(--theme_dark-main) -3px 0px 0px, var(--theme_dark-table-border) 0px 1px 0px !important; } -.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255, 0.14)'], -.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255, 0.07)'] { +.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255,'] { border-top: 1px solid var(--theme_dark-table-border) !important; } .notion-dark-theme [style*='box-shadow: rgba(255, 255, 255, 0.14) -1px 0px 0px'] { box-shadow: var(--theme_dark-table-border) -1px 0px 0px !important; } -.notion-dark-theme - [style*='border-bottom: 1px solid rgba(255, 255, 255, 0.14)'], -.notion-dark-theme - [style*='border-bottom: 1px solid rgba(255, 255, 255, 0.07)'] { +.notion-dark-theme [style*='border-bottom: 1px solid rgba(255, 255, 255,'] { border-bottom: 1px solid var(--theme_dark-table-border) !important; } .notion-dark-theme [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px'] { box-shadow: var(--theme_dark-table-border) 0px 1px 0px !important; } -.notion-dark-theme [style*='border-right: 1px solid rgba(255, 255, 255, 0.14)'], -.notion-dark-theme - [style*='border-right: 1px solid rgba(255, 255, 255, 0.07)'] { +.notion-dark-theme [style*='border-right: 1px solid rgba(255, 255, 255,'] { border-right: 1px solid var(--theme_dark-table-border) !important; } .notion-dark-theme [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { box-shadow: var(--theme_dark-table-border) 0px -1px 0px !important; } -.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255, 0.14)'], -.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255, 0.07)'] { +.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255,'] { border-left: 1px solid var(--theme_dark-table-border) !important; } .notion-dark-theme @@ -233,7 +242,16 @@ box-shadow: 0 0 0 0.5px var(--theme_dark-button_hover-border); } -/* fix inline-tables in pages */ +.notion-calendar-view-day, +.DayPicker-Day--today:not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end), +.DayPicker-Day.DayPicker-Day--start.DayPicker-Day--selected, +.DayPicker:not(.DayPicker--interactionDisabled) .DayPicker-Day--outside:hover, +.DayPicker:not(.DayPicker--interactionDisabled) + .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end) { + transition: all 200ms ease !important; +} + +/* fix inline-tables in pages (?) */ .notion-page-content .notion-collection_view-block { width: 100% !important; } @@ -256,29 +274,68 @@ /** colours **/ -[style*='background: rgba(46, 170, 220, 0.2)'], -[style*='background-color: rgba(46, 170, 220, 0.2)'] { - background: var(--theme_dark-block-selected) !important; +.notion-dark-theme ::selection, +.notion-dark-theme [style*='background: rgba(46, 170, 220,'], +.notion-dark-theme [style*='background-color: rgba(46, 170, 220,'] { + background: var(--theme_dark-selected) !important; } -.notion-dark-theme .notion-page-content [style*='color: inherit;'], -.notion-dark-theme .notion-frame .notion-page-block { - color: var(--theme_dark-text) !important; -} - -.notion-dark-theme [style*='background: rgb(46, 170, 220)'] { +.notion-dark-theme [style*='background: rgb(46, 170, 220)'], +.notion-dark-theme [style*='background-color: rgb(46, 170, 220)'] { background: var(--theme_dark-primary) !important; } +.notion-dark-theme + [style*='box-shadow: rgb(46, 170, 220) 0px 0px 0px 2px inset'] { + box-shadow: var(--theme_dark-primary) 0px 0px 0px 2px inset !important; +} .notion-dark-theme [style*='background: rgb(6, 156, 205)'] { background: var(--theme_dark-primary_hover) !important; } .notion-dark-theme [style*='background: rgb(0, 141, 190)'] { background: var(--theme_dark-primary_click) !important; } +.notion-dark-theme + .DayPicker-Day--today:not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end)::after, .notion-dark-theme [style*='background: rgb(235, 87, 87)'] { background: var(--theme_dark-primary_indicator) !important; } +.notion-dark-theme .notion-to_do-block .checkboxSquare path { + fill: var(--theme_dark-todo_empty-border) !important; +} +.notion-dark-theme .notion-to_do-block .check polygon { + fill: var(--theme_dark-todo_ticked-fill) !important; +} +.notion-dark-theme + .notion-to_do-block + [style*='background: rgb(46, 170, 220)'] { + background: var(--theme_dark-todo_ticked-background) !important; +} +.notion-to_do-block > div > div > div[style*='background:'] { + transition: background 200ms ease !important; +} +.notion-dark-theme .notion-to_do-block [style*='background: rgb(71, 76, 80)'] { + background: var(--theme_dark-todo_hover-background) !important; +} + +.notion-dark-theme + [style*='color: rgb(235, 87, 87); border: 1px solid rgba(235, 87, 87, 0.5);'] { + color: var(--theme_dark-danger_text) !important; + border: 1px solid var(--theme_dark-danger_border) !important; +} + +.notion-dark-theme, +.notion-dark-theme .notion-page-content [style*='color: inherit;'], +.notion-dark-theme .notion-frame .notion-page-block { + color: var(--theme_dark-text) !important; +} +.notion-dark-theme [style*='color: rgba(255, 255, 255, 0.6)'] { + color: var(--theme_dark-text_ui) !important; +} +.notion-dark-theme [style*='color: rgba(255, 255, 255, 0.4)'] { + color: var(--theme_dark-text_ui_dark) !important; +} + .notion-dark-theme [style*='color:rgba(151,154,155,0.95)'] { color: var(--theme_dark-text_gray) !important; } @@ -370,14 +427,24 @@ background: var(--theme_dark-line_red) !important; } +/* fix highlight padding: this isn't a typo */ +[style*='background:rgb('] { + padding-bottom: 3px !important; +} + /* code */ +.notion-dark-theme [style*='color:#EB5757'] { + color: var(--theme_dark-code_inline-text) !important; + background: var(--theme_dark-code_inline-background) !important; +} + .notion-dark-theme [style*='flex-grow: 1; border-radius: 3px; text-align: left; position: relative; background: rgb(63, 68, 71); min-width: 0px; width: 100%;'] { background: var(--theme_dark-code-background) !important; } .notion-dark-theme .notion-code-block > div { - color: var(--theme_dark-text_code) !important; + color: var(--theme_dark-code_text) !important; } .notion-dark-theme .notion-dark-theme .notion-code-block .token.function { color: var(--theme_dark-code_function) !important; diff --git a/repo/core/titlebar.css b/repo/core/titlebar.css index 83f5810..2296df4 100644 --- a/repo/core/titlebar.css +++ b/repo/core/titlebar.css @@ -2,6 +2,7 @@ * notion-enhancer * (c) 2020 dragonwocky * (c) 2020 TarasokUA + * (c) 2020 Arecsu * (https://dragonwocky.me/) under the MIT license */ @@ -93,3 +94,19 @@ background: var(--theme_light-button_hover); box-shadow: 0 0 0 0.5px var(--theme_light-button_hover-border); } + +/* hide topbar when sidebar is hidden */ +.notion-sidebar-container[style*='width: 0px;'] + .notion-frame { + height: calc( + 100% - (var(--configured-dragarea_height, 10px) + 45px) + ) !important; +} +.notion-sidebar-container[style*='width: 0px;'] + .notion-frame .notion-topbar { + opacity: 0 !important; + transition: opacity 200ms ease-in-out !important; +} +.notion-sidebar-container[style*='width: 0px;'] + + .notion-frame + .notion-topbar:hover { + opacity: 1 !important; +} From 771aa0b493b3595375b384303d9d33f8a04f471f Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sat, 25 Jul 2020 11:29:39 +1000 Subject: [PATCH 015/371] dark theme bugfixes: focused input borders, weird lines in tables --- repo/core/theme.css | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/repo/core/theme.css b/repo/core/theme.css index 97a8854..baf2ada 100644 --- a/repo/core/theme.css +++ b/repo/core/theme.css @@ -250,6 +250,9 @@ .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end) { transition: all 200ms ease !important; } +.notion-token-remove-button { + transition: opacity 200ms ease !important; +} /* fix inline-tables in pages (?) */ .notion-page-content .notion-collection_view-block { @@ -275,8 +278,10 @@ /** colours **/ .notion-dark-theme ::selection, -.notion-dark-theme [style*='background: rgba(46, 170, 220,'], -.notion-dark-theme [style*='background-color: rgba(46, 170, 220,'] { +.notion-dark-theme + [style*='background: rgba(46, 170, 220,']:not([style*='background: rgba(46, 170, 220, 0)']), +.notion-dark-theme + [style*='background-color: rgba(46, 170, 220,']:not([style*='background-color: rgba(46, 170, 220, 0)']) { background: var(--theme_dark-selected) !important; } @@ -288,6 +293,10 @@ [style*='box-shadow: rgb(46, 170, 220) 0px 0px 0px 2px inset'] { box-shadow: var(--theme_dark-primary) 0px 0px 0px 2px inset !important; } +.notion-dark-theme .notion-focusable:focus-within { + box-shadow: var(--theme_dark-primary) 0px 0px 0px 1px inset, + var(--theme_dark-primary_hover) 0px 0px 0px 2px !important; +} .notion-dark-theme [style*='background: rgb(6, 156, 205)'] { background: var(--theme_dark-primary_hover) !important; } From 5c84fbebb673848b6a34516d0e1e41dfcc88f91c Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sat, 25 Jul 2020 15:16:15 +1000 Subject: [PATCH 016/371] light 90% + other tweaks --- repo/core/client.js | 1 - repo/core/dark.css | 330 ++++++++++++++++++++++++++ repo/core/light.css | 330 ++++++++++++++++++++++++++ repo/core/scrollbars.css | 12 +- repo/core/shared.css | 50 ++++ repo/core/styles.css | 6 +- repo/core/theme.css | 493 --------------------------------------- repo/core/titlebar.css | 20 +- repo/core/variables.css | 200 ++++++++++++++++ 9 files changed, 930 insertions(+), 512 deletions(-) create mode 100644 repo/core/dark.css create mode 100644 repo/core/light.css create mode 100644 repo/core/shared.css delete mode 100644 repo/core/theme.css create mode 100644 repo/core/variables.css diff --git a/repo/core/client.js b/repo/core/client.js index ecdfb4b..8a9676a 100644 --- a/repo/core/client.js +++ b/repo/core/client.js @@ -70,7 +70,6 @@ module.exports = (defaults) => ); } } - setInterval(() => {}, 100); } // window buttons diff --git a/repo/core/dark.css b/repo/core/dark.css new file mode 100644 index 0000000..9576d08 --- /dev/null +++ b/repo/core/dark.css @@ -0,0 +1,330 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (c) 2020 Arecsu + * (c) 2020 u/zenith_illinois + * (https://dragonwocky.me/) under the MIT license + */ + +/** general ui **/ + +.notion-dark-theme [style*='background: rgb(55, 60, 63)'], +.notion-dark-theme [style*='background: rgba(69, 75, 78, 0.3)'] { + background: var(--theme_dark--sidebar) !important; +} +.notion-body.dark, +.notion-dark-theme [style*='background: rgb(47, 52, 55)'], +.notion-dark-theme [style*='background-color: rgb(47, 52, 55)'] { + background: var(--theme_dark--main) !important; +} + +.notion-dark-theme .notion-peek-renderer > div:nth-child(2) { + max-width: var(--theme_dark--preview-width) !important; +} +.notion-dark-theme + .notion-peek-renderer + .notion-scroller.vertical + [style*='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 20vh;'], +.notion-dark-theme + .notion-peek-renderer + .notion-scroller.vertical + [style*='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 20vh;'] + img { + height: var(--theme_dark--preview_banner-height) !important; +} +.notion-dark-theme + [style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'], +.notion-dark-theme + [style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'] + img { + height: var(--theme_dark--page_banner-height) !important; +} + +.notion-dark-theme [style*='Segoe UI'] { + font-family: var(--theme_dark--font_sans) !important; +} +.notion-dark-theme [style*='Georgia'] { + font-family: var(--theme_dark--font_serif) !important; +} +.notion-dark-theme [style*='iawriter-mono'] { + font-family: var(--theme_dark--font_mono) !important; +} +.notion-dark-theme [style*='SFMono-Regular'] { + font-family: var(--theme_dark--font_code) !important; +} + +/* prevent block hover options overlaying topbar */ +.notion-dark-theme .notion-topbar { + background: var(--theme_dark--main); +} + +/** databases **/ + +.notion-dark-theme [style*='background: rgb(63, 68, 71)'] { + background: var(--theme_dark--card) !important; +} +.notion-dark-theme .notion-frame [style*='background: rgb(63, 68, 71)'] { + border: 0.5px solid var(--theme_dark--card-border); +} + +.notion-dark-theme [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px'] { + box-shadow: var(--theme_dark--main) -3px 0px 0px !important; +} +.notion-dark-theme + [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px, rgba(255, 255, 255, 0.14) 0px 1px 0px'] { + box-shadow: var(--theme_dark--main) -3px 0px 0px, + var(--theme_dark--table-border) 0px 1px 0px !important; +} + +.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255,'] { + border-top: 1px solid var(--theme_dark--table-border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) -1px 0px 0px'] { + box-shadow: var(--theme_dark--table-border) -1px 0px 0px !important; +} +.notion-dark-theme [style*='border-bottom: 1px solid rgba(255, 255, 255,'] { + border-bottom: 1px solid var(--theme_dark--table-border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px'] { + box-shadow: var(--theme_dark--table-border) 0px 1px 0px !important; +} +.notion-dark-theme [style*='border-right: 1px solid rgba(255, 255, 255,'] { + border-right: 1px solid var(--theme_dark--table-border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { + box-shadow: var(--theme_dark--table-border) 0px -1px 0px !important; +} +.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255,'] { + border-left: 1px solid var(--theme_dark--table-border) !important; +} +.notion-dark-theme + [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'] { + box-shadow: var(--theme_dark--table-border) 0px 1px 0px inset !important; +} + +.notion-dark-theme [style*='background: rgb(71, 76, 80)'], +.notion-dark-theme [style*='background: rgb(80, 85, 88)'] { + background: var(--theme_dark--button_hover) !important; + box-shadow: 0 0 0 0.5px var(--theme_dark--button_hover-border); +} + +/** colours **/ + +.notion-dark-theme ::selection, +.notion-dark-theme + [style*='background: rgba(46, 170, 220,']:not([style*='background: rgba(46, 170, 220, 0)']), +.notion-dark-theme + [style*='background-color: rgba(46, 170, 220,']:not([style*='background-color: rgba(46, 170, 220, 0)']) { + background: var(--theme_dark--selected) !important; +} + +.notion-dark-theme [style*='background: rgb(46, 170, 220)'], +.notion-dark-theme [style*='background-color: rgb(46, 170, 220)'] { + background: var(--theme_dark--primary) !important; +} +.notion-dark-theme + [style*='box-shadow: rgb(46, 170, 220) 0px 0px 0px 2px inset'] { + box-shadow: var(--theme_dark--primary) 0px 0px 0px 2px inset !important; +} +.notion-dark-theme .notion-focusable:focus-within { + box-shadow: var(--theme_dark--primary) 0px 0px 0px 1px inset, + var(--theme_dark--primary_hover) 0px 0px 0px 2px !important; +} +.notion-dark-theme [style*='background: rgb(6, 156, 205)'] { + background: var(--theme_dark--primary_hover) !important; +} +.notion-dark-theme [style*='background: rgb(0, 141, 190)'] { + background: var(--theme_dark--primary_click) !important; +} +.notion-dark-theme + .DayPicker-Day--today:not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end)::after, +.notion-dark-theme [style*='background: rgb(235, 87, 87)'] { + background: var(--theme_dark--primary_indicator) !important; +} + +.notion-dark-theme .notion-to_do-block .checkboxSquare path { + fill: var(--theme_dark--todo_empty-border) !important; +} +.notion-dark-theme .notion-to_do-block .check polygon { + fill: var(--theme_dark--todo_ticked-fill) !important; +} +.notion-dark-theme + .notion-to_do-block + [style*='background: rgb(46, 170, 220)'] { + background: var(--theme_dark--todo_ticked-background) !important; +} +.notion-dark-theme .notion-to_do-block [style*='background: rgb(71, 76, 80)'] { + background: var(--theme_dark--todo_hover-background) !important; +} + +.notion-dark-theme + [style*='color: rgb(235, 87, 87); border: 1px solid rgba(235, 87, 87, 0.5);'] { + color: var(--theme_dark--danger_text) !important; + border: 1px solid var(--theme_dark--danger_border) !important; +} + +.notion-dark-theme, +.notion-dark-theme .notion-page-content [style*='color: inherit;'], +.notion-dark-theme .notion-frame .notion-page-block, +.notion-dark-theme [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme [style*='color: rgba(255, 255, 255, 0.7)'] { + color: var(--theme_dark--text) !important; +} +.notion-dark-theme [style*='color: rgba(255, 255, 255, 0.6)'] { + color: var(--theme_dark--text_ui) !important; +} +.notion-dark-theme [style*='color: rgba(255, 255, 255, 0.4)'] { + color: var(--theme_dark--text_ui_info) !important; +} +.notion-dark-theme [style*='fill: rgba(202, 204, 206,'], +.notion-dark-theme [style*='fill: rgb(202, 204, 206)'] { + fill: var(--theme_dark--text_ui) !important; +} + +.notion-dark-theme [style*='color:rgba(151,154,155,0.95)'] { + color: var(--theme_dark--text_gray) !important; +} +.notion-dark-theme [style*='background: rgba(151, 154, 155, 0.5)'], +.notion-dark-theme [style*='background:rgb(69,75,78)'] { + background: var(--theme_dark--bg_gray) !important; +} +.notion-dark-theme [style*='background: rgb(69, 75, 78)'] { + background: var(--theme_dark--line_gray) !important; +} +.notion-dark-theme [style*='color:rgb(147,114,100)'] { + color: var(--theme_dark--text_brown) !important; +} +.notion-dark-theme [style*='background: rgba(147, 114, 100, 0.5)'], +.notion-dark-theme [style*='background:rgb(67,64,64)'] { + background: var(--theme_dark--bg_brown) !important; +} +.notion-dark-theme [style*='background: rgb(67, 64, 64)'] { + background: var(--theme_dark--line_brown) !important; +} +.notion-dark-theme [style*='color:rgb(255,163,68)'] { + color: var(--theme_dark--text_orange) !important; +} +.notion-dark-theme [style*='background: rgba(255, 163, 68, 0.5)'], +.notion-dark-theme [style*='background:rgb(89,74,58)'] { + background: var(--theme_dark--bg_orange) !important; +} +.notion-dark-theme [style*='background: rgb(89, 74, 58)'] { + background: var(--theme_dark--line_orange) !important; +} +.notion-dark-theme [style*='color:rgb(255,220,73)'] { + color: var(--theme_dark--text_yellow) !important; +} +.notion-dark-theme [style*='background: rgba(255, 220, 73, 0.5)'], +.notion-dark-theme [style*='background:rgb(89,86,59)'] { + background: var(--theme_dark--bg_yellow) !important; +} +.notion-dark-theme [style*='background: rgb(89, 86, 59)'] { + background: var(--theme_dark--line_yellow) !important; +} +.notion-dark-theme [style*='color:rgb(77,171,154)'] { + color: var(--theme_dark--text_green) !important; +} +.notion-dark-theme [style*='background: rgba(77, 171, 154, 0.5)'], +.notion-dark-theme [style*='background:rgb(53,76,75)'] { + background: var(--theme_dark--bg_green) !important; +} +.notion-dark-theme [style*='background: rgb(53, 76, 75)'] { + background: var(--theme_dark--line_green) !important; +} +.notion-dark-theme [style*='color:rgb(82,156,202)'] { + color: var(--theme_dark--text_blue) !important; +} +.notion-dark-theme [style*='background: rgba(82, 156, 202, 0.5)'], +.notion-dark-theme [style*='background:rgb(54,73,84)'] { + background: var(--theme_dark--bg_blue) !important; +} +.notion-dark-theme [style*='background: rgb(54, 73, 84)'] { + background: var(--theme_dark--line_blue) !important; +} +.notion-dark-theme [style*='color:rgb(154,109,215)'] { + color: var(--theme_dark--text_purple) !important; +} +.notion-dark-theme [style*='background: rgba(154, 109, 215, 0.5)'], +.notion-dark-theme [style*='background:rgb(68,63,87)'] { + background: var(--theme_dark--bg_purple) !important; +} +.notion-dark-theme [style*='background: rgb(68, 63, 87)'] { + background: var(--theme_dark--line_purple) !important; +} +.notion-dark-theme [style*='color:rgb(226,85,161)'] { + color: var(--theme_dark--text_pink) !important; +} +.notion-dark-theme [style*='background: rgba(226, 85, 161, 0.5)'], +.notion-dark-theme [style*='background:rgb(83,59,76)'] { + background: var(--theme_dark--bg_pink) !important; +} +.notion-dark-theme [style*='background: rgb(83, 59, 76)'] { + background: var(--theme_dark--line_pink) !important; +} +.notion-dark-theme [style*='color:rgb(255,115,105)'] { + color: var(--theme_dark--text_red) !important; +} +.notion-dark-theme [style*='background: rgba(255, 115, 105, 0.5);'], +.notion-dark-theme [style*='background:rgb(89,65,65)'] { + background: var(--theme_dark--bg_red) !important; +} +.notion-dark-theme [style*='background: rgb(89, 65, 65)'] { + background: var(--theme_dark--line_red) !important; +} + +/* code */ + +.notion-dark-theme [style*='color:#EB5757'] { + color: var(--theme_dark--code_inline-text) !important; + background: var(--theme_dark--code_inline-background) !important; +} + +.notion-dark-theme .notion-code-block { + background: var(--theme_dark--code-background) !important; +} +.notion-dark-theme .notion-code-block > div { + color: var(--theme_dark--code_text) !important; +} +.notion-dark-theme .notion-code-block .token.function { + color: var(--theme_dark--code_function) !important; +} +.notion-dark-theme .notion-code-block .token.keyword { + color: var(--theme_dark--code_keyword) !important; +} +.notion-dark-theme .notion-code-block .token.tag { + color: var(--theme_dark--code_tag) !important; +} +.notion-dark-theme .notion-code-block .token.operator { + color: var(--theme_dark--code_operator) !important; +} +.notion-dark-theme .notion-code-block .token.property { + color: var(--theme_dark--code_property) !important; +} +.notion-dark-theme .notion-code-block .token.builtin { + color: var(--theme_dark--code_builtin) !important; +} +.notion-dark-theme .notion-code-block .token.attr-name { + color: var(--theme_dark--code_attr-name) !important; +} +.notion-dark-theme .notion-code-block .token.attr-value { + color: var(--theme_dark--code_attr-value) !important; +} +.notion-dark-theme .notion-code-block .token.comment { + color: var(--theme_dark--code_comment) !important; +} +.notion-dark-theme .notion-code-block .token.punctuation { + color: var(--theme_dark--code_punctuation) !important; +} +.notion-dark-theme .notion-code-block .token.doctype { + color: var(--theme_dark--code_doctype) !important; +} +.notion-dark-theme .notion-code-block .token.number { + color: var(--theme_dark--code_number) !important; +} +.notion-dark-theme .notion-code-block .token.string { + color: var(--theme_dark--code_string) !important; +} diff --git a/repo/core/light.css b/repo/core/light.css new file mode 100644 index 0000000..40fd3d0 --- /dev/null +++ b/repo/core/light.css @@ -0,0 +1,330 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (c) 2020 Arecsu + * (c) 2020 u/zenith_illinois + * (https://dragonwocky.me/) under the MIT license + */ + +/** general ui **/ + +.notion-light-theme [style*='background: rgb(247, 246, 243)'], +.notion-light-theme [style*='background: rgba(235, 236, 237, 0.3)'] { + background: var(--theme_light--sidebar) !important; +} +.notion-body.light, +.notion-light-theme [style*='background: white'] { + background: var(--theme_light--main) !important; +} + +.notion-light-theme .notion-peek-renderer > div:nth-child(2) { + max-width: var(--theme_light--preview-width) !important; +} +.notion-light-theme + .notion-peek-renderer + .notion-scroller.vertical + [style*='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 20vh;'], +.notion-light-theme + .notion-peek-renderer + .notion-scroller.vertical + [style*='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 20vh;'] + img { + height: var(--theme_light--preview_banner-height) !important; +} +.notion-light-theme + [style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'], +.notion-light-theme + [style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'] + img { + height: var(--theme_light--page_banner-height) !important; +} + +.notion-light-theme [style*='Segoe UI'] { + font-family: var(--theme_light--font_sans) !important; +} +.notion-light-theme [style*='Georgia'] { + font-family: var(--theme_light--font_serif) !important; +} +.notion-light-theme [style*='iawriter-mono'] { + font-family: var(--theme_light--font_mono) !important; +} +.notion-light-theme [style*='SFMono-Regular'] { + font-family: var(--theme_light--font_code) !important; +} + +/* prevent block hover options overlaying topbar */ +.notion-light-theme .notion-topbar { + background: var(--theme_light--main); +} + +/** databases **/ + +.notion-light-theme [style*='background: rgb(247, 246, 243)'] { + background: var(--theme_light--card) !important; +} +.notion-light-theme .notion-frame [style*='background: rgb(247, 246, 243)'] { + border: 0.5px solid var(--theme_light--card-border); +} + +.notion-light-theme [style*='box-shadow: white -3px 0px 0px'] { + box-shadow: var(--theme_light--main) -3px 0px 0px !important; +} +.notion-light-theme + [style*='box-shadow: white -3px 0px 0px, rgba(55, 53, 47, 0.16) 0px 1px 0px'] { + box-shadow: var(--theme_light--main) -3px 0px 0px, + var(--theme_light--table-border) 0px 1px 0px !important; +} + +.notion-light-theme [style*='border-top: 1px solid rgba(55, 53, 47,'] { + border-top: 1px solid var(--theme_light--table-border) !important; +} +.notion-light-theme [style*='box-shadow: rgba(55, 53, 47, 0.09) -1px 0px 0px'] { + box-shadow: var(--theme_light--table-border) -1px 0px 0px !important; +} +.notion-light-theme [style*='border-bottom: 1px solid rgba(55, 53, 47,'] { + border-bottom: 1px solid var(--theme_light--table-border) !important; +} +.notion-light-theme [style*='box-shadow: rgba(55, 53, 47, 0.09) 0px 1px 0px'] { + box-shadow: var(--theme_light--table-border) 0px 1px 0px !important; +} +.notion-light-theme [style*='border-right: 1px solid rgba(55, 53, 47,'] { + border-right: 1px solid var(--theme_light--table-border) !important; +} +.notion-light-theme [style*='box-shadow: rgba(55, 53, 47, 0.09) 0px -1px 0px'] { + box-shadow: var(--theme_light--table-border) 0px -1px 0px !important; +} +.notion-light-theme [style*='border-left: 1px solid rgba(55, 53, 47,'] { + border-left: 1px solid var(--theme_light--table-border) !important; +} +.notion-light-theme + [style*='box-shadow: rgba(55, 53, 47, 0.16) 0px 1px 0px inset'] { + box-shadow: var(--theme_light--table-border) 0px 1px 0px inset !important; +} + +.notion-light-theme [style*='background: rgba(55, 53, 47,'] { + background: var(--theme_light--button_hover) !important; + box-shadow: 0 0 0 0.5px var(--theme_light--button_hover-border); +} + +/** colours **/ + +.notion-light-theme ::selection, +.notion-light-theme + [style*='background: rgba(46, 170, 220,']:not([style*='background: rgba(46, 170, 220, 0)']), +.notion-light-theme + [style*='background-color: rgba(46, 170, 220,']:not([style*='background-color: rgba(46, 170, 220, 0)']) { + background: var(--theme_light--selected) !important; +} + +.notion-light-theme [style*='background: rgb(46, 170, 220)'], +.notion-light-theme [style*='background-color: rgb(46, 170, 220)'] { + background: var(--theme_light--primary) !important; +} +.notion-light-theme + [style*='box-shadow: rgb(46, 170, 220) 0px 0px 0px 2px inset'] { + box-shadow: var(--theme_light--primary) 0px 0px 0px 2px inset !important; +} +.notion-light-theme .notion-focusable:focus-within { + box-shadow: var(--theme_light--primary) 0px 0px 0px 1px inset, + var(--theme_light--primary_hover) 0px 0px 0px 2px !important; +} +.notion-light-theme [style*='background: rgb(6, 156, 205)'] { + background: var(--theme_light--primary_hover) !important; +} +.notion-light-theme [style*='background: rgb(0, 141, 190)'] { + background: var(--theme_light--primary_click) !important; +} +.notion-light-theme + .DayPicker-Day--today:not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end)::after, +.notion-light-theme [style*='background: rgb(235, 87, 87)'] { + background: var(--theme_light--primary_indicator) !important; +} + +.notion-light-theme .notion-to_do-block .checkboxSquare path { + fill: var(--theme_light--todo_empty-border) !important; +} +.notion-light-theme .notion-to_do-block .check polygon { + fill: var(--theme_light--todo_ticked-fill) !important; +} +.notion-light-theme + .notion-to_do-block + [style*='background: rgb(46, 170, 220)'] { + background: var(--theme_light--todo_ticked-background) !important; +} +.notion-light-theme + .notion-to_do-block + [style*='background: rgba(55, 53, 47, 0.08)'] { + background: var(--theme_light--todo_hover-background) !important; +} + +.notion-light-theme + [style*='color: rgb(235, 87, 87); border: 1px solid rgba(235, 87, 87, 0.5);'] { + color: var(--theme_light--danger_text) !important; + border: 1px solid var(--theme_light--danger_border) !important; +} + +.notion-light-theme, +.notion-light-theme [style*='color:'] { + color: var(--theme_light--text) !important; +} +.notion-light-theme [style*='color: rgba(255, 255, 255, 0.6)'], +.notion-light-theme [style*='color: rgba(25, 23, 17,'], +.notion-light-theme [style*='color: rgba(55, 53, 47,'], +.notion-light-theme [style*='color: rgb(25, 23, 17)'], +.notion-light-theme [style*='color: rgb(55, 53, 47)'] { + color: var(--theme_light--text_ui) !important; +} +.notion-light-theme .notion-page-content { + color: var(--theme_light--text) !important; +} +.notion-light-theme [style*='fill: rgba(55, 53, 47,'] { + fill: var(--theme_light--text_ui) !important; +} +.notion-light-theme [style*='color: rgba(255, 255, 255, 0.4)'] { + color: var(--theme_light--text_ui_info) !important; +} + +.notion-light-theme [style*='color:rgb(155,154,151)'] { + color: var(--theme_light--text_gray) !important; +} +.notion-light-theme [style*='background: rgb(235, 236, 237)'], +.notion-light-theme [style*='background:rgb(235,236,237)'] { + background: var(--theme_light--bg_gray) !important; +} +.notion-light-theme div[style='background: rgb(235, 236, 237)'] { + background: var(--theme_light--line_gray) !important; +} +.notion-light-theme [style*='color:rgb(100,71,58)'] { + color: var(--theme_light--text_brown) !important; +} +.notion-light-theme [style*='background: rgb(233, 229, 227)'], +.notion-light-theme [style*='background:rgb(233,229,227)'] { + background: var(--theme_light--bg_brown) !important; +} +.notion-light-theme div[style='background: rgb(233, 229, 227)'] { + background: var(--theme_light--line_brown) !important; +} +.notion-light-theme [style*='color:rgb(217,115,13)'] { + color: var(--theme_light--text_orange) !important; +} +.notion-light-theme [style*='background: rgb(250, 235, 221)'], +.notion-light-theme [style*='background:rgb(250,235,221)'] { + background: var(--theme_light--bg_orange) !important; +} +.notion-light-theme div[style='background: rgb(250, 235, 221)'] { + background: var(--theme_light--line_orange) !important; +} +.notion-light-theme [style*='color:rgb(223,171,1)'] { + color: var(--theme_light--text_yellow) !important; +} +.notion-light-theme [style*='background: rgb(251, 243, 219)'], +.notion-light-theme [style*='background:rgb(251,243,219)'] { + background: var(--theme_light--bg_yellow) !important; +} +.notion-light-theme div[style='background: rgb(251, 243, 219)'] { + background: var(--theme_light--line_yellow) !important; +} +.notion-light-theme [style*='color:rgb(15,123,108)'] { + color: var(--theme_light--text_green) !important; +} +.notion-light-theme [style*='background: rgb(221, 237, 234)'], +.notion-light-theme [style*='background:rgb(221,237,234)'] { + background: var(--theme_light--bg_green) !important; +} +.notion-light-theme div[style='background: rgb(221, 237, 234)'] { + background: var(--theme_light--line_green) !important; +} +.notion-light-theme [style*='color:rgb(11,110,153)'] { + color: var(--theme_light--text_blue) !important; +} +.notion-light-theme [style*='background: rgb(221, 235, 241)'], +.notion-light-theme [style*='background:rgb(221,235,241)'] { + background: var(--theme_light--bg_blue) !important; +} +.notion-light-theme div[style='background: rgb(221, 235, 241)'] { + background: var(--theme_light--line_blue) !important; +} +.notion-light-theme [style*='color:rgb(105,64,165)'] { + color: var(--theme_light--text_purple) !important; +} +.notion-light-theme [style*='background: rgb(234, 228, 242)'], +.notion-light-theme [style*='background:rgb(234,228,242)'] { + background: var(--theme_light--bg_purple) !important; +} +.notion-light-theme div[style='background: rgb(234, 228, 242)'] { + background: var(--theme_light--line_purple) !important; +} +.notion-light-theme [style*='color:rgb(173,26,114)'] { + color: var(--theme_light--text_pink) !important; +} +.notion-light-theme [style*='background: rgb(244, 223, 235)'], +.notion-light-theme [style*='background:rgb(244,223,235)'] { + background: var(--theme_light--bg_pink) !important; +} +.notion-light-theme div[style='background: rgb(244, 223, 235)'] { + background: var(--theme_light--line_pink) !important; +} +.notion-light-theme [style*='color:rgb(224,62,62)'] { + color: var(--theme_light--text_red) !important; +} +.notion-light-theme [style*='background: rgb(251, 228, 228)'], +.notion-light-theme [style*='background:rgb(251,228,228)'] { + background: var(--theme_light--bg_red) !important; +} +.notion-light-theme div[style='background: rgb(251, 228, 228)'] { + background: var(--theme_light--line_red) !important; +} + +/* code */ + +.notion-light-theme [style*='color:#EB5757'] { + color: var(--theme_light--code_inline-text) !important; + background: var(--theme_light--code_inline-background) !important; +} + +.notion-light-theme .notion-code-block { + background: var(--theme_light--code-background) !important; +} +.notion-light-theme .notion-code-block > div { + color: var(--theme_light--code_text) !important; +} +.notion-light-theme .notion-code-block .token.function { + color: var(--theme_light--code_function) !important; +} +.notion-light-theme .notion-code-block .token.keyword { + color: var(--theme_light--code_keyword) !important; +} +.notion-light-theme .notion-code-block .token.tag { + color: var(--theme_light--code_tag) !important; +} +.notion-light-theme .notion-code-block .token.operator { + color: var(--theme_light--code_operator) !important; +} +.notion-light-theme .notion-code-block .token.property { + color: var(--theme_light--code_property) !important; +} +.notion-light-theme .notion-code-block .token.builtin { + color: var(--theme_light--code_builtin) !important; +} +.notion-light-theme .notion-code-block .token.attr-name { + color: var(--theme_light--code_attr-name) !important; +} +.notion-light-theme .notion-code-block .token.attr-value { + color: var(--theme_light--code_attr-value) !important; +} +.notion-light-theme .notion-code-block .token.comment { + color: var(--theme_light--code_comment) !important; +} +.notion-light-theme .notion-code-block .token.punctuation { + color: var(--theme_light--code_punctuation) !important; +} +.notion-light-theme .notion-code-block .token.doctype { + color: var(--theme_light--code_doctype) !important; +} +.notion-light-theme .notion-code-block .token.number { + color: var(--theme_light--code_number) !important; +} +.notion-light-theme .notion-code-block .token.string { + color: var(--theme_light--code_string) !important; +} diff --git a/repo/core/scrollbars.css b/repo/core/scrollbars.css index 7402d8c..20224ad 100644 --- a/repo/core/scrollbars.css +++ b/repo/core/scrollbars.css @@ -20,17 +20,17 @@ } .smooth-scrollbars .notion-dark-theme ::-webkit-scrollbar-thumb { - background-color: var(--theme_dark-scrollbar); - border: var(--theme_dark-scrollbar-border); + background-color: var(--theme_dark--scrollbar); + border: var(--theme_dark--scrollbar-border); } .smooth-scrollbars .notion-dark-theme ::-webkit-scrollbar-thumb:hover { - background: var(--theme_dark-scrollbar_hover); + background: var(--theme_dark--scrollbar_hover); } .smooth-scrollbars .notion-light-theme ::-webkit-scrollbar-thumb { - background-color: var(--theme_light-scrollbar); - border: 1px solid var(--theme_light-scrollbar-border); + background-color: var(--theme_light--scrollbar); + border: 1px solid var(--theme_light--scrollbar-border); } .smooth-scrollbars .notion-light-theme ::-webkit-scrollbar-thumb:hover { - background: var(--theme_light-scrollbar_hover); + background: var(--theme_light--scrollbar_hover); } diff --git a/repo/core/shared.css b/repo/core/shared.css new file mode 100644 index 0000000..c36f5ce --- /dev/null +++ b/repo/core/shared.css @@ -0,0 +1,50 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (c) 2020 Arecsu + * (c) 2020 u/zenith_illinois + * (https://dragonwocky.me/) under the MIT license + */ + +/* prevent block hover options overlaying topbar */ +*:not([style*='z-index']) { + z-index: 1; +} + +/* fix highlight padding: this isn't a typo */ +[style*='background:rgb('] { + padding-bottom: 3px !important; +} + +/* smooth transitions */ +.notion-calendar-view-day, +.DayPicker-Day--today:not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end), +.DayPicker-Day.DayPicker-Day--start.DayPicker-Day--selected, +.DayPicker:not(.DayPicker--interactionDisabled) .DayPicker-Day--outside:hover, +.DayPicker:not(.DayPicker--interactionDisabled) + .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end) { + transition: all 200ms ease !important; +} +.notion-token-remove-button { + transition: opacity 200ms ease !important; +} +.notion-to_do-block > div > div > div[style*='background:'] { + transition: background 200ms ease !important; +} + +/* normalise inline-table size */ +.notion-page-content .notion-collection_view-block { + width: 100% !important; +} +.notion-page-content + .notion-collection_view-block + [style*='min-width: calc(100% - 192px);'], +.notion-page-content + .notion-collection_view-block + [style*='min-width: 708px;'] { + min-width: 100% !important; +} +.notion-page-content .notion-collection_view-block > div { + padding: 0 1px; +} diff --git a/repo/core/styles.css b/repo/core/styles.css index 3019d73..b2a7b88 100644 --- a/repo/core/styles.css +++ b/repo/core/styles.css @@ -1,10 +1,12 @@ /* * notion-enhancer * (c) 2020 dragonwocky - * (c) 2020 TarasokUA * (https://dragonwocky.me/) under the MIT license */ -@import './theme.css'; +@import './variables.css'; +@import './dark.css'; +@import './light.css'; +@import './shared.css'; @import './scrollbars.css'; @import './titlebar.css'; diff --git a/repo/core/theme.css b/repo/core/theme.css deleted file mode 100644 index baf2ada..0000000 --- a/repo/core/theme.css +++ /dev/null @@ -1,493 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky - * (c) 2020 TarasokUA - * (c) 2020 Arecsu - * (c) 2020 u/zenith_illinois - * (https://dragonwocky.me/) under the MIT license - */ - -:root { - /** light **/ - - --theme_light-font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', - Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', - 'Segoe UI Symbol'; - --theme_light-font_serif: Lyon-Text, Georgia, YuMincho, 'Yu Mincho', - 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', 'Songti TC', 'Songti SC', - SimSun, 'Nanum Myeongjo', NanumMyeongjo, Batang, serif; - --theme_light-font_mono: iawriter-mono, Nitti, Menlo, Courier, monospace; - --theme_light-font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, - Courier, monospace; - - --theme_light-dragarea: #e6e6e6; - --theme_light-button_hover: rgb(239, 239, 239); - --theme_light-button_hover-border: transparent; - --theme_light-button_close: #e81123; - --theme_light-button_close-fill: white; - - --theme_light-scrollbar: #d9d8d6; - --theme_light-scrollbar-border: #cacac8; - --theme_light-scrollbar_hover: #cacac8; - - /** dark **/ - - --theme_dark-main: rgb(47, 52, 55); - --theme_dark-sidebar: rgb(55, 60, 63); - --theme_dark-dragarea: #272d2f; - --theme_dark-preview-width: 977px; - --theme_dark-preview_banner-height: 20vh; - --theme_dark-page_banner-height: 30vh; - - --theme_dark-font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', - Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', - 'Segoe UI Symbol'; - --theme_dark-font_serif: Lyon-Text, Georgia, YuMincho, 'Yu Mincho', - 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', 'Songti TC', 'Songti SC', - SimSun, 'Nanum Myeongjo', NanumMyeongjo, Batang, serif; - --theme_dark-font_mono: iawriter-mono, Nitti, Menlo, Courier, monospace; - --theme_dark-font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, - Courier, monospace; - - --theme_dark-scrollbar: #505457; - --theme_dark-scrollbar-border: transparent; - --theme_dark-scrollbar_hover: #696d6f; - - --theme_dark-card: rgb(63, 68, 71); - --theme_dark-card-border: rgb(63, 68, 71); - --theme_dark-table-border: rgba(255, 255, 255, 0.1); - --theme_dark-button_hover: rgb(71, 76, 80); - --theme_dark-button_close: #e81123; - --theme_dark-button_close-fill: white; - --theme_dark-button_hover-border: transparent; - - --theme_dark-selected: rgba(46, 170, 220, 0.2); - --theme_dark-primary: rgb(46, 170, 220); - --theme_dark-primary_hover: rgb(6, 156, 205); - --theme_dark-primary_click: rgb(0, 141, 190); - --theme_dark-primary_indicator: rgb(235, 87, 87); - - --theme_dark-todo_empty-border: currentColor; - --theme_dark-todo_ticked: currentColor; - --theme_dark-todo_ticked-background: var(--theme_dark-primary); - --theme_dark-todo_hover-background: rgb(71, 76, 80); - - --theme_dark-danger_text: rgb(235, 87, 87); - --theme_dark-danger_border: rgba(235, 87, 87, 0.5); - - --theme_dark-text: rgba(255, 255, 255, 0.9); - --theme_dark-text_ui: rgba(255, 255, 255, 0.6); - --theme_dark-text_ui_dark: rgba(255, 255, 255, 0.4); - --theme_dark-text_gray: rgba(151, 154, 155, 0.95); - --theme_dark-text_brown: rgb(147, 114, 100); - --theme_dark-text_orange: rgb(255, 163, 68); - --theme_dark-text_yellow: rgb(255, 220, 73); - --theme_dark-text_green: rgb(77, 171, 154); - --theme_dark-text_blue: rgb(82, 156, 202); - --theme_dark-text_purple: rgb(154, 109, 215); - --theme_dark-text_pink: rgb(226, 85, 161); - --theme_dark-text_red: rgb(255, 115, 105); - --theme_dark-bg_gray: rgba(151, 154, 155, 0.5); - --theme_dark-bg_brown: rgba(147, 114, 100, 0.5); - --theme_dark-bg_orange: rgba(255, 163, 68, 0.5); - --theme_dark-bg_yellow: rgba(255, 220, 73, 0.5); - --theme_dark-bg_green: rgba(77, 171, 154, 0.5); - --theme_dark-bg_blue: rgba(82, 156, 202, 0.5); - --theme_dark-bg_purple: rgba(154, 109, 215, 0.5); - --theme_dark-bg_pink: rgba(226, 85, 161, 0.5); - --theme_dark-bg_red: rgba(255, 115, 105, 0.5); - --theme_dark-line_gray: rgb(69, 75, 78); - --theme_dark-line_brown: rgb(67, 64, 64); - --theme_dark-line_orange: rgb(89, 74, 58); - --theme_dark-line_yellow: rgb(89, 86, 59); - --theme_dark-line_green: rgb(53, 76, 75); - --theme_dark-line_blue: rgb(54, 73, 84); - --theme_dark-line_purple: rgb(68, 63, 87); - --theme_dark-line_pink: rgb(83, 59, 76); - --theme_dark-line_red: rgb(89, 65, 65); - - --theme_dark-code_inline-text: #eb5757; - --theme_dark-code_inline-background: rgba(135, 131, 120, 0.15); - --theme_dark-code_text: rgba(255, 255, 255, 0.9); - --theme_dark-code-background: rgb(63, 68, 71); - --theme_dark-code_function: rgba(255, 255, 255, 0.9); - --theme_dark-code_keyword: hsl(350, 40%, 70%); - --theme_dark-code_tag: hsl(350, 40%, 70%); - --theme_dark-code_operator: hsl(40, 90%, 60%); - --theme_dark-code_builtin: hsl(75, 70%, 60%); - --theme_dark-code_attr-name: hsl(75, 70%, 60%); - --theme_dark-code_comment: hsl(30, 20%, 50%); - --theme_dark-code_punctuation: rgba(255, 255, 255, 0.9); - --theme_dark-code_doctype: hsl(30, 20%, 50%); - --theme_dark-code_number: hsl(350, 40%, 70%); - --theme_dark-code_string: hsl(75, 70%, 60%); - --theme_dark-code_attr-value: hsl(350, 40%, 70%); -} - -/** general ui **/ - -.notion-dark-theme [style*='background: rgb(55, 60, 63)'], -.notion-dark-theme [style*='background: rgba(69, 75, 78, 0.3)'] { - background: var(--theme_dark-sidebar) !important; -} -.notion-body.dark, -.notion-dark-theme [style*='background: rgb(47, 52, 55)'], -.notion-dark-theme [style*='background-color: rgb(47, 52, 55)'] { - background: var(--theme_dark-main) !important; -} - -.notion-peek-renderer > div:nth-child(2) { - max-width: var(--theme_dark-preview-width) !important; -} -.notion-peek-renderer - .notion-scroller.vertical - [style*='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 20vh;'], -.notion-peek-renderer - .notion-scroller.vertical - [style*='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 20vh;'] - img { - height: var(--theme_dark-preview_banner-height) !important; -} -[style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'], -[style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'] - img { - height: var(--theme_dark-page_banner-height) !important; -} - -.notion-dark-theme [style*='Segoe UI'] { - font-family: var(--theme_dark-font_sans) !important; -} -.notion-dark-theme [style*='Georgia'] { - font-family: var(--theme_dark-font_serif) !important; -} -.notion-dark-theme [style*='iawriter-mono'] { - font-family: var(--theme_dark-font_mono) !important; -} -.notion-dark-theme [style*='SFMono-Regular'] { - font-family: var(--theme_dark-font_code) !important; -} - -.notion-light-theme [style*='Segoe UI'] { - font-family: var(--theme_light-font_sans) !important; -} -.notion-light-theme [style*='Georgia'] { - font-family: var(--theme_light-font_serif) !important; -} -.notion-light-theme [style*='iawriter-mono'] { - font-family: var(--theme_light-font_mono) !important; -} -.notion-light-theme [style*='SFMono-Regular'] { - font-family: var(--theme_light-font_code) !important; -} - -/* prevent block hover options overlaying topbar */ -*:not([style*='z-index']) { - z-index: 1; -} -.notion-dark-theme .notion-topbar { - background: var(--theme_dark-main); -} - -/** databases **/ - -.notion-dark-theme [style*='background: rgb(63, 68, 71)'] { - background: var(--theme_dark-card) !important; -} -.notion-dark-theme .notion-frame [style*='background: rgb(63, 68, 71)'] { - border: 0.5px solid var(--theme_dark-card-border); -} - -.notion-dark-theme [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px'] { - box-shadow: var(--theme_dark-main) -3px 0px 0px !important; -} -.notion-dark-theme - [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px, rgba(255, 255, 255, 0.14) 0px 1px 0px'] { - box-shadow: var(--theme_dark-main) -3px 0px 0px, - var(--theme_dark-table-border) 0px 1px 0px !important; -} - -.notion-dark-theme [style*='border-top: 1px solid rgba(255, 255, 255,'] { - border-top: 1px solid var(--theme_dark-table-border) !important; -} -.notion-dark-theme - [style*='box-shadow: rgba(255, 255, 255, 0.14) -1px 0px 0px'] { - box-shadow: var(--theme_dark-table-border) -1px 0px 0px !important; -} -.notion-dark-theme [style*='border-bottom: 1px solid rgba(255, 255, 255,'] { - border-bottom: 1px solid var(--theme_dark-table-border) !important; -} -.notion-dark-theme - [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px'] { - box-shadow: var(--theme_dark-table-border) 0px 1px 0px !important; -} -.notion-dark-theme [style*='border-right: 1px solid rgba(255, 255, 255,'] { - border-right: 1px solid var(--theme_dark-table-border) !important; -} -.notion-dark-theme - [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { - box-shadow: var(--theme_dark-table-border) 0px -1px 0px !important; -} -.notion-dark-theme [style*='border-left: 1px solid rgba(255, 255, 255,'] { - border-left: 1px solid var(--theme_dark-table-border) !important; -} -.notion-dark-theme - [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'] { - box-shadow: var(--theme_dark-table-border) 0px 1px 0px inset !important; -} - -.notion-dark-theme [style*='background: rgb(71, 76, 80)'], -.notion-dark-theme [style*='background: rgb(80, 85, 88)'], -.notion-dark-theme [style*='background: rgb(98, 102, 104)'] { - background: var(--theme_dark-button_hover) !important; - box-shadow: 0 0 0 0.5px var(--theme_dark-button_hover-border); -} - -.notion-calendar-view-day, -.DayPicker-Day--today:not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end), -.DayPicker-Day.DayPicker-Day--start.DayPicker-Day--selected, -.DayPicker:not(.DayPicker--interactionDisabled) .DayPicker-Day--outside:hover, -.DayPicker:not(.DayPicker--interactionDisabled) - .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end) { - transition: all 200ms ease !important; -} -.notion-token-remove-button { - transition: opacity 200ms ease !important; -} - -/* fix inline-tables in pages (?) */ -.notion-page-content .notion-collection_view-block { - width: 100% !important; -} -.notion-page-content .notion-collection_view-block > div:first-child { - padding-left: 0px !important; - padding-right: 0px !important; -} -.notion-page-content - .notion-collection_view-block - [style*='min-width: calc(100% - 192px);'], -.notion-page-content - .notion-collection_view-block - [style*='min-width: 708px;'] { - min-width: 100% !important; -} -.notion-page-content .notion-collection_view-block .notion-table-view { - padding-left: 0px !important; - padding-right: 0px !important; -} - -/** colours **/ - -.notion-dark-theme ::selection, -.notion-dark-theme - [style*='background: rgba(46, 170, 220,']:not([style*='background: rgba(46, 170, 220, 0)']), -.notion-dark-theme - [style*='background-color: rgba(46, 170, 220,']:not([style*='background-color: rgba(46, 170, 220, 0)']) { - background: var(--theme_dark-selected) !important; -} - -.notion-dark-theme [style*='background: rgb(46, 170, 220)'], -.notion-dark-theme [style*='background-color: rgb(46, 170, 220)'] { - background: var(--theme_dark-primary) !important; -} -.notion-dark-theme - [style*='box-shadow: rgb(46, 170, 220) 0px 0px 0px 2px inset'] { - box-shadow: var(--theme_dark-primary) 0px 0px 0px 2px inset !important; -} -.notion-dark-theme .notion-focusable:focus-within { - box-shadow: var(--theme_dark-primary) 0px 0px 0px 1px inset, - var(--theme_dark-primary_hover) 0px 0px 0px 2px !important; -} -.notion-dark-theme [style*='background: rgb(6, 156, 205)'] { - background: var(--theme_dark-primary_hover) !important; -} -.notion-dark-theme [style*='background: rgb(0, 141, 190)'] { - background: var(--theme_dark-primary_click) !important; -} -.notion-dark-theme - .DayPicker-Day--today:not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end)::after, -.notion-dark-theme [style*='background: rgb(235, 87, 87)'] { - background: var(--theme_dark-primary_indicator) !important; -} - -.notion-dark-theme .notion-to_do-block .checkboxSquare path { - fill: var(--theme_dark-todo_empty-border) !important; -} -.notion-dark-theme .notion-to_do-block .check polygon { - fill: var(--theme_dark-todo_ticked-fill) !important; -} -.notion-dark-theme - .notion-to_do-block - [style*='background: rgb(46, 170, 220)'] { - background: var(--theme_dark-todo_ticked-background) !important; -} -.notion-to_do-block > div > div > div[style*='background:'] { - transition: background 200ms ease !important; -} -.notion-dark-theme .notion-to_do-block [style*='background: rgb(71, 76, 80)'] { - background: var(--theme_dark-todo_hover-background) !important; -} - -.notion-dark-theme - [style*='color: rgb(235, 87, 87); border: 1px solid rgba(235, 87, 87, 0.5);'] { - color: var(--theme_dark-danger_text) !important; - border: 1px solid var(--theme_dark-danger_border) !important; -} - -.notion-dark-theme, -.notion-dark-theme .notion-page-content [style*='color: inherit;'], -.notion-dark-theme .notion-frame .notion-page-block { - color: var(--theme_dark-text) !important; -} -.notion-dark-theme [style*='color: rgba(255, 255, 255, 0.6)'] { - color: var(--theme_dark-text_ui) !important; -} -.notion-dark-theme [style*='color: rgba(255, 255, 255, 0.4)'] { - color: var(--theme_dark-text_ui_dark) !important; -} - -.notion-dark-theme [style*='color:rgba(151,154,155,0.95)'] { - color: var(--theme_dark-text_gray) !important; -} -.notion-dark-theme [style*='background: rgba(151, 154, 155, 0.5)'], -.notion-dark-theme [style*='background:rgb(69,75,78)'] { - background: var(--theme_dark-bg_gray) !important; -} -.notion-dark-theme [style*='background: rgb(69, 75, 78)'] { - background: var(--theme_dark-line_gray) !important; -} -.notion-dark-theme [style*='color:rgb(147,114,100)'] { - color: var(--theme_dark-text_brown) !important; -} -.notion-dark-theme [style*='background: rgba(147, 114, 100, 0.5)'], -.notion-dark-theme [style*='background:rgb(67,64,64)'] { - background: var(--theme_dark-bg_brown) !important; -} -.notion-dark-theme [style*='background: rgb(67, 64, 64)'] { - background: var(--theme_dark-line_brown) !important; -} -.notion-dark-theme [style*='color:rgb(255,163,68)'] { - color: var(--theme_dark-text_orange) !important; -} -.notion-dark-theme [style*='background: rgba(255, 163, 68, 0.5)'], -.notion-dark-theme [style*='background:rgb(89,74,58)'] { - background: var(--theme_dark-bg_orange) !important; -} -.notion-dark-theme [style*='background: rgb(89, 74, 58)'] { - background: var(--theme_dark-line_orange) !important; -} -.notion-dark-theme [style*='color:rgb(255,220,73)'] { - color: var(--theme_dark-text_yellow) !important; -} -.notion-dark-theme [style*='background: rgba(255, 220, 73, 0.5)'], -.notion-dark-theme [style*='background:rgb(89,86,59)'] { - background: var(--theme_dark-bg_yellow) !important; -} -.notion-dark-theme [style*='background: rgb(89, 86, 59)'] { - background: var(--theme_dark-line_yellow) !important; -} -.notion-dark-theme [style*='color:rgb(77,171,154)'] { - color: var(--theme_dark-text_green) !important; -} -.notion-dark-theme [style*='background: rgba(77, 171, 154, 0.5)'], -.notion-dark-theme [style*='background:rgb(53,76,75)'] { - background: var(--theme_dark-bg_green) !important; -} -.notion-dark-theme [style*='background: rgb(53, 76, 75)'] { - background: var(--theme_dark-line_green) !important; -} -.notion-dark-theme [style*='color:rgb(82,156,202)'] { - color: var(--theme_dark-text_blue) !important; -} -.notion-dark-theme [style*='background: rgba(82, 156, 202, 0.5)'], -.notion-dark-theme [style*='background:rgb(54,73,84)'] { - background: var(--theme_dark-bg_blue) !important; -} -.notion-dark-theme [style*='background: rgb(54, 73, 84)'] { - background: var(--theme_dark-line_blue) !important; -} -.notion-dark-theme [style*='color:rgb(154,109,215)'] { - color: var(--theme_dark-text_purple) !important; -} -.notion-dark-theme [style*='background: rgba(154, 109, 215, 0.5)'], -.notion-dark-theme [style*='background:rgb(68,63,87)'] { - background: var(--theme_dark-bg_purple) !important; -} -.notion-dark-theme [style*='background: rgb(68, 63, 87)'] { - background: var(--theme_dark-line_purple) !important; -} -.notion-dark-theme [style*='color:rgb(226,85,161)'] { - color: var(--theme_dark-text_pink) !important; -} -.notion-dark-theme [style*='background: rgba(226, 85, 161, 0.5)'], -.notion-dark-theme [style*='background:rgb(83,59,76)'] { - background: var(--theme_dark-bg_pink) !important; -} -.notion-dark-theme [style*='background: rgb(83, 59, 76)'] { - background: var(--theme_dark-line_pink) !important; -} -.notion-dark-theme [style*='color:rgb(255,115,105)'] { - color: var(--theme_dark-text_red) !important; -} -.notion-dark-theme [style*='background: rgba(255, 115, 105, 0.5);'], -.notion-dark-theme [style*='background:rgb(89,65,65)'] { - background: var(--theme_dark-bg_red) !important; -} -.notion-dark-theme [style*='background: rgb(89, 65, 65)'] { - background: var(--theme_dark-line_red) !important; -} - -/* fix highlight padding: this isn't a typo */ -[style*='background:rgb('] { - padding-bottom: 3px !important; -} - -/* code */ - -.notion-dark-theme [style*='color:#EB5757'] { - color: var(--theme_dark-code_inline-text) !important; - background: var(--theme_dark-code_inline-background) !important; -} - -.notion-dark-theme - [style*='flex-grow: 1; border-radius: 3px; text-align: left; position: relative; background: rgb(63, 68, 71); min-width: 0px; width: 100%;'] { - background: var(--theme_dark-code-background) !important; -} -.notion-dark-theme .notion-code-block > div { - color: var(--theme_dark-code_text) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.function { - color: var(--theme_dark-code_function) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.keyword { - color: var(--theme_dark-code_keyword) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.tag { - color: var(--theme_dark-code_tag) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.operator { - color: var(--theme_dark-code_operator) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.builtin { - color: var(--theme_dark-code_builtin) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.attr-name { - color: var(--theme_dark-code_attr-name) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.attr-value { - color: var(--theme_dark-code_attr-value) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.comment { - color: var(--theme_dark-code_comment) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.punctuation { - color: var(--theme_dark-code_punctuation) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.doctype { - color: var(--theme_dark-code_doctype) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.number { - color: var(--theme_dark-code_number) !important; -} -.notion-dark-theme .notion-dark-theme .notion-code-block .token.string { - color: var(--theme_dark-code_string) !important; -} diff --git a/repo/core/titlebar.css b/repo/core/titlebar.css index 2296df4..c4d3335 100644 --- a/repo/core/titlebar.css +++ b/repo/core/titlebar.css @@ -14,10 +14,10 @@ width: 100%; } .frameless .notion-dark-theme .window-dragarea { - background: var(--theme_dark-dragarea); + background: var(--theme_dark--dragarea); } .frameless .notion-light-theme .window-dragarea { - background: var(--theme_light-dragarea); + background: var(--theme_light--dragarea); } @media (max-width: 760px) { @@ -74,25 +74,25 @@ } .notion-dark-theme .window-button:hover { - background: var(--theme_dark-button_hover); - box-shadow: 0 0 0 0.5px var(--theme_dark-button_hover-border); + background: var(--theme_dark--button_hover); + box-shadow: 0 0 0 0.5px var(--theme_dark--button_hover-border); } .notion-dark-theme .window-button.btn-close:hover { - background: var(--theme_dark-button_close); + background: var(--theme_dark--button_close); } .notion-dark-theme .window-button.btn-close:hover svg line { - stroke: var(--theme_dark-button_close-fill); + stroke: var(--theme_dark--button_close-fill); } .notion-light-theme .window-button.btn-close:hover { - background: var(--theme_light-button_close); + background: var(--theme_light--button_close); } .notion-light-theme .window-button.btn-close:hover svg line { - stroke: var(--theme_light-button_close-fill); + stroke: var(--theme_light--button_close-fill); } .notion-light-theme .window-button:hover { - background: var(--theme_light-button_hover); - box-shadow: 0 0 0 0.5px var(--theme_light-button_hover-border); + background: var(--theme_light--button_hover); + box-shadow: 0 0 0 0.5px var(--theme_light--button_hover-border); } /* hide topbar when sidebar is hidden */ diff --git a/repo/core/variables.css b/repo/core/variables.css new file mode 100644 index 0000000..d13f66a --- /dev/null +++ b/repo/core/variables.css @@ -0,0 +1,200 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (c) 2020 Arecsu + * (c) 2020 u/zenith_illinois + * (https://dragonwocky.me/) under the MIT license + */ + +:root { + /** dark **/ + + --theme_dark--main: rgb(47, 52, 55); + --theme_dark--sidebar: rgb(55, 60, 63); + --theme_dark--dragarea: #272d2f; + --theme_dark--preview-width: 977px; + --theme_dark--preview_banner-height: 20vh; + --theme_dark--page_banner-height: 30vh; + + --theme_dark--font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', + Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', + 'Segoe UI Symbol'; + --theme_dark--font_serif: Lyon-Text, Georgia, YuMincho, 'Yu Mincho', + 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', 'Songti TC', 'Songti SC', + SimSun, 'Nanum Myeongjo', NanumMyeongjo, Batang, serif; + --theme_dark--font_mono: iawriter-mono, Nitti, Menlo, Courier, monospace; + --theme_dark--font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, + Courier, monospace; + + --theme_dark--scrollbar: #505457; + --theme_dark--scrollbar-border: transparent; + --theme_dark--scrollbar_hover: #696d6f; + + --theme_dark--card: rgb(63, 68, 71); + --theme_dark--card-border: rgb(63, 68, 71); + --theme_dark--table-border: rgba(255, 255, 255, 0.1); + --theme_dark--button_hover: rgb(71, 76, 80); + --theme_dark--button_hover-border: transparent; + --theme_dark--button_close: #e81123; + --theme_dark--button_close-fill: white; + + --theme_dark--selected: rgba(46, 170, 220, 0.2); + --theme_dark--primary: rgb(46, 170, 220); + --theme_dark--primary_hover: rgb(6, 156, 205); + --theme_dark--primary_click: rgb(0, 141, 190); + --theme_dark--primary_indicator: rgb(235, 87, 87); + + --theme_dark--todo_empty-border: currentColor; + --theme_dark--todo_ticked: currentColor; + --theme_dark--todo_ticked-background: var(--theme_dark--primary); + --theme_dark--todo_hover-background: rgb(71, 76, 80); + + --theme_dark--danger_text: rgb(235, 87, 87); + --theme_dark--danger_border: rgba(235, 87, 87, 0.5); + + --theme_dark--text: rgba(255, 255, 255, 0.9); + --theme_dark--text_ui: rgba(255, 255, 255, 0.6); + --theme_dark--text_ui_info: rgba(255, 255, 255, 0.4); + + --theme_dark--text_gray: rgba(151, 154, 155, 0.95); + --theme_dark--text_brown: rgb(147, 114, 100); + --theme_dark--text_orange: rgb(255, 163, 68); + --theme_dark--text_yellow: rgb(255, 220, 73); + --theme_dark--text_green: rgb(77, 171, 154); + --theme_dark--text_blue: rgb(82, 156, 202); + --theme_dark--text_purple: rgb(154, 109, 215); + --theme_dark--text_pink: rgb(226, 85, 161); + --theme_dark--text_red: rgb(255, 115, 105); + --theme_dark--bg_gray: rgba(151, 154, 155, 0.5); + --theme_dark--bg_brown: rgba(147, 114, 100, 0.5); + --theme_dark--bg_orange: rgba(255, 163, 68, 0.5); + --theme_dark--bg_yellow: rgba(255, 220, 73, 0.5); + --theme_dark--bg_green: rgba(77, 171, 154, 0.5); + --theme_dark--bg_blue: rgba(82, 156, 202, 0.5); + --theme_dark--bg_purple: rgba(154, 109, 215, 0.5); + --theme_dark--bg_pink: rgba(226, 85, 161, 0.5); + --theme_dark--bg_red: rgba(255, 115, 105, 0.5); + --theme_dark--line_gray: rgb(69, 75, 78); + --theme_dark--line_brown: rgb(67, 64, 64); + --theme_dark--line_orange: rgb(89, 74, 58); + --theme_dark--line_yellow: rgb(89, 86, 59); + --theme_dark--line_green: rgb(53, 76, 75); + --theme_dark--line_blue: rgb(54, 73, 84); + --theme_dark--line_purple: rgb(68, 63, 87); + --theme_dark--line_pink: rgb(83, 59, 76); + --theme_dark--line_red: rgb(89, 65, 65); + + --theme_dark--code_inline-text: #eb5757; + --theme_dark--code_inline-background: rgba(135, 131, 120, 0.15); + --theme_dark--code_text: var(--theme_dark--text); + --theme_dark--code-background: rgb(63, 68, 71); + --theme_dark--code_function: rgba(255, 255, 255, 0.9); + --theme_dark--code_keyword: hsl(350, 40%, 70%); + --theme_dark--code_tag: hsl(350, 40%, 70%); + --theme_dark--code_operator: hsl(40, 90%, 60%); + --theme_dark--code_property: hsl(350, 40%, 70%); + --theme_dark--code_builtin: hsl(75, 70%, 60%); + --theme_dark--code_attr-name: hsl(75, 70%, 60%); + --theme_dark--code_comment: hsl(30, 20%, 50%); + --theme_dark--code_punctuation: rgba(255, 255, 255, 0.9); + --theme_dark--code_doctype: hsl(30, 20%, 50%); + --theme_dark--code_number: hsl(350, 40%, 70%); + --theme_dark--code_string: hsl(75, 70%, 60%); + --theme_dark--code_attr-value: hsl(350, 40%, 70%); + + /** light **/ + + --theme_light--main: white; + --theme_light--sidebar: rgb(247, 246, 243); + --theme_light--dragarea: rgba(55, 53, 47, 0.04); + --theme_light--preview-width: 977px; + --theme_light--preview_banner-height: 20vh; + --theme_light--page_banner-height: 30vh; + + --theme_light--font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', + Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', + 'Segoe UI Symbol'; + --theme_light--font_serif: Lyon-Text, Georgia, YuMincho, 'Yu Mincho', + 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', 'Songti TC', 'Songti SC', + SimSun, 'Nanum Myeongjo', NanumMyeongjo, Batang, serif; + --theme_light--font_mono: iawriter-mono, Nitti, Menlo, Courier, monospace; + --theme_light--font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, + Courier, monospace; + + --theme_light--scrollbar: #d9d8d6; + --theme_light--scrollbar-border: #cacac8; + --theme_light--scrollbar_hover: #cacac8; + + --theme_light--card: rgb(247, 246, 243); + --theme_light--card-border: rgb(247, 246, 243); + --theme_light--table-border: rgba(55, 53, 47, 0.16); + --theme_light--button_hover: rgba(55, 53, 47, 0.08); + --theme_light--button_hover-border: transparent; + --theme_light--button_close: #e81123; + --theme_light--button_close-fill: white; + + --theme_light--selected: rgba(46, 170, 220, 0.2); + --theme_light--primary: rgb(46, 170, 220); + --theme_light--primary_hover: rgb(6, 156, 205); + --theme_light--primary_click: rgb(0, 141, 190); + --theme_light--primary_indicator: rgb(235, 87, 87); + + --theme_light--todo_empty-border: currentColor; + --theme_light--todo_ticked: currentColor; + --theme_light--todo_ticked-background: var(--theme_light--primary); + --theme_light--todo_hover-background: rgba(55, 53, 47, 0.08); + + --theme_light--danger_text: rgb(235, 87, 87); + --theme_light--danger_border: rgba(235, 87, 87, 0.5); + + --theme_light--text: rgb(55, 53, 47); + --theme_light--text_ui: rgba(55, 53, 47, 0.6); + --theme_light--text_ui_info: rgba(55, 53, 47, 0.4); + + --theme_light--text_gray: rgb(155, 154, 151); + --theme_light--text_brown: rgb(100, 71, 58); + --theme_light--text_orange: rgb(217, 115, 13); + --theme_light--text_yellow: rgb(223, 171, 1); + --theme_light--text_green: rgb(15, 123, 108); + --theme_light--text_blue: rgb(11, 110, 153); + --theme_light--text_purple: rgb(105, 64, 165); + --theme_light--text_pink: rgb(173, 26, 114); + --theme_light--text_red: rgb(224, 62, 62); + --theme_light--bg_gray: rgb(235, 236, 237); + --theme_light--bg_brown: rgb(233, 229, 227); + --theme_light--bg_orange: rgb(250, 235, 221); + --theme_light--bg_yellow: rgb(251, 243, 219); + --theme_light--bg_green: rgb(221, 237, 234); + --theme_light--bg_blue: rgb(221, 235, 241); + --theme_light--bg_purple: rgb(234, 228, 242); + --theme_light--bg_pink: rgb(244, 223, 235); + --theme_light--bg_red: rgb(251, 228, 228); + --theme_light--line_gray: rgb(235, 236, 237); + --theme_light--line_brown: rgb(233, 229, 227); + --theme_light--line_orange: rgb(250, 235, 221); + --theme_light--line_yellow: rgb(251, 243, 219); + --theme_light--line_green: rgb(221, 237, 234); + --theme_light--line_blue: rgb(221, 235, 241); + --theme_light--line_purple: rgb(105, 64, 165); + --theme_light--line_pink: rgb(244, 223, 235); + --theme_light--line_red: rgb(251, 228, 228); + + --theme_light--code_inline-text: #eb5757; + --theme_light--code_inline-background: rgba(135, 131, 120, 0.15); + --theme_light--code_text: var(--theme_light--text); + --theme_light--code-background: rgb(247, 246, 243); + --theme_light--code_function: #dd4a68; + --theme_light--code_keyword: #07a; + --theme_light--code_tag: #905; + --theme_light--code_operator: #9a6e3a; + --theme_light--code_property: #905; + --theme_light--code_builtin: #690; + --theme_light--code_attr-name: #690; + --theme_light--code_comment: slategray; + --theme_light--code_punctuation: #999; + --theme_light--code_doctype: slategray; + --theme_light--code_number: #905; + --theme_light--code_string: #690; + --theme_light--code_attr-value: #07a; +} From 06211688b62e80e2108204c34c8c404e05c2c859 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sat, 25 Jul 2020 22:49:08 +1000 Subject: [PATCH 017/371] light theoretically 100% :) --- repo/core/dark.css | 7 ++++- repo/core/light.css | 65 ++++++++++++++++++++++++-------------------- repo/core/styles.css | 52 +++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 30 deletions(-) diff --git a/repo/core/dark.css b/repo/core/dark.css index 9576d08..fc660d6 100644 --- a/repo/core/dark.css +++ b/repo/core/dark.css @@ -122,6 +122,9 @@ background: var(--theme_dark--selected) !important; } +.notion-dark-theme [style*='color: rgb(46, 170, 220)'] { + color: var(--theme_dark--primary) !important; +} .notion-dark-theme [style*='background: rgb(46, 170, 220)'], .notion-dark-theme [style*='background-color: rgb(46, 170, 220)'] { background: var(--theme_dark--primary) !important; @@ -180,8 +183,10 @@ .notion-dark-theme [style*='color: rgba(255, 255, 255, 0.4)'] { color: var(--theme_dark--text_ui_info) !important; } -.notion-dark-theme [style*='fill: rgba(202, 204, 206,'], .notion-dark-theme [style*='fill: rgb(202, 204, 206)'] { + fill: var(--theme_dark--text) !important; +} +.notion-dark-theme [style*='fill: rgba(202, 204, 206,'] { fill: var(--theme_dark--text_ui) !important; } diff --git a/repo/core/light.css b/repo/core/light.css index 40fd3d0..798e63a 100644 --- a/repo/core/light.css +++ b/repo/core/light.css @@ -14,7 +14,9 @@ background: var(--theme_light--sidebar) !important; } .notion-body.light, -.notion-light-theme [style*='background: white'] { +.notion-light-theme [style*='background: white'], +.notion-light-theme [style*='background-color: white'], +.notion-light-theme [style*='background: rgba(206, 205, 202, 0.5)'] { background: var(--theme_light--main) !important; } @@ -106,6 +108,9 @@ background: var(--theme_light--button_hover) !important; box-shadow: 0 0 0 0.5px var(--theme_light--button_hover-border); } +.notion-light-theme [style*='background: rgba(242, 241, 238, 0.6)'] { + background: var(--theme_light--button) !important; +} /** colours **/ @@ -117,6 +122,9 @@ background: var(--theme_light--selected) !important; } +.notion-light-theme [style*='color: rgb(46, 170, 220)'] { + color: var(--theme_light--primary) !important; +} .notion-light-theme [style*='background: rgb(46, 170, 220)'], .notion-light-theme [style*='background-color: rgb(46, 170, 220)'] { background: var(--theme_light--primary) !important; @@ -165,114 +173,113 @@ } .notion-light-theme, -.notion-light-theme [style*='color:'] { +.notion-light-theme .notion-page-content [style*='color: inherit;'], +.notion-light-theme .notion-frame .notion-page-block, +.notion-light-theme [style*='color: rgb(55, 53, 47);'] { color: var(--theme_light--text) !important; } -.notion-light-theme [style*='color: rgba(255, 255, 255, 0.6)'], -.notion-light-theme [style*='color: rgba(25, 23, 17,'], -.notion-light-theme [style*='color: rgba(55, 53, 47,'], -.notion-light-theme [style*='color: rgb(25, 23, 17)'], -.notion-light-theme [style*='color: rgb(55, 53, 47)'] { +.notion-light-theme [style*='color: rgba(55, 53, 47, 0.6)'], +.notion-light-theme [style*='color: rgba(25, 23, 17, 0.6)'] { color: var(--theme_light--text_ui) !important; } -.notion-light-theme .notion-page-content { - color: var(--theme_light--text) !important; +.notion-light-theme [style*='color: rgba(55, 53, 47, 0.4)'] { + color: var(--theme_light--text_ui_info) !important; } .notion-light-theme [style*='fill: rgba(55, 53, 47,'] { fill: var(--theme_light--text_ui) !important; } -.notion-light-theme [style*='color: rgba(255, 255, 255, 0.4)'] { - color: var(--theme_light--text_ui_info) !important; +.notion-light-theme [style*='fill: rgba(55, 53, 47, 0.8)'] { + fill: var(--theme_light--text) !important; } .notion-light-theme [style*='color:rgb(155,154,151)'] { color: var(--theme_light--text_gray) !important; } -.notion-light-theme [style*='background: rgb(235, 236, 237)'], +.notion-light-theme [style*='background: rgba(140, 46, 0, 0.2)'], .notion-light-theme [style*='background:rgb(235,236,237)'] { background: var(--theme_light--bg_gray) !important; } -.notion-light-theme div[style='background: rgb(235, 236, 237)'] { +.notion-light-theme [style*='background: rgb(235, 236, 237)'] { background: var(--theme_light--line_gray) !important; } .notion-light-theme [style*='color:rgb(100,71,58)'] { color: var(--theme_light--text_brown) !important; } -.notion-light-theme [style*='background: rgb(233, 229, 227)'], +.notion-light-theme [style*='background: rgba(140, 46, 0, 0.2)'], .notion-light-theme [style*='background:rgb(233,229,227)'] { background: var(--theme_light--bg_brown) !important; } -.notion-light-theme div[style='background: rgb(233, 229, 227)'] { +.notion-light-theme [style*='background: rgb(233, 229, 227)'] { background: var(--theme_light--line_brown) !important; } .notion-light-theme [style*='color:rgb(217,115,13)'] { color: var(--theme_light--text_orange) !important; } -.notion-light-theme [style*='background: rgb(250, 235, 221)'], +.notion-light-theme [style*='background: rgba(245, 93, 0, 0.2)'], .notion-light-theme [style*='background:rgb(250,235,221)'] { background: var(--theme_light--bg_orange) !important; } -.notion-light-theme div[style='background: rgb(250, 235, 221)'] { +.notion-light-theme [style*='background: rgb(250, 235, 221)'] { background: var(--theme_light--line_orange) !important; } .notion-light-theme [style*='color:rgb(223,171,1)'] { color: var(--theme_light--text_yellow) !important; } -.notion-light-theme [style*='background: rgb(251, 243, 219)'], +.notion-light-theme [style*='background: rgba(233, 168, 0, 0.2)'], .notion-light-theme [style*='background:rgb(251,243,219)'] { background: var(--theme_light--bg_yellow) !important; } -.notion-light-theme div[style='background: rgb(251, 243, 219)'] { +.notion-light-theme [style*='background: rgb(251, 243, 219)'] { background: var(--theme_light--line_yellow) !important; } .notion-light-theme [style*='color:rgb(15,123,108)'] { color: var(--theme_light--text_green) !important; } -.notion-light-theme [style*='background: rgb(221, 237, 234)'], +.notion-light-theme [style*='background: rgba(0, 135, 107, 0.2)'], .notion-light-theme [style*='background:rgb(221,237,234)'] { background: var(--theme_light--bg_green) !important; } -.notion-light-theme div[style='background: rgb(221, 237, 234)'] { +.notion-light-theme [style*='background: rgb(221, 237, 234)'] { background: var(--theme_light--line_green) !important; } .notion-light-theme [style*='color:rgb(11,110,153)'] { color: var(--theme_light--text_blue) !important; } -.notion-light-theme [style*='background: rgb(221, 235, 241)'], +.notion-light-theme [style*='background: rgba(0, 120, 223, 0.2)'], .notion-light-theme [style*='background:rgb(221,235,241)'] { background: var(--theme_light--bg_blue) !important; } -.notion-light-theme div[style='background: rgb(221, 235, 241)'] { +.notion-light-theme [style*='background: rgb(221, 235, 241)'] { background: var(--theme_light--line_blue) !important; } .notion-light-theme [style*='color:rgb(105,64,165)'] { color: var(--theme_light--text_purple) !important; } -.notion-light-theme [style*='background: rgb(234, 228, 242)'], +.notion-light-theme [style*='background: rgba(103, 36, 222, 0.2)'], .notion-light-theme [style*='background:rgb(234,228,242)'] { background: var(--theme_light--bg_purple) !important; } -.notion-light-theme div[style='background: rgb(234, 228, 242)'] { +.notion-light-theme [style*='background: rgb(234, 228, 242)'] { background: var(--theme_light--line_purple) !important; } .notion-light-theme [style*='color:rgb(173,26,114)'] { color: var(--theme_light--text_pink) !important; } -.notion-light-theme [style*='background: rgb(244, 223, 235)'], +.notion-light-theme [style*='background: rgba(221, 0, 129, 0.2)'], .notion-light-theme [style*='background:rgb(244,223,235)'] { background: var(--theme_light--bg_pink) !important; } -.notion-light-theme div[style='background: rgb(244, 223, 235)'] { +.notion-light-theme [style*='background: rgb(244, 223, 235)'] { background: var(--theme_light--line_pink) !important; } .notion-light-theme [style*='color:rgb(224,62,62)'] { color: var(--theme_light--text_red) !important; } -.notion-light-theme [style*='background: rgb(251, 228, 228)'], +.notion-light-theme [style*='background: rgba(255, 0, 26, 0.2)'], .notion-light-theme [style*='background:rgb(251,228,228)'] { background: var(--theme_light--bg_red) !important; } -.notion-light-theme div[style='background: rgb(251, 228, 228)'] { +.notion-light-theme [style*='background: rgb(251, 228, 228)'] { background: var(--theme_light--line_red) !important; } diff --git a/repo/core/styles.css b/repo/core/styles.css index b2a7b88..6a57d80 100644 --- a/repo/core/styles.css +++ b/repo/core/styles.css @@ -10,3 +10,55 @@ @import './shared.css'; @import './scrollbars.css'; @import './titlebar.css'; + +:root { + --theme_light--main: rgb(5, 5, 5); + --theme_light--sidebar: rgb(1, 1, 1); + --theme_light--dragarea: #030303; + --theme_light--primary: rgb(177, 24, 24); + --theme_light--primary_hover: rgb(202, 26, 26); + --theme_light--primary_click: rgb(219, 41, 41); + --theme_light--primary_indicator: rgb(202, 26, 26); + + --theme_light--card: rgb(4, 4, 4); + --theme_light--card_border: rgba(10, 10, 10, 0.7); + --theme_light--button: rgb(15, 15, 15); + --theme_light--button_hover: rgb(32, 32, 32); + --theme_light--button_border: rgba(78, 78, 78, 0.7); + --theme_light--table_border: rgba(255, 255, 255, 0.1); + + --theme_light--scrollbar: #232425; + --theme_light--scrollbar-border: transparent; + --theme_light--scrollbar_hover: #373838; + + --theme_light--text: rgb(228, 228, 228); + --theme_light--text_ui: rgba(211, 211, 211, 0.637); + --theme_light--text_ui_info: rgba(211, 211, 211, 0.466); + --theme_light--text_gray: rgba(151, 154, 155, 0.95); + --theme_light--text_brown: rgb(147, 114, 100); + --theme_light--text_orange: rgb(255, 163, 68); + --theme_light--text_yellow: rgb(255, 220, 73); + --theme_light--text_green: rgb(50, 169, 104); + --theme_light--text_blue: rgb(82, 156, 202); + --theme_light--text_purple: rgb(154, 109, 215); + --theme_light--text_pink: rgb(226, 85, 161); + --theme_light--text_red: rgb(218, 47, 35); + --theme_light--bg_gray: rgba(126, 128, 129, 0.5); + --theme_light--bg_brown: #50331f; + --theme_light--bg_orange: rgba(255, 155, 0, 0.58); + --theme_light--bg_yellow: rgba(183, 155, 0, 1); + --theme_light--bg_green: rgb(50, 129, 47); + --theme_light--bg_blue: rgba(0, 90, 146, 0.71); + --theme_light--bg_purple: rgba(91, 49, 148, 0.74); + --theme_light--bg_pink: rgba(243, 61, 159, 0.5); + --theme_light--bg_red: rgb(122, 20, 20); + --theme_light--line_gray: rgba(126, 128, 129, 0.301); + --theme_light--line_brown: #50331fad; + --theme_light--line_orange: rgba(255, 153, 0, 0.315); + --theme_light--line_yellow: rgba(183, 156, 0, 0.445); + --theme_light--line_green: rgba(50, 129, 47, 0.39); + --theme_light--line_blue: rgba(0, 90, 146, 0.521); + --theme_light--line_purple: rgba(90, 49, 148, 0.349); + --theme_light--line_pink: rgba(243, 61, 158, 0.301); + --theme_light--line_red: rgba(122, 20, 20, 0.623); +} From 9f92ff325da3387e835e05e2f934adea2c231d76 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 26 Jul 2020 16:32:55 +1000 Subject: [PATCH 018/371] refactor some stuff, fix some bugs, apply theme to ctrl+f popup --- repo/core/client.js | 39 +++++++++++++++++++-- repo/core/{window.js => create.js} | 0 repo/core/dark.css | 10 ++++-- repo/core/light.css | 10 ++++-- repo/core/mod.js | 6 ++-- repo/core/{dragarea.js => render.js} | 0 repo/core/styles.css | 52 ---------------------------- repo/core/tray.js | 19 ++++++++++ repo/core/variables.css | 4 +++ 9 files changed, 79 insertions(+), 61 deletions(-) rename repo/core/{window.js => create.js} (100%) rename repo/core/{dragarea.js => render.js} (100%) diff --git a/repo/core/client.js b/repo/core/client.js index 8a9676a..c0b7d21 100644 --- a/repo/core/client.js +++ b/repo/core/client.js @@ -12,7 +12,13 @@ module.exports = (defaults) => path = require('path'), fs = require('fs-extra'), is_mac = process.platform === 'darwin', - settings = store(defaults); + settings = store(defaults), + helpers = require('../../pkg/helpers.js'), + __notion = helpers.getNotion(), + notionIpc = require(`${__notion.replace( + /\\/g, + '/' + )}/app/helpers/notionIpc.js`); // additional hotkeys document.defaultView.addEventListener('keyup', (event) => { @@ -39,10 +45,39 @@ module.exports = (defaults) => sidebar.style.overflow = ''; setTimeout(() => { sidebar.style.overflow = 'hidden auto'; - }, 1); + }, 10); } } + // ctrl+f theming + function setTheme() { + const mode = JSON.parse(localStorage.theme).mode, + style = (prop) => + getComputedStyle(document.body).getPropertyValue(prop); + notionIpc.sendNotionToIndex('search:set-theme', { + 'mode': mode, + 'colors': { + 'white': style(`--theme_${mode}--todo_ticked-fill`), + 'blue': style(`--theme_${mode}--primary`), + }, + 'borderRadius': 3, + 'textColor': style(`--theme_${mode}--text`), + 'popoverBackgroundColor': style(`--theme_${mode}--card`), + 'popoverBoxShadow': `0 0 0 1px ${style( + `--theme_${mode}--overlay` + )}, 0 3px 6px ${style(`--theme_${mode}--overlay`)}`, + 'inputBoxShadow': `box-shadow: ${style( + `--theme_${mode}--primary` + )} 0px 0px 0px 1px inset, ${style( + `--theme_${mode}--primary_hover` + )} 0px 0px 0px 2px !important`, + 'inputBackgroundColor': style(`--theme_${mode}--main`), + 'dividerColor': style(`--theme_${mode}--table-border`), + 'shadowOpacity': 0.2, + }); + } + setInterval(setTheme, 100); + // frameless if (settings.frameless) { document.body.classList.add('frameless'); diff --git a/repo/core/window.js b/repo/core/create.js similarity index 100% rename from repo/core/window.js rename to repo/core/create.js diff --git a/repo/core/dark.css b/repo/core/dark.css index fc660d6..f8512f8 100644 --- a/repo/core/dark.css +++ b/repo/core/dark.css @@ -10,7 +10,8 @@ /** general ui **/ .notion-dark-theme [style*='background: rgb(55, 60, 63)'], -.notion-dark-theme [style*='background: rgba(69, 75, 78, 0.3)'] { +.notion-dark-theme [style*='background: rgba(69, 75, 78, 0.3)'], +.notion-dark-theme [style*='background: rgb(120, 123, 123)'] { background: var(--theme_dark--sidebar) !important; } .notion-body.dark, @@ -19,6 +20,10 @@ background: var(--theme_dark--main) !important; } +.notion-dark-theme [style*='background: rgba(15, 15, 15, 0.6)'] { + background: var(--theme_dark--overlay) !important; +} + .notion-dark-theme .notion-peek-renderer > div:nth-child(2) { max-width: var(--theme_dark--preview-width) !important; } @@ -107,7 +112,8 @@ } .notion-dark-theme [style*='background: rgb(71, 76, 80)'], -.notion-dark-theme [style*='background: rgb(80, 85, 88)'] { +.notion-dark-theme [style*='background: rgb(80, 85, 88)'], +.notion-dark-theme [style*='background: rgb(98, 102, 104)'] { background: var(--theme_dark--button_hover) !important; box-shadow: 0 0 0 0.5px var(--theme_dark--button_hover-border); } diff --git a/repo/core/light.css b/repo/core/light.css index 798e63a..7067305 100644 --- a/repo/core/light.css +++ b/repo/core/light.css @@ -10,7 +10,8 @@ /** general ui **/ .notion-light-theme [style*='background: rgb(247, 246, 243)'], -.notion-light-theme [style*='background: rgba(235, 236, 237, 0.3)'] { +.notion-light-theme [style*='background: rgba(235, 236, 237, 0.3)'], +.notion-light-theme [style*='background: rgb(223, 223, 222)'] { background: var(--theme_light--sidebar) !important; } .notion-body.light, @@ -20,6 +21,10 @@ background: var(--theme_light--main) !important; } +.notion-light-theme [style*='background: rgba(15, 15, 15, 0.6)'] { + background: var(--theme_light--overlay) !important; +} + .notion-light-theme .notion-peek-renderer > div:nth-child(2) { max-width: var(--theme_light--preview-width) !important; } @@ -104,7 +109,8 @@ box-shadow: var(--theme_light--table-border) 0px 1px 0px inset !important; } -.notion-light-theme [style*='background: rgba(55, 53, 47,'] { +.notion-light-theme [style*='background: rgba(55, 53, 47,'], +.notion-light-theme [style*='background: rgb(239, 239, 238)'] { background: var(--theme_light--button_hover) !important; box-shadow: 0 0 0 0.5px var(--theme_light--button_hover-border); } diff --git a/repo/core/mod.js b/repo/core/mod.js index 5e6ed8c..0539538 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -5,7 +5,7 @@ */ const defaults = { - openhidden: true, + openhidden: false, maximized: false, close_to_tray: true, frameless: true, @@ -27,8 +27,8 @@ module.exports = { options: [], hacks: { 'main/main.js': require('./tray.js')(defaults), - 'main/createWindow.js': require('./window.js')(defaults), - 'renderer/index.js': require('./dragarea.js')(defaults), + 'main/createWindow.js': require('./create.js')(defaults), + 'renderer/index.js': require('./render.js')(defaults), 'renderer/preload.js': require('./client.js')(defaults), }, }; diff --git a/repo/core/dragarea.js b/repo/core/render.js similarity index 100% rename from repo/core/dragarea.js rename to repo/core/render.js diff --git a/repo/core/styles.css b/repo/core/styles.css index 6a57d80..b2a7b88 100644 --- a/repo/core/styles.css +++ b/repo/core/styles.css @@ -10,55 +10,3 @@ @import './shared.css'; @import './scrollbars.css'; @import './titlebar.css'; - -:root { - --theme_light--main: rgb(5, 5, 5); - --theme_light--sidebar: rgb(1, 1, 1); - --theme_light--dragarea: #030303; - --theme_light--primary: rgb(177, 24, 24); - --theme_light--primary_hover: rgb(202, 26, 26); - --theme_light--primary_click: rgb(219, 41, 41); - --theme_light--primary_indicator: rgb(202, 26, 26); - - --theme_light--card: rgb(4, 4, 4); - --theme_light--card_border: rgba(10, 10, 10, 0.7); - --theme_light--button: rgb(15, 15, 15); - --theme_light--button_hover: rgb(32, 32, 32); - --theme_light--button_border: rgba(78, 78, 78, 0.7); - --theme_light--table_border: rgba(255, 255, 255, 0.1); - - --theme_light--scrollbar: #232425; - --theme_light--scrollbar-border: transparent; - --theme_light--scrollbar_hover: #373838; - - --theme_light--text: rgb(228, 228, 228); - --theme_light--text_ui: rgba(211, 211, 211, 0.637); - --theme_light--text_ui_info: rgba(211, 211, 211, 0.466); - --theme_light--text_gray: rgba(151, 154, 155, 0.95); - --theme_light--text_brown: rgb(147, 114, 100); - --theme_light--text_orange: rgb(255, 163, 68); - --theme_light--text_yellow: rgb(255, 220, 73); - --theme_light--text_green: rgb(50, 169, 104); - --theme_light--text_blue: rgb(82, 156, 202); - --theme_light--text_purple: rgb(154, 109, 215); - --theme_light--text_pink: rgb(226, 85, 161); - --theme_light--text_red: rgb(218, 47, 35); - --theme_light--bg_gray: rgba(126, 128, 129, 0.5); - --theme_light--bg_brown: #50331f; - --theme_light--bg_orange: rgba(255, 155, 0, 0.58); - --theme_light--bg_yellow: rgba(183, 155, 0, 1); - --theme_light--bg_green: rgb(50, 129, 47); - --theme_light--bg_blue: rgba(0, 90, 146, 0.71); - --theme_light--bg_purple: rgba(91, 49, 148, 0.74); - --theme_light--bg_pink: rgba(243, 61, 159, 0.5); - --theme_light--bg_red: rgb(122, 20, 20); - --theme_light--line_gray: rgba(126, 128, 129, 0.301); - --theme_light--line_brown: #50331fad; - --theme_light--line_orange: rgba(255, 153, 0, 0.315); - --theme_light--line_yellow: rgba(183, 156, 0, 0.445); - --theme_light--line_green: rgba(50, 129, 47, 0.39); - --theme_light--line_blue: rgba(0, 90, 146, 0.521); - --theme_light--line_purple: rgba(90, 49, 148, 0.349); - --theme_light--line_pink: rgba(243, 61, 158, 0.301); - --theme_light--line_red: rgba(122, 20, 20, 0.623); -} diff --git a/repo/core/tray.js b/repo/core/tray.js index 53525b3..c763ae3 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -89,6 +89,25 @@ module.exports = (defaults) => tray.on('click', () => { const windows = electron.BrowserWindow.getAllWindows(); + + for (let browser of windows) { + browser.webContents.sendInputEvent({ + type: 'keyDown', + modifiers: ['control', 'shift'], + key: 'L', + }); + browser.webContents.sendInputEvent({ + type: 'char', + modifiers: ['control', 'shift'], + key: 'L', + }); + browser.webContents.sendInputEvent({ + type: 'keyUp', + modifiers: ['control', 'shift'], + key: 'L', + }); + } + if (windows.some((win) => win.isVisible())) hideWindows(); else showWindows(); }); diff --git a/repo/core/variables.css b/repo/core/variables.css index d13f66a..6415a09 100644 --- a/repo/core/variables.css +++ b/repo/core/variables.css @@ -12,6 +12,7 @@ --theme_dark--main: rgb(47, 52, 55); --theme_dark--sidebar: rgb(55, 60, 63); + --theme_dark--overlay: rgba(15, 15, 15, 0.6); --theme_dark--dragarea: #272d2f; --theme_dark--preview-width: 977px; --theme_dark--preview_banner-height: 20vh; @@ -47,6 +48,7 @@ --theme_dark--todo_empty-border: currentColor; --theme_dark--todo_ticked: currentColor; + --theme_dark--todo_ticked-fill: white; --theme_dark--todo_ticked-background: var(--theme_dark--primary); --theme_dark--todo_hover-background: rgb(71, 76, 80); @@ -107,6 +109,7 @@ --theme_light--main: white; --theme_light--sidebar: rgb(247, 246, 243); + --theme_light--overlay: rgba(15, 15, 15, 0.6); --theme_light--dragarea: rgba(55, 53, 47, 0.04); --theme_light--preview-width: 977px; --theme_light--preview_banner-height: 20vh; @@ -142,6 +145,7 @@ --theme_light--todo_empty-border: currentColor; --theme_light--todo_ticked: currentColor; + --theme_light--todo_ticked-fill: white; --theme_light--todo_ticked-background: var(--theme_light--primary); --theme_light--todo_hover-background: rgba(55, 53, 47, 0.08); From 8dd7d0649cf4af3ff40697b15bf05ec9c5723073 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 28 Jul 2020 19:03:35 +1000 Subject: [PATCH 019/371] menu window creation --- repo/core/{ => css}/dark.css | 0 repo/core/{ => css}/light.css | 0 repo/core/{ => css}/scrollbars.css | 0 repo/core/{ => css}/shared.css | 0 repo/core/{ => css}/titlebar.css | 0 repo/core/{ => css}/variables.css | 0 repo/core/menu.html | 16 ++++++ repo/core/render.js | 2 + repo/core/styles.css | 12 ++-- repo/core/tray.js | 89 ++++++++++++++++++++++-------- 10 files changed, 91 insertions(+), 28 deletions(-) rename repo/core/{ => css}/dark.css (100%) rename repo/core/{ => css}/light.css (100%) rename repo/core/{ => css}/scrollbars.css (100%) rename repo/core/{ => css}/shared.css (100%) rename repo/core/{ => css}/titlebar.css (100%) rename repo/core/{ => css}/variables.css (100%) create mode 100644 repo/core/menu.html diff --git a/repo/core/dark.css b/repo/core/css/dark.css similarity index 100% rename from repo/core/dark.css rename to repo/core/css/dark.css diff --git a/repo/core/light.css b/repo/core/css/light.css similarity index 100% rename from repo/core/light.css rename to repo/core/css/light.css diff --git a/repo/core/scrollbars.css b/repo/core/css/scrollbars.css similarity index 100% rename from repo/core/scrollbars.css rename to repo/core/css/scrollbars.css diff --git a/repo/core/shared.css b/repo/core/css/shared.css similarity index 100% rename from repo/core/shared.css rename to repo/core/css/shared.css diff --git a/repo/core/titlebar.css b/repo/core/css/titlebar.css similarity index 100% rename from repo/core/titlebar.css rename to repo/core/css/titlebar.css diff --git a/repo/core/variables.css b/repo/core/css/variables.css similarity index 100% rename from repo/core/variables.css rename to repo/core/css/variables.css diff --git a/repo/core/menu.html b/repo/core/menu.html new file mode 100644 index 0000000..fcdd055 --- /dev/null +++ b/repo/core/menu.html @@ -0,0 +1,16 @@ + + + + + + Notion Enhancements Menu + + + + yayayay it works! + + diff --git a/repo/core/render.js b/repo/core/render.js index 13656c1..0add42f 100644 --- a/repo/core/render.js +++ b/repo/core/render.js @@ -16,6 +16,8 @@ module.exports = (defaults) => ), default_styles = dragarea.getAttribute('style'); + // document.body.innerText = document.body.innerHTML; + document .getElementById('notion') .addEventListener('ipc-message', (event) => { diff --git a/repo/core/styles.css b/repo/core/styles.css index b2a7b88..e4419e7 100644 --- a/repo/core/styles.css +++ b/repo/core/styles.css @@ -4,9 +4,9 @@ * (https://dragonwocky.me/) under the MIT license */ -@import './variables.css'; -@import './dark.css'; -@import './light.css'; -@import './shared.css'; -@import './scrollbars.css'; -@import './titlebar.css'; +@import './css/variables.css'; +@import './css/dark.css'; +@import './css/light.css'; +@import './css/shared.css'; +@import './css/scrollbars.css'; +@import './css/titlebar.css'; diff --git a/repo/core/tray.js b/repo/core/tray.js index c763ae3..b3d36a0 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -5,7 +5,7 @@ * (https://dragonwocky.me/) under the MIT license */ -let tray; +let tray, enhancer_menu; module.exports = (defaults) => function (store, __exports) { @@ -13,7 +13,9 @@ module.exports = (defaults) => path = require('path'), is_mac = process.platform === 'darwin', is_win = process.platform === 'win32', - settings = store(defaults); + settings = store(defaults), + helpers = require('../../pkg/helpers.js'), + __notion = helpers.getNotion(); electron.app.on('ready', () => { tray = new electron.Tray( @@ -27,6 +29,41 @@ module.exports = (defaults) => }) ); + function calculateWindowPos(width, height) { + const screen = electron.screen.getDisplayNearestPoint({ + x: tray.getBounds().x, + y: tray.getBounds().y, + }); + // left + if (screen.workArea.x > 0) + // The workspace starts more on the right + return { + x: screen.workArea.x, + y: screen.workArea.height - height, + }; + // top + if (screen.workArea.y > 0) + return { + x: Math.round( + tray.getBounds().x + tray.getBounds().width / 2 - width / 2 + ), + y: screen.workArea.y, + }; + // right + if (screen.workArea.width < screen.bounds.width) + return { + x: screen.workArea.width - width, + y: screen.bounds.height - height, + }; + // bottom + return { + x: Math.round( + tray.getBounds().x + tray.getBounds().width / 2 - width / 2 + ), + y: screen.workArea.height - height, + }; + } + const contextMenu = electron.Menu.buildFromTemplate([ { type: 'normal', @@ -61,7 +98,34 @@ module.exports = (defaults) => { type: 'normal', label: 'Enhancements', - // will open menu + click: () => { + const window_state = require(`${__notion.replace( + /\\/g, + '/' + )}/app/node_modules/electron-window-state/index.js`)({ + file: 'menu-windowstate.json', + defaultWidth: 275, + defaultHeight: 600, + }); + electron.shell.openExternal(JSON.stringify(window_state)); + enhancer_menu = new electron.BrowserWindow({ + show: true, + frame: false, + x: + window_state.x || + calculateWindowPos(window_state.width, window_state.height).x, + y: + window_state.y || + calculateWindowPos(window_state.width, window_state.height).y, + width: window_state.width, + height: window_state.height, + webPreferences: { + nodeIntegration: true, + session: electron.session.fromPartition('persist:notion'), + }, + }); + enhancer_menu.loadURL('enhancement://core/menu.html'); + }, }, { type: 'separator', @@ -89,25 +153,6 @@ module.exports = (defaults) => tray.on('click', () => { const windows = electron.BrowserWindow.getAllWindows(); - - for (let browser of windows) { - browser.webContents.sendInputEvent({ - type: 'keyDown', - modifiers: ['control', 'shift'], - key: 'L', - }); - browser.webContents.sendInputEvent({ - type: 'char', - modifiers: ['control', 'shift'], - key: 'L', - }); - browser.webContents.sendInputEvent({ - type: 'keyUp', - modifiers: ['control', 'shift'], - key: 'L', - }); - } - if (windows.some((win) => win.isVisible())) hideWindows(); else showWindows(); }); From f6b52e5c024697372e2b4bb6a4c62bace4bc05b2 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sat, 1 Aug 2020 23:46:43 +1000 Subject: [PATCH 020/371] theme menu window + bunch of other tweaks --- repo/core/buttons.js | 98 +++++++++++++++ repo/core/client.js | 183 +++++++++------------------- repo/core/create.js | 7 +- repo/core/css/buttons.css | 56 +++++++++ repo/core/css/menu.css | 69 +++++++++++ repo/core/css/shared.css | 8 ++ repo/core/css/titlebar.css | 52 +------- repo/core/css/variables.json | 162 ++++++++++++++++++++++++ repo/core/icons/alwaysontop_off.svg | 2 +- repo/core/icons/alwaysontop_on.svg | 2 +- repo/core/icons/close.svg | 2 +- repo/core/icons/maximize_off.svg | 2 +- repo/core/icons/maximize_on.svg | 2 +- repo/core/icons/minimize.svg | 2 +- repo/core/menu.html | 20 +-- repo/core/menu.js | 23 ++++ repo/core/mod.js | 3 + repo/core/render.js | 16 ++- repo/core/tray.js | 17 ++- 19 files changed, 524 insertions(+), 202 deletions(-) create mode 100644 repo/core/buttons.js create mode 100644 repo/core/css/buttons.css create mode 100644 repo/core/css/menu.css create mode 100644 repo/core/css/variables.json create mode 100644 repo/core/menu.js diff --git a/repo/core/buttons.js b/repo/core/buttons.js new file mode 100644 index 0000000..c1c57d2 --- /dev/null +++ b/repo/core/buttons.js @@ -0,0 +1,98 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/) under the MIT license + */ + +'use strict'; + +const __mod = require('./mod.js'), + store = require('../../pkg/store.js'), + settings = store(__mod.id, __mod.defaults), + path = require('path'), + fs = require('fs-extra'), + browser = require('electron').remote.getCurrentWindow(), + is_mac = process.platform === 'darwin', + buttons = { + element: document.createElement('div'), + insert: [ + 'alwaysontop', + ...(settings.frameless && !is_mac + ? ['minimize', 'maximize', 'close'] + : []), + ], + icons: { + raw: { + alwaysontop: { + on: fs.readFile( + path.resolve(`${__dirname}/icons/alwaysontop_on.svg`) + ), + off: fs.readFile( + path.resolve(`${__dirname}/icons/alwaysontop_off.svg`) + ), + }, + minimize: fs.readFile(path.resolve(`${__dirname}/icons/minimize.svg`)), + maximize: { + on: fs.readFile(path.resolve(`${__dirname}/icons/maximize_on.svg`)), + off: fs.readFile(path.resolve(`${__dirname}/icons/maximize_off.svg`)), + }, + close: fs.readFile(path.resolve(`${__dirname}/icons/close.svg`)), + }, + alwaysontop() { + return browser.isAlwaysOnTop() + ? buttons.icons.raw.alwaysontop.on + : buttons.icons.raw.alwaysontop.off; // '🠙' : '🠛' + }, + minimize() { + return buttons.icons.raw.minimize; // '⚊' + }, + maximize() { + return browser.isMaximized() + ? buttons.icons.raw.maximize.on + : buttons.icons.raw.maximize.off; // '🗗' : '🗖' + }, + close() { + return buttons.icons.raw.close; // '⨉' + }, + }, + actions: { + async alwaysontop() { + browser.setAlwaysOnTop(!browser.isAlwaysOnTop()); + this.innerHTML = await buttons.icons.alwaysontop(); + }, + minimize() { + browser.minimize(); + }, + async maximize() { + browser.isMaximized() ? browser.unmaximize() : browser.maximize(); + this.innerHTML = await buttons.icons.maximize(); + }, + close() { + browser.close(); + }, + }, + }; + +(async () => { + buttons.element.className = 'window-buttons-area'; + for (let btn of buttons.insert) { + buttons.element.innerHTML += ``; + setTimeout( + () => + (document.querySelector(`.window-button#btn-${btn}`).onclick = + buttons.actions[btn]), + 10 + ); + } + if (settings.frameless && !is_mac) { + setInterval(async () => { + const icon = (await buttons.icons.maximize()).toString(), + el = buttons.element.querySelector('#btn-maximize'); + if (el.innerHTML != icon) el.innerHTML = icon; + }, 100); + } +})(); + +module.exports = buttons; diff --git a/repo/core/client.js b/repo/core/client.js index c0b7d21..d0c802b 100644 --- a/repo/core/client.js +++ b/repo/core/client.js @@ -5,13 +5,11 @@ * (https://dragonwocky.me/) under the MIT license */ +'use strict'; + module.exports = (defaults) => function (store, __exports) { const electron = require('electron'), - browser = electron.remote.getCurrentWindow(), - path = require('path'), - fs = require('fs-extra'), - is_mac = process.platform === 'darwin', settings = store(defaults), helpers = require('../../pkg/helpers.js'), __notion = helpers.getNotion(), @@ -49,39 +47,9 @@ module.exports = (defaults) => } } - // ctrl+f theming - function setTheme() { - const mode = JSON.parse(localStorage.theme).mode, - style = (prop) => - getComputedStyle(document.body).getPropertyValue(prop); - notionIpc.sendNotionToIndex('search:set-theme', { - 'mode': mode, - 'colors': { - 'white': style(`--theme_${mode}--todo_ticked-fill`), - 'blue': style(`--theme_${mode}--primary`), - }, - 'borderRadius': 3, - 'textColor': style(`--theme_${mode}--text`), - 'popoverBackgroundColor': style(`--theme_${mode}--card`), - 'popoverBoxShadow': `0 0 0 1px ${style( - `--theme_${mode}--overlay` - )}, 0 3px 6px ${style(`--theme_${mode}--overlay`)}`, - 'inputBoxShadow': `box-shadow: ${style( - `--theme_${mode}--primary` - )} 0px 0px 0px 1px inset, ${style( - `--theme_${mode}--primary_hover` - )} 0px 0px 0px 2px !important`, - 'inputBackgroundColor': style(`--theme_${mode}--main`), - 'dividerColor': style(`--theme_${mode}--table-border`), - 'shadowOpacity': 0.2, - }); - } - setInterval(setTheme, 100); - // frameless if (settings.frameless) { document.body.classList.add('frameless'); - // draggable area const dragarea = document.createElement('div'); dragarea.className = 'window-dragarea'; @@ -90,100 +58,10 @@ module.exports = (defaults) => '--configured-dragarea_height', `${settings.dragarea_height + 2}px` ); - let sidebar_width; - interval_attempts.patchDragarea = setInterval(patchDragarea, 50); - function patchDragarea() { - const sidebar = document.querySelector('.notion-sidebar'); - if (!sidebar) return; - clearInterval(interval_attempts.patchDragarea); - let new_width = - sidebar.style.height === 'auto' ? '0px' : sidebar.style.width; - if (sidebar_width !== new_width) { - sidebar_width = new_width; - electron.ipcRenderer.sendToHost( - `enhancer:sidebar-width-${sidebar_width}` - ); - } - } } // window buttons - const buttons = { - element: document.createElement('span'), - insert: ['alwaysontop'], - icons: { - raw: { - alwaysontop: { - on: fs.readFile( - path.resolve(`${__dirname}/icons/alwaysontop_on.svg`) - ), - off: fs.readFile( - path.resolve(`${__dirname}/icons/alwaysontop_off.svg`) - ), - }, - minimize: fs.readFile( - path.resolve(`${__dirname}/icons/minimize.svg`) - ), - maximize: { - on: fs.readFile( - path.resolve(`${__dirname}/icons/maximize_on.svg`) - ), - off: fs.readFile( - path.resolve(`${__dirname}/icons/maximize_off.svg`) - ), - }, - close: fs.readFile(path.resolve(`${__dirname}/icons/close.svg`)), - }, - alwaysontop() { - return browser.isAlwaysOnTop() - ? buttons.icons.raw.alwaysontop.on - : buttons.icons.raw.alwaysontop.off; // '🠙' : '🠛' - }, - minimize() { - return buttons.icons.raw.minimize; // '⚊' - }, - maximize() { - return browser.isMaximized() - ? buttons.icons.raw.maximize.on - : buttons.icons.raw.maximize.off; // '🗗' : '🗖' - }, - close() { - return buttons.icons.raw.close; // '⨉' - }, - }, - actions: { - async alwaysontop() { - browser.setAlwaysOnTop(!browser.isAlwaysOnTop()); - this.innerHTML = await buttons.icons.alwaysontop(); - }, - minimize() { - browser.minimize(); - }, - async maximize() { - browser.isMaximized() ? browser.unmaximize() : browser.maximize(); - this.innerHTML = await buttons.icons.maximize(); - }, - close() { - browser.close(); - }, - }, - }; - - if (settings.frameless && !is_mac) - buttons.insert.push('minimize', 'maximize', 'close'); - buttons.element.className = 'window-buttons-area'; - for (let btn of buttons.insert) { - buttons.element.innerHTML += ``; - } - if (settings.frameless && !is_mac) - setInterval(async () => { - const icon = await buttons.icons.maximize(), - el = buttons.element.querySelector('.btn-maximize'); - if (el.innerHTML != icon) el.innerHTML = icon; - }, 100); - + const buttons = require('./buttons.js'); document .querySelector('.notion-topbar > div[style*="display: flex"]') .appendChild(buttons.element); @@ -196,9 +74,58 @@ module.exports = (defaults) => .querySelector('.notion-topbar-share-menu') .parentElement.classList.add('notion-topbar-actions'); - for (let btn of buttons.insert) { - document.querySelector(`.window-button.btn-${btn}`).onclick = - buttons.actions[btn]; + let sidebar_width; + function communicationLoop() { + const getStyle = (prop) => + getComputedStyle(document.body).getPropertyValue(prop), + mode = JSON.parse(localStorage.theme).mode; + + // ctrl+f theming + notionIpc.sendNotionToIndex('search:set-theme', { + 'mode': mode, + 'colors': { + 'white': getStyle(`--theme_${mode}--todo_ticked-fill`), + 'blue': getStyle(`--theme_${mode}--primary`), + }, + 'borderRadius': 3, + 'textColor': getStyle(`--theme_${mode}--text`), + 'popoverBackgroundColor': getStyle(`--theme_${mode}--card`), + 'popoverBoxShadow': `0 0 0 1px ${getStyle( + `--theme_${mode}--overlay` + )}, 0 3px 6px ${getStyle(`--theme_${mode}--overlay`)}`, + 'inputBoxShadow': `box-shadow: ${getStyle( + `--theme_${mode}--primary` + )} 0px 0px 0px 1px inset, ${getStyle( + `--theme_${mode}--primary_hover` + )} 0px 0px 0px 2px !important`, + 'inputBackgroundColor': getStyle(`--theme_${mode}--main`), + 'dividerColor': getStyle(`--theme_${mode}--table-border`), + 'shadowOpacity': 0.2, + }); + + // enhancer menu + electron.ipcRenderer.send('enhancer:set-theme', { + mode, + rules: require('./css/variables.json').map((rule) => [ + rule, + getStyle(rule), + ]), + }); + + // draggable area resizing + const sidebar = document.querySelector('.notion-sidebar'); + if (settings.frameless && sidebar) { + let new_sidebar_width = + sidebar.style.height === 'auto' ? '0px' : sidebar.style.width; + if (sidebar_width !== new_sidebar_width) { + sidebar_width = new_sidebar_width; + electron.ipcRenderer.sendToHost( + 'enhancer:sidebar-width', + sidebar_width + ); + } + } } + setInterval(communicationLoop, 500); } }; diff --git a/repo/core/create.js b/repo/core/create.js index 73c7b4a..87709cb 100644 --- a/repo/core/create.js +++ b/repo/core/create.js @@ -5,10 +5,15 @@ * (https://dragonwocky.me/) under the MIT license */ +'use strict'; + module.exports = (defaults) => function (store, __exports) { const electron = require('electron'), - allWindows = electron.BrowserWindow.getAllWindows, + allWindows = () => + electron.BrowserWindow.getAllWindows().filter( + (win) => win.getTitle() !== 'notion-enhancer menu' + ), // createWindow = __exports.createWindow, path = require('path'), settings = store(defaults), diff --git a/repo/core/css/buttons.css b/repo/core/css/buttons.css new file mode 100644 index 0000000..6e94223 --- /dev/null +++ b/repo/core/css/buttons.css @@ -0,0 +1,56 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/) under the MIT license + */ + +.window-buttons-area { + display: flex; + align-items: center; + font-size: 14px; +} +.window-button { + background: transparent; + border: 0; + margin: 0px 0px 0px 9px; + width: 32px; + line-height: 26px; + border-radius: 4px; + font-size: 16px; + transition: background 0.2s; + cursor: default; +} +.window-button svg { + margin-top: 8px; + width: 14px; + height: 14px; +} +.window-button svg path { + fill: currentColor; +} +.window-button svg line { + stroke: currentColor; +} + +.notion-dark-theme .window-button:hover { + background: var(--theme_dark--button_hover); + box-shadow: 0 0 0 0.5px var(--theme_dark--button_hover-border); +} +.notion-dark-theme .window-button#btn-close:hover { + background: var(--theme_dark--button_close); +} +.notion-dark-theme .window-button#btn-close:hover svg line { + stroke: var(--theme_dark--button_close-fill); +} + +.notion-light-theme .window-button#btn-close:hover { + background: var(--theme_light--button_close); +} +.notion-light-theme .window-button#btn-close:hover svg line { + stroke: var(--theme_light--button_close-fill); +} +.notion-light-theme .window-button:hover { + background: var(--theme_light--button_hover); + box-shadow: 0 0 0 0.5px var(--theme_light--button_hover-border); +} diff --git a/repo/core/css/menu.css b/repo/core/css/menu.css new file mode 100644 index 0000000..ee75464 --- /dev/null +++ b/repo/core/css/menu.css @@ -0,0 +1,69 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/) under the MIT license + */ + +@import './buttons.css'; +@import './scrollbars.css'; + +* { + box-sizing: border-box; + word-break: break-word; + text-decoration: none; + text-size-adjust: 100%; +} +html, +body { + width: 100%; + height: 100%; + margin: 0; + padding: 0; +} + +.notion-dark-theme * { + outline-color: var(--theme_dark--card-border); +} +.notion-light-theme * { + outline-color: var(--theme_light--card-border); +} + +.notion-dark-theme { + background: var(--theme_dark--main); +} +.notion-light-theme { + background: var(--theme_light--main); +} + +.notion-dark-theme, +.notion-dark-theme button { + color: var(--theme_dark--text); + font-family: var(--theme_dark--font_sans); +} +.notion-light-theme, +.notion-light-theme button { + color: var(--theme_light--text); + font-family: var(--theme_light--font_sans); +} + +#menu-titlebar { + display: flex; + padding: 0.4em; + -webkit-app-region: drag; +} +#menu-titlebar button { + -webkit-app-region: no-drag; +} +#menu-titlebar :first-child { + margin-left: auto; +} +.notion-dark-theme #menu-titlebar { + background: var(--theme_dark--dragarea); +} +.notion-light-theme #menu-titlebar { + background: var(--theme_light--dragarea); +} + +main { + padding: 1em; +} diff --git a/repo/core/css/shared.css b/repo/core/css/shared.css index c36f5ce..dffbafe 100644 --- a/repo/core/css/shared.css +++ b/repo/core/css/shared.css @@ -37,6 +37,14 @@ .notion-page-content .notion-collection_view-block { width: 100% !important; } +.notion-page-content + .notion-collection_view-block + [style*='padding-left: 96px'], +.notion-page-content + .notion-collection_view-block + [style*='padding-left: 126px'] { + padding-left: 0 !important; +} .notion-page-content .notion-collection_view-block [style*='min-width: calc(100% - 192px);'], diff --git a/repo/core/css/titlebar.css b/repo/core/css/titlebar.css index c4d3335..2916a7b 100644 --- a/repo/core/css/titlebar.css +++ b/repo/core/css/titlebar.css @@ -6,6 +6,8 @@ * (https://dragonwocky.me/) under the MIT license */ +@import 'buttons.css'; + .frameless .notion-topbar { height: calc(var(--configured-dragarea_height, 10px) + 45px) !important; } @@ -45,56 +47,6 @@ } } -.window-buttons-area { - display: flex; - align-items: center; - font-size: 14px; -} -.window-button { - background: transparent; - border: 0; - margin: 0px 0px 0px 9px; - width: 32px; - line-height: 26px; - border-radius: 4px; - font-size: 16px; - transition: background 0.2s; - cursor: default; -} -.window-button svg { - margin-top: 8px; - width: 14px; - height: 14px; -} -.window-button svg path { - fill: currentColor; -} -.window-button svg line { - stroke: currentColor; -} - -.notion-dark-theme .window-button:hover { - background: var(--theme_dark--button_hover); - box-shadow: 0 0 0 0.5px var(--theme_dark--button_hover-border); -} -.notion-dark-theme .window-button.btn-close:hover { - background: var(--theme_dark--button_close); -} -.notion-dark-theme .window-button.btn-close:hover svg line { - stroke: var(--theme_dark--button_close-fill); -} - -.notion-light-theme .window-button.btn-close:hover { - background: var(--theme_light--button_close); -} -.notion-light-theme .window-button.btn-close:hover svg line { - stroke: var(--theme_light--button_close-fill); -} -.notion-light-theme .window-button:hover { - background: var(--theme_light--button_hover); - box-shadow: 0 0 0 0.5px var(--theme_light--button_hover-border); -} - /* hide topbar when sidebar is hidden */ .notion-sidebar-container[style*='width: 0px;'] + .notion-frame { height: calc( diff --git a/repo/core/css/variables.json b/repo/core/css/variables.json new file mode 100644 index 0000000..491b9f3 --- /dev/null +++ b/repo/core/css/variables.json @@ -0,0 +1,162 @@ +[ + "--theme_dark--main", + "--theme_dark--sidebar", + "--theme_dark--overlay", + "--theme_dark--dragarea", + "--theme_dark--preview-width", + "--theme_dark--preview_banner-height", + "--theme_dark--page_banner-height", + "--theme_dark--font_sans", + "--theme_dark--font_serif", + "--theme_dark--font_mono", + "--theme_dark--font_code", + "--theme_dark--scrollbar", + "--theme_dark--scrollbar-border", + "--theme_dark--scrollbar_hover", + "--theme_dark--card", + "--theme_dark--card-border", + "--theme_dark--table-border", + "--theme_dark--button_hover", + "--theme_dark--button_hover-border", + "--theme_dark--button_close", + "--theme_dark--button_close-fill", + "--theme_dark--selected", + "--theme_dark--primary", + "--theme_dark--primary_hover", + "--theme_dark--primary_click", + "--theme_dark--primary_indicator", + "--theme_dark--todo_empty-border", + "--theme_dark--todo_ticked", + "--theme_dark--todo_ticked-fill", + "--theme_dark--todo_ticked-background", + "--theme_dark--todo_hover-background", + "--theme_dark--danger_text", + "--theme_dark--danger_border", + "--theme_dark--text", + "--theme_dark--text_ui", + "--theme_dark--text_ui_info", + "--theme_dark--text_gray", + "--theme_dark--text_brown", + "--theme_dark--text_orange", + "--theme_dark--text_yellow", + "--theme_dark--text_green", + "--theme_dark--text_blue", + "--theme_dark--text_purple", + "--theme_dark--text_pink", + "--theme_dark--text_red", + "--theme_dark--bg_gray", + "--theme_dark--bg_brown", + "--theme_dark--bg_orange", + "--theme_dark--bg_yellow", + "--theme_dark--bg_green", + "--theme_dark--bg_blue", + "--theme_dark--bg_purple", + "--theme_dark--bg_pink", + "--theme_dark--bg_red", + "--theme_dark--line_gray", + "--theme_dark--line_brown", + "--theme_dark--line_orange", + "--theme_dark--line_yellow", + "--theme_dark--line_green", + "--theme_dark--line_blue", + "--theme_dark--line_purple", + "--theme_dark--line_pink", + "--theme_dark--line_red", + "--theme_dark--code_inline-text", + "--theme_dark--code_inline-background", + "--theme_dark--code_text", + "--theme_dark--code-background", + "--theme_dark--code_function", + "--theme_dark--code_keyword", + "--theme_dark--code_tag", + "--theme_dark--code_operator", + "--theme_dark--code_property", + "--theme_dark--code_builtin", + "--theme_dark--code_attr-name", + "--theme_dark--code_comment", + "--theme_dark--code_punctuation", + "--theme_dark--code_doctype", + "--theme_dark--code_number", + "--theme_dark--code_string", + "--theme_dark--code_attr-value", + "--theme_light--main", + "--theme_light--sidebar", + "--theme_light--overlay", + "--theme_light--dragarea", + "--theme_light--preview-width", + "--theme_light--preview_banner-height", + "--theme_light--page_banner-height", + "--theme_light--font_sans", + "--theme_light--font_serif", + "--theme_light--font_mono", + "--theme_light--font_code", + "--theme_light--scrollbar", + "--theme_light--scrollbar-border", + "--theme_light--scrollbar_hover", + "--theme_light--card", + "--theme_light--card-border", + "--theme_light--table-border", + "--theme_light--button_hover", + "--theme_light--button_hover-border", + "--theme_light--button_close", + "--theme_light--button_close-fill", + "--theme_light--selected", + "--theme_light--primary", + "--theme_light--primary_hover", + "--theme_light--primary_click", + "--theme_light--primary_indicator", + "--theme_light--todo_empty-border", + "--theme_light--todo_ticked", + "--theme_light--todo_ticked-fill", + "--theme_light--todo_ticked-background", + "--theme_light--todo_hover-background", + "--theme_light--danger_text", + "--theme_light--danger_border", + "--theme_light--text", + "--theme_light--text_ui", + "--theme_light--text_ui_info", + "--theme_light--text_gray", + "--theme_light--text_brown", + "--theme_light--text_orange", + "--theme_light--text_yellow", + "--theme_light--text_green", + "--theme_light--text_blue", + "--theme_light--text_purple", + "--theme_light--text_pink", + "--theme_light--text_red", + "--theme_light--bg_gray", + "--theme_light--bg_brown", + "--theme_light--bg_orange", + "--theme_light--bg_yellow", + "--theme_light--bg_green", + "--theme_light--bg_blue", + "--theme_light--bg_purple", + "--theme_light--bg_pink", + "--theme_light--bg_red", + "--theme_light--line_gray", + "--theme_light--line_brown", + "--theme_light--line_orange", + "--theme_light--line_yellow", + "--theme_light--line_green", + "--theme_light--line_blue", + "--theme_light--line_purple", + "--theme_light--line_pink", + "--theme_light--line_red", + "--theme_light--code_inline-text", + "--theme_light--code_inline-background", + "--theme_light--code_text", + "--theme_light--code-background", + "--theme_light--code_function", + "--theme_light--code_keyword", + "--theme_light--code_tag", + "--theme_light--code_operator", + "--theme_light--code_property", + "--theme_light--code_builtin", + "--theme_light--code_attr-name", + "--theme_light--code_comment", + "--theme_light--code_punctuation", + "--theme_light--code_doctype", + "--theme_light--code_number", + "--theme_light--code_string", + "--theme_light--code_attr-value" +] diff --git a/repo/core/icons/alwaysontop_off.svg b/repo/core/icons/alwaysontop_off.svg index e731f9b..648339d 100644 --- a/repo/core/icons/alwaysontop_off.svg +++ b/repo/core/icons/alwaysontop_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/alwaysontop_on.svg b/repo/core/icons/alwaysontop_on.svg index b9befcd..0c2abaf 100644 --- a/repo/core/icons/alwaysontop_on.svg +++ b/repo/core/icons/alwaysontop_on.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/close.svg b/repo/core/icons/close.svg index 7268fb0..ea9caad 100644 --- a/repo/core/icons/close.svg +++ b/repo/core/icons/close.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/maximize_off.svg b/repo/core/icons/maximize_off.svg index e79979f..ebd1c92 100644 --- a/repo/core/icons/maximize_off.svg +++ b/repo/core/icons/maximize_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/maximize_on.svg b/repo/core/icons/maximize_on.svg index 038b21e..c7fdcbd 100644 --- a/repo/core/icons/maximize_on.svg +++ b/repo/core/icons/maximize_on.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/minimize.svg b/repo/core/icons/minimize.svg index e40cd84..ec85d9d 100644 --- a/repo/core/icons/minimize.svg +++ b/repo/core/icons/minimize.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/menu.html b/repo/core/menu.html index fcdd055..09a0eae 100644 --- a/repo/core/menu.html +++ b/repo/core/menu.html @@ -3,14 +3,20 @@ - Notion Enhancements Menu + notion-enhancer menu + + - - yayayay it works! + +
+ hi +
+ diff --git a/repo/core/menu.js b/repo/core/menu.js new file mode 100644 index 0000000..51a8e06 --- /dev/null +++ b/repo/core/menu.js @@ -0,0 +1,23 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/) under the MIT license + */ + +'use strict'; + +const __mod = require('./mod.js'), + store = require('../../pkg/store.js'), + settings = store(__mod.id, __mod.defaults), + electron = require('electron'); + +window['__start'] = async () => { + const buttons = require('./buttons.js'); + document.querySelector('#menu-titlebar').appendChild(buttons.element); + + electron.ipcRenderer.on('enhancer:set-theme', (event, theme) => { + document.body.className = `notion-${theme.mode}-theme smooth-scrollbars`; + for (const style of theme.rules) + document.body.style.setProperty(style[0], style[1]); + }); +}; diff --git a/repo/core/mod.js b/repo/core/mod.js index 0539538..294000b 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -4,6 +4,8 @@ * (https://dragonwocky.me/) under the MIT license */ +'use strict'; + const defaults = { openhidden: false, maximized: false, @@ -31,4 +33,5 @@ module.exports = { 'renderer/index.js': require('./render.js')(defaults), 'renderer/preload.js': require('./client.js')(defaults), }, + defaults, }; diff --git a/repo/core/render.js b/repo/core/render.js index 0add42f..d77e17a 100644 --- a/repo/core/render.js +++ b/repo/core/render.js @@ -4,6 +4,8 @@ * (https://dragonwocky.me/) under the MIT license */ +'use strict'; + module.exports = (defaults) => function (store, __exports) { const __start = window['__start'], @@ -21,15 +23,11 @@ module.exports = (defaults) => document .getElementById('notion') .addEventListener('ipc-message', (event) => { - if (event.channel.startsWith('enhancer:sidebar-width-')) - dragarea.setAttribute( - 'style', - `${default_styles} top: 2px; height: ${ - settings.dragarea_height - }px; left: ${event.channel.slice( - 'enhancer:sidebar-width-'.length - )};` - ); + if (event.channel !== 'enhancer:sidebar-width') return; + dragarea.setAttribute( + 'style', + `${default_styles} top: 2px; height: ${settings.dragarea_height}px; left: ${event.args[0]};` + ); }); }; }; diff --git a/repo/core/tray.js b/repo/core/tray.js index b3d36a0..f22eb74 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -5,6 +5,8 @@ * (https://dragonwocky.me/) under the MIT license */ +'use strict'; + let tray, enhancer_menu; module.exports = (defaults) => @@ -29,6 +31,11 @@ module.exports = (defaults) => }) ); + electron.ipcMain.on('enhancer:set-theme', (event, arg) => { + if (!enhancer_menu) return; + enhancer_menu.webContents.send('enhancer:set-theme', arg); + }); + function calculateWindowPos(width, height) { const screen = electron.screen.getDisplayNearestPoint({ x: tray.getBounds().x, @@ -36,7 +43,6 @@ module.exports = (defaults) => }); // left if (screen.workArea.x > 0) - // The workspace starts more on the right return { x: screen.workArea.x, y: screen.workArea.height - height, @@ -99,11 +105,13 @@ module.exports = (defaults) => type: 'normal', label: 'Enhancements', click: () => { + if (enhancer_menu) return enhancer_menu.show(); const window_state = require(`${__notion.replace( /\\/g, '/' )}/app/node_modules/electron-window-state/index.js`)({ file: 'menu-windowstate.json', + path: helpers.data_folder, defaultWidth: 275, defaultHeight: 600, }); @@ -111,6 +119,8 @@ module.exports = (defaults) => enhancer_menu = new electron.BrowserWindow({ show: true, frame: false, + backgroundColor: '#ffffff', + titleBarStyle: 'hiddenInset', x: window_state.x || calculateWindowPos(window_state.width, window_state.height).x, @@ -120,11 +130,16 @@ module.exports = (defaults) => width: window_state.width, height: window_state.height, webPreferences: { + preload: path.resolve(`${__dirname}/menu.js`), nodeIntegration: true, session: electron.session.fromPartition('persist:notion'), }, }); enhancer_menu.loadURL('enhancement://core/menu.html'); + enhancer_menu.on('close', (e) => { + window_state.saveState(enhancer_menu); + enhancer_menu = null; + }); }, }, { From 7d0560228b604ef398e44dd453774d95d2dd497d Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 2 Aug 2020 09:01:12 +1000 Subject: [PATCH 021/371] button spacing bugfix --- repo/core/css/shared.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repo/core/css/shared.css b/repo/core/css/shared.css index dffbafe..6a15788 100644 --- a/repo/core/css/shared.css +++ b/repo/core/css/shared.css @@ -56,3 +56,9 @@ .notion-page-content .notion-collection_view-block > div { padding: 0 1px; } + +/* fix button resizing */ +.notion-collection_view-block [role='button'], +.notion-collection_view_page-block [role='button'] { + border-width: 0 !important; +} From 19593e1d01871de7cb25d4499f404b34d562fe34 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 2 Aug 2020 16:26:28 +1000 Subject: [PATCH 022/371] add alerts (inc. update checker) to menu --- repo/core/create.js | 1 + repo/core/css/menu.css | 127 +++++++++++++++++++++++++++++++++++++++++ repo/core/menu.html | 9 +-- repo/core/menu.js | 82 +++++++++++++++++++++++++- repo/core/tray.js | 1 - 5 files changed, 212 insertions(+), 8 deletions(-) diff --git a/repo/core/create.js b/repo/core/create.js index 87709cb..4a2a1e9 100644 --- a/repo/core/create.js +++ b/repo/core/create.js @@ -60,6 +60,7 @@ module.exports = (defaults) => allWindows().some((win) => win.isVisible() && win.id != window.id) ) { window.show(); + window.focus(); if (settings.maximized) window.maximize(); if ( (focused_window && focused_window.isFullScreen()) || diff --git a/repo/core/css/menu.css b/repo/core/css/menu.css index ee75464..f73b2de 100644 --- a/repo/core/css/menu.css +++ b/repo/core/css/menu.css @@ -7,6 +7,15 @@ @import './buttons.css'; @import './scrollbars.css'; +@keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + * { box-sizing: border-box; word-break: break-word; @@ -21,12 +30,31 @@ body { padding: 0; } +body:not([style]) > * { + display: none !important; +} +body:not([style])::after { + content: ''; + position: absolute; + left: 44vw; + top: calc(50% - 7.5vw); + width: 10vw; + height: 10vw; + border: 4px solid rgb(34, 34, 34); + border-top-color: transparent; + border-radius: 50%; + animation: spin 0.8s linear infinite; +} + .notion-dark-theme * { outline-color: var(--theme_dark--card-border); } .notion-light-theme * { outline-color: var(--theme_light--card-border); } +*:active { + outline: none; +} .notion-dark-theme { background: var(--theme_dark--main); @@ -67,3 +95,102 @@ body { main { padding: 1em; } + +#alerts [role='alert'] { + padding: 0.25em; + display: flex; + margin-bottom: 0.75em; +} +#alerts [role='alert']::before { + content: '!'; + display: block; + /* margin: auto 0; */ + font-weight: bold; + font-size: 1.2em; + padding: 0.5rem; +} +#alerts [role='alert'] p { + font-size: 1rem; + margin: auto 0; + padding: 0.5em; +} + +.notion-dark-theme #alerts [role='alert'] p { + color: var(--theme_dark--text_ui); +} +.notion-light-theme #alerts [role='alert'] p { + color: var(--theme_light--text_ui); +} + +.notion-light-theme #alerts [role='alert']::before { + color: rgba(0, 0, 0, 0.2); +} +.notion-light-theme #alerts [role='alert'] { + border: 1px solid rgba(0, 0, 0, 0.1); +} + +.notion-dark-theme #alerts .error { + border: 1px solid var(--theme_dark--bg_red); + background: var(--theme_dark--line_red); +} +.notion-dark-theme #alerts .error::before { + color: var(--theme_dark--bg_red); +} +.notion-light-theme #alerts .error { + background: var(--theme_light--line_red); +} + +.notion-dark-theme #alerts .warning { + border: 1px solid var(--theme_dark--bg_yellow); + background: var(--theme_dark--line_yellow); +} +.notion-dark-theme #alerts .warning::before { + color: var(--theme_dark--bg_yellow); +} +.notion-light-theme #alerts .warning { + background: var(--theme_light--line_yellow); +} + +.notion-dark-theme #alerts .info { + border: 1px solid var(--theme_dark--bg_blue); + background: var(--theme_dark--line_blue); +} +.notion-dark-theme #alerts .info::before { + color: var(--theme_dark--bg_blue); +} +.notion-light-theme #alerts .info { + background: var(--theme_light--line_blue); +} + +#alerts .success::before { + content: '✓'; +} +.notion-dark-theme #alerts .success { + border: 1px solid var(--theme_dark--bg_green); + background: var(--theme_dark--line_green); +} +.notion-dark-theme #alerts .success::before { + color: var(--theme_dark--bg_green); +} +.notion-light-theme #alerts .success { + background: var(--theme_light--line_green); +} + +code { + border-radius: 0.1em; + padding: 0.2em 0.4em; +} +.notion-dark-theme code { + font: 0.85em var(--theme_dark--font_code); + /* color: var(--theme_dark--code_inline-text); */ + background: var(--theme_dark--code_inline-background); +} +.notion-light-theme code { + font: 0.85em var(--theme_light--font_code); + /* color: var(--theme_light--code_inline-text); */ + background: var(--theme_light--code_inline-background); +} + +u { + text-decoration: underline; +} diff --git a/repo/core/menu.html b/repo/core/menu.html index 09a0eae..1d1d336 100644 --- a/repo/core/menu.html +++ b/repo/core/menu.html @@ -4,16 +4,13 @@ notion-enhancer menu - - +
- hi +
+
diff --git a/repo/core/menu.js b/repo/core/menu.js index 0f7438b..37ccf5e 100644 --- a/repo/core/menu.js +++ b/repo/core/menu.js @@ -9,14 +9,23 @@ const __mod = require('./mod.js'), store = require('../../pkg/store.js'), helpers = require('../../pkg/helpers.js'), - electron = require('electron'); + electron = require('electron'), + browser = electron.remote.getCurrentWindow(); window['__start'] = async () => { const buttons = require('./buttons.js'); document.querySelector('#menu-titlebar').appendChild(buttons.element); + document.defaultView.addEventListener('keyup', (event) => { + if (event.code === 'F5') window.reload(); + if (event.key === 'e' && (event.ctrlKey || event.metaKey)) { + electron.remote.BrowserWindow.getAllWindows()[0].show(); + browser.close(); + } + }); + electron.ipcRenderer.on('enhancer:set-theme', (event, theme) => { - document.body.className = `notion-${theme.mode}-theme smooth-scrollbars`; + document.body.className = `notion-${theme.mode}-theme`; for (const style of theme.rules) document.body.style.setProperty(style[0], style[1]); }); @@ -85,6 +94,7 @@ window['__start'] = async () => { ).prepend(); }); + // mod loader const modules = helpers.getEnhancements(); if (modules.loaded.length) console.info( @@ -100,4 +110,44 @@ window['__start'] = async () => { .join(', ')}.` ).append(); } + + // mod options + function markdown(string) { + return snarkdown( + string + .split('\n') + .map((line) => line.trim()) + .join('
') + ).replace(/([^\\])?~~([^\n]*[^\\])~~/g, '$1$2'); + } + const $modules = document.querySelector('#modules'); + for (let mod of modules.loaded.sort((a, b) => + store('mods', { [mod.id]: { pinned: false } }).pinned + ? 1 + : a.name.localeCompare(b.name) + )) { + $modules.append( + createElement(` +
+

${mod.name}

+

${mod.tags + .map((tag) => (tag.startsWith('#') ? tag : `#${tag}`)) + .join(' ')}

+

${markdown(mod.desc)}

+

+ + + ${mod.author} + + v${mod.version} +

+
+ `) + ); + } }; diff --git a/repo/core/mod.js b/repo/core/mod.js index 294000b..894d854 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -18,10 +18,10 @@ const defaults = { module.exports = { id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', - type: 'core', + tags: ['core', 'extension'], name: 'notion-enhancer core', - desc: - 'the modloader itself, including: the CLI, the menu, and enabling/disabling/insertion/updating of mods.', + desc: `the **modloader** itself, _including_: the [CLI](https://github.com), the menu, and ~~enabling/disabling/insertion/updating of~~ mods. + ![](https://preview.redd.it/vtiw9ulqlt951.png?width=1368&format=png&auto=webp&s=733d8b27ec62151c7858b4eca463f809ead6395a)`, version: require('../../package.json').version, author: 'dragonwocky', thumb: diff --git a/repo/core/tray.js b/repo/core/tray.js index 6a2acee..91c8a48 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -35,6 +35,7 @@ module.exports = (defaults) => if (!enhancer_menu) return; enhancer_menu.webContents.send('enhancer:set-theme', arg); }); + electron.ipcMain.on('enhancer:open-extension-menu', openExtensionMenu); function calculateWindowPos(width, height) { const screen = electron.screen.getDisplayNearestPoint({ @@ -70,6 +71,43 @@ module.exports = (defaults) => }; } + function openExtensionMenu() { + if (enhancer_menu) return enhancer_menu.show(); + const window_state = require(`${__notion.replace( + /\\/g, + '/' + )}/app/node_modules/electron-window-state/index.js`)({ + file: 'menu-windowstate.json', + path: helpers.data_folder, + defaultWidth: 275, + defaultHeight: 600, + }); + electron.shell.openExternal(JSON.stringify(window_state)); + enhancer_menu = new electron.BrowserWindow({ + show: true, + frame: false, + titleBarStyle: 'hiddenInset', + x: + window_state.x || + calculateWindowPos(window_state.width, window_state.height).x, + y: + window_state.y || + calculateWindowPos(window_state.width, window_state.height).y, + width: window_state.width, + height: window_state.height, + webPreferences: { + preload: path.resolve(`${__dirname}/menu.js`), + nodeIntegration: true, + session: electron.session.fromPartition('persist:notion'), + }, + }); + enhancer_menu.loadURL('enhancement://core/menu.html'); + enhancer_menu.on('close', (e) => { + window_state.saveState(enhancer_menu); + enhancer_menu = null; + }); + } + const contextMenu = electron.Menu.buildFromTemplate([ { type: 'normal', @@ -104,42 +142,8 @@ module.exports = (defaults) => { type: 'normal', label: 'Enhancements', - click: () => { - if (enhancer_menu) return enhancer_menu.show(); - const window_state = require(`${__notion.replace( - /\\/g, - '/' - )}/app/node_modules/electron-window-state/index.js`)({ - file: 'menu-windowstate.json', - path: helpers.data_folder, - defaultWidth: 275, - defaultHeight: 600, - }); - electron.shell.openExternal(JSON.stringify(window_state)); - enhancer_menu = new electron.BrowserWindow({ - show: true, - frame: false, - titleBarStyle: 'hiddenInset', - x: - window_state.x || - calculateWindowPos(window_state.width, window_state.height).x, - y: - window_state.y || - calculateWindowPos(window_state.width, window_state.height).y, - width: window_state.width, - height: window_state.height, - webPreferences: { - preload: path.resolve(`${__dirname}/menu.js`), - nodeIntegration: true, - session: electron.session.fromPartition('persist:notion'), - }, - }); - enhancer_menu.loadURL('enhancement://core/menu.html'); - enhancer_menu.on('close', (e) => { - window_state.saveState(enhancer_menu); - enhancer_menu = null; - }); - }, + accelerator: 'CommandOrControl+E', + click: openExtensionMenu, }, { type: 'separator', From 158ce182df1cd97e09c62d50a1b99dc664417426 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 4 Aug 2020 00:31:27 +1000 Subject: [PATCH 024/371] mod toggling, first extension: bracketed links --- repo/bracketed-links/mod.js | 16 +++ repo/core/css/localised.css | 206 +++++++++++++++++++++++++++++++++++ repo/core/css/menu.css | 211 +++++++++++++++++------------------- repo/core/menu.js | 85 +++++++++++---- repo/core/mod.js | 4 +- 5 files changed, 388 insertions(+), 134 deletions(-) create mode 100644 repo/bracketed-links/mod.js create mode 100644 repo/core/css/localised.css diff --git a/repo/bracketed-links/mod.js b/repo/bracketed-links/mod.js new file mode 100644 index 0000000..c2ad673 --- /dev/null +++ b/repo/bracketed-links/mod.js @@ -0,0 +1,16 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/) under the MIT license + */ + +'use strict'; + +module.exports = { + id: '60e14feb-a81d-4ffb-9b12-7585d346bad8', + tags: ['extension'], + name: 'bracketed links', + desc: 'render links surrounded with [brackets] instead of __underlined__.', + version: '0.0.1', + author: 'arecsu', +}; diff --git a/repo/core/css/localised.css b/repo/core/css/localised.css new file mode 100644 index 0000000..a7e3585 --- /dev/null +++ b/repo/core/css/localised.css @@ -0,0 +1,206 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/) under the MIT license + */ + +@import './variables.css'; + +.notion-dark-theme { + --theme_local--main: var(--theme_dark--main); + --theme_local--sidebar: var(--theme_dark--sidebar); + --theme_local--overlay: var(--theme_dark--overlay); + --theme_local--dragarea: var(--theme_dark--dragarea); + --theme_local--preview-width: var(--theme_dark--preview-width); + --theme_local--preview_banner-height: var( + --theme_dark--preview_banner-height + ); + --theme_local--page_banner-height: var(--theme_dark--page_banner-height); + + --theme_local--font_sans: var(--theme_dark--font_sans); + --theme_local--font_serif: var(--theme_dark--font_serif); + --theme_local--font_mono: var(--theme_dark--font_mono); + --theme_local--font_code: var(--theme_dark--font_code); + + --theme_local--scrollbar: var(--theme_dark--scrollbar); + --theme_local--scrollbar-border: var(--theme_dark--scrollbar-border); + --theme_local--scrollbar_hover: var(--theme_dark--scrollbar_hover); + + --theme_local--card: var(--theme_dark--card); + --theme_local--card-border: var(--theme_dark--card-border); + --theme_local--table-border: var(--theme_dark--table-border); + --theme_local--button_hover: var(--theme_dark--button_hover); + --theme_local--button_hover-border: var(--theme_dark--button_hover-border); + --theme_local--button_close: var(--theme_dark--button_close); + --theme_local--button_close-fill: var(--theme_dark--button_close-fill); + + --theme_local--selected: var(--theme_dark--selected); + --theme_local--primary: var(--theme_dark--primary); + --theme_local--primary_hover: var(--theme_dark--primary_hover); + --theme_local--primary_click: var(--theme_dark--primary_click); + --theme_local--primary_indicator: var(--theme_dark--primary_indicator); + + --theme_local--todo_empty-border: var(--theme_dark--todo_empty-border); + --theme_local--todo_ticked: var(--theme_dark--todo_ticked); + --theme_local--todo_ticked-fill: var(--theme_dark--todo_ticked-fill); + --theme_local--todo_ticked-background: var( + --theme_dark--todo_ticked-background + ); + --theme_local--todo_hover-background: var( + --theme_dark--todo_hover-background + ); + + --theme_local--danger_text: var(--theme_dark--danger_text); + --theme_local--danger_border: var(--theme_dark--danger_border); + + --theme_local--text: var(--theme_dark--text); + --theme_local--text_ui: var(--theme_dark--text_ui); + --theme_local--text_ui_info: var(--theme_dark--text_ui_info); + + --theme_local--text_gray: var(--theme_dark--text_gray); + --theme_local--text_brown: var(--theme_dark--text_brown); + --theme_local--text_orange: var(--theme_dark--text_orange); + --theme_local--text_yellow: var(--theme_dark--text_yellow); + --theme_local--text_green: var(--theme_dark--text_green); + --theme_local--text_blue: var(--theme_dark--text_blue); + --theme_local--text_purple: var(--theme_dark--text_purple); + --theme_local--text_pink: var(--theme_dark--text_pink); + --theme_local--text_red: var(--theme_dark--text_red); + --theme_local--bg_gray: var(--theme_dark--bg_gray); + --theme_local--bg_brown: var(--theme_dark--bg_brown); + --theme_local--bg_orange: var(--theme_dark--bg_orange); + --theme_local--bg_yellow: var(--theme_dark--bg_yellow); + --theme_local--bg_green: var(--theme_dark--bg_green); + --theme_local--bg_blue: var(--theme_dark--bg_blue); + --theme_local--bg_purple: var(--theme_dark--bg_purple); + --theme_local--bg_pink: var(--theme_dark--bg_pink); + --theme_local--bg_red: var(--theme_dark--bg_red); + --theme_local--line_gray: var(--theme_dark--line_gray); + --theme_local--line_brown: var(--theme_dark--line_brown); + --theme_local--line_orange: var(--theme_dark--line_orange); + --theme_local--line_yellow: var(--theme_dark--line_yellow); + --theme_local--line_green: var(--theme_dark--line_green); + --theme_local--line_blue: var(--theme_dark--line_blue); + --theme_local--line_purple: var(--theme_dark--line_purple); + --theme_local--line_pink: var(--theme_dark--line_pink); + --theme_local--line_red: var(--theme_dark--line_red); + + --theme_local--code_inline-text: var(--theme_dark--code_inline-text); + --theme_local--code_inline-background: var( + --theme_dark--code_inline-background + ); + --theme_local--code_text: var(--theme_dark--code_text); + --theme_local--code-background: var(--theme_dark--code-background); + --theme_local--code_function: var(--theme_dark--code_function); + --theme_local--code_keyword: var(--theme_dark--code_keyword); + --theme_local--code_tag: var(--theme_dark--code_tag); + --theme_local--code_operator: var(--theme_dark--code_operator); + --theme_local--code_property: var(--theme_dark--code_property); + --theme_local--code_builtin: var(--theme_dark--code_builtin); + --theme_local--code_attr-name: var(--theme_dark--code_attr-name); + --theme_local--code_comment: var(--theme_dark--code_comment); + --theme_local--code_punctuation: var(--theme_dark--code_punctuation); + --theme_local--code_doctype: var(--theme_dark--code_doctype); + --theme_local--code_number: var(--theme_dark--code_number); + --theme_local--code_string: var(--theme_dark--code_string); + --theme_local--code_attr-value: var(--theme_dark--code_attr-value); +} +.notion-light-theme { + --theme_local--main: var(--theme_light--main); + --theme_local--sidebar: var(--theme_light--sidebar); + --theme_local--overlay: var(--theme_light--overlay); + --theme_local--dragarea: var(--theme_light--dragarea); + --theme_local--preview-width: var(--theme_light--preview-width); + --theme_local--preview_banner-height: var( + --theme_light--preview_banner-height + ); + --theme_local--page_banner-height: var(--theme_light--page_banner-height); + + --theme_local--font_sans: var(--theme_light--font_sans); + --theme_local--font_serif: var(--theme_light--font_serif); + --theme_local--font_mono: var(--theme_light--font_mono); + --theme_local--font_code: var(--theme_light--font_code); + + --theme_local--scrollbar: var(--theme_light--scrollbar); + --theme_local--scrollbar-border: var(--theme_light--scrollbar-border); + --theme_local--scrollbar_hover: var(--theme_light--scrollbar_hover); + + --theme_local--card: var(--theme_light--card); + --theme_local--card-border: var(--theme_light--card-border); + --theme_local--table-border: var(--theme_light--table-border); + --theme_local--button_hover: var(--theme_light--button_hover); + --theme_local--button_hover-border: var(--theme_light--button_hover-border); + --theme_local--button_close: var(--theme_light--button_close); + --theme_local--button_close-fill: var(--theme_light--button_close-fill); + + --theme_local--selected: var(--theme_light--selected); + --theme_local--primary: var(--theme_light--primary); + --theme_local--primary_hover: var(--theme_light--primary_hover); + --theme_local--primary_click: var(--theme_light--primary_click); + --theme_local--primary_indicator: var(--theme_light--primary_indicator); + + --theme_local--todo_empty-border: var(--theme_light--todo_empty-border); + --theme_local--todo_ticked: var(--theme_light--todo_ticked); + --theme_local--todo_ticked-fill: var(--theme_light--todo_ticked-fill); + --theme_local--todo_ticked-background: var( + --theme_light--todo_ticked-background + ); + --theme_local--todo_hover-background: var( + --theme_light--todo_hover-background + ); + + --theme_local--danger_text: var(--theme_light--danger_text); + --theme_local--danger_border: var(--theme_light--danger_border); + + --theme_local--text: var(--theme_light--text); + --theme_local--text_ui: var(--theme_light--text_ui); + --theme_local--text_ui_info: var(--theme_light--text_ui_info); + + --theme_local--text_gray: var(--theme_light--text_gray); + --theme_local--text_brown: var(--theme_light--text_brown); + --theme_local--text_orange: var(--theme_light--text_orange); + --theme_local--text_yellow: var(--theme_light--text_yellow); + --theme_local--text_green: var(--theme_light--text_green); + --theme_local--text_blue: var(--theme_light--text_blue); + --theme_local--text_purple: var(--theme_light--text_purple); + --theme_local--text_pink: var(--theme_light--text_pink); + --theme_local--text_red: var(--theme_light--text_red); + --theme_local--bg_gray: var(--theme_light--bg_gray); + --theme_local--bg_brown: var(--theme_light--bg_brown); + --theme_local--bg_orange: var(--theme_light--bg_orange); + --theme_local--bg_yellow: var(--theme_light--bg_yellow); + --theme_local--bg_green: var(--theme_light--bg_green); + --theme_local--bg_blue: var(--theme_light--bg_blue); + --theme_local--bg_purple: var(--theme_light--bg_purple); + --theme_local--bg_pink: var(--theme_light--bg_pink); + --theme_local--bg_red: var(--theme_light--bg_red); + --theme_local--line_gray: var(--theme_light--line_gray); + --theme_local--line_brown: var(--theme_light--line_brown); + --theme_local--line_orange: var(--theme_light--line_orange); + --theme_local--line_yellow: var(--theme_light--line_yellow); + --theme_local--line_green: var(--theme_light--line_green); + --theme_local--line_blue: var(--theme_light--line_blue); + --theme_local--line_purple: var(--theme_light--line_purple); + --theme_local--line_pink: var(--theme_light--line_pink); + --theme_local--line_red: var(--theme_light--line_red); + + --theme_local--code_inline-text: var(--theme_light--code_inline-text); + --theme_local--code_inline-background: var( + --theme_light--code_inline-background + ); + --theme_local--code_text: var(--theme_light--code_text); + --theme_local--code-background: var(--theme_light--code-background); + --theme_local--code_function: var(--theme_light--code_function); + --theme_local--code_keyword: var(--theme_light--code_keyword); + --theme_local--code_tag: var(--theme_light--code_tag); + --theme_local--code_operator: var(--theme_light--code_operator); + --theme_local--code_property: var(--theme_light--code_property); + --theme_local--code_builtin: var(--theme_light--code_builtin); + --theme_local--code_attr-name: var(--theme_light--code_attr-name); + --theme_local--code_comment: var(--theme_light--code_comment); + --theme_local--code_punctuation: var(--theme_light--code_punctuation); + --theme_local--code_doctype: var(--theme_light--code_doctype); + --theme_local--code_number: var(--theme_light--code_number); + --theme_local--code_string: var(--theme_light--code_string); + --theme_local--code_attr-value: var(--theme_light--code_attr-value); +} diff --git a/repo/core/css/menu.css b/repo/core/css/menu.css index 65b8afd..8eea81a 100644 --- a/repo/core/css/menu.css +++ b/repo/core/css/menu.css @@ -6,6 +6,7 @@ @import './buttons.css'; @import './scrollbars.css'; +@import './localised.css'; @keyframes spin { from { @@ -21,6 +22,10 @@ word-break: break-word; text-decoration: none; text-size-adjust: 100%; + outline-color: var(--theme_local--card-border); +} +*:active { + outline: none; } html, body { @@ -29,6 +34,7 @@ body { margin: 0; padding: 0; overflow: hidden; + background: var(--theme_local--main); } body:not([style]) > * { @@ -47,29 +53,11 @@ body:not([style])::after { animation: spin 0.8s linear infinite; } -.notion-dark-theme * { - outline-color: var(--theme_dark--card-border); -} -.notion-light-theme * { - outline-color: var(--theme_light--card-border); -} -*:active { - outline: none; -} - -.notion-dark-theme { - background: var(--theme_dark--main); -} -.notion-light-theme { - background: var(--theme_light--main); -} - main { - padding: 1em; + padding: 1em 1em 2.9em 1em; height: 100%; overflow: auto; } - main section { border-radius: 2px; padding: 0.75em; @@ -78,36 +66,24 @@ main section { /* inline formatting */ +body, +button { + color: var(--theme_local--text); + font-family: var(--theme_local--font_sans); +} + code { border-radius: 0.1em; padding: 0.2em 0.4em; -} -.notion-dark-theme code { - font: 0.85em var(--theme_dark--font_code); - /* color: var(--theme_dark--code_inline-text); */ - background: var(--theme_dark--code_inline-background); -} -.notion-light-theme code { - font: 0.85em var(--theme_light--font_code); - /* color: var(--theme_light--code_inline-text); */ - background: var(--theme_light--code_inline-background); + font: 0.85em var(--theme_local--font_code); + /* color: var(--theme_local--code_inline-text); */ + background: var(--theme_local--code_inline-background); } u { text-decoration: underline; } -.notion-dark-theme, -.notion-dark-theme button { - color: var(--theme_dark--text); - font-family: var(--theme_dark--font_sans); -} -.notion-light-theme, -.notion-light-theme button { - color: var(--theme_light--text); - font-family: var(--theme_light--font_sans); -} - /* titlebar */ #menu-titlebar::before { @@ -131,11 +107,8 @@ u { #menu-titlebar :first-child { margin-left: auto; } -.notion-dark-theme #menu-titlebar { - background: var(--theme_dark--dragarea); -} -.notion-light-theme #menu-titlebar { - background: var(--theme_light--dragarea); +#menu-titlebar { + background: var(--theme_local--dragarea); } /* alerts */ @@ -155,13 +128,40 @@ u { font-size: 1rem; margin: auto 0; padding-left: 0.5em; + color: var(--theme_local--text_ui); } -.notion-dark-theme #alerts [role='alert'] p { - color: var(--theme_dark--text_ui); +#alerts .error::before { + color: var(--theme_local--bg_red); } -.notion-light-theme #alerts [role='alert'] p { - color: var(--theme_light--text_ui); +#alerts .error { + border: 1px solid var(--theme_local--bg_red); + background: var(--theme_local--line_red); +} + +#alerts .warning::before { + color: var(--theme_local--bg_yellow); +} +#alerts .warning { + border: 1px solid var(--theme_local--bg_yellow); + background: var(--theme_local--line_yellow); +} + +#alerts .info::before { + color: var(--theme_local--bg_blue); +} +#alerts .info { + border: 1px solid var(--theme_local--bg_blue); + background: var(--theme_local--line_blue); +} + +#alerts .success::before { + content: '✓'; + color: var(--theme_local--bg_green); +} +#alerts .success { + border: 1px solid var(--theme_local--bg_green); + background: var(--theme_local--line_green); } .notion-light-theme #alerts [role='alert']::before { @@ -171,62 +171,11 @@ u { border: 1px solid rgba(0, 0, 0, 0.1); } -.notion-dark-theme #alerts .error { - border: 1px solid var(--theme_dark--bg_red); - background: var(--theme_dark--line_red); -} -.notion-dark-theme #alerts .error::before { - color: var(--theme_dark--bg_red); -} -.notion-light-theme #alerts .error { - background: var(--theme_light--line_red); -} +/* module meta */ -.notion-dark-theme #alerts .warning { - border: 1px solid var(--theme_dark--bg_yellow); - background: var(--theme_dark--line_yellow); -} -.notion-dark-theme #alerts .warning::before { - color: var(--theme_dark--bg_yellow); -} -.notion-light-theme #alerts .warning { - background: var(--theme_light--line_yellow); -} - -.notion-dark-theme #alerts .info { - border: 1px solid var(--theme_dark--bg_blue); - background: var(--theme_dark--line_blue); -} -.notion-dark-theme #alerts .info::before { - color: var(--theme_dark--bg_blue); -} -.notion-light-theme #alerts .info { - background: var(--theme_light--line_blue); -} - -#alerts .success::before { - content: '✓'; -} -.notion-dark-theme #alerts .success { - border: 1px solid var(--theme_dark--bg_green); - background: var(--theme_dark--line_green); -} -.notion-dark-theme #alerts .success::before { - color: var(--theme_dark--bg_green); -} -.notion-light-theme #alerts .success { - background: var(--theme_light--line_green); -} - -/* modules */ - -.notion-dark-theme #modules section { - background: var(--theme_dark--sidebar); - border: 1px solid var(--theme_dark--table-border); -} -.notion-light-theme #modules section { - background: var(--theme_light--sidebar); - border: 1px solid var(--theme_light--card-border); +#modules section { + background: var(--theme_local--sidebar); + border: 1px solid var(--theme_local--table-border); } #modules section h3, @@ -272,12 +221,54 @@ u { #modules section .tags, #modules section .version { font-size: 0.85em; + color: var(--theme_local--text_ui); } -.notion-dark-theme #modules section .tags, -.notion-dark-theme #modules section .version { - color: var(--theme_dark--text_ui); + +/* module options */ + +.toggle * { + cursor: pointer; } -.notion-light-theme #modules section .tags, -.notion-light-theme #modules section .version { - color: var(--theme_light--text_ui); +.toggle input { + display: none; +} +.toggle input + label .switch { + position: relative; + margin-top: 0.5em; + float: right; + height: 0.65em; + width: 2em; + background: var(--theme_local--card); + border-radius: 5px; +} +.toggle input + label .switch:before { + content: ''; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + border-radius: inherit; + background: linear-gradient( + 90deg, + var(--theme_local--primary), + var(--theme_local--primary_click) + ); + opacity: var(--menu--toggle_opacity, 0); + transition: opacity 300ms; +} +.toggle input + label .switch .dot { + position: absolute; + width: 1em; + height: 1em; + top: -0.15em; + border-radius: 50%; + transform: translateX(var(--menu--toggle_offset, 0)); + transition: transform 350ms, box-shadow 350ms; + background: var(--theme_local--todo_ticked-fill); + box-shadow: 2px 1px 4px var(--theme_local--table-border); +} +.toggle input:checked + label { + --menu--toggle_offset: 1em; + --menu--toggle_opacity: 1; } diff --git a/repo/core/menu.js b/repo/core/menu.js index 37ccf5e..739f2dc 100644 --- a/repo/core/menu.js +++ b/repo/core/menu.js @@ -18,10 +18,7 @@ window['__start'] = async () => { document.defaultView.addEventListener('keyup', (event) => { if (event.code === 'F5') window.reload(); - if (event.key === 'e' && (event.ctrlKey || event.metaKey)) { - electron.remote.BrowserWindow.getAllWindows()[0].show(); - browser.close(); - } + if (event.key === 'e' && (event.ctrlKey || event.metaKey)) browser.close(); }); electron.ipcRenderer.on('enhancer:set-theme', (event, theme) => { @@ -113,28 +110,69 @@ window['__start'] = async () => { // mod options function markdown(string) { - return snarkdown( - string - .split('\n') - .map((line) => line.trim()) - .join('
') - ).replace(/([^\\])?~~([^\n]*[^\\])~~/g, '$1$2'); + return string + .split('\n') + .map((line) => + line + // todo: stop e.g. whole chunk of ~~thin~~g~~ being selected + .trim() + // ~~strikethrough~~ + .replace(/([^\\])?~~([^\n]*[^\\])~~/g, '$1$2') + // __underline__ + .replace(/([^\\])?__([^\n]*[^\\])__/g, '$1$2') + // **bold** + .replace(/([^\\])?\*\*([^\n]*[^\\])\*\*/g, '$1$2') + // *italic* + .replace(/([^\\])?\*([^\n]*[^\\])\*/g, '$1$2') + // _italic_ + .replace(/([^\\])?_([^\n]*[^\\])_/g, '$1$2') + // `code` + .replace(/([^\\])?`([^\n]*[^\\])`/g, '$1$2') + // ![image_title](source) + .replace( + /([^\\])?\!\[([^\n]*[^\\]?)\]\(([^\n]*[^\\])\)/g, + '$1$2' + ) + // [link](destination) + .replace( + /([^\\])?\[([^\n]*[^\\])\]\(([^\n]*[^\\])\)/g, + '$1$2' + ) + ) + .join('
'); } const $modules = document.querySelector('#modules'); - for (let mod of modules.loaded.sort((a, b) => - store('mods', { [mod.id]: { pinned: false } }).pinned + for (let mod of modules.loaded.sort((a, b) => { + return a.tags.includes('core') || + store('mods', { [a.id]: { pinned: false } }).pinned + ? -1 + : b.tags.includes('core') || + store('mods', { [b.id]: { pinned: false } }).pinned ? 1 - : a.name.localeCompare(b.name) - )) { - $modules.append( - createElement(` + : a.name.localeCompare(b.name); + })) { + const menuStore = store('mods', { [mod.id]: { enabled: false } }); + mod.store = store(mod.id); + mod.elem = createElement(` - `) - ); + `); + const $enable = mod.elem.querySelector(`#enable_${mod.id}`); + if ($enable) + $enable.addEventListener('click', (event) => { + menuStore[mod.id].enabled = $enable.checked; + }); + $modules.append(mod.elem); } }; diff --git a/repo/core/mod.js b/repo/core/mod.js index 894d854..66a3c58 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -20,12 +20,10 @@ module.exports = { id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', tags: ['core', 'extension'], name: 'notion-enhancer core', - desc: `the **modloader** itself, _including_: the [CLI](https://github.com), the menu, and ~~enabling/disabling/insertion/updating of~~ mods. + desc: `the **modloader** itself, _including_: the [CLI](https://github.com), the \`menu\`, and ~~enabling/disabling/insertion/updating of~~ mods. ![](https://preview.redd.it/vtiw9ulqlt951.png?width=1368&format=png&auto=webp&s=733d8b27ec62151c7858b4eca463f809ead6395a)`, version: require('../../package.json').version, author: 'dragonwocky', - thumb: - 'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067', options: [], hacks: { 'main/main.js': require('./tray.js')(defaults), From 6dacae46b5b5c6c0f147cf10eff4289a8d14f0b4 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 4 Aug 2020 13:13:01 +1000 Subject: [PATCH 025/371] improve markdown regexes --- repo/core/css/menu.css | 20 +++++++++++++++----- repo/core/menu.js | 31 +++++++++++++++++++------------ repo/core/mod.js | 2 +- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/repo/core/css/menu.css b/repo/core/css/menu.css index 8eea81a..019b43d 100644 --- a/repo/core/css/menu.css +++ b/repo/core/css/menu.css @@ -83,6 +83,9 @@ code { u { text-decoration: underline; } +s { + text-decoration: line-through; +} /* titlebar */ @@ -188,22 +191,29 @@ u { margin: 0.3em 0 0.4em 0; font-size: 0.9em; } +#modules section .desc p { + margin: 0; +} +#modules section .desc blockquote { + margin: 0.3em 0; + border-left: 0.3em solid var(--theme_local--table-border); + padding-left: 0.7em; +} + #modules section .desc a { color: currentColor; text-decoration: underline dotted; } -#modules section .desc s { - text-decoration: line-through; -} + #modules section .desc img { width: 100%; max-width: 20em; margin: 0.5em 0; } -#modules section .desc img:first-child { +#modules section .desc :first-child img:first-child { margin-top: 0; } -#modules section .desc img:last-child { +#modules section .desc :last-child img:last-child { margin-bottom: 0; } diff --git a/repo/core/menu.js b/repo/core/menu.js index 739f2dc..4ad2b65 100644 --- a/repo/core/menu.js +++ b/repo/core/menu.js @@ -110,36 +110,43 @@ window['__start'] = async () => { // mod options function markdown(string) { - return string + const parsed = string .split('\n') .map((line) => line // todo: stop e.g. whole chunk of ~~thin~~g~~ being selected .trim() + .replace(/\s+/g, ' ') + // > quote + .replace(/^>\s+(.+)$/g, '
$1
') // ~~strikethrough~~ - .replace(/([^\\])?~~([^\n]*[^\\])~~/g, '$1$2') + .replace(/([^\\])?~~((?:(?!~~).)*[^\\])~~/g, '$1$2') // __underline__ - .replace(/([^\\])?__([^\n]*[^\\])__/g, '$1$2') + .replace(/([^\\])?__((?:(?!__).)*[^\\])__/g, '$1$2') // **bold** - .replace(/([^\\])?\*\*([^\n]*[^\\])\*\*/g, '$1$2') + .replace(/([^\\])?\*\*((?:(?!\*\*).)*[^\\])\*\*/g, '$1$2') // *italic* - .replace(/([^\\])?\*([^\n]*[^\\])\*/g, '$1$2') + .replace(/([^\\])?\*([^*]*[^\\*])\*/g, '$1$2') // _italic_ - .replace(/([^\\])?_([^\n]*[^\\])_/g, '$1$2') + .replace(/([^\\])?_([^_]*[^\\_])_/g, '$1$2') // `code` - .replace(/([^\\])?`([^\n]*[^\\])`/g, '$1$2') + .replace(/([^\\])?`([^`]*[^\\`])`/g, '$1$2') // ![image_title](source) .replace( - /([^\\])?\!\[([^\n]*[^\\]?)\]\(([^\n]*[^\\])\)/g, - '$1$2' + /([^\\])?\!\[([^\]]*[^\\\]]?)\]\(([^)]*[^\\)])\)/g, + '$1$2' ) // [link](destination) .replace( - /([^\\])?\[([^\n]*[^\\])\]\(([^\n]*[^\\])\)/g, + /([^\\])?\[([^\]]*[^\\\]]?)\]\(([^)]*[^\\)])\)/g, '$1$2' ) ) - .join('
'); + .map((line) => + line.startsWith('
') ? line : `

${line}

` + ) + .join(''); + return parsed; } const $modules = document.querySelector('#modules'); for (let mod of modules.loaded.sort((a, b) => { @@ -176,7 +183,7 @@ window['__start'] = async () => {

${mod.tags .map((tag) => (tag.startsWith('#') ? tag : `#${tag}`)) .join(' ')}

-

${markdown(mod.desc)}

+
${markdown(mod.desc)}

diff --git a/repo/core/mod.js b/repo/core/mod.js index 66a3c58..574d4d4 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -20,7 +20,7 @@ module.exports = { id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', tags: ['core', 'extension'], name: 'notion-enhancer core', - desc: `the **modloader** itself, _including_: the [CLI](https://github.com), the \`menu\`, and ~~enabling/disabling/insertion/updating of~~ mods. + desc: `> the **modloader** itself, _including_: the [CLI](https://github.com), the \`menu\`, and ~~enabling/disabling/insertion/updating of~~ mods. ![](https://preview.redd.it/vtiw9ulqlt951.png?width=1368&format=png&auto=webp&s=733d8b27ec62151c7858b4eca463f809ead6395a)`, version: require('../../package.json').version, author: 'dragonwocky', From 92501bd7e1f2c20b5a27ca8f5a8b9bce5e039849 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 4 Aug 2020 15:32:04 +1000 Subject: [PATCH 026/371] menu options: toggles + selects --- repo/core/buttons.js | 169 +++++++++++----------- repo/core/client.js | 218 ++++++++++++++-------------- repo/core/create.js | 150 ++++++++++--------- repo/core/css/menu.css | 49 ++++++- repo/core/menu.js | 146 +++++++++++++------ repo/core/mod.js | 64 ++++++--- repo/core/render.js | 42 +++--- repo/core/tray.js | 320 ++++++++++++++++++++--------------------- 8 files changed, 646 insertions(+), 512 deletions(-) diff --git a/repo/core/buttons.js b/repo/core/buttons.js index c1c57d2..1dcf728 100644 --- a/repo/core/buttons.js +++ b/repo/core/buttons.js @@ -6,93 +6,96 @@ 'use strict'; -const __mod = require('./mod.js'), - store = require('../../pkg/store.js'), - settings = store(__mod.id, __mod.defaults), - path = require('path'), - fs = require('fs-extra'), - browser = require('electron').remote.getCurrentWindow(), - is_mac = process.platform === 'darwin', - buttons = { - element: document.createElement('div'), - insert: [ - 'alwaysontop', - ...(settings.frameless && !is_mac - ? ['minimize', 'maximize', 'close'] - : []), - ], - icons: { - raw: { - alwaysontop: { - on: fs.readFile( - path.resolve(`${__dirname}/icons/alwaysontop_on.svg`) - ), - off: fs.readFile( - path.resolve(`${__dirname}/icons/alwaysontop_off.svg`) +module.exports = (store) => { + const path = require('path'), + fs = require('fs-extra'), + browser = require('electron').remote.getCurrentWindow(), + is_mac = process.platform === 'darwin', + buttons = { + element: document.createElement('div'), + insert: [ + 'alwaysontop', + ...(store().frameless && !is_mac + ? ['minimize', 'maximize', 'close'] + : []), + ], + icons: { + raw: { + alwaysontop: { + on: fs.readFile( + path.resolve(`${__dirname}/icons/alwaysontop_on.svg`) + ), + off: fs.readFile( + path.resolve(`${__dirname}/icons/alwaysontop_off.svg`) + ), + }, + minimize: fs.readFile( + path.resolve(`${__dirname}/icons/minimize.svg`) ), + maximize: { + on: fs.readFile(path.resolve(`${__dirname}/icons/maximize_on.svg`)), + off: fs.readFile( + path.resolve(`${__dirname}/icons/maximize_off.svg`) + ), + }, + close: fs.readFile(path.resolve(`${__dirname}/icons/close.svg`)), }, - minimize: fs.readFile(path.resolve(`${__dirname}/icons/minimize.svg`)), - maximize: { - on: fs.readFile(path.resolve(`${__dirname}/icons/maximize_on.svg`)), - off: fs.readFile(path.resolve(`${__dirname}/icons/maximize_off.svg`)), + alwaysontop() { + return browser.isAlwaysOnTop() + ? buttons.icons.raw.alwaysontop.on + : buttons.icons.raw.alwaysontop.off; // '🠙' : '🠛' + }, + minimize() { + return buttons.icons.raw.minimize; // '⚊' + }, + maximize() { + return browser.isMaximized() + ? buttons.icons.raw.maximize.on + : buttons.icons.raw.maximize.off; // '🗗' : '🗖' + }, + close() { + return buttons.icons.raw.close; // '⨉' }, - close: fs.readFile(path.resolve(`${__dirname}/icons/close.svg`)), }, - alwaysontop() { - return browser.isAlwaysOnTop() - ? buttons.icons.raw.alwaysontop.on - : buttons.icons.raw.alwaysontop.off; // '🠙' : '🠛' + actions: { + async alwaysontop() { + browser.setAlwaysOnTop(!browser.isAlwaysOnTop()); + this.innerHTML = await buttons.icons.alwaysontop(); + }, + minimize() { + browser.minimize(); + }, + async maximize() { + browser.isMaximized() ? browser.unmaximize() : browser.maximize(); + this.innerHTML = await buttons.icons.maximize(); + }, + close() { + browser.close(); + }, }, - minimize() { - return buttons.icons.raw.minimize; // '⚊' - }, - maximize() { - return browser.isMaximized() - ? buttons.icons.raw.maximize.on - : buttons.icons.raw.maximize.off; // '🗗' : '🗖' - }, - close() { - return buttons.icons.raw.close; // '⨉' - }, - }, - actions: { - async alwaysontop() { - browser.setAlwaysOnTop(!browser.isAlwaysOnTop()); - this.innerHTML = await buttons.icons.alwaysontop(); - }, - minimize() { - browser.minimize(); - }, - async maximize() { - browser.isMaximized() ? browser.unmaximize() : browser.maximize(); - this.innerHTML = await buttons.icons.maximize(); - }, - close() { - browser.close(); - }, - }, - }; + }; -(async () => { - buttons.element.className = 'window-buttons-area'; - for (let btn of buttons.insert) { - buttons.element.innerHTML += ``; - setTimeout( - () => - (document.querySelector(`.window-button#btn-${btn}`).onclick = - buttons.actions[btn]), - 10 - ); - } - if (settings.frameless && !is_mac) { - setInterval(async () => { - const icon = (await buttons.icons.maximize()).toString(), - el = buttons.element.querySelector('#btn-maximize'); - if (el.innerHTML != icon) el.innerHTML = icon; - }, 100); - } -})(); + (async () => { + buttons.element.className = 'window-buttons-area'; + for (let btn of buttons.insert) { + buttons.element.innerHTML += ``; + setTimeout( + () => + (document.querySelector(`.window-button#btn-${btn}`).onclick = + buttons.actions[btn]), + 10 + ); + } + if (store().frameless && !is_mac) { + setInterval(async () => { + const icon = (await buttons.icons.maximize()).toString(), + el = buttons.element.querySelector('#btn-maximize'); + if (el.innerHTML != icon) el.innerHTML = icon; + }, 100); + } + })(); -module.exports = buttons; + return buttons; +}; diff --git a/repo/core/client.js b/repo/core/client.js index 1c535e9..85b3cfe 100644 --- a/repo/core/client.js +++ b/repo/core/client.js @@ -7,125 +7,123 @@ 'use strict'; -module.exports = (defaults) => - function (store, __exports) { - const electron = require('electron'), - settings = store(defaults), - helpers = require('../../pkg/helpers.js'), - __notion = helpers.getNotion(), - notionIpc = require(`${__notion.replace( - /\\/g, - '/' - )}/app/helpers/notionIpc.js`); +module.exports = (store, __exports) => { + const electron = require('electron'), + helpers = require('../../pkg/helpers.js'), + __notion = helpers.getNotion(), + notionIpc = require(`${__notion.replace( + /\\/g, + '/' + )}/app/helpers/notionIpc.js`); - // additional hotkeys - document.defaultView.addEventListener('keyup', (event) => { - if (event.code === 'F5') window.reload(); - if (event.key === 'e' && (event.ctrlKey || event.metaKey)) - electron.ipcRenderer.send('enhancer:open-extension-menu'); - }); + // additional hotkeys + document.defaultView.addEventListener('keyup', (event) => { + if (event.code === 'F5') window.reload(); + if (event.key === 'e' && (event.ctrlKey || event.metaKey)) + electron.ipcRenderer.send('enhancer:open-extension-menu'); + }); - const attempt_interval = setInterval(enhance, 500); - async function enhance() { - if (!document.querySelector('.notion-frame')) return; - clearInterval(attempt_interval); + const attempt_interval = setInterval(enhance, 500); + async function enhance() { + if (!document.querySelector('.notion-frame')) return; + clearInterval(attempt_interval); - // scrollbars - if (settings.smooth_scrollbars) { - document.body.classList.add('smooth-scrollbars'); - // interval_attempts.patchScrollbars = setInterval(patchScrollbars, 100); - // function patchScrollbars() { - // const sidebar = document.querySelector( - // '.notion-scroller.vertical[style*="overflow: hidden auto;"]' - // ); - // if (!sidebar) return; - // clearInterval(interval_attempts.patchScrollbars); - // sidebar.style.overflow = ''; - // setTimeout(() => { - // sidebar.style.overflow = 'hidden auto'; - // }, 10); - // } - } + // scrollbars + if (store().smooth_scrollbars) { + document.body.classList.add('smooth-scrollbars'); + // interval_attempts.patchScrollbars = setInterval(patchScrollbars, 100); + // function patchScrollbars() { + // const sidebar = document.querySelector( + // '.notion-scroller.vertical[style*="overflow: hidden auto;"]' + // ); + // if (!sidebar) return; + // clearInterval(interval_attempts.patchScrollbars); + // sidebar.style.overflow = ''; + // setTimeout(() => { + // sidebar.style.overflow = 'hidden auto'; + // }, 10); + // } + } - // frameless - if (settings.frameless) { - document.body.classList.add('frameless'); - // draggable area - const dragarea = document.createElement('div'); - dragarea.className = 'window-dragarea'; - document.querySelector('.notion-topbar').prepend(dragarea); - document.documentElement.style.setProperty( - '--configured-dragarea_height', - `${settings.dragarea_height + 2}px` - ); - } + // frameless + if (store().frameless) { + document.body.classList.add('frameless'); + // draggable area + const dragarea = document.createElement('div'); + dragarea.className = 'window-dragarea'; + document.querySelector('.notion-topbar').prepend(dragarea); + document.documentElement.style.setProperty( + '--configured-dragarea_height', + `${store().dragarea_height + 2}px` + ); + } - // window buttons - const buttons = require('./buttons.js'); - document - .querySelector('.notion-topbar > div[style*="display: flex"]') - .appendChild(buttons.element); - document - .querySelector('.notion-history-back-button') - .parentElement.nextElementSibling.classList.add( - 'notion-topbar-breadcrumb' - ); - document - .querySelector('.notion-topbar-share-menu') - .parentElement.classList.add('notion-topbar-actions'); + // window buttons + const buttons = require('./buttons.js')(store); + document + .querySelector('.notion-topbar > div[style*="display: flex"]') + .appendChild(buttons.element); + document + .querySelector('.notion-history-back-button') + .parentElement.nextElementSibling.classList.add( + 'notion-topbar-breadcrumb' + ); + document + .querySelector('.notion-topbar-share-menu') + .parentElement.classList.add('notion-topbar-actions'); - let sidebar_width; - function communicationLoop() { - const getStyle = (prop) => - getComputedStyle(document.body).getPropertyValue(prop), - mode = JSON.parse(localStorage.theme).mode; + let sidebar_width; + function communicationLoop() { + const getStyle = (prop) => + getComputedStyle(document.body).getPropertyValue(prop), + mode = JSON.parse(localStorage.theme).mode; - // ctrl+f theming - notionIpc.sendNotionToIndex('search:set-theme', { - 'mode': mode, - 'colors': { - 'white': getStyle(`--theme_${mode}--todo_ticked-fill`), - 'blue': getStyle(`--theme_${mode}--primary`), - }, - 'borderRadius': 3, - 'textColor': getStyle(`--theme_${mode}--text`), - 'popoverBackgroundColor': getStyle(`--theme_${mode}--card`), - 'popoverBoxShadow': `0 0 0 1px ${getStyle( - `--theme_${mode}--overlay` - )}, 0 3px 6px ${getStyle(`--theme_${mode}--overlay`)}`, - 'inputBoxShadow': `box-shadow: ${getStyle( - `--theme_${mode}--primary` - )} 0px 0px 0px 1px inset, ${getStyle( - `--theme_${mode}--primary_hover` - )} 0px 0px 0px 2px !important`, - 'inputBackgroundColor': getStyle(`--theme_${mode}--main`), - 'dividerColor': getStyle(`--theme_${mode}--table-border`), - 'shadowOpacity': 0.2, - }); + // ctrl+f theming + notionIpc.sendNotionToIndex('search:set-theme', { + 'mode': mode, + 'colors': { + 'white': getStyle(`--theme_${mode}--todo_ticked-fill`), + 'blue': getStyle(`--theme_${mode}--primary`), + }, + 'borderRadius': 3, + 'textColor': getStyle(`--theme_${mode}--text`), + 'popoverBackgroundColor': getStyle(`--theme_${mode}--card`), + 'popoverBoxShadow': `0 0 0 1px ${getStyle( + `--theme_${mode}--overlay` + )}, 0 3px 6px ${getStyle(`--theme_${mode}--overlay`)}`, + 'inputBoxShadow': `box-shadow: ${getStyle( + `--theme_${mode}--primary` + )} 0px 0px 0px 1px inset, ${getStyle( + `--theme_${mode}--primary_hover` + )} 0px 0px 0px 2px !important`, + 'inputBackgroundColor': getStyle(`--theme_${mode}--main`), + 'dividerColor': getStyle(`--theme_${mode}--table-border`), + 'shadowOpacity': 0.2, + }); - // enhancer menu - electron.ipcRenderer.send('enhancer:set-theme', { - mode, - rules: require('./css/variables.json').map((rule) => [ - rule, - getStyle(rule), - ]), - }); + // enhancer menu + electron.ipcRenderer.send('enhancer:set-theme', { + mode, + rules: require('./css/variables.json').map((rule) => [ + rule, + getStyle(rule), + ]), + }); - // draggable area resizing - const sidebar = document.querySelector('.notion-sidebar'); - if (settings.frameless && sidebar) { - let new_sidebar_width = - sidebar.style.height === 'auto' ? '0px' : sidebar.style.width; - if (sidebar_width !== new_sidebar_width) { - sidebar_width = new_sidebar_width; - electron.ipcRenderer.sendToHost( - 'enhancer:sidebar-width', - sidebar_width - ); - } + // draggable area resizing + const sidebar = document.querySelector('.notion-sidebar'); + if (store().frameless && sidebar) { + let new_sidebar_width = + sidebar.style.height === 'auto' ? '0px' : sidebar.style.width; + if (sidebar_width !== new_sidebar_width) { + sidebar_width = new_sidebar_width; + electron.ipcRenderer.sendToHost( + 'enhancer:sidebar-width', + sidebar_width + ); } } - setInterval(communicationLoop, 500); } - }; + setInterval(communicationLoop, 500); + } +}; diff --git a/repo/core/create.js b/repo/core/create.js index 4a2a1e9..1343670 100644 --- a/repo/core/create.js +++ b/repo/core/create.js @@ -7,84 +7,78 @@ 'use strict'; -module.exports = (defaults) => - function (store, __exports) { - const electron = require('electron'), - allWindows = () => - electron.BrowserWindow.getAllWindows().filter( - (win) => win.getTitle() !== 'notion-enhancer menu' - ), - // createWindow = __exports.createWindow, - path = require('path'), - settings = store(defaults), - helpers = require('../../pkg/helpers.js'), - __notion = helpers.getNotion(); +module.exports = (store, __exports) => { + const electron = require('electron'), + allWindows = () => + electron.BrowserWindow.getAllWindows().filter( + (win) => win.getTitle() !== 'notion-enhancer menu' + ), + // createWindow = __exports.createWindow, + path = require('path'), + helpers = require('../../pkg/helpers.js'), + __notion = helpers.getNotion(); - __exports.createWindow = function (relativeUrl) { - if (!relativeUrl) relativeUrl = ''; - const window_state = require(`${__notion.replace( - /\\/g, - '/' - )}/app/node_modules/electron-window-state/index.js`)({ - defaultWidth: 1320, - defaultHeight: 860, - }), - rect = { - x: window_state.x, - y: window_state.y, - width: window_state.width, - height: window_state.height, - }, - focused_window = electron.BrowserWindow.getFocusedWindow(); - if (focused_window && !focused_window.isMaximized()) { - rect.x = focused_window.getPosition()[0] + 20; - rect.y = focused_window.getPosition()[1] + 20; - rect.width = focused_window.getSize()[0]; - rect.height = focused_window.getSize()[1]; + __exports.createWindow = function (relativeUrl) { + if (!relativeUrl) relativeUrl = ''; + const window_state = require(`${__notion.replace( + /\\/g, + '/' + )}/app/node_modules/electron-window-state/index.js`)({ + defaultWidth: 1320, + defaultHeight: 860, + }), + rect = { + x: window_state.x, + y: window_state.y, + width: window_state.width, + height: window_state.height, + }, + focused_window = electron.BrowserWindow.getFocusedWindow(); + if (focused_window && !focused_window.isMaximized()) { + rect.x = focused_window.getPosition()[0] + 20; + rect.y = focused_window.getPosition()[1] + 20; + rect.width = focused_window.getSize()[0]; + rect.height = focused_window.getSize()[1]; + } + const window = new electron.BrowserWindow({ + show: false, + backgroundColor: '#ffffff', + titleBarStyle: 'hiddenInset', + frame: !store().frameless, + webPreferences: { + preload: path.resolve(`${__notion}/app/renderer/index.js`), + webviewTag: true, + session: electron.session.fromPartition('persist:notion'), + }, + ...rect, + }); + window.once('ready-to-show', function () { + if ( + !store().openhidden || + allWindows().some((win) => win.isVisible() && win.id != window.id) + ) { + window.show(); + window.focus(); + if (store().maximized) window.maximize(); + if ( + (focused_window && focused_window.isFullScreen()) || + window_state.isFullScreen + ) + window.setFullScreen(true); } - const window = new electron.BrowserWindow({ - show: false, - backgroundColor: '#ffffff', - titleBarStyle: 'hiddenInset', - frame: !settings.frameless, - webPreferences: { - preload: path.resolve(`${__notion}/app/renderer/index.js`), - webviewTag: true, - session: electron.session.fromPartition('persist:notion'), - }, - ...rect, - }); - window.once('ready-to-show', function () { - if ( - !settings.openhidden || - allWindows().some((win) => win.isVisible() && win.id != window.id) - ) { - window.show(); - window.focus(); - if (settings.maximized) window.maximize(); - if ( - (focused_window && focused_window.isFullScreen()) || - window_state.isFullScreen - ) - window.setFullScreen(true); - } - }); - let intended_quit = false; - window.on('close', (e) => { - if ( - intended_quit || - !settings.close_to_tray || - allWindows().length > 1 - ) { - window_state.saveState(window); - window = null; - } else { - e.preventDefault(); - window.hide(); - } - }); - electron.app.on('before-quit', () => (intended_quit = true)); - window.loadURL(__exports.getIndexUrl(relativeUrl)); - return window; - }; + }); + let intended_quit = false; + window.on('close', (e) => { + if (intended_quit || !store().close_to_tray || allWindows().length > 1) { + window_state.saveState(window); + window = null; + } else { + e.preventDefault(); + window.hide(); + } + }); + electron.app.on('before-quit', () => (intended_quit = true)); + window.loadURL(__exports.getIndexUrl(relativeUrl)); + return window; }; +}; diff --git a/repo/core/css/menu.css b/repo/core/css/menu.css index 019b43d..58ee971 100644 --- a/repo/core/css/menu.css +++ b/repo/core/css/menu.css @@ -60,7 +60,6 @@ main { } main section { border-radius: 2px; - padding: 0.75em; margin-bottom: 0.75em; } @@ -118,6 +117,7 @@ s { #alerts [role='alert'] { display: flex; + padding: 0.75em; } #alerts [role='alert']::before { content: '!'; @@ -180,6 +180,12 @@ s { background: var(--theme_local--sidebar); border: 1px solid var(--theme_local--table-border); } +#modules section > div { + padding: 0.75em; +} +.notion-light-theme #modules section { + background: var(--theme_local--main); +} #modules section h3, #modules section p { @@ -187,6 +193,13 @@ s { font-size: 1rem; } +/* #modules section .meta .toggle input + label .switch:before { + background: linear-gradient( + 90deg, + var(--theme_local--text_green), + var(--theme_local--bg_green) + ); +} */ #modules section .desc { margin: 0.3em 0 0.4em 0; font-size: 0.9em; @@ -236,19 +249,51 @@ s { /* module options */ +#modules .disabled .options { + display: none; +} +#modules section .options { + border-top: 1px solid var(--theme_local--table-border); + background: var(--theme_local--card); +} +#modules section .options p { + font-size: 0.9em; +} +#modules section .options p:not(:last-child) { + padding-bottom: 0.5em; + border-bottom: 0.5px solid var(--theme_local--table-border); + margin-bottom: 0.5em; +} + +select { + width: 100%; + margin: 0.25em 0; + font-size: 0.9rem; + padding: 0.4rem 0.2rem; + border: none; + color: var(--theme_local--text); + background: var(--theme_local--main); +} + .toggle * { cursor: pointer; } .toggle input { display: none; } +.toggle input + label { + display: flex; +} +.toggle input + label .name { + flex-basis: calc(100% - 2.25em); +} .toggle input + label .switch { position: relative; margin-top: 0.5em; float: right; height: 0.65em; width: 2em; - background: var(--theme_local--card); + background: var(--theme_local--main); border-radius: 5px; } .toggle input + label .switch:before { diff --git a/repo/core/menu.js b/repo/core/menu.js index 4ad2b65..f5cea1f 100644 --- a/repo/core/menu.js +++ b/repo/core/menu.js @@ -6,14 +6,13 @@ 'use strict'; -const __mod = require('./mod.js'), - store = require('../../pkg/store.js'), +const store = require('../../pkg/store.js'), helpers = require('../../pkg/helpers.js'), electron = require('electron'), browser = electron.remote.getCurrentWindow(); window['__start'] = async () => { - const buttons = require('./buttons.js'); + const buttons = require('./buttons.js')(() => ({ frameless: true })); document.querySelector('#menu-titlebar').appendChild(buttons.element); document.defaultView.addEventListener('keyup', (event) => { @@ -61,10 +60,11 @@ window['__start'] = async () => { ) .then((res) => res.json()) .then((res) => { - const version = { - local: __mod.version.split(/[~-]/g)[0], - repo: res.tag_name.slice(1), - }; + const raw_v = require('./mod.js').version, + version = { + local: raw_v.split(/[~-]/g)[0], + repo: res.tag_name.slice(1), + }; if (version.local == version.repo) return; // compare func from https://github.com/substack/semver-compare version.sorted = [version.local, version.repo].sort((a, b) => { @@ -87,7 +87,7 @@ window['__start'] = async () => { run npm i -g notion-enhancer
(or yarn global add notion-enhancer),
and notion-enhancer apply.` - : `local build v${__mod.version} is unstable.` + : `local build v${raw_v} is unstable.` ).prepend(); }); @@ -108,13 +108,12 @@ window['__start'] = async () => { ).append(); } - // mod options + // mod info + options function markdown(string) { const parsed = string .split('\n') .map((line) => line - // todo: stop e.g. whole chunk of ~~thin~~g~~ being selected .trim() .replace(/\s+/g, ' ') // > quote @@ -148,56 +147,121 @@ window['__start'] = async () => { .join(''); return parsed; } + + let modified_notice; + function modified() { + if (modified_notice) return; + modified_notice = createAlert( + 'info', + `changes may not apply until app restart.` + ); + modified_notice.append(); + } + const $modules = document.querySelector('#modules'); - for (let mod of modules.loaded.sort((a, b) => { - return a.tags.includes('core') || - store('mods', { [a.id]: { pinned: false } }).pinned + for (let mod of modules.loaded.sort((a, b) => + a.tags.includes('core') || + store('mods', { [a.id]: { pinned: false } }).pinned ? -1 : b.tags.includes('core') || store('mods', { [b.id]: { pinned: false } }).pinned ? 1 - : a.name.localeCompare(b.name); - })) { + : a.name.localeCompare(b.name) + )) { const menuStore = store('mods', { [mod.id]: { enabled: false } }); - mod.store = store(mod.id); mod.elem = createElement(`

`); const $enable = mod.elem.querySelector(`#enable_${mod.id}`); if ($enable) $enable.addEventListener('click', (event) => { menuStore[mod.id].enabled = $enable.checked; + mod.elem.className = menuStore[mod.id].enabled ? 'enabled' : 'disabled'; }); + const $options = mod.elem.querySelector('.options'); + if ($options) + for (const opt of mod.options) { + let $opt; + switch (opt.type) { + case 'toggle': + $opt = createElement(` +

+ + +

+ `); + const $opt_checkbox = $opt.querySelector( + `#toggle_${mod.id}--${opt.key}` + ); + $opt_checkbox.addEventListener('change', (event) => { + store(mod.id)[opt.key] = $opt_checkbox.checked; + modified(); + }); + $options.appendChild($opt); + break; + case 'select': + $opt = createElement(` +

+ + +

+ `); + const $opt_select = $opt.querySelector( + `#select_${mod.id}--${opt.key}` + ); + $opt_select.value = store(mod.id)[opt.key]; + $opt_select.addEventListener('change', (event) => { + store(mod.id)[opt.key] = $opt_select.value; + modified(); + }); + $options.appendChild($opt); + break; + case 'input': + break; + case 'file': + break; + } + } $modules.append(mod.elem); } }; diff --git a/repo/core/mod.js b/repo/core/mod.js index 574d4d4..6d02054 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -6,16 +6,6 @@ 'use strict'; -const defaults = { - openhidden: false, - maximized: false, - close_to_tray: true, - frameless: true, - dragarea_height: 15, - smooth_scrollbars: true, - hotkey: 'CmdOrCtrl+Shift+A', -}; - module.exports = { id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', tags: ['core', 'extension'], @@ -24,12 +14,54 @@ module.exports = { ![](https://preview.redd.it/vtiw9ulqlt951.png?width=1368&format=png&auto=webp&s=733d8b27ec62151c7858b4eca463f809ead6395a)`, version: require('../../package.json').version, author: 'dragonwocky', - options: [], + options: [ + { + key: 'openhidden', + label: 'hide app on open', + type: 'toggle', + value: false, + }, + { + key: 'maximized', + label: 'auto-maximise windows', + type: 'toggle', + value: false, + }, + { + key: 'close_to_tray', + label: 'close window to the tray', + type: 'toggle', + value: true, + }, + { + key: 'frameless', + label: 'integrate titlebar into notion', + type: 'toggle', + value: true, + }, + { + key: 'dragarea_height', + label: 'height of frameless dragarea', + type: 'input', + value: 15, + }, + { + key: 'smooth_scrollbars', + label: 'integrate scrollbars into notion', + type: 'toggle', + value: true, + }, + { + key: 'hotkey', + label: 'window display hotkey', + type: 'input', + value: 'CmdOrCtrl+Shift+A', + }, + ], hacks: { - 'main/main.js': require('./tray.js')(defaults), - 'main/createWindow.js': require('./create.js')(defaults), - 'renderer/index.js': require('./render.js')(defaults), - 'renderer/preload.js': require('./client.js')(defaults), + 'main/main.js': require('./tray.js'), + 'main/createWindow.js': require('./create.js'), + 'renderer/index.js': require('./render.js'), + 'renderer/preload.js': require('./client.js'), }, - defaults, }; diff --git a/repo/core/render.js b/repo/core/render.js index d77e17a..f9eb7f8 100644 --- a/repo/core/render.js +++ b/repo/core/render.js @@ -6,28 +6,28 @@ 'use strict'; -module.exports = (defaults) => - function (store, __exports) { - const __start = window['__start'], - settings = store(defaults); +module.exports = (store, __exports) => { + const __start = window['__start']; - window['__start'] = function () { - __start(); - const dragarea = document.querySelector( - '#root [style*="-webkit-app-region: drag"]' - ), - default_styles = dragarea.getAttribute('style'); + window['__start'] = function () { + __start(); + const dragarea = document.querySelector( + '#root [style*="-webkit-app-region: drag"]' + ), + default_styles = dragarea.getAttribute('style'); - // document.body.innerText = document.body.innerHTML; + // document.body.innerText = document.body.innerHTML; - document - .getElementById('notion') - .addEventListener('ipc-message', (event) => { - if (event.channel !== 'enhancer:sidebar-width') return; - dragarea.setAttribute( - 'style', - `${default_styles} top: 2px; height: ${settings.dragarea_height}px; left: ${event.args[0]};` - ); - }); - }; + document + .getElementById('notion') + .addEventListener('ipc-message', (event) => { + if (event.channel !== 'enhancer:sidebar-width') return; + dragarea.setAttribute( + 'style', + `${default_styles} top: 2px; height: ${ + store().dragarea_height + }px; left: ${event.args[0]};` + ); + }); }; +}; diff --git a/repo/core/tray.js b/repo/core/tray.js index 91c8a48..cc7ddcf 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -9,176 +9,174 @@ let tray, enhancer_menu; -module.exports = (defaults) => - function (store, __exports) { - const electron = require('electron'), - path = require('path'), - is_mac = process.platform === 'darwin', - is_win = process.platform === 'win32', - settings = store(defaults), - helpers = require('../../pkg/helpers.js'), - __notion = helpers.getNotion(); +module.exports = (store, __exports) => { + const electron = require('electron'), + path = require('path'), + is_mac = process.platform === 'darwin', + is_win = process.platform === 'win32', + helpers = require('../../pkg/helpers.js'), + __notion = helpers.getNotion(); - electron.app.on('ready', () => { - tray = new electron.Tray( - is_win - ? path.resolve(`${__dirname}/icons/windows.ico`) - : new electron.nativeImage.createFromPath( - path.resolve(`${__dirname}/icons/mac+linux.png`) - ).resize({ - width: 16, - height: 16, - }) - ); + electron.app.on('ready', () => { + tray = new electron.Tray( + is_win + ? path.resolve(`${__dirname}/icons/windows.ico`) + : new electron.nativeImage.createFromPath( + path.resolve(`${__dirname}/icons/mac+linux.png`) + ).resize({ + width: 16, + height: 16, + }) + ); - electron.ipcMain.on('enhancer:set-theme', (event, arg) => { - if (!enhancer_menu) return; - enhancer_menu.webContents.send('enhancer:set-theme', arg); + electron.ipcMain.on('enhancer:set-theme', (event, arg) => { + if (!enhancer_menu) return; + enhancer_menu.webContents.send('enhancer:set-theme', arg); + }); + electron.ipcMain.on('enhancer:open-extension-menu', openExtensionMenu); + + function calculateWindowPos(width, height) { + const screen = electron.screen.getDisplayNearestPoint({ + x: tray.getBounds().x, + y: tray.getBounds().y, }); - electron.ipcMain.on('enhancer:open-extension-menu', openExtensionMenu); - - function calculateWindowPos(width, height) { - const screen = electron.screen.getDisplayNearestPoint({ - x: tray.getBounds().x, - y: tray.getBounds().y, - }); - // left - if (screen.workArea.x > 0) - return { - x: screen.workArea.x, - y: screen.workArea.height - height, - }; - // top - if (screen.workArea.y > 0) - return { - x: Math.round( - tray.getBounds().x + tray.getBounds().width / 2 - width / 2 - ), - y: screen.workArea.y, - }; - // right - if (screen.workArea.width < screen.bounds.width) - return { - x: screen.workArea.width - width, - y: screen.bounds.height - height, - }; - // bottom + // left + if (screen.workArea.x > 0) + return { + x: screen.workArea.x, + y: screen.workArea.height - height, + }; + // top + if (screen.workArea.y > 0) return { x: Math.round( tray.getBounds().x + tray.getBounds().width / 2 - width / 2 ), - y: screen.workArea.height - height, + y: screen.workArea.y, }; - } + // right + if (screen.workArea.width < screen.bounds.width) + return { + x: screen.workArea.width - width, + y: screen.bounds.height - height, + }; + // bottom + return { + x: Math.round( + tray.getBounds().x + tray.getBounds().width / 2 - width / 2 + ), + y: screen.workArea.height - height, + }; + } - function openExtensionMenu() { - if (enhancer_menu) return enhancer_menu.show(); - const window_state = require(`${__notion.replace( - /\\/g, - '/' - )}/app/node_modules/electron-window-state/index.js`)({ - file: 'menu-windowstate.json', - path: helpers.data_folder, - defaultWidth: 275, - defaultHeight: 600, - }); - electron.shell.openExternal(JSON.stringify(window_state)); - enhancer_menu = new electron.BrowserWindow({ - show: true, - frame: false, - titleBarStyle: 'hiddenInset', - x: - window_state.x || - calculateWindowPos(window_state.width, window_state.height).x, - y: - window_state.y || - calculateWindowPos(window_state.width, window_state.height).y, - width: window_state.width, - height: window_state.height, - webPreferences: { - preload: path.resolve(`${__dirname}/menu.js`), - nodeIntegration: true, - session: electron.session.fromPartition('persist:notion'), - }, - }); - enhancer_menu.loadURL('enhancement://core/menu.html'); - enhancer_menu.on('close', (e) => { - window_state.saveState(enhancer_menu); - enhancer_menu = null; - }); - } - - const contextMenu = electron.Menu.buildFromTemplate([ - { - type: 'normal', - label: 'Bug Report', - click: () => { - electron.shell.openExternal( - 'https://github.com/dragonwocky/notion-enhancer/issues/new?labels=bug&template=bug-report.md' - ); - }, - }, - { - type: 'normal', - label: 'Feature Request', - click: () => { - electron.shell.openExternal( - 'https://github.com/dragonwocky/notion-enhancer/issues/new?labels=enhancement&template=feature-request.md' - ); - }, - }, - { - type: 'separator', - }, - { - type: 'normal', - label: 'Docs', - click: () => { - electron.shell.openExternal( - 'https://github.com/dragonwocky/notion-enhancer/tree/js' - ); - }, - }, - { - type: 'normal', - label: 'Enhancements', - accelerator: 'CommandOrControl+E', - click: openExtensionMenu, - }, - { - type: 'separator', - }, - { - label: 'Quit', - role: 'quit', - }, - ]); - tray.setContextMenu(contextMenu); - tray.setToolTip('Notion'); - - function showWindows() { - const windows = electron.BrowserWindow.getAllWindows(); - if (is_mac) electron.app.show(); - if (settings.maximized) windows.forEach((win) => [win.maximize()]); - else windows.forEach((win) => win.show()); - electron.app.focus({ steal: true }); - } - function hideWindows() { - const windows = electron.BrowserWindow.getAllWindows(); - windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); - if (is_mac) electron.app.hide(); - } - - tray.on('click', () => { - const windows = electron.BrowserWindow.getAllWindows(); - if (windows.some((win) => win.isVisible())) hideWindows(); - else showWindows(); + function openExtensionMenu() { + if (enhancer_menu) return enhancer_menu.show(); + const window_state = require(`${__notion.replace( + /\\/g, + '/' + )}/app/node_modules/electron-window-state/index.js`)({ + file: 'menu-windowstate.json', + path: helpers.data_folder, + defaultWidth: 275, + defaultHeight: 600, }); - electron.globalShortcut.register(settings.hotkey, () => { - const windows = electron.BrowserWindow.getAllWindows(); - if (windows.some((win) => win.isFocused() && win.isVisible())) - hideWindows(); - else showWindows(); + electron.shell.openExternal(JSON.stringify(window_state)); + enhancer_menu = new electron.BrowserWindow({ + show: true, + frame: false, + titleBarStyle: 'hiddenInset', + x: + window_state.x || + calculateWindowPos(window_state.width, window_state.height).x, + y: + window_state.y || + calculateWindowPos(window_state.width, window_state.height).y, + width: window_state.width, + height: window_state.height, + webPreferences: { + preload: path.resolve(`${__dirname}/menu.js`), + nodeIntegration: true, + session: electron.session.fromPartition('persist:notion'), + }, }); + enhancer_menu.loadURL('enhancement://core/menu.html'); + enhancer_menu.on('close', (e) => { + window_state.saveState(enhancer_menu); + enhancer_menu = null; + }); + } + + const contextMenu = electron.Menu.buildFromTemplate([ + { + type: 'normal', + label: 'Bug Report', + click: () => { + electron.shell.openExternal( + 'https://github.com/dragonwocky/notion-enhancer/issues/new?labels=bug&template=bug-report.md' + ); + }, + }, + { + type: 'normal', + label: 'Feature Request', + click: () => { + electron.shell.openExternal( + 'https://github.com/dragonwocky/notion-enhancer/issues/new?labels=enhancement&template=feature-request.md' + ); + }, + }, + { + type: 'separator', + }, + { + type: 'normal', + label: 'Docs', + click: () => { + electron.shell.openExternal( + 'https://github.com/dragonwocky/notion-enhancer/tree/js' + ); + }, + }, + { + type: 'normal', + label: 'Enhancements', + accelerator: 'CommandOrControl+E', + click: openExtensionMenu, + }, + { + type: 'separator', + }, + { + label: 'Quit', + role: 'quit', + }, + ]); + tray.setContextMenu(contextMenu); + tray.setToolTip('Notion'); + + function showWindows() { + const windows = electron.BrowserWindow.getAllWindows(); + if (is_mac) electron.app.show(); + if (store().maximized) windows.forEach((win) => [win.maximize()]); + else windows.forEach((win) => win.show()); + electron.app.focus({ steal: true }); + } + function hideWindows() { + const windows = electron.BrowserWindow.getAllWindows(); + windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); + if (is_mac) electron.app.hide(); + } + + tray.on('click', () => { + const windows = electron.BrowserWindow.getAllWindows(); + if (windows.some((win) => win.isVisible())) hideWindows(); + else showWindows(); }); - }; + electron.globalShortcut.register(store().hotkey, () => { + const windows = electron.BrowserWindow.getAllWindows(); + if (windows.some((win) => win.isFocused() && win.isVisible())) + hideWindows(); + else showWindows(); + }); + }); +}; From 0a6a540a41243ab9bc9149736fd948b4275bcb85 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 4 Aug 2020 23:02:20 +1000 Subject: [PATCH 027/371] menu options: input + files --- repo/bracketed-links/mod.js | 2 +- repo/bracketed-links/styles.css | 4 +- repo/core/create.js | 8 +- repo/core/css/menu.css | 71 ++++++++++++++--- repo/core/icons/alwaysontop_off.svg | 2 +- repo/core/icons/alwaysontop_on.svg | 2 +- repo/core/icons/file.svg | 1 + repo/core/icons/maximize_off.svg | 2 +- repo/core/icons/maximize_on.svg | 2 +- repo/core/icons/minimize.svg | 2 +- repo/core/menu.js | 116 +++++++++++++++++++++------- repo/core/mod.js | 13 ++-- repo/core/tray.js | 16 ++++ repo/custom-inserts/mod.js | 30 +++++++ 14 files changed, 215 insertions(+), 56 deletions(-) create mode 100644 repo/core/icons/file.svg create mode 100644 repo/custom-inserts/mod.js diff --git a/repo/bracketed-links/mod.js b/repo/bracketed-links/mod.js index c2ad673..981df61 100644 --- a/repo/bracketed-links/mod.js +++ b/repo/bracketed-links/mod.js @@ -10,7 +10,7 @@ module.exports = { id: '60e14feb-a81d-4ffb-9b12-7585d346bad8', tags: ['extension'], name: 'bracketed links', - desc: 'render links surrounded with [brackets] instead of __underlined__.', + desc: 'render links surrounded with [[brackets]] instead of __underlined__.', version: '0.0.1', author: 'arecsu', }; diff --git a/repo/bracketed-links/styles.css b/repo/bracketed-links/styles.css index 3087e62..8bc3f9d 100644 --- a/repo/bracketed-links/styles.css +++ b/repo/bracketed-links/styles.css @@ -9,12 +9,12 @@ border-bottom: none !important; } .notion-link-token:before { - content: '['; + content: '[['; opacity: 0.7; transition: opacity 100ms ease-in; } .notion-link-token:after { - content: ']'; + content: ']]'; opacity: 0.7; transition: opacity 100ms ease-in; } diff --git a/repo/core/create.js b/repo/core/create.js index 1343670..9cee6e8 100644 --- a/repo/core/create.js +++ b/repo/core/create.js @@ -18,7 +18,7 @@ module.exports = (store, __exports) => { helpers = require('../../pkg/helpers.js'), __notion = helpers.getNotion(); - __exports.createWindow = function (relativeUrl) { + __exports.createWindow = function (relativeUrl, focused_window) { if (!relativeUrl) relativeUrl = ''; const window_state = require(`${__notion.replace( /\\/g, @@ -32,8 +32,9 @@ module.exports = (store, __exports) => { y: window_state.y, width: window_state.width, height: window_state.height, - }, - focused_window = electron.BrowserWindow.getFocusedWindow(); + }; + focused_window = + focused_window || electron.BrowserWindow.getFocusedWindow(); if (focused_window && !focused_window.isMaximized()) { rect.x = focused_window.getPosition()[0] + 20; rect.y = focused_window.getPosition()[1] + 20; @@ -81,4 +82,5 @@ module.exports = (store, __exports) => { window.loadURL(__exports.getIndexUrl(relativeUrl)); return window; }; + return __exports.createWindow; }; diff --git a/repo/core/css/menu.css b/repo/core/css/menu.css index 58ee971..a7f8e86 100644 --- a/repo/core/css/menu.css +++ b/repo/core/css/menu.css @@ -205,6 +205,7 @@ s { font-size: 0.9em; } #modules section .desc p { + font-size: inherit; margin: 0; } #modules section .desc blockquote { @@ -265,7 +266,16 @@ s { margin-bottom: 0.5em; } -select { +.toggle *, +.input *, +.select *, +.file * { + cursor: pointer; +} +.select select, +.input input[type='text'], +.input input[type='number'], +.file input[type='file'] + label .choose { width: 100%; margin: 0.25em 0; font-size: 0.9rem; @@ -274,20 +284,59 @@ select { color: var(--theme_local--text); background: var(--theme_local--main); } - -.toggle * { - cursor: pointer; +.select select:focus, +.input input[type='text']:focus, +.input input[type='number']:focus, +.file input[type='file']:focus + label .choose, +.file input[type='file'] + label .choose:hover { + outline: var(--theme_local--table-border) solid 2px; } -.toggle input { +.file input[type='file'], +.toggle input[type='checkbox'] { display: none; } -.toggle input + label { + +.input input[type='text'], +.input input[type='number'] { + padding: 0.4rem; + cursor: text; +} + +.file input[type='file'] + label .label { + position: relative; display: flex; } -.toggle input + label .name { +.file input[type='file'] + label .label .name { + flex-basis: calc(100% - 1.5rem); +} +.file input[type='file'] + label .label .clear { + font-size: 1rem; + position: absolute; + top: 0.4em; + right: 0; + width: 1em; + height: 0.1em; + border: 0.35em solid var(--theme_local--card); + background: currentColor; +} +.file input[type='file'] + label .choose { + display: block; + white-space: nowrap; + overflow: hidden; +} +.file input[type='file'] + label .choose svg { + padding-top: 0.5em; + height: 1.25em; + width: 1.25em; +} + +.toggle input[type='checkbox'] + label { + display: flex; +} +.toggle input[type='checkbox'] + label .name { flex-basis: calc(100% - 2.25em); } -.toggle input + label .switch { +.toggle input[type='checkbox'] + label .switch { position: relative; margin-top: 0.5em; float: right; @@ -296,7 +345,7 @@ select { background: var(--theme_local--main); border-radius: 5px; } -.toggle input + label .switch:before { +.toggle input[type='checkbox'] + label .switch::before { content: ''; position: absolute; left: 0; @@ -312,7 +361,7 @@ select { opacity: var(--menu--toggle_opacity, 0); transition: opacity 300ms; } -.toggle input + label .switch .dot { +.toggle input[type='checkbox'] + label .switch .dot { position: absolute; width: 1em; height: 1em; @@ -323,7 +372,7 @@ select { background: var(--theme_local--todo_ticked-fill); box-shadow: 2px 1px 4px var(--theme_local--table-border); } -.toggle input:checked + label { +.toggle input[type='checkbox']:checked + label { --menu--toggle_offset: 1em; --menu--toggle_opacity: 1; } diff --git a/repo/core/icons/alwaysontop_off.svg b/repo/core/icons/alwaysontop_off.svg index 648339d..e8711d6 100644 --- a/repo/core/icons/alwaysontop_off.svg +++ b/repo/core/icons/alwaysontop_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/alwaysontop_on.svg b/repo/core/icons/alwaysontop_on.svg index 0c2abaf..4b700e3 100644 --- a/repo/core/icons/alwaysontop_on.svg +++ b/repo/core/icons/alwaysontop_on.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/file.svg b/repo/core/icons/file.svg new file mode 100644 index 0000000..159a961 --- /dev/null +++ b/repo/core/icons/file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/repo/core/icons/maximize_off.svg b/repo/core/icons/maximize_off.svg index ebd1c92..378e3d2 100644 --- a/repo/core/icons/maximize_off.svg +++ b/repo/core/icons/maximize_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/maximize_on.svg b/repo/core/icons/maximize_on.svg index c7fdcbd..6f19bf5 100644 --- a/repo/core/icons/maximize_on.svg +++ b/repo/core/icons/maximize_on.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/icons/minimize.svg b/repo/core/icons/minimize.svg index ec85d9d..3ea3cc9 100644 --- a/repo/core/icons/minimize.svg +++ b/repo/core/icons/minimize.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/repo/core/menu.js b/repo/core/menu.js index f5cea1f..013cf9a 100644 --- a/repo/core/menu.js +++ b/repo/core/menu.js @@ -8,6 +8,8 @@ const store = require('../../pkg/store.js'), helpers = require('../../pkg/helpers.js'), + fs = require('fs-extra'), + path = require('path'), electron = require('electron'), browser = electron.remote.getCurrentWindow(); @@ -17,7 +19,7 @@ window['__start'] = async () => { document.defaultView.addEventListener('keyup', (event) => { if (event.code === 'F5') window.reload(); - if (event.key === 'e' && (event.ctrlKey || event.metaKey)) browser.close(); + if ((event.ctrlKey || event.metaKey) && event.key === 'e') browser.close(); }); electron.ipcRenderer.on('enhancer:set-theme', (event, theme) => { @@ -68,11 +70,11 @@ window['__start'] = async () => { if (version.local == version.repo) return; // compare func from https://github.com/substack/semver-compare version.sorted = [version.local, version.repo].sort((a, b) => { - var pa = a.split('.'); - var pb = b.split('.'); - for (var i = 0; i < 3; i++) { - var na = Number(pa[i]); - var nb = Number(pb[i]); + const pa = a.split('.'), + pb = b.split('.'); + for (let i = 0; i < 3; i++) { + let na = Number(pa[i]), + nb = Number(pb[i]); if (na > nb) return 1; if (nb > na) return -1; if (!isNaN(na) && isNaN(nb)) return 1; @@ -133,7 +135,7 @@ window['__start'] = async () => { // ![image_title](source) .replace( /([^\\])?\!\[([^\]]*[^\\\]]?)\]\(([^)]*[^\\)])\)/g, - '$1$2' + '$1$2' ) // [link](destination) .replace( @@ -153,7 +155,7 @@ window['__start'] = async () => { if (modified_notice) return; modified_notice = createAlert( 'info', - `changes may not apply until app restart.` + `changes may not fully apply until app restart.` ); modified_notice.append(); } @@ -193,7 +195,7 @@ window['__start'] = async () => {
${markdown(mod.desc)}

- + ${mod.author} v${mod.version} @@ -210,7 +212,9 @@ window['__start'] = async () => { menuStore[mod.id].enabled = $enable.checked; mod.elem.className = menuStore[mod.id].enabled ? 'enabled' : 'disabled'; }); + const $options = mod.elem.querySelector('.options'); + let file_icon; if ($options) for (const opt of mod.options) { let $opt; @@ -219,21 +223,17 @@ window['__start'] = async () => { $opt = createElement(`

+ ${ + store(mod.id, { [opt.key]: opt.value })[opt.key] + ? 'checked' + : '' + } />

`); - const $opt_checkbox = $opt.querySelector( - `#toggle_${mod.id}--${opt.key}` - ); - $opt_checkbox.addEventListener('change', (event) => { - store(mod.id)[opt.key] = $opt_checkbox.checked; - modified(); - }); - $options.appendChild($opt); break; case 'select': $opt = createElement(` @@ -246,21 +246,83 @@ window['__start'] = async () => {

`); - const $opt_select = $opt.querySelector( - `#select_${mod.id}--${opt.key}` - ); - $opt_select.value = store(mod.id)[opt.key]; - $opt_select.addEventListener('change', (event) => { - store(mod.id)[opt.key] = $opt_select.value; - modified(); - }); - $options.appendChild($opt); break; case 'input': + $opt = createElement(` +

+ + +

+ `); break; case 'file': + if (!file_icon) + file_icon = await fs.readFile( + path.resolve(`${__dirname}/icons/file.svg`) + ); + $opt = createElement(` +

+ + +

+ `); + $opt.querySelector('.clear').addEventListener('click', (event) => { + store(mod.id)[opt.key] = ''; + $opt.querySelector('.path').innerText = store(mod.id)[opt.key] + ? store(mod.id)[opt.key].split(path.sep).reverse()[0] + : 'choose a file...'; + }); break; } + + if (opt.type !== 'file') { + $opt.querySelector( + `#${opt.type}_${mod.id}--${opt.key}` + ).value = store(mod.id, { + [opt.key]: opt.type === 'select' ? opt.value[0] : opt.value, + })[opt.key]; + } + $opt + .querySelector(`#${opt.type}_${mod.id}--${opt.key}`) + .addEventListener('change', (event) => { + if (opt.type === 'toggle') { + store(mod.id)[opt.key] = event.target.checked; + } else if (opt.type === 'file') { + if (event.target.files.length) + store(mod.id)[opt.key] = event.target.files[0].path; + $opt.querySelector('.path').innerText = store(mod.id)[opt.key] + ? store(mod.id)[opt.key].split(path.sep).reverse()[0] + : 'choose a file...'; + } else + store(mod.id)[opt.key] = + typeof opt.value === 'number' + ? Number(event.target.value) + : event.target.value; + modified(); + }); + $options.appendChild($opt); } $modules.append(mod.elem); } diff --git a/repo/core/mod.js b/repo/core/mod.js index 6d02054..feca362 100644 --- a/repo/core/mod.js +++ b/repo/core/mod.js @@ -10,8 +10,7 @@ module.exports = { id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', tags: ['core', 'extension'], name: 'notion-enhancer core', - desc: `> the **modloader** itself, _including_: the [CLI](https://github.com), the \`menu\`, and ~~enabling/disabling/insertion/updating of~~ mods. - ![](https://preview.redd.it/vtiw9ulqlt951.png?width=1368&format=png&auto=webp&s=733d8b27ec62151c7858b4eca463f809ead6395a)`, + desc: 'what makes this whole thing possible: cli, modloader, menu, & tray.', version: require('../../package.json').version, author: 'dragonwocky', options: [ @@ -35,27 +34,27 @@ module.exports = { }, { key: 'frameless', - label: 'integrate titlebar into notion', + label: 'integrated titlebar', type: 'toggle', value: true, }, { key: 'dragarea_height', - label: 'height of frameless dragarea', + label: 'height of frameless dragarea:', type: 'input', value: 15, }, { key: 'smooth_scrollbars', - label: 'integrate scrollbars into notion', + label: 'integrated scrollbars', type: 'toggle', value: true, }, { key: 'hotkey', - label: 'window display hotkey', + label: 'window display hotkey:', type: 'input', - value: 'CmdOrCtrl+Shift+A', + value: 'CommandOrControl+Shift+A', }, ], hacks: { diff --git a/repo/core/tray.js b/repo/core/tray.js index cc7ddcf..4e98c60 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -143,6 +143,22 @@ module.exports = (store, __exports) => { accelerator: 'CommandOrControl+E', click: openExtensionMenu, }, + { + type: 'normal', + label: 'New Window', + click: () => { + require('./create.js')( + store, + require(path.resolve(`${__notion}/app/main/createWindow.js`)) + )( + '', + electron.BrowserWindow.getAllWindows().find( + (win) => win !== enhancer_menu + ) + ); + }, + accelerator: 'CommandOrControl+Shift+N', + }, { type: 'separator', }, diff --git a/repo/custom-inserts/mod.js b/repo/custom-inserts/mod.js new file mode 100644 index 0000000..54ca1ff --- /dev/null +++ b/repo/custom-inserts/mod.js @@ -0,0 +1,30 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/) under the MIT license + */ + +'use strict'; + +module.exports = { + id: 'b4b0aced-2059-43bf-8d1d-ccd757ee5ebb', + tags: ['extension'], + name: 'custom inserts', + desc: 'directly link files for small client-side tweaks.', + version: '0.0.2', + author: 'dragonwocky', + options: [ + { + key: 'css', + label: 'css insert', + type: 'file', + extensions: ['css'], + }, + { + key: 'js', + label: 'client-side js insert', + type: 'file', + extensions: ['js'], + }, + ], +}; From 7f779e35e501e9b075f6c929a781ca0761f050fb Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Wed, 5 Aug 2020 21:48:11 +1000 Subject: [PATCH 028/371] working menu search --- repo/core/css/menu.css | 90 ++++++++++++++++++++++++++++----- repo/core/icons/user.png | Bin 0 -> 45426 bytes repo/core/menu.html | 9 ++++ repo/core/menu.js | 99 +++++++++++++++++++++++++++++++++++-- repo/core/mod.js | 4 +- repo/custom-inserts/mod.js | 29 ++++++++++- 6 files changed, 214 insertions(+), 17 deletions(-) create mode 100644 repo/core/icons/user.png diff --git a/repo/core/css/menu.css b/repo/core/css/menu.css index a7f8e86..29ad6d7 100644 --- a/repo/core/css/menu.css +++ b/repo/core/css/menu.css @@ -22,11 +22,10 @@ word-break: break-word; text-decoration: none; text-size-adjust: 100%; + color: var(--theme_local--text); + font-family: var(--theme_local--font_sans); outline-color: var(--theme_local--card-border); } -*:active { - outline: none; -} html, body { width: 100%; @@ -65,12 +64,6 @@ main section { /* inline formatting */ -body, -button { - color: var(--theme_local--text); - font-family: var(--theme_local--font_sans); -} - code { border-radius: 0.1em; padding: 0.2em 0.4em; @@ -174,6 +167,62 @@ s { border: 1px solid rgba(0, 0, 0, 0.1); } +/* search */ + +#search { + position: relative; + margin-bottom: 0.75em; +} + +#search > svg { + position: absolute; + width: 1em; + height: 1em; + top: 1.3em; + left: 1em; +} +#search > svg path { + fill: var(--theme_local--text_ui_info); +} +#search > input { + width: 100%; + padding: 1em 1.4em 1em 2.8em; + font: 1em var(--font); + background: var(--theme_local--card); + border: 1px solid var(--theme_local--table-border); + color: var(--theme_local--text); + border-radius: 2px; +} +#search > input::placeholder { + font-weight: bold; + color: var(--theme_local--text_ui_info); +} +#search > input:focus { + box-shadow: var(--theme_local--table-border) 0.04em 0.04em, + var(--theme_local--table-border) -0.04em -0.04em, + var(--theme_local--table-border) -0.04em 0.04em, + var(--theme_local--table-border) 0.04em -0.04em; + outline: none; +} + +#search #tags > span { + cursor: pointer; + display: inline-block; + font-size: 0.8em; + padding: 0.2em 0.5em; + margin-top: 0.5em; + background: var(--theme_local--card); + border-radius: 2px; + transition: background 200ms; + user-select: none; +} +#search #tags > span:not(:last-child) { + margin-right: 0.5em; +} +#search #tags > .selected { + background: var(--tag_colour, var(--theme_local--primary_click)); +} + /* module meta */ #modules section { @@ -193,13 +242,21 @@ s { font-size: 1rem; } -/* #modules section .meta .toggle input + label .switch:before { +/* #modules section .meta .toggle input + label .switch::before { background: linear-gradient( 90deg, var(--theme_local--text_green), var(--theme_local--bg_green) ); +} +#modules section .meta .toggle input + label .switch { + background: linear-gradient( + 90deg, + var(--theme_local--text_red), + var(--theme_local--bg_red) + ); } */ + #modules section .desc { margin: 0.3em 0 0.4em 0; font-size: 0.9em; @@ -293,7 +350,10 @@ s { } .file input[type='file'], .toggle input[type='checkbox'] { - display: none; + opacity: 0; + width: 0.1px; + height: 0.1px; + position: fixed; } .input input[type='text'], @@ -344,6 +404,7 @@ s { width: 2em; background: var(--theme_local--main); border-radius: 5px; + transition: background 300ms; } .toggle input[type='checkbox'] + label .switch::before { content: ''; @@ -372,6 +433,13 @@ s { background: var(--theme_local--todo_ticked-fill); box-shadow: 2px 1px 4px var(--theme_local--table-border); } +.toggle input[type='checkbox']:checked:focus + label .switch { + background: none !important; +} +.toggle input[type='checkbox']:focus + label .switch::before, +.toggle input[type='checkbox']:focus + label .switch .dot { + border: 1px solid var(--theme_local--card-border); +} .toggle input[type='checkbox']:checked + label { --menu--toggle_offset: 1em; --menu--toggle_opacity: 1; diff --git a/repo/core/icons/user.png b/repo/core/icons/user.png new file mode 100644 index 0000000000000000000000000000000000000000..06feff7fe0f98dad6ae05def4ef5108e5b494e79 GIT binary patch literal 45426 zcmeI1F;0|G7)9TNh7f5f>}=hGg=7d0F%yC;z|PKCm|!ijFfnl@(7ORcO##LoxCV>g znTA;2`{fIF2xk((nET#;{&R>8UyqlEyE{*J#u&ScSM!tA_v`ha?XA_;I^Cn*5nmVI-QebJCm|*pJ6R&VhozXlgury6fu=>1-SGcCmXr2^UnkFV#ecr?? zTvKN>PYNte6BDdHZ{iiMsWX}<1(v3X309vs@e0?}8O@UdOVh*ztIwNwg=^}J=1GC2 zX<~xa=S{rAHFZYwq`<-i0~o*n1~7mD3}65Q7{CAqFn|FJU;qOczyJm?fB_6(00S7n z00!<12)~rQ+dh!L@JbIM6qTqHF~ARAM7#M=Dw)C}b1Fr&n-8UuDJ(LlQbfD?P%4?i zB6BK5w3`p5k|``Qr&2__`A{mE!Xk4jMYNj_rIINuGN)2RyZKNmnZhFTjjANTY|=yt zwn@AK3$G+dichE%PaptLNsttuP$`~30HBf}DL$c6Jb?f}B|%brLZx^D0f0(^r1*qN z@dN?@l>|xg36
+
+ - @@ -22,6 +23,10 @@
+ diff --git a/repo/core/menu.js b/repo/core/menu.js index 389d513..542fc11 100644 --- a/repo/core/menu.js +++ b/repo/core/menu.js @@ -130,6 +130,37 @@ window['__start'] = async () => { ).append(); } + // further-configuration popup + const $popup = document.querySelector('#popup'); + document.addEventListener('keyup', (event) => { + if ( + $popup.classList.contains('visible') && + [13, 27].includes(event.keyCode) + ) + $popup.classList.remove('visible'); + }); + let colorpicker_target = null; + const $colorpicker = colorjoe + .rgb('colorpicker') + .on('change', function (color) { + if (!colorpicker_target) return; + colorpicker_target.elem.style.setProperty( + '--configured--color-value', + color.css() + ); + store(colorpicker_target.id)[colorpicker_target.key] = color.css(); + }) + .update(); + + document + .querySelector('#colorpicker') + .appendChild(createElement('')); + document.querySelectorAll('#popup .close-modal').forEach((el) => + el.addEventListener('click', (event) => { + $popup.classList.remove('visible'); + }) + ); + // search const search_query = { enabled: true, @@ -244,6 +275,94 @@ window['__start'] = async () => { modified_notice.append(); } + const file_icon = await fs.readFile( + path.resolve(`${__dirname}/icons/file.svg`) + ); + function createOption(opt, id) { + let $opt; + switch (opt.type) { + case 'toggle': + $opt = ` + + + `; + break; + case 'select': + $opt = ` + + + `; + break; + case 'input': + $opt = ` + + + `; + break; + case 'color': + $opt = ` + + + `; + break; + case 'file': + $opt = ` + + + `; + } + $opt = createElement(`

${$opt}

`); + if (opt.type === 'color') { + $opt + .querySelector(`#${opt.type}_${id}--${opt.key}`) + .style.setProperty( + '--configured--color-value', + store(id, { [opt.key]: opt.value })[opt.key] + ); + } else if (opt.type === 'file') { + $opt.querySelector('.clear').addEventListener('click', (event) => { + store(id)[opt.key] = ''; + $opt.querySelector('.path').innerText = 'choose a file...'; + }); + } else { + $opt.querySelector(`#${opt.type}_${id}--${opt.key}`).value = store(id, { + [opt.key]: opt.type === 'select' ? opt.value[0] : opt.value, + })[opt.key]; + } + + return $opt; + } + const $modules = document.querySelector('#modules'); for (let mod of modules.loaded.sort((a, b) => a.tags.includes('core') || @@ -302,114 +421,40 @@ window['__start'] = async () => { }); const $options = mod.elem.querySelector('.options'); - let file_icon; if ($options) for (const opt of mod.options) { - let $opt; - switch (opt.type) { - case 'toggle': - $opt = createElement(` -

- - -

- `); - break; - case 'select': - $opt = createElement(` -

- - -

- `); - break; - case 'input': - $opt = createElement(` -

- - -

- `); - break; - case 'file': - if (!file_icon) - file_icon = await fs.readFile( - path.resolve(`${__dirname}/icons/file.svg`) - ); - $opt = createElement(` -

- - -

- `); - $opt.querySelector('.clear').addEventListener('click', (event) => { - store(mod.id)[opt.key] = ''; - $opt.querySelector('.path').innerText = store(mod.id)[opt.key] - ? store(mod.id)[opt.key].split(path.sep).reverse()[0] - : 'choose a file...'; - }); - break; - } - - if (opt.type !== 'file') { - $opt.querySelector( - `#${opt.type}_${mod.id}--${opt.key}` - ).value = store(mod.id, { - [opt.key]: opt.type === 'select' ? opt.value[0] : opt.value, - })[opt.key]; - } - $opt - .querySelector(`#${opt.type}_${mod.id}--${opt.key}`) - .addEventListener('change', (event) => { - if (opt.type === 'toggle') { - store(mod.id)[opt.key] = event.target.checked; - } else if (opt.type === 'file') { - if (event.target.files.length) - store(mod.id)[opt.key] = event.target.files[0].path; - $opt.querySelector('.path').innerText = store(mod.id)[opt.key] - ? store(mod.id)[opt.key].split(path.sep).reverse()[0] - : 'choose a file...'; - } else - store(mod.id)[opt.key] = - typeof opt.value === 'number' - ? Number(event.target.value) - : event.target.value; - modified(); + const $opt = createOption(opt, mod.id); + if (opt.type === 'color') { + const $preview = $opt.querySelector('input'); + $opt.addEventListener('click', (event) => { + colorpicker_target = { + id: mod.id, + key: opt.key, + elem: $preview, + }; + $colorpicker.set(store(mod.id)[opt.key]); + $popup.classList.add('visible'); }); + } else { + $opt + .querySelector(`#${opt.type}_${mod.id}--${opt.key}`) + .addEventListener('change', (event) => { + if (opt.type === 'toggle') { + store(mod.id)[opt.key] = event.target.checked; + } else if (opt.type === 'file') { + if (event.target.files.length) + store(mod.id)[opt.key] = event.target.files[0].path; + $opt.querySelector('.path').innerText = store(mod.id)[opt.key] + ? store(mod.id)[opt.key].split(path.sep).reverse()[0] + : 'choose a file...'; + } else + store(mod.id)[opt.key] = + typeof opt.value === 'number' + ? Number(event.target.value) + : event.target.value; + modified(); + }); + } $options.appendChild($opt); } $modules.append(mod.elem); diff --git a/repo/dark+/mod.js b/repo/dark+/mod.js index 3448f2b..56d4d99 100644 --- a/repo/dark+/mod.js +++ b/repo/dark+/mod.js @@ -13,4 +13,40 @@ module.exports = { desc: 'a vivid-colour near-black theme.', version: '0.1.0', author: 'dragonwocky', + options: [ + { + key: 'primary', + label: 'primary colour', + type: 'color', + value: 'rgb(177, 24, 24)', + }, + ], + hacks: { + 'renderer/preload.js'(store, __exports) { + const color = require('./one-color.js')(store().primary); + document.addEventListener('readystatechange', (event) => { + if (document.readyState !== 'complete') return false; + document.documentElement.style.setProperty( + '--theme_dark--selected', + color.lightness(0.35).alpha(0.2).cssa() + ); + document.documentElement.style.setProperty( + '--theme_dark--primary', + color.hex() + ); + document.documentElement.style.setProperty( + '--theme_dark--primary_hover', + color.lightness(0.5).hex() + ); + document.documentElement.style.setProperty( + '--theme_dark--primary_click', + color.lightness(0.6).hex() + ); + document.documentElement.style.setProperty( + '--theme_dark--primary_indicator', + color.lightness(0.4).hex() + ); + }); + }, + }, }; diff --git a/repo/dark+/one-color.js b/repo/dark+/one-color.js new file mode 100644 index 0000000..b602090 --- /dev/null +++ b/repo/dark+/one-color.js @@ -0,0 +1,2 @@ +!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):((t=t||self).one=t.one||{},t.one.color=r())}(this,(function(){"use strict";var t=[],r=function(t){return void 0===t},e=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,n=/\s*(\.\d+|100|\d?\d(?:\.\d+)?)%\s*/,a=new RegExp("^(rgb|hsl|hsv)a?\\("+e.source+","+e.source+","+e.source+"(?:,"+/\s*(\.\d+|\d+(?:\.\d+)?)\s*/.source+")?\\)$","i");function o(t){if(Array.isArray(t)){if("string"==typeof t[0]&&"function"==typeof o[t[0]])return new o[t[0]](t.slice(1,t.length));if(4===t.length)return new o.RGB(t[0]/255,t[1]/255,t[2]/255,t[3]/255)}else if("string"==typeof t){var e=t.toLowerCase();o.namedColors[e]&&(t="#"+o.namedColors[e]),"transparent"===e&&(t="rgba(0,0,0,0)");var s=t.match(a);if(s){var i=s[1].toUpperCase(),u=r(s[8])?s[8]:parseFloat(s[8]),h="H"===i[0],c=s[3]?100:h?360:255,f=s[5]||h?100:255,l=s[7]||h?100:255;if(r(o[i]))throw new Error("color."+i+" is not installed.");return new o[i](parseFloat(s[2])/c,parseFloat(s[4])/f,parseFloat(s[6])/l,u)}t.length<6&&(t=t.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var p=t.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(p)return new o.RGB(parseInt(p[1],16)/255,parseInt(p[2],16)/255,parseInt(p[3],16)/255);if(o.CMYK){var d=t.match(new RegExp("^cmyk\\("+n.source+","+n.source+","+n.source+","+n.source+"\\)$","i"));if(d)return new o.CMYK(parseFloat(d[1])/100,parseFloat(d[2])/100,parseFloat(d[3])/100,parseFloat(d[4])/100)}}else if("object"==typeof t&&t.isColor)return t;return!1}o.namedColors={},o.installColorSpace=function(e,n,a){o[e]=function(t){var r=Array.isArray(t)?t:arguments;n.forEach((function(t,a){var o=r[a];if("alpha"===t)this._alpha=isNaN(o)||o>1?1:o<0?0:o;else{if(isNaN(o))throw new Error("["+e+"]: Invalid color: ("+n.join(",")+")");"hue"===t?this._hue=o<0?o-Math.floor(o):o%1:this["_"+t]=o<0?0:o>1?1:o}}),this)},o[e].propertyNames=n;var s=o[e].prototype;for(var i in["valueOf","hex","hexa","css","cssa"].forEach((function(t){s[t]=s[t]||("RGB"===e?s.hex:function(){return this.rgb()[t]()})})),s.isColor=!0,s.equals=function(t,a){r(a)&&(a=1e-10),t=t[e.toLowerCase()]();for(var o=0;oa)return!1;return!0},s.toJSON=function(){return[e].concat(n.map((function(t){return this["_"+t]}),this))},a)if(Object.prototype.hasOwnProperty.call(a,i)){var u=i.match(/^from(.*)$/);u?o[u[1].toUpperCase()].prototype[e.toLowerCase()]=a[i]:s[i]=a[i]}function h(t,r){var e={};for(var n in e[r.toLowerCase()]=function(){return this.rgb()[r.toLowerCase()]()},o[r].propertyNames.forEach((function(t){var n="black"===t?"k":t.charAt(0);e[t]=e[n]=function(e,n){return this[r.toLowerCase()]()[t](e,n)}})),e)Object.prototype.hasOwnProperty.call(e,n)&&void 0===o[t].prototype[n]&&(o[t].prototype[n]=e[n])}return s[e.toLowerCase()]=function(){return this},s.toString=function(){return"["+e+" "+n.map((function(t){return this["_"+t]}),this).join(", ")+"]"},n.forEach((function(t){var r="black"===t?"k":t.charAt(0);s[t]=s[r]=function(r,e){return void 0===r?this["_"+t]:e?new this.constructor(n.map((function(e){return this["_"+e]+(t===e?r:0)}),this)):new this.constructor(n.map((function(e){return t===e?r:this["_"+e]}),this))}})),t.forEach((function(t){h(e,t),h(t,e)})),t.push(e),o},o.pluginList=[],o.use=function(t){return-1===o.pluginList.indexOf(t)&&(this.pluginList.push(t),t(o)),o},o.installMethod=function(r,e){return t.forEach((function(t){o[t].prototype[r]=e})),this},o.installColorSpace("RGB",["red","green","blue","alpha"],{hex:function(){var t=(65536*Math.round(255*this._red)+256*Math.round(255*this._green)+Math.round(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-t.length)+t},hexa:function(){var t=Math.round(255*this._alpha).toString(16);return"#"+"00".substr(0,2-t.length)+t+this.hex().substr(1,6)},css:function(){return"rgb("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+")"},cssa:function(){return"rgba("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+","+this._alpha+")"}});var s=function(t){t.installColorSpace("HSV",["hue","saturation","value","alpha"],{rgb:function(){var r,e,n,a=this._hue,o=this._saturation,s=this._value,i=Math.min(5,Math.floor(6*a)),u=6*a-i,h=s*(1-o),c=s*(1-u*o),f=s*(1-(1-u)*o);switch(i){case 0:r=s,e=f,n=h;break;case 1:r=c,e=s,n=h;break;case 2:r=h,e=s,n=f;break;case 3:r=h,e=c,n=s;break;case 4:r=f,e=h,n=s;break;case 5:r=s,e=h,n=c}return new t.RGB(r,e,n,this._alpha)},hsl:function(){var r,e=(2-this._saturation)*this._value,n=this._saturation*this._value,a=e<=1?e:2-e;return r=a<1e-9?0:n/a,new t.HSL(this._hue,r,e/2,this._alpha)},fromRgb:function(){var r,e=this._red,n=this._green,a=this._blue,o=Math.max(e,n,a),s=o-Math.min(e,n,a),i=0===o?0:s/o,u=o;if(0===s)r=0;else switch(o){case e:r=(n-a)/s/6+(n Date: Thu, 13 Aug 2020 23:24:45 +1000 Subject: [PATCH 038/371] purple gameish theme... need to link to reddit account --- repo/core/css/dark.css | 3 + repo/core/css/light.css | 3 + repo/gameish/mod.js | 17 ++++++ repo/gameish/styles.css | 125 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 repo/gameish/mod.js create mode 100644 repo/gameish/styles.css diff --git a/repo/core/css/dark.css b/repo/core/css/dark.css index d671ee6..5dc1df7 100644 --- a/repo/core/css/dark.css +++ b/repo/core/css/dark.css @@ -109,6 +109,9 @@ .notion-dark-theme [style*='color: rgb(46, 170, 220)'] { color: var(--theme_dark--primary) !important; } +.notion-dark-theme [style*='fill: rgb(46, 170, 220)'] { + fill: var(--theme_dark--primary) !important; +} .notion-dark-theme [style*='background: rgb(46, 170, 220)'], .notion-dark-theme [style*='background-color: rgb(46, 170, 220)'] { background: var(--theme_dark--primary) !important; diff --git a/repo/core/css/light.css b/repo/core/css/light.css index 0588137..4cc43ea 100644 --- a/repo/core/css/light.css +++ b/repo/core/css/light.css @@ -110,6 +110,9 @@ .notion-light-theme [style*='color: rgb(46, 170, 220)'] { color: var(--theme_light--primary) !important; } +.notion-light-theme [style*='fill: rgb(46, 170, 220)'] { + fill: var(--theme_light--primary) !important; +} .notion-light-theme [style*='background: rgb(46, 170, 220)'], .notion-light-theme [style*='background-color: rgb(46, 170, 220)'] { background: var(--theme_light--primary) !important; diff --git a/repo/gameish/mod.js b/repo/gameish/mod.js new file mode 100644 index 0000000..1289918 --- /dev/null +++ b/repo/gameish/mod.js @@ -0,0 +1,17 @@ +/* + * gameish + * (c) 2020 dragonwocky (https://dragonwocky.me/) + * (c) 2020 alizarin + * under the MIT license + */ + +'use strict'; + +module.exports = { + id: 'ad923617-e76e-408e-9f23-490738a3223f', + tags: ['theme', 'dark'], + name: 'gameish', + desc: 'a purple, "gamer-styled" theme with a blocky-font.', + version: '0.0.3', + author: 'alizarin', +}; diff --git a/repo/gameish/styles.css b/repo/gameish/styles.css new file mode 100644 index 0000000..2257aeb --- /dev/null +++ b/repo/gameish/styles.css @@ -0,0 +1,125 @@ +/* + * gameish + * (c) 2020 dragonwocky (https://dragonwocky.me/) + * (c) 2020 alizarin + * under the MIT license + */ + +@import url('https://fonts.googleapis.com/css2?family=Baumans&family=Comfortaa&family=DM+Mono&family=Gruppo&family=Nova+Mono&family=Offside&family=Press+Start+2P&family=Righteous&display=swap'); + +:root { + --theme_dark--main: #1e1c26; + --theme_dark--sidebar: #24222c; + /* --theme_dark--overlay: rgba(15, 15, 15, 0.6); */ + --theme_dark--dragarea: #19181f; + /* --theme_dark--preview-width: 977px; + --theme_dark--preview-padding: 8em; + --theme_dark--preview_banner-height: 20vh; + --theme_dark--page_banner-height: 30vh; */ + + --theme_dark--font_sans: 'Offside', -apple-system, BlinkMacSystemFont, + 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, + 'Segoe UI Emoji', 'Segoe UI Symbol'; + /* --theme_dark--font_serif: Lyon-Text, Georgia, YuMincho, 'Yu Mincho', + 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', 'Songti TC', 'Songti SC', + SimSun, 'Nanum Myeongjo', NanumMyeongjo, Batang, serif; */ + --theme_dark--font_mono: 'DM Mono', iawriter-mono, Nitti, Menlo, Courier, + monospace; + --theme_dark--font_code: 'DM Mono', SFMono-Regular, Consolas, + 'Liberation Mono', Menlo, Courier, monospace; + + /* --theme_dark--font_title-size: 40px; + --theme_dark--font_heading1-size: 30px; + --theme_dark--font_heading2-size: 24px; + --theme_dark--font_heading3-size: 20px; + --theme_dark--font_label-size: 14px; + --theme_dark--font_body-size: 16px; + --theme_dark--font_code-size: 12.75px; + --theme_dark--font_sidebar-size: 14px; */ + + --theme_dark--scrollbar: #221f29; + /* --theme_dark--scrollbar-border: transparent; */ + --theme_dark--scrollbar_hover: #312d3c; + + /* --theme_dark--card: rgb(53, 51, 58); */ + --theme_dark--gallery: rgba(162, 162, 162, 0.01); + --theme_dark--table-border: rgba(148, 148, 184, 0.5); + --theme_dark--interactive_hover: #282632; + /* --theme_dark--interactive_hover-border: transparent; + --theme_dark--button_close: #e81123; + --theme_dark--button_close-fill: white; */ + + --theme_dark--selected: rgba(85, 68, 156, 0.3); + --theme_dark--primary: rgb(106, 47, 200); + --theme_dark--primary_hover: rgb(110, 48, 211); + --theme_dark--primary_click: rgb(117, 65, 200); + --theme_dark--primary_indicator: rgb(150, 84, 226); + + /* --theme_dark--option-color: white; + --theme_dark--option-background: transparent; + --theme_dark--option_active-color: white; + --theme_dark--option_active-background: var(--theme_dark--primary); + --theme_dark--option_hover-color: white; */ + --theme_dark--option_hover-background: rgb(20, 0, 51); + + --theme_dark--danger_text: rgb(235, 87, 87); + --theme_dark--danger_border: rgba(235, 87, 87, 0.5); + + --theme_dark--text: rgba(255, 255, 255, 0.9); + --theme_dark--text_ui: rgba(255, 255, 255, 0.6); + --theme_dark--text_ui_info: rgba(255, 255, 255, 0.4); + + --theme_dark--text_gray: rgba(151, 154, 155, 0.95); + --theme_dark--text_brown: rgb(112, 87, 77); + /* --theme_dark--text_orange: rgb(255, 163, 68); */ + --theme_dark--text_yellow: #ffe529; + --theme_dark--text_green: #64d97b; + /* --theme_dark--text_blue: rgb(82, 156, 202); */ + --theme_dark--text_purple: #d43cc7; + /* --theme_dark--text_pink: rgb(226, 85, 161); */ + --theme_dark--text_red: #d93939; + /* --theme_dark--bg_gray: rgba(151, 154, 155, 0.5); + --theme_dark--bg_brown: rgba(147, 114, 100, 0.5); + --theme_dark--bg_orange: rgba(255, 163, 68, 0.5); + --theme_dark--bg_yellow: rgba(255, 220, 73, 0.5); + --theme_dark--bg_green: rgba(77, 171, 154, 0.5); + --theme_dark--bg_blue: rgba(82, 156, 202, 0.5); + --theme_dark--bg_purple: rgba(154, 109, 215, 0.5); + --theme_dark--bg_pink: rgba(226, 85, 161, 0.5); */ + --theme_dark--bg_red: rgba(216, 57, 46, 0.5); + /* --theme_dark--line_gray: rgb(69, 75, 78); */ + --theme_dark--line_brown: rgb(78, 57, 48); + --theme_dark--line_orange: rgb(136, 80, 48); + --theme_dark--line_yellow: #fbe2287c; + /* --theme_dark--line_green: rgb(53, 76, 75); + --theme_dark--line_blue: rgb(54, 73, 84); + --theme_dark--line_purple: rgb(68, 63, 87); + --theme_dark--line_pink: rgb(83, 59, 76); */ + --theme_dark--line_red: rgb(151, 62, 62); + + --theme_dark--code_inline-text: #d9cbec; + --theme_dark--code_inline-background: #24222c; + /* --theme_dark--code_text: var(--theme_dark--text); */ + --theme_dark--code-background: #24222c; + /* --theme_dark--code_function: rgba(255, 255, 255, 0.9); + --theme_dark--code_keyword: hsl(350, 40%, 70%); + --theme_dark--code_tag: hsl(350, 40%, 70%); + --theme_dark--code_operator: hsl(40, 90%, 60%); + --theme_dark--code_important: #e90; + --theme_dark--code_property: hsl(350, 40%, 70%); + --theme_dark--code_builtin: hsl(75, 70%, 60%); + --theme_dark--code_attr-name: hsl(75, 70%, 60%); + --theme_dark--code_comment: hsl(30, 20%, 50%); + --theme_dark--code_punctuation: rgba(255, 255, 255, 0.9); + --theme_dark--code_doctype: hsl(30, 20%, 50%); + --theme_dark--code_number: hsl(350, 40%, 70%); + --theme_dark--code_string: hsl(75, 70%, 60%); + --theme_dark--code_attr-value: hsl(350, 40%, 70%); */ +} + +.notion-scroller.vertical.horizontal + .notion-table-view + .notion-selectable.notion-collection_view-block + > :first-child { + background: var(--theme_dark--card) !important; +} From a9a6fc5929539975a432dfeb1ca30a7621bef0a3 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Fri, 14 Aug 2020 23:18:38 +1000 Subject: [PATCH 039/371] pastel dark theme + custom author definitions --- repo/bracketed-links/mod.js | 2 +- repo/core/css/dark.css | 39 ++++++++++ repo/core/css/light.css | 39 ++++++++++ repo/core/css/localised.css | 4 + repo/core/css/menu.css | 4 +- repo/core/css/variables.css | 10 ++- repo/core/css/variables.json | 4 + repo/core/menu.js | 18 +++-- repo/custom-inserts/mod.js | 2 +- repo/dark+/mod.js | 2 +- repo/dark+/styles.css | 4 + repo/focus-mode/mod.js | 2 +- repo/gameish/mod.js | 11 ++- repo/gameish/styles.css | 10 ++- repo/neutral/mod.js | 2 +- repo/neutral/styles.css | 8 +- repo/pastel-dark/mod.js | 22 ++++++ repo/pastel-dark/styles.css | 138 +++++++++++++++++++++++++++++++++++ 18 files changed, 299 insertions(+), 22 deletions(-) create mode 100644 repo/pastel-dark/mod.js create mode 100644 repo/pastel-dark/styles.css diff --git a/repo/bracketed-links/mod.js b/repo/bracketed-links/mod.js index a92597d..551e979 100644 --- a/repo/bracketed-links/mod.js +++ b/repo/bracketed-links/mod.js @@ -11,6 +11,6 @@ module.exports = { tags: ['extension'], name: 'bracketed links', desc: 'render links surrounded with [[brackets]] instead of __underlined__.', - version: '0.0.1', + version: '0.1.0', author: 'arecsu', }; diff --git a/repo/core/css/dark.css b/repo/core/css/dark.css index 5dc1df7..edea597 100644 --- a/repo/core/css/dark.css +++ b/repo/core/css/dark.css @@ -170,6 +170,7 @@ .notion-dark-theme [style*='background: rgba(151, 154, 155, 0.5)'], .notion-dark-theme [style*='background:rgb(69,75,78)'] { background: var(--theme_dark--bg_gray) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(69, 75, 78)'] { background: var(--theme_dark--line_gray) !important; @@ -180,6 +181,7 @@ .notion-dark-theme [style*='background: rgba(147, 114, 100, 0.5)'], .notion-dark-theme [style*='background:rgb(67,64,64)'] { background: var(--theme_dark--bg_brown) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(67, 64, 64)'] { background: var(--theme_dark--line_brown) !important; @@ -190,6 +192,7 @@ .notion-dark-theme [style*='background: rgba(255, 163, 68, 0.5)'], .notion-dark-theme [style*='background:rgb(89,74,58)'] { background: var(--theme_dark--bg_orange) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(89, 74, 58)'] { background: var(--theme_dark--line_orange) !important; @@ -200,6 +203,7 @@ .notion-dark-theme [style*='background: rgba(255, 220, 73, 0.5)'], .notion-dark-theme [style*='background:rgb(89,86,59)'] { background: var(--theme_dark--bg_yellow) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(89, 86, 59)'] { background: var(--theme_dark--line_yellow) !important; @@ -210,6 +214,7 @@ .notion-dark-theme [style*='background: rgba(77, 171, 154, 0.5)'], .notion-dark-theme [style*='background:rgb(53,76,75)'] { background: var(--theme_dark--bg_green) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(53, 76, 75)'] { background: var(--theme_dark--line_green) !important; @@ -220,6 +225,7 @@ .notion-dark-theme [style*='background: rgba(82, 156, 202, 0.5)'], .notion-dark-theme [style*='background:rgb(54,73,84)'] { background: var(--theme_dark--bg_blue) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(54, 73, 84)'] { background: var(--theme_dark--line_blue) !important; @@ -230,6 +236,7 @@ .notion-dark-theme [style*='background: rgba(154, 109, 215, 0.5)'], .notion-dark-theme [style*='background:rgb(68,63,87)'] { background: var(--theme_dark--bg_purple) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(68, 63, 87)'] { background: var(--theme_dark--line_purple) !important; @@ -240,6 +247,7 @@ .notion-dark-theme [style*='background: rgba(226, 85, 161, 0.5)'], .notion-dark-theme [style*='background:rgb(83,59,76)'] { background: var(--theme_dark--bg_pink) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(83, 59, 76)'] { background: var(--theme_dark--line_pink) !important; @@ -250,11 +258,42 @@ .notion-dark-theme [style*='background: rgba(255, 115, 105, 0.5);'], .notion-dark-theme [style*='background:rgb(89,65,65)'] { background: var(--theme_dark--bg_red) !important; + color: var(--theme_dark--bg_text) !important; } .notion-dark-theme [style*='background: rgb(89, 65, 65)'] { background: var(--theme_dark--line_red) !important; } +.notion-dark-theme + [style*='background: rgb(69, 75, 78)'] + [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme + [style*='background: rgb(67, 64, 64)'] + [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme + [style*='background: rgb(89, 74, 58)'] + [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme + [style*='background: rgb(89, 86, 59)'] + [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme + [style*='background: rgb(53, 76, 75)'] + [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme + [style*='background: rgb(54, 73, 84)'] + [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme + [style*='background: rgb(68, 63, 87)'] + [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme + [style*='background: rgb(83, 59, 76)'] + [style*='color: rgba(255, 255, 255, 0.9)'], +.notion-dark-theme + [style*='background: rgb(89, 65, 65)'] + [style*='color: rgba(255, 255, 255, 0.9)'] { + color: var(--theme_dark--line_text) !important; +} + /* code */ .notion-dark-theme [style*='color:#EB5757'] { diff --git a/repo/core/css/light.css b/repo/core/css/light.css index 4cc43ea..b72ab69 100644 --- a/repo/core/css/light.css +++ b/repo/core/css/light.css @@ -178,6 +178,7 @@ .notion-light-theme [style*='background: rgba(140, 46, 0, 0.2)'], .notion-light-theme [style*='background:rgb(235,236,237)'] { background: var(--theme_light--bg_gray) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(235, 236, 237)'] { background: var(--theme_light--line_gray) !important; @@ -188,6 +189,7 @@ .notion-light-theme [style*='background: rgba(140, 46, 0, 0.2)'], .notion-light-theme [style*='background:rgb(233,229,227)'] { background: var(--theme_light--bg_brown) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(233, 229, 227)'] { background: var(--theme_light--line_brown) !important; @@ -198,6 +200,7 @@ .notion-light-theme [style*='background: rgba(245, 93, 0, 0.2)'], .notion-light-theme [style*='background:rgb(250,235,221)'] { background: var(--theme_light--bg_orange) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(250, 235, 221)'] { background: var(--theme_light--line_orange) !important; @@ -208,6 +211,7 @@ .notion-light-theme [style*='background: rgba(233, 168, 0, 0.2)'], .notion-light-theme [style*='background:rgb(251,243,219)'] { background: var(--theme_light--bg_yellow) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(251, 243, 219)'] { background: var(--theme_light--line_yellow) !important; @@ -218,6 +222,7 @@ .notion-light-theme [style*='background: rgba(0, 135, 107, 0.2)'], .notion-light-theme [style*='background:rgb(221,237,234)'] { background: var(--theme_light--bg_green) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(221, 237, 234)'] { background: var(--theme_light--line_green) !important; @@ -228,6 +233,7 @@ .notion-light-theme [style*='background: rgba(0, 120, 223, 0.2)'], .notion-light-theme [style*='background:rgb(221,235,241)'] { background: var(--theme_light--bg_blue) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(221, 235, 241)'] { background: var(--theme_light--line_blue) !important; @@ -238,6 +244,7 @@ .notion-light-theme [style*='background: rgba(103, 36, 222, 0.2)'], .notion-light-theme [style*='background:rgb(234,228,242)'] { background: var(--theme_light--bg_purple) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(234, 228, 242)'] { background: var(--theme_light--line_purple) !important; @@ -248,6 +255,7 @@ .notion-light-theme [style*='background: rgba(221, 0, 129, 0.2)'], .notion-light-theme [style*='background:rgb(244,223,235)'] { background: var(--theme_light--bg_pink) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(244, 223, 235)'] { background: var(--theme_light--line_pink) !important; @@ -258,11 +266,42 @@ .notion-light-theme [style*='background: rgba(255, 0, 26, 0.2)'], .notion-light-theme [style*='background:rgb(251,228,228)'] { background: var(--theme_light--bg_red) !important; + color: var(--theme_light--bg_text) !important; } .notion-light-theme [style*='background: rgb(251, 228, 228)'] { background: var(--theme_light--line_red) !important; } +.notion-light-theme + [style*='background: rgb(235, 236, 237)'] + [style*='color: rgb(55, 53, 47);'], +.notion-light-theme + [style*='background: rgb(233, 229, 227)'] + [style*='color: rgb(55, 53, 47);'], +.notion-light-theme + [style*='background: rgb(250, 235, 221)'] + [style*='color: rgb(55, 53, 47);'], +.notion-light-theme + [style*='background: rgb(251, 243, 219)'] + [style*='color: rgb(55, 53, 47);'], +.notion-light-theme + [style*='background: rgb(221, 237, 234)'] + [style*='color: rgb(55, 53, 47);'], +.notion-light-theme + [style*='background: rgb(221, 235, 241)'] + [style*='color: rgb(55, 53, 47);'], +.notion-light-theme + [style*='background: rgb(234, 228, 242)'] + [style*='color: rgb(55, 53, 47);'], +.notion-light-theme + [style*='background: rgb(244, 223, 235)'] + [style*='color: rgb(55, 53, 47);'], +.notion-light-theme + [style*='background: rgb(251, 228, 228)'] + [style*='color: rgb(55, 53, 47);'] { + color: var(--theme_light--line_text) !important; +} + /* code */ .notion-light-theme [style*='color:#EB5757'] { diff --git a/repo/core/css/localised.css b/repo/core/css/localised.css index 16709b9..160603e 100644 --- a/repo/core/css/localised.css +++ b/repo/core/css/localised.css @@ -66,6 +66,7 @@ --theme--text_purple: var(--theme_dark--text_purple); --theme--text_pink: var(--theme_dark--text_pink); --theme--text_red: var(--theme_dark--text_red); + --theme--bg_text: var(--theme_dark--bg_text); --theme--bg_gray: var(--theme_dark--bg_gray); --theme--bg_brown: var(--theme_dark--bg_brown); --theme--bg_orange: var(--theme_dark--bg_orange); @@ -75,6 +76,7 @@ --theme--bg_purple: var(--theme_dark--bg_purple); --theme--bg_pink: var(--theme_dark--bg_pink); --theme--bg_red: var(--theme_dark--bg_red); + --theme--line_text: var(--theme_dark--line_text); --theme--line_gray: var(--theme_dark--line_gray); --theme--line_brown: var(--theme_dark--line_brown); --theme--line_orange: var(--theme_dark--line_orange); @@ -164,6 +166,7 @@ --theme--text_purple: var(--theme_light--text_purple); --theme--text_pink: var(--theme_light--text_pink); --theme--text_red: var(--theme_light--text_red); + --theme--bg_text: var(--theme_light--bg_text); --theme--bg_gray: var(--theme_light--bg_gray); --theme--bg_brown: var(--theme_light--bg_brown); --theme--bg_orange: var(--theme_light--bg_orange); @@ -173,6 +176,7 @@ --theme--bg_purple: var(--theme_light--bg_purple); --theme--bg_pink: var(--theme_light--bg_pink); --theme--bg_red: var(--theme_light--bg_red); + --theme--line_text: var(--theme_light--line_text); --theme--line_gray: var(--theme_light--line_gray); --theme--line_brown: var(--theme_light--line_brown); --theme--line_orange: var(--theme_light--line_orange); diff --git a/repo/core/css/menu.css b/repo/core/css/menu.css index 7583cf8..bcd6713 100644 --- a/repo/core/css/menu.css +++ b/repo/core/css/menu.css @@ -133,13 +133,13 @@ s { font-weight: bold; font-size: 1.2em; padding-right: 0.5rem; - color: var(--theme--text_ui_info); + color: var(--theme--bg_text); } #alerts [role='alert'] p { font-size: 1rem; margin: auto 0; padding-left: 0.5em; - color: var(--theme--text_ui); + color: var(--theme--bg_text); } #alerts .error { diff --git a/repo/core/css/variables.css b/repo/core/css/variables.css index f21f4a9..7854438 100644 --- a/repo/core/css/variables.css +++ b/repo/core/css/variables.css @@ -79,6 +79,8 @@ --theme_dark--text_purple: rgb(154, 109, 215); --theme_dark--text_pink: rgb(226, 85, 161); --theme_dark--text_red: rgb(255, 115, 105); + + --theme_dark--bg_text: var(--theme_dark--text); --theme_dark--bg_gray: rgba(151, 154, 155, 0.5); --theme_dark--bg_brown: rgba(147, 114, 100, 0.5); --theme_dark--bg_orange: rgba(255, 163, 68, 0.5); @@ -88,6 +90,8 @@ --theme_dark--bg_purple: rgba(154, 109, 215, 0.5); --theme_dark--bg_pink: rgba(226, 85, 161, 0.5); --theme_dark--bg_red: rgba(255, 115, 105, 0.5); + + --theme_dark--line_text: var(--theme_dark--text); --theme_dark--line_gray: rgb(69, 75, 78); --theme_dark--line_brown: rgb(67, 64, 64); --theme_dark--line_orange: rgb(89, 74, 58); @@ -188,6 +192,8 @@ --theme_light--text_purple: rgb(105, 64, 165); --theme_light--text_pink: rgb(173, 26, 114); --theme_light--text_red: rgb(224, 62, 62); + + --theme_light--bg_text: var(--theme_light--text); --theme_light--bg_gray: rgb(235, 236, 237); --theme_light--bg_brown: rgb(233, 229, 227); --theme_light--bg_orange: rgb(250, 235, 221); @@ -197,13 +203,15 @@ --theme_light--bg_purple: rgb(234, 228, 242); --theme_light--bg_pink: rgb(244, 223, 235); --theme_light--bg_red: rgb(251, 228, 228); + + --theme_light--line_text: var(--theme_light--text); --theme_light--line_gray: rgb(235, 236, 237); --theme_light--line_brown: rgb(233, 229, 227); --theme_light--line_orange: rgb(250, 235, 221); --theme_light--line_yellow: rgb(251, 243, 219); --theme_light--line_green: rgb(221, 237, 234); --theme_light--line_blue: rgb(221, 235, 241); - --theme_light--line_purple: rgb(105, 64, 165); + --theme_light--line_purple: rgb(234, 228, 242); --theme_light--line_pink: rgb(244, 223, 235); --theme_light--line_red: rgb(251, 228, 228); diff --git a/repo/core/css/variables.json b/repo/core/css/variables.json index 19e7fd4..da593b8 100644 --- a/repo/core/css/variables.json +++ b/repo/core/css/variables.json @@ -54,6 +54,7 @@ "--theme_dark--text_purple", "--theme_dark--text_pink", "--theme_dark--text_red", + "--theme_dark--bg_text", "--theme_dark--bg_gray", "--theme_dark--bg_brown", "--theme_dark--bg_orange", @@ -63,6 +64,7 @@ "--theme_dark--bg_purple", "--theme_dark--bg_pink", "--theme_dark--bg_red", + "--theme_dark--line_text", "--theme_dark--line_gray", "--theme_dark--line_brown", "--theme_dark--line_orange", @@ -145,6 +147,7 @@ "--theme_light--text_purple", "--theme_light--text_pink", "--theme_light--text_red", + "--theme_light--bg_text", "--theme_light--bg_gray", "--theme_light--bg_brown", "--theme_light--bg_orange", @@ -154,6 +157,7 @@ "--theme_light--bg_purple", "--theme_light--bg_pink", "--theme_light--bg_red", + "--theme_light--line_text", "--theme_light--line_gray", "--theme_light--line_brown", "--theme_light--line_orange", diff --git a/repo/core/menu.js b/repo/core/menu.js index 542fc11..4f0f3e1 100644 --- a/repo/core/menu.js +++ b/repo/core/menu.js @@ -373,7 +373,15 @@ window['__start'] = async () => { ? 1 : a.name.localeCompare(b.name) )) { - const menuStore = store('mods', { [mod.id]: { enabled: false } }); + const menuStore = store('mods', { [mod.id]: { enabled: false } }), + author = + typeof mod.author === 'object' + ? mod.author + : { + name: mod.author, + link: `https://github.com/${mod.author}`, + avatar: `https://github.com/${mod.author}.png`, + }; mod.elem = createElement(`