mirror of
				https://github.com/notion-enhancer/notion-enhancer.git
				synced 2025-10-26 11:48:08 +11:00 
			
		
		
		
	refactor some stuff, fix some bugs, apply theme to ctrl+f popup
This commit is contained in:
		
							parent
							
								
									160fad9f60
								
							
						
					
					
						commit
						aadcc50a11
					
				| @ -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'); | ||||
|  | ||||
| @ -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); | ||||
| } | ||||
|  | ||||
| @ -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); | ||||
| } | ||||
|  | ||||
| @ -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), | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| @ -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); | ||||
| } | ||||
|  | ||||
| @ -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(); | ||||
|       }); | ||||
|  | ||||
| @ -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); | ||||
| 
 | ||||
|  | ||||
| @ -60,6 +60,7 @@ module.exports = function (__file, __exports) { | ||||
|       } | ||||
|       modules.loaded.push(mod.name); | ||||
|     } catch (err) { | ||||
|       // console.error(err);
 | ||||
|       modules.invalid.push(dir); | ||||
|     } | ||||
|   } | ||||
|  | ||||
							
								
								
									
										32
									
								
								yarn.lock
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								yarn.lock
									
									
									
									
									
								
							| @ -2,19 +2,19 @@ | ||||
| # yarn lockfile v1 | ||||
| 
 | ||||
| 
 | ||||
| "@jsdevtools/file-path-filter@^3.0.0": | ||||
|   version "3.0.1" | ||||
|   resolved "https://registry.yarnpkg.com/@jsdevtools/file-path-filter/-/file-path-filter-3.0.1.tgz#7fa96b4c0d41a2ec6231584a9f90f4e9442d24eb" | ||||
|   integrity sha512-7kOhYFyidfB9fZf2LLkMD/AntpFnxzWW614H4hLvWe3ENE9NN32cZQeF0Ychjg6h91XaUYbqQx2D/GtXJ05/Ew== | ||||
| "@jsdevtools/file-path-filter@^3.0.2": | ||||
|   version "3.0.2" | ||||
|   resolved "https://registry.yarnpkg.com/@jsdevtools/file-path-filter/-/file-path-filter-3.0.2.tgz#22a0b544b8471fafd8da87c471a92bc778ab75f1" | ||||
|   integrity sha512-+SbZG6stIE/nRF2PpRnubtuzhh4pouDsk/hEWwM5mKsSKlFfr4ziAE5VMogGG/K++i9NHbUTxxW0y4vdM678ew== | ||||
|   dependencies: | ||||
|     glob-to-regexp "^0.4.1" | ||||
| 
 | ||||
| "@jsdevtools/readdir-enhanced@6.0.3": | ||||
|   version "6.0.3" | ||||
|   resolved "https://registry.yarnpkg.com/@jsdevtools/readdir-enhanced/-/readdir-enhanced-6.0.3.tgz#0916be64d6677dd98b8bf6fd38e6e1057d31ada2" | ||||
|   integrity sha512-fDg/Qk6+vaMDGW3P4DN+i3Kx/t1Hk2FgKcxynA/N9a7hZZp3oBG55ia8lZP9CPWvIUDmOwIyDOo2/k9lTB2ciQ== | ||||
| "@jsdevtools/readdir-enhanced@6.0.4": | ||||
|   version "6.0.4" | ||||
|   resolved "https://registry.yarnpkg.com/@jsdevtools/readdir-enhanced/-/readdir-enhanced-6.0.4.tgz#077749dac62cefd01453cd5af1084586c635a358" | ||||
|   integrity sha512-I6D6Omu6C7XWHzvlVbXeCS0FSxYYQ13XzdrFuo1K30unnRSpdt9AxY2KyJZbYJyfI2uNNidqDkG9/K/y699AjA== | ||||
|   dependencies: | ||||
|     "@jsdevtools/file-path-filter" "^3.0.0" | ||||
|     "@jsdevtools/file-path-filter" "^3.0.2" | ||||
| 
 | ||||
| "@types/glob@^7.1.1": | ||||
|   version "7.1.3" | ||||
| @ -30,9 +30,9 @@ | ||||
|   integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== | ||||
| 
 | ||||
| "@types/node@*": | ||||
|   version "14.0.23" | ||||
|   resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.23.tgz#676fa0883450ed9da0bb24156213636290892806" | ||||
|   integrity sha512-Z4U8yDAl5TFkmYsZdFPdjeMa57NOvnaf1tljHzhouaPEp7LCj2JKkejpI1ODviIAQuW4CcQmxkQ77rnLsOOoKw== | ||||
|   version "14.0.26" | ||||
|   resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.26.tgz#22a3b8a46510da8944b67bfc27df02c34a35331c" | ||||
|   integrity sha512-W+fpe5s91FBGE0pEa0lnqGLL4USgpLgs4nokw16SrBBco/gQxuua7KnArSEOd5iaMqbbSHV10vUDkJYJJqpXKA== | ||||
| 
 | ||||
| asar@^3.0.3: | ||||
|   version "3.0.3" | ||||
| @ -163,11 +163,11 @@ path-is-absolute@^1.0.0: | ||||
|   integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= | ||||
| 
 | ||||
| readdir-enhanced@^6.0.3: | ||||
|   version "6.0.3" | ||||
|   resolved "https://registry.yarnpkg.com/readdir-enhanced/-/readdir-enhanced-6.0.3.tgz#68996e119d62852ca48ea1148a8bab066df61bea" | ||||
|   integrity sha512-il2lsGAN3AzufAKnuqFdEz6TVdCCuQEpSQ96ntgUlCCRZwbz9A2VFLph0BqXQ/Sw1/Rb1wTrkbtsJpNEjP7wuA== | ||||
|   version "6.0.4" | ||||
|   resolved "https://registry.yarnpkg.com/readdir-enhanced/-/readdir-enhanced-6.0.4.tgz#71186776390bd1cf33b7c1451924ffaced7db184" | ||||
|   integrity sha512-MWY048D/nEpHwqdnsBiUxpqjJPkEw2i2RmY5gM2Gadn0rkHS/DhUBqrYTkOqKHF4RoUlYZZ8GnP4ymlRGuo30A== | ||||
|   dependencies: | ||||
|     "@jsdevtools/readdir-enhanced" "6.0.3" | ||||
|     "@jsdevtools/readdir-enhanced" "6.0.4" | ||||
| 
 | ||||
| universalify@^1.0.0: | ||||
|   version "1.0.0" | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user