diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md deleted file mode 100644 index b54589e..0000000 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: bug report -about: experienced any broken/glitchy enhancer behaviour? -title: '' -labels: bug -assignees: '' ---- - -FILL OUT THIS TEMPLATE, REMOVING/REPLACING ALL NON-BOLD TEXT WITH YOUR OWN INFORMATION. -BE AS CLEAR AND CONCISE AS POSSIBLE. - -**describe the bug** -what is the bug - what happens? - -**expected behaviour** -why is this a bug - what should be happening? - -**screenshots** -if applicable, add screenshots of your problem. - -**platform** -what OS are you using? e.g. windows 7, windows 10, WSL, ubuntu, arch linux, macOS diff --git a/.github/ISSUE_TEMPLATE/feature-proposal.md b/.github/ISSUE_TEMPLATE/feature-proposal.md deleted file mode 100644 index 9f339d4..0000000 --- a/.github/ISSUE_TEMPLATE/feature-proposal.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -name: feature proposal -about: got an idea/request/suggestion for a new feature/module? -title: '' -labels: enhancement -assignees: '' ---- - -FILL OUT THIS TEMPLATE, REMOVING/REPLACING ALL NON-BOLD TEXT WITH YOUR OWN INFORMATION. -BE AS CLEAR AND CONCISE AS POSSIBLE. - -ONCE ALL INFORMATION HERE HAS BEEN FILLED IN, THE MODULE WILL BE REVIEWED & DISCUSSED -BY OTHER CONTRIBUTORS AND BY THE COMMUNITY. IF IT IS APPROVED AS SOMETHING USEFUL/BENEFICIAL, -THEN IT IS GUARANTEED TO BE ADDED TO THE ENHANCER. - -IF YOU WOULD LIKE TO CONTRIBUTE AND CODE THIS YOURSELF, THAT'D BE AWESOME! JUST OPEN A -PULL REQUEST WHEN YOU'RE READY. IF PROGRAMMING ISN'T YOUR THING, ANOTHER DEV WILL COME -ALONG AND PICK THE IDEA UP. - -ONCE SOMEONE STARTS WORK ON THIS, THE ISSUE WILL BE ASSIGNED TO THEIR GITHUB ACCOUNT -SO MULTIPLE PEOPLE DON'T ALL WORK ON THE SAME THING: IF YOU PLAN ON MAKING THIS, SAY SO! - -**problem** - -why is this feature necessary? how will it help? what existing shortcomings does it address? - -**solution** - -how will this feature appear/act? - -how could this be technically implemented using the available -capabilities of the enhancer and notion? - -**cons** - -what are the potential costs or dangers of this feature, or things that may go -outside of the enhancer's scope? e.g. bad performance, security issues, or -modifying the data notion stores. - -**alternatives** - -would a different feature remove the need for this? - -does this need to be implemented by the enhancer? could an external service work better? -e.g. playing background music via noisli or youtube. diff --git a/.github/workflows/potential-duplicates.yml b/.github/workflows/potential-duplicates.yml deleted file mode 100644 index dce768d..0000000 --- a/.github/workflows/potential-duplicates.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: potential duplicates -on: - issues: - types: [opened, edited] -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: bubkoo/potential-duplicates@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Label to set, when potential duplicates are detected. - label: potential-duplicate - # Get issues with state to compare. Supported state: 'all', 'closed', 'open'. - state: all - # If similarity is higher than this threshold([0,1]), issue will be marked as duplicate. - threshold: 0.6 - # Reactions to be add to comment when potential duplicates are detected. - # Available reactions: "-1", "+1", "confused", "laugh", "heart", "hooray", "rocket", "eyes" - reactions: 'confused' - # Comment to post when potential duplicates are detected. - comment: > - potential duplicates: - {{#issues}} - - [#{{ number }}] {{ title }} ({{ accuracy }}%) - {{/issues}} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 53f79ca..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,111 +0,0 @@ -# contributing - -the enhancer is a tool for the community, so who best to build it but the community? - -these guidelines are designed for smooth communication, management and development on this project. -following them shows respect to the developer/s spending their free time on it, and makes it easiest for them to improve the tool. - -**found a bug / something isn't working as expected?** create a -[bug report](https://github.com/notion-enhancer/notion-enhancer/issues/new?labels=bug&template=bug-report.md). - -> SECURITY ISSUE? (e.g. PERSONAL/NOTION DATA BEING INTERFERED WITH) -> EMAIL ME INSTEAD: [thedragonring.bod@gmail.com](mailto:thedragonring.bod@gmail.com) - -**have a cool new feature idea / there's something you just wish you could do?** submit a -[feature proposal](https://github.com/notion-enhancer/notion-enhancer/issues/new?labels=enhancement&template=feature-proposal.md). - -> enhancements are applied only locally - -> features should be designed only to improve the user experience. - -**know your way around notion/electron/js/css and have some code to contribute?** great! read below for guidelines -on how to create a helpful pull request and what happens with your code afterwards. it's probably also helpful to -join the [discord server](https://discord.gg/sFWPXtA). - -**for information on how to actually create a theme or module with the notion-enhancer api, check the [docs](DOCUMENTATION.md).** - -## testing - -first, remove any other installations of the enhancer: `npm remove -g notion-enhancer` - -to download and install the latest code, run: - -```sh -git clone https://github.com/notion-enhancer/notion-enhancer -cd notion-enhancer -git checkout dev -npm link -notion-enhancer apply -y -``` - -to update the dev build, go into the downloaded folder and run `git pull`. (make sure any work-in-progress themes etc. are copied somewhere else safely first.) - -to remove the dev build, go into the downloaded folder and run: - -```sh -notion-enhancer remove -n -npm unlink -``` - -## conventions - -the enhancer is a **core** extended by included **modules**. -the core can be further split into the **installer** and the **modloader**. -modules are either **extensions** or **themes**. - -each module is separately versioned, following the [semver](https://semver.org/) scheme. -depending on the content and scale of a contribution, it may constitute an update on its own or may be merged into a larger update. - -to keep a consistent & informative code style it is preferred to name variables with -`snake_case`, functions/methods with `camelCase`, and classes with `PascalCase`. -if a variable is a reference to a DOM element, it may be helpful to prefix it with a `$`. - -some variables beginning with a double underscore are `__folder` paths and `ALL_CAPS` variables -are constant. this is not required, but these styles should not be used for any other purpose. - -the master branch is kept consistent with the current release, -so all changes should be made to the dev branch. - -## review - -active core devs will manually look through each pull request and communicate with contributors before merging to -make sure it is: - -**a) safe.** system details (e.g. IP, clipboard) + notion user data are considered private unless directly shared by the user. -none of this should be accessed or transmitted to an external server. - -**b) functional.** is there a better way to do this? can extra dependencies be removed or replaced by newer web technologies? -how can this be made as user-friendly as possible? - -**c) bug-free.** where possible, code should be tested on a variety of platforms in a variety of situations so it can be -confirmed that it won't break anything for the user and is robust enough to handle use by both -power users and non-tech-savvy users. - -## translating - -future versions of the enhancer will have multi-language support. - -if you are willing to help with translation, let me know and i'll contact you when i'm ready. - -## licensing - -this project is distributed under the [MIT](https://choosealicense.com/licenses/mit/) license. -the project as a whole is copyrighted by core devs in the [LICENSE](LICENSE) file. - -when modifying a file, add your copyright to it in the format: - -``` -/* - * module or project name - * (c) year name (website) - * under the MIT license - */ -``` - -all code contributed to this repository remains attributed to the contributor, -but full rights are granted for it to be used under the terms of the MIT license. -on the occasion that the contributed code should be removed or overwritten, -the contributor's copyright may be removed from the file. - -by opening a pull request in this repository, you agree to the above conditions. - -dependencies remain separately licensed to their various authors. diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md deleted file mode 100644 index ad71710..0000000 --- a/DOCUMENTATION.md +++ /dev/null @@ -1,217 +0,0 @@ -# documentation - -the enhancer is essentially a modloader for notion. this document contains the specifications of -how those modules can be made and what they should contain. - -this file assumes basic working knowledge of modern javascript and css. since these are the languages -executable within the notion app, these are the languages enhancements must be written in. - -want to contribute? check the [contribution guidelines](CONTRIBUTING.md). - -for support, join the [discord server](https://discord.gg/sFWPXtA). - -## creating a mod - -_to understand best how notion's app works, check out [the electron docs](https://www.electronjs.org/docs/),_ -_explore the contents of your local extracted `app.asar`, and navigate the html structure with the devtools web inspector._ - -_look through [the existing modules](mods)_ -_for examples of the stuff described below in action._ - -_at the moment, for ease of development and use (and security assurance), there's no way for users_ -_to install their own modules. this means that testing modules requires_ -_[running a dev build of the enhancer](CONTRIBUTING.md#testing). a better system is in the works._ - -_once your mod is working, open a pull request to add it to the enhancer!_ - -each directory in the `mods` folder is considered a module, with the file entry points `mod.js`, -`variables.css`, `app.css`, `tabs.css` and `menu.css`. - -| file | description | -| ------------ | --------------------------------------------------------------------- | -| `mod.js` | **required:** describes the module and contains functional javascript | -| `styles.css` | **optional:** a css file automatically inserted into each app window | - -## mod.js - -```js -// not valid js! -// a visual representation of the contents/type -// of this file's exported object. -module.exports = { - id: String of uuidv4, - name: String of short_name, - tags?: Array of categories, - desc: String of markdown, - version: String of semver, - author: String of github_username OR { - name: String of author_name, - link: String of url, - avatar: String of image_source, - }, - options?: Array<{ - key: String, - label: String, - desc?: String, - type: String in ['toggle', 'select', 'input', 'file'], - value: Boolean or Array or String or Number or null, - platformOverwrite?: { - darwin?: Boolean or Array or String or Number or null, - win32?: Boolean or Array or String or Number or null, - linux?: Boolean or Array or String or Number or null, - } - }>, - hacks?: { - [k: 'insert-point' (e.g. 'main/createWindow.js')]: function ( - store, // used for configuration and persisting of data (explanation below). - __exports // module.exports of the target file. if you don't understand that, don't use it. - ) {} - } -}; -``` - -| key | value | type | -| ------- | ----------------------------------------------------------------------------------------------- | ---------------------- | -| id | **required:** uuidv4 - generate a new one [here](https://www.uuidgenerator.net) | _string_ | -| name | **required:** short name (e.g. `'ocean theme'`) | _string_ | -| tags | **required:** categories/type (e.g. `'extension'`, `'theme'`, `'light'`, `'dark'`) | _array\_ | -| desc | **optional:** 1-3 sentence description of what the module is/does, with basic markdown support. | _string_ | -| version | **required:** semver (e.g. `'0.3.7'`) | _string_ | -| author | **required:** see below: original extension creator | _string_ or \ | -| options | **optional:** see below: options made available in the enhancer menu (accessible from the tray) | _array\_ | -| hacks | **optional:** see below: code inserted at various points | _object_ | - -> a module that with the primary function of being a hack should be tagged as an extension, -> while a module that has the primary function of adding styles should be tagged as a theme. - -#### author - -by default this is assumed to be a github username: just pass it as a string and -the link/avatar will be automatically found. - -if you'd rather customise this, pass this object: - -| key | value | type | -| ------ | ------------------------------------------ | -------- | -| name | **required:** author's (your?) name | _string_ | -| link | **required:** link to the author's profile | _string_ | -| avatar | **required:** url for the author's avatar | _string_ | - -#### options - -| key | value | type | -| ----------------- | ---------------------------------------------------------------------------------------- | --------------------------- | -| key | **required:** key to save value to the mod `store` | _string_ | -| label | **required:** short description/name of option to be shown in menu | _string_ | -| desc | **optional:** extended information to be shown on hover | _string_ | -| type | **required:** input type (see below) | _string_ | -| extensions | **optional:** allowed file extensions (only use with a file option), e.g. `['js', 'ts']` | _array\_ | -| value | **optional:** default or possible value/s for option | see below | -| platformOverwrite | **optional:** remove the option from the menu and force a value on a specific platform | _\_ as shown above | - -| type | value | -| ------ | -------------------- | -| toggle | _boolean_ | -| select | _array\_ | -| input | _string_ or _number_ | -| color | _string_ | -| file | none | - -> the file option stores only a filepath, not the file itself. - -## hacks - -each "hack" is a function taking 2 arguments. - -1. the **`store`** argument, which allows access to the module settings/options defined in `mod.js` - (those set in the menu, or used internally by the module). each module store is automatically saved to + - loaded from `~/.notion-enhancer/id.json`. - it should always be called as `store({ defaults })` (not stored in a variable), - but otherwise treated as a normal object to access and set things. -2. the **`__exports`** argument, which is the `module.exports` of the file being modded. - this can be used to call or replace functions from notion. - -this hack is applied to whichever file (`.js`-only) is set as the function key. these can be found within the `app` folder. - -files under the `main` folder are executed on app launch in a process shared -between all app windows (consider it a backend). files under the `renderer` folder are -executed on window launch in a pre-window process: the client-side javascript -normally expected to run on a webpage. - -unless scripts need to change app logic (e.g. to add the tray menu), -they should usually be applied to `renderer/preload.js` to interact -with the app window itself. - -e.g. - -```js -// sayhi.js -module.exports = function (store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - console.log(store({ name: 'dragonwocky' }).name); - }); -}; -// mod.js -module.exports.hacks = { - 'renderer/preload.js': require('./sayhi.js'), -}; -``` - -### the `enhancement://` protocol - -any files within the `mods` folder can be loaded with the `enhancement://` protocol. - -for example, inserting an image from the core mod: ``. - -## `variables.css` - -**inserted into all windows.** - -(put font import statements here too.) - -the enhancer has been designed with theming in mind, so as much of notion's colours -and typography as possible and some basic spacing (both for the light and dark themes) have been mapped out -using css variables. - -this set of variables is 100% mandatory to use if you wish to use or change anything they handle -(particularly colours). this is necessary to keep all themes consistently working -(e.g. responding properly to light/dark theme changes), and it makes theming a lot easier - -notion's html structure needs some complex selectors to properly modify it, -and it means theme authors don't have to worry about separately updating their theme every time something changes. - -the full/up-to-date list of variables and their default values can be found in the -[core `variables.css` file](mods/core/variables.css). each variable is named something along the lines of -`--theme_mode--target_name-property`. still not sure what a variable does? try changing it and seeing what happens. - -these are all made possible by the core module. if you believe this set of variables is buggy or lacking in any way, -consider opening a pull request to fix those issues - please do not try and reinvent the wheel unnecessarily. - -> ### using variables -> -> variables should be defined per-mode, but used without specifying. for example: -> -> ```css -> :root { -> --theme_dark--main: rgb(5, 5, 5); -> } -> .demo-element { -> background: var(--theme--main); -> } -> ``` -> -> this to simplify styling and make it possible for things like the "night shift" module to work, -> by leaving the choice of light/dark theme up to the user and then directing the right values to -> the relevant variables. - -## `app.css` - -**inserted into the notion app window.** - -## `tabs.css` - -**inserted into the notion app container for styling tabs.** - -## `menu.css` - -**inserted into the enhancements menu.** diff --git a/README.md b/README.md index 2bac9b9..431d008 100644 --- a/README.md +++ b/README.md @@ -1,474 +1,3 @@ -# notion-enhancer +# notion-enhancer (desktop) -notion.so is a pretty awesome tool already, but there's always room for improvements. -it might just be a preference, it might be something crucial to your setup, -it might be something users have been asking for for a long time, -or it might even be something you haven't realised you need yet -\- there's something that would make your user experience a lot better. - -this package is a mod-loader for the desktop app, with custom colour theming and extra feature enhancements. - -want to contribute? check out the [contribution guidelines](CONTRIBUTING.md) and the [documentation](DOCUMENTATION.md). - -for support, join the [discord server](https://discord.gg/sFWPXtA). - -## Supported desktop clients - -- the pre-enhanced builds available at [notion-repackaged](https://github.com/notion-enhancer/notion-repackaged). Built for Windows, Linux and Mac (Intel and M1) -- the pre-enhanced arch linux AUR package [notion-app-enhanced](https://aur.archlinux.org/packages/notion-app-enhanced/) - -it is possible to manually patch the [official windows/mac releases](https://notion.so/desktop), but currently it is not recommended as notion-repackaged contains extra bugfixes on top of the notion-enhancer release. - -mobile clients are not supported and due to system limitations/restrictions cannot be. - -a chrome extension is work in progress - -## Installation - -### Installing notion-repackaged builds - -> **if you are using Arch or derivatives like Manjaro**, you can install [notion-app-enhanced](https://aur.archlinux.org/packages/notion-app-enhanced/) which is pre-enhanced and doesn't require any additional steps to get working. -> - -The [notion-enhancer/notion-repackaged](https://github.com/notion-enhancer/notion-repackaged) project provides prebuilt builds for Windows, Linux and Mac that are ready to install and use. These builds are pre-enhanced and aim to provide the fastest and easiest way to use notion-enhancer. - -The [available release builds](https://github.com/notion-enhancer/notion-repackaged/releases/) include: - -- Windows (`.exe` installer, only x64) -- Linux (`AppImage`, `deb`, `rpm`, `pacman` packages, only x64) -- Mac (`dmg` package, for Intel and Apple Silicon) - -The builds are not signed, so your operating system might complain when installing even though the builds are completely safe to use. - -For more information, please head over to [notion-repackaged's documentation](https://github.com/notion-enhancer/notion-repackaged) - -### Patching manually - -YOU SHOULD NOT DO THIS. PLEASE USE NOTION-REPACKAGED UNTIL NOTION-ENHANCER IS UPDATED. NOTION HAS RECENTLY MADE MANY BREAKING CHANGES THAT WE ARE TRYING TO CATCH UP WITH. - -> **if you are updating from v0.7.0 or earlier,** things have changed, more information is available -> in this [update guide](UPDATING.md). please read that before following these instructions. - -- ensure that no notion windows/processes are running by ending all Notion processes in your task manager. - - `CMD + ALT + ESC` on mac and `CTRL + SHIFT + ESC` on windows/linux to open task manager. -- [install node.js](https://nodejs.org/en/download/) - - you may need to restart your computer. - - notion-enhancer will use node.js, you do not need to interact with it aside from downloading to install notion-enhancer. -- open your computer's terminal, **not the node.js command prompt.** - - **windows 10:** search in your start menu (click windows key or icon in bottom left of screen) for _'cmd'_ or _'command prompt'_. - - **mac:** search in spotlight (magnifying glass in top right of screen) for _'terminal'_. -- type and enter the following line(s) based on your operating system, if there are multiple lines, make sure to enter them _one by one_ . - - **windows 10:** - ``` - npm i -g notion-enhancer - ``` - - **mac:** this may ask you to enter your password, instead of hiding your password with \*\*\* symbols, mac terminal hides it by making it invisible. simply type your password and click enter. - ``` - sudo chmod -R a+wr /usr/local/lib/node_modules - sudo chmod -R a+wr /usr/local/bin - sudo chmod -R a+wr /Applications/Notion.app/Contents/Resources - npm i -g notion-enhancer - ``` - - **debian/ubuntu, chromeOS, wsl (to modify the win10 app):** - ``` - bash curl -sL https://deb.nodesource.com setup_current.x | sudo -E bash - - sudo apt-get install -y nodejs - npm i -g notion-enhancer - ``` - -- ⚠ important - on the notion desktop app version 2.0.13 and newer, a small fix is necessary to make notion enhancer work. follow the [steps here](https://www.notion.so/hack-notion-enhancer-v0-10-2-to-work-with-notion-s-v2-0-13-app-a4ab1267e67b4126b6448641ca4a0041) to fix notion. there's also a [video version](https://www.youtube.com/watch?v=vcwUpwpQ2sY) of the instructions. - -#### Command-line interface - -the enhancements should be automatically applied on installation -and automatically removed on uninstallation. - -on some platforms this may throw errors if done without -elevated/admin permissions, though, so if it hasn't automatically -installed you will still need to use these commands. - -``` -Usage: - $ notion-enhancer [options] - -Commands: - apply : add enhancements to the notion app - remove : return notion to its pre-enhanced/pre-modded state - check : check the current state of the notion app - -For more info, run any command with the `--help` flag: - $ notion-enhancer apply --help - $ notion-enhancer remove --help - $ notion-enhancer check --help - -Options: - -y, --yes : skip prompts (may overwrite data) - -n, --no : skip prompts (may cause failures) - -d, --dev : show detailed error messages (for debug purposes) - -h, --help : display usage information - -v, --version : display version number -``` - -## Frequently asked questions - -**when will the update be out?** -i code this in my free time, in-between my other commitments. there are no ETAs. - -**the themes aren't working?** -if you pick a dark theme it will only be applied if notion is in dark mode, -and if you pick a light theme it will only work if notion is in light mode. -do `CMD/CTRL+SHIFT+L` to toggle between them. - -**is this against notion's terms of service? can i get in trouble for using it?** -definitely not! i contacted their support team to check, and the response was awesome: - -> "Thanks for taking the time to share this with us. Userscripts and userstyles are definitely -> cool ideas and would be helpful for many users! ... I'll also share this with the rest of the -> team to take to heart for future improvements." - -**how do i uninstall the enhancer?** -run `npm remove -g notion-enhancer`. - -## Features - -most of the enhancer's functionality is split into configurable enhancement modules, -but some basic improvements necessary for things to work are built in by values: - -- the notion:// url scheme/protocol is patched to work on linux. -- a tray/menubar icon: links relevant to the enhancer + buttons to manage notion windows. - -once applied, modules can be configured via the graphical menu, -which is opened from the tray/menubar icon or with `OPTION/ALT+E`. - -![](https://user-images.githubusercontent.com/16874139/97819046-34e8b600-1cfa-11eb-8fa6-a3ad5374cd0b.png) - -currently all modules come pre-installed for technical reasons, security assurance, and ease-of-use. -these include: - -### notion-enhancer core - -**tags:** #core - -**description:** the cli, modloader, menu, & tray. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -| option | extended description | type | values/defaults | platform-specific details | -| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------- | ------------------------- | -| auto-resolve theme conflicts | when a theme is enabled any other themes of the same mode (light/dark) will be disabled. | toggle | no | | -| hide app on open | app can be made visible by clicking the tray icon or using the hotkey. | toggle | no | | -| auto-maximise windows | whenever a window is un-hidden or is created it will be maximised. | toggle | no | | -| close window to the tray | pressing the × close button will hide the app instead of quitting it. it can be re-shown by clicking the tray icon or using the hotkey. | toggle | yes | | -| integrated titlebar | replace the native titlebar with buttons inset into the app. | toggle | yes | macOS: forced on | -| tiling window manager mode | completely remove the close/minimise/maximise buttons - this is for a special type of window manager. if you don't understand it, don't use it. | toggle | no | macOS: forced off | -| window display hotkey | used to toggle hiding/showing all app windows. | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `CommandOrControl+Shift+A` | | -| open enhancements menu hotkey | used to toggle opening/closing this menu while notion is focused. | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `Alt+E` | | -| values/defaults page id/url | every new tab/window that isn't opening a url via the notion:// protocol will load this page. to get a page link from within the app, go to the triple-dot menu and click "copy link". leave blank to just load the last page you opened. | text input | `Alt+E` | | - -![](https://user-images.githubusercontent.com/16874139/97819249-7a59b300-1cfb-11eb-99fa-de945fe8e3d9.png) - -### tabs - -**tags:** #core #extension - -**description:** have multiple notion pages open in a single window. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -| option | type | values/defaults | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| tab select modifier (key+1, +2, +3, ... +9 and key+left/right arrows) | select | `Alt`, `Command`, `Control`, `Super`, `Alt+Shift`, `Command+Shift`, `Control+Shift`, `Super+Shift` | -| new tab keybinding | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `CommandOrControl+T` | -| close tab keybinding | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `CommandOrControl+W` | - -![](https://user-images.githubusercontent.com/16874139/97821456-9dd62b00-1d06-11eb-8c3a-e9f77bbd740e.png) - -### tweaks - -**tags:** #core #extension - -**description:** common style/layout changes. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -| option | extended description | type | values/defaults | platform-specific details | -| ---------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------ | --------------- | ------------------------- | -| height of frameless dragarea | the rectangle added at the top of a window in "integrated titlebar" mode, used to drag/move the window. | number input | 15 | macOS: forced to 0 | -| width to wrap columns at | the size in pixels below which in-page columns are resized to appear full width so content isn't squished. | number input | 600 | | -| integrated scrollbars | use scrollbars that fit better into notion's ui instead of the default chrome ones. | toggle | yes | | -| snappy transitions | | toggle | no | | -| thicker bold text | | toggle | yes | | -| more readable line spacing | | toggle | no | | -| hide help button | | toggle | no | | - -![](https://user-images.githubusercontent.com/16874139/97819829-1638ee00-1cff-11eb-80c6-f270c2ba0f37.png) - -### always on top - -**tags:** #extension - -**description:** add an arrow/button to show the notion window -on top of other windows even if it's not focused. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -![](https://user-images.githubusercontent.com/16874139/97820478-79784f80-1d02-11eb-9e32-caac4563d8f0.png) - -### bracketed links - -**tags:** #extension - -**description:** render links surrounded with \[\[brackets]] instead of underlined. - -**author:** [arecsu](https://github.com/arecsu/) - -![](https://user-images.githubusercontent.com/16874139/97820501-9f9def80-1d02-11eb-8ad8-b1ddf1ed9599.png) - -### bypass preview - -**tags:** #extension - -**description:** go straight to the normal full view when opening a page. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -### calendar scroll - -**tags:** #extension - -**description:** add a button to scroll down to the current week in fullpage/infinite-scroll calendars. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -![](https://user-images.githubusercontent.com/16874139/97820611-fe636900-1d02-11eb-8f78-0536103e25aa.png) - -### cherry cola - -**tags:** #theme #dark - -**description:** a delightfully plummy, cherry cola flavored theme. - -**author:** [runargs](https://github.com/runargs) - -![](https://user-images.githubusercontent.com/16874139/97819898-9fe8bb80-1cff-11eb-846f-1a66e0302ebd.png) - -### custom inserts - -**tags:** #extension - -**description:** link files for small client-side tweaks. (not sure how to do something? check out the -[tweaks](https://github.com/notion-enhancer/tweaks) collection.) - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -| option | type | -| --------------------- | ---- | -| css insert | file | -| client-side js insert | file | - -### dark+ - -**tags:** #theme #dark - -**description:** a vivid-colour near-black theme. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -| option | type | values/defaults | -| -------------- | ----- | ------------------ | -| primary colour | color | `rgb(177, 24, 24)` | - -![](https://user-images.githubusercontent.com/16874139/97820632-19ce7400-1d03-11eb-85a9-87f6d957dc96.png) - -### dracula - -**tags:** #theme #dark - -**description:** a theme based on the popular dracula color palette originally by zeno rocha and friends. - -**author:** [dracula](https://github.com/dracula/) - -![](https://user-images.githubusercontent.com/16874139/97820175-04f0e100-1d01-11eb-9ede-b6e033a28cbc.png) - -### emoji sets - -**tags:** #extension - -**description:** pick from a variety of emoji styles to use. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -| option | type | values/defaults | -| ------ | ------ | -------------------------------------------------------------------------------------------------------------------------- | -| style | select | twitter, apple, google, microsoft, samsung, whatsapp, facebook, messenger, joypixels, openmoji, emojidex, lg, htc, mozilla | - -![](https://user-images.githubusercontent.com/16874139/97820652-3f5b7d80-1d03-11eb-80a6-34089b946711.png) - -### focus mode - -**tags:** #extension - -**description:** hide the titlebar/menubar if the sidebar is closed (will be shown on hover). - -**author:** [arecsu](https://github.com/arecsu/) - -| option | extended description | type | values/defaults | -| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | --------------- | -| add padding to bottom of the page | will only take effect when the sidebar is hidden. aims to make the canvas as symmetrical/consistent as possible: if there is empty space on 3 sides, the 4th should follow. | toggle | on | - -![](https://user-images.githubusercontent.com/16874139/97820337-da535800-1d01-11eb-9df5-55567cba2cc4.png) - -### font chooser - -**tags:** #extension - -**description:** customize fonts. for each option, type in the name of -the font you would like to use, or leave it blank to not change anything. - -**author:** [torchatlas](https://github.com/torchatlas) - -| option | type | -| -------------------- | ---------- | -| sans-serif (inc. ui) | text input | -| serif | text input | -| monospace | text input | -| code | text input | - -![](https://user-images.githubusercontent.com/16874139/97820678-61ed9680-1d03-11eb-8f9f-54c1c5faf25e.png) - -### gameish - -**tags:** #theme #dark - -**description:** a purple, "gamer-styled" theme with a blocky-font. - -**author:** [LVL100ShrekCultist](https://reddit.com/user/LVL100ShrekCultist/) - -![](https://user-images.githubusercontent.com/16874139/97820696-75006680-1d03-11eb-8046-c3cb871ad34c.png) - -### littlepig dark - -**tags:** #theme #dark - -**description:** a purple monospaced theme using emojis and colourful text. - -**author:** [Lizishan](https://www.reddit.com/user/Lizishan/) - -![](https://user-images.githubusercontent.com/16874139/97820718-919c9e80-1d03-11eb-9749-e04faef82e2d.png) - -### littlepig light - -**tags:** #theme #light - -**description:** a bright monospaced theme using emojis and colourful text. - -**author:** [Lizishan](https://www.reddit.com/user/Lizishan/) - -![](https://user-images.githubusercontent.com/16874139/97820868-446cfc80-1d04-11eb-80ba-48cbedd62ed1.png) - -### material ocean - -**tags:** #theme #dark - -**description:** an oceanic colour palette. - -**author:** [blacksuan19](https://github.com/blacksuan19) - -![](https://user-images.githubusercontent.com/16874139/97820253-6d3fc280-1d01-11eb-86d1-9932b364bad8.png) - -### neutral - -**tags:** #theme #dark - -**description:** smoother colours and fonts, designed to be more pleasing to the eye. - -**author:** [arecsu](https://github.com/arecsu/) - -![](https://user-images.githubusercontent.com/16874139/97821029-fad0e180-1d04-11eb-9bad-2c76e9fa7613.png) - -### night shift - -**tags:** #extension #theme - -**description:** sync dark/light theme with the system (overrides normal theme setting). - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -### pastel dark - -**tags:** #theme #dark - -**description:** a true dark theme with a hint of pastel. - -**author:** [zenith_illinois](https://reddit.com/user/zenith_illinois/) - -![](https://user-images.githubusercontent.com/16874139/97820893-60709e00-1d04-11eb-8d52-55ab44000786.png) - -### property layout - -**tags:** #extension - -**description:** auto-collapse page properties that usually push down page content. - -**author:** [alexander-kazakov](https://github.com/alexander-kazakov/) - -![](https://user-images.githubusercontent.com/16874139/97820916-81d18a00-1d04-11eb-8e07-b7519590157a.png) - -### right-to-left - -**tags:** #extension - -**description:** enables auto rtl/ltr text direction detection. - -**author:** [obahareth](https://github.com/obahareth/) - -![](https://user-images.githubusercontent.com/16874139/97820953-a7f72a00-1d04-11eb-98c0-6ad83d097682.png) - -### scroll to top - -**tags:** #extension - -**description:** add an arrow above the help button to scroll back to the top of a page. - -**author:** [CloudHill](https://github.com/CloudHill/) - -| option | type | values/defaults | -| --------------------------------------- | ------------ | --------------- | -| smooth scrolling | toggle | on | -| distance scrolled until button is shown | number input | 50 | -| unit to measure distance with | select | percent, pixels | - -![](https://user-images.githubusercontent.com/16874139/97820445-4c2ba180-1d02-11eb-9d1a-911bca266f7f.png) - -### weekly view - -**tags:** #extension - -**description:** calendar views named "weekly" will show only the 7 days of this week. - -**author:** [adihd](https://github.com/adihd/) - -![](https://user-images.githubusercontent.com/16874139/97820985-bf361780-1d04-11eb-9e2a-786a7c37477d.png) - -### word counter - -**tags:** #extension - -**description:** add page details: word/character/sentence/block count & speaking/reading times. - -**author:** [dragonwocky](https://github.com/dragonwocky/) - -![](https://user-images.githubusercontent.com/16874139/97821003-d37a1480-1d04-11eb-8aaa-9e5dfea495eb.png) - -## contributors - -[@TarasokUA](https://github.com/TarasokUA/) wrote the first versions of this in python, in early 2020. -a couple months after I ([@dragonwocky](https://github.com/dragonwocky/)) picked the project up, at first extending -upon the original base and later moving to the javascript module system. - -the enhancer wouldn't be anything near to what it is now though without -interested community members testing, coding and ideating features - some are listed as -[contributors](https://github.com/notion-enhancer/notion-enhancer/graphs/contributors) here on github, -but many more have been helping out on discord and in emails. - -individual modules have their original authors attributed. +an enhancer/customiser for the all-in-one productivity workspace notion.so diff --git a/UPDATING.md b/UPDATING.md deleted file mode 100644 index 27c2d83..0000000 --- a/UPDATING.md +++ /dev/null @@ -1,55 +0,0 @@ -# updating - -the enhancer is still a young project, so it's growing quickly. this means a lot of stuff is changing internally -\- and, sometimes, externally. - -previously (<= v0.7.0), the enhancer was a python script with a couple of resource files, and if you -wanted to customise things you had to go in and edit those files. in v0.8.0 there has been a complete -rewrite and overhaul: now this is a program that makes use of a number of modules and a graphical menu. - -## installation dependencies - -previously, python and the node.js `asar` package both had to be manually installed. -node.js is the only current requirement of the enhancer. - -- python is no longer a dependency: keep it, get rid of it - up to you. -- the package installs asar itself in a more scoped environment: if you're confident with - the command line, you can remove the package with `npm remove -g asar`. otherwise, it - won't do any damage to just leave it. - -## keeping the files - -enhancement is done fully from the command prompt. -by default, there are no files for you to worry about. - -you can delete the folder the old version of the enhancer is kept in. -(though you may want to keep the `user.css` file: see below.) - -## user.css styling - -when you first load the enhancer, there's no single file you can edit to see instant changes. -instead, the "custom inserts" module is used: you can use it to pick any javascript or css file anywhere -on your computer and include it every time you load up notion. - -to make your own css file, make sure that your file manager has "show file extensions" ticked, then -create a text document and make sure the name ends in `.css` (e.g. `notion-tweaks.css`). or, just use -the old `user.css` from before the update. - -most of the same css snippets will work, but some (e.g. preview page width) have been moved to the new variable -system, plus new ones have been found. it's a good idea to check what you have against the [tweaks](https://github.com/notion-enhancer/tweaks) -page and the [css theming documentation](DOCUMENTATION.md#variable-theming). - -## configuration - -"what happened to the tray options?" - -"how can I set a custom window visibility toggle hotkey?" - -these options and more have been moved to the graphical menu, which can be opened from the -tray or with `ALT+E` (while the notion app is focused). - -## installing - -just follow the normal [installation steps](README.md#installation) (starting from step 2, you should -already have node.js installed). don't worry about running `cleaner.py`, the new version will detect and overwrite -the old for you. diff --git a/bin.js b/bin.js deleted file mode 100755 index 1242a91..0000000 --- a/bin.js +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env node - -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (https://dragonwocky.me/notion-enhancer) under the MIT license - */ - -'use strict'; - -const cli = require('cac')('notion-enhancer'), - { EnhancerError } = require('./pkg/helpers.js'); - -// === title === -// ...information -// * warning -// > prompt -// -- response -// ~~ exit -// ### error ### - -cli.option('-y, --yes', ': skip prompts (may overwrite data)'); -cli.option('-n, --no', ': skip prompts (may cause failures)'); -cli.option('-d, --dev', ': show detailed error messages (for debug purposes)'); - -cli - .command('apply', ': add the enhancer to the notion app') - .action(async (options) => { - console.info('=== NOTION ENHANCEMENT LOG ==='); - await require('./pkg/apply.js')({ - overwrite_version: options.yes ? 'y' : options.no ? 'n' : undefined, - friendly_errors: !options.dev, - }); - console.info('=== END OF LOG ==='); - }); -cli - .command('remove', ': return notion to its pre-enhanced/pre-modded state') - .action(async (options) => { - console.info('=== NOTION RESTORATION LOG ==='); - await require('./pkg/remove.js')({ - delete_data: options.yes ? 'y' : options.no ? 'n' : undefined, - friendly_errors: !options.dev, - }); - console.info('=== END OF LOG ==='); - }); -cli - .command('check', ': check the current state of the notion app') - .action(async (options) => { - try { - const status = await require('./pkg/check.js')(); - console.info(options.dev ? status : status.msg); - } catch (err) { - console.error( - err instanceof EnhancerError && !options.dev ? err.message : err - ); - } - }); - -let helpCalled = false; -cli.globalCommand.option('-h, --help', ': display usage information'); -cli.globalCommand.helpCallback = (sections) => { - sections[0].body += '\nhttps://github.com/notion-enhancer/notion-enhancer'; - helpCalled = true; -}; -cli.showHelpOnExit = true; - -cli.globalCommand.option('-v, --version', ': display version number'); -cli.globalCommand.versionNumber = require('./package.json').version; -cli.showVersionOnExit = true; - -cli.parse(); - -if (!cli.matchedCommand && !helpCalled && !cli.options.version) - cli.outputHelp(); diff --git a/mods/alwaysontop/mod.js b/mods/alwaysontop/mod.js deleted file mode 100644 index 69c5e3f..0000000 --- a/mods/alwaysontop/mod.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * always on top - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -// this is just a pseudo mod to "separate" the button -// from the core module - the core still handles actually -// making it work. -module.exports = { - id: '72886371-dada-49a7-9afc-9f275ecf29d3', - tags: ['extension'], - name: 'always on top', - desc: - "add an arrow/button to show the notion window on top of other windows even if it's not focused.", - version: '0.1.1', - author: 'dragonwocky', -}; diff --git a/mods/bracketed-links/app.css b/mods/bracketed-links/app.css deleted file mode 100644 index 0ecca69..0000000 --- a/mods/bracketed-links/app.css +++ /dev/null @@ -1,24 +0,0 @@ -/* - * bracketed links - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Arecsu - * 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/mods/bracketed-links/mod.js b/mods/bracketed-links/mod.js deleted file mode 100644 index 46cb072..0000000 --- a/mods/bracketed-links/mod.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * bracketed links - * (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.1.0', - author: 'arecsu', -}; diff --git a/mods/bypass-preview/app.css b/mods/bypass-preview/app.css deleted file mode 100644 index 176a1b9..0000000 --- a/mods/bypass-preview/app.css +++ /dev/null @@ -1,9 +0,0 @@ -/* - * bypass preview - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -.notion-peek-renderer { - display: none; -} diff --git a/mods/bypass-preview/mod.js b/mods/bypass-preview/mod.js deleted file mode 100644 index 2fe9f02..0000000 --- a/mods/bypass-preview/mod.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * bypass preview - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'cb6fd684-f113-4a7a-9423-8f0f0cff069f', - tags: ['extension'], - name: 'bypass preview', - desc: 'go straight to the normal full view when opening a page.', - version: '0.1.2', - author: 'dragonwocky', - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - let queue = []; - const observer = new MutationObserver((list, observer) => { - if (!queue.length) requestIdleCallback(() => handle(queue)); - queue.push(...list); - }); - observer.observe(document.body, { - childList: true, - subtree: true, - attributes: true, - }); - - let lastPageID; - function handle(list) { - queue = []; - const pageID = (location.search - .slice(1) - .split('&') - .map((opt) => opt.split('=')) - .find((opt) => opt[0] === 'p') || [ - '', - ...location.pathname.split(/(-|\/)/g).reverse(), - ])[1], - preview = document.querySelector( - '.notion-peek-renderer [style*="height: 45px;"] a' - ); - if (!pageID) return; - if (preview) { - if (pageID === lastPageID) { - history.back(); - } else preview.click(); - } else lastPageID = pageID; - } - }); - }, - }, -}; diff --git a/mods/calendar-scroll/app.css b/mods/calendar-scroll/app.css deleted file mode 100644 index 9f6dfd7..0000000 --- a/mods/calendar-scroll/app.css +++ /dev/null @@ -1,21 +0,0 @@ -/* - * calendar scroll - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -#calendar-scroll-to-week { - background: var(--theme--interactive_hover); - border: 1px solid transparent; - font-size: var(--theme--font_label-size); - color: var(--theme--text); - height: 24px; - border-radius: 3px; - line-height: 1.2; - padding: 0 0.5em; - margin-right: 5px; -} -#calendar-scroll-to-week:hover { - background: transparent; - border: 1px solid var(--theme--interactive_hover); -} diff --git a/mods/calendar-scroll/mod.js b/mods/calendar-scroll/mod.js deleted file mode 100644 index 4284076..0000000 --- a/mods/calendar-scroll/mod.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * calendar scroll - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: 'b1c7db33-dfee-489a-a76c-0dd66f7ed29a', - tags: ['extension'], - name: 'calendar scroll', - desc: - 'add a button to scroll down to the current week in fullpage/infinite-scroll calendars.', - version: '0.1.1', - author: 'dragonwocky', - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - const attempt_interval = setInterval(enhance, 500); - function enhance() { - const notion_elem = document.querySelector('.notion-frame'); - if (!notion_elem) return; - clearInterval(attempt_interval); - - const button = createElement( - '' - ); - button.addEventListener('click', (event) => { - const collection_view = document.querySelector( - '.notion-collection-view-select' - ); - if (!collection_view) return; - const day = [ - ...collection_view.parentElement.parentElement.parentElement.parentElement.getElementsByClassName( - 'notion-calendar-view-day' - ), - ].find((day) => day.style.background); - if (!day) return; - const scroller = document.querySelector( - '.notion-frame .notion-scroller' - ); - scroller.scroll({ - top: day.offsetParent.offsetParent.offsetTop + 70, - }); - setTimeout( - () => - scroller.scroll({ - top: day.offsetParent.offsetParent.offsetTop + 70, - }), - 100 - ); - }); - - handle(); - const observer = new MutationObserver(handle); - observer.observe(notion_elem, { - childList: true, - subtree: true, - }); - function handle(list, observer) { - if (document.querySelector('#calendar-scroll-to-week')) return; - const arrow = document.querySelector( - '.notion-selectable.notion-collection_view_page-block .chevronLeft' - ); - if (arrow) - arrow.parentElement.parentElement.insertBefore( - button, - arrow.parentElement - ); - } - } - }); - }, - }, -}; diff --git a/mods/cherrycola/app.css b/mods/cherrycola/app.css deleted file mode 100644 index 93af219..0000000 --- a/mods/cherrycola/app.css +++ /dev/null @@ -1,12 +0,0 @@ -/* - * cherry cola - * (c) 2020 Alexa Baldon (https://github.com/runargs) - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -/* quotations as serif */ -.notion-dark-theme .notion-quote-block { - font-family: Georgia, 'Times New Roman', Times, serif; - background-color: var(--cola-sec); -} diff --git a/mods/cherrycola/mod.js b/mods/cherrycola/mod.js deleted file mode 100644 index 33e4c34..0000000 --- a/mods/cherrycola/mod.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * cherry cola - * (c) 2020 Alexa Baldon (https://github.com/runargs) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'ec5c4640-68d4-4d25-aefd-62c7e9737cfb', - tags: ['theme', 'dark'], - name: 'cherry cola', - desc: 'a delightfully plummy, cherry cola flavored theme.', - version: '0.1.0', - author: 'runargs', -}; diff --git a/mods/cherrycola/variables.css b/mods/cherrycola/variables.css deleted file mode 100644 index 45add4e..0000000 --- a/mods/cherrycola/variables.css +++ /dev/null @@ -1,144 +0,0 @@ -/* - * cherry cola - * (c) 2020 Alexa Baldon (https://github.com/runargs) - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -:root { - --cola-main: #180915; - --cola-sec: #1d0919; - --cola-tet: #492341; - --cola-info: #9b6890; - --cola-accent: #bf799b; - --cola-gray: #8a8a8a; - --cola-brown: #755241; - --cola-orange: #e6846b; - --cola-yellow: #d7b56e; - --cola-green: #8f9b4f; - --cola-blue: #6ebdb7; - --cola-purple: #813d63; - --cola-pink: #d86f71; - --cola-red: #a33232; - - /* main */ - --theme_dark--main: var(--cola-main); - --theme_dark--sidebar: var(--cola-sec); - --theme_dark--overlay: rgba(29, 9, 25, 0.5); - --theme_dark--dragarea: #210a1c; - --theme_dark--box-shadow: rgba(20, 0, 16, 0.2) 0px 0px 0px 1px, - rgba(20, 0, 16, 0.2) 0px 2px 4px; - --theme_dark--box-shadow_strong: rgba(20, 0, 16, 0.1) 0px 0px 0px 1px, - rgba(20, 0, 16, 0.2) 0px 3px 6px, rgba(20, 0, 16, 0.4) 0px 9px 24px; - - /* scrollbar */ - --theme_dark--scrollbar: var(--cola-sec); - --theme_dark--scrollbar_hover: var(--cola-accent); - - /* database */ - --theme_dark--card: var(--cola-sec); - --theme_dark--gallery: var(--cola-sec); - --theme_dark--select_input: var(--cola-tet); - --theme_dark--table-border: var(--cola-tet); - --theme_dark--ui-border: rgba(73, 35, 65, 0.7); - --theme_dark--interactive_hover: var(--cola-tet); - --theme_dark--button_close: var(--cola-accent); - - /* select/hover/click */ - --theme_dark--selected: rgba(78, 32, 69, 0.5); - --theme_dark--primary: var(--cola-accent); - --theme_dark--primary_hover: var(--cola-accent); - --theme_dark--primary_click: var(--cola-sec); - --theme_dark--primary_indicator: var(--cola-accent); - - --theme_dark--option_active-background: var(--theme_dark--primary); - --theme_dark--option_hover-background: var(--theme_dark--primary_hover); - - /* danger */ - --theme_dark--danger_text: #eb5757; - --theme_dark--danger_border: rgba(235, 87, 87, 0.5); - - /* default text colors */ - --theme_dark--text: #ffffff; - --theme_dark--text_ui: var(--cola-info); - --theme_dark--text_ui_info: var(--cola-info); - - /* text color options */ - --theme_dark--text_gray: var(--cola-gray); - --theme_dark--text_brown: var(--cola-brown); - --theme_dark--text_orange: var(--cola-orange); - --theme_dark--text_yellow: var(--cola-yellow); - --theme_dark--text_green: var(--cola-green); - --theme_dark--text_blue: var(--cola-blue); - --theme_dark--text_purple: var(--cola-purple); - --theme_dark--text_pink: var(--cola-pink); - --theme_dark--text_red: var(--cola-red); - - --theme_dark--select-text: var(--cola-main); - --theme_dark--select_gray: var(--cola-gray); - --theme_dark--select_brown: var(--cola-brown); - --theme_dark--select_brown-text: #ffffff; - --theme_dark--select_orange: var(--cola-orange); - --theme_dark--select_yellow: var(--cola-yellow); - --theme_dark--select_green: var(--cola-green); - --theme_dark--select_blue: var(--cola-blue); - --theme_dark--select_purple: var(--cola-purple); - --theme_dark--select_purple-text: #ffffff; - --theme_dark--select_pink: var(--cola-pink); - --theme_dark--select_red: var(--cola-red); - --theme_dark--select_red-text: #ffffff; - - --theme_dark--line-text: var(--cola-main); - --theme_dark--line_gray: var(--cola-gray); - --theme_dark--line_brown: var(--cola-brown); - --theme_dark--line_orange: var(--cola-orange); - --theme_dark--line_yellow: var(--cola-yellow); - --theme_dark--line_green: var(--cola-green); - --theme_dark--line_blue: var(--cola-blue); - --theme_dark--line_purple: var(--cola-purple); - --theme_dark--line_pink: var(--cola-pink); - --theme_dark--line_red: var(--cola-red); - - --theme_dark--bg-text: var(--theme_dark--select-text); - --theme_dark--bg_gray: var(--theme_dark--select_gray); - --theme_dark--bg_brown: var(--theme_dark--select_brown); - --theme_dark--bg_orange: var(--theme_dark--select_orange); - --theme_dark--bg_yellow: var(--theme_dark--select_yellow); - --theme_dark--bg_green: var(--theme_dark--select_green); - --theme_dark--bg_blue: var(--theme_dark--select_blue); - --theme_dark--bg_purple: var(--theme_dark--select_purple); - --theme_dark--bg_pink: var(--theme_dark--select_pink); - --theme_dark--bg_red: var(--theme_dark--select_red); - - /* callout blocks */ - --theme_dark--callout-text: var(--theme_dark--line-text); - --theme_dark--callout_gray: var(--theme_dark--line_gray); - --theme_dark--callout_brown: var(--theme_dark--line_brown); - --theme_dark--callout_orange: var(--theme_dark--line_orange); - --theme_dark--callout_yellow: var(--theme_dark--line_yellow); - --theme_dark--callout_green: var(--theme_dark--line_green); - --theme_dark--callout_blue: var(--theme_dark--line_blue); - --theme_dark--callout_purple: var(--theme_dark--line_purple); - --theme_dark--callout_pink: var(--theme_dark--line_pink); - --theme_dark--callout_red: var(--theme_dark--line_red); - - /* incline/code text */ - --theme_dark--code_inline-text: var(--cola-accent); - --theme_dark--code_inline-background: var(--cola-main); - --theme_dark--code-text: var(--theme_dark--text); - --theme_dark--code-background: var(--cola-sec); - --theme_dark--code_function: var(--theme_dark--text_blue); - --theme_dark--code_keyword: var(--theme_dark--text_pink); - --theme_dark--code_tag: var(--theme_dark--text_pink); - --theme_dark--code_operator: var(--theme_dark--text_yellow); - --theme_dark--code_important: var(--theme_dark--text_yellow); - --theme_dark--code_property: var(--theme_dark--text_pink); - --theme_dark--code_builtin: var(--theme_dark--text_yellow); - --theme_dark--code_attr-name: var(--theme_dark--text_yellow); - --theme_dark--code_comment: var(--theme_dark--text_gray); - --theme_dark--code_punctuation: var(--theme_dark--text_gray); - --theme_dark--code_doctype: var(--theme_dark--text_gray); - --theme_dark--code_number: var(--theme_dark--text_purple); - --theme_dark--code_string: var(--theme_dark--text_orange); - --theme_dark--code_attr-value: var(--theme_dark--text_orange); -} \ No newline at end of file diff --git a/mods/code-line-numbers/app.css b/mods/code-line-numbers/app.css deleted file mode 100644 index 8d9eb8b..0000000 --- a/mods/code-line-numbers/app.css +++ /dev/null @@ -1,30 +0,0 @@ -/* - * code line numbers - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -.notion-code-block.line-numbers { - position: relative; -} - -.code-numbered { - padding-left: 48px !important; -} -#code-line-numbers { - font-size: var(--theme--font_code-size); - font-family: var(--theme--font_code); - color: var(--theme--text_ui_info); - background: var(--theme--code-background); - text-align: right; - position: absolute; - left: 0; - right: calc(100% - 48px); - padding-right: 18px; - overflow: hidden; - pointer-events: none; -} -#code-line-numbers:empty { - display: none; -} diff --git a/mods/code-line-numbers/mod.js b/mods/code-line-numbers/mod.js deleted file mode 100644 index 02d5e32..0000000 --- a/mods/code-line-numbers/mod.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * code line numbers - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: 'd61dc8a7-b195-465b-935f-53eea9efe74e', - tags: ['extension'], - name: 'code line numbers', - desc: 'adds line numbers to code blocks.', - version: '1.2.0', - author: 'CloudHill', - options: [ - { - key: 'single_lined', - label: 'show line numbers on single-lined code blocks', - type: 'toggle', - value: false, - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - let queue = []; - const observer = new MutationObserver((list, observer) => { - if (!queue.length) requestAnimationFrame(() => handle(queue)); - queue.push(...list); - }); - observer.observe(document.body, { - childList: true, - subtree: true, - }); - - const resizeObserver = new ResizeObserver( - (list, observer) => number(list[0].target) - ); - - function handle(list) { - queue = []; - for (let { addedNodes, target } of list) { - const block = target.querySelector('.line-numbers.notion-code-block') || - ( - addedNodes[0]?.classList?.contains('.notion-code-block') && - addedNodes[0].querySelector('.line-numbers.notion-code-block') - ); - - if (block) { - if (block.dataset.numbered) return; - number(block); - block.dataset.numbered = true; - resizeObserver.observe(block); - } - } - } - - function number(block) { - let codeLineNumbers = ''; - - let numbers = block.querySelector('#code-line-numbers'); - if (!numbers) { - numbers = createElement( - '' - ); - - // set size - const blockStyle = window.getComputedStyle(block.children[0]); - numbers.style.top = blockStyle.paddingTop; - numbers.style.bottom = blockStyle.paddingBottom; - - block.append(numbers); - - // get lineHeight - const temp = createElement('A'); - block.firstChild.append(temp); - block.lineHeight = temp.getBoundingClientRect().height; - temp.remove(); - } - - const lines = block.firstChild.innerText.split(/\r\n|\r|\n/); - if (lines[lines.length - 1] === '') lines.pop(); - let lineCounter = 0; - const wordWrap = block.firstChild.style.wordBreak === 'break-all'; - - for (let i = 0; i < lines.length; i++) { - lineCounter++; - codeLineNumbers += `${lineCounter}\n`; - - if (wordWrap) { - const temp = document.createElement('span'); - temp.innerText = lines[i]; - block.firstChild.append(temp); - const lineHeight = temp.getBoundingClientRect().height; - temp.remove(); - - for (let j = 1; j < (lineHeight / block.lineHeight - 1); j++) - codeLineNumbers += '\n'; - } - } - - if (store().single_lined || codeLineNumbers.length > 2) { - block.firstChild.classList.add('code-numbered'); - numbers.innerText = codeLineNumbers || 1; - } else { - block.firstChild.classList.remove('code-numbered'); - numbers.innerText = ''; - } - } - }); - }, - }, -}; diff --git a/mods/collapsible-headers/app.css b/mods/collapsible-headers/app.css deleted file mode 100644 index d96a25f..0000000 --- a/mods/collapsible-headers/app.css +++ /dev/null @@ -1,86 +0,0 @@ -/* - * collapsible headers - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - - .notion-page-content .notion-selectable[collapsed] { - max-height: 0px; - overflow: hidden; - opacity: 0; -} - -.notion-page-content .notion-selectable[collapsed] .notion-selectable { - pointer-events: none; -} - -.collapse-header { - flex-grow: 0; - flex-shrink: 0; - align-self: center; - width: 24px; - height: 24px; - padding: 6px; - margin: 0 6px; - border-radius: 3px; - display: flex; - align-items: center; - justify-content: center; - z-index: 1; - cursor: pointer; - transition: 200ms ease-in; -} -.collapse-header:hover { - background: var(--theme--interactive_hover); -} -/* position: left */ -.collapse-header:first-child { - margin-left: 2px; -} -/* position: right / inline */ -.collapse-header:last-child { - opacity: 0; -} - -/* show toggle on: collapsed, hover, focus */ -[data-collapsed="true"] .collapse-header:last-child, -[data-collapsed]:hover .collapse-header:last-child, -[data-collapsed] :focus + .collapse-header:last-child { - opacity: 1; -} - -.collapse-header svg { - width: 100%; - height: 100%; - transition: transform 200ms ease-out 0s; -} -/* position: left */ -.collapse-header:first-child svg { - transform: rotateZ(90deg); -} -/* position: right / inline */ -.collapse-header:last-child svg { - transform: rotateZ(270deg); -} - -[data-collapsed="false"] .collapse-header svg { - transform: rotateZ(180deg); -} - -/* position: inline */ -[inline-toggle] { - position: relative; - overflow: hidden; -} -[inline-toggle] [placeholder] { - width: auto !important; -} -[inline-toggle] [placeholder]::after { - content: ''; - position: absolute; - top: 0; - width: 100%; - height: 100%; - cursor: text; -} diff --git a/mods/collapsible-headers/mod.js b/mods/collapsible-headers/mod.js deleted file mode 100644 index f3d9588..0000000 --- a/mods/collapsible-headers/mod.js +++ /dev/null @@ -1,478 +0,0 @@ -/* - * collapsible headers - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: '548fe2d7-174a-44dd-88d8-35c7f9a093a7', - tags: ['extension'], - name: 'collapsible headers', - desc: 'adds toggles to collapse header sections.', - version: '1.0.1', - author: 'CloudHill', - options: [ - { - key: 'toggle', - label: 'toggle position', - type: 'select', - value: ['left', 'right', 'inline'], - }, - { - key: 'animate', - label: 'enable animation', - type: 'toggle', - value: true, - }, - { - key: 'divBreak', - label: 'use divider blocks to break header sections', - type: 'toggle', - value: false, - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - const attempt_interval = setInterval(enhance, 500); - function enhance() { - if (!document.querySelector('.notion-frame')) return; - clearInterval(attempt_interval); - - if (!store().collapsed_ids) store().collapsed_ids = []; - - window.addEventListener('hashchange', showSelectedHeader); - - // add toggles to headers whenever blocks are added/removed - const contentObserver = new MutationObserver((list, observer) => { - list.forEach(m => { - let node = m.addedNodes[0] || m.removedNodes[0]; - if ( - ( - node?.nodeType === Node.ELEMENT_NODE && - ( - node.className !== 'notion-selectable-halo' && - !node.style.cssText.includes('z-index: 88;') - ) - ) && - ( - m.target.className === 'notion-page-content' || - m.target.className.includes('notion-selectable') - ) - ) { - // if a collapsed header is removed - if ( - node.dataset?.collapsed === 'true' && - !node.nextElementSibling - ) showHeaderContent(node); - - initHeaderToggles(); - } - }) - }); - - // observe for page changes - let queue = []; - const pageObserver = new MutationObserver((list, observer) => { - if (!queue.length) requestAnimationFrame(() => process(queue)); - queue.push(...list); - }); - pageObserver.observe(document.body, { - childList: true, - subtree: true, - }); - function process(list) { - queue = []; - for (let { addedNodes } of list) { - if ( - addedNodes[0] && - addedNodes[0].className === 'notion-presence-container' - ) { - showSelectedHeader(); - initHeaderToggles(); - contentObserver.disconnect(); - contentObserver.observe( - document.querySelector('.notion-page-content'), - { - childList: true, - subtree: true, - } - ); - } - } - } - - // bind to ctrl + enter - document.addEventListener('keyup', e => { - const hotkey = { - key: 'Enter', - ctrlKey: true, - metaKey: false, - altKey: false, - shiftKey: false, - }; - for (let prop in hotkey) - if (hotkey[prop] !== e[prop]) return; - // toggle active/selected headers - const active = document.activeElement; - let toggle; - if ( - (toggle = active.nextElementSibling || active.previousElementSibling) && - toggle.className === 'collapse-header' - ) { - toggle.click(); - } else { - toggleHeaders( getSelectedHeaders() ); - } - }); - - function initHeaderToggles() { - const headerBlocks = document - .querySelectorAll('.notion-page-content [class*="header-block"]'); - - headerBlocks.forEach(header => { - const nextBlock = header.nextElementSibling; - - // if header is moved - if ( - header.dataset.collapsed && - header.collapsedBlocks && - header.collapsedBlocks[0] !== nextBlock - ) { - showHeaderContent(header); - } - - // if header has no content - if ( - !nextBlock || - getHeaderLevel(nextBlock) <= getHeaderLevel(header) || - ( - store().divBreak && - nextBlock.classList && - nextBlock.classList.contains('notion-divider-block') - ) - ) { - if (header.dataset.collapsed) { - delete header.dataset.collapsed; - const toggle = header.querySelector('.collapse-header'); - if (toggle) toggle.remove(); - } - return; - }; - - // if header already has a toggle - if (header.querySelector('.collapse-header')) return; - - // add toggle to headers - const toggle = createElement(` -
- - - -
- `) - - if (store().toggle === 'left') header.firstChild.prepend(toggle); - else header.firstChild.appendChild(toggle); - - if (store().toggle === 'inline') - header.firstChild.setAttribute('inline-toggle', ''); - - toggle.header = header; - toggle.addEventListener('click', toggleHeaderContent); - - // check store for header - header.dataset.collapsed = false; - if (store().collapsed_ids.includes(header.dataset.blockId)) - collapseHeaderContent(header, false); - }); - } - - function toggleHeaderContent(e) { - e.stopPropagation(); - const toggle = e.currentTarget; - const header = toggle.header; - - const selected = getSelectedHeaders(); - if (selected && selected.includes(header)) return toggleHeaders(selected); - - if (header.dataset.collapsed === 'true') showHeaderContent(header); - else collapseHeaderContent(header); - } - - function collapseHeaderContent(header, animate = true) { - if ( - !header.className.includes('header-block') || - header.dataset.collapsed === 'true' - ) return; - header.dataset.collapsed = true; - - // store collapsed headers - if (!store().collapsed_ids.includes(header.dataset.blockId)) { - store().collapsed_ids.push(header.dataset.blockId); - } - - const headerLevel = getHeaderLevel(header); - const toggle = header.querySelector('.collapse-header'); - - header.collapsedBlocks = getHeaderContent(header); - header.collapsedBlocks.forEach(block => { - // don't collapse already collapsed blocks - if (block.hasAttribute('collapsed')) { - if (+(block.getAttribute('collapsed')) < headerLevel) { - block.setAttribute('collapsed', headerLevel); - if (block.storeAttributes) block.storeAttributes.header = header; - } - return; - }; - - block.storeAttributes = { - marginTop: block.style.marginTop, - marginBottom: block.style.marginBottom, - header: header, - } - block.style.marginTop = 0; - block.style.marginBottom = 0; - - if (!store().animate) { - block.setAttribute('collapsed', headerLevel); - toggleInnerBlocks(block, true); - } else { - const height = block.offsetHeight; - block.storeAttributes.height = height + 'px'; - block.setAttribute('collapsed', headerLevel); - - if (!animate) toggleInnerBlocks(block, true); - else { - if (toggle) toggle.removeEventListener('click', toggleHeaderContent); - block.animate( - [ - { - maxHeight: height + 'px', - opacity: 1, - marginTop: block.storeAttributes.marginTop, - marginBottom: block.storeAttributes.marginBottom, - }, - { - maxHeight: (height - 100 > 0 ? height - 100 : 0) + 'px', - opacity: 0, marginTop: 0, marginBottom: 0, - }, - { - maxHeight: 0, opacity: 0, marginTop: 0, marginBottom: 0, - } - ], - { - duration: 300, - easing: 'ease-out' - } - ).onfinish = () => { - if (toggle) toggle.addEventListener('click', toggleHeaderContent); - toggleInnerBlocks(block, true); - }; - } - } - }); - } - - function showHeaderContent(header, animate = true) { - if ( - !header.className.includes('header-block') || - header.dataset.collapsed === 'false' - ) return; - header.dataset.collapsed = false; - - // remove header from store - const collapsed_ids = store().collapsed_ids; - if (collapsed_ids.includes(header.dataset.blockId)) { - store().collapsed_ids = collapsed_ids.filter(id => id !== header.dataset.blockId); - } - - if (!header.collapsedBlocks) return; - const toggle = header.querySelector('.collapse-header'); - - showBlockHeader(header); - - header.collapsedBlocks.forEach(block => { - // don't toggle blocks collapsed under other headers - if ( - +(block.getAttribute('collapsed')) > getHeaderLevel(header) || - !block.storeAttributes - ) return; - - block.style.marginTop = block.storeAttributes.marginTop; - block.style.marginBottom = block.storeAttributes.marginBottom; - - if (!store().animate) { - block.removeAttribute('collapsed'); - toggleInnerBlocks(block, false); - - } else if (block.storeAttributes) { - toggleInnerBlocks(block, false); - - if (!animate) block.removeAttribute('collapsed'); - else { - const height = parseInt(block.storeAttributes.height); - if (toggle) toggle.removeEventListener('click', toggleHeaderContent); - block.animate( - [ - { - maxHeight: 0, opacity: 0, marginTop: 0, marginBottom: 0, - }, - { - maxHeight: (height - 100 > 0 ? height - 100 : 0) + 'px', - opacity: 1, - marginTop: block.storeAttributes.marginTop, - marginBottom: block.storeAttributes.marginBottom, - }, - { - maxHeight: height + 'px', - opacity: 1, - marginTop: block.storeAttributes.marginTop, - marginBottom: block.storeAttributes.marginBottom, - } - ], - { - duration: 300, - easing: 'ease-out' - } - ).onfinish = () => { - if (toggle) toggle.addEventListener('click', toggleHeaderContent); - block.removeAttribute('collapsed'); - }; - } - } - delete block.storeAttributes; - }); - delete header.collapsedBlocks; - } - - // query for headers marked with the selection halo - function getSelectedHeaders() { - const selectedHeaders = Array.from( - document.querySelectorAll('[class*="header-block"] .notion-selectable-halo') - ).map(halo => halo.parentElement); - - if (selectedHeaders.length > 0) return selectedHeaders; - return null; - } - - // toggle an array of headers - function toggleHeaders(headers) { - if (!headers) return; - headers = headers - .filter(h => - !( h.hasAttribute('collapsed') && h.dataset.collapsed === 'false' ) - ); - - if (headers && headers.length > 0) { - const collapsed = headers - .filter(h => h.dataset.collapsed === 'true').length; - headers.forEach(h => { - if (collapsed >= headers.length) showHeaderContent(h); - else collapseHeaderContent(h); - }); - } - } - - // get subsequent blocks - function getHeaderContent(header) { - let blockList = []; - let nextBlock = header.nextElementSibling; - while (nextBlock) { - if ( - getHeaderLevel(nextBlock) <= getHeaderLevel(header) || - ( - store().divBreak && - nextBlock.classList && - nextBlock.classList.contains('notion-divider-block') - ) - ) break; - blockList.push(nextBlock); - nextBlock = nextBlock.nextElementSibling; - } - return blockList; - } - - // toggles a header from one of its collapsed blocks - function showBlockHeader(block) { - if ( - block?.hasAttribute('collapsed') && - block.storeAttributes?.header - ) { - showHeaderContent(block.storeAttributes.header); - return true; - } - return false; - } - - function getHeaderLevel(header) { - if (!header.className || !header.className.includes('header-block')) return 9; - const subCount = header.classList[1].match(/sub/gi) || ''; - let headerLevel = 1 + subCount.length; - return headerLevel; - } - - // ensures that any columns and indented blocks are also hidden - // true => collapse, false => show - function toggleInnerBlocks(block, collapse) { - const header = block.storeAttributes?.header; - Array.from( - block.querySelectorAll('.notion-selectable') - ).forEach(b => { - if (!b.getAttribute('collapsed')) { - if (collapse) { - if (!b.storeAttributes) { - b.storeAttributes = { - height: b.offsetHeight, - marginTop: b.style.marginTop, - marginBottom: b.style.marginBottom, - header: header, - }; - } - b.setAttribute('collapsed', '') - } - else { - b.removeAttribute('collapsed'); - delete b.storeAttributes; - } - } - }); - } - - function showSelectedHeader() { - setTimeout(() => { - const halo = document.querySelector('.notion-selectable-halo'); - const header = halo?.parentElement; - - if (!header?.className?.includes('header-block')) return; - - // clear hash so that the same header can be toggled again - location.hash = ''; - - if (showBlockHeader(header)) { - setTimeout( - () => { - // is header in view? - var rect = header.getBoundingClientRect(); - if ( - (rect.top >= 0) && - (rect.bottom <= window.innerHeight) - ) return; - // if not, scroll to header - header.scrollIntoView({ behavior: 'smooth' }); - }, 400 - ) - } - }, 0) - } - } - }); - }, - }, -}; diff --git a/mods/core/app.css b/mods/core/app.css deleted file mode 100644 index 06ffc57..0000000 --- a/mods/core/app.css +++ /dev/null @@ -1,9 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -@import './css/theme.css'; -@import './css/scrollbars.css'; -@import './css/titlebar.css'; diff --git a/mods/core/buttons.js b/mods/core/buttons.js deleted file mode 100644 index d132722..0000000 --- a/mods/core/buttons.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -module.exports = (store) => { - const helpers = require('../../pkg/helpers.js'), - path = require('path'), - fs = require('fs-extra'), - browser = require('electron').remote.getCurrentWindow(), - is_mac = process.platform === 'darwin', - buttons = { - element: helpers.createElement('
'), - insert: [ - ...((store('mods')['72886371-dada-49a7-9afc-9f275ecf29d3'] || {}) - .enabled - ? ['alwaysontop'] - : []), - ...(store().frameless && !store().tiling_mode && !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(); - }, - }, - }; - - if (!buttons.insert.includes('alwaysontop')) browser.setAlwaysOnTop(false); - - (async () => { - for (let btn of buttons.insert) { - buttons.element.innerHTML += ``; - } - for (let btn of buttons.insert) { - buttons.element.querySelector(`.window-button.btn-${btn}`).onclick = - buttons.actions[btn]; - } - if (store().frameless && !store().tiling_mode && !is_mac) { - window.addEventListener('resize', (event) => { - Promise.resolve(buttons.icons.maximize()).then((icon) => { - icon = icon.toString(); - const el = buttons.element.querySelector('.btn-maximize'); - if (el.innerHTML != icon) el.innerHTML = icon; - }); - }); - } - })(); - - return buttons; -}; diff --git a/mods/core/client.js b/mods/core/client.js deleted file mode 100644 index a6eddd0..0000000 --- a/mods/core/client.js +++ /dev/null @@ -1,269 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 TarasokUA - * under the MIT license - */ - -'use strict'; - -module.exports = (store, __exports) => { - const electron = require('electron'), - helpers = require('../../pkg/helpers.js'), - notionIpc = require(`${helpers - .getNotionResources() - .replace(/\\/g, '/')}/app/helpers/notionIpc.js`), - { toKeyEvent } = require('keyboardevent-from-electron-accelerator'), - tabsEnabled = (store('mods')['e1692c29-475e-437b-b7ff-3eee872e1a42'] || {}) - .enabled; - - document.defaultView.addEventListener('keyup', (event) => { - // additional hotkeys - if (event.key === 'F5') location.reload(); - // open menu on hotkey toggle - if (store().menu_toggle) { - const hotkey = { - ctrlKey: false, - metaKey: false, - altKey: false, - shiftKey: false, - ...toKeyEvent(store().menu_toggle), - }; - let triggered = true; - for (let prop in hotkey) - if ( - hotkey[prop] !== event[prop] && - !(prop === 'key' && event[prop] === 'Dead') - ) - triggered = false; - if (triggered) electron.ipcRenderer.send('enhancer:open-menu'); - } - if (tabsEnabled) { - const tabStore = () => store('e1692c29-475e-437b-b7ff-3eee872e1a42'); - if (tabStore().select_modifier) { - // switch between tabs via key modifier - const select_tab_modifier = { - ctrlKey: false, - metaKey: false, - altKey: false, - shiftKey: false, - ...toKeyEvent(tabStore().select_modifier), - }; - let triggered = true; - for (let prop in select_tab_modifier) - if (select_tab_modifier[prop] !== event[prop]) triggered = false; - if ( - triggered && - [ - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'ArrowRight', - 'ArrowLeft', - ].includes(event.key) - ) - electron.ipcRenderer.sendToHost('enhancer:select-tab', event.key); - } - if (tabStore().new_tab) { - // create/close tab keybindings - const new_tab_keybinding = { - ctrlKey: false, - metaKey: false, - altKey: false, - shiftKey: false, - ...toKeyEvent(tabStore().new_tab), - }; - let triggered = true; - for (let prop in new_tab_keybinding) - if (new_tab_keybinding[prop] !== event[prop]) triggered = false; - if (triggered) electron.ipcRenderer.sendToHost('enhancer:new-tab'); - } - if (tabStore().close_tab) { - const close_tab_keybinding = { - ctrlKey: false, - metaKey: false, - altKey: false, - shiftKey: false, - ...toKeyEvent(tabStore().close_tab), - }; - let triggered = true; - for (let prop in close_tab_keybinding) - if (close_tab_keybinding[prop] !== event[prop]) triggered = false; - if (triggered) electron.ipcRenderer.sendToHost('enhancer:close-tab'); - } - } - }); - - const attempt_interval = setInterval(enhance, 500); - async function enhance() { - if ( - !document.querySelector('.notion-frame') || - !document.querySelector('.notion-sidebar') || - !document.querySelector('.notion-topbar') - ) - return; - clearInterval(attempt_interval); - - // frameless - if (store().frameless && !store().tiling_mode && !tabsEnabled) { - document.body.classList.add('frameless'); - // draggable area - document - .querySelector('.notion-topbar') - .prepend(helpers.createElement('
')); - } - - // window buttons - if (!tabsEnabled) { - 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'); - - const getStyle = (prop) => - getComputedStyle( - document.querySelector('.notion-app-inner') - ).getPropertyValue(prop); - - // external theming - document.defaultView.addEventListener('keydown', (event) => { - if ((event.ctrlKey || event.metaKey) && event.key === 'f') { - notionIpc.sendNotionToIndex('search:set-theme', { - 'mode': document.querySelector('.notion-dark-theme') - ? 'dark' - : 'light', - 'colors': { - 'white': getStyle('--theme--option_active-color'), - 'blue': getStyle('--theme--option_active-background'), - }, - 'borderRadius': 3, - 'textColor': getStyle('--theme--text'), - 'popoverBackgroundColor': getStyle('--theme--card'), - 'popoverBoxShadow': getStyle('--theme--box-shadow_strong'), - 'inputBoxShadow': `box-shadow: ${getStyle( - `--theme--primary` - )} 0px 0px 0px 1px inset, ${getStyle( - `--theme--primary_hover` - )} 0px 0px 0px 2px !important`, - 'inputBackgroundColor': getStyle('--theme--main'), - 'dividerColor': getStyle('--theme--table-border'), - 'shadowOpacity': 0.2, - }); - } - }); - - function setAppTheme() { - const theme = document.querySelector('.notion-dark-theme') - ? 'dark' - : 'light'; - electron.ipcRenderer.send('enhancer:set-app-theme', theme); - } - setAppTheme(); - new MutationObserver(setAppTheme).observe( - document.querySelector('.notion-app-inner'), - { attributes: true } - ); - electron.ipcRenderer.on('enhancer:get-app-theme', setAppTheme); - - if (tabsEnabled) { - let tab_title = { img: '', emoji: '', text: '' }; - if (process.platform === 'darwin') - document - .querySelector('.notion-sidebar [style*="37px"]:empty') - .remove(); - const TITLE_OBSERVER = new MutationObserver(() => - __electronApi.setWindowTitle('notion.so') - ); - __electronApi.setWindowTitle = (title) => { - const $container = - document.querySelector( - '.notion-peek-renderer [style="padding-left: calc(126px + env(safe-area-inset-left)); padding-right: calc(126px + env(safe-area-inset-right)); max-width: 100%; width: 100%;"]' - ) || - document.querySelector( - '.notion-frame [style="padding-left: calc(96px + env(safe-area-inset-left)); padding-right: calc(96px + env(safe-area-inset-right)); max-width: 100%; margin-bottom: 8px; width: 100%;"]' - ) || - document.querySelector('.notion-peek-renderer') || - document.querySelector('.notion-frame'), - icon = $container.querySelector( - '.notion-record-icon img:not([src^="data:"])' - ), - img = - icon && icon.getAttribute('src') - ? `` - : '', - emoji = icon ? icon.getAttribute('aria-label') : ''; - let text = $container.querySelector('[placeholder="Untitled"]'); - text = text - ? text.innerText || 'Untitled' - : [ - setTimeout(() => __electronApi.setWindowTitle(title), 250), - title, - ][1]; - TITLE_OBSERVER.disconnect(); - TITLE_OBSERVER.observe($container, { - childList: true, - subtree: true, - characterData: true, - attributes: true, - }); - if ( - tab_title.img !== img || - tab_title.emoji !== emoji || - tab_title.text !== text - ) { - tab_title = { - img, - emoji, - text, - }; - electron.ipcRenderer.sendToHost('enhancer:set-tab-title', tab_title); - } - }; - __electronApi.openInNewWindow = (urlPath) => { - electron.ipcRenderer.sendToHost( - 'enhancer:new-tab', - `notion://www.notion.so${urlPath}` - ); - }; - } else if (store().frameless && !store().tiling_mode) { - let sidebar_width; - function setSidebarWidth(list) { - const new_sidebar_width = - list[0].target.style.height === 'auto' - ? '0px' - : list[0].target.style.width; - if (new_sidebar_width !== sidebar_width) { - sidebar_width = new_sidebar_width; - electron.ipcRenderer.sendToHost( - 'enhancer:sidebar-width', - sidebar_width - ); - } - } - new MutationObserver(setSidebarWidth).observe( - document.querySelector('.notion-sidebar'), - { attributes: true } - ); - setSidebarWidth([{ target: document.querySelector('.notion-sidebar') }]); - } - } -}; diff --git a/mods/core/colorjoe/min.js b/mods/core/colorjoe/min.js deleted file mode 100644 index 0d60153..0000000 --- a/mods/core/colorjoe/min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! colorjoe - v4.1.1 - Juho Vepsalainen - MIT -https://bebraw.github.com/colorjoe - 2020-01-27 */ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.colorjoe=n()}(this,function(){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(e,n){return e(n={exports:{}},n.exports),n.exports}var p=e(function(e,n){e.exports=function(){function r(e,n){e?(t(e,n,"touchstart","touchmove","touchend"),t(e,n,"mousedown","mousemove","mouseup")):console.warn("drag is missing elem!")}return r.xyslider=function(e){var n=i(e.class||"",e.parent),t=i("pointer",n);return i("shape shape1",t),i("shape shape2",t),i("bg bg1",n),i("bg bg2",n),r(n,a(e.cbs,t)),{background:n,pointer:t}},r.slider=function(e){var n=i(e.class,e.parent),t=i("pointer",n);return i("shape",t),i("bg",n),r(n,a(e.cbs,t)),{background:n,pointer:t}},r;function a(e,t){var n={};for(var r in e)n[r]=a(e[r]);function a(n){return function(e){e.pointer=t,n(e)}}return n}function i(e,n){return t="div",r=e,a=n,i=document.createElement(t),r&&(i.className=r),a.appendChild(i),i;var t,r,a,i}function t(r,e,n,a,i){var t,o,u,s=(e=(t=e)?{begin:t.begin||p,change:t.change||p,end:t.end||p}:{begin:function(e){o={x:e.elem.offsetLeft,y:e.elem.offsetTop},u=e.cursor},change:function(e){d(e.elem,"left",o.x+e.cursor.x-u.x+"px"),d(e.elem,"top",o.y+e.cursor.y-u.y+"px")},end:p}).begin,l=e.change,f=e.end;c(r,n,function(n){var t=function(e){var n=Array.prototype.slice,t=n.apply(arguments,[1]);return function(){return e.apply(null,t.concat(n.apply(arguments)))}}(g,l,r);c(document,a,t),c(document,i,function e(){h(document,a,t),h(document,i,e),g(f,r,n)}),g(s,r,n)})}function c(e,n,t){var r=!1;try{var a=Object.defineProperty({},"passive",{get:function(){r=!0}});window.addEventListener("testPassive",null,a),window.removeEventListener("testPassive",null,a)}catch(e){}e.addEventListener(n,t,!!r&&{passive:!1})}function h(e,n,t){e.removeEventListener(n,t,!1)}function d(e,n,t){e.style[n]=t}function p(){}function g(e,n,t){t.preventDefault();var r,a,i,o={x:(r=n.getBoundingClientRect()).left,y:r.top},u=n.clientWidth,s=n.clientHeight,l={x:(i=t,(i.touches?i.touches[i.touches.length-1]:i).clientX),y:(a=t,(a.touches?a.touches[a.touches.length-1]:a).clientY)},f=(l.x-o.x)/u,c=(l.y-o.y)/s;e({x:isNaN(f)?0:f,y:isNaN(c)?0:c,cursor:l,elem:n,e:t})}}()}),a=e(function(e,n){e.exports=function(){function c(e){if(Array.isArray(e)){if("string"==typeof e[0]&&"function"==typeof c[e[0]])return new c[e[0]](e.slice(1,e.length));if(4===e.length)return new c.RGB(e[0]/255,e[1]/255,e[2]/255,e[3]/255)}else if("string"==typeof e){var n=e.toLowerCase();c.namedColors[n]&&(e="#"+c.namedColors[n]),"transparent"===n&&(e="rgba(0,0,0,0)");var t=e.match(p);if(t){var r=t[1].toUpperCase(),a=h(t[8])?t[8]:parseFloat(t[8]),i="H"===r[0],o=t[3]?100:i?360:255,u=t[5]||i?100:255,s=t[7]||i?100:255;if(h(c[r]))throw new Error("color."+r+" is not installed.");return new c[r](parseFloat(t[2])/o,parseFloat(t[4])/u,parseFloat(t[6])/s,a)}e.length<6&&(e=e.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var l=e.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(l)return new c.RGB(parseInt(l[1],16)/255,parseInt(l[2],16)/255,parseInt(l[3],16)/255);if(c.CMYK){var f=e.match(new RegExp("^cmyk\\("+d.source+","+d.source+","+d.source+","+d.source+"\\)$","i"));if(f)return new c.CMYK(parseFloat(f[1])/100,parseFloat(f[2])/100,parseFloat(f[3])/100,parseFloat(f[4])/100)}}else if("object"==typeof e&&e.isColor)return e;return!1}var u=[],h=function(e){return void 0===e},e=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,d=/\s*(\.\d+|100|\d?\d(?:\.\d+)?)%\s*/,p=new RegExp("^(rgb|hsl|hsv)a?\\("+e.source+","+e.source+","+e.source+"(?:,"+/\s*(\.\d+|\d+(?:\.\d+)?)\s*/.source+")?\\)$","i");c.namedColors={},c.installColorSpace=function(a,i,e){function n(e,r){var n={};for(var t in n[r.toLowerCase()]=function(){return this.rgb()[r.toLowerCase()]()},c[r].propertyNames.forEach(function(t){var e="black"===t?"k":t.charAt(0);n[t]=n[e]=function(e,n){return this[r.toLowerCase()]()[t](e,n)}}),n)n.hasOwnProperty(t)&&void 0===c[e].prototype[t]&&(c[e].prototype[t]=n[t])}(c[a]=function(e){var r=Array.isArray(e)?e:arguments;i.forEach(function(e,n){var t=r[n];if("alpha"===e)this._alpha=isNaN(t)||1n)return!1;return!0},r.toJSON=function(){return[a].concat(i.map(function(e){return this["_"+e]},this))},e)if(e.hasOwnProperty(t)){var o=t.match(/^from(.*)$/);o?c[o[1].toUpperCase()].prototype[a.toLowerCase()]=e[t]:r[t]=e[t]}return r[a.toLowerCase()]=function(){return this},r.toString=function(){return"["+a+" "+i.map(function(e){return this["_"+e]},this).join(", ")+"]"},i.forEach(function(t){var e="black"===t?"k":t.charAt(0);r[t]=r[e]=function(n,e){return void 0===n?this["_"+t]:e?new this.constructor(i.map(function(e){return this["_"+e]+(t===e?n:0)},this)):new this.constructor(i.map(function(e){return t===e?n:this["_"+e]},this))}}),u.forEach(function(e){n(a,e),n(e,a)}),u.push(a),c},c.pluginList=[],c.use=function(e){return-1===c.pluginList.indexOf(e)&&(this.pluginList.push(e),e(c)),c},c.installMethod=function(n,t){return u.forEach(function(e){c[e].prototype[n]=t}),this},c.installColorSpace("RGB",["red","green","blue","alpha"],{hex:function(){var e=(65536*Math.round(255*this._red)+256*Math.round(255*this._green)+Math.round(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-e.length)+e},hexa:function(){var e=Math.round(255*this._alpha).toString(16);return"#"+"00".substr(0,2-e.length)+e+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 n=function(a){a.installColorSpace("XYZ",["x","y","z","alpha"],{fromRgb:function(){var e=function(e){return.04045t[e]?r[e]=(n[e]-t[e])/(1-t[e]):n[e]>t[e]?r[e]=(t[e]-n[e])/t[e]:r[e]=0}),r._red>r._green?r._red>r._blue?n._alpha=r._red:n._alpha=r._blue:r._green>r._blue?n._alpha=r._green:n._alpha=r._blue,n._alpha<1e-10||(a.forEach(function(e){n[e]=(n[e]-t[e])/n._alpha+t[e]}),n._alpha*=r._alpha),n})})}()}),g=n(b,"div");function b(e,n,t){var r=document.createElement(e);return r.className=n,t.appendChild(r),r}function n(e){var n=Array.prototype.slice,t=n.apply(arguments,[1]);return function(){return e.apply(null,t.concat(n.apply(arguments)))}}function t(e,n,t){return Math.min(Math.max(e,n),t)}var v={clamp:t,e:b,div:g,partial:n,labelInput:function(e,n,t,r){var a="colorPickerInput"+Math.floor(1001*Math.random()),i=g(e,t);return{label:(c=n,h=i,d=a,p=b("label","",h),p.innerHTML=c,d&&p.setAttribute("for",d),p),input:(o="text",u=i,s=r,l=a,f=b("input","",u),f.type=o,s&&(f.maxLength=s),l&&f.setAttribute("id",l),s&&(f.maxLength=s),f)};var o,u,s,l,f;var c,h,d,p},X:function(e,n){e.style.left=t(100*n,0,100)+"%"},Y:function(e,n){e.style.top=t(100*n,0,100)+"%"},BG:function(e,n){e.style.background=n}};var r={currentColor:function(e){var n=v.div("currentColorContainer",e),t=v.div("currentColor",n);return{change:function(e){v.BG(t,e.cssa())}}},fields:function(e,t,n){var r=n.space,a=n.limit||255,i=0<=n.fix?n.fix:0,o=(""+a).length+i;o=i?o+1:o;var u=r.split(""),s="A"==r[r.length-1];if(r=s?r.slice(0,-1):r,["RGB","HSL","HSV","CMYK"].indexOf(r)<0)return console.warn("Invalid field names",r);var l=v.div("colorFields",e),f=u.map(function(e){e=e.toLowerCase();var n=v.labelInput("color "+e,e,l,o);return n.input.onblur=c,n.input.onkeydown=h,n.input.onkeyup=d,{name:e,e:n}});function c(){t.done()}function h(e){e.ctrlKey||e.altKey||!/^[a-zA-Z]$/.test(e.key)||e.preventDefault()}function d(){var n=[r];f.forEach(function(e){n.push(e.e.input.value/a)}),s||n.push(t.getAlpha()),t.set(n)}return{change:function(n){f.forEach(function(e){e.e.input.value=(n[e.name]()*a).toFixed(i)})}}},hex:function(e,r,n){var t=v.labelInput("hex",n.label||"",e,7);return t.input.value="#",t.input.onkeyup=function(e){var n=e.keyCode||e.which,t=e.target.value;t=function(e,n,t){for(var r=e,a=e.length;a (https://dragonwocky.me/) - * (c) 2020 TarasokUA - * under the MIT license - */ - -'use strict'; - -module.exports = (store, __exports) => { - const electron = require('electron'), - is_mac = process.platform === 'darwin', - allWindows = () => - electron.BrowserWindow.getAllWindows().filter( - (win) => win.getTitle() !== 'notion-enhancer menu' - ), - // createWindow = __exports.createWindow, - path = require('path'), - helpers = require('../../pkg/helpers.js'); - - __exports.createWindow = function (relativeUrl, focused_window, force = false) { - if (!relativeUrl) relativeUrl = ''; - const window_state = require(`${helpers - .getNotionResources() - .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 = - 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 windows = electron.BrowserWindow.getAllWindows(); - if (is_mac && !force && windows.length) { - return; - } - - let window = new electron.BrowserWindow({ - show: false, - backgroundColor: '#ffffff', - titleBarStyle: 'hiddenInset', - frame: !store().frameless, - webPreferences: { - preload: path.resolve( - `${helpers.getNotionResources()}/app/renderer/index.js` - ), - webviewTag: true, - session: electron.session.fromPartition('persist:notion'), - enableRemoteModule: true, - }, - ...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); - } - }); - 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; - }; - return __exports.createWindow; -}; diff --git a/mods/core/css/buttons.css b/mods/core/css/buttons.css deleted file mode 100644 index 70b8465..0000000 --- a/mods/core/css/buttons.css +++ /dev/null @@ -1,43 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 TarasokUA - * 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; -} - -.window-button:hover { - background: var(--theme--interactive_hover); - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border); -} -.window-button.btn-close:hover { - background: var(--theme--button_close); - color: var(--theme--button_close-fill); -} diff --git a/mods/core/css/scrollbars.css b/mods/core/css/scrollbars.css deleted file mode 100644 index a837c92..0000000 --- a/mods/core/css/scrollbars.css +++ /dev/null @@ -1,29 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 TarasokUA - * under the MIT license - */ - -[data-tweaks*='[smooth_scrollbars]'] .notion-scroller { - cursor: auto; -} -[data-tweaks*='[smooth_scrollbars]'] ::-webkit-scrollbar { - width: 8px; /* vertical */ - height: 8px; /* horizontal */ - -webkit-app-region: no-drag; -} -[data-tweaks*='[smooth_scrollbars]'] ::-webkit-scrollbar-corner { - background-color: transparent; /* overlap */ -} -[data-tweaks*='[smooth_scrollbars]'] ::-webkit-scrollbar-thumb { - border-radius: 5px; -} - -[data-tweaks*='[smooth_scrollbars]'] ::-webkit-scrollbar-thumb { - background-color: var(--theme--scrollbar); - border: 1px solid var(--theme--scrollbar-border); -} -[data-tweaks*='[smooth_scrollbars]'] ::-webkit-scrollbar-thumb:hover { - background: var(--theme--scrollbar_hover); -} diff --git a/mods/core/css/theme.css b/mods/core/css/theme.css deleted file mode 100644 index 8bbf38b..0000000 --- a/mods/core/css/theme.css +++ /dev/null @@ -1,1123 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 TarasokUA - * (c) 2020 Arecsu - * (c) 2020 u/zenith_illinois - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -/** app **/ - -.notion-body, -.notion-body.dark [style*='background: rgb(47, 52, 55)'], -.notion-body.dark [style*='background-color: rgb(47, 52, 55)'], -.notion-body:not(.dark) - .notion-light-theme - [style*='background: white']:not(.notion-help-button), -.notion-body:not(.dark) - .notion-dark-theme - [style*='background: white']:not(.notion-help-button):not([style*='box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;']), -.notion-body:not(.dark) [style*='background-color: white'] { - background: var(--theme--main) !important; -} -.notion-sidebar > div, -.notion-body.dark [style*='background: rgb(55, 60, 63)'], -.notion-body.dark [style*='background: rgb(120, 123, 123)'], -.notion-body:not(.dark) [style*='background: rgb(247, 246, 243)'], -.notion-body:not(.dark) [style*='background: rgb(223, 223, 222)'] { - background: var(--theme--sidebar) !important; -} -.notion-peek-renderer, -[style*='background: rgba(15, 15, 15, 0.6)'] { - background: var(--theme--overlay) !important; -} - -.notion-frame - .notion-scroller - [style*='env(safe-area-inset-'][style*=' width: 900px'], -.notion-frame - .notion-scroller - [style*='env(safe-area-inset-'][style*=';width: 900px'], -.notion-frame - .notion-scroller - [style*='height: 30vh'] - [style*='pointer-events:'][style*='max-width: 100%; width: 900px'] { - width: var(--theme--page_normal-width) !important; -} - -.notion-frame - [style*='padding-left: calc(96px + env(safe-area-inset-left)); padding-right: calc(96px + env(safe-area-inset-right));'] { - padding-left: var(--theme--page-padding) !important; - padding-right: var(--theme--page-padding) !important; -} - -.notion-page-content [data-block-id][style*='max-width'] { - max-width: 100% !important; -} -.notion-frame - .notion-scroller - [style*='env(safe-area-inset-'][style*=' width: 100%'], -.notion-frame - .notion-scroller - [style*='height: 30vh'] - [style*='pointer-events:'][style*='max-width: 100%; width: 100%'] { - width: var(--theme--page_full-width) !important; -} -.notion-frame .notion-scroller [style*='padding-left: 136.5px;'] { - padding-left: 0 !important; -} -.notion-frame .notion-scroller [style*='padding-right: 136.5px;'] { - padding-right: 0 !important; -} -.notion-collection_view-block > :first-child, -.notion-collection_view-block .notion-scroller > :first-child { - padding-left: 0 !important; - padding-right: 0 !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--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--page_banner-height) !important; -} - -/* colour help button - one of the few specific classes notion does give us */ -.notion-help-button { - background: var(--theme--interactive_hover) !important; - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border) !important; -} - -/* page preview sizing */ -.notion-peek-renderer > div:nth-child(2) { - max-width: var(--theme--preview-width) !important; -} -.notion-peek-renderer .notion-page-content [style*='max-width: 943px;'] { - max-width: none !important; -} - -.notion-peek-renderer - .notion-scroller.vertical - [style*='padding-left: calc(126px + env(safe-area-inset-left));'] { - padding-left: var(--theme--preview-padding) !important; -} -.notion-peek-renderer - .notion-scroller.vertical - [style*='padding-right: calc(126px + env(safe-area-inset-right));'] { - padding-right: var(--theme--preview-padding) !important; -} -.notion-peek-renderer - .notion-scroller.vertical - [style*='margin-left: calc(126px + env(safe-area-inset-left));'] { - margin-left: var(--theme--preview-padding) !important; -} -.notion-peek-renderer - .notion-scroller.vertical - [style*='margin-right: calc(126px + env(safe-area-inset-right));'] { - margin-right: var(--theme--preview-padding) !important; -} -.notion-peek-renderer .notion-page-content { - padding-left: var(--theme--preview-padding) !important; - padding-right: var(--theme--preview-padding) !important; - width: 100%; -} - -/** fonts **/ - -[style*='Segoe UI'] { - font-family: var(--theme--font_sans) !important; -} -[style*='Georgia'] { - font-family: var(--theme--font_serif) !important; -} -[style*='iawriter-mono'] { - font-family: var(--theme--font_mono) !important; -} -[style*='SFMono-Regular'] { - font-family: var(--theme--font_code) !important; -} -.notion-selectable.notion-quote-block div[spellcheck="true"] { - font-family: var(--theme--font_quote) !important; -} -[placeholder='Heading 1'], [placeholder='Heading 2'], [placeholder='Heading 3'] { - font-family: var(--theme--font_headings) !important; -} -.notion-frame .notion-page-block div[placeholder='Untitled'], -.notion-overlay-container .notion-page-block div[placeholder='Untitled'] { - font-size: calc( - var(--theme--font_body-size) * (var(--theme--font_heading1-size) / 1em) - ) !important; -} -[placeholder='Heading 1'] { - font-size: calc( - var(--theme--font_body-size) * (var(--theme--font_heading1-size) / 1em) - ) !important; -} -[placeholder='Heading 2'] { - font-size: calc( - var(--theme--font_body-size) * (var(--theme--font_heading2-size) / 1em) - ) !important; -} -[placeholder='Heading 3'] { - font-size: calc( - var(--theme--font_body-size) * (var(--theme--font_heading3-size) / 1em) - ) !important; -} -.notion-frame .notion-scroller.vertical.horizontal [style*='font-size: 14px'], -.notion-overlay-container .notion-scroller.vertical [style*='font-size: 14px'] { - font-size: var(--theme--font_label-size) !important; -} -.notion-frame .notion-scroller.vertical.horizontal .notion-page-content, -.notion-overlay-container .notion-scroller.vertical .notion-page-content { - font-size: var(--theme--font_body-size) !important; -} -.notion-frame - .notion-scroller.vertical.horizontal - .notion-page-content[style*='font-size: 14px'], -.notion-overlay-container - .notion-scroller.vertical - .notion-page-content[style*='font-size: 14px'] { - font-size: var(--theme--font_body-size_small) !important; -} -.notion-code-block [placeholder=' '] { - font-size: var(--theme--font_code-size) !important; -} -.notion-sidebar [style*='font-size: 14px'] { - font-size: var(--theme--font_sidebar-size) !important; -} - -/** text-block readability **/ - -.notion-page-content .notion-selectable.notion-text-block { - line-height: var(--theme--text-block_line-height) !important; - margin-top: var(--theme--text-block_margin-top) !important; -} - -/** databases **/ - -.notion-body.dark [style*='background: rgb(63, 68, 71)'], -.notion-body.dark [style*='background-color: rgb(64, 68, 71);'], -.notion-body:not(.dark) - .notion-scroller.horizontal.vertical - .notion-selectable - > a[style*='background: white'], -.notion-body:not(.dark) [style*='background: rgb(247, 246, 243)'], -.notion-body:not(.dark) - .notion-dark-theme - [style*='background: white'][style*='box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;'] { - background: var(--theme--card) !important; -} -.notion-body.dark - .notion-page-block.notion-collection-item - [style*='background: rgba(255, 255, 255, 0.05)'], -.notion-body:not(.dark) - .notion-page-block.notion-collection-item - [style*='background: rgba(55, 53, 47, 0.024)'] { - background: var(--theme--gallery) !important; -} -.notion-body.dark .notion-scroller > [style*='rgb(55, 60, 63)'], -.notion-body:not(.dark) [style*='background: rgba(242, 241, 238, 0.6)'] { - background: var(--theme--select_input) !important; -} - -.notion-body.dark - [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px -1px inset;'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.16) 0px -1px 0px inset'] { - box-shadow: rgba(55, 53, 47, 0.16) 0px -1px inset !important; -} - -.notion-body.dark [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px 1px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.09) 0px 1px 0px'] { - box-shadow: var(--theme--ui-border) 0px 1px 0px !important; -} -.notion-body.dark - [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.16) 0px 1px 0px inset'] { - box-shadow: var(--theme--table-border) 0px 1px 0px inset !important; -} - -.notion-body.dark [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px;'], -.notion-body:not(.dark) [style*='box-shadow: white -3px 0px 0px;'] { - box-shadow: var(--theme--main) -3px 0px 0px !important; -} -.notion-body.dark - [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px, rgba(255, 255, 255, 0.14) 0px 1px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: white -3px 0px 0px, rgba(55, 53, 47, 0.16) 0px 1px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { - box-shadow: var(--theme--main) -3px 0px 0px, - var(--theme--ui-border) 0px 1px 0px !important; -} - -.notion-body.dark [style*='border-top: 1px solid rgba(255, 255, 255,'], -.notion-body:not(.dark) [style*='border-top: 1px solid rgba(55, 53, 47,'] { - border-top: 1px solid var(--theme--table-border) !important; -} -.notion-body.dark - [style*='box-shadow: rgba(255, 255, 255, 0.14) -1px 0px 0px'] { - box-shadow: var(--theme--table-border) -1px 0px 0px !important; -} -.notion-body.dark [style*='border-bottom: 1px solid rgba(255, 255, 255,'], -.notion-body:not(.dark) [style*='border-bottom: 1px solid rgba(55, 53, 47,'] { - border-bottom: 1px solid var(--theme--table-border) !important; -} -.notion-body.dark [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.16) 0px 1px 0px'] { - box-shadow: var(--theme--table-border) 0px 1px 0px !important; -} -.notion-body.dark [style*='border-right: 1px solid rgba(255, 255, 255,'], -.notion-body:not(.dark) [style*='border-right: 1px solid rgba(55, 53, 47,'] { - border-right: 1px solid var(--theme--table-border) !important; -} -.notion-body.dark [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'], -.notion-body.dark [style*='box-shadow: rgba(55, 53, 47, 0.09) 0px -1px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.09) 0px -1px 0px'] { - box-shadow: var(--theme--ui-border) 0px -1px 0px !important; -} -.notion-body.dark [style*='border-left: 1px solid rgba(255, 255, 255,'], -.notion-body.dark - .notion-block-permission-settings-public-access - [role='button'][style*='border-left: none'], -.notion-body:not(.dark) [style*='border-left: 1px solid rgba(55, 53, 47,'] { - border-left: 1px solid var(--theme--table-border) !important; -} -.notion-body.dark - [style*='box-shadow: rgba(255, 255, 255, 0.14) 1px 0px 0px inset'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.16) 1px 0px 0px inset'] { - box-shadow: var(--theme--table-border) 1px 0px 0px inset !important; -} -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.09) -1px 0px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.16) -1px 0px 0px'] { - box-shadow: -1px -1px 0 var(--theme--table-border) !important; -} - -.notion-body.dark - [style*='border-top: 1px solid rgb(77, 81, 83)'], -.notion-body:not(.dark) - [style*='border-top: 1px solid rgb(223, 223, 222)'] { - border-top: 1px solid var(--theme--table-border_row) !important; -} -.notion-body.dark - [style*='border-bottom: 1px solid rgb(77, 81, 83)'], -.notion-body:not(.dark) - [style*='border-bottom: 1px solid rgb(223, 223, 222)'] { - border-bottom: 1px solid var(--theme--table-border_row) !important; -} -.notion-body.dark - [style*='border-right: 1px solid rgb(77, 81, 83)'], -.notion-body:not(.dark) - [style*='border-right: 1px solid rgb(223, 223, 222)'] { - border-right: 1px solid var(--theme--table-border_row) !important; -} - -.notion-body.dark - [style*='border-right: 1px solid rgb(63, 66, 69)'], -.notion-body:not(.dark) - [style*='border-right: 1px solid rgb(237, 237, 236)'] { - border-right: 1px solid var(--theme--table-border_column) !important; -} - -.notion-body.dark - [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px, rgb(77, 81, 83) 0px 1px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: white -3px 0px 0px, rgb(223, 223, 222) 0px 1px 0px'] { - box-shadow: var(--theme--main) -3px 0px 0px, - var(--theme--table-border_row) 0px 1px 0px !important; -} -.notion-body.dark - [style*='box-shadow: rgb(77, 81, 83) -1px 0px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: rgb(223, 223, 222) -1px 0px 0px'] { - box-shadow: var(--theme--table-border_row) -1px 0px 0px !important; -} -.notion-body.dark - [style*='box-shadow: rgb(77, 81, 83) 0px 1px 0px'], -.notion-body:not(.dark) - [style*='box-shadow: rgb(223, 223, 222) 0px 1px 0px'] { - box-shadow: var(--theme--table-border_row) 0 1px 0px !important; -} -.notion-body.dark - [style*='box-shadow: rgb(77, 81, 83) 0px 1px 0px inset'], -.notion-body:not(.dark) - [style*='box-shadow: rgb(223, 223, 222) 0px 1px 0px inset'] { - box-shadow: var(--theme--table-border_row) 0 1px 0px inset !important; -} - -[style*='border: 1px solid rgba(46, 170, 220, 0.6)'] { - border: 1px solid var(--theme--table-border_selected) !important; -} - -.notion-body.dark - [style*='background-image: linear-gradient(to right, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.14) 100%);'], -.notion-body:not(.dark) - [style*='background-image: linear-gradient(to right, rgba(55, 53, 47, 0.16) 0%, rgba(55, 53, 47, 0.16) 100%);'] { - background-image: linear-gradient( - to right, - var(--theme--bg_gray) 0%, - var(--theme--bg_gray) 100% - ) !important; -} - -.notion-body.dark [style*='background: rgb(71, 76, 80)'], -.notion-body.dark [style*='background: rgb(80, 85, 88)'], -.notion-body.dark [style*='background: rgb(98, 102, 104)'], -.notion-body.dark [style*='height: 1px; background: rgba(255, 255, 255, 0.07)'], -.notion-body:not(.dark) [style*='background: rgba(55, 53, 47,'], -.notion-body:not(.dark) [style*='background: rgb(239, 239, 238)'], -.notion-body:not(.dark) [style*='background: rgba(206, 205, 202, 0.5)'] { - background: var(--theme--interactive_hover) !important; - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border) !important; -} - -/* normalise inline-table size */ -.notion-page-content .notion-collection_view-block[style*=' width'], -.notion-page-content .notion-collection_view-block[style^='width'] { - width: 100% !important; -} -.notion-page-content - .notion-collection_view-block - [style*='padding-left: 50px'], -.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*='padding-right: 50px'], -.notion-page-content - .notion-collection_view-block - [style*='padding-right: 96px'], -.notion-page-content - .notion-collection_view-block - [style*='padding-right: 126px'] { - padding-right: 0 !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; -} - -/* 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; -} - -/* fix button resizing */ -.notion-collection_view-block [role='button'], -.notion-collection_view_page-block [role='button'] { - border-width: 0 !important; -} - -/** general ui **/ - -::selection, -[style*='background: rgba(46, 170, 220,']:not([style*='background: rgba(46, 170, 220, 0)']), -[style*='background-color: rgba(46, 170, 220,']:not([style*='background-color: rgba(46, 170, 220, 0)']) { - background: var(--theme--selected) !important; -} - -[style*=' color: rgb(46, 170, 220)'], -[style^='color: rgb(46, 170, 220)'] { - color: var(--theme--primary) !important; -} -[style*='fill: rgb(46, 170, 220)'] { - fill: var(--theme--primary) !important; -} -[style*='background: rgb(46, 170, 220)'], -[style*='background-color: rgb(46, 170, 220)'] { - background: var(--theme--primary) !important; -} -[style*='box-shadow: rgb(46, 170, 220) 0px 0px 0px 2px inset'] { - box-shadow: var(--theme--primary) 0px 0px 0px 2px inset !important; -} -[style*='background: rgb(6, 156, 205)'] { - background: var(--theme--primary_hover) !important; -} -[style*='background: rgb(0, 141, 190)'] { - background: var(--theme--primary_click) !important; -} -[style*='background: rgb(46, 170, 220)'][style*='color: white'], -[style*='background-color: rgb(46, 170, 220)'][style*='color: white'], -[style*='background: rgb(6, 156, 205)'][style*='color: white'], -[style*='background: rgb(0, 141, 190)'][style*='color: white'] { - color: var(--theme--primary_text) !important; -} -[style*='background: rgb(46, 170, 220)'] [style*='fill: white'], -[style*='background-color: rgb(46, 170, 220)'] [style*='fill: white'], -[style*='background: rgb(6, 156, 205)'] [style*='fill: white'], -[style*='background: rgb(0, 141, 190)'] [style*='fill: white'] { - fill: var(--theme--primary_text) !important; -} -.DayPicker-Day--today:not(.DayPicker-Day--selected):not(.DayPicker-Day--value):not(.DayPicker-Day--start):not(.DayPicker-Day--end)::after, -[style*='background: rgb(235, 87, 87)'] { - background: var(--theme--primary_indicator) !important; -} -[style*='background: rgb(235, 87, 87)'][style*='color: white'] { - color: var(--theme--primary_indicator_text) !important; -} -#notion-app .DayPicker:not(.DayPicker--interactionDisabled) .DayPicker-Day--outside:hover, #notion-app .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):hover { - background: var(--theme--primary_indicator_hover) !important; -} - -.notion-body.dark - [style*='box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 3px 6px, rgba(15, 15, 15, 0.4) 0px 9px 24px'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px'] { - box-shadow: var(--theme--box-shadow_strong) !important; -} -.notion-body.dark - [style*='box-shadow: rgba(15, 15, 15, 0.2) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 2px 4px'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 2px 4px'] { - box-shadow: var(--theme--box-shadow) !important; -} - -.notion-to_do-block > div [role='button']:hover, -.notion-to_do-block > div [role='button']:hover .checkboxSquare, -.notion-to_do-block > div [role='button']:hover .check { - background: var(--theme--option_hover-background) !important; -} -.notion-to_do-block > div [role='button']:hover .checkboxSquare path, -.notion-to_do-block > div [role='button']:hover .check polygon { - fill: var(--theme--option_hover-color) !important; -} -.notion-to_do-block > div [role='button']:not(:hover) .check { - background: var(--theme--option_active-background) !important; -} -.notion-to_do-block > div [role='button']:not(:hover) .check polygon { - fill: var(--theme--option_active-color) !important; -} - -.notion-to_do-block .checkboxSquare { - background: var(--theme--option-background) !important; -} -.notion-to_do-block .checkboxSquare path { - fill: var(--theme--option-color) !important; -} - -[style*='color: rgb(235, 87, 87); border: 1px solid rgba(235, 87, 87, 0.5);'] { - color: var(--theme--danger_text) !important; - border: 1px solid var(--theme--danger_border) !important; -} - -/* divider */ - -.notion-body.dark .notion-divider-block [style*='border-bottom: 1px solid rgba(255, 255, 255,'], -.notion-body:not(.dark) .notion-divider-block [style*='border-bottom: 1px solid rgba(55, 53, 47,'] { - border-bottom: 1px solid var(--theme--divider) !important; -} - -/* inputs */ -.notion-focusable:focus-within { - box-shadow: var(--theme--primary_hover) 0px 0px 0px 2px !important; -} - -/** content colours **/ - -.notion-body, -.notion-frame .notion-page-block, -.notion-body.dark [style*=' color: rgba(255, 255, 255, 0.9)'], -.notion-body.dark [style^='color: rgba(255, 255, 255, 0.9)'], -.notion-body.dark [style*=' color: rgba(255, 255, 255, 0.7)'], -.notion-body.dark [style^='color: rgba(255, 255, 255, 0.7)'], -.notion-body:not(.dark) [style*=' color: rgb(55, 53, 47);'], -.notion-body:not(.dark) [style^='color: rgb(55, 53, 47);'] { - color: var(--theme--text) !important; -} -.notion-body.dark [style*='color: rgba(255, 255, 255, 0.6)'], -.notion-body:not(.dark) [style*='color: rgba(55, 53, 47, 0.6)'], -.notion-body:not(.dark) [style*='color: rgba(25, 23, 17, 0.6)'] { - color: var(--theme--text_ui) !important; -} -::placeholder { - opacity: 1 !important; -} -::placeholder, -[style*='-webkit-text-fill-color:'], -.notion-body.dark [style*='color: rgba(255, 255, 255, 0.4)'], -.notion-body.dark [style*='color: rgba(255, 255, 255, 0.4)']::before, -.notion-body:not(.dark) [style*='color: rgba(55, 53, 47, 0.4)'], -.notion-body:not(.dark) [style*='color: rgba(55, 53, 47, 0.4)']::before { - color: var(--theme--text_ui_info) !important; - -webkit-text-fill-color: var(--theme--text_ui_info) !important; -} -.notion-body.dark [style*='fill: rgb(202, 204, 206)'] { - fill: var(--theme--text) !important; -} - -.notion-body.dark [style*='fill: rgba(255, 255, 255, 0.6)'], -.notion-body:not(.dark) [style*='fill: rgba(55, 53, 47, 0.8)'], -.notion-body:not(.dark) [style*='fill: rgba(55, 53, 47, 0.6)'], -.notion-body:not(.dark) [style*='fill: rgba(25, 23, 17, 0.6)'] { - fill: var(--theme--text_ui) !important; -} -.notion-body.dark [style*='fill: rgba(202, 204, 206, 0.6)'], -.notion-body.dark [style*='fill: rgba(202, 204, 206, 0.4)'], -.notion-body:not(.dark) [style*='fill: rgba(55, 53, 47, 0.4)'], -.notion-body:not(.dark) [style*='fill: rgba(55, 53, 47, 0.3)'] { - fill: var(--theme--text_ui_info) !important; -} -.notion-body.dark [style*='border-color:rgba(255,255,255,0.4);opacity:0.7'], -.notion-body:not(.dark) [style*='border-color:rgba(55,53,47,0.4);opacity:0.7'] { - border-color: var(--theme--text_ui_info) !important; -} -.notion-body.dark [style*='caret-color: rgba(255, 255, 255, 0.9)'], -.notion-body:not(.dark) [style*='caret-color: rgb(55, 53, 47)'] { - caret-color: var(--theme--text) !important; -} - -.notion-body.dark [style*='color:rgba(151,154,155,0.95)'], -.notion-body.dark - [style*='color: rgba(255, 255, 255, 0.6); fill: rgba(255, 255, 255, 0.6);'], -.notion-body:not(.dark) [style*='color:rgb(155,154,151)'], -.notion-body:not(.dark) - [style*='color: rgba(55, 53, 47, 0.6); fill: rgba(55, 53, 47, 0.6);'] { - color: var(--theme--text_gray) !important; - fill: var(--theme--text_gray) !important; -} -.notion-body.dark [style*='background:rgb(69,75,78)'], -.notion-body:not(.dark) [style*='background:rgb(235,236,237)'] { - background: var(--theme--bg_gray) !important; - color: var(--theme--bg_gray-text) !important; -} -.notion-body.dark - [style*='color:rgba(151,154,155,0.95)'] - [style*='background:rgb(69,75,78)'], -.notion-body.dark - [style*='color: rgba(255, 255, 255, 0.6); fill: rgba(255, 255, 255, 0.6);'] - [style*='background:rgb(69,75,78)'], -.notion-body:not(.dark) - [style*='color:rgb(155,154,151)'] - [style*='background:rgb(235,236,237)'], -.notion-body:not(.dark) - [style*='color: rgba(55, 53, 47, 0.6); fill: rgba(55, 53, 47, 0.6);'] - [style*='background:rgb(235,236,237)'] { - background: var(--theme--bg_gray) !important; - color: var(--theme--text_gray) !important; - fill: var(--theme--text_gray) !important; -} -.notion-body.dark [style*='background: rgb(69, 75, 78)'], -.notion-body:not(.dark) [style*='background: rgb(235, 236, 237)'] { - background: var(--theme--line_gray) !important; - color: var(--theme--line_gray-text) !important; -} -.notion-body.dark [style*='background: rgba(151, 154, 155, 0.5)'], -.notion-body:not(.dark) [style*='background: rgba(140, 46, 0, 0.2)'] { - background: var(--theme--select_gray) !important; - color: var(--theme--select_gray-text) !important; -} -.notion-body.dark [style*='background: rgba(69, 75, 78, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(235, 236, 237, 0.3)'] { - background: var(--theme--callout_gray) !important; - color: var(--theme--callout_gray-text) !important; -} - -.notion-body.dark [style*='color:rgb(147,114,100)'], -.notion-body.dark - [style*='color: rgb(147, 114, 100); fill: rgb(147, 114, 100);'], -.notion-body:not(.dark) [style*='color:rgb(100,71,58)'], -.notion-body:not(.dark) - [style*='color: rgb(100, 71, 58); fill: rgb(100, 71, 58);'] { - color: var(--theme--text_brown) !important; - fill: var(--theme--text_brown) !important; -} -.notion-body.dark [style*='background:rgb(67,64,64)'], -.notion-body:not(.dark) [style*='background:rgb(233,229,227)'] { - background: var(--theme--bg_brown) !important; - color: var(--theme--bg_brown-text) !important; -} -.notion-body.dark - [style*='color:rgb(147,114,100)'] - [style*='background:rgb(67,64,64)'], -.notion-body.dark - [style*='color: rgb(147, 114, 100); fill: rgb(147, 114, 100);'] - [style*='background:rgb(67,64,64)'], -.notion-body:not(.dark) - [style*='color:rgb(100,71,58)'] - [style*='background:rgb(233,229,227)'], -.notion-body:not(.dark) - [style*='color: rgb(100, 71, 58); fill: rgb(100, 71, 58);'] - [style*='background:rgb(233,229,227)'] { - background: var(--theme--bg_brown) !important; - color: var(--theme--text_brown) !important; - fill: var(--theme--text_brown) !important; -} -.notion-body.dark [style*='background: rgb(67, 64, 64)'], -.notion-body:not(.dark) [style*='background: rgb(233, 229, 227)'] { - background: var(--theme--line_brown) !important; - color: var(--theme--line_brown-text) !important; -} -.notion-body.dark [style*='background: rgba(147, 114, 100, 0.5)'], -.notion-body:not(.dark) [style*='background: rgba(140, 46, 0, 0.2)'] { - background: var(--theme--select_brown) !important; - color: var(--theme--select_brown-text) !important; -} -.notion-body.dark [style*='background: rgba(67, 64, 64, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(233, 229, 227, 0.3)'] { - background: var(--theme--callout_brown) !important; - color: var(--theme--callout_brown-text) !important; -} - -.notion-body.dark [style*='color:rgb(255,163,68)'], -.notion-body.dark [style*='color: rgb(255, 163, 68); fill: rgb(255, 163, 68);'], -.notion-body:not(.dark) [style*='color:rgb(217,115,13)'], -.notion-body:not(.dark) - [style*='color: rgb(217, 115, 13); fill: rgb(217, 115, 13);'] { - color: var(--theme--text_orange) !important; - fill: var(--theme--text_orange) !important; -} -.notion-body.dark [style*='background:rgb(89,74,58)'], -.notion-body:not(.dark) [style*='background:rgb(250,235,221)'] { - background: var(--theme--bg_orange) !important; - color: var(--theme--bg_orange-text) !important; -} -.notion-body.dark - [style*='color:rgb(255,163,68)'] - [style*='background:rgb(89,74,58)'], -.notion-body.dark - [style*='color: rgb(255, 163, 68); fill: rgb(255, 163, 68);'] - [style*='background:rgb(89,74,58)'], -.notion-body:not(.dark) - [style*='color:rgb(217,115,13)'] - [style*='background:rgb(250,235,221)'], -.notion-body:not(.dark) - [style*='color: rgb(217, 115, 13); fill: rgb(217, 115, 13);'] - [style*='background:rgb(250,235,221)'] { - background: var(--theme--bg_orange) !important; - color: var(--theme--text_orange) !important; - fill: var(--theme--text_orange) !important; -} -.notion-body.dark [style*='background: rgb(89, 74, 58)'], -.notion-body:not(.dark) [style*='background: rgb(250, 235, 221)'] { - background: var(--theme--line_orange) !important; - color: var(--theme--line_orange-text) !important; -} -.notion-body.dark [style*='background: rgba(255, 163, 68, 0.5)'], -.notion-body:not(.dark) [style*='background: rgba(245, 93, 0, 0.2)'] { - background: var(--theme--select_orange) !important; - color: var(--theme--select_orange-text) !important; -} -.notion-body.dark [style*='background: rgba(89, 74, 58, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(250, 235, 221, 0.3)'] { - background: var(--theme--callout_orange) !important; - color: var(--theme--callout_orange-text) !important; -} - -.notion-body.dark [style*='color:rgb(255,220,73)'], -.notion-body.dark [style*='color: rgb(255, 220, 73); fill: rgb(255, 220, 73);'], -.notion-body:not(.dark) [style*='color:rgb(223,171,1)'], -.notion-body:not(.dark) - [style*='color: rgb(223, 171, 1); fill: rgb(223, 171, 1);'] { - color: var(--theme--text_yellow) !important; - fill: var(--theme--text_yellow) !important; -} -.notion-body.dark [style*='background:rgb(89,86,59)'], -.notion-body:not(.dark) [style*='background:rgb(251,243,219)'] { - background: var(--theme--bg_yellow) !important; - color: var(--theme--bg_yellow-text) !important; -} -.notion-body.dark - [style*='color:rgb(255,220,73)'] - [style*='background:rgb(89,86,59)'], -.notion-body.dark - [style*='color: rgb(255, 220, 73); fill: rgb(255, 220, 73);'] - [style*='background:rgb(89,86,59)'], -.notion-body:not(.dark) - [style*='color:rgb(223,171,1)'] - [style*='background:rgb(251,243,219)'], -.notion-body:not(.dark) - [style*='color: rgb(223, 171, 1); fill: rgb(223, 171, 1);'] - [style*='background:rgb(251,243,219)'] { - background: var(--theme--bg_yellow) !important; - color: var(--theme--text_yellow) !important; - fill: var(--theme--text_yellow) !important; -} -.notion-body.dark [style*='background: rgb(89, 86, 59)'], -.notion-body:not(.dark) [style*='background: rgb(251, 243, 219)'] { - background: var(--theme--line_yellow) !important; - color: var(--theme--line_yellow-text) !important; -} -.notion-body.dark [style*='background: rgba(255, 220, 73, 0.5)'], -.notion-body:not(.dark) [style*='background: rgba(233, 168, 0, 0.2)'] { - background: var(--theme--select_yellow) !important; - color: var(--theme--select_yellow-text) !important; -} -.notion-body.dark [style*='background: rgba(89, 86, 59, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(251, 243, 219, 0.3)'] { - background: var(--theme--callout_yellow) !important; - color: var(--theme--callout_yellow-text) !important; -} - -.notion-body.dark [style*='color:rgb(77,171,154)'], -.notion-body.dark [style*='color: rgb(77, 171, 154); fill: rgb(77, 171, 154);'], -.notion-body:not(.dark) [style*='color:rgb(15,123,108)'], -.notion-body:not(.dark) - [style*='color: rgb(15, 123, 108); fill: rgb(15, 123, 108);'] { - color: var(--theme--text_green) !important; - fill: var(--theme--text_green) !important; -} -.notion-body.dark [style*='background:rgb(53,76,75)'], -.notion-body:not(.dark) [style*='background:rgb(221,237,234)'] { - background: var(--theme--bg_green) !important; - color: var(--theme--bg_green-text) !important; -} -.notion-body.dark - [style*='color:rgb(77,171,154)'] - [style*='background:rgb(53,76,75)'], -.notion-body.dark - [style*='color: rgb(77, 171, 154); fill: rgb(77, 171, 154);'] - [style*='background:rgb(53,76,75)'], -.notion-body:not(.dark) - [style*='color:rgb(15,123,108)'] - [style*='background:rgb(221,237,234)'], -.notion-body:not(.dark) - [style*='color: rgb(15, 123, 108); fill: rgb(15, 123, 108);'] - [style*='background:rgb(221,237,234)'] { - background: var(--theme--bg_green) !important; - color: var(--theme--text_green) !important; - fill: var(--theme--text_green) !important; -} -.notion-body.dark [style*='background: rgb(53, 76, 75)'], -.notion-body:not(.dark) [style*='background: rgb(221, 237, 234)'] { - background: var(--theme--line_green) !important; - color: var(--theme--line_green-text) !important; -} -.notion-body.dark [style*='background: rgba(77, 171, 154, 0.5)'], -.notion-body:not(.dark) [style*='background: rgba(0, 135, 107, 0.2)'] { - background: var(--theme--select_green) !important; - color: var(--theme--select_green-text) !important; -} -.notion-body.dark [style*='background: rgba(53, 76, 75, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(221, 237, 234, 0.3)'] { - background: var(--theme--callout_green) !important; - color: var(--theme--callout_green-text) !important; -} - -.notion-body.dark [style*='color:rgb(82,156,202)'], -.notion-body.dark [style*='color: rgb(82, 156, 202); fill: rgb(82, 156, 202);'], -.notion-body:not(.dark) [style*='color:rgb(11,110,153)'], -.notion-body:not(.dark) - [style*='color: rgb(11, 110, 153); fill: rgb(11, 110, 153);'] { - color: var(--theme--text_blue) !important; - fill: var(--theme--text_blue) !important; -} -.notion-body.dark [style*='background:rgb(54,73,84)'], -.notion-body:not(.dark) [style*='background:rgb(221,235,241)'] { - background: var(--theme--bg_blue) !important; - color: var(--theme--bg_blue-text) !important; -} -.notion-body.dark - [style*='color:rgb(82,156,202)'] - [style*='background:rgb(54,73,84)'], -.notion-body.dark - [style*='color: rgb(82, 156, 202); fill: rgb(82, 156, 202);'] - [style*='background:rgb(54,73,84)'], -.notion-body:not(.dark) - [style*='color:rgb(11,110,153)'] - [style*='background:rgb(221,235,241)'], -.notion-body:not(.dark) - [style*='color: rgb(11, 110, 153); fill: rgb(11, 110, 153);'] - [style*='background:rgb(221,235,241)'] { - background: var(--theme--bg_blue) !important; - color: var(--theme--text_blue) !important; - fill: var(--theme--text_blue) !important; -} -.notion-body.dark [style*='background: rgb(54, 73, 84)'], -.notion-body:not(.dark) [style*='background: rgb(221, 235, 241)'] { - background: var(--theme--line_blue) !important; - color: var(--theme--line_blue-text) !important; -} -.notion-body.dark [style*='background: rgba(82, 156, 202, 0.5)'], -.notion-body:not(.dark) [style*='background: rgba(0, 120, 223, 0.2)'] { - background: var(--theme--select_blue) !important; - color: var(--theme--select_blue-text) !important; -} -.notion-body.dark [style*='background: rgba(54, 73, 84, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(221, 235, 241, 0.3)'] { - background: var(--theme--callout_blue) !important; - color: var(--theme--callout_blue-text) !important; -} - -.notion-body.dark [style*='color:rgb(154,109,215)'], -.notion-body.dark - [style*='color: rgb(154, 109, 215); fill: rgb(154, 109, 215);'], -.notion-body:not(.dark) [style*='color:rgb(105,64,165)'], -.notion-body:not(.dark) - [style*='color: rgb(105, 64, 165); fill: rgb(105, 64, 165);'] { - color: var(--theme--text_purple) !important; - fill: var(--theme--text_purple) !important; -} -.notion-body.dark [style*='background:rgb(68,63,87)'], -.notion-body:not(.dark) [style*='background:rgb(234,228,242)'] { - background: var(--theme--bg_purple) !important; - color: var(--theme--bg_purple-text) !important; -} -.notion-body.dark - [style*='color:rgb(154,109,215)'] - [style*='background:rgb(68,63,87)'], -.notion-body.dark - [style*='color: rgb(154, 109, 215); fill: rgb(154, 109, 215);'] - [style*='background:rgb(68,63,87)'], -.notion-body:not(.dark) - [style*='color:rgb(105,64,165)'] - [style*='background:rgb(234,228,242)'], -.notion-body:not(.dark) - [style*='color: rgb(105, 64, 165); fill: rgb(105, 64, 165);'] - [style*='background:rgb(234,228,242)'] { - background: var(--theme--bg_purple) !important; - color: var(--theme--text_purple) !important; - fill: var(--theme--text_purple) !important; -} -.notion-body.dark [style*='background: rgb(68, 63, 87)'], -.notion-body:not(.dark) [style*='background: rgb(234, 228, 242)'] { - background: var(--theme--line_purple) !important; - color: var(--theme--line_purple-text) !important; -} -.notion-body.dark [style*='background: rgba(154, 109, 215, 0.5)'], -.notion-body:not(.dark) [style*='background: rgba(103, 36, 222, 0.2)'] { - background: var(--theme--select_purple) !important; - color: var(--theme--select_purple-text) !important; -} -.notion-body.dark [style*='background: rgba(68, 63, 87, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(234, 228, 242, 0.3)'] { - background: var(--theme--callout_purple) !important; - color: var(--theme--callout_purple-text) !important; -} - -.notion-body.dark [style*='color:rgb(226,85,161)'], -.notion-body.dark [style*='color: rgb(226, 85, 161); fill: rgb(226, 85, 161);'], -.notion-body:not(.dark) [style*='color:rgb(173,26,114)'], -.notion-body:not(.dark) - [style*='color: rgb(173, 26, 114); fill: rgb(173, 26, 114);'] { - color: var(--theme--text_pink) !important; - fill: var(--theme--text_pink) !important; -} -.notion-body.dark [style*='background:rgb(83,59,76)'], -.notion-body:not(.dark) [style*='background:rgb(244,223,235)'] { - background: var(--theme--bg_pink) !important; - color: var(--theme--bg_pink-text) !important; -} -.notion-body.dark - [style*='color:rgb(226,85,161)'] - [style*='background:rgb(83,59,76)'], -.notion-body.dark - [style*='color: rgb(226, 85, 161); fill: rgb(226, 85, 161);'] - [style*='background:rgb(83,59,76)'], -.notion-body:not(.dark) - [style*='color:rgb(173,26,114)'] - [style*='background:rgb(244,223,235)'], -.notion-body:not(.dark) - [style*='color: rgb(173, 26, 114); fill: rgb(173, 26, 114);'] - [style*='background:rgb(244,223,235)'] { - background: var(--theme--bg_pink) !important; - color: var(--theme--text_pink) !important; - fill: var(--theme--text_pink) !important; -} -.notion-body.dark [style*='background: rgb(83, 59, 76)'], -.notion-body:not(.dark) [style*='background: rgb(244, 223, 235)'] { - background: var(--theme--line_pink) !important; - color: var(--theme--line_pink-text) !important; -} -.notion-body.dark [style*='background: rgba(226, 85, 161, 0.5)'], -.notion-body:not(.dark) [style*='background: rgba(221, 0, 129, 0.2)'] { - background: var(--theme--select_pink) !important; - color: var(--theme--select_pink-text) !important; -} -.notion-body.dark [style*='background: rgba(83, 59, 76, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(244, 223, 235, 0.3)'] { - background: var(--theme--callout_pink) !important; - color: var(--theme--callout_pink-text) !important; -} - -.notion-body.dark [style*='color:rgb(255,115,105)'], -.notion-body.dark - [style*='color: rgb(255, 115, 105); fill: rgb(255, 115, 105);'], -.notion-body:not(.dark) [style*='color:rgb(224,62,62)'], -.notion-body:not(.dark) - [style*='color: rgb(224, 62, 62); fill: rgb(224, 62, 62);'] { - color: var(--theme--text_red) !important; - fill: var(--theme--text_red) !important; -} -.notion-body.dark [style*='background:rgb(89,65,65)'], -.notion-body:not(.dark) [style*='background:rgb(251,228,228)'] { - background: var(--theme--bg_red) !important; - color: var(--theme--bg_red-text) !important; -} -.notion-body.dark - [style*='color:rgb(255,115,105)'] - [style*='background:rgb(89,65,65)'], -.notion-body.dark - [style*='color: rgb(255, 115, 105); fill: rgb(255, 115, 105);'] - [style*='background:rgb(89,65,65)'], -.notion-body:not(.dark) - [style*='color:rgb(224,62,62)'] - [style*='background:rgb(251,228,228)'], -.notion-body:not(.dark) - [style*='color: rgb(224, 62, 62); fill: rgb(224, 62, 62);'] - [style*='background:rgb(251,228,228)'] { - background: var(--theme--bg_red) !important; - color: var(--theme--text_red) !important; - fill: var(--theme--text_red) !important; -} -.notion-body.dark [style*='background: rgb(89, 65, 65)'], -.notion-body:not(.dark) [style*='background: rgb(251, 228, 228)'] { - background: var(--theme--line_red) !important; - color: var(--theme--line_red-text) !important; -} -.notion-body.dark [style*='background: rgba(255, 115, 105, 0.5);'], -.notion-body:not(.dark) [style*='background: rgba(255, 0, 26, 0.2)'] { - background: var(--theme--select_red) !important; - color: var(--theme--select_red-text) !important; -} -.notion-body.dark [style*='background: rgba(89, 65, 65, 0.3)'], -.notion-body:not(.dark) [style*='background: rgba(251, 228, 228, 0.3)'] { - background: var(--theme--callout_red) !important; - color: var(--theme--callout_red-text) !important; -} - -/* fix highlight padding: this isn't a typo */ -[style*='background:rgb('] { - padding-bottom: 3px !important; -} - -/** code **/ - -[style*='color:#EB5757'] { - color: var(--theme--code_inline-text) !important; - background: var(--theme--code_inline-background) !important; -} - -.notion-page-content .notion-code-block { - background: var(--theme--code-background) !important; -} -.notion-code-block > div { - color: var(--theme--code-text) !important; -} -.notion-code-block .token.function { - color: var(--theme--code_function) !important; -} -.notion-code-block .token.parameter { - color: var(--theme--code_parameter) !important; -} -.notion-code-block .token.keyword { - color: var(--theme--code_keyword) !important; -} -.notion-code-block .token.constant { - color: var(--theme--code_constant) !important; -} -.notion-code-block .token.tag { - color: var(--theme--code_tag) !important; -} -.notion-code-block .token.operator { - color: var(--theme--code_operator) !important; -} -.notion-code-block .token.important { - color: var(--theme--code_important) !important; -} -.notion-code-block .token.regex { - color: var(--theme--code_regex) !important; -} -.notion-code-block .token.property { - color: var(--theme--code_property) !important; -} -.notion-code-block .token.builtin { - color: var(--theme--code_builtin) !important; -} -.notion-code-block .token.class-name { - color: var(--theme--code_class-name) !important; -} -.notion-code-block .token.attr-name { - color: var(--theme--code_attr-name) !important; -} -.notion-code-block .token.attr-value { - color: var(--theme--code_attr-value) !important; -} -.notion-code-block .token.selector { - color: var(--theme--code_selector) !important; -} -.notion-code-block .token.id { - color: var(--theme--code_id) !important; -} -.notion-code-block .token.class { - color: var(--theme--code_class) !important; -} -.notion-code-block .token.pseudo-element { - color: var(--theme--code_pseudo-element) !important; -} -.notion-code-block .token.pseudo-class { - color: var(--theme--code_pseudo-class) !important; -} -.notion-code-block .token.attribute { - color: var(--theme--code_attribute) !important; -} -.notion-code-block .token.value { - color: var(--theme--code_value) !important; -} -.notion-code-block .token.unit { - color: var(--theme--code_unit) !important; -} -.notion-code-block .token.comment { - color: var(--theme--code_comment) !important; -} -.notion-code-block .token.punctuation { - color: var(--theme--code_punctuation) !important; -} -.notion-code-block .token.annotation { - color: var(--theme--code_annotation) !important; -} -.notion-code-block .token.decorator { - color: var(--theme--code_decorator) !important; -} -.notion-code-block .token.doctype { - color: var(--theme--code_doctype) !important; -} -.notion-code-block .token.number { - color: var(--theme--code_number) !important; -} -.notion-code-block .token.string { - color: var(--theme--code_string) !important; -} -.notion-code-block .token.boolean { - color: var(--theme--code_boolean) !important; -} diff --git a/mods/core/css/titlebar.css b/mods/core/css/titlebar.css deleted file mode 100644 index 9ab225c..0000000 --- a/mods/core/css/titlebar.css +++ /dev/null @@ -1,48 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 TarasokUA - * under the MIT license - */ - -@import './buttons.css'; - -.frameless .notion-topbar { - height: calc(var(--configured--dragarea_height, 15px) + 45px) !important; -} -.frameless .window-dragarea { - height: var(--configured--dragarea_height, 15px); - width: 100%; -} -.frameless .window-dragarea { - background: var(--theme--dragarea); -} - -.frameless [style*='top: 10.4972px'] { - top: calc(10.4972px + var(--configured--dragarea_height, 15px)) !important; -} - -@media (max-width: 760px) { - .frameless .notion-topbar { - height: calc(var(--configured--dragarea_height, 15px) + 80px) !important; - } - .frameless .notion-topbar > :nth-child(2) { - height: 80px !important; - display: grid !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; - } -} diff --git a/mods/core/enhancerMenu.js b/mods/core/enhancerMenu.js deleted file mode 100644 index 909c251..0000000 --- a/mods/core/enhancerMenu.js +++ /dev/null @@ -1,762 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const store = require('../../pkg/store.js'), - { createElement, getEnhancements } = require('../../pkg/helpers.js'), - fs = require('fs-extra'), - path = require('path'), - electron = require('electron'), - { toKeyEvent } = require('keyboardevent-from-electron-accelerator'); - -window['__start'] = async () => { - document.body.setAttribute('data-platform', process.platform); - - // mod loader - const modules = getEnhancements(); - if (modules.loaded.length) { - console.info( - ` enhancements loaded: ${modules.loaded - .map((mod) => mod.name) - .join(', ')}.` - ); - } - if (modules.invalid.length) { - createAlert( - 'error', - `invalid mods found: ${modules.invalid - .map((mod) => `${mod}`) - .join(', ')}.` - ).append(); - } - const coreStore = (...args) => { - const mod = modules.loaded.find( - (m) => m.id === '0f0bf8b6-eae6-4273-b307-8fc43f2ee082' - ); - return !args.length - ? store(mod.id, mod.defaults) - : args.length === 1 && typeof args[0] === 'object' - ? store(mod.id, { ...mod.defaults, ...args[0] }) - : store(args[0], { ...mod.defaults, ...args[1] }); - }; - - electron.ipcRenderer.send('enhancer:get-app-theme'); - electron.ipcRenderer.on('enhancer:set-app-theme', (event, theme) => { - document.body.className = `notion-${theme}-theme`; - }); - - const buttons = require('./buttons.js')(() => ({ - '72886371-dada-49a7-9afc-9f275ecf29d3': { - enabled: (store('mods')['72886371-dada-49a7-9afc-9f275ecf29d3'] || {}) - .enabled, - }, - tiling_mode: coreStore().tiling_mode, - frameless: coreStore().frameless, - })); - document.querySelector('#titlebar').appendChild(buttons.element); - - function createAlert(type, message) { - if (!type) - throw Error(' @ createAlert: no alert type specified'); - const el = createElement(` - - `); - return { - el, - resolve() { - el.remove(); - }, - prepend() { - document.querySelector('#alerts').prepend(el); - return this; - }, - append() { - document.querySelector('#alerts').appendChild(el); - return this; - }, - }; - } - - // update checker - fetch( - `https://api.github.com/repos/notion-enhancer/notion-enhancer/releases/latest` - ) - .then((res) => res.json()) - .then((res) => { - 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) => { - 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; - if (isNaN(na) && !isNaN(nb)) return -1; - } - return 0; - }); - createAlert( - 'warning', - version.sorted[0] == version.local - ? `update v${version.repo} available!
- run npm i -g notion-enhancer` - : `local build v${raw_v} is unstable.` - ).prepend(); - }); - - const $popup = document.querySelector('#popup'); - document.addEventListener('keyup', (event) => { - if (event.key === 'F5') location.reload(); - // further-configuration popup - if ( - $popup.classList.contains('visible') && - ['Enter', 'Escape'].includes(event.key) - ) - $popup.classList.remove('visible'); - // close window on hotkey toggle - if (coreStore().menu_toggle) { - const hotkey = { - ctrlKey: false, - metaKey: false, - altKey: false, - shiftKey: false, - ...toKeyEvent(coreStore().menu_toggle), - }; - let triggered = true; - for (let prop in hotkey) - if ( - hotkey[prop] !== event[prop] && - !(prop === 'key' && event[prop] === 'Dead') - ) - triggered = false; - if (triggered || ((event.ctrlKey || event.metaKey) && event.key === 'w')) - electron.remote.getCurrentWindow().close(); - } - // focus search - const meta = - !(event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey; - if ( - meta && - document.activeElement.getAttribute('tabindex') === '0' && - event.key === 'Enter' - ) - document.activeElement.click(); - if (document.activeElement.tagName.toLowerCase() === 'input') { - if (document.activeElement.type === 'checkbox' && event.key === 'Enter') - document.activeElement.checked = !document.activeElement.checked; - if ( - ['Escape', 'Enter'].includes(event.key) && - document.activeElement.type !== 'checkbox' && - (document.activeElement.parentElement.id !== 'search' || - event.key === 'Escape') - ) - document.activeElement.blur(); - } else if (meta && event.key === '/') - document.querySelector('#search > input').focus(); - if ( - (event.ctrlKey || event.metaKey) && - event.key === 'f' && - !event.altKey && - !event.shiftKey - ) - document.querySelector('#search > input').focus(); - }); - - 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'); - }) - ); - - const conflicts = { - relaunch: null, - detected: () => - store('mods', { - conflicts: { dark: false, light: false }, - }).conflicts, - alerts: [], - check() { - document.body.classList.remove('conflict'); - conflicts.alerts.forEach((alert) => alert.resolve()); - conflicts.alerts = []; - const enabled = modules.loaded.filter( - (mod) => - store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled && - mod.tags.includes('theme') - ), - dark = enabled.filter((mod) => mod.tags.includes('dark')), - light = enabled.filter((mod) => mod.tags.includes('light')); - for (let mode of [ - [dark, 'dark'], - [light, 'light'], - ]) { - const conflictID = mode[0] - .map((mod) => mod.id) - .sort() - .join('||'); - if ( - conflicts.detected()[mode[1]] && - conflicts.detected()[mode[1]][0] === conflictID && - conflicts.detected()[mode[1]][1] - ) - continue; - if (mode[0].length > 1) { - document.body.classList.add('conflict'); - conflicts.detected()[mode[1]] = [conflictID, false]; - const alert = createAlert( - 'error', - `conflicting ${mode[1]} themes: ${mode[0] - .map((mod) => `${mod.name}`) - .join( - ', ' - )}.
resolve or dismiss to continue.` - ); - alert.el - .querySelector('[data-action="dismiss"]') - .addEventListener('click', (event) => { - conflicts.detected()[mode[1]] = [conflictID, true]; - conflicts.check(); - }); - alert.append(); - conflicts.alerts.push(alert); - } else conflicts.detected()[mode[1]] = false; - } - search(); - }, - }; - function modified() { - conflicts.check(); - if (conflicts.relaunch) return; - conflicts.relaunch = createAlert( - 'info', - 'changes may not fully apply until app relaunch.' - ); - conflicts.relaunch.el - .querySelector('[data-action="relaunch"]') - .addEventListener('click', (event) => { - electron.remote.app.relaunch(); - electron.remote.app.quit(); - }); - conflicts.relaunch.append(); - } - - const search_filters = { - enabled: true, - disabled: true, - tags: new Set( - modules.loaded - .map((mod) => mod.tags) - .flat() - .sort() - ), - }; - function innerText(elem) { - let text = ''; - for (let $node of elem.childNodes) { - if ($node.nodeType === 3) text += $node.textContent; - if ($node.nodeType === 1) { - if ($node.getAttribute('data-tooltip')) - text += $node.getAttribute('data-tooltip'); - text += ['text', 'number'].includes($node.type) - ? $node.value - : innerText($node); - } - } - return text; - } - function search() { - modules.loaded.forEach((mod) => { - const $search_input = document.querySelector('#search > input'), - conflictingIDs = [conflicts.detected().dark, conflicts.detected().light] - .filter((conflict) => conflict && !conflict[1]) - .map(([mods, dismissed]) => mods.split('||')) - .flat(); - if ( - conflictingIDs.length || - document.body.classList.contains('reorder') - ) { - $search_input.disabled = true; - } else $search_input.disabled = false; - if ( - !document.body.classList.contains('reorder') && - (conflictingIDs.length - ? !conflictingIDs.some((id) => id.includes(mod.id)) - : (mod.elem.classList.contains('enabled') && - !search_filters.enabled) || - (mod.elem.classList.contains('disabled') && - !search_filters.disabled) || - !mod.tags.some((tag) => search_filters.tags.has(tag)) || - ($search_input.value && - !innerText(mod.elem) - .toLowerCase() - .includes($search_input.value.toLowerCase().trim()))) - ) - return (mod.elem.style.display = 'none'); - mod.elem.style.display = 'block'; - }); - } - document.querySelector('#search > input').addEventListener('input', search); - - function createTag(tagname, onclick, color) { - if (!tagname) - throw Error(' @ createTag: no tagname specified'); - if (!onclick) - throw Error(' @ createTag: no action specified'); - const el = createElement( - `${tagname}` - ); - document.querySelector('#tags').append(el); - el.addEventListener('click', (event) => { - if ( - !document.body.classList.contains('reorder') && - !document.body.classList.contains('conflict') - ) { - el.className = el.className === 'selected' ? '' : 'selected'; - onclick(el.className === 'selected'); - } - }); - return el; - } - createTag('enabled', (state) => [ - ((search_filters.enabled = state), search()), - ]); - createTag('disabled', (state) => [ - (search_filters.disabled = state), - search(), - ]); - for (let tag of search_filters.tags) - createTag(`#${tag}`, (state) => [ - state ? search_filters.tags.add(tag) : search_filters.tags.delete(tag), - search(), - ]); - - // mod info + options - function markdown(string) { - const parsed = string - .split('\n') - .map((line) => - line - .trim() - .replace(/\s+/g, ' ') - // > quote - .replace(/^>\s+(.+)$/g, '
$1
') - // ~~strikethrough~~ - .replace(/([^\\])?~~((?:(?!~~).)*[^\\])~~/g, '$1$2') - // __underline__ - .replace(/([^\\])?__((?:(?!__).)*[^\\])__/g, '$1$2') - // **bold** - .replace(/([^\\])?\*\*((?:(?!\*\*).)*[^\\])\*\*/g, '$1$2') - // *italic* - .replace(/([^\\])?\*([^*]*[^\\*])\*/g, '$1$2') - // _italic_ - .replace(/([^\\])?_([^_]*[^\\_])_/g, '$1$2') - // `code` - .replace(/([^\\])?`([^`]*[^\\`])`/g, '$1$2') - // ![image_title](source) - .replace( - /([^\\])?\!\[([^\]]*[^\\\]]?)\]\(([^)]*[^\\)])\)/g, - `$1$2` - ) - // [link](destination) - .replace( - /([^\\])?\[([^\]]*[^\\\]]?)\]\(([^)]*[^\\)])\)/g, - '$1$2' - ) - ) - .map((line) => - line.startsWith('
') ? line : `

${line}

` - ) - .join(''); - return parsed; - } - - const file_icon = await fs.readFile( - path.resolve(`${__dirname}/icons/file.svg`) - ), - question_icon = ( - await fs.readFile(path.resolve(`${__dirname}/icons/question.svg`)) - ).toString(); - function createOption(opt, id) { - let $opt; - const desc = opt.desc - ? question_icon.replace( - ' - - `; - 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'), - fileExists = (file) => fs.pathExistsSync(path.resolve(file)); - - for (let mod of modules.loaded) { - const enabled = - mod.alwaysActive || - store('mods', { - [mod.id]: { enabled: false }, - })[mod.id].enabled, - author = - typeof mod.author === 'object' - ? mod.author - : { - name: mod.author, - link: `https://github.com/${mod.author}`, - avatar: `https://github.com/${mod.author}.png`, - }; - if (enabled) { - for (let sheet of ['menu', 'variables']) { - if (fileExists(`${__dirname}/../${mod.dir}/${sheet}.css`)) { - document.head.appendChild( - createElement( - `` - ) - ); - } - } - } - mod.elem = createElement(` -
-
-

${mod.name}` - : `class="toggle"> - - ` - }

-

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

-
${markdown(mod.desc)}
-

- - - ${author.name} - - v${mod.version} -

-
- ${ - mod.options && mod.options.length - ? '
' - : '' - } -
- `); - const $enable = mod.elem.querySelector(`#enable_${mod.id}`); - if ($enable) - $enable.addEventListener('click', (event) => { - store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled = - $enable.checked; - mod.elem.className = store('mods', { [mod.id]: { enabled: false } })[ - mod.id - ].enabled - ? 'enabled' - : 'disabled'; - if ( - $enable.checked && - coreStore().autoresolve && - mod.tags.includes('theme') - ) { - modules.loaded.forEach((other) => { - const $other_enable = other.elem.querySelector( - `#enable_${other.id}` - ); - if ( - other !== mod && - $other_enable && - $other_enable.checked && - other.tags.includes('theme') - ) { - for (let mode of ['dark', 'light']) - if (other.tags.includes(mode) && mod.tags.includes(mode)) - $other_enable.click(); - } - }); - } - search(); - modified(); - }); - - const $options = mod.elem.querySelector('.options'); - if ($options) - for (const opt of mod.options) { - if ( - Object.keys(opt.platformOverwrite || {}).some( - (platform) => process.platform === platform - ) - ) { - continue; - } - 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) => { - modified(); - 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' - ? +event.target.value - : event.target.value; - }); - } - $options.appendChild($opt); - } - if (mod.tags.includes('core')) $modules.append(mod.elem); - } - document - .querySelectorAll('input[type="checkbox"]') - .forEach((checkbox) => - checkbox.addEventListener('click', (event) => event.target.blur()) - ); - conflicts.check(); - - // draggable re-ordering - const draggable = { - state: 0, - tags: ['b', 'span'], - $toggle: document.querySelector('#draggable-toggle'), - list: modules.loaded - .filter((m) => !m.tags.includes('core')) - .map((m) => m.elem), - target: null, - render() { - draggable.target = null; - for (let $node of draggable.list) { - $node.draggable = false; - $modules.append($node); - } - }, - mouseover(event) { - if (!draggable.target && event.target.innerText) { - for (let $node of draggable.list) $node.draggable = false; - const $node = draggable.list.find( - (node) => node.innerText === event.target.innerText - ); - if ($node) $node.draggable = draggable.state; - } - }, - }; - document.addEventListener('dragstart', (event) => { - draggable.target = event.target; - event.target.style.opacity = 0.5; - }); - document.addEventListener('dragend', (event) => { - event.target.style.opacity = ''; - }); - document.addEventListener('dragover', (event) => { - event.preventDefault(); - document - .querySelectorAll('.dragged-over') - .forEach((el) => el.classList.remove('dragged-over')); - const $node = [ - draggable.list[0].previousElementSibling, - ...draggable.list, - ].find((node) => node.innerText === event.target.innerText); - if ($node) $node.classList.add('dragged-over'); - }); - document.addEventListener('drop', (event) => { - event.preventDefault(); - document - .querySelectorAll('.dragged-over') - .forEach((el) => el.classList.remove('dragged-over')); - if ( - draggable.target && - draggable.target.innerText !== event.target.innerText - ) { - const from = draggable.list.findIndex( - (node) => node.innerText === draggable.target.innerText - ), - to = - event.target.innerText === - draggable.list[0].previousElementSibling.innerText - ? 0 - : draggable.list.findIndex( - (node) => node.innerText === event.target.innerText - ) + 1; - if (to >= 0) { - draggable.list.splice( - to > from ? to - 1 : to, - 0, - draggable.list.splice(from, 1)[0] - ); - store('mods').priority = draggable.list.map((m) => m.id); - } - } - draggable.render(); - modified(); - }); - document.addEventListener('mouseover', draggable.mouseover); - draggable.render(); - draggable.$toggle.addEventListener('click', (event) => { - draggable.state = !draggable.state; - draggable.tags = draggable.tags.reverse(); - draggable.$toggle.innerHTML = ` - <${draggable.tags[0]} data-bolded="configure">configure | - <${draggable.tags[1]} data-bolded="reorder">reorder - `; - document.body.classList[draggable.state ? 'add' : 'remove']('reorder'); - $modules - .querySelectorAll('input') - .forEach((input) => (input.disabled = draggable.state)); - search(); - }); - - const $tooltip = document.querySelector('#tooltip'); - document.querySelectorAll('[data-tooltip]').forEach((el) => { - el.addEventListener('mouseenter', (e) => { - $tooltip.innerText = el.getAttribute('data-tooltip'); - $tooltip.classList.add('active'); - }); - el.addEventListener('mouseover', (e) => { - $tooltip.style.top = e.clientY - $tooltip.clientHeight + 'px'; - $tooltip.style.left = - e.clientX < window.innerWidth / 2 ? e.clientX + 'px' : ''; - $tooltip.style.right = - e.clientX > window.innerWidth / 2 - ? window.innerWidth - e.clientX + 'px' - : ''; - }); - el.addEventListener('mouseleave', (e) => - $tooltip.classList.remove('active') - ); - }); -}; diff --git a/mods/core/icons/alwaysontop_off.svg b/mods/core/icons/alwaysontop_off.svg deleted file mode 100644 index 96afcf0..0000000 --- a/mods/core/icons/alwaysontop_off.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/core/icons/alwaysontop_on.svg b/mods/core/icons/alwaysontop_on.svg deleted file mode 100644 index 3fec5d5..0000000 --- a/mods/core/icons/alwaysontop_on.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/core/icons/close.svg b/mods/core/icons/close.svg deleted file mode 100644 index 7268fb0..0000000 --- a/mods/core/icons/close.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/core/icons/file.svg b/mods/core/icons/file.svg deleted file mode 100644 index 81c387e..0000000 --- a/mods/core/icons/file.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/core/icons/mac+linux.png b/mods/core/icons/mac+linux.png deleted file mode 100644 index 3a7708f..0000000 Binary files a/mods/core/icons/mac+linux.png and /dev/null differ diff --git a/mods/core/icons/maximize_off.svg b/mods/core/icons/maximize_off.svg deleted file mode 100644 index 0bf56b0..0000000 --- a/mods/core/icons/maximize_off.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/core/icons/maximize_on.svg b/mods/core/icons/maximize_on.svg deleted file mode 100644 index af77a3e..0000000 --- a/mods/core/icons/maximize_on.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/core/icons/minimize.svg b/mods/core/icons/minimize.svg deleted file mode 100644 index d179e14..0000000 --- a/mods/core/icons/minimize.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/core/icons/question.svg b/mods/core/icons/question.svg deleted file mode 100644 index 3389568..0000000 --- a/mods/core/icons/question.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/core/icons/user.png b/mods/core/icons/user.png deleted file mode 100644 index 252c20d..0000000 Binary files a/mods/core/icons/user.png and /dev/null differ diff --git a/mods/core/icons/windows.ico b/mods/core/icons/windows.ico deleted file mode 100644 index 3f8a1c7..0000000 Binary files a/mods/core/icons/windows.ico and /dev/null differ diff --git a/mods/core/menu.css b/mods/core/menu.css deleted file mode 100644 index 412c901..0000000 --- a/mods/core/menu.css +++ /dev/null @@ -1,655 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -@import './css/buttons.css'; -@import './css/scrollbars.css'; - -@keyframes spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@keyframes fade { - from { - opacity: 0; - } - to { - opacity: 1; - } -} - -* { - box-sizing: border-box; - word-break: break-word; - text-decoration: none; - text-size-adjust: 100%; - font-family: var(--theme--font_sans); - outline-color: var(--theme--table-border); -} -html, -body { - width: 100%; - height: 100%; - margin: 0; - padding: 0; - display: block; - overflow: hidden; - background: var(--theme--main); - color: var(--theme--text); -} - -main { - padding: 1em 1em 2.9em 1em; - height: 100%; - overflow: auto; -} -main section { - border-radius: 2px; - margin-bottom: 0.75em; -} - -/* inline formatting */ - -code { - border-radius: 0.1em; - padding: 0.2em 0.4em; - font: 0.85em var(--theme--font_code); - background: var(--theme--code_inline-background); -} - -button { - color: var(--theme--text); -} - -u { - text-decoration: underline; -} -s { - text-decoration: line-through; -} - -/* titlebar */ - -#titlebar::before { - content: ''; - position: absolute; - width: 100%; - -webkit-app-region: no-drag; - top: 0; - left: 0; - height: 2px; -} - -#titlebar { - display: flex; - -webkit-app-region: drag; - background: var(--theme--dragarea); -} -#titlebar button { - -webkit-app-region: no-drag; -} -#titlebar .window-buttons-area { - margin: 0.4em 0.4em 0.4em auto; -} -#titlebar .window-buttons-area:empty { - display: none; -} -[data-platform='darwin'] #titlebar { - height: 2.65em; -} - -/* alerts */ - -#alerts [role='alert'] { - display: flex; - padding: 0.75em; - background: var(--theme--interactive_hover); - border: 1px solid var(--theme--interactive_hover-border); -} -#alerts [role='alert']::before { - content: '!'; - display: block; - /* margin: auto 0; */ - font-weight: bold; - font-size: 1.2em; - padding-right: 0.5rem; - color: var(--theme--interactive_hover-border); -} -#alerts [role='alert'] p { - font-size: 1rem; - margin: auto 0; - padding-left: 0.5em; - color: var(--theme--line_text); -} - -#alerts .error::before { - color: var(--theme--select_red); -} -#alerts .error { - color: var(--theme--line_red-text); - background: var(--theme--line_red); - border-color: var(--theme--select_red); -} -#alerts .warning::before { - color: var(--theme--select_yellow); -} -#alerts .warning { - color: var(--theme--line_yellow-text); - background: var(--theme--line_yellow); - border-color: var(--theme--select_yellow); -} -#alerts .info::before { - color: var(--theme--select_blue); -} -#alerts .info { - color: var(--theme--line_blue-text); - background: var(--theme--line_blue); - border-color: var(--theme--select_blue); -} -#alerts .success::before { - content: '✓'; - color: var(--theme--select_green); -} -#alerts .success { - color: var(--theme--line_green-text); - background: var(--theme--line_green); - border-color: var(--theme--select_green); -} - -#alerts code { - background: transparent; - text-decoration: underline; -} - -[data-action] { - text-decoration: underline dotted; - cursor: pointer; -} - -/* 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--text_ui_info); -} -#search > input { - width: 100%; - padding: 1em 1.4em 1em 2.8em; - font: 1em var(--theme--font_sans); - background: var(--theme--card); - border: 1px solid var(--theme--table-border); - color: var(--theme--text); - border-radius: 2px; -} -#search > input::placeholder { - font-weight: bold; - color: var(--theme--text_ui_info); -} -#search > input:focus { - box-shadow: var(--theme--table-border) 0.04em 0.04em, - var(--theme--table-border) -0.04em -0.04em, - var(--theme--table-border) -0.04em 0.04em, - var(--theme--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--option-background); - color: var(--theme--option-color); - border-radius: 2px; - transition: color 200ms, background 200ms, opacity 200ms; - user-select: none; -} -#search #tags > span:not(:last-child) { - margin-right: 0.5em; -} -#search #tags > span:hover { - background: var(--theme--option_hover-background); - color: var(--theme--option_hover-color); -} -#search #tags > span::before { - content: '× '; -} -#search #tags > .selected { - background: var(--tag_color, var(--theme--option_active-background)); - color: var(--theme--option_active-color); -} -#search #tags > .selected::before { - content: '✓ '; -} - -/* module meta */ - -#modules { - position: relative; -} -#modules section { - background: var(--theme--sidebar); - border: 1px solid var(--theme--table-border); -} -#modules section > div { - padding: 0.75em; -} -.notion-light-theme #modules section { - background: var(--theme--main); -} - -#modules section h3, -#modules section p { - margin: 0; - font-size: 1rem; -} - -#modules section .desc { - margin: 0.3em 0 0.4em 0; - font-size: 0.9em; -} -#modules section .desc p { - font-size: inherit; - margin: 0; -} -#modules section .desc blockquote { - margin: 0.3em 0; - border-left: 0.3em solid var(--theme--table-border); - padding-left: 0.7em; -} - -#modules section .desc a { - color: currentColor; - text-decoration: underline dotted; -} - -#modules section .desc img { - width: 100%; - max-width: 20em; - margin: 0.5em 0; -} -#modules section .desc :first-child img:first-child { - margin-top: 0; -} -#modules section .desc :last-child img:last-child { - margin-bottom: 0; -} - -#modules section .author { - color: currentColor; -} -#modules section .author img { - height: 1em; - width: 1em; - margin-bottom: 0.15625em; - display: inline-block; - vertical-align: middle; - border-radius: 50%; - object-fit: cover; -} -#modules section .tags, -#modules section .version { - font-size: 0.85em; - color: var(--theme--text_ui); -} - -/* module options */ - -#modules .disabled .options { - display: none; -} -#modules section .options { - border-top: 1px solid var(--theme--table-border); - background: var(--theme--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--table-border); - margin-bottom: 0.5em; -} - -svg[data-tooltip] { - height: 1em; - width: 1em; - margin: 0 0 -2px 1px; - color: var(--theme--text_ui_info); -} -#tooltip { - pointer-events: none; - position: absolute; - padding: 0.25em 0.5em 0.5em 0.5em; - margin: 0 1em; - border-radius: 3px; - box-shadow: var(--theme--box-shadow_strong); - border-right-width: 1px; - font-size: calc(var(--theme--font_label-size) * 0.8); - background: var(--theme--interactive_hover); - opacity: 0; - transition: opacity 120ms ease-in; -} -#tooltip.active { - opacity: 1; -} - -.toggle *, -.input *, -.select *, -.color *, -.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; - padding: 0.4rem 0.2rem; - border: none; - color: var(--theme--text); - background: var(--theme--main); -} -.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--table-border) solid 2px; -} -.file input[type='file'], -.toggle input[type='checkbox'] { - opacity: 0; - width: 0.1px; - height: 0.1px; - position: fixed; -} - -.input input[type='text'], -.input input[type='number'] { - padding: 0.4rem; - cursor: text; -} - -.file input[type='file'] + label .label { - position: relative; - display: flex; -} -.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--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; - --menu--toggle_bg: rgba(135, 131, 120, 0.3); -} -.toggle input[type='checkbox'] + label .name { - flex-basis: calc(100% - 2.25em); - margin-right: 0.75em; -} -.toggle input[type='checkbox'] + label .switch { - position: relative; - top: 0.2em; - float: right; - height: 1em; - width: 1.85em; - padding: 0.1em; - background: var(--menu--toggle_bg); - border-radius: 3.14em; - transition: background 300ms; -} -.toggle input[type='checkbox'] + label .switch::before { - content: ''; - display: block; - width: 0.8em; - height: 0.8em; - border-radius: 50%; - transform: translateX(var(--menu--toggle_offset, 0)); - transition: transform 350ms, box-shadow 350ms; - background: var(--theme--option_active-color); - /* box-shadow: 2px 1px 4px var(--theme--table-border); */ -} - -.toggle input[type='checkbox']:checked + label { - --menu--toggle_offset: 0.8em; - --menu--toggle_bg: var(--theme--primary); -} - -.color { - display: flex; -} -.color label { - flex-basis: 70%; -} -.color input[type='button'] { - flex-basis: 30%; - box-shadow: 2px 1px 4px var(--theme--table-border); - border: 1px solid var(--theme--option_active-color); - border-radius: 3px; - background: var(--configured--color-value); - margin: 0; -} -.color input[type='button']:focus { - box-shadow: 3px 2px 5px var(--theme--table-border); -} - -/* further-configuration popup */ - -#popup, -#popup-overlay { - position: absolute; - top: 0; - height: 100vh; - width: 100vw; -} -#popup { - display: none; -} -#popup.visible { - display: flex; - animation: fade 200ms ease; -} -#popup-overlay { - background: var(--theme--overlay); -} - -.colorPicker { - margin: auto; - position: relative; - border: 1px solid var(--theme--table-border); - background: var(--theme--card); -} - -.colorPicker .twod { - border-radius: 4px; -} -.colorPicker .twod .bg { - border-radius: 2px; -} -.colorPicker .oned, -.colorPicker .oned .bg { - margin-left: 0; - height: 212.5px; -} -.colorPicker .oned .bg { - border-radius: 4px; - border: 1px solid var(--theme--table-border); -} -.colorPicker > button { - display: block; - position: absolute; - bottom: 8px; - right: 8px; - margin: 0; - padding: 0; - border: none; - width: 21px; - height: 20px; - cursor: pointer; - background: transparent; - transition: background 0.2s; -} -.colorPicker > button::after { - content: '×'; - font-size: 1.5em; - position: relative; - bottom: 5px; -} -.colorPicker > button:hover { - background: var(--theme--interactive_hover); - border-radius: 4px; - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border); -} -.colorPicker > button:focus { - outline: none; - box-shadow: 0 0 0 1px var(--theme--table-border); -} -.colorPicker .twod .pointer .shape.shape1 { - width: 11px; - height: 11px; -} -.colorPicker .twod .pointer .shape.shape2 { - width: 9px; - height: 9px; -} -.colorPicker .oned .pointer .shape { - height: 6.5px; - margin-left: 0; - border: 2px solid #fff; - box-shadow: 0 0 0 1px #000; -} -.shape { - cursor: pointer; -} - -@media (max-width: 300px) { - .colorPicker .twod, - .colorPicker .twod .bg { - width: 200px; - height: 200px; - } - .colorPicker .oned, - .colorPicker .oned .bg { - height: 172.5px; - } -} -@media (max-width: 250px) { - .colorPicker .twod, - .colorPicker .twod .bg { - width: 150px; - height: 150px; - } - .colorPicker .oned, - .colorPicker .oned .bg { - height: 132.5px; - } -} - -/* draggable re-ordering of mods */ - -#draggable-toggle { - background: none; - border: none; - margin-top: 0.8em; - padding-left: 0; - cursor: pointer; - color: var(--theme--text_ui); -} - -[data-bolded] { - display: inline-flex; - flex-direction: column; -} -[data-bolded]::after { - content: attr(data-bolded); - height: 0; - visibility: hidden; - overflow: hidden; - user-select: none; - pointer-events: none; - font-weight: bold; -} - -.reorder #search #tags > span, -.reorder #search #tags > span:hover, -.conflict #search #tags > span, -.conflict #search #tags > span:hover { - opacity: 0.7; - background: var(--theme--option-background); -} -.reorder #search #tags > .selected, -.reorder #search #tags > .selected:hover, -.conflict #search #tags > .selected, -.conflict #search #tags > .selected:hover { - background: var(--tag_color, var(--theme--option_active-background)); -} - -.reorder #modules .dragged-over::after { - content: ''; - height: 0.25em; - width: 99%; - position: absolute; - margin: 0.3em 0; - opacity: 0.7; - background: var(--theme--selected); -} - -.reorder #modules .switch, -.reorder #modules .tags, -.reorder #modules .desc, -.reorder #modules .options, -.reorder #modules .author, -.reorder #modules .version { - display: none; -} -.reorder #modules .core .toggle * { - cursor: text; -} -.reorder #modules section:not(.core) label::before { - content: '::'; - margin-right: 0.4em; - color: var(--theme--text_ui); -} diff --git a/mods/core/menu.html b/mods/core/menu.html deleted file mode 100644 index 8369d30..0000000 --- a/mods/core/menu.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - notion-enhancer menu - - - - - -
-
-
- -
-
- - - - - diff --git a/mods/core/mod.js b/mods/core/mod.js deleted file mode 100644 index f38e99f..0000000 --- a/mods/core/mod.js +++ /dev/null @@ -1,103 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082', - alwaysActive: true, - tags: ['core'], - name: 'notion-enhancer core', - desc: 'the cli, modloader, menu, & tray.', - version: require('../../package.json').version, - author: 'dragonwocky', - options: [ - { - key: 'autoresolve', - label: 'auto-resolve theme conflicts', - desc: - 'when a theme is enabled any other themes of the same mode (light/dark) will be disabled.', - type: 'toggle', - value: false, - }, - { - key: 'openhidden', - label: 'hide app on open', - desc: - 'app can be made visible by clicking the tray icon or using the hotkey.', - type: 'toggle', - value: false, - }, - { - key: 'maximized', - label: 'auto-maximise windows', - desc: - 'whenever a window is un-hidden or is created it will be maximised.', - type: 'toggle', - value: false, - }, - { - key: 'close_to_tray', - label: 'close window to the tray', - desc: `pressing the × close button will hide the app instead of quitting it.\ - it can be re-shown by clicking the tray icon or using the hotkey.`, - type: 'toggle', - value: true, - platformOverwrite: { - darwin: true, - }, - }, - { - key: 'frameless', - label: 'integrated titlebar', - desc: `replace the native titlebar with buttons inset into the app.`, - type: 'toggle', - value: true, - platformOverwrite: { - darwin: false, - }, - }, - { - key: 'tiling_mode', - label: 'tiling window manager mode', - desc: `completely remove the close/minimise/maximise buttons - - this is for a special type of window manager. if you don't understand it, don't use it.`, - type: 'toggle', - value: false, - }, - { - key: 'hotkey', - label: 'window display hotkey:', - desc: 'used to toggle hiding/showing all app windows.', - type: 'input', - value: 'CommandOrControl+Shift+A', - }, - { - key: 'menu_toggle', - label: 'open enhancements menu hotkey:', - desc: 'used to toggle opening/closing this menu while notion is focused.', - type: 'input', - value: 'Alt+E', - }, - { - key: 'default_page', - label: 'default page id/url:', - desc: `every new tab/window that isn't opening a url via the notion://\ - protocol will load this page. to get a page link from within the app,\ - go to the triple-dot menu and click "copy link".\ - leave blank to just load the last page you opened.`, - type: 'input', - value: '', - }, - ], - hacks: { - 'main/main.js': require('./tray.js'), - 'main/systemMenu.js': require('./systemMenu.js'), - 'main/createWindow.js': require('./createWindow.js'), - 'renderer/index.js': require('./render.js'), - 'renderer/preload.js': require('./client.js'), - }, -}; diff --git a/mods/core/render.js b/mods/core/render.js deleted file mode 100644 index cfc1857..0000000 --- a/mods/core/render.js +++ /dev/null @@ -1,1066 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const url = require('url'), - path = require('path'), - electron = require('electron'), - fs = require('fs-extra'), - { - getNotionResources, - getEnhancements, - createElement, - } = require('../../pkg/helpers.js'), - __notion = getNotionResources(), - config = require(`${__notion}/app/config.js`), - constants = require(`${__notion}/app/shared/constants.js`), - notion_intl = require(`${__notion}/app/shared/notion-intl/index.js`), - notionIpc = require(`${__notion}/app/helpers/notionIpc.js`), - localizationHelper = require(`${__notion}/app/helpers/localizationHelper.js`), - koMessages = require(`${__notion}/app/i18n/ko_KR/messages.json`), - schemeHelpers = require(`${__notion}/app/shared/schemeHelpers.js`), - React = require(`${__notion}/app/node_modules/react/index.js`), - ReactDOM = require(`${__notion}/app/node_modules/react-dom/index.js`), - { toKeyEvent } = require('keyboardevent-from-electron-accelerator'); - -const insertCSP = `{ - const csp = document.createElement('meta'); - csp.httpEquiv = 'Content-Security-Policy'; - csp.content = "script-src 'self' 'unsafe-inline' 'unsafe-eval' enhancement: https://gist.github.com https://apis.google.com https://api.amplitude.com https://widget.intercom.io https://js.intercomcdn.com https://logs-01.loggly.com https://cdn.segment.com https://analytics.pgncs.notion.so https://checkout.stripe.com https://embed.typeform.com https://admin.typeform.com https://platform.twitter.com https://cdn.syndication.twimg.com; connect-src 'self' https://msgstore.www.notion.so wss://msgstore.www.notion.so https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com https: http: https://api.amplitude.com https://api.embed.ly https://js.intercomcdn.com https://api-iam.intercom.io wss://nexus-websocket-a.intercom.io https://logs-01.loggly.com https://api.segment.io https://api.pgncs.notion.so https://checkout.stripe.com https://cdn.contentful.com https://preview.contentful.com https://images.ctfassets.net https://api.unsplash.com https://boards-api.greenhouse.io; font-src 'self' data: enhancement: https: http:; img-src 'self' data: blob: https: https://platform.twitter.com https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com; style-src 'self' 'unsafe-inline' enhancement: https: http:; frame-src https: http:; media-src https: http:"; - document.head.appendChild(csp); -}`, - idToNotionURL = (id) => - `notion://www.notion.so/${ - url.parse(id).pathname.split('/').reverse()[0] || '' - }/${url.parse(id).search || ''}`; - -module.exports = (store, __exports) => { - if ((store('mods')['e1692c29-475e-437b-b7ff-3eee872e1a42'] || {}).enabled) { - class Index extends React.PureComponent { - constructor() { - super(...arguments); - this.state = { - error: false, - searching: false, - searchingPeekView: false, - zoomFactor: 1, - tabs: new Map([[0, { title: 'notion.so', open: true }]]), - slideIn: new Set(), - slideOut: new Set(), - }; - this.$titlebar = null; - this.$dragging = null; - this.views = { - active: null, - current: { - $el: () => this.views.html[this.views.current.id], - id: 0, - }, - react: {}, - html: {}, - loaded: {}, - tabs: {}, - }; - this.$search = null; - this.handleReload = () => { - this.setState({ error: false }); - Object.values(this.views.html).forEach(($notion) => { - if ($notion.isWaitingForResponse()) $notion.reload(); - }); - }; - this.communicateWithView = this.communicateWithView.bind(this); - this.startSearch = this.startSearch.bind(this); - this.stopSearch = this.stopSearch.bind(this); - this.nextSearch = this.nextSearch.bind(this); - this.prevSearch = this.prevSearch.bind(this); - this.clearSearch = this.clearSearch.bind(this); - this.doneSearch = this.doneSearch.bind(this); - - // draggable re-ordering - const getTab = ($el) => { - if ($el.tagName !== 'BUTTON') $el = $el.parentElement; - if ($el.innerText === '+') - return [null, document.querySelector('.tab.new')]; - const tab = Object.entries(this.views.tabs).find( - ([id, $node]) => $node === $el - ); - return tab ? [+tab[0], tab[1]] : []; - }; - document.addEventListener('dragstart', (event) => { - if (!this.$titlebar) return; - const tab = getTab(event.target); - this.$dragging = tab[0]; - event.dataTransfer.setData( - 'text', - JSON.stringify({ - target: electron.remote.getCurrentWindow().webContents.id, - tab: tab[0], - title: tab[1].children[0].innerText, - url: document.getElementById(getTab(event.target)[0]).src, - }) - ); - event.target.style.opacity = 0.5; - }); - document.addEventListener('dragend', (event) => { - if (!this.$titlebar) return; - event.target.style.opacity = ''; - document - .querySelectorAll('.dragged-over') - .forEach((el) => el.classList.remove('dragged-over')); - }); - document.addEventListener('dragover', (event) => { - if (!this.$titlebar) return; - event.preventDefault(); - document - .querySelectorAll('.dragged-over') - .forEach((el) => el.classList.remove('dragged-over')); - const tab = getTab(event.target)[1]; - if (tab) tab.classList.add('dragged-over'); - }); - document.addEventListener('drop', async (event) => { - event.preventDefault(); - const eventData = JSON.parse(event.dataTransfer.getData('text')); - if ( - eventData.target !== - electron.remote.getCurrentWindow().webContents.id - ) { - electron.ipcRenderer.send( - 'enhancer:close-tab', - eventData.target, - eventData.tab - ); - this.$dragging = await this.newTab( - eventData.url, - eventData.title, - false - ); - } - if (this.$titlebar) { - const from = getTab(this.views.tabs[+this.$dragging]), - to = getTab(event.target); - if (from[0] !== to[0]) { - if (to[1].classList.contains('new')) { - const list = new Map(this.state.tabs); - list.delete(from[0]); - list.set(from[0], this.state.tabs.get(from[0])); - this.setState({ tabs: list }); - } else { - const list = [...this.state.tabs], - fromIndex = list.findIndex( - ([id, { title, open }]) => id === from[0] - ), - toIndex = list.findIndex( - ([id, { title, open }]) => id === to[0] - ); - list.splice( - toIndex > fromIndex ? toIndex - 1 : toIndex, - 0, - list.splice(fromIndex, 1)[0] - ); - this.setState({ tabs: new Map(list) }); - } - } - this.$dragging = null; - } - }); - electron.ipcRenderer.on('enhancer:close-tab', (event, tab) => { - this.closeTab(tab); - }); - } - - componentDidMount() { - const buttons = require('./buttons.js')(store); - this.$titlebar.appendChild(buttons.element); - this.loadListeners(); - - let electronWindow; - try { - electronWindow = electron.remote.getCurrentWindow(); - } catch (error) { - notionIpc.sendToMain('notion:log-error', { - level: 'error', - from: 'index', - type: 'GetCurrentWindowError', - error: error.message, - }); - } - if (!electronWindow) { - this.setState({ error: true }); - this.handleReload(); - return; - } - electronWindow.addListener('app-command', (e, cmd) => { - if (cmd === 'browser-backward' && webContents.canGoBack()) { - this.views.current.$el().goBack(); - } else if (cmd === 'browser-forward' && webContents.canGoForward()) { - this.views.current.$el().goForward(); - } - }); - electronWindow.addListener('swipe', (e, dir) => { - if (dir === 'left' && webContents.canGoBack()) { - this.views.current.$el().goBack(); - } else if (dir === 'right' && webContents.canGoForward()) { - this.views.current.$el().goForward(); - } - }); - electronWindow.addListener('focus', (e) => { - this.views.current.$el().focus(); - }); - } - - newTab(url = '', title = 'notion.so', animate = true) { - let id = 0; - const list = new Map(this.state.tabs); - while (this.state.tabs.get(id) && this.state.tabs.get(id).open) id++; - list.delete(id); - return this.openTab(id, { - state: list, - load: url || true, - title, - animate, - }); - } - openTab( - id, - { - state = new Map(this.state.tabs), - slideOut = new Set(this.state.slideOut), - load, - animate, - title = 'notion.so', - } = { - state: new Map(this.state.tabs), - slideOut: new Set(this.state.slideOut), - load: false, - title: 'notion.so', - animate: false, - } - ) { - return new Promise((res, rej) => { - if (!id && id !== 0) { - if (state.get(this.views.current.id).open) return res(id); - const currentIndex = [...state].findIndex( - ([id, { title, open }]) => id === this.views.current.id - ); - id = ([...state].find( - ([id, { title, open }], tabIndex) => - open && tabIndex > currentIndex - ) || [...state].find(([id, { title, open }]) => open))[0]; - } - const current_src = this.views.current.$el().src; - this.views.current.id = id; - this.setState( - { - tabs: state.set(id, { - title: state.get(id) ? state.get(id).title : title, - open: true, - }), - slideIn: animate - ? this.state.slideIn.add(id) - : this.state.slideIn, - slideOut: slideOut, - }, - async () => { - this.focusTab(); - new Promise((resolve, reject) => { - let attempt, - clear = () => { - clearInterval(attempt); - return true; - }; - attempt = setInterval(() => { - if (this.views.current.id !== id) return clear() && reject(); - if (document.body.contains(this.views.html[id])) - return clear() && resolve(); - }, 50); - }) - .then(() => { - if (load) { - this.views.html[id].style.opacity = '0'; - let unhide; - unhide = () => { - this.views.html[id].style.opacity = ''; - this.views.html[id].removeEventListener( - 'did-stop-loading', - unhide - ); - }; - this.views.html[id].addEventListener( - 'did-stop-loading', - unhide - ); - this.views.html[id].loadURL( - typeof load === 'string' - ? load - : store().default_page - ? idToNotionURL(store().default_page) - : current_src - ); - } - }) - .catch(() => { - // nothing - }) - .finally(() => { - setTimeout(() => { - this.setState( - { slideIn: new Set(), slideOut: new Set() }, - () => res(id) - ); - }, 150); - }); - } - ); - }); - } - closeTab(id) { - if ((!id && id !== 0) || !this.state.tabs.get(id)) return; - const list = new Map(this.state.tabs); - list.set(id, { ...list.get(id), open: false }); - if (![...list].filter(([id, { title, open }]) => open).length) - return electron.remote.getCurrentWindow().close(); - return this.openTab( - this.views.current.id === id ? null : this.views.current.id, - { state: list, slideOut: this.state.slideOut.add(id) } - ); - } - focusTab() { - if (this.views.active === this.views.current.id) return; - this.loadListeners(); - this.blurListeners(); - this.focusListeners(); - for (const id in this.views.loaded) { - if (this.views.loaded.hasOwnProperty(id) && this.views.loaded[id]) { - const selected = - id == this.views.current.id && - this.state.tabs.get(+id) && - this.state.tabs.get(+id).open; - this.views.loaded[id].style.display = selected ? 'flex' : 'none'; - if (selected) { - this.views.active = +id; - this.views.loaded[id].focus(); - const electronWindow = electron.remote.getCurrentWindow(), - title = - (this.state.tabs.get(+id).emoji - ? `${this.state.tabs.get(+id).emoji} ` - : '') + (this.state.tabs.get(+id).text || 'Notion Desktop'); - if (electronWindow && electronWindow.getTitle() !== title) - electronWindow.setTitle(title); - } - } - } - } - selectTab(num) { - if (num === 'ArrowLeft') { - const prev = document.querySelector('.tab.current') - .previousElementSibling; - if (prev) prev.click(); - } else if (num === 'ArrowRight') { - const next = document.querySelector('.tab.current') - .nextElementSibling; - if (next && !next.classList.contains('new')) next.click(); - } else { - num = +num; - if (num == 9) { - document - .querySelector('#tabs') - .children[ - document.querySelector('#tabs').children.length - 2 - ].click(); - } else if ( - document.querySelector('#tabs').children[num - 1] && - document.querySelector('#tabs').children.length > num - ) { - document.querySelector('#tabs').children[num - 1].click(); - } - } - } - - communicateWithView(event) { - switch (event.channel) { - case 'enhancer:set-tab-title': - if (this.state.tabs.get(+event.target.id)) { - this.setState({ - tabs: new Map( - this.state.tabs.set(+event.target.id, { - ...this.state.tabs.get(+event.target.id), - title: event.args[0], - }) - ), - }); - const electronWindow = electron.remote.getCurrentWindow(), - title = - (event.args[0].emoji ? `${event.args[0].emoji} ` : '') + - (event.args[0].text || 'Notion Desktop'); - if ( - event.target.id == this.views.current.id && - electronWindow.getTitle() !== title - ) - electronWindow.setTitle(title); - } - break; - case 'enhancer:select-tab': - this.selectTab(event.args[0]); - break; - case 'enhancer:new-tab': - this.newTab(event.args[0]); - break; - case 'enhancer:close-tab': - this.closeTab( - event.args[0] || event.args[0] === 0 - ? event.args[0] - : this.views.current.id - ); - break; - } - } - startSearch(isPeekView) { - this.setState( - { - searching: true, - searchingPeekView: isPeekView, - }, - () => { - if (document.activeElement instanceof HTMLElement) - document.activeElement.blur(); - this.$search.focus(); - notionIpc.sendIndexToSearch(this.$search, 'search:start'); - notionIpc.sendIndexToNotion(this.$search, 'search:started'); - } - ); - } - stopSearch() { - notionIpc.sendIndexToSearch(this.$search, 'search:reset'); - this.setState({ - searching: false, - }); - this.lastSearchQuery = undefined; - this.views.current - .$el() - - .stopFindInPage('clearSelection'); - notionIpc.sendIndexToNotion(this.views.current.$el(), 'search:stopped'); - } - nextSearch(query) { - this.views.current - .$el() - - .findInPage(query, { - forward: true, - findNext: query === this.lastSearchQuery, - }); - this.lastSearchQuery = query; - } - prevSearch(query) { - this.views.current - .$el() - - .findInPage(query, { - forward: false, - findNext: query === this.lastSearchQuery, - }); - this.lastSearchQuery = query; - } - clearSearch() { - this.lastSearchQuery = undefined; - this.views.current - .$el() - - .stopFindInPage('clearSelection'); - } - doneSearch() { - this.lastSearchQuery = undefined; - this.views.current - .$el() - - .stopFindInPage('clearSelection'); - this.setState({ searching: false }); - if (document.activeElement instanceof HTMLElement) { - document.activeElement.blur(); - } - this.views.current.$el().focus(); - notionIpc.sendIndexToNotion(this.views.current.$el(), 'search:stopped'); - } - focusListeners() { - if (!this.views.current.$el() || !this.$search) return; - this.views.current - .$el() - .addEventListener('ipc-message', this.communicateWithView); - notionIpc.receiveIndexFromNotion.addListener( - this.views.current.$el(), - 'search:start', - this.startSearch - ); - notionIpc.receiveIndexFromNotion.addListener( - this.views.current.$el(), - 'search:stop', - this.stopSearch - ); - notionIpc.receiveIndexFromSearch.addListener( - this.$search, - 'search:next', - this.nextSearch - ); - notionIpc.receiveIndexFromSearch.addListener( - this.$search, - 'search:prev', - this.prevSearch - ); - notionIpc.receiveIndexFromSearch.addListener( - this.$search, - 'search:clear', - this.clearSearch - ); - notionIpc.receiveIndexFromSearch.addListener( - this.$search, - 'search:stop', - this.doneSearch - ); - } - blurListeners() { - if (!this.views.current.$el() || !this.$search) return; - if (this.state.searching) this.stopSearch(); - this.views.current - .$el() - .removeEventListener('ipc-message', this.communicateWithView); - notionIpc.receiveIndexFromNotion.removeListener( - this.views.current.$el(), - 'search:start', - this.startSearch - ); - notionIpc.receiveIndexFromNotion.removeListener( - this.views.current.$el(), - 'search:stop', - this.stopSearch - ); - notionIpc.receiveIndexFromSearch.removeListener( - this.$search, - 'search:next', - this.nextSearch - ); - notionIpc.receiveIndexFromSearch.removeListener( - this.$search, - 'search:prev', - this.prevSearch - ); - notionIpc.receiveIndexFromSearch.removeListener( - this.$search, - 'search:clear', - this.clearSearch - ); - notionIpc.receiveIndexFromSearch.removeListener( - this.$search, - 'search:stop', - this.doneSearch - ); - } - loadListeners() { - if (!this.$search) return; - Object.entries(this.views.html) - .filter(([id, $notion]) => !this.views.loaded[id] && $notion) - .forEach(([id, $notion]) => { - if (!$notion) return; - this.views.loaded[id] = $notion; - $notion.addEventListener('did-fail-load', (error) => { - // logger.info('Failed to load:', error); - if ( - error.errorCode === -3 || - !error.validatedURL.startsWith( - schemeHelpers.getSchemeUrl({ - httpUrl: config.default.baseURL, - protocol: config.default.protocol, - }) - ) - ) { - return; - } - this.setState({ error: true }); - }); - $notion.addEventListener('dom-ready', () => { - // $notion.executeJavaScript(insertCSP); - electron.remote.webContents - .fromId($notion.getWebContentsId()) - .addListener('found-in-page', (event, result) => { - const matches = result - ? { - count: result.matches, - index: result.activeMatchOrdinal, - } - : { count: 0, index: 0 }; - notionIpc.sendIndexToSearch( - this.$search, - 'search:result', - matches - ); - }); - notionIpc.proxyAllMainToNotion($notion); - }); - notionIpc.receiveIndexFromNotion.addListener( - $notion, - 'search:set-theme', - (theme) => { - notionIpc.sendIndexToSearch( - this.$search, - 'search:set-theme', - theme - ); - } - ); - notionIpc.receiveIndexFromNotion.addListener( - $notion, - 'zoom', - (zoomFactor) => { - $notion.setZoomFactor(zoomFactor); - this.$search.setZoomFactor(zoomFactor); - this.setState({ zoomFactor }); - } - ); - let electronWindow; - try { - electronWindow = electron.remote.getCurrentWindow(); - } catch (error) { - notionIpc.sendToMain('notion:log-error', { - level: 'error', - from: 'index', - type: 'GetCurrentWindowError', - error: error.message, - }); - } - if (!electronWindow) { - this.setState({ error: true }); - this.handleReload(); - return; - } - const sendFullScreenChangeEvent = () => { - notionIpc.sendIndexToNotion( - $notion, - 'notion:full-screen-changed' - ); - }; - electronWindow.addListener( - 'enter-full-screen', - sendFullScreenChangeEvent - ); - electronWindow.addListener( - 'leave-full-screen', - sendFullScreenChangeEvent - ); - electronWindow.addListener( - 'enter-html-full-screen', - sendFullScreenChangeEvent - ); - electronWindow.addListener( - 'leave-html-full-screen', - sendFullScreenChangeEvent - ); - }); - } - - renderTitlebar() { - return React.createElement( - 'header', - { - id: 'titlebar', - ref: ($titlebar) => { - this.$titlebar = $titlebar; - }, - onClick: (e) => { - this.views.current.$el().focus(); - }, - }, - React.createElement('button', { - id: 'open-enhancer-menu', - onClick: (e) => { - electron.ipcRenderer.send('enhancer:open-menu'); - }, - }), - React.createElement( - 'div', - { id: 'tabs' }, - ...[...this.state.tabs] - .filter( - ([id, { title, open }]) => open || this.state.slideOut.has(id) - ) - .map(([id, { title, open }]) => - React.createElement( - 'button', - { - className: - 'tab' + - (id === this.views.current.id ? ' current' : '') + - (this.state.slideIn.has(id) ? ' slideIn' : '') + - (this.state.slideOut.has(id) ? ' slideOut' : ''), - draggable: true, - onClick: (e) => { - if (!e.target.classList.contains('close')) - this.openTab(id); - }, - onMouseUp: (e) => { - if (window.event.which === 2) this.closeTab(id); - }, - ref: ($tab) => { - this.views.tabs[id] = $tab; - }, - }, - React.createElement('span', { - dangerouslySetInnerHTML: { - __html: (title.img || '') + (title.text || 'notion.so'), - }, - }), - React.createElement( - 'span', - { - className: 'close', - onClick: () => { - this.closeTab(id); - }, - }, - '×' - ) - ) - ), - React.createElement( - 'button', - { - className: 'tab new', - onClick: () => { - this.newTab(); - }, - }, - React.createElement('span', {}, '+') - ) - ) - ); - } - renderNotionContainer() { - this.views.react = Object.fromEntries( - [...this.state.tabs].map(([id, { title, open }]) => { - return [ - id, - this.views.react[id] || - React.createElement('webview', { - className: 'notion', - id, - ref: ($notion) => { - this.views.html[id] = $notion; - this.focusTab(); - }, - partition: constants.electronSessionPartition, - preload: path.resolve(`${__notion}/app/renderer/preload.js`), - src: this.props.notionUrl, - webpreferences: 'spellcheck=yes, enableremotemodule=yes', - }), - ]; - }) - ); - return React.createElement( - 'div', - { - style: { - flexGrow: 1, - display: this.state.error ? 'none' : 'flex', - }, - }, - ...Object.values(this.views.react) - ); - } - renderSearchContainer() { - return React.createElement( - 'div', - { - style: { - position: 'fixed', - overflow: 'hidden', - pointerEvents: 'none', - padding: '0 20px', - top: - (this.state.searchingPeekView - ? 0 - : process.platform === 'darwin' - ? 37 - : 45) * this.state.zoomFactor, - right: (48 - 24) * this.state.zoomFactor, - width: 460 * this.state.zoomFactor, - height: 72 * this.state.zoomFactor, - zIndex: 99, - }, - }, - React.createElement('webview', { - id: 'search', - style: { - width: '100%', - height: '100%', - transition: `transform 70ms ease-${ - this.state.searching ? 'out' : 'in' - }`, - transform: `translateY(${this.state.searching ? '0' : '-100'}%)`, - pointerEvents: this.state.searching ? 'auto' : 'none', - }, - ref: ($search) => { - this.$search = $search; - this.focusTab(); - }, - partition: constants.electronSessionPartition, - preload: `file://${path.resolve( - `${__notion}/app/renderer/search.js` - )}`, - src: `file://${path.resolve( - `${__notion}/app/renderer/search.html` - )}`, - webpreferences: 'spellcheck=no, enableremotemodule=yes', - }) - ); - } - renderErrorContainer() { - return React.createElement( - 'div', - { - style: { - position: 'fixed', - top: 0, - left: 0, - right: 0, - bottom: 0, - display: this.state.error ? 'flex' : 'none', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - padding: 24, - paddingBottom: '8vh', - }, - }, - React.createElement('img', { - style: { - width: 300, - maxWidth: '100%', - }, - src: './onboarding-offline.png', - }), - React.createElement( - 'div', - { - style: { - paddingTop: 16, - paddingBottom: 16, - textAlign: 'center', - lineHeight: 1.4, - fontSize: 17, - letterSpacing: '-0.01em', - color: '#424241', - fontWeight: 500, - }, - }, - React.createElement( - 'div', - null, - React.createElement(notion_intl.FormattedMessage, { - id: 'desktopLogin.offline.title', - defaultMessage: 'Welcome to Notion!', - values: { - strong: (...chunks) => - React.createElement('strong', null, chunks), - }, - }) - ), - React.createElement( - 'div', - null, - React.createElement(notion_intl.FormattedMessage, { - id: 'desktopLogin.offline.message', - defaultMessage: 'Connect to the internet to get started.', - }) - ) - ), - React.createElement( - 'div', - null, - React.createElement( - 'button', - { - style: { - background: '#fefaf8', - border: '1px solid #f1cbca', - boxSizing: 'border-box', - boxShadow: '0px 1px 2px rgba(0, 0, 0, 0.1)', - borderRadius: 3, - lineHeight: 'normal', - fontSize: 14, - fontWeight: 600, - letterSpacing: '-0.03em', - color: '#d8615c', - paddingLeft: 12, - paddingRight: 12, - height: 36, - }, - onClick: this.handleReload, - }, - React.createElement(notion_intl.FormattedMessage, { - id: - 'desktopLogin.offline.retryConnectingToInternetButton.label', - defaultMessage: 'Try again', - }) - ) - ) - ); - } - render() { - const notionLocale = localizationHelper.getNotionLocaleFromElectronLocale( - window.navigator.language - ), - result = React.createElement( - notion_intl.IntlProvider, - { - locale: notionLocale, - messages: - notionLocale === 'ko-KR' - ? koMessages - : { - 'desktopLogin.offline.title': - 'Welcome to Notion!', - 'desktopLogin.offline.message': - 'Connect to the internet to get started.', - 'desktopLogin.offline.retryConnectingToInternetButton.label': - 'Try again', - }, - }, - this.renderTitlebar(), - this.renderNotionContainer(), - this.renderSearchContainer(), - this.renderErrorContainer() - ); - document.body.classList[this.state.error ? 'add' : 'remove']('error'); - this.loadListeners(); - return result; - } - } - - window['__start'] = () => { - document.body.className = 'notion-dark-theme'; - document.body.setAttribute('data-platform', process.platform); - - const modules = getEnhancements(); - for (let mod of modules.loaded) { - for (let font of mod.fonts || []) { - document - .querySelector('head') - .appendChild( - createElement(``) - ); - } - } - - for (let mod of modules.loaded) { - if ( - mod.alwaysActive || - store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled - ) { - const fileExists = (file) => fs.pathExistsSync(path.resolve(file)); - for (let sheet of ['tabs', 'variables']) { - if (fileExists(`${__dirname}/../${mod.dir}/${sheet}.css`)) { - document.head.appendChild( - createElement( - `` - ) - ); - } - } - } - } - electron.ipcRenderer.on('enhancer:set-app-theme', (event, theme) => { - document.body.className = `notion-${theme}-theme`; - }); - - const parsed = url.parse(window.location.href, true), - notionUrl = - parsed.query.path || - (store().default_page - ? idToNotionURL(store().default_page) - : schemeHelpers.getSchemeUrl({ - httpUrl: config.default.baseURL, - protocol: config.default.protocol, - })); - delete parsed.search; - delete parsed.query; - const plainUrl = url.format(parsed); - window.history.replaceState(undefined, undefined, plainUrl); - - document.title = localizationHelper - .createIntlShape( - localizationHelper.getNotionLocaleFromElectronLocale( - window.navigator.language - ) - ) - .formatMessage( - notion_intl.defineMessages({ - documentTitle: { - id: 'desktop.documentTitle', - defaultMessage: 'Notion Desktop', - }, - }).documentTitle - ); - const $root = document.getElementById('root'); - ReactDOM.render( - React.createElement(Index, { notionUrl: notionUrl }), - $root - ); - }; - } else { - const __start = window['__start']; - window['__start'] = () => { - __start(); - - if (store().default_page) { - new Promise((res, rej) => { - let attempt; - attempt = setInterval(() => { - if ( - !document.getElementById('notion') || - !document.getElementById('notion').loadURL - ) - return; - clearInterval(attempt); - res(); - }, 50); - }).then(() => { - if ( - document.getElementById('notion').getAttribute('src') === - 'notion://www.notion.so' && - idToNotionURL(store().default_page) - ) { - document - .getElementById('notion') - .loadURL(idToNotionURL(store().default_page)); - } - }); - } - - const dragarea = document.querySelector( - '#root [style*="-webkit-app-region: drag"]' - ), - default_styles = dragarea.getAttribute('style'); - if (store().tiling_mode) { - dragarea.style.display = 'none'; - } else { - document - .getElementById('notion') - .addEventListener('ipc-message', (event) => { - if (event.channel !== 'enhancer:sidebar-width') return; - dragarea.setAttribute( - 'style', - `${default_styles} top: 2px; height: ${ - store('cf8a7b27-5a4c-4d45-a4cb-1d2bbc9e9014').dragarea_height - }px; left: ${event.args[0]};` - ); - }); - - document.getElementById('notion').addEventListener('dom-ready', () => { - // document.getElementById('notion').executeJavaScript(insertCSP); - }); - } - }; - } -}; diff --git a/mods/core/systemMenu.js b/mods/core/systemMenu.js deleted file mode 100644 index 82fb7bd..0000000 --- a/mods/core/systemMenu.js +++ /dev/null @@ -1,477 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -module.exports = (store, __exports) => { - const electron = require('electron'), - fs = require('fs-extra'), - { getNotionResources } = require('../../pkg/helpers.js'), - __notion = getNotionResources(), - createWindow = require(`${__notion}/app/main/createWindow.js`), - config = require(`${__notion}/app/config.js`), - notion_intl = require(`${__notion}/app/shared/notion-intl/index.js`), - localizationHelper = require(`${__notion}/app/helpers/localizationHelper.js`), - isMac = process.platform === 'darwin', - // why is it inversed? i have no idea, but for some reason this is what works - tabsEnabled = !(store('mods')['e1692c29-475e-437b-b7ff-3eee872e1a42'] || {}) - .enabled, - menuMessages = notion_intl.defineMessages({ - fileMenuTitle: { - id: 'desktopTopbar.fileMenu.title', - defaultMessage: 'File', - }, - editMenuTitle: { - id: 'desktopTopbar.editMenu.title', - defaultMessage: 'Edit', - }, - viewMenuTitle: { - id: 'desktopTopbar.viewMenu.title', - defaultMessage: 'View', - }, - windowMenuTitle: { - id: 'desktopTopbar.windowMenu.title', - defaultMessage: 'Window', - }, - helpTitle: { - id: 'desktopTopbar.helpMenu.title', - defaultMessage: 'Help', - }, - newWindow: { - id: 'desktopTopbar.fileMenu.newWindow', - defaultMessage: 'New Window', - }, - closeWindow: { - id: 'desktopTopbar.fileMenu.close', - defaultMessage: 'Close Window', - }, - quit: { - id: 'desktopTopbar.fileMenu.quit', - defaultMessage: 'Exit', - }, - undo: { - id: 'desktopTopbar.editMenu.undo', - defaultMessage: 'Undo', - }, - redo: { - id: 'desktopTopbar.editMenu.redo', - defaultMessage: 'Redo', - }, - cut: { - id: 'desktopTopbar.editMenu.cut', - defaultMessage: 'Cut', - }, - copy: { - id: 'desktopTopbar.editMenu.copy', - defaultMessage: 'Copy', - }, - paste: { - id: 'desktopTopbar.editMenu.paste', - defaultMessage: 'Paste', - }, - selectAll: { - id: 'desktopTopbar.editMenu.selectAll', - defaultMessage: 'Select All', - }, - startSpeaking: { - id: 'desktopTopbar.editMenu.speech.startSpeaking', - defaultMessage: 'Start Speaking', - }, - stopSpeaking: { - id: 'desktopTopbar.editMenu.speech.stopSpeaking', - defaultMessage: 'Stop Speaking', - }, - speech: { - id: 'desktopTopbar.editMenu.speech', - defaultMessage: 'Speech', - }, - reload: { - id: 'desktopTopbar.viewMenu.reload', - defaultMessage: 'Reload', - }, - togglefullscreen: { - id: 'desktopTopbar.viewMenu.togglefullscreen', - defaultMessage: 'Toggle Full Screen', - }, - toggleDevTools: { - id: 'desktopTopbar.toggleDevTools', - defaultMessage: 'Toggle Developer Tools', - }, - toggleWindowDevTools: { - id: 'desktopTopbar.toggleWindowDevTools', - defaultMessage: 'Toggle Window Developer Tools', - }, - maximize: { - id: 'desktopTopbar.windowMenu.maximize', - defaultMessage: 'Maximize', - }, - minimize: { - id: 'desktopTopbar.windowMenu.minimize', - defaultMessage: 'Minimize', - }, - zoom: { - id: 'desktopTopbar.windowMenu.zoom', - defaultMessage: 'Zoom', - }, - front: { - id: 'desktopTopbar.windowMenu.front', - defaultMessage: 'Front', - }, - close: { - id: 'desktopTopbar.windowMenu.close', - defaultMessage: 'Close', - }, - help: { - id: 'desktopTopbar.helpMenu.openHelpAndSupport', - defaultMessage: 'Open Help & Support', - }, - reset: { - id: 'desktopTopbar.appMenu.resetAppAndClearData', - defaultMessage: 'Reset App & Clear Local Data', - }, - about: { - id: 'desktopTopbar.appMenu.about', - defaultMessage: 'About Notion', - }, - services: { - id: 'desktopTopbar.appMenu.services', - defaultMessage: 'Services', - }, - hide: { id: 'desktopTopbar.appMenu.hide', defaultMessage: 'Hide Notion' }, - hideOthers: { - id: 'desktopTopbar.appMenu.hideOthers', - defaultMessage: 'Hide Others', - }, - unhide: { - id: 'desktopTopbar.appMenu.unhide', - defaultMessage: 'Show All', - }, - quitMac: { id: 'desktopTopbar.appMenu.quit', defaultMessage: 'Quit' }, - }), - escapeAmpersand = (message) => message.replace(/&/g, '&&'); - __exports.setupSystemMenu = (locale) => { - const intl = localizationHelper.createIntlShape(locale), - fileMenu = { - role: 'fileMenu', - label: escapeAmpersand(intl.formatMessage(menuMessages.fileMenuTitle)), - submenu: isMac - ? [ - { - label: escapeAmpersand( - intl.formatMessage(menuMessages.newWindow) - ), - accelerator: 'CmdOrCtrl+Shift+N', - click: () => createWindow.createWindow('', '', true), - }, - ...(tabsEnabled - ? [ - { - role: 'close', - label: escapeAmpersand( - intl.formatMessage(menuMessages.closeWindow) - ), - }, - ] - : []), - ] - : [ - { - label: escapeAmpersand( - intl.formatMessage(menuMessages.newWindow) - ), - accelerator: 'CmdOrCtrl+Shift+N', - click: () => createWindow.createWindow(), - }, - ...(tabsEnabled - ? [ - { - role: 'quit', - label: escapeAmpersand( - intl.formatMessage(menuMessages.quit) - ), - }, - ] - : []), - ], - }, - editMenu = { - role: 'editMenu', - label: escapeAmpersand(intl.formatMessage(menuMessages.editMenuTitle)), - submenu: isMac - ? [ - { - role: 'undo', - label: escapeAmpersand(intl.formatMessage(menuMessages.undo)), - }, - { - role: 'redo', - label: escapeAmpersand(intl.formatMessage(menuMessages.redo)), - }, - { type: 'separator' }, - { - role: 'cut', - label: escapeAmpersand(intl.formatMessage(menuMessages.cut)), - }, - { - role: 'copy', - label: escapeAmpersand(intl.formatMessage(menuMessages.copy)), - }, - { - role: 'paste', - label: escapeAmpersand(intl.formatMessage(menuMessages.paste)), - }, - { - role: 'selectAll', - label: escapeAmpersand( - intl.formatMessage(menuMessages.selectAll) - ), - }, - { type: 'separator' }, - { - label: escapeAmpersand(intl.formatMessage(menuMessages.speech)), - submenu: [ - { - role: 'startSpeaking', - label: escapeAmpersand( - intl.formatMessage(menuMessages.startSpeaking) - ), - }, - { - role: 'stopSpeaking', - label: escapeAmpersand( - intl.formatMessage(menuMessages.stopSpeaking) - ), - }, - ], - }, - ] - : [ - { - role: 'undo', - label: escapeAmpersand(intl.formatMessage(menuMessages.undo)), - }, - { - role: 'redo', - label: escapeAmpersand(intl.formatMessage(menuMessages.redo)), - }, - { type: 'separator' }, - { - role: 'cut', - label: escapeAmpersand(intl.formatMessage(menuMessages.cut)), - }, - { - role: 'copy', - label: escapeAmpersand(intl.formatMessage(menuMessages.copy)), - }, - { - role: 'paste', - label: escapeAmpersand(intl.formatMessage(menuMessages.paste)), - }, - { type: 'separator' }, - { - role: 'selectAll', - label: escapeAmpersand( - intl.formatMessage(menuMessages.selectAll) - ), - }, - ], - }, - viewMenu = { - role: 'viewMenu', - label: escapeAmpersand(intl.formatMessage(menuMessages.viewMenuTitle)), - submenu: [ - { - label: escapeAmpersand(intl.formatMessage(menuMessages.reload)), - accelerator: 'CmdOrCtrl+R', - click() { - const focusedWebContents = electron.webContents.getFocusedWebContents(); - if (focusedWebContents) { - if (focusedWebContents.hostWebContents) { - for (const webContentsInstance of electron.webContents.getAllWebContents()) { - if ( - webContentsInstance.hostWebContents === - focusedWebContents.hostWebContents - ) { - webContentsInstance.reload(); - } - } - } else { - focusedWebContents.reload(); - } - } - }, - }, - { - label: escapeAmpersand( - intl.formatMessage(menuMessages.toggleDevTools) - ), - accelerator: isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I', - click() { - let focusedWebContents = electron.webContents.getFocusedWebContents(); - if (focusedWebContents) { - const focusedWebContentsUrl = focusedWebContents.getURL(); - if ( - focusedWebContentsUrl.startsWith('file://') && - focusedWebContentsUrl.endsWith('/search.html') - ) { - const notionWebviewWebContents = electron.webContents - .getAllWebContents() - .find( - (webContentsInstance) => - webContentsInstance.hostWebContents === - focusedWebContents.hostWebContents && - webContentsInstance !== focusedWebContents - ); - if (notionWebviewWebContents) { - focusedWebContents = notionWebviewWebContents; - } - } - focusedWebContents.toggleDevTools(); - } - }, - }, - { - label: escapeAmpersand( - intl.formatMessage(menuMessages.toggleWindowDevTools) - ), - accelerator: isMac ? 'Shift+Alt+Command+I' : 'Alt+Ctrl+Shift+I', - visible: false, - click(menuItem, focusedWindow) { - if (focusedWindow) { - focusedWindow.webContents.toggleDevTools(); - } - }, - }, - { type: 'separator' }, - { - role: 'togglefullscreen', - label: escapeAmpersand( - intl.formatMessage(menuMessages.togglefullscreen) - ), - }, - ], - }, - windowMenu = { - role: 'windowMenu', - label: escapeAmpersand( - intl.formatMessage(menuMessages.windowMenuTitle) - ), - submenu: isMac - ? [ - { - role: 'minimize', - label: escapeAmpersand( - intl.formatMessage(menuMessages.minimize) - ), - }, - { - role: 'zoom', - label: escapeAmpersand(intl.formatMessage(menuMessages.zoom)), - }, - { type: 'separator' }, - { - role: 'front', - label: escapeAmpersand(intl.formatMessage(menuMessages.front)), - }, - ] - : [ - { - role: 'minimize', - label: escapeAmpersand( - intl.formatMessage(menuMessages.minimize) - ), - }, - { - label: escapeAmpersand( - intl.formatMessage(menuMessages.maximize) - ), - click(item, focusedWindow) { - if (focusedWindow) { - if (focusedWindow.isMaximized()) { - focusedWindow.unmaximize(); - } else { - focusedWindow.maximize(); - } - } - }, - }, - ...(tabsEnabled - ? [ - { - role: 'close', - label: escapeAmpersand( - intl.formatMessage(menuMessages.close) - ), - }, - ] - : []), - ], - }, - helpMenu = { - role: 'help', - label: escapeAmpersand(intl.formatMessage(menuMessages.helpTitle)), - submenu: [ - { - label: escapeAmpersand(intl.formatMessage(menuMessages.help)), - click() { - electron.shell.openExternal(config.default.baseURL + '/help'); - }, - }, - ], - }, - appMenu = { - role: 'appMenu', - submenu: [ - { - role: 'about', - label: escapeAmpersand(intl.formatMessage(menuMessages.about)), - }, - { type: 'separator' }, - { - label: escapeAmpersand(intl.formatMessage(menuMessages.reset)), - async click(item, focusedWindow) { - await fs.remove(electron.app.getPath('userData')); - electron.app.relaunch(); - electron.app.exit(); - }, - }, - { type: 'separator' }, - { - role: 'services', - label: escapeAmpersand(intl.formatMessage(menuMessages.services)), - }, - { type: 'separator' }, - { - role: 'hide', - label: escapeAmpersand(intl.formatMessage(menuMessages.hide)), - }, - { - role: 'hideOthers', - label: escapeAmpersand(intl.formatMessage(menuMessages.hideOthers)), - }, - { - role: 'unhide', - label: escapeAmpersand(intl.formatMessage(menuMessages.unhide)), - }, - ...(tabsEnabled - ? [ - { type: 'separator' }, - { - role: 'quit', - label: escapeAmpersand( - intl.formatMessage(menuMessages.quitMac) - ), - }, - ] - : []), - ], - }, - template = [fileMenu, editMenu, viewMenu, windowMenu, helpMenu]; - if (isMac) template.unshift(appMenu); - const menu = electron.Menu.buildFromTemplate(template); - electron.Menu.setApplicationMenu(menu); - }; -}; diff --git a/mods/core/tabs.css b/mods/core/tabs.css deleted file mode 100644 index 41c53fb..0000000 --- a/mods/core/tabs.css +++ /dev/null @@ -1,196 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -@import './css/buttons.css'; - -* { - box-sizing: border-box; - word-break: break-word; - text-decoration: none; - text-size-adjust: 100%; - font-family: var(--theme--font_sans) !important; - outline-color: var(--theme--table-border); -} - -@keyframes spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} -@keyframes tabSlide { - from { - width: 0; - } - to { - width: 8.5em; - } -} - -body:not(.error)::after { - z-index: 1; - content: ''; - position: absolute; - left: calc(50% - 15px); - top: calc(50% + 10px); - width: 18px; - height: 18px; - opacity: 0.5; - border: 4px solid var(--theme--text); - border-top-color: transparent; - border-radius: 50%; - animation: spin 0.8s linear infinite; -} - -html, -body, -#root { - background: var(--theme--main) !important; - position: relative; - height: 100%; - margin: 0; -} -#root { - display: flex; - flex-direction: column; -} - -[data-platform='darwin'] #titlebar { - padding-left: 4em; -} -#titlebar::before { - content: ''; - position: absolute; - width: 100%; - -webkit-app-region: no-drag; - top: 0; - left: 0; - height: 2px; -} -#titlebar { - display: flex; - flex-shrink: 1; - user-select: none; - -webkit-app-region: drag; - background: var(--theme--dragarea); -} -#titlebar button { - color: var(--theme--text); - -webkit-app-region: no-drag; - border: none; - background: transparent; -} -#titlebar .window-buttons-area { - margin: 0.5em 0.55em 0.5em auto; -} -#titlebar .window-buttons-area:empty { - display: none; -} - -#open-enhancer-menu::before { - content: ''; - height: 1.25em; - width: 1.25em; - display: inline-block; - margin: auto 1em -0.25em 1em; - background-size: contain; - background-image: url('enhancement://core/icons/mac+linux.png'); - background-repeat: no-repeat; -} -#tabs { - margin-top: auto; - flex-wrap: wrap; - display: flex; - align-items: center; -} -#tabs .tab:not(.new):not(.current) { - flex: 1 1 30px; - min-width: 30px; -} -#tabs button:nth-child(16) { - display: none; - opacity: 0; -} -#tabs .tab { - display: inline-flex; - background: var(--theme--main); - border: none; - font-size: 1.15em; - padding: 0.2em 0.4em; - text-align: left; - border-bottom: 0.22em solid var(--theme--table-border); - opacity: 0.8; -} -#tabs .tab img { - object-fit: cover; - height: 1em; - width: 1em; - border-radius: 3px; - margin: 0 0.5em -0.16em 0.1em; -} -#tabs .tab:not(.new) { - margin-top: 0.5em; -} -#tabs .tab:not(.new) span:not(.close) { - width: 8.5em; - margin-right: 0.22em; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -#tabs .tab.slideIn span:not(.close) { - animation: tabSlide 100ms ease-in-out; -} -#tabs .tab.slideOut { - width: 0; - animation: tabSlide 100ms ease-in-out reverse; -} -#tabs .tab .close { - padding: 0 0.35em 0.1em 0.3em; - margin-left: auto; - font-weight: bold; -} -#tabs .tab.current { - opacity: 1; - background: var(--theme--selected); - border-bottom: 0.22em solid var(--theme--option_active-background); -} -#tabs .tab.new { - background: none; - border: none; - margin-left: -0.1em; - margin-top: 0.3em; -} -#tabs .tab.new span { - padding: 0 0.35em 0.1em 0.3em; - font-weight: bold; -} -#tabs .tab:hover { - opacity: 1; -} -#tabs .tab .close:hover, -#tabs .tab.new span:hover, -#titlebar .window-button:hover { - border-radius: 0.22em; - background: var(--theme--table-border); - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border); -} -#titlebar .window-button.btn-close:hover { - background: var(--theme--button_close); - color: var(--theme--button_close-fill); -} -#tabs .tab.dragged-over { - box-shadow: inset 0.22em 0 0 0 var(--theme--selected); -} - -.notion { - z-index: 2; - width: 100%; - height: 100%; - display: none; -} diff --git a/mods/core/tray.js b/mods/core/tray.js deleted file mode 100644 index 53464a8..0000000 --- a/mods/core/tray.js +++ /dev/null @@ -1,261 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 TarasokUA - * under the MIT license - */ - -'use strict'; - -let tray, enhancer_menu; - -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'), - getAllWindows = electron.BrowserWindow.getAllWindows; - - function newWindow() { - require('./createWindow.js')( - store, - require(path.resolve( - `${helpers.getNotionResources()}/app/main/createWindow.js` - )) - )( - '', - getAllWindows().find((win) => win !== enhancer_menu) - ); - } - - electron.app.on('second-instance', (event, args, workingDirectory) => { - const windows = getAllWindows(); - if (windows.some((win) => win.isVisible())) { - newWindow(); - } else { - windows.forEach((window) => { - window.show(); - window.focus(); - if (store().maximized) window.maximize(); - }); - } - }); - - electron.app.once('ready', () => { - // tray - - 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, - }) - ); - - // menu - - electron.ipcMain.on('enhancer:open-menu', openEnhancerMenu); - electron.ipcMain.on('enhancer:set-app-theme', (event, arg) => { - electron.webContents - .getAllWebContents() - .forEach((webContents) => - webContents.send('enhancer:set-app-theme', arg) - ); - }); - electron.ipcMain.on('enhancer:get-app-theme', (event, arg) => { - electron.webContents - .getAllWebContents() - .forEach((webContents) => - webContents.send('enhancer:get-app-theme', arg) - ); - }); - electron.ipcMain.on('enhancer:close-tab', (event, target, tab) => { - electron.webContents - .fromId(target) - .webContents.send('enhancer:close-tab', tab); - }); - - 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 - return { - x: Math.round( - tray.getBounds().x + tray.getBounds().width / 2 - width / 2 - ), - y: screen.workArea.height - height, - }; - } - - function openEnhancerMenu() { - if (enhancer_menu) return enhancer_menu.show(); - const window_state = require(`${helpers - .getNotionResources() - .replace(/\\/g, '/')}/app/node_modules/electron-window-state/index.js`)( - { - file: 'menu.windowstate.json', - path: helpers.__data, - defaultWidth: 275, - defaultHeight: 600, - } - ); - enhancer_menu = new electron.BrowserWindow({ - show: true, - frame: !store().frameless, - 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}/enhancerMenu.js`), - nodeIntegration: true, - session: electron.session.fromPartition('persist:notion'), - enableRemoteModule: true, - }, - }); - enhancer_menu.loadURL('enhancement://core/menu.html'); - enhancer_menu.on('close', (e) => { - window_state.saveState(enhancer_menu); - enhancer_menu = null; - }); - // enhancer_menu.webContents.openDevTools(); - } - - // tray - - const contextMenu = electron.Menu.buildFromTemplate([ - { - type: 'normal', - label: 'GitHub', - click: () => { - electron.shell.openExternal( - 'https://github.com/notion-enhancer/notion-enhancer/blob/master/DOCUMENTATION.md' - ); - }, - }, - { - type: 'normal', - label: 'Discord', - click: () => { - electron.shell.openExternal('https://discord.gg/sFWPXtA'); - }, - }, - { - type: 'separator', - }, - { - type: 'normal', - label: 'Bug Report', - click: () => { - electron.shell.openExternal( - 'https://github.com/notion-enhancer/notion-enhancer/issues/new?labels=bug&template=bug-report.md' - ); - }, - }, - { - type: 'normal', - label: 'Feature Proposal', - click: () => { - electron.shell.openExternal( - 'https://github.com/notion-enhancer/notion-enhancer/issues/new?labels=enhancement&template=feature-proposal.md' - ); - }, - }, - { - type: 'separator', - }, - { - type: 'normal', - label: 'Enhancements', - accelerator: store().menu_toggle, - click: openEnhancerMenu, - }, - { - type: 'normal', - label: 'New Window', - click: newWindow(), - accelerator: 'CommandOrControl+Shift+N', - }, - { - type: 'normal', - label: 'Toggle Visibility', - accelerator: store().hotkey, - click: toggleWindows, - }, - { - type: 'separator', - }, - { - label: 'Relaunch', - click: () => { - electron.app.relaunch(); - electron.app.quit(); - }, - }, - { - label: 'Quit', - role: 'quit', - }, - ]); - tray.setContextMenu(contextMenu); - tray.setToolTip('Notion'); - - // hotkey - - function showWindows(windows) { - 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(windows) { - windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); - if (is_mac) electron.app.hide(); - } - function toggleWindows() { - const windows = getAllWindows(); - if (windows.some((win) => win.isVisible())) hideWindows(windows); - else showWindows(windows); - } - tray.on('click', toggleWindows); - if (store().hotkey) { - electron.globalShortcut.register(store().hotkey, () => { - const windows = getAllWindows(); - if (windows.some((win) => win.isFocused() && win.isVisible())) - hideWindows(windows); - else showWindows(windows); - }); - } - }); -}; diff --git a/mods/core/variables.css b/mods/core/variables.css deleted file mode 100644 index 63d2f9d..0000000 --- a/mods/core/variables.css +++ /dev/null @@ -1,810 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 TarasokUA - * (c) 2020 Arecsu - * (c) 2020 u/zenith_illinois - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -:root { - /** dark **/ - - --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--box-shadow: rgba(15, 15, 15, 0.2) 0px 0px 0px 1px, - rgba(15, 15, 15, 0.2) 0px 2px 4px; - --theme_dark--box-shadow_strong: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, - rgba(15, 15, 15, 0.2) 0px 3px 6px, rgba(15, 15, 15, 0.4) 0px 9px 24px; - --theme_dark--page_normal-width: 900px; - --theme_dark--page_full-width: 100%; - --theme_dark--page-padding: calc(96px + env(safe-area-inset-left)); - --theme_dark--page_banner-height: 30vh; - --theme_dark--preview-width: 977px; - --theme_dark--preview-padding: 8rem; - --theme_dark--preview_banner-height: 20vh; - - --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--font_quote: var(--theme_dark--font_sans); - --theme_dark--font_headings: var(--theme_dark--font_sans); - - --theme_dark--font_title-size: 40px; - --theme_dark--font_heading1-size: 1.875em; - --theme_dark--font_heading2-size: 1.5em; - --theme_dark--font_heading3-size: 1.25em; - --theme_dark--font_label-size: 14px; - --theme_dark--font_body-size: 16px; - --theme_dark--font_body-size_small: 14px; - --theme_dark--font_code-size: 0.796875em; - --theme_dark--font_sidebar-size: 14px; - - --theme_dark--text-block_line-height: 1.5; - --theme_dark--text-block_margin-top: 1px; - - --theme_dark--scrollbar: #505457; - --theme_dark--scrollbar-border: transparent; - --theme_dark--scrollbar_hover: #696d6f; - - --theme_dark--card: rgb(63, 68, 71); - --theme_dark--gallery: rgba(255, 255, 255, 0.05); - --theme_dark--select_input: rgb(55, 60, 63); - --theme_dark--table-border: rgba(255, 255, 255, 0.1); - --theme_dark--table-border_row: rgb(77, 81, 83); - --theme_dark--table-border_column: rgb(63, 66, 69); - --theme_dark--table-border_selected: rgba(46, 170, 220, 0.6); - --theme_dark--ui-border: rgba(255, 255, 255, 0.07); - --theme_dark--interactive_hover: rgb(71, 76, 80); - --theme_dark--interactive_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_text: white; - --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--primary_indicator_text: var(--theme_dark--primary_text); - --theme_dark--primary_indicator_hover: rgba(45, 156, 219, 0.2); - - --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(71, 76, 80); - - --theme_dark--danger_text: rgb(235, 87, 87); - --theme_dark--danger_border: rgba(235, 87, 87, 0.5); - - --theme_dark--divider: var(--theme_dark--table-border); - - --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-text: var(--theme_dark--text); - --theme_dark--bg_gray: rgb(69, 75, 78); - --theme_dark--bg_gray-text: var(--theme_dark--bg-text); - --theme_dark--bg_brown: rgb(67, 64, 64); - --theme_dark--bg_brown-text: var(--theme_dark--bg-text); - --theme_dark--bg_orange: rgb(89, 74, 58); - --theme_dark--bg_orange-text: var(--theme_dark--bg-text); - --theme_dark--bg_yellow: rgb(89, 86, 59); - --theme_dark--bg_yellow-text: var(--theme_dark--bg-text); - --theme_dark--bg_green: rgb(53, 76, 75); - --theme_dark--bg_green-text: var(--theme_dark--bg-text); - --theme_dark--bg_blue: rgb(54, 73, 84); - --theme_dark--bg_blue-text: var(--theme_dark--bg-text); - --theme_dark--bg_purple: rgb(68, 63, 87); - --theme_dark--bg_purple-text: var(--theme_dark--bg-text); - --theme_dark--bg_pink: rgb(83, 59, 76); - --theme_dark--bg_pink-text: var(--theme_dark--bg-text); - --theme_dark--bg_red: rgb(89, 65, 65); - --theme_dark--bg_red-text: var(--theme_dark--bg-text); - - --theme_dark--line-text: var(--theme_dark--text); - --theme_dark--line_gray: rgb(69, 75, 78); - --theme_dark--line_gray-text: var(--theme_dark--line-text); - --theme_dark--line_brown: rgb(67, 64, 64); - --theme_dark--line_brown-text: var(--theme_dark--line-text); - --theme_dark--line_orange: rgb(89, 74, 58); - --theme_dark--line_orange-text: var(--theme_dark--line-text); - --theme_dark--line_yellow: rgb(89, 86, 59); - --theme_dark--line_yellow-text: var(--theme_dark--line-text); - --theme_dark--line_green: rgb(53, 76, 75); - --theme_dark--line_green-text: var(--theme_dark--line-text); - --theme_dark--line_blue: rgb(54, 73, 84); - --theme_dark--line_blue-text: var(--theme_dark--line-text); - --theme_dark--line_purple: rgb(68, 63, 87); - --theme_dark--line_purple-text: var(--theme_dark--line-text); - --theme_dark--line_pink: rgb(83, 59, 76); - --theme_dark--line_pink-text: var(--theme_dark--line-text); - --theme_dark--line_red: rgb(89, 65, 65); - --theme_dark--line_red-text: var(--theme_dark--line-text); - - --theme_dark--select-text: var(--theme_dark--text); - --theme_dark--select_gray: rgba(151, 154, 155, 0.5); - --theme_dark--select_gray-text: var(--theme_dark--select-text); - --theme_dark--select_brown: rgba(147, 114, 100, 0.5); - --theme_dark--select_brown-text: var(--theme_dark--select-text); - --theme_dark--select_orange: rgba(255, 163, 68, 0.5); - --theme_dark--select_orange-text: var(--theme_dark--select-text); - --theme_dark--select_yellow: rgba(255, 220, 73, 0.5); - --theme_dark--select_yellow-text: var(--theme_dark--select-text); - --theme_dark--select_green: rgba(77, 171, 154, 0.5); - --theme_dark--select_green-text: var(--theme_dark--select-text); - --theme_dark--select_blue: rgba(82, 156, 202, 0.5); - --theme_dark--select_blue-text: var(--theme_dark--select-text); - --theme_dark--select_purple: rgba(154, 109, 215, 0.5); - --theme_dark--select_purple-text: var(--theme_dark--select-text); - --theme_dark--select_pink: rgba(226, 85, 161, 0.5); - --theme_dark--select_pink-text: var(--theme_dark--select-text); - --theme_dark--select_red: rgba(255, 115, 105, 0.5); - --theme_dark--select_red-text: var(--theme_dark--select-text); - - --theme_dark--callout-text: var(--theme_dark--text); - --theme_dark--callout_gray: rgba(69, 75, 78, 0.3); - --theme_dark--callout_gray-text: var(--theme_dark--callout-text); - --theme_dark--callout_brown: rgba(67, 64, 64, 0.3); - --theme_dark--callout_brown-text: var(--theme_dark--callout-text); - --theme_dark--callout_orange: rgba(89, 74, 58, 0.3); - --theme_dark--callout_orange-text: var(--theme_dark--callout-text); - --theme_dark--callout_yellow: rgba(89, 86, 59, 0.3); - --theme_dark--callout_yellow-text: var(--theme_dark--callout-text); - --theme_dark--callout_green: rgba(53, 76, 75, 0.3); - --theme_dark--callout_green-text: var(--theme_dark--callout-text); - --theme_dark--callout_blue: rgba(54, 73, 84, 0.3); - --theme_dark--callout_blue-text: var(--theme_dark--callout-text); - --theme_dark--callout_purple: rgba(68, 63, 87, 0.3); - --theme_dark--callout_purple-text: var(--theme_dark--callout-text); - --theme_dark--callout_pink: rgba(83, 59, 76, 0.3); - --theme_dark--callout_pink-text: var(--theme_dark--callout-text); - --theme_dark--callout_red: rgba(89, 65, 65, 0.3); - --theme_dark--callout_red-text: var(--theme_dark--callout-text); - - --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: var(--theme_dark--card); - --theme_dark--code_function: var(--theme_dark--code-text); - --theme_dark--code_parameter: var(--theme_dark--code-text); - --theme_dark--code_keyword: hsl(350, 40%, 70%); - --theme_dark--code_constant: 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_regex: #e90; - --theme_dark--code_property: hsl(350, 40%, 70%); - --theme_dark--code_builtin: hsl(75, 70%, 60%); - --theme_dark--code_class-name: var(--theme_dark--code-text); - --theme_dark--code_attr-name: hsl(75, 70%, 60%); - --theme_dark--code_attr-value: hsl(350, 40%, 70%); - --theme_dark--code_selector: hsl(75, 70%, 60%); - --theme_dark--code_id: var(--theme_dark--code-text); - --theme_dark--code_class: var(--theme_dark--code-text); - --theme_dark--code_pseudo-element: var(--theme_dark--code-text); - --theme_dark--code_pseudo-class: var(--theme_dark--code-text); - --theme_dark--code_attribute: var(--theme_dark--code-text); - --theme_dark--code_value: var(--theme_dark--code-text); - --theme_dark--code_unit: var(--theme_dark--code-text); - --theme_dark--code_comment: hsl(30, 20%, 50%); - --theme_dark--code_punctuation: var(--theme_dark--code-text); - --theme_dark--code_annotation: var(--theme_dark--code_punctuation); - --theme_dark--code_decorator: var(--theme_dark--code_punctuation); - --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_boolean: hsl(350, 40%, 70%); - - /** light **/ - - --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--box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, - rgba(15, 15, 15, 0.1) 0px 2px 4px; - --theme_light--box-shadow_strong: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, - rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px; - --theme_light--page_normal-width: 900px; - --theme_light--page_full-width: 100%; - --theme_light--page-padding: calc(96px + env(safe-area-inset-left)); - --theme_light--page_banner-height: 30vh; - --theme_light--preview-width: 977px; - --theme_light--preview-padding: 8rem; - --theme_light--preview_banner-height: 20vh; - - --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--font_quote: var(--theme_light--font_sans); - --theme_light--font_headings: var(--theme_light--font_sans); - - --theme_light--font_title-size: 40px; - --theme_light--font_heading1-size: 1.875em; - --theme_light--font_heading2-size: 1.5em; - --theme_light--font_heading3-size: 1.25em; - --theme_light--font_label-size: 14px; - --theme_light--font_body-size: 16px; - --theme_light--font_body-size_small: 14px; - --theme_light--font_code-size: 0.796875em; - --theme_light--font_sidebar-size: 14px; - - --theme_light--text-block_line-height: 1.5; - --theme_light--text-block_margin-top: 1px; - - --theme_light--scrollbar: #d9d8d6; - --theme_light--scrollbar-border: #cacac8; - --theme_light--scrollbar_hover: #cacac8; - - --theme_light--card: rgb(247, 247, 247); - --theme_light--gallery: rgba(55, 53, 47, 0.024); - --theme_light--select_input: rgba(242, 241, 238, 0.6); - --theme_light--table-border: rgba(55, 53, 47, 0.16); - --theme_light--table-border_row: rgb(223, 223, 222); - --theme_light--table-border_column: rgb(237, 237, 236); - --theme_light--table-border_selected: rgba(46, 170, 220, 0.6); - --theme_light--ui-border: rgba(55, 53, 47, 0.09); - --theme_light--interactive_hover: rgb(239, 239, 239); - --theme_light--interactive_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_text: white; - --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--primary_indicator_text: var(--theme_light--primary_text); - --theme_light--primary_indicator_hover: rgba(45, 156, 219, 0.2); - - --theme_light--option-color: black; - --theme_light--option-background: transparent; - --theme_light--option_hover-color: black; - --theme_light--option_hover-background: rgba(55, 53, 47, 0.08); - --theme_light--option_active-color: white; - --theme_light--option_active-background: var(--theme_light--primary); - - --theme_light--danger_text: rgb(235, 87, 87); - --theme_light--danger_border: rgba(235, 87, 87, 0.5); - - --theme_light--divider: var(--theme_light--table-border); - - --theme_light--text: rgb(55, 53, 47); - --theme_light--text_ui: rgba(55, 53, 47, 0.6); - --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-text: var(--theme_light--text); - --theme_light--bg_gray: rgb(235, 236, 237); - --theme_light--bg_gray-text: var(--theme_light--bg-text); - --theme_light--bg_brown: rgb(233, 229, 227); - --theme_light--bg_brown-text: var(--theme_light--bg-text); - --theme_light--bg_orange: rgb(250, 235, 221); - --theme_light--bg_orange-text: var(--theme_light--bg-text); - --theme_light--bg_yellow: rgb(251, 243, 219); - --theme_light--bg_yellow-text: var(--theme_light--bg-text); - --theme_light--bg_green: rgb(221, 237, 234); - --theme_light--bg_green-text: var(--theme_light--bg-text); - --theme_light--bg_blue: rgb(221, 235, 241); - --theme_light--bg_blue-text: var(--theme_light--bg-text); - --theme_light--bg_purple: rgb(234, 228, 242); - --theme_light--bg_purple-text: var(--theme_light--bg-text); - --theme_light--bg_pink: rgb(244, 223, 235); - --theme_light--bg_pink-text: var(--theme_light--bg-text); - --theme_light--bg_red: rgb(251, 228, 228); - --theme_light--bg_red-text: var(--theme_light--bg-text); - - --theme_light--line-text: var(--theme_light--text); - --theme_light--line_gray: rgb(235, 236, 237); - --theme_light--line_gray-text: var(--theme_light--line-text); - --theme_light--line_brown: rgb(233, 229, 227); - --theme_light--line_brown-text: var(--theme_light--line-text); - --theme_light--line_orange: rgb(250, 235, 221); - --theme_light--line_orange-text: var(--theme_light--line-text); - --theme_light--line_yellow: rgb(251, 243, 219); - --theme_light--line_yellow-text: var(--theme_light--line-text); - --theme_light--line_green: rgb(221, 237, 234); - --theme_light--line_green-text: var(--theme_light--line-text); - --theme_light--line_blue: rgb(221, 235, 241); - --theme_light--line_blue-text: var(--theme_light--line-text); - --theme_light--line_purple: rgb(234, 228, 242); - --theme_light--line_purple-text: var(--theme_light--line-text); - --theme_light--line_pink: rgb(244, 223, 235); - --theme_light--line_pink-text: var(--theme_light--line-text); - --theme_light--line_red: rgb(251, 228, 228); - --theme_light--line_red-text: var(--theme_light--line-text); - - --theme_light--select-text: var(--theme_light--text); - --theme_light--select_gray: rgba(140, 46, 0, 0.2); - --theme_light--select_gray-text: var(--theme_light--select-text); - --theme_light--select_brown: rgba(140, 46, 0, 0.2); - --theme_light--select_brown-text: var(--theme_light--select-text); - --theme_light--select_orange: rgba(245, 93, 0, 0.2); - --theme_light--select_orange-text: var(--theme_light--select-text); - --theme_light--select_yellow: rgba(233, 168, 0, 0.2); - --theme_light--select_yellow-text: var(--theme_light--select-text); - --theme_light--select_green: rgba(0, 135, 107, 0.2); - --theme_light--select_green-text: var(--theme_light--select-text); - --theme_light--select_blue: rgba(0, 120, 223, 0.2); - --theme_light--select_blue-text: var(--theme_light--select-text); - --theme_light--select_purple: rgba(103, 36, 222, 0.2); - --theme_light--select_purple-text: var(--theme_light--select-text); - --theme_light--select_pink: rgba(221, 0, 129, 0.2); - --theme_light--select_pink-text: var(--theme_light--select-text); - --theme_light--select_red: rgba(255, 0, 26, 0.2); - --theme_light--select_red-text: var(--theme_light--select-text); - - --theme_light--callout-text: var(--theme_light--text); - --theme_light--callout_gray: rgba(235, 236, 237, 0.3); - --theme_light--callout_gray-text: var(--theme_light--callout-text); - --theme_light--callout_brown: rgba(233, 229, 227, 0.3); - --theme_light--callout_brown-text: var(--theme_light--callout-text); - --theme_light--callout_orange: rgba(250, 235, 221, 0.3); - --theme_light--callout_orange-text: var(--theme_light--callout-text); - --theme_light--callout_yellow: rgba(251, 243, 219, 0.3); - --theme_light--callout_yellow-text: var(--theme_light--callout-text); - --theme_light--callout_green: rgba(221, 237, 234, 0.3); - --theme_light--callout_green-text: var(--theme_light--callout-text); - --theme_light--callout_blue: rgba(221, 235, 241, 0.3); - --theme_light--callout_blue-text: var(--theme_light--callout-text); - --theme_light--callout_purple: rgba(234, 228, 242, 0.3); - --theme_light--callout_purple-text: var(--theme_light--callout-text); - --theme_light--callout_pink: rgba(244, 223, 235, 0.3); - --theme_light--callout_pink-text: var(--theme_light--callout-text); - --theme_light--callout_red: rgba(251, 228, 228, 0.3); - --theme_light--callout_red-text: var(--theme_light--callout-text); - - --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: var(--theme_light--card); - --theme_light--code_function: #dd4a68; - --theme_light--code_parameter: var(--theme_light--code-text); - --theme_light--code_keyword: #07a; - --theme_light--code_constant: #905; - --theme_light--code_tag: #905; - --theme_light--code_operator: #9a6e3a; - --theme_light--code_important: #e90; - --theme_light--code_regex: #e90; - --theme_light--code_property: #905; - --theme_light--code_builtin: #690; - --theme_light--code_class-name: #dd4a68; - --theme_light--code_attr-name: #690; - --theme_light--code_attr-value: #07a; - --theme_light--code_selector: #690; - --theme_light--code_id: var(--theme_light--code-text); - --theme_light--code_class: var(--theme_light--code-text); - --theme_light--code_pseudo-element: var(--theme_light--code-text); - --theme_light--code_pseudo-class: var(--theme_light--code-text); - --theme_light--code_attribute: var(--theme_light--code-text); - --theme_light--code_value: var(--theme_light--code-text); - --theme_light--code_unit: var(--theme_light--code-text); - --theme_light--code_comment: slategray; - --theme_light--code_punctuation: #999; - --theme_light--code_annotation: var(--theme_light--code_punctuation); - --theme_light--code_decorator: var(--theme_light--code_punctuation); - --theme_light--code_doctype: slategray; - --theme_light--code_number: #905; - --theme_light--code_string: #690; - --theme_light--code_boolean: #905; -} - -.notion-dark-theme { - --theme--main: var(--theme_dark--main); - --theme--sidebar: var(--theme_dark--sidebar); - --theme--overlay: var(--theme_dark--overlay); - --theme--dragarea: var(--theme_dark--dragarea); - --theme--box-shadow: var(--theme_dark--box-shadow); - --theme--box-shadow_strong: var(--theme_dark--box-shadow_strong); - --theme--page_normal-width: var(--theme_dark--page_normal-width); - --theme--page_full-width: var(--theme_dark--page_full-width); - --theme--page-padding: var(--theme_dark--page-padding); - --theme--page_banner-height: var(--theme_dark--page_banner-height); - --theme--preview-width: var(--theme_dark--preview-width); - --theme--preview-padding: var(--theme_dark--preview-padding); - --theme--preview_banner-height: var(--theme_dark--preview_banner-height); - --theme--font_sans: var(--theme_dark--font_sans); - --theme--font_serif: var(--theme_dark--font_serif); - --theme--font_mono: var(--theme_dark--font_mono); - --theme--font_code: var(--theme_dark--font_code); - --theme--font_quote: var(--theme_dark--font_quote); - --theme--font_headings: var(--theme_dark--font_headings); - --theme--font_title-size: var(--theme_dark--font_title-size); - --theme--font_heading1-size: var(--theme_dark--font_heading1-size); - --theme--font_heading2-size: var(--theme_dark--font_heading2-size); - --theme--font_heading3-size: var(--theme_dark--font_heading3-size); - --theme--font_label-size: var(--theme_dark--font_label-size); - --theme--font_body-size: var(--theme_dark--font_body-size); - --theme--font_body-size_small: var(--theme_dark--font_body-size_small); - --theme--font_code-size: var(--theme_dark--font_code-size); - --theme--font_sidebar-size: var(--theme_dark--font_sidebar-size); - --theme--text-block_line-height: var(--theme_dark--text-block_line-height); - --theme--text-block_margin-top: var(--theme_dark--text-block_margin-top); - --theme--scrollbar: var(--theme_dark--scrollbar); - --theme--scrollbar-border: var(--theme_dark--scrollbar-border); - --theme--scrollbar_hover: var(--theme_dark--scrollbar_hover); - --theme--card: var(--theme_dark--card); - --theme--gallery: var(--theme_dark--gallery); - --theme--select_input: var(--theme_dark--select_input); - --theme--table-border: var(--theme_dark--table-border); - --theme--table-border_row: var(--theme_dark--table-border_row); - --theme--table-border_column: var(--theme_dark--table-border_column); - --theme--table-border_selected: var(--theme_dark--table-border_selected); - --theme--ui-border: var(--theme_dark--ui-border); - --theme--interactive_hover: var(--theme_dark--interactive_hover); - --theme--interactive_hover-border: var( - --theme_dark--interactive_hover-border - ); - --theme--button_close: var(--theme_dark--button_close); - --theme--button_close-fill: var(--theme_dark--button_close-fill); - --theme--selected: var(--theme_dark--selected); - --theme--primary: var(--theme_dark--primary); - --theme--primary_text: var(--theme_dark--primary_text); - --theme--primary_hover: var(--theme_dark--primary_hover); - --theme--primary_click: var(--theme_dark--primary_click); - --theme--primary_indicator: var(--theme_dark--primary_indicator); - --theme--primary_indicator_text: var(--theme_dark--primary_indicator_text); - --theme--primary_indicator_hover: var(--theme_dark--primary_indicator_hover); - --theme--option-color: var(--theme_dark--option-color); - --theme--option-background: var(--theme_dark--option-background); - --theme--option_active-color: var(--theme_dark--option_active-color); - --theme--option_active-background: var( - --theme_dark--option_active-background - ); - --theme--option_hover-color: var(--theme_dark--option_hover-color); - --theme--option_hover-background: var(--theme_dark--option_hover-background); - --theme--danger_text: var(--theme_dark--danger_text); - --theme--danger_border: var(--theme_dark--danger_border); - --theme--divider: var(--theme_dark--divider); - --theme--text: var(--theme_dark--text); - --theme--text_ui: var(--theme_dark--text_ui); - --theme--text_ui_info: var(--theme_dark--text_ui_info); - --theme--text_gray: var(--theme_dark--text_gray); - --theme--text_brown: var(--theme_dark--text_brown); - --theme--text_orange: var(--theme_dark--text_orange); - --theme--text_yellow: var(--theme_dark--text_yellow); - --theme--text_green: var(--theme_dark--text_green); - --theme--text_blue: var(--theme_dark--text_blue); - --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--select-text: var(--theme_dark--select-text); - --theme--bg-text: var(--theme_dark--bg-text); - --theme--bg_gray: var(--theme_dark--bg_gray); - --theme--bg_gray-text: var(--theme_dark--bg_gray-text); - --theme--bg_brown: var(--theme_dark--bg_brown); - --theme--bg_brown-text: var(--theme_dark--bg_brown-text); - --theme--bg_orange: var(--theme_dark--bg_orange); - --theme--bg_orange-text: var(--theme_dark--bg_orange-text); - --theme--bg_yellow: var(--theme_dark--bg_yellow); - --theme--bg_yellow-text: var(--theme_dark--bg_yellow-text); - --theme--bg_green: var(--theme_dark--bg_green); - --theme--bg_green-text: var(--theme_dark--bg_green-text); - --theme--bg_blue: var(--theme_dark--bg_blue); - --theme--bg_blue-text: var(--theme_dark--bg_blue-text); - --theme--bg_purple: var(--theme_dark--bg_purple); - --theme--bg_purple-text: var(--theme_dark--bg_purple-text); - --theme--bg_pink: var(--theme_dark--bg_pink); - --theme--bg_pink-text: var(--theme_dark--bg_pink-text); - --theme--bg_red: var(--theme_dark--bg_red); - --theme--bg_red-text: var(--theme_dark--bg_red-text); - --theme--line-text: var(--theme_dark--line-text); - --theme--line_gray: var(--theme_dark--line_gray); - --theme--line_gray-text: var(--theme_dark--line_gray-text); - --theme--line_brown: var(--theme_dark--line_brown); - --theme--line_brown-text: var(--theme_dark--line_brown-text); - --theme--line_orange: var(--theme_dark--line_orange); - --theme--line_orange-text: var(--theme_dark--line_orange-text); - --theme--line_yellow: var(--theme_dark--line_yellow); - --theme--line_yellow-text: var(--theme_dark--line_yellow-text); - --theme--line_green: var(--theme_dark--line_green); - --theme--line_green-text: var(--theme_dark--line_green-text); - --theme--line_blue: var(--theme_dark--line_blue); - --theme--line_blue-text: var(--theme_dark--line_blue-text); - --theme--line_purple: var(--theme_dark--line_purple); - --theme--line_purple-text: var(--theme_dark--line_purple-text); - --theme--line_pink: var(--theme_dark--line_pink); - --theme--line_pink-text: var(--theme_dark--line_pink-text); - --theme--line_red: var(--theme_dark--line_red); - --theme--line_red-text: var(--theme_dark--line_red-text); - --theme--select_gray: var(--theme_dark--select_gray); - --theme--select_gray-text: var(--theme_dark--select_gray-text); - --theme--select_brown: var(--theme_dark--select_brown); - --theme--select_brown-text: var(--theme_dark--select_brown-text); - --theme--select_orange: var(--theme_dark--select_orange); - --theme--select_orange-text: var(--theme_dark--select_orange-text); - --theme--select_yellow: var(--theme_dark--select_yellow); - --theme--select_yellow-text: var(--theme_dark--select_yellow-text); - --theme--select_green: var(--theme_dark--select_green); - --theme--select_green-text: var(--theme_dark--select_green-text); - --theme--select_blue: var(--theme_dark--select_blue); - --theme--select_blue-text: var(--theme_dark--select_blue-text); - --theme--select_purple: var(--theme_dark--select_purple); - --theme--select_purple-text: var(--theme_dark--select_purple-text); - --theme--select_pink: var(--theme_dark--select_pink); - --theme--select_pink-text: var(--theme_dark--select_pink-text); - --theme--select_red: var(--theme_dark--select_red); - --theme--select_red-text: var(--theme_dark--select_red-text); - --theme--callout-text: var(--theme_dark--callout-text); - --theme--callout_gray: var(--theme_dark--callout_gray); - --theme--callout_gray-text: var(--theme_dark--callout_gray-text); - --theme--callout_brown: var(--theme_dark--callout_brown); - --theme--callout_brown-text: var(--theme_dark--callout_brown-text); - --theme--callout_orange: var(--theme_dark--callout_orange); - --theme--callout_orange-text: var(--theme_dark--callout_orange-text); - --theme--callout_yellow: var(--theme_dark--callout_yellow); - --theme--callout_yellow-text: var(--theme_dark--callout_yellow-text); - --theme--callout_green: var(--theme_dark--callout_green); - --theme--callout_green-text: var(--theme_dark--callout_green-text); - --theme--callout_blue: var(--theme_dark--callout_blue); - --theme--callout_blue-text: var(--theme_dark--callout_blue-text); - --theme--callout_purple: var(--theme_dark--callout_purple); - --theme--callout_purple-text: var(--theme_dark--callout_purple-text); - --theme--callout_pink: var(--theme_dark--callout_pink); - --theme--callout_pink-text: var(--theme_dark--callout_pink-text); - --theme--callout_red: var(--theme_dark--callout_red); - --theme--callout_red-text: var(--theme_dark--callout_red-text); - --theme--code_inline-text: var(--theme_dark--code_inline-text); - --theme--code_inline-background: var(--theme_dark--code_inline-background); - --theme--code-text: var(--theme_dark--code-text); - --theme--code-background: var(--theme_dark--code-background); - --theme--code_function: var(--theme_dark--code_function); - --theme--code_parameter: var(--theme_dark--code_parameter); - --theme--code_keyword: var(--theme_dark--code_keyword); - --theme--code_constant: var(--theme_dark--code_constant); - --theme--code_tag: var(--theme_dark--code_tag); - --theme--code_operator: var(--theme_dark--code_operator); - --theme--code_important: var(--theme_dark--code_important); - --theme--code_regex: var(--theme_dark--code_regex); - --theme--code_property: var(--theme_dark--code_property); - --theme--code_builtin: var(--theme_dark--code_builtin); - --theme--code_class-name: var(--theme_dark--code_class-name); - --theme--code_attr-name: var(--theme_dark--code_attr-name); - --theme--code_attr-value: var(--theme_dark--code_attr-value); - --theme--code_selector: var(--theme_dark--code_selector); - --theme--code_id: var(--theme_dark--code_id); - --theme--code_class: var(--theme_dark--code_class); - --theme--code_pseudo-element: var(--theme_dark--code_pseudo-element); - --theme--code_pseudo-class: var(--theme_dark--code_pseudo-class); - --theme--code_attribute: var(--theme_dark--code_attribute); - --theme--code_value: var(--theme_dark--code_value); - --theme--code_unit: var(--theme_dark--code_unit); - --theme--code_comment: var(--theme_dark--code_comment); - --theme--code_punctuation: var(--theme_dark--code_punctuation); - --theme--code_annotation: var(--theme_dark--code_annotation); - --theme--code_decorator: var(--theme_dark--code_decorator); - --theme--code_doctype: var(--theme_dark--code_doctype); - --theme--code_number: var(--theme_dark--code_number); - --theme--code_string: var(--theme_dark--code_string); - --theme--code_boolean: var(--theme_dark--code_boolean); -} - -.notion-light-theme { - --theme--main: var(--theme_light--main); - --theme--sidebar: var(--theme_light--sidebar); - --theme--overlay: var(--theme_light--overlay); - --theme--dragarea: var(--theme_light--dragarea); - --theme--box-shadow: var(--theme_light--box-shadow); - --theme--box-shadow_strong: var(--theme_light--box-shadow_strong); - --theme--page_normal-width: var(--theme_light--page_normal-width); - --theme--page_full-width: var(--theme_light--page_full-width); - --theme--page-padding: var(--theme_light--page-padding); - --theme--page_banner-height: var(--theme_light--page_banner-height); - --theme--preview-width: var(--theme_light--preview-width); - --theme--preview-padding: var(--theme_light--preview-padding); - --theme--preview_banner-height: var(--theme_light--preview_banner-height); - --theme--font_sans: var(--theme_light--font_sans); - --theme--font_serif: var(--theme_light--font_serif); - --theme--font_mono: var(--theme_light--font_mono); - --theme--font_code: var(--theme_light--font_code); - --theme--font_quote: var(--theme_light--font_quote); - --theme--font_headings: var(--theme_light--font_headings); - --theme--font_title-size: var(--theme_light--font_title-size); - --theme--font_heading1-size: var(--theme_light--font_heading1-size); - --theme--font_heading2-size: var(--theme_light--font_heading2-size); - --theme--font_heading3-size: var(--theme_light--font_heading3-size); - --theme--font_label-size: var(--theme_light--font_label-size); - --theme--font_body-size: var(--theme_light--font_body-size); - --theme--font_body-size_small: var(--theme_light--font_body-size_small); - --theme--font_code-size: var(--theme_light--font_code-size); - --theme--font_sidebar-size: var(--theme_light--font_sidebar-size); - --theme--text-block_line-height: var(--theme_light--text-block_line-height); - --theme--text-block_margin-top: var(--theme_light--text-block_margin-top); - --theme--scrollbar: var(--theme_light--scrollbar); - --theme--scrollbar-border: var(--theme_light--scrollbar-border); - --theme--scrollbar_hover: var(--theme_light--scrollbar_hover); - --theme--card: var(--theme_light--card); - --theme--gallery: var(--theme_light--gallery); - --theme--select_input: var(--theme_light--select_input); - --theme--table-border: var(--theme_light--table-border); - --theme--table-border_row: var(--theme_light--table-border_row); - --theme--table-border_column: var(--theme_light--table-border_column); - --theme--table-border_selected: var(--theme_light--table-border_selected); - --theme--ui-border: var(--theme_light--ui-border); - --theme--interactive_hover: var(--theme_light--interactive_hover); - --theme--interactive_hover-border: var( - --theme_light--interactive_hover-border - ); - --theme--button_close: var(--theme_light--button_close); - --theme--button_close-fill: var(--theme_light--button_close-fill); - --theme--selected: var(--theme_light--selected); - --theme--primary: var(--theme_light--primary); - --theme--primary_text: var(--theme_light--primary_text); - --theme--primary_hover: var(--theme_light--primary_hover); - --theme--primary_click: var(--theme_light--primary_click); - --theme--primary_indicator: var(--theme_light--primary_indicator); - --theme--primary_indicator_text: var(--theme_light--primary_indicator_text); - --theme--primary_indicator_hover: var(--theme_light--primary_indicator_hover); - --theme--option-color: var(--theme_light--option-color); - --theme--option-background: var(--theme_light--option-background); - --theme--option_hover-color: var(--theme_light--option_hover-color); - --theme--option_hover-background: var(--theme_light--option_hover-background); - --theme--option_active-color: var(--theme_light--option_active-color); - --theme--option_active-background: var( - --theme_light--option_active-background - ); - --theme--danger_text: var(--theme_light--danger_text); - --theme--danger_border: var(--theme_light--danger_border); - --theme--divider: var(--theme_light--divider); - --theme--text: var(--theme_light--text); - --theme--text_ui: var(--theme_light--text_ui); - --theme--text_ui_info: var(--theme_light--text_ui_info); - --theme--text_gray: var(--theme_light--text_gray); - --theme--text_brown: var(--theme_light--text_brown); - --theme--text_orange: var(--theme_light--text_orange); - --theme--text_yellow: var(--theme_light--text_yellow); - --theme--text_green: var(--theme_light--text_green); - --theme--text_blue: var(--theme_light--text_blue); - --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--select-text: var(--theme_light--select-text); - --theme--bg-text: var(--theme_light--bg-text); - --theme--bg_gray: var(--theme_light--bg_gray); - --theme--bg_gray-text: var(--theme_light--bg_gray-text); - --theme--bg_brown: var(--theme_light--bg_brown); - --theme--bg_brown-text: var(--theme_light--bg_brown-text); - --theme--bg_orange: var(--theme_light--bg_orange); - --theme--bg_orange-text: var(--theme_light--bg_orange-text); - --theme--bg_yellow: var(--theme_light--bg_yellow); - --theme--bg_yellow-text: var(--theme_light--bg_yellow-text); - --theme--bg_green: var(--theme_light--bg_green); - --theme--bg_green-text: var(--theme_light--bg_green-text); - --theme--bg_blue: var(--theme_light--bg_blue); - --theme--bg_blue-text: var(--theme_light--bg_blue-text); - --theme--bg_purple: var(--theme_light--bg_purple); - --theme--bg_purple-text: var(--theme_light--bg_purple-text); - --theme--bg_pink: var(--theme_light--bg_pink); - --theme--bg_pink-text: var(--theme_light--bg_pink-text); - --theme--bg_red: var(--theme_light--bg_red); - --theme--bg_red-text: var(--theme_light--bg_red-text); - --theme--line-text: var(--theme_light--line-text); - --theme--line_gray: var(--theme_light--line_gray); - --theme--line_gray-text: var(--theme_light--line_gray-text); - --theme--line_brown: var(--theme_light--line_brown); - --theme--line_brown-text: var(--theme_light--line_brown-text); - --theme--line_orange: var(--theme_light--line_orange); - --theme--line_orange-text: var(--theme_light--line_orange-text); - --theme--line_yellow: var(--theme_light--line_yellow); - --theme--line_yellow-text: var(--theme_light--line_yellow-text); - --theme--line_green: var(--theme_light--line_green); - --theme--line_green-text: var(--theme_light--line_green-text); - --theme--line_blue: var(--theme_light--line_blue); - --theme--line_blue-text: var(--theme_light--line_blue-text); - --theme--line_purple: var(--theme_light--line_purple); - --theme--line_purple-text: var(--theme_light--line_purple-text); - --theme--line_pink: var(--theme_light--line_pink); - --theme--line_pink-text: var(--theme_light--line_pink-text); - --theme--line_red: var(--theme_light--line_red); - --theme--line_red-text: var(--theme_light--line_red-text); - --theme--select_gray: var(--theme_light--select_gray); - --theme--select_gray-text: var(--theme_light--select_gray-text); - --theme--select_brown: var(--theme_light--select_brown); - --theme--select_brown-text: var(--theme_light--select_brown-text); - --theme--select_orange: var(--theme_light--select_orange); - --theme--select_orange-text: var(--theme_light--select_orange-text); - --theme--select_yellow: var(--theme_light--select_yellow); - --theme--select_yellow-text: var(--theme_light--select_yellow-text); - --theme--select_green: var(--theme_light--select_green); - --theme--select_green-text: var(--theme_light--select_green-text); - --theme--select_blue: var(--theme_light--select_blue); - --theme--select_blue-text: var(--theme_light--select_blue-text); - --theme--select_purple: var(--theme_light--select_purple); - --theme--select_purple-text: var(--theme_light--select_purple-text); - --theme--select_pink: var(--theme_light--select_pink); - --theme--select_pink-text: var(--theme_light--select_pink-text); - --theme--select_red: var(--theme_light--select_red); - --theme--select_red-text: var(--theme_light--select_red-text); - --theme--callout-text: var(--theme_light--callout-text); - --theme--callout_gray: var(--theme_light--callout_gray); - --theme--callout_gray-text: var(--theme_light--callout_gray-text); - --theme--callout_brown: var(--theme_light--callout_brown); - --theme--callout_brown-text: var(--theme_light--callout_brown-text); - --theme--callout_orange: var(--theme_light--callout_orange); - --theme--callout_orange-text: var(--theme_light--callout_orange-text); - --theme--callout_yellow: var(--theme_light--callout_yellow); - --theme--callout_yellow-text: var(--theme_light--callout_yellow-text); - --theme--callout_green: var(--theme_light--callout_green); - --theme--callout_green-text: var(--theme_light--callout_green-text); - --theme--callout_blue: var(--theme_light--callout_blue); - --theme--callout_blue-text: var(--theme_light--callout_blue-text); - --theme--callout_purple: var(--theme_light--callout_purple); - --theme--callout_purple-text: var(--theme_light--callout_purple-text); - --theme--callout_pink: var(--theme_light--callout_pink); - --theme--callout_pink-text: var(--theme_light--callout_pink-text); - --theme--callout_red: var(--theme_light--callout_red); - --theme--callout_red-text: var(--theme_light--callout_red-text); - --theme--code_inline-text: var(--theme_light--code_inline-text); - --theme--code_inline-background: var(--theme_light--code_inline-background); - --theme--code-text: var(--theme_light--code-text); - --theme--code-background: var(--theme_light--code-background); - --theme--code_function: var(--theme_light--code_function); - --theme--code_parameter: var(--theme_light--code_parameter); - --theme--code_keyword: var(--theme_light--code_keyword); - --theme--code_constant: var(--theme_light--code_constant); - --theme--code_tag: var(--theme_light--code_tag); - --theme--code_operator: var(--theme_light--code_operator); - --theme--code_important: var(--theme_light--code_important); - --theme--code_regex: var(--theme_light--code_regex); - --theme--code_property: var(--theme_light--code_property); - --theme--code_builtin: var(--theme_light--code_builtin); - --theme--code_class-name: var(--theme_light--code_class-name); - --theme--code_attr-name: var(--theme_light--code_attr-name); - --theme--code_attr-value: var(--theme_light--code_attr-value); - --theme--code_selector: var(--theme_light--code_selector); - --theme--code_id: var(--theme_light--code_id); - --theme--code_class: var(--theme_light--code_class); - --theme--code_pseudo-element: var(--theme_light--code_pseudo-element); - --theme--code_pseudo-class: var(--theme_light--code_pseudo-class); - --theme--code_attribute: var(--theme_light--code_attribute); - --theme--code_value: var(--theme_light--code_value); - --theme--code_unit: var(--theme_light--code_unit); - --theme--code_comment: var(--theme_light--code_comment); - --theme--code_punctuation: var(--theme_light--code_punctuation); - --theme--code_annotation: var(--theme_light--code_annotation); - --theme--code_decorator: var(--theme_light--code_decorator); - --theme--code_doctype: var(--theme_light--code_doctype); - --theme--code_number: var(--theme_light--code_number); - --theme--code_string: var(--theme_light--code_string); - --theme--code_boolean: var(--theme_light--code_boolean); -} diff --git a/mods/custom-inserts/mod.js b/mods/custom-inserts/mod.js deleted file mode 100644 index 9c05008..0000000 --- a/mods/custom-inserts/mod.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * custom inserts - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: 'b4b0aced-2059-43bf-8d1d-ccd757ee5ebb', - tags: ['extension'], - name: 'custom inserts', - desc: `link files for small client-side tweaks. (not sure how to do something? check out the - [tweaks](https://github.com/notion-enhancer/notion-enhancer/blob/master/TWEAKS.md) collection.)`, - version: '0.1.3', - author: 'dragonwocky', - options: [ - { - key: 'css', - label: 'css insert', - type: 'file', - extensions: ['css'], - }, - { - key: 'js', - label: 'client-side js insert', - type: 'file', - extensions: ['js'], - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - const fs = require('fs-extra'); - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - if (store().css) { - try { - document - .querySelector('head') - .appendChild( - createElement( - `` - ) - ); - } catch (err) { - console.warn(' invalid css file... unsetting.'); - store().css = ''; - } - } - if (store().js) { - try { - require(store().js); - } catch (err) { - console.warn(' invalid js file... unsetting.'); - store().js = ''; - } - } - }); - }, - }, -}; diff --git a/mods/dark+/mod.js b/mods/dark+/mod.js deleted file mode 100644 index 981a1c7..0000000 --- a/mods/dark+/mod.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * dark+ - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'c86cfe98-e645-4822-aa6b-e2de1e08bafa', - tags: ['theme', 'dark'], - name: 'dark+', - desc: 'a vivid-colour near-black theme.', - version: '0.1.6', - 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/mods/dark+/one-color.js b/mods/dark+/one-color.js deleted file mode 100644 index b602090..0000000 --- a/mods/dark+/one-color.js +++ /dev/null @@ -1,2 +0,0 @@ -!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 (https://dragonwocky.me/) - * (c) 2020 Alexa Baldon (https://github.com/runargs) - * under the MIT license - */ - -:root { - --theme_dark--main: rgb(5, 5, 5); - --theme_dark--sidebar: rgb(1, 1, 1); - --theme_dark--dragarea: #000; - --theme_dark--box-shadow_strong: none; - - --theme_dark--scrollbar: #23242599; - --theme_dark--scrollbar-border: transparent; - --theme_dark--scrollbar_hover: #37383899; - - --theme_dark--card: rgb(8, 8, 8); - --theme_dark--gallery: rgba(26, 26, 26, 0.3); - --theme_dark--select_input: rgb(12, 12, 12); - --theme_dark--table-border: rgba(46, 46, 46, 0.7); - --theme_dark--ui-border: var(--theme_dark--table-border); - --theme_dark--interactive_hover:rgba(55, 56, 56, 0.3); - - --theme_dark--option_hover-background: rgb(32, 32, 32); - - --theme_dark--text: rgb(228, 228, 228); - --theme_dark--text_ui: rgba(211, 211, 211, 0.637); - --theme_dark--text_ui_info: rgba(211, 211, 211, 0.466); - - --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(50, 169, 104); - --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(218, 47, 35); - - --theme_dark--select_gray: rgba(126, 128, 129, 0.5); - --theme_dark--select_brown: #50331f; - --theme_dark--select_orange: rgba(255, 155, 0, 0.58); - --theme_dark--select_yellow: rgba(183, 155, 0, 1); - --theme_dark--select_green: rgb(50, 129, 47); - --theme_dark--select_blue: rgba(0, 90, 146, 0.71); - --theme_dark--select_purple: rgba(91, 49, 148, 0.74); - --theme_dark--select_pink: rgba(243, 61, 159, 0.5); - --theme_dark--select_red: rgb(122, 20, 20); - - --theme_dark--bg_gray: var(--theme_dark--select_gray); - --theme_dark--bg_brown: var(--theme_dark--select_brown); - --theme_dark--bg_orange: var(--theme_dark--select_orange); - --theme_dark--bg_yellow: var(--theme_dark--select_yellow); - --theme_dark--bg_green: var(--theme_dark--select_green); - --theme_dark--bg_blue: var(--theme_dark--select_blue); - --theme_dark--bg_purple: var(--theme_dark--select_purple); - --theme_dark--bg_pink: var(--theme_dark--select_pink); - --theme_dark--bg_red: var(--theme_dark--select_red); - - --theme_dark--line_gray: rgba(126, 128, 129, 0.301); - --theme_dark--line_brown: #50331fad; - --theme_dark--line_orange: rgba(255, 153, 0, 0.315); - --theme_dark--line_yellow: rgba(183, 156, 0, 0.445); - --theme_dark--line_green: rgba(50, 129, 47, 0.39); - --theme_dark--line_blue: rgba(0, 90, 146, 0.521); - --theme_dark--line_purple: rgba(90, 49, 148, 0.349); - --theme_dark--line_pink: rgba(243, 61, 158, 0.301); - --theme_dark--line_red: rgba(122, 20, 20, 0.623); - - --theme_dark--callout_gray: rgba(126, 128, 129, 0.089); - --theme_dark--callout_brown: #50331f59; - --theme_dark--callout_orange: rgba(255, 153, 0, 0.164); - --theme_dark--callout_yellow: rgba(183, 156, 0, 0.274); - --theme_dark--callout_green: rgba(50, 129, 47, 0.191); - --theme_dark--callout_blue: rgba(0, 90, 146, 0.294); - --theme_dark--callout_purple: rgba(90, 49, 148, 0.219); - --theme_dark--callout_pink: rgba(243, 61, 158, 0.191); - --theme_dark--callout_red: rgba(122, 20, 20, 0.376); - - --theme_dark--code_inline-text: #7dc582; - --theme_dark--code_inline-background: rgb(8, 8, 8); - --theme_dark--code-background: rgb(8, 8, 8); - --theme_dark--code_function: #c7e1ff; - --theme_dark--code_keyword: #c397d8; - --theme_dark--code_tag: #82aed8; - --theme_dark--code_operator: rgb(166, 175, 201); - --theme_dark--code_important: #da265f; - --theme_dark--code_property: #82aed8; - --theme_dark--code_builtin: #ff6294; - --theme_dark--code_attr-name: #ff6294; - --theme_dark--code_comment: rgb(166, 175, 201); - --theme_dark--code_punctuation: rgb(166, 175, 201); - --theme_dark--code_doctype: rgb(166, 175, 201); - --theme_dark--code_number: #c397d8; - --theme_dark--code_string: #7dc582; - --theme_dark--code_attr-value: #7dc582; -} diff --git a/mods/dracula/app.css b/mods/dracula/app.css deleted file mode 100644 index bc81138..0000000 --- a/mods/dracula/app.css +++ /dev/null @@ -1,97 +0,0 @@ -/* - * dracula - * (c) 2020 @mimishahzad386#5651 - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -.notion-dark-theme img[src*='/images/onboarding/use-case-note.png'], -.notion-dark-theme - img[src*='/images/onboarding/team-features-illustration.png'] { - filter: invert(1) !important; -} -.notion-dark-theme img[src*='/images/onboarding/checked.svg'] { - filter: hue-rotate(45deg) !important; -} -.notion-dark-theme - img[style*='display: block; object-fit: cover; border-radius: 100%; width: 90px; height: 90px;'], -.notion-dark-theme - img[style*='display: block; object-fit: cover; border-radius: 3px; width: 56.832px; height: 56.832px; transition: opacity 100ms ease-out 0s;'] { - transition: filter 0.4s ease !important; -} -.notion-dark-theme - img[style*='display: block; object-fit: cover; border-radius: 100%; width: 90px; height: 90px;']:hover, -.notion-dark-theme - img[style*='display: block; object-fit: cover; border-radius: 3px; width: 56.832px; height: 56.832px; transition: opacity 100ms ease-out 0s;']:hover { - filter: brightness(1.2); -} - -.notion-dark-theme - [style*='font-family: Fira Code, Menlo, Courier, monospace;'] { - filter: hue-rotate(170deg) !important; -} - -.notion-dark-theme - .notion-token-remove-button[role*='button'][tabindex*='0']:hover, -.notion-dark-theme .notion-record-icon { - background: transparent !important; -} - -.notion-dark-theme .notion-focusable:focus-within, -.notion-dark-theme .notion-to_do-block > div > div > div[style*='background:'], -.notion-dark-theme div[role='button'], -[style*='height: 4px;'] - > .notion-selectable.notion-collection_view_page-block - > *, -.notion-dark-theme .notion-calendar-view-day[style*='background: #282a36;'], -.DayPicker-Day--today, -.notion-dark-theme - .DayPicker:not(.DayPicker--interactionDisabled) - .DayPicker-Day--outside:hover, -.notion-dark-theme - .DayPicker:not(.DayPicker--interactionDisabled) - .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--value) - .DayPicker-Day.DayPicker-Day--start.DayPicker-Day--selected, -.notion-dark-theme .DayPicker-Day.DayPicker-Day--range.DayPicker-Day--start, -.notion-dark-theme .DayPicker-Day.DayPicker-Day--range.DayPicker-Day--end { - transition: color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease !important; -} - -.notion-dark-theme [style*='background: #282a36;'], -.notion-dark-theme - [style*='background: rgb(80, 85, 88);'][style*='color: rgba(255, 255, 255, 0.7)'], -.notion-dark-theme - [style*='background: rgb(80, 85, 88);'][style*='width: 18px;'][style*='height: 18px;'], -.notion-dark-theme - [style*='box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 5px 10px, rgba(15, 15, 15, 0.4) 0px 15px 40px;'], -.notion-dark-theme [style*='background: rgba(151, 154, 155, 0.5);'], -.notion-dark-theme [style*='background: rgba(147, 114, 100, 0.5)'], -.notion-dark-theme [style*='background: rgba(255, 163, 68, 0.5)'], -.notion-dark-theme [style*='background: rgba(255, 220, 73, 0.5)'], -.notion-dark-theme [style*='background: rgba(77, 171, 154, 0.5)'], -.notion-dark-theme [style*='background: rgba(82, 156, 202, 0.5)'], -.notion-dark-theme [style*='background: rgba(154, 109, 215, 0.5)'], -.notion-dark-theme [style*='background: rgba(226, 85, 161, 0.5)'], -.notion-dark-theme [style*='background: rgba(255, 115, 105, 0.5)'] { - box-shadow: 0 2px 4px rgb(0 0 0 / 66%) !important; -} - -.notion-dark-theme .notion-code-block .token.parameter, -.notion-dark-theme .notion-code-block .token.decorator, -.notion-dark-theme .notion-code-block .token.id, -.notion-dark-theme .notion-code-block .token.class, -.notion-dark-theme .notion-code-block .token.pseudo-element, -.notion-dark-theme .notion-code-block .token.pseudo-class, -.notion-dark-theme .notion-code-block .token.attribute { - font-style: italic; -} - -.notion-dark-theme .notion-code-block .token.punctuation { - opacity: 1; -} - - -.notion-dark-theme [class^="notion-outliner"] [style*="background: rgb(71, 76, 80);"] .triangle[fill] { - fill: var(--theme--text) -} \ No newline at end of file diff --git a/mods/dracula/mod.js b/mods/dracula/mod.js deleted file mode 100644 index 24ce175..0000000 --- a/mods/dracula/mod.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * dracula - * (c) 2020 @mimishahzad386#5651 - * (c) 2020 dracula - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: '033bff54-50ba-4cec-bdc0-b2ca7e307086', - tags: ['theme', 'dark'], - name: 'dracula', - desc: - 'a theme based on the popular dracula color palette originally by zeno rocha and friends. ', - version: '0.2.0', - author: 'dracula', -}; diff --git a/mods/dracula/variables.css b/mods/dracula/variables.css deleted file mode 100644 index f217218..0000000 --- a/mods/dracula/variables.css +++ /dev/null @@ -1,195 +0,0 @@ -/* - * dracula - * (c) 2020 @mimishahzad386#5651 - * (c) 2020 dracula - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Alexa Baldon (https://github.com/runargs) - * (c) 2020 CloudHill - * under the MIT license - */ - -:root { - - /* PALETTE */ - - --theme_dracula--bg: #282a36; - --theme_dracula--bg_lighter: #424450; - --theme_dracula--bg_light: #343746; - --theme_dracula--bg_dark: #21222c; - --theme_dracula--bg_darker: #191a21; - - --theme_dracula--fg: #f8f8f2; - --theme_dracula--fg_dark: #babbba; - - --theme_dracula--comment: #6272a4; - --theme_dracula--selection: #44475a; - --theme_dracula--line_highlight: #44475a75; - - --theme_dracula--gray: var(--theme_dracula--fg_dark); - --theme_dracula--brown: #6272a4; - --theme_dracula--orange: #ffb86c; - --theme_dracula--yellow: #f1fa8c; - --theme_dracula--green: #50fa7b; - --theme_dracula--blue: #8be9fd; - --theme_dracula--purple: #bd93f9; - --theme_dracula--pink: #ff79c6; - --theme_dracula--red: #ff5555; - - --theme_dracula--bg_gray: var(--theme_dracula--bg_light); - --theme_dracula--bg_brown: #465079; - --theme_dracula--bg_orange: #8a6345; - --theme_dracula--bg_yellow: #8e9656; - --theme_dracula--bg_green: #3f945f; - --theme_dracula--bg_blue: #498096; - --theme_dracula--bg_purple: #6a549b; - --theme_dracula--bg_pink: #8d4a7c; - --theme_dracula--bg_red: #943844; - - /* MAIN */ - - --theme_dark--main: var(--theme_dracula--bg); - --theme_dark--sidebar: var(--theme_dracula--bg_dark); - --theme_dark--overlay: #0d0d0e80; - --theme_dark--dragarea: var(--theme_dracula--bg_dark); - - --theme_dark--font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', - Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', - 'Segoe UI Symbol'; - - --theme_dark--scrollbar: var(--theme_dracula--selection); - --theme_dark--scrollbar_hover: var(--theme_dracula--comment); - - --theme_dark--card: var(--theme_dracula--bg_light); - --theme_dark--gallery: var(--theme_dracula--bg_dark); - --theme_dark--select_input: var(--theme_dracula--selection); - - --theme_dark--table-border: var(--theme_dracula--bg_lighter); - --theme_dark--table-border_row: var(--theme_dark--table-border); - --theme_dark--table-border_column: var(--theme_dark--table-border); - --theme_dark--table-border_selected: var(--theme_dracula--purple); - - --theme_dark--ui-border: var(--theme_dark--table-border); - --theme_dark--interactive_hover: var(--theme_dracula--line_highlight); - --theme_dark--button_close: var(--theme_dracula--red); - - --theme_dark--selected: #bb8dfd3d; - --theme_dark--primary: var(--theme_dracula--purple); - --theme_dark--primary_hover: #b179ff; - --theme_dark--primary_click: #9f5ff8; - --theme_dark--primary_indicator: var(--theme_dracula--comment); - --theme_dark--primary_indicator_hover: var(--theme_dracula--bg_purple); - - --theme_dark--option_active-background: var(--theme_dark--primary); - --theme_dark--option_hover-background: var(--theme_dark--bg_purple); - - --theme_dark--danger_text: var(--theme_dracula--red); - --theme_dark--danger_border: var(--theme_dracula--bg_red); - - /* TEXT */ - - --theme_dark--text: var(--theme_dracula--fg); - --theme_dark--text_ui: var(--theme_dracula--fg_dark); - --theme_dark--text_ui_info: var(--theme_dracula--comment); - - --theme_dark--text_gray: var(--theme_dracula--gray); - --theme_dark--text_brown: var(--theme_dracula--brown); - --theme_dark--text_orange: var(--theme_dracula--orange); - --theme_dark--text_yellow: var(--theme_dracula--yellow); - --theme_dark--text_green: var(--theme_dracula--green); - --theme_dark--text_blue: var(--theme_dracula--blue); - --theme_dark--text_purple: var(--theme_dracula--purple); - --theme_dark--text_pink: var(--theme_dracula--pink); - --theme_dark--text_red: var(--theme_dracula--red); - - /* SELECT */ - - --theme_dark--select-text: var(--theme_dracula--bg); - --theme_dark--select_gray: var(--theme_dracula--gray); - --theme_dark--select_brown: var(--theme_dracula--brown); - --theme_dark--select_brown-text: var(--theme_dracula--fg); - --theme_dark--select_orange: var(--theme_dracula--orange); - --theme_dark--select_yellow: var(--theme_dracula--yellow); - --theme_dark--select_green: var(--theme_dracula--green); - --theme_dark--select_blue: var(--theme_dracula--blue); - --theme_dark--select_purple: var(--theme_dracula--purple); - --theme_dark--select_pink: var(--theme_dracula--pink); - --theme_dark--select_red: var(--theme_dracula--red); - --theme_dark--select_red-text: var(--theme_dracula--fg); - - /* BG */ - - --theme_dark--bg-text: var(--theme_dracula--fg); - --theme_dark--bg_gray: var(--theme_dracula--bg_gray); - --theme_dark--bg_brown: var(--theme_dracula--bg_brown); - --theme_dark--bg_orange: var(--theme_dracula--bg_orange); - --theme_dark--bg_yellow: var(--theme_dracula--bg_yellow); - --theme_dark--bg_green: var(--theme_dracula--bg_green); - --theme_dark--bg_blue: var(--theme_dracula--bg_blue); - --theme_dark--bg_purple: var(--theme_dracula--bg_purple); - --theme_dark--bg_pink: var(--theme_dracula--bg_pink); - --theme_dark--bg_red: var(--theme_dracula--bg_red); - - /* LINE */ - - --theme_dark--line-text: var(--theme_dracula--fg); - --theme_dark--line_gray: var(--theme_dracula--bg_gray); - --theme_dark--line_brown: var(--theme_dracula--bg_brown); - --theme_dark--line_orange: var(--theme_dracula--bg_orange); - --theme_dark--line_yellow: var(--theme_dracula--bg_yellow); - --theme_dark--line_green: var(--theme_dracula--bg_green); - --theme_dark--line_blue: var(--theme_dracula--bg_blue); - --theme_dark--line_purple: var(--theme_dracula--bg_purple); - --theme_dark--line_pink: var(--theme_dracula--bg_pink); - --theme_dark--line_red: var(--theme_dracula--bg_red); - - /* CALLOUT */ - - --theme_dark--callout-text: var(--theme_dracula--fg); - --theme_dark--callout_gray: var(--theme_dracula--bg_gray); - --theme_dark--callout_brown: var(--theme_dracula--bg_brown); - --theme_dark--callout_orange: var(--theme_dracula--bg_orange); - --theme_dark--callout_yellow: var(--theme_dracula--bg_yellow); - --theme_dark--callout_green: var(--theme_dracula--bg_green); - --theme_dark--callout_blue: var(--theme_dracula--bg_blue); - --theme_dark--callout_purple: var(--theme_dracula--bg_purple); - --theme_dark--callout_pink: var(--theme_dracula--bg_pink); - --theme_dark--callout_red: var(--theme_dracula--bg_red); - - /* CODE */ - - --theme_dark--code_inline-text: var(--theme_dracula--green); - --theme_dark--code_inline-background: var(--theme_dracula--bg_light); - - --theme_dark--code-text: var(--theme_dracula--fg); - --theme_dark--code-background: var(--theme_dracula--bg_light); - - --theme_dark--code_function: var(--theme_dracula--green); - --theme_dark--code_parameter: var(--theme_dracula--orange); - --theme_dark--code_keyword: var(--theme_dracula--pink); - --theme_dark--code_constant: var(--theme_dracula--purple); - --theme_dark--code_tag: var(--theme_dracula--pink); - --theme_dark--code_operator: var(--theme_dracula--pink); - --theme_dark--code_important: var(--theme_dracula--pink); - --theme_dark--code_regex: var(--theme_dracula--red); - --theme_dark--code_property: var(--theme_dracula--blue); - --theme_dark--code_builtin: var(--theme_dracula--blue); - --theme_dark--code_class-name: var(--theme_dracula--blue); - --theme_dark--code_attr-name: var(--theme_dracula--green); - --theme_dark--code_attr-value: var(--theme_dracula--yellow); - --theme_dark--code_selector: var(--theme_dracula--pink); - --theme_dark--code_id: var(--theme_dracula--green); - --theme_dark--code_class: var(--theme_dracula--green); - --theme_dark--code_pseudo-element: var(--theme_dracula--green); - --theme_dark--code_pseudo-class: var(--theme_dracula--green); - --theme_dark--code_attribute: var(--theme_dracula--green); - --theme_dark--code_value: var(--theme_dracula--yellow); - --theme_dark--code_unit: var(--theme_dracula--pink); - --theme_dark--code_comment: var(--theme_dracula--comment); - --theme_dark--code_punctuation: var(--theme_dracula--text); - --theme_dark--code_annotation: var(--theme_dark--code_punctuation); - --theme_dark--code_decorator: var(--theme_dracula--green); - --theme_dark--code_doctype: var(--theme_dracula--fg_dark); - --theme_dark--code_number: var(--theme_dracula--purple); - --theme_dark--code_string: var(--theme_dracula--yellow); - --theme_dark--code_boolean: var(--theme_dracula--purple); -} diff --git a/mods/emoji-sets/app.css b/mods/emoji-sets/app.css deleted file mode 100644 index cf8b1ec..0000000 --- a/mods/emoji-sets/app.css +++ /dev/null @@ -1,11 +0,0 @@ -/* - * emoji sets - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) this css fix was provided by Arecsu from martyr⁠— (https://martyr.shop/) - * under the MIT license - */ - -div.notion-record-icon [style*='Apple Color Emoji'] { - display: flex; - justify-content: center; -} diff --git a/mods/emoji-sets/mod.js b/mods/emoji-sets/mod.js deleted file mode 100644 index b14b5c6..0000000 --- a/mods/emoji-sets/mod.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * emoji sets - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) minor fixes by Arecsu from martyr⁠— (https://martyr.shop/) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'a2401ee1-93ba-4b8c-9781-7f570bf5d71e', - tags: ['extension'], - name: 'emoji sets', - desc: 'pick from a variety of emoji styles to use.', - version: '0.3.0', - author: 'dragonwocky', - options: [ - { - key: 'style', - label: '', - type: 'select', - value: [ - 'twitter', - 'apple', - 'google', - 'microsoft', - 'samsung', - 'whatsapp', - 'facebook', - 'messenger', - 'joypixels', - 'openmoji', - 'emojidex', - 'lg', - 'htc', - 'mozilla', - ], - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - let tweaked = false; - - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - let queue = []; - const observer = new MutationObserver((list, observer) => { - if (!queue.length) requestAnimationFrame(handle); - queue.push(...list); - }); - - const observe = ()=> { - observer.observe(document.body, { - childList: true, - subtree: true, - characterData: true, - }); - }; - observe(); // initiate observer - - function handle() { - queue = []; - observer.disconnect(); // stop observer from getting stuck into an infinite loop from here - const isMac = process.platform === 'darwin', - native = - (store().style === 'microsoft' && process.platform === 'win32') || - (store().style === 'apple' && isMac); - if (store().style !== (isMac ? 'apple' : 'twitter') || tweaked) { - if (isMac) { - if (native) { - document - .querySelectorAll('span[role="image"][aria-label]') - .forEach((el) => { - el.style.background = ''; - el.style.color = 'currentColor'; - }); - } else { - document - .querySelectorAll('span[role="image"][aria-label]') - .forEach((el) => { - if (!el.style.background.includes(store().style)) { - el.style.background = `url(https://emojicdn.elk.sh/${el.getAttribute( - 'aria-label' - )}?style=${store().style})`; - el.style.width = el.parentElement.style.fontSize; - el.style.backgroundSize = 'contain'; - el.style.backgroundRepeat = 'no-repeat'; - el.style.color = 'transparent'; - } - }); - } - } else { - document - .querySelectorAll( - '[src*="notion-emojis.s3"]:not(.notion-emoji)' - ) - .forEach((el) => el.remove()); - if (native) { - document.querySelectorAll('.notion-emoji').forEach((el) => { - if ( - el.parentElement.querySelectorAll( - 'span[role="image"][aria-label]' - ).length !== - el.parentElement.querySelectorAll('.notion-emoji').length - ) { - el.insertAdjacentHTML( - 'beforebegin', - `${el.getAttribute('alt')}` - ); - el.style.display = 'none'; - if (el.parentElement.getAttribute('contenteditable')) - el.remove(); - } else if ( - el.previousElementSibling.matches( - 'span[role="image"][aria-label]' - ) - ) { - el.previousElementSibling.innerText = el.getAttribute( - 'alt' - ); - el.setAttribute('aria-label', el.getAttribute('alt')); - } - }); - } else { - document.querySelectorAll('.notion-emoji').forEach((el) => { - el.parentElement - .querySelectorAll('span[role="image"][aria-label]') - .forEach((text) => text.remove()); - el.style.display = 'inline-block'; - if (!el.style.background.includes(store().style)) { - el.style.background = `url(https://emojicdn.elk.sh/${el.getAttribute( - 'aria-label' - )}?style=${store().style})`; - el.style.backgroundSize = 'contain'; - el.style.backgroundRepeat = 'no-repeat'; - el.style.opacity = 1; - } - }); - } - } - tweaked = true; - } - observe(); // re-initiating the observer now that we don't risk an infinite loop - } - }); - }, - }, -}; diff --git a/mods/focus-mode/app.css b/mods/focus-mode/app.css deleted file mode 100644 index 032761f..0000000 --- a/mods/focus-mode/app.css +++ /dev/null @@ -1,28 +0,0 @@ -/* - * focus mode - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Arecsu - * under the MIT license - */ - -.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; -} -/* add space at the bottom of the main frame when sidebar is hidden -* -- matches space at top for titlebar */ -[data-focusmode='padded'] .notion-dark-theme .notion-frame { - transition: height 100ms ease 0s; -} -[data-focusmode='padded'] - .notion-sidebar-container[style*='width: 0px;'] - + .notion-frame { - height: calc( - 100% - (var(--configured--dragarea_height, 10px) + 45px) - ) !important; -} diff --git a/mods/focus-mode/mod.js b/mods/focus-mode/mod.js deleted file mode 100644 index 032de3e..0000000 --- a/mods/focus-mode/mod.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * focus mode - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Arecsu - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: '5a08598d-bfac-4167-9ae8-2bd0e2ef141e', - tags: ['extension'], - name: 'focus mode', - desc: - 'hide the titlebar/menubar if the sidebar is closed (will be shown on hover).', - version: '0.2.0', - author: 'arecsu', - options: [ - { - key: 'padded', - label: 'add padding to bottom of the page', - desc: `will only take effect when the sidebar is hidden. aims to make the canvas\ - as symmetrical/consistent as possible: if there is empty space on 3 sides, the 4th should follow.`, - type: 'toggle', - value: true, - }, - ], - hacks: { - 'renderer/preload.js': (store, __exports) => { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - if (store().padded) document.body.dataset.focusmode = 'padded'; - }); - }, - }, -}; diff --git a/mods/font-chooser/mod.js b/mods/font-chooser/mod.js deleted file mode 100644 index a25a31c..0000000 --- a/mods/font-chooser/mod.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * font chooser - * (c) 2020 torchatlas (https://bit.ly/torchatlas) - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'e0d8d148-45e7-4d79-8313-e7b2ad8abe16', - tags: ['extension'], - name: 'font chooser', - desc: - 'customize fonts. for each option, type in the name of the font you would like to use, or leave it blank to not change anything.

make sure the fonts you type are installed on your device.', - version: '0.3.0', - author: 'torchatlas', - options: [ - { - key: 'sans', - label: 'sans-serif (inc. ui):', - type: 'input', - value: '', - }, - { - key: 'serif', - label: 'serif:', - type: 'input', - value: '', - }, - { - key: 'mono', - label: 'monospace:', - type: 'input', - value: '', - }, - { - key: 'code', - label: 'code:', - type: 'input', - value: '', - }, - { - key: 'quote', - label: 'quote:', - type: 'input', - value: '', - }, - { - key: 'headings', - label: 'headings:', - type: 'input', - value: '', - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - const attempt_interval = setInterval(enhance, 500); - async function enhance() { - if (!document.querySelector('.notion-app-inner')) return; - clearInterval(attempt_interval); - for (let style of ['sans', 'serif', 'mono', 'code', 'quote', 'headings']) { - if (!store()[style]) continue; - - document - .querySelector('.notion-app-inner') - .style.setProperty(`--theme--font_${style}`, store()[style]); - } - } - }, - }, -}; diff --git a/mods/gameish/app.css b/mods/gameish/app.css deleted file mode 100644 index 03f001d..0000000 --- a/mods/gameish/app.css +++ /dev/null @@ -1,14 +0,0 @@ -/* - * gameish - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 u/LVL100ShrekCultist - * under the MIT license - */ - -.notion-dark-theme - .notion-scroller.vertical.horizontal - .notion-table-view - .notion-selectable.notion-collection_view-block - > :first-child { - background: var(--theme--card) !important; -} diff --git a/mods/gameish/mod.js b/mods/gameish/mod.js deleted file mode 100644 index 7117738..0000000 --- a/mods/gameish/mod.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * gameish - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 u/LVL100ShrekCultist - * 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.1.4', - author: { - name: 'LVL100ShrekCultist', - link: 'https://www.reddit.com/user/LVL100ShrekCultist/', - avatar: - 'https://styles.redditmedia.com/t5_2js69j/styles/profileIcon_jvnzmo30fyq41.jpg', - }, -}; diff --git a/mods/gameish/variables.css b/mods/gameish/variables.css deleted file mode 100644 index 6c964e3..0000000 --- a/mods/gameish/variables.css +++ /dev/null @@ -1,71 +0,0 @@ -/* - * gameish - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 u/LVL100ShrekCultist - * under the MIT license - */ - -@import '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--dragarea: #19181f; - - --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_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--scrollbar: #221f29; - --theme_dark--scrollbar_hover: #312d3c; - - --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--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_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_yellow: #ffe529; - --theme_dark--text_green: #64d97b; - --theme_dark--text_purple: #d43cc7; - --theme_dark--text_red: #d93939; - - --theme_dark--select_red: rgba(216, 57, 46, 0.5); - - --theme_dark--bg_brown: rgb(78, 57, 48); - --theme_dark--bg_orange: rgb(136, 80, 48); - --theme_dark--bg_yellow: #fbe2287c; - --theme_dark--bg_red: rgb(151, 62, 62); - - --theme_dark--line_brown: var(--theme_dark--bg_brown); - --theme_dark--line_orange: var(--theme_dark--bg_orange); - --theme_dark--line_yellow: var(--theme_dark--bg_yellow); - --theme_dark--line_red: var(--theme_dark--bg_red); - - --theme_dark--callout_brown: var(--theme_dark--bg_brown); - --theme_dark--callout_orange: var(--theme_dark--bg_orange); - --theme_dark--callout_yellow: var(--theme_dark--bg_yellow); - --theme_dark--callout_red: var(--theme_dark--bg_red); - - --theme_dark--code_inline-text: #d9cbec; - --theme_dark--code_inline-background: #24222c; -} diff --git a/mods/global-block-links/app.css b/mods/global-block-links/app.css deleted file mode 100644 index c9e3ca0..0000000 --- a/mods/global-block-links/app.css +++ /dev/null @@ -1,101 +0,0 @@ -/* - * global linking blocks - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -/* ========== THE PAGE BUTTON ========== */ -.admiraldus-glb-page-button -{ - display: inline-flex; - align-items: center; - flex-shrink: 0; - border-radius: 3px; - height: 28px; - min-width: 0px; - padding-right: 8px; - padding-left: 6px; - white-space: nowrap; - font-size: 14px; - line-height: 1.2; - color: var(--theme--text); - cursor: pointer; - transition: background 20ms ease-in 0s; - user-select: none; -} - -.admiraldus-glb-page-button:hover -{ - background: var(--theme--interactive_hover); - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border); -} - -.admiraldus-glb-page-button > svg -{ - backface-visibility: hidden; - display: block; - flex-shrink: 0; - margin-right: 6px; - height: 16px; - width: 16px; - fill: var(--theme--text_ui); -} - -.admiraldus-glb-page-button > span { - opacity: 1; - transition: opacity .4s ease; -} - -.admiraldus-glb-span-hide { - position: absolute; - top: -9999px; - opacity: 0 !important; -} - -/* ========== THE BLOCK BUTTON ========== */ -.admiraldus-glb-block-button { - display: flex; - align-items: center; - min-height: 28px; - width: 100%; - font-size: var(--theme--font_label-size); - line-height: 120%; - cursor: pointer; - transition: background 20ms ease-in 0s; - user-select: none; -} - -.admiraldus-glb-block-button:hover -{ - background: var(--theme--interactive_hover); - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border); -} - -.admiraldus-glb-block-button > svg { - backface-visibility: hidden; - display: flex; - display: block; - justify-content: center; - align-items: center; - flex-shrink: 0; - margin-left: 14px; - height: 17px; - width: 17px; - fill: var(--theme--text); -} - -.admiraldus-glb-block-button > span { - margin-right: 14px; - margin-left: 8px; - min-width: 0px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - flex: 1 1 auto; -} - -/* ========== THE MENU ========== */ -.--on-hover div[role="button"]:not(.admiraldus-glb-block-button) { - background: transparent !important; - box-shadow: none !important; -} diff --git a/mods/global-block-links/helper.js b/mods/global-block-links/helper.js deleted file mode 100644 index 02b6c61..0000000 --- a/mods/global-block-links/helper.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * helper.js from admiraldus - * (c) 2020 admiraldus (https://github.com/admiraldus) - * use for your own modules but you have to attribute to me. - * under the MIT license - */ - -'use strict'; - -const PATH = require('path'); -const FS = require('fs-extra'); - -var x$ = { - sel: function(els, mode = false, base = null) { - base = base === null ? document : base; - return mode ? base.querySelectorAll(els) : base.querySelector(els); - }, - - cls: { - r: function(els, cls, mode = false, base = null) { - base = base === null ? document : base; - mode ? x$.sel(els, true).forEach((el) => - el.classList.remove(cls)) : els.classList.remove(cls); - }, - - a: function(els, cls, mode = false, base = null) { - base = base === null ? document : base; - mode ? x$.sel(els, true).forEach((el) => - el.classList.add(cls)) : els.classList.add(cls); - }, - - c: function(els, cls, mode = false, base = null) { - base = base === null ? document : base; - return mode ? x$.sel(els, true).forEach((el) => - el.classList.contains(cls)) : els.classList.contains(cls); - }, - }, - - svg: function(path) { - return FS.readFile(PATH.resolve(__dirname + path)); - }, - - on: function(base, event, fn, flag = false) { - base.addEventListener(event, fn, flag); - }, - - sim: function(events, els) { - events.forEach((event) => els.dispatchEvent( - new MouseEvent(event, { - view: window, - bubbles: true, - cancelable: true, - buttons: 1, - }))); - }, - - obs: function(fn, els, config) { - const observer = new MutationObserver(fn); - observer.observe(els, config); - }, - - clp: function(mode = true, value) { - switch (mode) { - case false: - navigator.clipboard.writeText(value); - break; - case true: - return navigator.clipboard.readText(); - break; - } - }, - - el: function(html) { - const temp = document.createElement('template'); - temp.innerHTML = html.trim(); - return temp.content.firstElementChild; - }, -}; - -module.exports = { - x$, -}; diff --git a/mods/global-block-links/icons/chain.svg b/mods/global-block-links/icons/chain.svg deleted file mode 100644 index 31cdcfa..0000000 --- a/mods/global-block-links/icons/chain.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/mods/global-block-links/icons/globe.svg b/mods/global-block-links/icons/globe.svg deleted file mode 100644 index b88b775..0000000 --- a/mods/global-block-links/icons/globe.svg +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mods/global-block-links/mod.js b/mods/global-block-links/mod.js deleted file mode 100644 index 2639965..0000000 --- a/mods/global-block-links/mod.js +++ /dev/null @@ -1,241 +0,0 @@ -/* - * global linking blocks - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -'use strict'; - -const {x$} = require('./helper.js'); - -module.exports = { - id: '74856af4-6970-455d-bd86-0a385a402dd1', - name: 'global linking blocks', - tags: ['extension'], - desc: 'easily copy the global link of the page or the desired block.', - version: '0.1.0', - author: { - name: 'admiraldus', - link: 'https://github.com/admiraldus', - avatar: 'https://raw.githubusercontent.com/admiraldus/admiraldus/main/module.gif', - }, - options: [ - { - key: 'hidePageButton', - label: 'show the page link button', - type: 'toggle', - value: true, - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', () => { - if (document.readyState !== 'complete') return false; - - /** - * Prevent selectors from failing. - * - * @return {Function} Returns "wait()" until "main()" returns. - */ - const wait = !function wait() { - const els = [x$.sel('.notion-frame'), x$.sel('.notion-topbar')]; - if (els.some((el) => el !== null)) return main(); - setTimeout(() => wait(), 500); - }(); - - /** - * Everything happens here. ¯\_(ツ)_/¯ - */ - async function main() { - const icons = { - globe: await x$.svg('/icons/globe.svg'), - chain: await x$.svg('/icons/chain.svg'), - }; - const pageClass = 'admiraldus-glb-page-button'; - const blockClass = 'admiraldus-glb-block-button'; - const spanClass = 'admiraldus-glb-span-hide'; - - if (store().hidePageButton) { - /** - * Create the page link button and append it to the topbar. - * - * @return {create} Returns "create()" if not appended. - */ - const pageButton = function create() { - const target = x$.sel('.notion-topbar-share-menu'); - if (target === null) return; - - const attr = [ - `class="${pageClass}" role="button" tabindex="0"`, - `class="${spanClass}"`, - ]; - const html = x$.el( - `
- ${icons.chain} - Copy link - Link copied!`); - - target.before(html); - if (html === null) return create(); - }; - pageButton(); - - /** - * Observer for the topbar. - */ - x$.obs(() => { - if (x$.sel(`.${pageClass}`) !== null) return; - pageButton(); - }, x$.sel('.notion-topbar'), { - subtree: true, childList: true, - }); - } - - /** - * Create the block link button and append it to the block menu. - * - * @param {HTMLDivElement} el The copy link button. - * - * @return {create} Returns "create()" if not appended. - */ - const blockButton = function create(el) { - const target = el; - const attr = `class="${blockClass}" role="button" tabindex="0"`; - const html = x$.el( - `
- ${icons.globe} - Global link -
`); - - target.before(html); - if (html === null) return create(); - }; - - let buttonDelay; - let link; - /** - * Copy the link to the clipboard. - * - * @param {boolean} page If the link is the link of the page. - */ - function copyLink(page) { - /** - * Change the button text to provide the copied feedback. - */ - const changeButtonText = function create() { - const span = x$.sel('span', true, x$.sel(`.${pageClass}`)); - /** - * Set the classes of the button's div elements. - * - * @param {number} first A specific array items. - * @param {number} second A specific array items. - */ - function setClasses(first, second) { - x$.cls.a(span[first], spanClass); - x$.cls.r(span[second], spanClass); - } - - clearTimeout(buttonDelay); - setClasses(0, 1); - buttonDelay = setTimeout(() => { - setClasses(1, 0); - }, 700); - }; - - switch (page) { - case true: - link = `https://${window.location.href}/`.replace(/notion:\/\//, ''); - changeButtonText(); - x$.clp(false, link); - break; - case false: - const events = ['mousedown', 'mouseup', 'click']; - x$.sim(events, x$.sel(`.${blockClass}`).nextSibling); - x$.clp().then((text) => { - x$.clp(false, `${text.replace(/(?<=so[\/]).*#/, '')}/`); - }); - break; - } - } - - /** - * Observer for the overlay container. - */ - x$.obs(() => { - /** - * Get the copy link button. - * - * @return {HTMLDivElement} Returns the copy link button. - */ - function getLinkButton() { - const lang = ['Copy link', '링크 복사']; - const overlay = x$.sel('.notion-overlay-container'); - const record = x$.sel( - '[style*="text-overflow: ellipsis;"]', true, overlay); - - return Array.from(record).find( - (div) => lang.some((text) => div.textContent === text)); - } - if (x$.sel(`.${blockClass}`) !== null || - x$.sel('.notion-selectable-halo') === null || - getLinkButton() === undefined) return; - blockButton(getLinkButton().closest('[role="button"]')); - }, x$.sel('.notion-overlay-container'), { - subtree: true, childList: true, - }); - - /** - * Listen for click events to call "copyLink()"". - * - * @type {HTMLElement} - * @listens document.body#click - */ - x$.on(document.body, 'click', (event) => { - const target = event.target; - - if (x$.cls.c(target, pageClass) || - target.closest(`.${pageClass}`)) { - copyLink(/* page= */ true); - } else if (x$.cls.c(target, blockClass) || - target.closest(`.${blockClass}`)) { - copyLink(/* page= */ false); - } - }); - - /** - * Listen for mouseenter events to add class. - * - * @type {HTMLElement} - * @listens document.body#mouseenter - */ - x$.on(document.body, 'mouseenter', (event) => { - const target = event.target; - - if (x$.cls.c(target, 'admiraldus-glb-block-button')) { - const menu = target.closest('.notion-scroller.vertical'); - - x$.cls.a(menu, '--on-hover'); - } - }, true); - - /** - * Listen for mouseleave events to remove class. - * - * @type {HTMLElement} - * @listens document.body#mouseleave - */ - x$.on(document.body, 'mouseleave', (event) => { - const target = event.target; - - if (x$.cls.c(target, 'admiraldus-glb-block-button')) { - const menu = target.closest('.notion-scroller.vertical'); - - x$.cls.r(menu, '--on-hover'); - } - }, true); - } - }); - }, - }, -}; diff --git a/mods/gruvbox-dark/mod.js b/mods/gruvbox-dark/mod.js deleted file mode 100644 index c7fcb0f..0000000 --- a/mods/gruvbox-dark/mod.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * gruvbox dark - * (c) 2021 jordanrobinson (https://jordanrobinson.co.uk) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'ad0f5c5c-8b62-4b20-8a54-929e663ea368', - tags: ['theme', 'dark'], - name: 'gruvbox dark', - desc: 'gruvbox dark, based on the vim theme from morhetz.', - version: '0.2.0', - author: 'jordanrobinson', -}; diff --git a/mods/gruvbox-dark/variables.css b/mods/gruvbox-dark/variables.css deleted file mode 100644 index fbc0155..0000000 --- a/mods/gruvbox-dark/variables.css +++ /dev/null @@ -1,158 +0,0 @@ -/* - * gruvbox dark - * (c) 2021 jordanrobinson (https://jordanrobinson.co.uk) - * under the MIT license - */ - - :root { - - --theme_gruvbox_dark--bg: #282828; - --theme_gruvbox_dark--gray-dark: #928374; - --theme_gruvbox_dark--red-dark: #cc241d; - --theme_gruvbox_dark--red-light: #fb4934; - --theme_gruvbox_dark--green-dark: #98971a; - --theme_gruvbox_dark--green-light: #b8bb26; - --theme_gruvbox_dark--yellow-dark: #d79921; - --theme_gruvbox_dark--yellow-light: #fabd2f; - --theme_gruvbox_dark--blue-dark: #458588; - --theme_gruvbox_dark--blue-light: #83a598; - --theme_gruvbox_dark--purple-dark: #b16286; - --theme_gruvbox_dark--purple-light: #d3869b; - --theme_gruvbox_dark--aqua-dark: #689d6a; - --theme_gruvbox_dark--aqua-light: #8ec07c; - --theme_gruvbox_dark--gray-light: #a89984; - --theme_gruvbox_dark--orange-dark: #d65d0e; - --theme_gruvbox_dark--orange-light: #fe8019; - --theme_gruvbox_dark--fg: #ebdbb2; - --theme_gruvbox_dark--bg0-h: #1d2021; - --theme_gruvbox_dark--bg0: #282828; - --theme_gruvbox_dark--bg1: #3c3836; - --theme_gruvbox_dark--bg2: #504945; - --theme_gruvbox_dark--bg3: #665c54; - --theme_gruvbox_dark--bg4: #7c6f64; - --theme_gruvbox_dark--bg0-s: #32302f; - --theme_gruvbox_dark--fg4: #a89984; - --theme_gruvbox_dark--fg3: #bdae93; - --theme_gruvbox_dark--fg2: #d5c4a1; - --theme_gruvbox_dark--fg1: #ebdbb2; - --theme_gruvbox_dark--fg0: #fbf1c7; - - - --theme_dark--main: var(--theme_gruvbox_dark--bg0); - --theme_dark--sidebar: var(--theme_gruvbox_dark--bg1); - --theme_dark--overlay: rgba(80, 73, 69, 0.5); - --theme_dark--dragarea: var(--theme_gruvbox_dark--bg1); - - --theme_dark--font_sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', - Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', - 'Segoe UI Symbol'; - - --theme_dark--scrollbar: var(--theme_gruvbox_dark--bg0-s); - --theme_dark--scrollbar_hover: var(--theme_gruvbox_dark--bg3); - - --theme_dark--card: var(--theme_gruvbox_dark--bg3); - --theme_dark--gallery: var(--theme_gruvbox_dark--bg3); - --theme_dark--select_input: var(--theme_gruvbox_dark--gray-light); - --theme_dark--table-border: var(--theme_gruvbox_dark--gray-light); - --theme_dark--ui-border: var(--theme_dark--table-border); - --theme_dark--interactive_hover: rgba(80, 73, 69, 0.7); - --theme_dark--button_close: var(--theme_gruvbox_dark--red-dark); - - --theme_dark--selected: rgba(80, 73, 69, 0.5); - --theme_dark--primary: var(--theme_gruvbox_dark--bg3); - --theme_dark--primary_hover: var(--theme_gruvbox_dark--fg3); - --theme_dark--primary_click: var(--theme_gruvbox_dark--fg3); - --theme_dark--primary_indicator: var(--theme_gruvbox_dark--blue-dark); - - --theme_dark--option_active-background: var(--theme_dark--primary); - --theme_dark--option_hover-background: var(--theme_dark--primary_hover); - - --theme_dark--danger_text: var(--theme_gruvbox_dark--red-dark); - --theme_dark--danger_border: var(--theme_gruvbox_dark--red-light); - - --theme_dark--text: var(--theme_gruvbox_dark--fg0); - --theme_dark--text_ui: var(--theme_gruvbox_dark--fg3); - --theme_dark--text_ui_info: var(--theme_gruvbox_dark--bg3); - - --theme_dark--text_gray: var(--theme_gruvbox_dark--gray-dark); - --theme_dark--text_brown: var(--theme_gruvbox_dark--bg4); - --theme_dark--text_orange: var(--theme_gruvbox_dark--orange-dark); - --theme_dark--text_yellow: var(--theme_gruvbox_dark--yellow-dark); - --theme_dark--text_green: var(--theme_gruvbox_dark--green-dark); - --theme_dark--text_blue: var(--theme_gruvbox_dark--blue-dark); - --theme_dark--text_purple: var(--theme_gruvbox_dark--purple-dark); - --theme_dark--text_pink: var(--theme_gruvbox_dark--purple-light); - --theme_dark--text_red: var(--theme_gruvbox_dark--red-dark); - - --theme_dark--select-text: rgba(80, 73, 69 0.3); - --theme_dark--select_gray: var(--theme_gruvbox_dark--gray-dark); - --theme_dark--select_gray-text: var(--theme_gruvbox_dark--bg2); - --theme_dark--select_brown: var(--theme_gruvbox_dark--fg3); - --theme_dark--select_brown-text: var(--theme_gruvbox_dark--bg2); - --theme_dark--select_orange: var(--theme_gruvbox_dark--orange-dark); - --theme_dark--select_yellow: var(--theme_gruvbox_dark--yellow-dark); - --theme_dark--select_green: var(--theme_gruvbox_dark--green-dark); - --theme_dark--select_blue: var(--theme_gruvbox_dark--blue-dark); - --theme_dark--select_purple: var(--theme_gruvbox_dark--purple-dark); - --theme_dark--select_pink: var(--theme_gruvbox_dark--purple-light); - --theme_dark--select_red: var(--theme_gruvbox_dark--red-dark); - --theme_dark--select_red-text: var(--theme_gruvbox_dark--fg2); - - --theme_dark--bg-text: var(--theme_dark--select-text); - --theme_dark--bg_gray: var(--theme_gruvbox_dark--gray-dark); - --theme_dark--bg_brown: var(--theme_dark--select_brown); - --theme_dark--bg_orange: var(--theme_gruvbox_dark--orange-dark); - --theme_dark--bg_yellow: var(--theme_gruvbox_dark--yellow-dark); - --theme_dark--bg_green: var(--theme_gruvbox_dark--green-dark); - --theme_dark--bg_blue: var(--theme_gruvbox_dark--blue-dark); - --theme_dark--bg_purple: var(--theme_gruvbox_dark--purple-dark); - --theme_dark--bg_pink: var(--theme_dark--select_pink); - --theme_dark--bg_red: var(--theme_gruvbox_dark--red-dark); - - --theme_dark--line-text: var(--theme_dark--text); - --theme_dark--line_gray: var(--theme_dark--text_gray); - --theme_dark--line_gray-text: var(--theme_dark--text); - --theme_dark--line_brown: var(--theme_dark--text_brown); - --theme_dark--line_brown-text: var(--theme_dark--text); - --theme_dark--line_orange: var(--theme_dark--text_orange); - --theme_dark--line_yellow: var(--theme_dark--text_yellow); - --theme_dark--line_green: var(--theme_dark--text_green); - --theme_dark--line_blue: var(--theme_dark--text_blue); - --theme_dark--line_purple: var(--theme_dark--text_purple); - --theme_dark--line_pink: var(--theme_dark--text_pink); - --theme_dark--line_red: var(--theme_dark--text_red); - --theme_dark--line_red-text: var(--theme_dark--text); - - --theme_dark--callout-text: var(--theme_dark--text); - --theme_dark--callout_gray: var(--theme_dark--line_gray); - --theme_dark--callout_gray-text: var(--theme_dark--text); - --theme_dark--callout_brown: var(--theme_dark--line_brown); - --theme_dark--callout_brown-text: var(--theme_dark--text); - --theme_dark--callout_orange: var(--theme_dark--line_orange); - --theme_dark--callout_yellow: var(--theme_dark--line_yellow); - --theme_dark--callout_green: var(--theme_dark--line_green); - --theme_dark--callout_blue: var(--theme_dark--line_blue); - --theme_dark--callout_purple: var(--theme_dark--line_purple); - --theme_dark--callout_pink: var(--theme_dark--line_pink); - --theme_dark--callout_red: var(--theme_dark--line_red); - --theme_dark--callout_red-text: var(--theme_dark--text); - - --theme_dark--code_inline-text: var(--theme_gruvbox_dark--blue-light); - --theme_dark--code_inline-background: var(--theme_gruvbox_dark--bg1); - --theme_dark--code-text: var(--theme_dark--text); - --theme_dark--code-background: var(--theme_gruvbox_dark--bg1); - --theme_dark--code_function: var(--theme_dark--text_blue); - --theme_dark--code_keyword: var(--theme_dark--text_pink); - --theme_dark--code_tag: var(--theme_dark--text_pink); - --theme_dark--code_operator: var(--theme_dark--text_yellow); - --theme_dark--code_important: var(--theme_dark--text_yellow); - --theme_dark--code_property: var(--theme_dark--text_pink); - --theme_dark--code_builtin: var(--theme_dark--text_yellow); - --theme_dark--code_attr-name: var(--theme_dark--text_yellow); - --theme_dark--code_comment: var(--theme_dark--text_ui); - --theme_dark--code_punctuation: var(--theme_gruvbox_dark--aqua-light); - --theme_dark--code_doctype: var(--theme_gruvbox_dark--aqua-light); - --theme_dark--code_number: var(--theme_dark--text_purple); - --theme_dark--code_string: var(--theme_dark--text_orange); - --theme_dark--code_attr-value: var(--theme_dark--text_orange); -} \ No newline at end of file diff --git a/mods/indentation-lines/mod.js b/mods/indentation-lines/mod.js deleted file mode 100644 index 5a90bfb..0000000 --- a/mods/indentation-lines/mod.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * indentation lines - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Alexa Baldon (https://github.com/runargs) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: '35815b3b-3916-4dc6-8769-c9c2448f8b57', - tags: ['extension'], - name: 'indentation lines', - desc: 'adds vertical relationship lines to make list trees easier to follow.', - version: '1.0.0', - author: 'runargs', - options: [ - { - key: 'style', - label: 'style', - type: 'select', - value: ['solid', 'dashed', 'dotted', 'soft'], - }, - { - key: 'bulleted_list', - label: 'bulleted list', - type: 'toggle', - value: true, - }, - { - key: 'numbered_list', - label: 'numbered list', - type: 'toggle', - value: true, - }, - { - key: 'to_do', - label: 'to-do list', - type: 'toggle', - value: true, - }, - { - key: 'toggle', - label: 'toggle list', - type: 'toggle', - value: true, - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - - const selectors = - ['bulleted_list', 'numbered_list', 'to_do', 'toggle'] - .filter(l => store()[l]) - .map(l => `.notion-page-content .notion-${l}-block > div > div:last-child`); - - let style = 'solid'; - let opacity = 1; - switch(store().style) { - case 'dashed': - style = 'dashed'; - break; - case 'dotted': - style = 'dotted'; - break; - case 'soft': - opacity = 0.25; - break; - } - - if (selectors.length > 0) { - document - .querySelector('head') - .appendChild( - createElement(` - - `) - ) - } - }); - }, - }, -}; diff --git a/mods/littlepig-dark/app.css b/mods/littlepig-dark/app.css deleted file mode 100644 index 34cad66..0000000 --- a/mods/littlepig-dark/app.css +++ /dev/null @@ -1,88 +0,0 @@ -/* - * littlepig - * (c) 2020 dragonwocky - * (c) 2020 Lizishan - * under the MIT license - */ - -/* todo 颜色 */ -.notion-body.dark .notion-dark-theme [style*='background: rgb(46, 170, 220)'], -.notion-body.dark - .notion-dark-theme - [style*='background-color: rgb(46, 170, 220)'] { - background: var(--theme_dark--option_active-background) !important; -} - -/* ===================== header =========================== */ -.notion-dark-theme [placeholder*='Heading 1'] { - color: var(--littlepig_dark--h1_text) !important; -} - -.notion-dark-theme [placeholder*='Heading 2'] { - margin-bottom: 16px; - border-bottom: 4px solid var(--littlepig_dark--h2_text); - display: inline-block; - color: var(--littlepig_dark--h2_text) !important; - width: auto !important; - padding: 6px 12px 6px 0 !important; - position: relative; -} -.notion-dark-theme [placeholder*='Heading 2']::before { - content: '🔥 '; -} - -.notion-dark-theme [placeholder*='Heading 3'] { - width: fit-content !important; - padding: 4px 10px !important; - border-radius: 10px; - border: 2px solid var(--littlepig_dark--h3_text); - color: var(--littlepig_dark--h3_text) !important; - background-color: #fbf8e7; - display: inline-block; - margin-bottom: 14px; -} -.notion-dark-theme [placeholder*='Heading 3']::before { - content: '📌 '; -} - -/* list 样式 */ -.notion-dark-theme - [style*='font-size: 1.5em; line-height: 1; margin-bottom: 0.1em;'] { - color: #a830fd !important; -} - -/* quoteblock 样式 */ -.notion-dark-theme - .notion-quote-block - [style*='caret-color: rgba(255, 255, 255, 0.9);'] { - font-size: 0.85em !important; - border-left: none !important; - padding: 0.5em 0.5em 0.5em 1.9em !important; - position: relative; - margin: 10px 0; - background: var(--theme_dark--card); - border-radius: 3px; -} -.notion-dark-theme - .notion-quote-block - [style*='caret-color: rgba(255, 255, 255, 0.9);']::before { - content: '\201C'; - font-family: Georgia, serif; - font-size: 44px; - font-weight: bold; - color: #7b08fa; - position: absolute; - left: 0px; - top: -24px; -} - -/* link style */ -.notion-dark-theme .notion-link-token span { - border-bottom: 0.05em solid; - border-color: rgb(233, 51, 38) !important; - border-width: 3px !important; - opacity: 1 !important; -} -.notion-dark-theme .notion-link-token span:hover { - color: rgb(233, 51, 38) !important; -} diff --git a/mods/littlepig-dark/mod.js b/mods/littlepig-dark/mod.js deleted file mode 100644 index b34db0a..0000000 --- a/mods/littlepig-dark/mod.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * littlepig - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Lizishan - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'ad923617-e76e-418e-9f23-490738a32299', - tags: ['theme', 'dark'], - name: 'littlepig dark', - desc: 'a purple monospaced theme using emojis and colourful text.', - version: '0.1.2', - author: { - name: 'Lizishan', - link: 'https://www.reddit.com/user/Lizishan/', - avatar: - 'https://styles.redditmedia.com/t5_110nz4/styles/profileIcon_h1m3b16exoi51.jpg', - }, -}; diff --git a/mods/littlepig-dark/variables.css b/mods/littlepig-dark/variables.css deleted file mode 100644 index faa29a1..0000000 --- a/mods/littlepig-dark/variables.css +++ /dev/null @@ -1,125 +0,0 @@ -/* - * littlepig - * (c) 2020 dragonwocky - * (c) 2020 Lizishan - * under the MIT license - */ - -@import 'https://dev-cats.github.io/code-snippets/JetBrainsMono.css'; - -:root { - --theme_dark--main: #1e1c26; - --theme_dark--sidebar: #24222c; - --theme_dark--dragarea: #19181f; - - --theme_dark--font_sans: 'JetBrains Mono'; - --theme_dark--font_serif: 'JetBrains Mono'; - --theme_dark--font_mono: 'JetBrains Mono'; - --theme_dark--font_code: 'JetBrains Mono'; - - --theme_dark--scrollbar: #221f29; - --theme_dark--scrollbar_hover: #312d3c; - - --theme_dark--card: #24222c; - --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--selected: #9500ff6b; - --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_hover-background: rgb(20, 0, 51); - - --theme_dark--text: rgba(200, 200, 200, 0.8); - - /* 文本颜色 */ - --theme_dark--text_brown: rgb(177, 144, 131); - --theme_dark--text_green: rgb(66, 222, 137); - --theme_dark--text_blue: rgb(0, 157, 255); - --theme_dark--text_purple: rgb(162, 94, 255); - --theme_dark--text_red: rgb(240, 52, 38); - - /* 文本背景色 */ - --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_red: rgb(151, 62, 62); - - /* 标题色 */ - --littlepig_dark--h1_text: #c264fe; - --littlepig_dark--h2_text: #e2bafe; - --littlepig_dark--h3_text: #7b08fa; - - /* todo */ - --theme_dark--option_active-color: #7b08fa; - --theme_dark--option_active-background: #1d1c26; - - /* inline code */ - --theme_dark--code_inline-text: #e0dfe2; - --theme_dark--code_inline-background: rgb(179, 39, 39); - --theme_dark--code_function: rgb(179, 146, 240); - --theme_dark--code_number: hsl(159, 69%, 39%); - - /* 标签颜色 + 文本背景色 */ - --theme_dark--bg_gray: rgb(234, 234, 234); - --theme_dark--bg_gray-text: rgb(17, 17, 17); - --theme_dark--bg_brown: rgb(206, 206, 206); - --theme_dark--bg_brown-text: rgb(85, 35, 1); - --theme_dark--bg_orange: rgb(254, 214, 155); - --theme_dark--bg_orange-text: rgb(199, 110, 0); - --theme_dark--bg_yellow: #fcffd8; - --theme_dark--bg_yellow-text: #ff8c22; - --theme_dark--bg_green: #d5fded; - --theme_dark--bg_green-text: #006a00; - --theme_dark--bg_blue: #e2f5ff; - --theme_dark--bg_blue-text: #00b2ff; - --theme_dark--bg_purple: #efe6ff; - --theme_dark--bg_purple-text: #8334ff; - --theme_dark--bg_pink: #ffe9f1; - --theme_dark--bg_pink-text: rgb(255, 0, 127); - --theme_dark--bg_red: rgb(251, 228, 228); - --theme_dark--bg_red-text: rgb(138, 0, 10); - - --theme_dark--select_gray: rgb(234, 234, 234); - --theme_dark--select_gray-text: rgb(17, 17, 17); - --theme_dark--select_brown: rgb(206, 206, 206); - --theme_dark--select_brown-text: rgb(85, 35, 1); - --theme_dark--select_orange: rgb(254, 214, 155); - --theme_dark--select_orange-text: rgb(199, 110, 0); - --theme_dark--select_yellow: #fcffd8; - --theme_dark--select_yellow-text: #ff8c22; - --theme_dark--select_green: #d5fded; - --theme_dark--select_green-text: #006a00; - --theme_dark--select_blue: #e2f5ff; - --theme_dark--select_blue-text: #00b2ff; - --theme_dark--select_purple: #efe6ff; - --theme_dark--select_purple-text: #8334ff; - --theme_dark--select_pink: #ffe9f1; - --theme_dark--select_pink-text: rgb(255, 0, 127); - --theme_dark--select_red: rgb(251, 228, 228); - --theme_dark--select_red-text: rgb(138, 0, 10); - - /* callout 颜色 */ - --theme_dark--callout_gray: #e2e3e5; - --theme_dark--callout_gray-text: #383d41; - --theme_dark--callout_brown: rgb(130, 118, 111); - --theme_dark--callout_brown-text: rgb(85, 35, 1); - --theme_dark--callout_orange: rgb(254, 214, 155); - --theme_dark--callout_orange-text: rgb(255, 140, 0); - --theme_dark--callout_yellow: #fcffd8; - --theme_dark--callout_yellow-text: #c76e00; - --theme_dark--callout_green: #d4edda; - --theme_dark--callout_green-text: #155724; - --theme_dark--callout_blue: #cce5ff; - --theme_dark--callout_blue-text: #004085; - --theme_dark--callout_purple: rgb(199, 178, 230); - --theme_dark--callout_purple-text: rgb(90, 49, 148); - --theme_dark--callout_pink: rgb(255, 206, 228); - --theme_dark--callout_pink-text: rgb(255, 0, 127); - --theme_dark--callout_red: #f8d7da; - --theme_dark--callout_red-text: #721c24; -} diff --git a/mods/littlepig-light/app.css b/mods/littlepig-light/app.css deleted file mode 100644 index 463fc34..0000000 --- a/mods/littlepig-light/app.css +++ /dev/null @@ -1,93 +0,0 @@ -/* - * littlepig - * (c) 2020 dragonwocky - * (c) 2020 Lizishan - * under the MIT license - */ - -/* todo 颜色 */ -.notion-body:not(.dark) - .notion-light-theme - [style*='background: rgb(46, 170, 220)'], -.notion-body:not(.dark) - .notion-light-theme - [style*='background-color: rgb(46, 170, 220)'] { - background: var(--theme_dark--option_active-background) !important; -} -.notion-body:not(.dark) [style*='background: rgb(46, 170, 220)'][role='button'], -.notion-body:not(.dark) - [style*='background: rgb(46, 170, 220);'][style*='width: 26px'] { - background: var(--theme_light--primary) !important; -} - -/* ===================== header =========================== */ -.notion-body:not(.dark) [placeholder*='Heading 1'] { - color: var(--littlepig_light--h1_text) !important; -} - -.notion-body:not(.dark) [placeholder*='Heading 2'] { - margin-bottom: 16px; - border-bottom: 4px solid var(--littlepig_light--h2_text); - display: inline-block; - color: var(--littlepig_light--h2_text) !important; - width: auto !important; - padding: 6px 12px 6px 0 !important; - position: relative; -} -.notion-body:not(.dark) [placeholder*='Heading 2']::before { - content: '🔥 '; -} - -.notion-body:not(.dark) [placeholder*='Heading 3'] { - width: fit-content !important; - padding: 4px 10px !important; - border-radius: 10px; - border: 2px solid #42b983; - color: var(--littlepig_light--h3_text) !important; - background-color: #fbf8e7; - display: inline-block; - margin-bottom: 14px; -} -.notion-body:not(.dark) [placeholder*='Heading 3']::before { - content: '📌 '; -} - -/* list 样式 */ -.notion-body:not(.dark) - [style*='font-size: 1.5em; line-height: 1; margin-bottom: 0.1em;'] { - color: #41b983 !important; -} - -/* quoteblock 样式 */ -.notion-body:not(.dark) .notion-quote-block [style*='rgb(55, 53, 47);'] { - font-size: 0.85em !important; - border-left: none !important; - padding: 0.5em 0.5em 0.5em 1.9em !important; - position: relative; - margin: 10px 0; - background: var(--theme_light--card); - border-radius: 3px; -} -.notion-body:not(.dark) - .notion-quote-block - [style*='caret-color: rgb(55, 53, 47);']::before { - content: '\201C'; - font-family: Georgia, serif; - font-size: 44px; - font-weight: bold; - color: #42b983; - position: absolute; - left: 0px; - top: -24px; -} - -/* link style */ -.notion-body:not(.dark) .notion-link-token span { - border-bottom: 0.05em solid; - border-color: rgb(233, 51, 38) !important; - border-width: 3px !important; - opacity: 1 !important; -} -.notion-body:not(.dark) .notion-link-token span:hover { - color: rgb(233, 51, 38) !important; -} diff --git a/mods/littlepig-light/mod.js b/mods/littlepig-light/mod.js deleted file mode 100644 index c10ed64..0000000 --- a/mods/littlepig-light/mod.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * littlepig - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Lizishan - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'ad923617-e76e-408e-9f23-490738a32238', - tags: ['theme', 'light'], - name: 'littlepig light', - desc: 'a bright monospaced theme using emojis and colourful text.', - version: '0.1.1', - author: { - name: 'Lizishan', - link: 'https://www.reddit.com/user/Lizishan/', - avatar: - 'https://styles.redditmedia.com/t5_110nz4/styles/profileIcon_h1m3b16exoi51.jpg', - }, -}; diff --git a/mods/littlepig-light/variables.css b/mods/littlepig-light/variables.css deleted file mode 100644 index 8f81ea8..0000000 --- a/mods/littlepig-light/variables.css +++ /dev/null @@ -1,104 +0,0 @@ -/* - * littlepig - * (c) 2020 dragonwocky - * (c) 2020 Lizishan - * under the MIT license - */ - -@import 'https://dev-cats.github.io/code-snippets/JetBrainsMono.css'; - -:root { - --theme_light--font_sans: 'JetBrains Mono'; - --theme_light--font_serif: 'JetBrains Mono'; - --theme_light--font_mono: 'JetBrains Mono'; - --theme_light--font_code: 'JetBrains Mono'; - - --theme_light--selected: rgba(177, 24, 24, 0.22); - --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--text_gray: rgba(151, 154, 155, 0.95); - --theme_light--text_brown: rgb(167, 126, 100); - --theme_light--text_orange: rgb(255, 134, 0); - --theme_light--text_yellow: rgb(255, 195, 0); - --theme_light--text_green: rgb(0, 171, 0); - --theme_light--text_blue: rgb(0, 121, 255); - --theme_light--text_purple: rgb(126, 0, 255); - --theme_light--text_pink: rgb(255, 0, 208); - --theme_light--text_red: rgb(255, 0, 0); - - /* 文本背景色 */ - --theme_light--bg_gray: rgb(234, 234, 234); - --theme_light--bg_gray-text: rgb(17, 17, 17); - --theme_light--bg_brown: rgb(206, 206, 206); - --theme_light--bg_brown-text: rgb(85, 35, 1); - --theme_light--bg_orange: rgb(254, 214, 155); - --theme_light--bg_orange-text: rgb(199, 110, 0); - --theme_light--bg_yellow: #fcffd8; - --theme_light--bg_yellow-text: #ff8c22; - --theme_light--bg_green: #d5fded; - --theme_light--bg_green-text: #006a00; - --theme_light--bg_blue: #e2f5ff; - --theme_light--bg_blue-text: #00b2ff; - --theme_light--bg_purple: #efe6ff; - --theme_light--bg_purple-text: #8334ff; - --theme_light--bg_pink: #ffe9f1; - --theme_light--bg_pink-text: rgb(255, 0, 127); - --theme_light--bg_red: rgb(248, 215, 218); - --theme_light--bg_red-text: rgb(138, 0, 10); - - --theme_light--select_gray: rgb(234, 234, 234); - --theme_light--select_gray-text: rgb(17, 17, 17); - --theme_light--select_brown: rgb(206, 206, 206); - --theme_light--select_brown-text: rgb(85, 35, 1); - --theme_light--select_orange: rgb(254, 214, 155); - --theme_light--select_orange-text: rgb(199, 110, 0); - --theme_light--select_yellow: #fcffd8; - --theme_light--select_yellow-text: #ff8c22; - --theme_light--select_green: #d5fded; - --theme_light--select_green-text: #006a00; - --theme_light--select_blue: #e2f5ff; - --theme_light--select_blue-text: #00b2ff; - --theme_light--select_purple: #efe6ff; - --theme_light--select_purple-text: #8334ff; - --theme_light--select_pink: #ffe9f1; - --theme_light--select_pink-text: rgb(255, 0, 127); - --theme_light--select_red: rgb(248, 215, 218); - --theme_light--select_red-text: rgb(138, 0, 10); - - /* 标题色 */ - --littlepig_light--h1_text: #008800; - --littlepig_light--h2_text: #006a00; - --littlepig_light--h3_text: #003e00; - - /* todo */ - --theme_light--option_active-color: #008800; - --theme_light--option_active-background: #ffffff; - - /* inline code */ - --theme_light--code_inline-text: #e0dfe2; - --theme_light--code_inline-background: rgb(179, 39, 39); - - /* callout 颜色 */ - --theme_light--callout_gray: #e2e3e5; - --theme_light--callout_gray-text: #383d41; - --theme_light--callout_brown: rgb(130, 118, 111); - --theme_light--callout_brown-text: rgb(85, 35, 1); - --theme_light--callout_orange: rgb(254, 214, 155); - --theme_light--callout_orange-text: rgb(255, 140, 0); - --theme_light--callout_yellow: #fcffd8; - --theme_light--callout_yellow-text: #c76e00; - --theme_light--callout_green: #d4edda; - --theme_light--callout_green-text: #155724; - --theme_light--callout_blue: #cce5ff; - --theme_light--callout_blue-text: #004085; - --theme_light--callout_purple: rgb(199, 178, 230); - --theme_light--callout_purple-text: rgb(90, 49, 148); - --theme_light--callout_pink: rgb(255, 206, 228); - --theme_light--callout_pink-text: rgb(255, 0, 127); - --theme_light--callout_red: #f8d7da; - --theme_light--callout_red-text: #721c24; -} diff --git a/mods/material-ocean/mod.js b/mods/material-ocean/mod.js deleted file mode 100644 index dd3eab5..0000000 --- a/mods/material-ocean/mod.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * material ocean - * (c) 2020 Abubakar Yagoub (https://blacksuan19.tk) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: '69e7ccb2-4aef-484c-876d-3de1b433d2b9', - tags: ['theme', 'dark'], - name: 'material ocean', - desc: 'an oceanic colour palette.', - version: '0.1.0', - author: 'blacksuan19', -}; diff --git a/mods/material-ocean/variables.css b/mods/material-ocean/variables.css deleted file mode 100644 index eef943d..0000000 --- a/mods/material-ocean/variables.css +++ /dev/null @@ -1,126 +0,0 @@ -/* - * material ocean - * (c) 2020 Abubakar Yagoub (https://blacksuan19.tk) - * under the MIT license - */ - -:root { - --ocean-main: #0f111a; - --ocean-sec: #00010a; - --ocean-tet: #000108; - --ocean-accent: #ff4151; - --ocean-gray: #e0e0e0; - --ocean-brown: #d8b6a6; - --ocean-orange: #fde3c0; - --ocean-yellow: #ebcb8b; - --ocean-green: #a3be8c; - --ocean-blue: #81a1c1; - --ocean-purple: #b48ead; - --ocean-pink: #ffc0cb; - --ocean-red: #bf616a; - - --theme_dark--main: var(--ocean-main); - --theme_dark--sidebar: var(--ocean-sec); - --theme_dark--overlay: rgba(0, 1, 10, 0.5); - --theme_dark--dragarea: var(--ocean-sec); - - --theme_dark--scrollbar: var(--ocean-sec); - --theme_dark--scrollbar_hover: var(--ocean-accent); - - --theme_dark--card: var(--ocean-sec); - --theme_dark--gallery: var(--ocean-sec); - --theme_dark--select_input: var(--ocean-tet); - --theme_dark--table-border: rgba(255, 255, 255, 0.1); - --theme_dark--ui-border: var(--theme_dark--table-border); - --theme_dark--interactive_hover: var(--ocean-tet); - --theme_dark--button_close: var(--ocean-accent); - - --theme_dark--selected: rgba(255, 65, 81, 0.2); - --theme_dark--primary: var(--ocean-accent); - --theme_dark--primary_hover: var(--ocean-accent); - --theme_dark--primary_click: var(--ocean-sec); - --theme_dark--primary_indicator: var(--ocean-accent); - - --theme_dark--option_active-background: var(--theme_dark--primary); - --theme_dark--option_hover-background: var(--theme_dark--primary_hover); - - --theme_dark--danger_text: #eb5757; - --theme_dark--danger_border: rgba(235, 87, 87, 0.5); - - --theme_dark--text: #ffffff; - --theme_dark--text_ui: var(--ocean-gray); - --theme_dark--text_ui_info: var(--ocean-gray); - - --theme_dark--text_gray: var(--ocean-gray); - --theme_dark--text_brown: var(--ocean-brown); - --theme_dark--text_orange: var(--ocean-orange); - --theme_dark--text_yellow: var(--ocean-yellow); - --theme_dark--text_green: var(--ocean-green); - --theme_dark--text_blue: var(--ocean-blue); - --theme_dark--text_purple: var(--ocean-purple); - --theme_dark--text_pink: var(--ocean-pink); - --theme_dark--text_red: var(--ocean-red); - - --theme_dark--bg-text: var(--ocean-main); - --theme_dark--bg_gray: var(--ocean-gray); - --theme_dark--bg_brown: var(--ocean-brown); - --theme_dark--bg_orange: var(--ocean-orange); - --theme_dark--bg_yellow: var(--ocean-yellow); - --theme_dark--bg_green: var(--ocean-green); - --theme_dark--bg_blue: var(--ocean-blue); - --theme_dark--bg_purple: var(--ocean-purple); - --theme_dark--bg_pink: var(--ocean-pink); - --theme_dark--bg_red: var(--ocean-red); - - --theme_dark--line-text: var(--ocean-main); - --theme_dark--line_gray: #e0e0e089; - --theme_dark--line_brown: #d8b6a692; - --theme_dark--line_orange: #fde3c09f; - --theme_dark--line_yellow: #ffe6a6ad; - --theme_dark--line_green: #a3be8ca3; - --theme_dark--line_blue: #81a1c1a3; - --theme_dark--line_purple: #b48eada8; - --theme_dark--line_pink: #ffc0cbb1; - --theme_dark--line_red: #bf616a9e; - - --theme_dark--select-text: var(--theme_dark--bg-text); - --theme_dark--select_gray: var(--theme_dark--bg_gray); - --theme_dark--select_brown: var(--theme_dark--bg_brown); - --theme_dark--select_orange: var(--theme_dark--bg_orange); - --theme_dark--select_yellow: var(--theme_dark--bg_yellow); - --theme_dark--select_green: var(--theme_dark--bg_green); - --theme_dark--select_blue: var(--theme_dark--bg_blue); - --theme_dark--select_purple: var(--theme_dark--bg_purple); - --theme_dark--select_pink: var(--theme_dark--bg_pink); - --theme_dark--select_red: var(--theme_dark--bg_red); - - --theme_dark--callout-text: var(--theme_dark--line-text); - --theme_dark--callout_gray: var(--theme_dark--line_gray); - --theme_dark--callout_brown: var(--theme_dark--line_brown); - --theme_dark--callout_orange: var(--theme_dark--line_orange); - --theme_dark--callout_yellow: var(--theme_dark--line_yellow); - --theme_dark--callout_green: var(--theme_dark--line_green); - --theme_dark--callout_blue: var(--theme_dark--line_blue); - --theme_dark--callout_purple: var(--theme_dark--line_purple); - --theme_dark--callout_pink: var(--theme_dark--line_pink); - --theme_dark--callout_red: var(--theme_dark--line_red); - - --theme_dark--code_inline-text: #b3f5c8; - --theme_dark--code_inline-background: var(--ocean-sec); - --theme_dark--code-text: var(--theme_dark--text); - --theme_dark--code-background: var(--ocean-sec); - --theme_dark--code_function: var(--theme_dark--text_blue); - --theme_dark--code_keyword: var(--theme_dark--text_pink); - --theme_dark--code_tag: var(--theme_dark--text_pink); - --theme_dark--code_operator: var(--theme_dark--text_yellow); - --theme_dark--code_important: var(--theme_dark--text_yellow); - --theme_dark--code_property: var(--theme_dark--text_pink); - --theme_dark--code_builtin: var(--theme_dark--text_yellow); - --theme_dark--code_attr-name: var(--theme_dark--text_yellow); - --theme_dark--code_comment: var(--theme_dark--text_gray); - --theme_dark--code_punctuation: var(--theme_dark--text_gray); - --theme_dark--code_doctype: var(--theme_dark--text_gray); - --theme_dark--code_number: var(--theme_dark--text_purple); - --theme_dark--code_string: var(--theme_dark--text_orange); - --theme_dark--code_attr-value: var(--theme_dark--text_orange); -} diff --git a/mods/neutral/app.css b/mods/neutral/app.css deleted file mode 100644 index ffac700..0000000 --- a/mods/neutral/app.css +++ /dev/null @@ -1,19 +0,0 @@ -/* - * neutral - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Arecsu - * under the MIT license - */ - -.notion-dark-theme [placeholder='Heading 1'], -.notion-dark-theme [placeholder='Heading 2'], -.notion-dark-theme [placeholder='Heading 3'] { - padding: 3px 1px !important; -} - -/* hide sidebar "new page" button */ -.notion-dark-theme - .notion-sidebar - > [style*='flex: 0 0 auto; margin-top: auto;'] { - display: none !important; -} diff --git a/mods/neutral/mod.js b/mods/neutral/mod.js deleted file mode 100644 index 25ea0e5..0000000 --- a/mods/neutral/mod.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * neutral - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Arecsu - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'c4435543-4705-4d68-8cf7-d11c342f8089', - tags: ['theme', 'dark'], - name: 'neutral', - desc: 'smoother colours and fonts, designed to be more pleasing to the eye.', - version: '0.1.4', - author: 'arecsu', -}; diff --git a/mods/neutral/variables.css b/mods/neutral/variables.css deleted file mode 100644 index 1e499d0..0000000 --- a/mods/neutral/variables.css +++ /dev/null @@ -1,134 +0,0 @@ -/* - * neutral - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Arecsu - * under the MIT license - */ - -@import 'https://rsms.me/inter/inter.css'; -@import 'https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400&display=swap'; - -:root { - /** dark **/ - - --theme_dark--main: #131313; - --theme_dark--sidebar: #161616; - --theme_dark--overlay: rgba(15, 15, 15, 0.6); - --theme_dark--dragarea: #111111; - --theme_dark--box-shadow: rgba(15, 15, 15, 0.5) 0px 0px 0px 1px, - rgba(15, 15, 15, 0.5) 0px 2px 4px; - - --theme_dark--font_sans: 'Inter', -apple-system, BlinkMacSystemFont, - 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, - 'Segoe UI Emoji', 'Segoe UI Symbol'; - --theme_dark--font_mono: 'Roboto Mono', iawriter-mono, Nitti, Menlo, Courier, - monospace; - --theme_dark--font_code: 'Roboto Mono', SFMono-Regular, Consolas, - 'Liberation Mono', Menlo, Courier, monospace; - - /* 1.3 supreme ratio. https://www.modularscale.com/ */ - --theme_dark--font_title-size: 33px; - --theme_dark--font_heading1-size: 2.2em; - --theme_dark--font_heading2-size: 1.687em; - --theme_dark--font_heading3-size: 1.3em; - --theme_dark--font_label-size: 14px; - --theme_dark--font_body-size: 15px; - --theme_dark--font_body-size_small: 13.5px; - --theme_dark--font_code-size: 0.9em; - --theme_dark--font_sidebar-size: 14px; - - --theme_dark--scrollbar: #232425; - --theme_dark--scrollbar-border: transparent; - --theme_dark--scrollbar_hover: #373838; - - --theme_dark--card: #181818; - --theme_dark--gallery: rgba(105, 105, 105, 0.05); - --theme_dark--select_input: #1d1d1d; - --theme_dark--table-border: rgba(78, 78, 78, 0.7); - --theme_dark--ui-border: var(--theme_dark--table-border); - --theme_dark--interactive_hover: rgb(29, 29, 29); - - --theme_dark--selected: #52525244; - --theme_dark--primary: #404040; - --theme_dark--primary_hover: #6d6d6d; - --theme_dark--primary_click: #cacaca; - --theme_dark--primary_indicator: #6d6d6d; - - --theme_dark--option_hover-background: #484848; - - --theme_dark--danger_text: #ce535f; - --theme_dark--danger_border: #8c3d3d; - - --theme_dark--text: #dadada; - --theme_dark--text_ui: #dadadad0; - --theme_dark--text_ui_info: #dadadab4; - - --theme_dark--text_gray: #858585; - --theme_dark--text_brown: #484848; - --theme_dark--text_orange: #ec9873; - --theme_dark--text_yellow: #e2c06f; - --theme_dark--text_green: #92b178; - --theme_dark--text_blue: #719cca; - --theme_dark--text_purple: #ab82bb; - --theme_dark--text_pink: #d285aa; - --theme_dark--text_red: #ce535f; - - --theme_dark--bg_gray: #585858; - --theme_dark--bg_brown: #333333; - --theme_dark--bg_orange: #9a5a3f; - --theme_dark--bg_yellow: #b58a46; - --theme_dark--bg_green: #657953; - --theme_dark--bg_blue: #355475; - --theme_dark--bg_purple: #775186; - --theme_dark--bg_pink: #8e4b63; - --theme_dark--bg_red: #8c3d3d; - - --theme_dark--line_gray: #585858; - --theme_dark--line_brown: #333333; - --theme_dark--line_orange: #9a5a3f; - --theme_dark--line_yellow: #b58a46; - --theme_dark--line_green: #657953; - --theme_dark--line_blue: #355475; - --theme_dark--line_purple: #775186; - --theme_dark--line_pink: #8e4b63; - --theme_dark--line_red: #8c3d3d; - - --theme_dark--select_gray: var(--theme_dark--bg_gray); - --theme_dark--select_brown: var(--theme_dark--bg_brown); - --theme_dark--select_orange: var(--theme_dark--bg_orange); - --theme_dark--select_yellow: var(--theme_dark--bg_yellow); - --theme_dark--select_green: var(--theme_dark--bg_green); - --theme_dark--select_blue: var(--theme_dark--bg_blue); - --theme_dark--select_purple: var(--theme_dark--bg_purple); - --theme_dark--select_pink: var(--theme_dark--bg_pink); - --theme_dark--select_red: var(--theme_dark--bg_red); - - --theme_dark--callout_gray: rgba(88, 88, 88, 0.175); - --theme_dark--callout_brown: rgb(51, 51, 51, 0.175); - --theme_dark--callout_orange: rgb(154, 90, 63, 0.175); - --theme_dark--callout_yellow: rgb(181, 138, 70, 0.175); - --theme_dark--callout_green: rgb(101, 121, 83, 0.175); - --theme_dark--callout_blue: rgb(53, 84, 117, 0.175); - --theme_dark--callout_purple: rgb(119, 81, 134, 0.175); - --theme_dark--callout_pink: rgb(142, 75, 99, 0.175); - --theme_dark--callout_red: rgb(140, 61, 61, 0.175); - - --theme_dark--code_inline-text: var(--theme_dark--text); - --theme_dark--code_inline-background: #333333; - --theme_dark--code-text: var(--theme_dark--text); - --theme_dark--code-background: #0e0e0e; - --theme_dark--code_function: var(--theme_dark--text_blue); - --theme_dark--code_keyword: var(--theme_dark--text_pink); - --theme_dark--code_tag: var(--theme_dark--text_pink); - --theme_dark--code_operator: var(--theme_dark--text_yellow); - --theme_dark--code_important: var(--theme_dark--text_yellow); - --theme_dark--code_property: var(--theme_dark--text_pink); - --theme_dark--code_builtin: var(--theme_dark--text_yellow); - --theme_dark--code_attr-name: var(--theme_dark--text_yellow); - --theme_dark--code_comment: var(--theme_dark--text_gray); - --theme_dark--code_punctuation: var(--theme_dark--text_gray); - --theme_dark--code_doctype: var(--theme_dark--text_gray); - --theme_dark--code_number: var(--theme_dark--text_purple); - --theme_dark--code_string: var(--theme_dark--text_orange); - --theme_dark--code_attr-value: var(--theme_dark--text_orange); -} diff --git a/mods/night-shift/mod.js b/mods/night-shift/mod.js deleted file mode 100644 index 6449f85..0000000 --- a/mods/night-shift/mod.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * night shift - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: '9a71bbff-e87d-4a0b-8a2c-a93473113c30', - tags: ['extension', 'theme'], - name: 'night shift', - desc: - 'sync dark/light theme with the system (overrides normal theme setting).', - version: '0.1.2', - author: 'dragonwocky', - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - const attempt_interval = setInterval(enhance, 500); - function enhance() { - const notion_elem = document.querySelector('.notion-app-inner'); - if (!notion_elem) return; - clearInterval(attempt_interval); - handle([{ target: notion_elem }]); - const observer = new MutationObserver(handle); - observer.observe(notion_elem, { - attributes: true, - subtree: true, - }); - function handle(list, observer) { - const mode = `notion-app-inner notion-${ - window.matchMedia('(prefers-color-scheme: dark)').matches - ? 'dark' - : 'light' - }-theme`; - if (notion_elem.className !== mode) notion_elem.className = mode; - window - .matchMedia('(prefers-color-scheme: dark)') - .addEventListener('change', handle); - } - } - }); - }, - }, -}; diff --git a/mods/nord/app.css b/mods/nord/app.css deleted file mode 100644 index 4730fb4..0000000 --- a/mods/nord/app.css +++ /dev/null @@ -1,8 +0,0 @@ -/* - * nord v0.1.0 - * (c) 2020 MANNEN - * dunno what to do here - * under the MIT license, probably? - */ - -/* diff --git a/mods/nord/mod.js b/mods/nord/mod.js deleted file mode 100644 index 31fe791..0000000 --- a/mods/nord/mod.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * nord v0.1.0 - * (c) 2020 MANNEN - * dunno what to do here - * under the MIT license, probably? - */ - -'use strict'; - -module.exports = { - id: 'ff87ff66-4910-436f-a843-7598edde2a7f', - tags: ['theme', 'dark'], - name: 'nord', - desc: 'An arctic, north-bluish color palette.', - version: '0.1.0', - author: 'MANNEN', -}; diff --git a/mods/nord/variables.css b/mods/nord/variables.css deleted file mode 100644 index 08c165f..0000000 --- a/mods/nord/variables.css +++ /dev/null @@ -1,186 +0,0 @@ -/* - * nord v0.1.0 - * (c) 2020 MANNEN - * dunno what to do here - * under the MIT license, probably? - */ - -@import 'https://rsms.me/inter/inter.css'; -@import url('https://fonts.googleapis.com/css2?family=Fira+Code&display=swap'); - -:root { - /** dark **/ - - --nord0: #2e3440; /*dark1*/ - --nord1: #3b4252; /*dark2*/ - --nord2: #434c5e; /*dark3*/ - --nord3: #4c566a; /*dark4*/ - --nord4: #d8dee9; /*light1*/ - --nord5: #e5e9f0; /*light2*/ - --nord6: #eceff4; /*light3*/ - --nord7: #8fbcbb; /*frost1*/ - --nord8: #88c0d0; /*frost2*/ - --nord9: #81a1c1; /*frost3*/ - --nord10: #5e81ac; /*frost4*/ - --nord11: #bf616a; /*red*/ - --nord12: #d08770; /*orange*/ - --nord13: #ebcb8b; /*yellow*/ - --nord14: #a3be8c; /*green*/ - --nord15: #b48ead; /*purple*/ - - --theme_dark--main: var(--nord0); - --theme_dark--sidebar: var(--nord1); - --theme_dark--overlay: rgb(41 37 37 / 60%); - --theme_dark--dragarea: var(--nord0); - --theme_dark--box-shadow: rgba(15, 15, 15, 0.2) 0px 0px 0px 1px, - rgba(15, 15, 15, 0.2) 0px 2px 4px; - --theme_dark--box-shadow_strong: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, - rgba(15, 15, 15, 0.2) 0px 3px 6px, rgba(15, 15, 15, 0.4) 0px 9px 24px; - - --theme_dark--font_sans: 'Inter', -apple-system, BlinkMacSystemFont, - 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, - 'Segoe UI Emoji', 'Segoe UI Symbol'; - --theme_dark--font_code: 'Fira Code', monospace; - - --theme_dark--scrollbar: var(--nord2); - --theme_dark--scrollbar-border: transparent; - --theme_dark--scrollbar_hover: var(--nord3); - - --theme_dark--card: var(--nord1); - --theme_dark--gallery: var(--nord2); - --theme_dark--select_input: rgb(55, 60, 63); - --theme_dark--table-border: rgba(255, 255, 255, 0.1); - --theme_dark--ui-border: rgba(255, 255, 255, 0.07); - --theme_dark--interactive_hover: var(--nord3); - --theme_dark--interactive_hover-border: transparent; - --theme_dark--button_close: var(--nord11); - --theme_dark--button_close-fill: var(--nord6); - - --theme_dark--selected: rgb(136 192 208 / 50%); - --theme_dark--primary: var(--nord8); - --theme_dark--primary_hover: var(--nord8); - --theme_dark--primary_click: var(--nord8); - --theme_dark--primary_indicator: var(--nord11); - - --theme_dark--option-color: var(--nord4); - --theme_dark--option-background: transparent; - --theme_dark--option_active-color: var(--nord4); - --theme_dark--option_active-background: var(--theme_dark--primary); - --theme_dark--option_hover-color: var(--nord4); - --theme_dark--option_hover-background: var(--nord4); - - --theme_dark--danger_text: var(--nord11); - --theme_dark--danger_border: rgba(235, 87, 87, 0.5); - - --theme_dark--text: var(--nord4); - --theme_dark--text_ui: var(--nord4); - --theme_dark--text_ui_info: var(--nord4); - - --theme_dark--text_gray: rgba(151, 154, 155, 0.95); - --theme_dark--text_brown: rgb(147, 114, 100); - --theme_dark--text_orange: var(--nord12); - --theme_dark--text_yellow: var(--nord13); - --theme_dark--text_green: var(--nord14); - --theme_dark--text_blue: var(--nord9); - --theme_dark--text_purple: var(--nord15); - --theme_dark--text_pink: rgb(193 106 153); - --theme_dark--text_red: var(--nord11); - - --theme_dark--bg-text: var(--theme_dark--text); - --theme_dark--bg_gray: rgb(69, 75, 78); - --theme_dark--bg_gray-text: var(--theme_dark--bg-text); - --theme_dark--bg_brown: rgb(67, 64, 64); - --theme_dark--bg_brown-text: var(--theme_dark--bg-text); - --theme_dark--bg_orange: var(--nord12); - --theme_dark--bg_orange-text: var(--theme_light--bg-text); - --theme_dark--bg_yellow: var(--nord13); - --theme_dark--bg_yellow-text: var(--theme_light--bg-text); - --theme_dark--bg_green: var(--nord14); - --theme_dark--bg_green-text: var(--theme_dark--bg-text); - --theme_dark--bg_blue: var(--nord9); - --theme_dark--bg_blue-text: var(--theme_dark--bg-text); - --theme_dark--bg_purple: var(--nord15); - --theme_dark--bg_purple-text: var(--theme_dark--bg-text); - --theme_dark--bg_pink: rgb(193 106 153); - --theme_dark--bg_pink-text: var(--theme_dark--bg-text); - --theme_dark--bg_red: var(--nord11); - --theme_dark--bg_red-text: var(--theme_dark--bg-text); - - --theme_dark--line-text: var(--theme_dark--text); - --theme_dark--line_gray: rgb(69, 75, 78); - --theme_dark--line_gray-text: var(--theme_dark--line-text); - --theme_dark--line_brown: rgb(67, 64, 64); - --theme_dark--line_brown-text: var(--theme_dark--line-text); - --theme_dark--line_orange: var(--nord12); - --theme_dark--line_orange-text: var(--theme_light--line-text); - --theme_dark--line_yellow: var(--nord13); - --theme_dark--line_yellow-text: var(--theme_light--line-text); - --theme_dark--line_green: var(--nord14); - --theme_dark--line_green-text: var(--theme_dark--line-text); - --theme_dark--line_blue: var(--nord9); - --theme_dark--line_blue-text: var(--theme_dark--line-text); - --theme_dark--line_purple: var(--nord15); - --theme_dark--line_purple-text: var(--theme_dark--line-text); - --theme_dark--line_pink: rgb(193 106 153); - --theme_dark--line_pink-text: var(--theme_dark--line-text); - --theme_dark--line_red: var(--nord11); - --theme_dark--line_red-text: var(--theme_dark--line-text); - - --theme_dark--select-text: var(--theme_dark--text); - --theme_dark--select_gray: rgba(151, 154, 155, 0.5); - --theme_dark--select_gray-text: var(--theme_dark--select-text); - --theme_dark--select_brown: rgba(147, 114, 100, 0.5); - --theme_dark--select_brown-text: var(--theme_dark--select-text); - --theme_dark--select_orange: rgba(255, 163, 68, 0.5); - --theme_dark--select_orange-text: var(--theme_dark--select-text); - --theme_dark--select_yellow: rgba(255, 220, 73, 0.5); - --theme_dark--select_yellow-text: var(--theme_dark--select-text); - --theme_dark--select_green: rgba(77, 171, 154, 0.5); - --theme_dark--select_green-text: var(--theme_dark--select-text); - --theme_dark--select_blue: rgba(82, 156, 202, 0.5); - --theme_dark--select_blue-text: var(--theme_dark--select-text); - --theme_dark--select_purple: rgba(154, 109, 215, 0.5); - --theme_dark--select_purple-text: var(--theme_dark--select-text); - --theme_dark--select_pink: rgba(226, 85, 161, 0.5); - --theme_dark--select_pink-text: var(--theme_dark--select-text); - --theme_dark--select_red: rgba(255, 115, 105, 0.5); - --theme_dark--select_red-text: var(--theme_dark--select-text); - - --theme_dark--callout-text: var(--theme_dark--text); - --theme_dark--callout_gray: rgba(69, 75, 78, 0.3); - --theme_dark--callout_gray-text: var(--theme_dark--callout-text); - --theme_dark--callout_brown: rgba(67, 64, 64, 0.3); - --theme_dark--callout_brown-text: var(--theme_dark--callout-text); - --theme_dark--callout_orange: rgba(89, 74, 58, 0.3); - --theme_dark--callout_orange-text: var(--theme_dark--callout-text); - --theme_dark--callout_yellow: rgba(89, 86, 59, 0.3); - --theme_dark--callout_yellow-text: var(--theme_dark--callout-text); - --theme_dark--callout_green: rgba(53, 76, 75, 0.3); - --theme_dark--callout_green-text: var(--theme_dark--callout-text); - --theme_dark--callout_blue: rgba(54, 73, 84, 0.3); - --theme_dark--callout_blue-text: var(--theme_dark--callout-text); - --theme_dark--callout_purple: rgba(68, 63, 87, 0.3); - --theme_dark--callout_purple-text: var(--theme_dark--callout-text); - --theme_dark--callout_pink: rgba(83, 59, 76, 0.3); - --theme_dark--callout_pink-text: var(--theme_dark--callout-text); - --theme_dark--callout_red: rgba(89, 65, 65, 0.3); - --theme_dark--callout_red-text: var(--theme_dark--callout-text); - - --theme_dark--code_inline-text: var(--nord11); - --theme_dark--code_inline-background: rgba(135, 131, 120, 0.15); - --theme_dark--code-text: var(--theme_dark--text); - --theme_dark--code-background: var(--theme_dark--card); - --theme_dark--code_function: var(--theme_dark--text_blue); - --theme_dark--code_keyword: var(--theme_dark--text_pink); - --theme_dark--code_tag: var(--theme_dark--text_pink); - --theme_dark--code_operator: var(--theme_dark--text_yellow); - --theme_dark--code_important: var(--theme_dark--text_yellow); - --theme_dark--code_property: var(--theme_dark--text_pink); - --theme_dark--code_builtin: var(--theme_dark--text_yellow); - --theme_dark--code_attr-name: var(--theme_dark--text_yellow); - --theme_dark--code_comment: var(--theme_dark--text_gray); - --theme_dark--code_punctuation: var(--theme_dark--text_gray); - --theme_dark--code_doctype: var(--theme_dark--text_gray); - --theme_dark--code_number: var(--theme_dark--text_purple); - --theme_dark--code_string: var(--theme_dark--text_orange); - --theme_dark--code_attr-value: var(--theme_dark--text_orange); diff --git a/mods/notion-icons/app.css b/mods/notion-icons/app.css deleted file mode 100644 index 0b49a68..0000000 --- a/mods/notion-icons/app.css +++ /dev/null @@ -1,411 +0,0 @@ -/* - * notion-icons - * (c) 2019 jayhxmo (https://jaymo.io/) - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -/* tab */ - -[hide-active-bar] > :nth-child(2) { - display: none; -} - -.notion-icons--tab, -.notion-icons--tab > div { - color: var(--theme--text) !important; -} - -#notion-icons--active-bar { - border-bottom: 2px solid var(--theme--text); - position: absolute; - bottom: -1px; - left: 8px; - right: 8px; -} - -.notion-icons--restore-button svg { - width: 16px; - height: 16px; - fill: var(--theme--text_ui_info); -} - -/* interactive hover */ - -.notion-icons--tab > div:hover, -.notion-icons--icon:hover, -.notion-icons--toggle:hover, -.notion-icons--restore-button:hover, -.notion-icons--removed-set:hover { - background: var(--theme--interactive_hover); - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border) !important; -} - -/* container */ - -#notion-icons { - position: absolute; - top: 1px; - left: 0; - right: 0; - bottom: 0; - z-index: 9999; - display: flex; - flex-direction: column; - align-items: stretch; - background: var(--theme--card); - border-radius: 3px; - overflow: hidden; -} -/* search */ - -.notion-icons--search { - flex-shrink: 0; - height: 28px; - min-width: 0px; - margin: 9px 14px 10px; - padding: 3px 6px; - border-radius: 3px; - display: flex; - align-items: center; - position: relative; - font-size: 14px; - line-height: 1.2; - background: var(--theme--select_input); - box-shadow: rgba(15, 15, 15, 0.2) 0px 0px 0px 1px inset; - user-select: none; - cursor: text; -} -.notion-dark-theme .notion-icons--search { - background: rgba(15, 15, 15, 0.3); - box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px inset; -} - -.notion-icons--search input { - font-size: inherit; - line-height: inherit; - border: none; - background: none; - width: 100%; - display: block; - resize: none; - padding: 0px; -} - -.notion-icons--search svg { - flex-grow: 0; - flex-shrink: 0; - width: 14px; - height: 14px; - display: block; - fill: inherit; - backface-visibility: hidden; - margin-right: 6px; - color: rgba(55, 53, 47, 0.8); -} -.notion-dark-theme .notion-icons--search svg { - color: rgb(202, 204, 206); -} - -/* scroller */ - -.notion-icons--scroller { - padding: 8px 12px; - overflow: hidden auto; - display: flex; - flex-direction: column; -} - -/* divider */ - -.notion-icons--divider { - height: 1px; - margin-bottom: 9px; - border-bottom: 1px solid var(--theme--table-border); -} - -/* icon set */ - -.notion-icons--icon-set { - margin-bottom: 8px; - color: var(--theme--text); - font-size: 11px; - line-height: 1.5; - letter-spacing: 1px; - font-weight: 600; - border-radius: 2px; -} - -.notion-icons--icon-set.error { - color: var(--theme--text_red); - background: var(--theme--line_red); - border: 1px solid var(--theme--select_red); - padding: 8px 16px; -} -.notion-icons--icon-set.error::after { - content: '!'; - display: block; - font-size: 1.6em; - line-height: 0.9; - float: right; -} - -/* icon set header/toggle */ - -.notion-icons--toggle { - display: flex; - align-items: center; - margin-bottom: 8px; - padding: 0.25em; - border-radius: 2px; - text-transform: uppercase; - user-select: none; - cursor: pointer; - transition: background 200ms, margin-bottom 200ms ease-in; -} -.notion-icons--icon-set.alert .notion-icons--toggle { - color: var(--theme--line_yellow-text); - background: var(--theme--line_yellow); - border: 1px solid var(--theme--select_yellow); - margin-left: -1px; - margin-right: -1px; -} -.notion-icons--icon-set.alert .notion-icons--toggle:hover { - background: var(--theme--select_yellow); -} - -.notion-icons--toggle .triangle { - flex-grow: 0; - flex-shrink: 0; - width: 0.9em; - height: 1em; - margin: 0 0.75em 0 0.5em; - transition: transform 200ms ease-out 0s; - transform: rotateZ(180deg); -} - -.notion-icons--author { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -.notion-icons--author span, -.notion-icons--author a { - color: var(--theme--text_ui_info); - transition: color 20ms ease-in; -} -.notion-icons--toggle a:hover { - color: var(--theme--primary); -} - -/* icon set body */ - -.notion-icons--body { - display: flex; - flex-wrap: wrap; - align-items: flex-start; - flex-grow: 1; - margin-left: 1.2em; - overflow: hidden; - transition: height 200ms ease-in, opacity 200ms ease-in; -} - -/* hidden icon set */ - -.notion-icons--icon-set[hidden-set] { - padding-bottom: 0; -} -.notion-icons--icon-set[hidden-set] .notion-icons--toggle { - margin-bottom: 0; -} -.notion-icons--icon-set[hidden-set] .triangle { - transform: rotateZ(90deg); -} -.notion-icons--icon-set[hidden-set] .notion-icons--body { - opacity: 0; -} - -/* icons */ - -.notion-icons--icon { - width: 40px; - height: 40px; - padding: 4px; - border-radius: 3px; - display: flex; - align-items: center; - justify-content: center; - position: relative; - user-select: none; - cursor: pointer; - transition: background 20ms ease-in; -} - -.notion-icons--icon img { - width: 100%; - height: 100%; - pointer-events: none; -} -/* spritesheet */ -.notion-icons--icon div { - width: 32px; - height: 32px; - background-size: 32px; - background-repeat: no-repeat; - pointer-events: none; -} - -.notion-icons--icon.error { - font-size: 20px; - background: var(--theme--line_yellow); - border: 1px solid var(--theme--select_yellow); - color: var(--theme--text_yellow); -} -.notion-icons--icon.error:hover { - background: var(--theme--select_yellow); -} - -/* tooltip */ - -.notion-icons--tooltip { - position: fixed; - pointer-events: none; - z-index: 99; -} - -.notion-icons--tooltip > div { - position: absolute; - top: 0px; - left: 0px; - width: 40px; - height: 40px; - display: flex; - flex-direction: column; - justify-content: flex-end; - align-items: center; -} - -.notion-icons--tooltip-text { - bottom: calc(100% + 6px); - padding: 4px 8px; - border-radius: 3px; - display: flex; - align-items: center; - flex-direction: column; - position: relative; - max-width: calc(100vw - 24px); - background: rgb(15, 15, 15); - color: rgba(255, 255, 255, 0.9); - box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px; - font-size: 12px; - line-height: 1.4; - font-weight: 500; - white-space: nowrap; - overflow: hidden; -} - -.notion-dark-theme .notion-icons--tooltip-text { - background: rgb(202, 204, 206); - color: rgb(15, 15, 15); -} - -/* actions */ - -.notion-icons--actions { - flex-grow: 0; - flex-shrink: 0; - margin-left: auto; - display: flex; - align-items: center; -} - -/* spinner */ - -.notion-icons--spinner { - width: 12px; - height: 12px; -} -.notion-icons--spinner img { - width: 100%; - height: 100%; - animation: rotation 1.3s infinite linear; -} - -/* remove button */ - -.notion-icons--remove-button { - display: flex; - justify-content: center; - align-items: center; - margin-left: 8px; - width: 16px; - height: 16px; - position: relative; -} -.notion-icons--remove-button::before { - content: 'Hide icon set'; - position: absolute; - right: -3px; - padding: 4px 22px 4px 6px; - background: var(--theme--main); - box-shadow: var(--theme--box-shadow); - white-space: nowrap; - opacity: 0; - pointer-events: none; - transition: opacity 50ms ease-in; -} -.notion-icons--remove-button:hover::before { - opacity: 1; - pointer-events: auto; -} -.notion-icons--remove-button svg { - width: 100%; - height: 100%; - fill: var(--theme--text_ui_info); - z-index: 1; -} - -/* restore icon sets modal */ - -.notion-icons--overlay-container { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - z-index: 999; - overflow: hidden; -} - -.notion-icons--restore { - max-width: 320px; - max-height: 320px; - position: relative; - border-radius: 3px; - padding: 8px 0; - box-shadow: var(--theme--box-shadow_strong); - background: var(--theme--card); - overflow: hidden auto; -} - -.notion-icons--removed-set { - display: flex; - align-items: center; - width: 100%; - padding: 8px 14px; - user-select: none; - cursor: pointer; - transition: background 0.4s ease; -} - -/* animation */ - -@keyframes rotation { - from { - transform: rotate(0deg); - } - to { - transform: rotate(359deg); - } -} diff --git a/mods/notion-icons/icons/remove.svg b/mods/notion-icons/icons/remove.svg deleted file mode 100644 index b6a57a6..0000000 --- a/mods/notion-icons/icons/remove.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/mods/notion-icons/icons/restore.svg b/mods/notion-icons/icons/restore.svg deleted file mode 100644 index 2e41e4c..0000000 --- a/mods/notion-icons/icons/restore.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/mods/notion-icons/icons/search.svg b/mods/notion-icons/icons/search.svg deleted file mode 100644 index e8c0216..0000000 --- a/mods/notion-icons/icons/search.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/mods/notion-icons/icons/triangle.svg b/mods/notion-icons/icons/triangle.svg deleted file mode 100644 index 8615536..0000000 --- a/mods/notion-icons/icons/triangle.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/notion-icons/mod.js b/mods/notion-icons/mod.js deleted file mode 100644 index 2b77dfa..0000000 --- a/mods/notion-icons/mod.js +++ /dev/null @@ -1,653 +0,0 @@ -/* - * notion-icons - * (c) 2020 jayhxmo (https://jaymo.io/) - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'), - fs = require('fs-extra'), - path = require('path'), - notionIconsUrl = 'https://raw.githubusercontent.com/notion-enhancer/icons/main/'; - -module.exports = { - id: '2d1f4809-9581-40dd-9bf3-4239db406483', - tags: ['extension'], - name: 'notion icons', - desc: - 'use custom icon sets directly in notion.', - version: '1.2.0', - author: 'jayhxmo', - options: [ - { - key: 'hide', - label: 'hide icon sets by default.', - type: 'toggle', - value: false, - }, - { - key: 'json', - label: 'insert custom json', - type: 'file', - extensions: ['json'], - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - let garbageCollector = [], - filterMap = new WeakMap(); - - function getAsync(urlString, callback) { - let httpReq = new XMLHttpRequest(); - httpReq.onreadystatechange = function() { - if (httpReq.readyState == 4 && httpReq.status == 200) callback(httpReq.responseText); - }; - httpReq.open('GET', urlString, true); - httpReq.send(null); - } - - const menuIcons = {}; - (async () => { - menuIcons.triangle = await fs.readFile( path.resolve(__dirname, 'icons/triangle.svg') ); - menuIcons.remove = await fs.readFile( path.resolve(__dirname, 'icons/remove.svg' ) ); - menuIcons.restore = await fs.readFile( path.resolve(__dirname, 'icons/restore.svg' ) ); - menuIcons.search = await fs.readFile( path.resolve(__dirname, 'icons/search.svg' ) ); - })(); - - // source => icon data - const enhancerIconSets = new Map(); - getAsync(notionIconsUrl + 'icons.json', iconsData => { - const data = JSON.parse(iconsData); - (data.icons || data).forEach(set => { - enhancerIconSets.set(set.source, set); - }) - }); - - // array - let customIconSets; - if (store().json) { - const customData = JSON.parse( - fs.readFileSync(store().json) - ) - customIconSets = customData.icons || customData; - } - - // notion icons overlay - - function addIconsTab() { - // prevent icons tab duplication - if (getTab(5)) - return removeIconsOverlay(); - - // change 'Upload an image' to 'Upload' - getTab(2, true).innerText = 'Upload'; - - // initialize icons tab - const iconsTab = getTab(3).cloneNode(true); - iconsTab.className = 'notion-icons--tab'; - iconsTab.firstChild.innerText = 'Icons'; - iconsTab.firstChild.addEventListener('click', renderIconsOverlay); - - // insert icons tab - const tabStrip = getTab(1).parentElement; - tabStrip.insertBefore(iconsTab, tabStrip.lastChild); - - initCloseTriggers(); - } - - function renderIconsOverlay() { - if (!isCurrentTab(4)) { - // switch to 3rd tab so that the link can be input in the underlay - if (!isCurrentTab(3)) getTab(3, true).click(); - - if ( - store().removedSets?.length > 0 && - enhancerIconSets.size > 0 - ) - addRestoreButton(); - - // set active bar on icons tab - const iconsTab = getTab(4), - activeBar = createElement( - `
` - ); - iconsTab.style.position = 'relative'; - iconsTab.appendChild(activeBar); - getTab(3).setAttribute('hide-active-bar', ''); - - // create icons overlay - const notionIcons = createElement( - '
' - ); - - // render search bar - const search = createElement(` - - `), - searchInput = search.lastElementChild; - - searchInput.addEventListener('input', () => { - filterIcons(searchInput.value); - }); - - // render scroller and icon sets - const scroller = createElement(` -
- `); - scroller.appendChild( loadIconSets() ); - - notionIcons.append(search, scroller); - - // insert icons overlay - document.querySelector('.notion-media-menu > .notion-scroller') - .appendChild(notionIcons); - - // focus on search bar - requestAnimationFrame(() => { - searchInput.focus(); - }); - } - } - - // convert icons data into renderable - function loadIconSets() { - const iconSets = new DocumentFragment(); - - if (customIconSets) { - customIconSets.forEach(i => { - iconSets.appendChild( renderIconSet(i) ); - }); - - // divider - iconSets.appendChild( - createElement('
') - ); - } - - if (enhancerIconSets.size > 0) { - enhancerIconSets.forEach((i, source) => { - // ignore removed icon sets - if ( store().removedSets?.includes(source) ) return; - - i.sourceUrl = i.sourceUrl || (notionIconsUrl + source); - iconSets.appendChild( renderIconSet(i, true) ); - }); - } - - return iconSets; - } - - // returns icon set element - function renderIconSet(iconData, enhancerSet = false) { - const iconSet = createElement( - '
' - ); - - try { - const author = iconData.author - ? iconData.authorUrl - ? ` by ${iconData.author}` - : ` by ${iconData.author}` - : ''; - - const toggle = createElement(` -
- ${menuIcons.triangle} -
${iconData.name}${author}
-
-
- -
-
-
- `); - - const iconSetBody = createElement( - '
' - ); - - iconSet.append(toggle, iconSetBody); - - const promiseArray = []; - // render icons - for (let i = 0; i < (iconData.count || iconData.source.length); i++) { - - const iconUrl = iconData.sourceUrl - ? Array.isArray(iconData.source) - ? `${iconData.sourceUrl}/${iconData.source[i]}.${iconData.extension}` - : `${iconData.sourceUrl}/${iconData.source}_${i}.${iconData.extension}` - : iconData.source[i]; - - const icon = createElement(`
`); - icon.innerHTML = enhancerSet - // load sprite sheet - ? `
` - : ``; - - // add filters to filterMap - const filters = []; - - if (iconData.filter) { - if (iconData.filter === 'source') { - const filename = iconUrl.match(/.*\/(.+?)\./); - if (filename?.length > 1) { - filters.push(...filename[1].split(/[ \-_]/)); - } - } - else if (Array.isArray(iconData.filter)) { - filters.push(...iconData.filter[i]); - } - icon.setAttribute('filter', filters.join(' ')); - } - - // add set name and author to filters - filters.push(...iconData.name.toLowerCase().split(' ')); - if (iconData.author) filters.push(...iconData.author.toLowerCase().split(' ')); - - filterMap.set(icon, filters); - - // make sure icons load - if (!enhancerSet) { - promiseArray.push( - new Promise((resolve, reject) => { - icon.firstChild.onload = resolve; - icon.firstChild.onerror = () => { - reject(); - icon.classList.add('error'); - icon.innerHTML = '!'; - }; - }) - ); - } - - garbageCollector.push(icon); - icon.addEventListener('click', () => setPageIcon(iconUrl)); - iconSetBody.appendChild(icon); - } - - // hide spinner after all icons finish loading - (async () => { - const spinner = toggle.querySelector('.notion-icons--spinner'), - loadPromise = Promise.all(promiseArray); - loadPromise.then( - () => spinner.remove(), - () => { - iconSet.classList.add('alert') - spinner.remove(); - } - ); - })(); - - // add remove icon set button - if (enhancerSet) { - const removeButton = createElement( - `
${menuIcons.remove}
` - ); - removeButton.addEventListener('click', e => { - e.stopPropagation(); - removeIconSet(iconData); - }); - iconSet.querySelector('.notion-icons--actions') - .appendChild(removeButton); - } - - // set up toggle - toggle.addEventListener('click', e => { - if (e.target.nodeName === 'A') return; - toggleIconSet(iconSet); - }); - - // hide by default? - if (store().hide) - requestAnimationFrame(() => toggleIconSet(iconSet)) - - // tooltip - let timeout; - iconSetBody.addEventListener('mouseover', e => { - const el = e.target; - if (!el.hasAttribute('filter')) return; - - document.querySelector('.notion-icons--tooltip')?.remove(); - timeout = setTimeout(() => { - renderTooltip(el, el.getAttribute('filter')) - }, 300); - }) - iconSetBody.addEventListener('mouseout', e => { - const el = e.target; - if (!el.hasAttribute('filter')) return; - - document.querySelector('.notion-icons--tooltip')?.remove(); - clearTimeout(timeout); - }); - - } catch (err) { - iconSet.classList.add('error'); - iconSet.innerHTML = `Invalid Icon Set: ${iconData.name}`; - } - - return iconSet; - } - - function removeIconsOverlay() { - const elements = [ - document.getElementById('notion-icons'), - document.getElementById('notion-icons--active-bar'), - document.querySelector('.notion-icons--restore-button'), - document.querySelector('.notion-icons--tooltip'), - ] - elements.forEach(el => { - if (el) el.remove(); - }) - - getTab(4).style.position = ''; - - if (getTab(3)) - getTab(3).removeAttribute('hide-active-bar'); - - if ( - document.querySelector('.notion-icons--overlay-container') - ) closeRestoreOverlay(); - - if (garbageCollector.length) { - for (let i = 0; i < garbageCollector.length; i++) { - garbageCollector[i] = null; - } - garbageCollector = []; - } - } - - function initCloseTriggers() { - // remove the icons overlay when clicking... - const triggers = [ - // the fog layer - document.querySelector('.notion-overlay-container [style*="width: 100vw; height: 100vh;"]'), - // the first three buttons - ...[1, 2, 3].map( n => getTab(n, true) ), - // the remove button - (getTab(5) || getTab(4)).lastElementChild, - ]; - - triggers.forEach(t => { - t.addEventListener('click', removeIconsOverlay); - garbageCollector.push(t); - }) - - // remove the icons overlay when pressing the Escape key - document.querySelector('.notion-media-menu') - .addEventListener('keydown', e => { - if (e.keyCode === 27) removeIconsOverlay(); - }); - } - - // restore overlay - - function addRestoreButton() { - const buttons = getTab(1).parentElement.lastElementChild; - - const restoreButton = buttons.lastElementChild.cloneNode(true); - restoreButton.className = 'notion-icons--restore-button'; - restoreButton.innerHTML = menuIcons.restore; - restoreButton.addEventListener('click', renderRestoreOverlay); - - buttons.prepend(restoreButton); - } - - function renderRestoreOverlay() { - if (!store().removedSets) return; - store().removedSets.sort(); - - const overlayContainer = createElement(` -
- `); - overlayContainer.addEventListener('click', closeRestoreOverlay); - document.querySelector('.notion-app-inner').appendChild(overlayContainer); - - const rect = document.querySelector('.notion-icons--restore-button') - .getBoundingClientRect(); - const div = createElement(` -
-
-
- `); - - const restoreOverlay = createElement(` -
- `) - - store().removedSets.forEach(source => { - restoreOverlay.appendChild( renderRestoreItem(source) ); - }) - - overlayContainer.appendChild(div); - div.firstElementChild.appendChild(restoreOverlay); - - // fade in - restoreOverlay.animate( - [ {opacity: 0}, {opacity: 1} ], - { duration: 200 } - ); - } - - function renderRestoreItem(source) { - const iconData = enhancerIconSets.get(source); - const iconUrl = ` - ${iconData.sourceUrl || (notionIconsUrl + source)}/${source}_${0}.${iconData.extension} - `; - const restoreItem = createElement(` -
-
- -
- ${iconData.name} -
- `) - restoreItem.addEventListener('click', () => restoreIconSet(iconData)); - return restoreItem; - } - - function closeRestoreOverlay() { - const overlayContainer = document.querySelector('.notion-icons--overlay-container'); - overlayContainer.removeEventListener('click', closeRestoreOverlay); - // fade out - document.querySelector('.notion-icons--restore').animate( - [ {opacity: 1}, {opacity: 0} ], - { duration: 200 } - ).onfinish = () => overlayContainer.remove(); - } - - // icon set actions - - function toggleIconSet(iconSet, hide) { - const isHidden = iconSet.hasAttribute('hidden-set'); - if (hide == null) hide = !isHidden; - - const body = iconSet.lastChild; - if (hide && !isHidden) { - iconSet.setAttribute('hidden-set', ''); - body.style.height = body.offsetHeight + 'px'; - requestAnimationFrame( - () => body.style.height = 0 - ); - } - else if (!hide && isHidden) { - iconSet.removeAttribute('hidden-set'); - // get height - body.style.height = ''; - const height = body.offsetHeight; - body.style.height = 0; - - requestAnimationFrame( - () => body.style.height = height + 'px' - ); - setTimeout( - () => body.style.height = '', 200 - ); - } - } - - function removeIconSet(iconData) { - if (!store().removedSets) store().removedSets = []; - if (!store().removedSets.includes(iconData.source)) - store().removedSets.push(iconData.source); - removeIconsOverlay(); - renderIconsOverlay(); - } - - function restoreIconSet(iconData) { - if (!store().removedSets) return; - store().removedSets = store().removedSets - .filter(source => source !== iconData.source); - removeIconsOverlay(); - renderIconsOverlay(); - } - - // other actions - - // submit the icon's url as an image link - function setPageIcon(iconUrl) { - const input = document.querySelector('.notion-media-menu input[type=url]'); - - const nativeInputValueSetter = Object.getOwnPropertyDescriptor( - window.HTMLInputElement.prototype, 'value' - ).set; - nativeInputValueSetter.call(input, iconUrl); - - input.dispatchEvent( - new Event('input', { bubbles: true }) - ); - - input.dispatchEvent( - new KeyboardEvent('keydown', { bubbles: true, cancelable: true, keyCode: 13 }) - ); - - removeIconsOverlay(); - } - - function filterIcons(input) { - const iconSets = document.querySelectorAll('.notion-icons--icon-set'); - if (!iconSets) return; - - // show all sets and icons - if (!input) return iconSets.forEach(set => { - set.style.display = ''; - set.querySelectorAll('.notion-icons--icon') - .forEach(i => i.style.display = ''); - }); - // split input into an array - else input = input.toLowerCase().trim().split(' '); - - const findMatch = icon => { - const iconFilters = filterMap.get(icon).slice(); - - // match whole words for the first terms - if (input.length > 1) { - let index; - for (let i of input.slice(0, -1)) { - if ( - ( index = iconFilters.indexOf(i) ) >= 0 - ) { - iconFilters.splice(index, 1); - continue; - } - return false; - } - } - - // match partially for the last term - for (let iconFilter of iconFilters) { - if (iconFilter.includes(input[input.length - 1])) { - return true; - }; - } - - return false; - } - - iconSets.forEach(set => { - let found = false; - - set.querySelectorAll('.notion-icons--icon') - .forEach(i => { - // hide icon set - if (!filterMap.has(i)) return; - - if (findMatch(i)) { - i.style.display = ''; - found = true; - } else i.style.display = 'none'; - }); - - if (!found) set.style.display = 'none'; - else { - set.style.display = ''; - toggleIconSet(set, false); - } - }) - } - - function renderTooltip(el, text) { - const rect = el.getBoundingClientRect(); - const overlayContainer = document.querySelector('.notion-overlay-container') - - const tooltip = createElement(` -
-
-
- `), tooltipText = createElement( - `
${text}
` - ); - - tooltip.firstElementChild.appendChild(tooltipText); - overlayContainer.appendChild(tooltip); - - // prevent tooltip from rendering outside the window - const left = (tooltipText.offsetWidth / 2) - (rect.width / 2) - rect.left + 4; - if (left > 0) tooltipText.style.left = left + 'px'; - } - - document.addEventListener('readystatechange', () => { - if (document.readyState !== 'complete') return false; - const attempt_interval = setInterval(enhance, 500); - function enhance() { - const overlay = document.querySelector('.notion-overlay-container'); - if (!overlay) return; - clearInterval(attempt_interval); - - const observer = new MutationObserver((list, observer) => { - for ( let { addedNodes } of list) { - if ( - addedNodes[0]?.querySelector?.('.notion-media-menu') && - /^pointer-events: auto; position: relative; z-index: \d;$/ - .test(addedNodes[0].style.cssText) - ) { - addIconsTab(); - } - } - }); - observer.observe(overlay, { - childList: true, - subtree: true, - }); - } - }); - - // helpers - - function getTab(n, button = false) { - return document.querySelector( - `.notion-media-menu > :first-child > :first-child > :nth-child(${n}) ${button ? 'div' : ''}` - ); - } - - function isCurrentTab(n) { - return getTab(n).childNodes.length > 1; - } - }, - }, -}; diff --git a/mods/outliner/app.css b/mods/outliner/app.css deleted file mode 100644 index 03af8f5..0000000 --- a/mods/outliner/app.css +++ /dev/null @@ -1,64 +0,0 @@ -/* - * outliner - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -.outliner { - max-height: 100%; - overflow: hidden auto; -} - -.outline-header { - position: relative; - display: flex; - align-items: center; - height: 2.2em; - cursor: pointer; - user-select: none; - transition: background 20ms ease-in; -} -.outline-header:hover { - background: var(--theme--interactive_hover); -} - -.outline-header .outline-link { - width: 100%; - height: 100%; - padding: 0 14px; - line-height: 2.2; - color: inherit; - text-decoration: none; - - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.outline-header .outline-link:empty:before { - color: var(--theme--text_ui_info); - content: attr(outline-placeholder); - display: block; -} - -.outline-header[header-level="2"] .outline-link { - text-indent: 18px; -} -.outline-header[header-level="3"] .outline-link { - text-indent: 36px; -} - -.outliner[lined] .outline-header:not([header-level="1"])::before { - content: ""; - border-left: solid 1px var(--theme--text_ui_info); - height: 2.2em; - opacity: 0.6; - position: absolute; - left: 18px; - pointer-events: none; -} -.outliner[lined] .outline-header[header-level="3"]::before { - border-right: solid 1px var(--theme--text_ui_info); - width: 18px; -} diff --git a/mods/outliner/icon.svg b/mods/outliner/icon.svg deleted file mode 100644 index 30f8901..0000000 --- a/mods/outliner/icon.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/mods/outliner/mod.js b/mods/outliner/mod.js deleted file mode 100644 index 86da862..0000000 --- a/mods/outliner/mod.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * outliner - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const store = require("../../pkg/store"); - -module.exports = { - id: '87e077cc-5402-451c-ac70-27cc4ae65546', - tags: ['extension', 'panel'], - name: 'outliner', - desc: 'table of contents.', - version: '1.2.2', - author: 'CloudHill', - options: [ - { - key: 'lined', - label: 'indentation lines', - type: 'toggle', - value: true - }, - { - key: 'fullHeight', - label: 'full height', - type: 'toggle', - value: false - } - ], - panel: { - html: "panel.html", - name: "Outline", - icon: "icon.svg", - js: "panel.js", - fullHeight: store('87e077cc-5402-451c-ac70-27cc4ae65546').fullHeight, - } -}; diff --git a/mods/outliner/panel.html b/mods/outliner/panel.html deleted file mode 100644 index 0485b69..0000000 --- a/mods/outliner/panel.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/mods/outliner/panel.js b/mods/outliner/panel.js deleted file mode 100644 index afc378d..0000000 --- a/mods/outliner/panel.js +++ /dev/null @@ -1,161 +0,0 @@ -/* - * outliner - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement } = require("../../pkg/helpers"); - -module.exports = (store, __exports) => { - let lastSearch; - - // Observe for page changes - const pageObserver = new MutationObserver((list, observer) => { - for ( let { addedNodes } of list) { - if (addedNodes[0]) { - if (addedNodes[0].className === 'notion-presence-container') { - startContentObserver(); - } - // Clear outline on database pages - else if (addedNodes[0].className === 'notion-scroller') { - contentObserver.disconnect(); - const outline = document.querySelector('.outliner'); - if (outline) outline.textContent = ''; - } - } - } - }); - - // Observe for header changes - const contentObserver = new MutationObserver((list, observer) => { - list.forEach(m => { - let header; - if ( - ( - m.type === 'childList' && - ( - m.target.hasAttribute('placeholder') || - m.target.className?.includes('header-block') - ) && - ( - (header = getHeaderBlock(m.target)) || - (header = getHeaderBlock(m.addedNodes[0])) - ) - ) || - ( - m.type === 'characterData' && - (header = getHeaderBlock(m.target.parentElement)) - ) - ) updateOutlineHeader(header); - - else if ( - m.type === 'childList' && m.removedNodes[0] && - ( - isHeaderElement(m.removedNodes[0]) || - m.removedNodes[0].querySelector?.('[class*="header-block"]') - ) - ) findHeaders(); - }) - }); - - function startContentObserver() { - findHeaders(); - contentObserver.disconnect(); - contentObserver.observe( - document.querySelector('.notion-page-content'), - { - childList: true, - subtree: true, - characterData: true, - } - ); - } - - function findHeaders() { - // Add cooldown to prevent the function being run twice at the 'same' time - if (lastSearch >= (Date.now() - 10)) return; - lastSearch = Date.now(); - - const outline = document.querySelector('.outliner'); - if (!outline) return; - outline.textContent = ''; - - const pageContent = document.querySelector('.notion-page-content'), - headerBlocks = pageContent.querySelectorAll('[class*="header-block"]'), - fragment = new DocumentFragment(); - - headerBlocks.forEach(header => { - const blockId = header.dataset.blockId.replace(/-/g, ''), - headerEl = header.querySelector('[placeholder]'), - placeholder = headerEl.getAttribute('placeholder'); - - const outlineHeader = createElement(` -
- -
- `); - header.outline = outlineHeader; - outlineHeader.firstElementChild.innerHTML = headerEl.innerHTML; - - fragment.appendChild(outlineHeader); - }) - - outline.appendChild(fragment); - } - - function updateOutlineHeader(header) { - const headerEl = header.querySelector('[placeholder]'); - if (!( - headerEl && - header.outline?.parentElement - )) return findHeaders(); - const outlineHeader = header.outline; - outlineHeader.firstElementChild.innerHTML = headerEl.innerHTML; - setOutlineLevel(outlineHeader, headerEl.getAttribute('placeholder').slice(-1)); - } - - function setOutlineLevel(outlineHeader, level) { - outlineHeader.setAttribute('header-level', level); - outlineHeader.firstElementChild.setAttribute('outline-placeholder', `Header ${level}`) - } - - function getHeaderBlock(el) { - return el?.closest?.('[class*="header-block"]'); - } - - function isHeaderElement(el) { - let placeholder; - if (el) { - placeholder = el.getAttribute?.('placeholder') || - el.querySelector?.('[placeholder]')?.getAttribute('placeholder'); - } - if (!placeholder) placeholder = ''; - return placeholder.includes('Heading'); - } - - return { - onLoad() { - if (store().lined) { - const outline = document.querySelector('.outliner'); - outline?.setAttribute('lined', ''); - } - - // Find headers when switching panels - if (document.querySelector('.notion-page-content')) { - startContentObserver(); - } - pageObserver.observe(document.body, { - childList: true, - subtree: true, - }); - }, - onSwitch() { - pageObserver.disconnect(); - contentObserver.disconnect(); - } - } -} diff --git a/mods/panel-sites/app.css b/mods/panel-sites/app.css deleted file mode 100644 index c4aaf3e..0000000 --- a/mods/panel-sites/app.css +++ /dev/null @@ -1,12 +0,0 @@ -/* - * panel sites - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -.panel-site { - border: none; - flex: 1; - background: white; -} diff --git a/mods/panel-sites/mod.js b/mods/panel-sites/mod.js deleted file mode 100644 index fb83182..0000000 --- a/mods/panel-sites/mod.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * panel sites - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: '0d541743-eb2c-4d77-83a8-3b2f5e8e5dff', - tags: ['extension', 'panel'], - name: 'panel sites', - desc: 'embed sites on the site panel.', - version: '1.0.0', - author: 'CloudHill', - options: [ - { - key: 'sites', - label: 'list of sites', - type: 'file', - extensions: ['json'], - }, - ], - panel: { - js: 'panel.js' - } -}; diff --git a/mods/panel-sites/panel.js b/mods/panel-sites/panel.js deleted file mode 100644 index 04d9ff4..0000000 --- a/mods/panel-sites/panel.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * panel sites - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -const electron = require('electron') - -module.exports = (store) => { - let iframe; - const mainWindow = electron.remote.getCurrentWindow(); - const originalUserAgent = mainWindow.webContents.getUserAgent(); - const mobileUserAgent = - 'Mozilla/5.0 (Linux; Android 7.0; SM-G930V Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36' - - // bypass x-frame-options - mainWindow.webContents.session.webRequest.onHeadersReceived((details, callback) => { - const responseHeaders = Object.entries(details.responseHeaders) - .filter( h => !/x-frame-options/i.test(h[0]) ); - callback({ - responseHeaders: Object.fromEntries(responseHeaders) - }); - }); - - // handle opening mobile sites - function setUserAgent(userAgent) { - mainWindow.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => { - details.requestHeaders['User-Agent'] = userAgent; - callback({ cancel: false, requestHeaders: details.requestHeaders }); - }); - } - - return { - onLoad() { - iframe = document.querySelector('.panel-site'); - if (iframe.hasAttribute('mobile-user-agent')) - setUserAgent(mobileUserAgent); - }, - onSwitch() { - if (iframe.hasAttribute('mobile-user-agent')) - setUserAgent(originalUserAgent); - } - } -} diff --git a/mods/pastel-dark/app.css b/mods/pastel-dark/app.css deleted file mode 100644 index e42eb1a..0000000 --- a/mods/pastel-dark/app.css +++ /dev/null @@ -1,78 +0,0 @@ -/* - * pastel dark - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 u/zenith_illinois - * under the MIT license - */ - -.notion-dark-theme img[src*='/images/onboarding/use-case-note.png'], -.notion-dark-theme - img[src*='/images/onboarding/team-features-illustration.png'] { - filter: invert(1) !important; -} -.notion-dark-theme img[src*='/images/onboarding/checked.svg'] { - filter: hue-rotate(45deg) !important; -} -.notion-dark-theme - img[style*='display: block; object-fit: cover; border-radius: 100%; width: 90px; height: 90px;'], -.notion-dark-theme - img[style*='display: block; object-fit: cover; border-radius: 3px; width: 56.832px; height: 56.832px; transition: opacity 100ms ease-out 0s;'] { - transition: filter 0.4s ease !important; -} -.notion-dark-theme - img[style*='display: block; object-fit: cover; border-radius: 100%; width: 90px; height: 90px;']:hover, -.notion-dark-theme - img[style*='display: block; object-fit: cover; border-radius: 3px; width: 56.832px; height: 56.832px; transition: opacity 100ms ease-out 0s;']:hover { - filter: brightness(1.2); -} - -.notion-dark-theme - [style*='font-family: iawriter-mono, Nitti, Menlo, Courier, monospace;'] { - filter: hue-rotate(170deg) !important; -} - -.notion-dark-theme - .notion-token-remove-button[role*='button'][tabindex*='0']:hover, -.notion-dark-theme .notion-record-icon { - background: transparent !important; -} - -.notion-dark-theme .notion-focusable:focus-within, -.notion-dark-theme .notion-to_do-block > div > div > div[style*='background:'], -.notion-dark-theme div[role='button'], -[style*='height: 4px;'] - > .notion-selectable.notion-collection_view_page-block - > *, -.notion-dark-theme - .notion-calendar-view-day[style*='background: rgb(235, 87, 87);'], -.DayPicker-Day--today, -.notion-dark-theme - .DayPicker:not(.DayPicker--interactionDisabled) - .DayPicker-Day--outside:hover, -.notion-dark-theme - .DayPicker:not(.DayPicker--interactionDisabled) - .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--value) - .DayPicker-Day.DayPicker-Day--start.DayPicker-Day--selected, -.notion-dark-theme .DayPicker-Day.DayPicker-Day--range.DayPicker-Day--start, -.notion-dark-theme .DayPicker-Day.DayPicker-Day--range.DayPicker-Day--end { - transition: color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease !important; -} - -.notion-dark-theme [style*='background: rgb(63, 68, 71);'], -.notion-dark-theme - [style*='background: rgb(80, 85, 88);'][style*='color: rgba(255, 255, 255, 0.7)'], -.notion-dark-theme - [style*='background: rgb(80, 85, 88);'][style*='width: 18px;'][style*='height: 18px;'], -.notion-dark-theme - [style*='box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 5px 10px, rgba(15, 15, 15, 0.4) 0px 15px 40px;'], -.notion-dark-theme [style*='background: rgba(151, 154, 155, 0.5);'], -.notion-dark-theme [style*='background: rgba(147, 114, 100, 0.5)'], -.notion-dark-theme [style*='background: rgba(255, 163, 68, 0.5)'], -.notion-dark-theme [style*='background: rgba(255, 220, 73, 0.5)'], -.notion-dark-theme [style*='background: rgba(77, 171, 154, 0.5)'], -.notion-dark-theme [style*='background: rgba(82, 156, 202, 0.5)'], -.notion-dark-theme [style*='background: rgba(154, 109, 215, 0.5)'], -.notion-dark-theme [style*='background: rgba(226, 85, 161, 0.5)'], -.notion-dark-theme [style*='background: rgba(255, 115, 105, 0.5)'] { - box-shadow: 0 2px 4px rgb(0 0 0 / 66%) !important; -} diff --git a/mods/pastel-dark/mod.js b/mods/pastel-dark/mod.js deleted file mode 100644 index ea20581..0000000 --- a/mods/pastel-dark/mod.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * pastel dark - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 u/zenith_illinois - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: '033bff54-50ba-4cec-bdc0-b2ca7e307085', - tags: ['theme', 'dark'], - name: 'pastel dark', - desc: 'a smooth-transition true dark theme with a hint of pastel.', - version: '0.1.4', - author: { - name: 'zenith_illinois', - link: 'https://www.reddit.com/user/zenith_illinois/', - avatar: 'https://www.redditstatic.com/avatars/avatar_default_18_46A508.png', - }, -}; diff --git a/mods/pastel-dark/variables.css b/mods/pastel-dark/variables.css deleted file mode 100644 index 7166b7c..0000000 --- a/mods/pastel-dark/variables.css +++ /dev/null @@ -1,119 +0,0 @@ -/* - * pastel dark - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 u/zenith_illinois - * under the MIT license - */ - -@import 'https://rsms.me/inter/inter.css'; - -:root { - --theme_dark--main: #0b0b0b; - --theme_dark--sidebar: #0f0f0f; - --theme_dark--overlay: rgba(15, 15, 15, 0.6); - --theme_dark--dragarea: #0d0d0d; - - --theme_dark--font_sans: 'Inter', -apple-system, BlinkMacSystemFont, - 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, - 'Segoe UI Emoji', 'Segoe UI Symbol'; - - --theme_dark--scrollbar: #141414; - --theme_dark--scrollbar_hover: #1b1b1b; - - --theme_dark--card: #0f0f0f; - --theme_dark--gallery: rgba(8, 8, 8, 0.05); - --theme_dark--select_input: #0d0d0d; - --theme_dark--table-border: rgba(255, 255, 255, 0.1); - --theme_dark--ui-border: var(--theme_dark--table-border); - --theme_dark--interactive_hover: #1e1e1e5c; - --theme_dark--button_close: #eb5757; - - --theme_dark--selected: rgba(184, 135, 247, 0.3); - --theme_dark--primary: #b887f7; - --theme_dark--primary_hover: #08d7c2; - --theme_dark--primary_click: #b887f7; - --theme_dark--primary_indicator: #08d7c2; - - --theme_dark--option_active-background: var(--theme_dark--primary); - --theme_dark--option_hover-background: var(--theme_dark--primary_hover); - - --theme_dark--danger_text: #eb5757; - --theme_dark--danger_border: rgba(235, 87, 87, 0.5); - - --theme_dark--text: #ffffff; - --theme_dark--text_ui: #909090; - --theme_dark--text_ui_info: #464646; - - --theme_dark--text_gray: #b1aeab; - --theme_dark--text_brown: #d8b6a6; - --theme_dark--text_orange: #fde3c0; - --theme_dark--text_yellow: #fcde93; - --theme_dark--text_green: #b3f5c8; - --theme_dark--text_blue: #bfe0fd; - --theme_dark--text_purple: #dac7fa; - --theme_dark--text_pink: #f7b8dc; - --theme_dark--text_red: #f8acb4; - - --theme_dark--bg-text: rgb(55, 53, 47); - --theme_dark--bg_gray: #b1aeab; - --theme_dark--bg_brown: #d8b6a6; - --theme_dark--bg_orange: #fde3c0; - --theme_dark--bg_yellow: #fcde93; - --theme_dark--bg_green: #b3f5c8; - --theme_dark--bg_blue: #bfe0fd; - --theme_dark--bg_purple: #dac7fa; - --theme_dark--bg_pink: #f7b8dc; - --theme_dark--bg_red: #f8acb4; - - --theme_dark--line-text: rgb(34, 34, 34); - --theme_dark--line_gray: #c2c1c089; - --theme_dark--line_brown: #dacec992; - --theme_dark--line_orange: #fff0dc9f; - --theme_dark--line_yellow: #ffe6a6ad; - --theme_dark--line_green: #c8fdd9a3; - --theme_dark--line_blue: #d1e9ffa3; - --theme_dark--line_purple: #e3d3ffa8; - --theme_dark--line_pink: #fdcce8b1; - --theme_dark--line_red: #ffc8ce9e; - - --theme_dark--select-text: var(--theme_dark--bg-text); - --theme_dark--select_gray: var(--theme_dark--bg_gray); - --theme_dark--select_brown: var(--theme_dark--bg_brown); - --theme_dark--select_orange: var(--theme_dark--bg_orange); - --theme_dark--select_yellow: var(--theme_dark--bg_yellow); - --theme_dark--select_green: var(--theme_dark--bg_green); - --theme_dark--select_blue: var(--theme_dark--bg_blue); - --theme_dark--select_purple: var(--theme_dark--bg_purple); - --theme_dark--select_pink: var(--theme_dark--bg_pink); - --theme_dark--select_red: var(--theme_dark--bg_red); - - --theme_dark--callout-text: var(--theme_dark--line-text); - --theme_dark--callout_gray: var(--theme_dark--line_gray); - --theme_dark--callout_brown: var(--theme_dark--line_brown); - --theme_dark--callout_orange: var(--theme_dark--line_orange); - --theme_dark--callout_yellow: var(--theme_dark--line_yellow); - --theme_dark--callout_green: var(--theme_dark--line_green); - --theme_dark--callout_blue: var(--theme_dark--line_blue); - --theme_dark--callout_purple: var(--theme_dark--line_purple); - --theme_dark--callout_pink: var(--theme_dark--line_pink); - --theme_dark--callout_red: var(--theme_dark--line_red); - - --theme_dark--code_inline-text: #b3f5c8; - --theme_dark--code_inline-background: rgb(8, 8, 8); - --theme_dark--code-text: var(--theme_dark--text); - --theme_dark--code-background: #0f0f0f; - --theme_dark--code_function: var(--theme_dark--text_blue); - --theme_dark--code_keyword: var(--theme_dark--text_pink); - --theme_dark--code_tag: var(--theme_dark--text_pink); - --theme_dark--code_operator: var(--theme_dark--text_yellow); - --theme_dark--code_important: var(--theme_dark--text_yellow); - --theme_dark--code_property: var(--theme_dark--text_pink); - --theme_dark--code_builtin: var(--theme_dark--text_yellow); - --theme_dark--code_attr-name: var(--theme_dark--text_yellow); - --theme_dark--code_comment: var(--theme_dark--text_gray); - --theme_dark--code_punctuation: var(--theme_dark--text_gray); - --theme_dark--code_doctype: var(--theme_dark--text_gray); - --theme_dark--code_number: var(--theme_dark--text_purple); - --theme_dark--code_string: var(--theme_dark--text_orange); - --theme_dark--code_attr-value: var(--theme_dark--text_orange); -} diff --git a/mods/pinky-boom-light/mod.js b/mods/pinky-boom-light/mod.js deleted file mode 100644 index 0ed8f68..0000000 --- a/mods/pinky-boom-light/mod.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Pinky Booooom Theme! - * (c) 2020 mugiwarafx (https://github.com/mugiwarafx) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: "fbef391c-58ff-4938-bd45-b85ae0435e4e", - name: "pinky boom theme", - tags: ['theme', 'light', 'pink'], - desc: "pinkify your light theme", - version: "1.0.0", - author: "mugiwarafx", -}; diff --git a/mods/pinky-boom-light/variables.css b/mods/pinky-boom-light/variables.css deleted file mode 100644 index 9be8027..0000000 --- a/mods/pinky-boom-light/variables.css +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Pinky Booooom Theme! - * (c) 2020 mugiwarafx (https://github.com/mugiwarafx) - * under the MIT license - */ - - :root { - - /** light **/ - - --light_pinky-deep-pink: deeppink; - - --light_pinky-lighten-1: #fce4ec; - --light_pinky-lighten-2: #f8bbd0; - --light_pinky-lighten-3: #f48fb1; - --light_pinky-lighten-4: #ff80ab; - - --light_pinky-darken: #880e4f; - - --light_pinky-alt-colors-white: #fefafa; - --light_pinky-alt-colors-transparent: transparent; - - --light_pinky-deep-purple: #1e114e; - - --light_pinky-trans-purple-1: #37352f06; - --light_pinky-trans-purple-2: #8868ff1a; - --light_pinky-trans-purple-3: #880e4f38; - --light_pinky-trans-purple-4: #8968ff42; - - --light_pinky-trans-1: #ffc0cb61; - --light_pinky-trans-2: #ffc0cb96; - --light_pinky-trans-3: #ffc0cbb8; - --light_pinky-trans-4: #ffc0cbda; - --light_pinky-trans-5: #ffb6c175; - --light_pinky-trans-6: #ffc0cb99; - - --light_pinky-brown: #a52a2a80; - --light_pinky-orange: #ffa60080; - --light_pinky-yellow: #ffff0080; - --light_pinky-green: #00ff0080; - --light_pinky-blue: #00ffff80; - --light_pinky-purple: #9b00ff80; - --light_pinky-pink: #ff149180; - --light_pinky-red: #ff000080; - --light_pinky-black: black; - --light_pinky-white: white; - - --theme_light--main: var(--light_pinky-alt-colors-white); - --theme_light--sidebar: var(--light_pinky-alt-colors-transparent); - --theme_light--overlay: var(--light_pinky-trans-6); - --theme_light--dragarea: var(--light_pinky-lighten-1); - --theme_light--box-shadow: var(--light_pinky-trans-1) 0px 0px 0px 1px, var(--light_pinky-trans-1) 0px 2px 4px; - --theme_light--box-shadow_strong: var(--light_pinky-trans-4) 0px 0px 0px 1px, var(--light_pinky-trans-2) 0px 3px 6px, var(--light_pinky-trans-3) 0px 9px 24px; - - --theme_light--page_normal-width: 900px; - --theme_light--page_full-width: 100%; - --theme_light--page-padding: calc(96px + env(safe-area-inset-left)); - --theme_light--page_banner-height: 30vh; - --theme_light--preview-width: 977px; - --theme_light--preview-padding: 8rem; - --theme_light--preview_banner-height: 20vh; - - --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--font_quote: var(--theme_light--font_sans); - --theme_light--font_headings: var(--theme_light--font_sans); - --theme_light--font_title-size: 40px; - --theme_light--font_heading1-size: 1.875em; - --theme_light--font_heading2-size: 1.5em; - --theme_light--font_heading3-size: 1.25em; - --theme_light--font_label-size: 14px; - --theme_light--font_body-size: 16px; - --theme_light--font_body-size_small: 14px; - --theme_light--font_code-size: 0.796875em; - --theme_light--font_sidebar-size: 14px; - --theme_light--text-block_line-height: 1.5; - --theme_light--text-block_margin-top: 1px; - - --theme_light--scrollbar: var(--light_pinky-lighten-3); - --theme_light--scrollbar-border: var(--theme_pinky--helpers-transparent); - --theme_light--scrollbar_hover: var(--light_pinky-lighten-2); - --theme_light--card: var(--light_pinky-lighten-1); - --theme_light--gallery: var(--light_pinky-trans-purple-1); - --theme_light--select_input: var(--light_pinky-trans-purple-2); - --theme_light--table-border: var(--light_pinky-trans-purple-2); - --theme_light--ui-border: var(--light_pinky-trans-purple-2); - --theme_light--interactive_hover: var(--light_pinky-trans-purple-4); - --theme_light--interactive_hover-border: var(--light_pinky-alt-colors-transparent); - --theme_light--button_close: #e81123; - --theme_light--button_close-fill: var(--light_pinky-white); - --theme_light--selected: var(--light_pinky-trans-purple-4); - --theme_light--primary: var(--light_pinky-deep-pink); - --theme_light--primary_hover: var(--light_pinky-lighten-4); - --theme_light--primary_click: var(--light_pinky-lighten-4); - --theme_light--primary_indicator: rgb(235, 87, 87); - --theme_light--option-color: var(--light_pinky-darken); - --theme_light--option-background: var(--light_pinky-alt-colors-transparent); - --theme_light--option_hover-color: var(--light_pinky-darken); - --theme_light--option_hover-background: var(--light_pinky-trans-purple-3); - --theme_light--option_active-color: var(--light_pinky-white); - --theme_light--option_active-background: var(--theme_light--primary); - --theme_light--danger_text: rgb(235, 87, 87); - --theme_light--danger_border: rgba(235, 87, 87, 0.5); - --theme_light--text: var(--theme_light--text); - --theme_light--text_ui: var(--light_pinky-deep-purple); - --theme_light--text_ui_info: var(--light_pinky-deep-pink); - - --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: var(--light_pinky-purple); - --theme_light--text_pink: var(--light_pinky-deep-pink); - --theme_light--text_red: rgb(224, 62, 62); - - --theme_light--bg-text: var(--theme_light--text); - --theme_light--bg_gray: rgba(128, 128, 128, 0.25); - --theme_light--bg_gray-text: var(--theme_light--bg-text); - --theme_light--bg_brown: var(--light_pinky-brown); - --theme_light--bg_brown-text: var(--theme_light--bg-text); - --theme_light--bg_orange: var(--light_pinky-orange); - --theme_light--bg_orange-text: var(--light_pinky-black); - --theme_light--bg_yellow: var(--light_pinky-yellow); - --theme_light--bg_yellow-text: var(--light_pinky-black); - --theme_light--bg_green: var(--light_pinky-green); - --theme_light--bg_green-text: var(--light_pinky-black); - --theme_light--bg_blue: var(--light_pinky-blue); - --theme_light--bg_blue-text: var(--light_pinky-black); - --theme_light--bg_purple: var(--light_pinky-purple); - --theme_light--bg_purple-text: var(--light_pinky-white); - --theme_light--bg_pink: var(--light_pinky-pink); - --theme_light--bg_pink-text: var(--light_pinky-white); - --theme_light--bg_red: var(--light_pinky-red); - --theme_light--bg_red-text: var(--theme_light--bg-text); - - --theme_light--line-text: var(--theme_light--text); - --theme_light--line_gray: rgba(128, 128, 128, 0.5); - --theme_light--line_gray-text: var(--theme_light--line-text); - --theme_light--line_brown: var(--light_pinky-brown); - --theme_light--line_brown-text: var(--theme_light--line-text); - --theme_light--line_orange: var(--light_pinky-orange); - --theme_light--line_orange-text: var(--theme_light--line-text); - --theme_light--line_yellow: var(--light_pinky-yellow); - --theme_light--line_yellow-text: var(--theme_light--line-text); - --theme_light--line_green: var(--light_pinky-green); - --theme_light--line_green-text: var(--theme_light--line-text); - --theme_light--line_blue: var(--light_pinky-blue); - --theme_light--line_blue-text: var(--theme_light--line-text); - --theme_light--line_purple: var(--light_pinky-purple); - --theme_light--line_purple-text: var(--theme_light--line-text); - --theme_light--line_pink: var(--light_pinky-pink); - --theme_light--line_pink-text: var(--theme_light--line-text); - --theme_light--line_red: var(--light_pinky-red); - --theme_light--line_red-text: var(--theme_light--line-text); - - --theme_light--select-text: var(--theme_light--text); - --theme_light--select_gray: rgba(128, 128, 128, 0.25); - --theme_light--select_gray-text: var(--light_pinky-white); - --theme_light--select_brown: var(--light_pinky-brown); - --theme_light--select_brown-text: var(--light_pinky-white); - --theme_light--select_orange: var(--light_pinky-orange); - --theme_light--select_orange-text: var(--light_pinky-black); - --theme_light--select_yellow: var(--light_pinky-yellow); - --theme_light--select_yellow-text: var(--light_pinky-black); - --theme_light--select_green: var(--light_pinky-green); - --theme_light--select_green-text: var(--light_pinky-black); - --theme_light--select_blue: var(--light_pinky-blue); - --theme_light--select_blue-text: var(--light_pinky-black); - --theme_light--select_purple: var(--light_pinky-purple); - --theme_light--select_purple-text: var(--light_pinky-white); - --theme_light--select_pink: var(--light_pinky-pink); - --theme_light--select_pink-text: var(--light_pinky-white); - --theme_light--select_red: var(--light_pinky-red); - --theme_light--select_red-text: var(--light_pinky-white); - - --theme_light--callout-text: var(--theme_light--text); - --theme_light--callout_gray: rgba(128, 128, 128, 0.25); - --theme_light--callout_gray-text: var(--light_pinky-black); - --theme_light--callout_brown: var(--light_pinky-brown); - --theme_light--callout_brown-text: var(--light_pinky-white); - --theme_light--callout_orange: var(--light_pinky-orange); - --theme_light--callout_orange-text: var(--light_pinky-black); - --theme_light--callout_yellow: var(--light_pinky-yellow); - --theme_light--callout_yellow-text: var(--light_pinky-black); - --theme_light--callout_green: var(--light_pinky-green); - --theme_light--callout_green-text: var(--light_pinky-black); - --theme_light--callout_blue: var(--light_pinky-blue); - --theme_light--callout_blue-text: var(--light_pinky-black); - --theme_light--callout_purple: var(--light_pinky-purple); - --theme_light--callout_purple-text: var(--light_pinky-white); - --theme_light--callout_pink: var(--light_pinky-pink); - --theme_light--callout_pink-text: var(--light_pinky-white); - --theme_light--callout_red: var(--light_pinky-red); - --theme_light--callout_red-text: var(--light_pinky-white); - - --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: #8868ff1f; - --theme_light--code_function: #dd4a68; - --theme_light--code_keyword: #07a; - --theme_light--code_tag: #905; - --theme_light--code_operator: #9a6e3a; - --theme_light--code_important: #e90; - --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; -} - -.notion-light-theme { - --theme--main: var(--theme_light--main); - --theme--sidebar: var(--theme_light--sidebar); - --theme--overlay: var(--theme_light--overlay); - --theme--dragarea: var(--theme_light--dragarea); - --theme--box-shadow: var(--theme_light--box-shadow); - --theme--box-shadow_strong: var(--theme_light--box-shadow_strong); - --theme--page_normal-width: var(--theme_light--page_normal-width); - --theme--page_full-width: var(--theme_light--page_full-width); - --theme--page-padding: var(--theme_light--page-padding); - --theme--page_banner-height: var(--theme_light--page_banner-height); - --theme--preview-width: var(--theme_light--preview-width); - --theme--preview-padding: var(--theme_light--preview-padding); - --theme--preview_banner-height: var(--theme_light--preview_banner-height); - --theme--font_sans: var(--theme_light--font_sans); - --theme--font_serif: var(--theme_light--font_serif); - --theme--font_mono: var(--theme_light--font_mono); - --theme--font_code: var(--theme_light--font_code); - --theme--font_quote: var(--theme_light--font_quote); - --theme--font_headings: var(--theme_light--font_headings); - --theme--font_title-size: var(--theme_light--font_title-size); - --theme--font_heading1-size: var(--theme_light--font_heading1-size); - --theme--font_heading2-size: var(--theme_light--font_heading2-size); - --theme--font_heading3-size: var(--theme_light--font_heading3-size); - --theme--font_label-size: var(--theme_light--font_label-size); - --theme--font_body-size: var(--theme_light--font_body-size); - --theme--font_body-size_small: var(--theme_light--font_body-size_small); - --theme--font_code-size: var(--theme_light--font_code-size); - --theme--font_sidebar-size: var(--theme_light--font_sidebar-size); - --theme--text-block_line-height: var(--theme_light--text-block_line-height); - --theme--text-block_margin-top: var(--theme_light--text-block_margin-top); - --theme--scrollbar: var(--theme_light--scrollbar); - --theme--scrollbar-border: var(--theme_light--scrollbar-border); - --theme--scrollbar_hover: var(--theme_light--scrollbar_hover); - --theme--card: var(--theme_light--card); - --theme--gallery: var(--theme_light--gallery); - --theme--select_input: var(--theme_light--select_input); - --theme--table-border: var(--theme_light--table-border); - --theme--ui-border: var(--theme_light--ui-border); - --theme--interactive_hover: var(--theme_light--interactive_hover); - --theme--interactive_hover-border: var(--theme_light--interactive_hover-border); - --theme--button_close: var(--theme_light--button_close); - --theme--button_close-fill: var(--theme_light--button_close-fill); - --theme--selected: var(--theme_light--selected); - --theme--primary: var(--theme_light--primary); - --theme--primary_hover: var(--theme_light--primary_hover); - --theme--primary_click: var(--theme_light--primary_click); - --theme--primary_indicator: var(--theme_light--primary_indicator); - --theme--option-color: var(--theme_light--option-color); - --theme--option-background: var(--theme_light--option-background); - --theme--option_hover-color: var(--theme_light--option_hover-color); - --theme--option_hover-background: var(--theme_light--option_hover-background); - --theme--option_active-color: var(--theme_light--option_active-color); - --theme--option_active-background: var(--theme_light--option_active-background); - --theme--danger_text: var(--theme_light--danger_text); - --theme--danger_border: var(--theme_light--danger_border); - --theme--text: var(--theme_light--text); - --theme--text_ui: var(--theme_light--text_ui); - --theme--text_ui_info: var(--theme_light--text_ui_info); - --theme--text_gray: var(--theme_light--text_gray); - --theme--text_brown: var(--theme_light--text_brown); - --theme--text_orange: var(--theme_light--text_orange); - --theme--text_yellow: var(--theme_light--text_yellow); - --theme--text_green: var(--theme_light--text_green); - --theme--text_blue: var(--theme_light--text_blue); - --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--select-text: var(--theme_light--select-text); - --theme--bg-text: var(--theme_light--bg-text); - --theme--bg_gray: var(--theme_light--bg_gray); - --theme--bg_gray-text: var(--theme_light--bg_gray-text); - --theme--bg_brown: var(--theme_light--bg_brown); - --theme--bg_brown-text: var(--theme_light--bg_brown-text); - --theme--bg_orange: var(--theme_light--bg_orange); - --theme--bg_orange-text: var(--theme_light--bg_orange-text); - --theme--bg_yellow: var(--theme_light--bg_yellow); - --theme--bg_yellow-text: var(--theme_light--bg_yellow-text); - --theme--bg_green: var(--theme_light--bg_green); - --theme--bg_green-text: var(--theme_light--bg_green-text); - --theme--bg_blue: var(--theme_light--bg_blue); - --theme--bg_blue-text: var(--theme_light--bg_blue-text); - --theme--bg_purple: var(--theme_light--bg_purple); - --theme--bg_purple-text: var(--theme_light--bg_purple-text); - --theme--bg_pink: var(--theme_light--bg_pink); - --theme--bg_pink-text: var(--theme_light--bg_pink-text); - --theme--bg_red: var(--theme_light--bg_red); - --theme--bg_red-text: var(--theme_light--bg_red-text); - --theme--line-text: var(--theme_light--line-text); - --theme--line_gray: var(--theme_light--line_gray); - --theme--line_gray-text: var(--theme_light--line_gray-text); - --theme--line_brown: var(--theme_light--line_brown); - --theme--line_brown-text: var(--theme_light--line_brown-text); - --theme--line_orange: var(--theme_light--line_orange); - --theme--line_orange-text: var(--theme_light--line_orange-text); - --theme--line_yellow: var(--theme_light--line_yellow); - --theme--line_yellow-text: var(--theme_light--line_yellow-text); - --theme--line_green: var(--theme_light--line_green); - --theme--line_green-text: var(--theme_light--line_green-text); - --theme--line_blue: var(--theme_light--line_blue); - --theme--line_blue-text: var(--theme_light--line_blue-text); - --theme--line_purple: var(--theme_light--line_purple); - --theme--line_purple-text: var(--theme_light--line_purple-text); - --theme--line_pink: var(--theme_light--line_pink); - --theme--line_pink-text: var(--theme_light--line_pink-text); - --theme--line_red: var(--theme_light--line_red); - --theme--line_red-text: var(--theme_light--line_red-text); - --theme--select_gray: var(--theme_light--select_gray); - --theme--select_gray-text: var(--theme_light--select_gray-text); - --theme--select_brown: var(--theme_light--select_brown); - --theme--select_brown-text: var(--theme_light--select_brown-text); - --theme--select_orange: var(--theme_light--select_orange); - --theme--select_orange-text: var(--theme_light--select_orange-text); - --theme--select_yellow: var(--theme_light--select_yellow); - --theme--select_yellow-text: var(--theme_light--select_yellow-text); - --theme--select_green: var(--theme_light--select_green); - --theme--select_green-text: var(--theme_light--select_green-text); - --theme--select_blue: var(--theme_light--select_blue); - --theme--select_blue-text: var(--theme_light--select_blue-text); - --theme--select_purple: var(--theme_light--select_purple); - --theme--select_purple-text: var(--theme_light--select_purple-text); - --theme--select_pink: var(--theme_light--select_pink); - --theme--select_pink-text: var(--theme_light--select_pink-text); - --theme--select_red: var(--theme_light--select_red); - --theme--select_red-text: var(--theme_light--select_red-text); - --theme--callout-text: var(--theme_light--callout-text); - --theme--callout_gray: var(--theme_light--callout_gray); - --theme--callout_gray-text: var(--theme_light--callout_gray-text); - --theme--callout_brown: var(--theme_light--callout_brown); - --theme--callout_brown-text: var(--theme_light--callout_brown-text); - --theme--callout_orange: var(--theme_light--callout_orange); - --theme--callout_orange-text: var(--theme_light--callout_orange-text); - --theme--callout_yellow: var(--theme_light--callout_yellow); - --theme--callout_yellow-text: var(--theme_light--callout_yellow-text); - --theme--callout_green: var(--theme_light--callout_green); - --theme--callout_green-text: var(--theme_light--callout_green-text); - --theme--callout_blue: var(--theme_light--callout_blue); - --theme--callout_blue-text: var(--theme_light--callout_blue-text); - --theme--callout_purple: var(--theme_light--callout_purple); - --theme--callout_purple-text: var(--theme_light--callout_purple-text); - --theme--callout_pink: var(--theme_light--callout_pink); - --theme--callout_pink-text: var(--theme_light--callout_pink-text); - --theme--callout_red: var(--theme_light--callout_red); - --theme--callout_red-text: var(--theme_light--callout_red-text); - --theme--code_inline-text: var(--theme_light--code_inline-text); - --theme--code_inline-background: var(--theme_light--code_inline-background); - --theme--code-text: var(--theme_light--code-text); - --theme--code-background: var(--theme_light--code-background); - --theme--code_function: var(--theme_light--code_function); - --theme--code_keyword: var(--theme_light--code_keyword); - --theme--code_tag: var(--theme_light--code_tag); - --theme--code_operator: var(--theme_light--code_operator); - --theme--code_important: var(--theme_light--code_important); - --theme--code_property: var(--theme_light--code_property); - --theme--code_builtin: var(--theme_light--code_builtin); - --theme--code_attr-name: var(--theme_light--code_attr-name); - --theme--code_comment: var(--theme_light--code_comment); - --theme--code_punctuation: var(--theme_light--code_punctuation); - --theme--code_doctype: var(--theme_light--code_doctype); - --theme--code_number: var(--theme_light--code_number); - --theme--code_string: var(--theme_light--code_string); - --theme--code_attr-value: var(--theme_light--code_attr-value); -} - -.notion-sidebar{background-color: pink;} diff --git a/mods/property-layout/app.css b/mods/property-layout/app.css deleted file mode 100644 index 96016ee..0000000 --- a/mods/property-layout/app.css +++ /dev/null @@ -1,48 +0,0 @@ -/* - * property layout - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 alexander-kazakov - * under the MIT license - */ - -.propertylayout-enhanced { - overflow: hidden; - transition: max-height 200ms ease-in, opacity 200ms ease-in; -} -.propertylayout-hidden { - max-height: 0 !important; - opacity: 0; -} - -.propertylayout-toggle { - width: 100%; - text-align: left; - font-size: 0.85em; - font-weight: 600; - padding: 0.25em; - background: transparent; - color: var(--theme--text_ui); - border: none; - border-radius: 2px; - transition: background 200ms, margin-bottom 200ms ease-in; -} -.notion-scroller.vertical > div > :first-child .propertylayout-toggle { - margin-top: 1em; -} -.propertylayout-toggle[data-action='show'] { - margin-bottom: 1em; -} -.propertylayout-toggle:hover { - background: var(--theme--interactive_hover); -} - -.propertylayout-toggle .triangle { - width: 0.6875em; - height: 0.6875em; - margin: 0 0.75em 0 0.5em; - transition: transform 200ms ease-out 0s; - transform: rotateZ(90deg); -} -.propertylayout-toggle[data-action="hide"] .triangle { - transform: rotateZ(180deg); -} diff --git a/mods/property-layout/mod.js b/mods/property-layout/mod.js deleted file mode 100644 index 9509a50..0000000 --- a/mods/property-layout/mod.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * property layout - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 alexander-kazakov - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: '4034a578-7dd3-4633-80c6-f47ac5b7b160', - tags: ['extension'], - name: 'property layout', - desc: 'auto-collapse page properties that usually push down page content.', - version: '0.2.4', - author: 'alexander-kazakov', - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - let queue = []; - const observer = new MutationObserver((list, observer) => { - if (!queue.length) requestAnimationFrame(() => handle(queue)); - queue.push(...list); - }); - observer.observe(document.body, { - childList: true, - subtree: true, - }); - function handle(list) { - queue = []; - let properties = document.querySelector( - '.notion-scroller.vertical [style*="env(safe-area-inset-left)"] > [style="width: 100%; font-size: 14px;"]' - ); - if ( - properties && - !properties.classList.contains('propertylayout-enhanced') - ) { - properties.classList.add( - 'propertylayout-enhanced', - 'propertylayout-hidden' - ); - const toggle = createElement( - '' - ); - toggle.prepend( - createElement('') - ); - toggle.addEventListener('click', (event) => { - properties.style.maxHeight = properties.children[0].offsetHeight + 'px'; - setTimeout(() => { - properties.classList.toggle('propertylayout-hidden'); - toggle.setAttribute( - 'data-action', - properties.classList.contains('propertylayout-hidden') - ? 'show' - : 'hide' - ); - }, 0); - }); - const propObserver = new MutationObserver(() => { - properties.style.maxHeight = ''; - }); - propObserver.observe(properties, { - childList: true, - subtree: true, - }); - if (properties.previousElementSibling) { - properties.previousElementSibling.append(toggle); - } else properties.parentElement.prepend(toggle); - } - } - }); - }, - }, -}; diff --git a/mods/right-to-left/mod.js b/mods/right-to-left/mod.js deleted file mode 100644 index 917e127..0000000 --- a/mods/right-to-left/mod.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * right-to-left - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 Omar Bahareth - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'b28ee2b9-4d34-4e36-be8a-ab5be3d79f51', - tags: ['extension'], - name: 'right-to-left', - desc: 'enables auto rtl/ltr text direction detection.', - version: '1.4.1', - author: 'obahareth', - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - let queue = []; - const DOCUMENT_OBSERVER = new MutationObserver((list, observer) => { - if (!queue.length) requestIdleCallback(() => handle(queue)); - queue.push(...list); - }), - PAGE_OBSERVER = new MutationObserver(autoAlignPageContent); - DOCUMENT_OBSERVER.observe(document.body, { - childList: true, - subtree: true, - }); - function handle(list) { - queue = []; - for (let { addedNodes } of list) { - if ( - addedNodes[0] && - addedNodes[0].className === 'notion-page-content' - ) { - autoAlignPageContent(); - - PAGE_OBSERVER.disconnect(); - PAGE_OBSERVER.observe(addedNodes[0], { - childList: true, - subtree: false, - }); - } - } - } - function autoAlignPageContent() { - document - .querySelectorAll( - `.notion-page-content > div[data-block-id]:not([dir]):not(.notion-column_list-block), - [placeholder="Untitled"]:not([dir]), - .notion-column-block > div[data-block-id]:not([dir])` - ) - .forEach((block) => block.setAttribute('dir', 'auto')); - document - .querySelectorAll( - "div[placeholder='List'], div[placeholder='To-do']" - ) - .forEach((item) => { - item.style['text-align'] = '-webkit-auto'; - }); - } - }); - }, - }, -}; diff --git a/mods/scroll-to-top/app.css b/mods/scroll-to-top/app.css deleted file mode 100644 index 38ec2b5..0000000 --- a/mods/scroll-to-top/app.css +++ /dev/null @@ -1,60 +0,0 @@ -/* - * scroll-to-top - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -.bottom-right-buttons { - position: absolute; - bottom: 33px; - right: 33px; - z-index: 101; - cursor: default; - pointer-events: none; -} - -.bottom-right-buttons > div { - margin-top: 8px; - pointer-events: auto; - - user-select: none; - transition: opacity 700ms ease 0s, color 700ms ease 0s, - transform 700ms ease 0s; - cursor: pointer; - - position: static !important; - - width: 36px; - height: 36px; - - display: flex; - align-items: center; - justify-content: center; - - border-radius: 100%; - font-size: 20px; - - background: var(--theme--interactive_hover); - box-shadow: var(--theme--box-shadow); -} - -.notion-scroll-button { - display: flex !important; -} - -.notion-scroll-button.hidden { - pointer-events: none; - - visibility: hidden; - opacity: 0; - transform: translateY(10px); - - transition-property: opacity, transform, visibility; - transition-delay: 0, 0, 700ms; -} - -.notion-scroll-button > svg { - width: 16px; - height: 16px; -} diff --git a/mods/scroll-to-top/arrow.svg b/mods/scroll-to-top/arrow.svg deleted file mode 100644 index 106d0b7..0000000 --- a/mods/scroll-to-top/arrow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/scroll-to-top/mod.js b/mods/scroll-to-top/mod.js deleted file mode 100644 index f4e609b..0000000 --- a/mods/scroll-to-top/mod.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * scroll-to-top - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'), - path = require('path'), - fs = require('fs-extra'); - -module.exports = { - id: '0a958f5a-17c5-48b5-8713-16190cae1959', - tags: ['extension'], - name: 'scroll to top', - desc: - 'add an arrow above the help button to scroll back to the top of a page.', - version: '1.1.0', - author: 'CloudHill', - options: [ - { - key: 'smooth', - label: 'smooth scrolling', - type: 'toggle', - value: true, - }, - { - key: 'top', - label: 'distance scrolled until button is shown:', - type: 'input', - value: 50, - }, - { - key: 'unit', - label: 'unit to measure distance with:', - type: 'select', - value: ['percent', 'pixels'], - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - const attempt_interval = setInterval(enhance, 500); - function enhance() { - if (!document.querySelector('.notion-frame')) return; - clearInterval(attempt_interval); - - const $container = document.createElement('div'); - const $help = document.querySelector('.notion-help-button'); - const $scroll = createElement( - '
' - ); - - (async () => { - $scroll.innerHTML = await fs.readFile( - path.resolve(`${__dirname}/arrow.svg`) // 🠙; - ) - })(); - - $container.className = 'bottom-right-buttons'; - $help.after($container); - $container.append($scroll); - $container.append($help); - - if (store().top > 0) $scroll.classList.add('hidden'); - - $scroll.addEventListener('click', () => { - document.querySelector('.notion-frame > .notion-scroller').scroll({ - top: 0, - left: 0, - behavior: store().smooth ? 'smooth' : 'auto', - }); - }); - - let queue = []; - let $scroller = document.querySelector( - '.notion-frame > .notion-scroller' - ); - let top = store().top || 0; - - const observer = new MutationObserver((list, observer) => { - if (!queue.length) requestAnimationFrame(() => handle(queue)); - queue.push(...list); - }); - observer.observe(document.body, { - childList: true, - subtree: true, - }); - - function handle(list) { - queue = []; - setScrollDistance(); - - for (let { addedNodes } of list) { - if ( - addedNodes[0] && - (addedNodes[0].className === 'notion-presence-container' || - addedNodes[0].className === 'notion-scroller') && - top > 0 - ) { - $scroll.classList.add('hidden'); - - $scroller = document.querySelector( - '.notion-frame > .notion-scroller' - ); - setScrollDistance(); - - $scroller.addEventListener('scroll', (event) => { - if ( - Math.ceil(event.target.scrollTop) < $scroller.top_distance - ) - $scroll.classList.add('hidden'); - else $scroll.classList.remove('hidden'); - }); - } - } - } - - function setScrollDistance() { - $scroller.top_distance = top; - if (top > 0 && store().unit === 'percent') { - let content_height = Array.from($scroller.children).reduce( - (h, c) => h + c.offsetHeight, - 0 - ); - $scroller.top_distance *= - (content_height - $scroller.offsetHeight) / 100; - } - } - } - }); - }, - }, -}; diff --git a/mods/side-panel/app.css b/mods/side-panel/app.css deleted file mode 100644 index 0a95437..0000000 --- a/mods/side-panel/app.css +++ /dev/null @@ -1,228 +0,0 @@ -/* - * side panel - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -.notion-frame, .notion-cursor-listener > div[style*="flex-end"] { - transition: padding-right 300ms ease-in-out; -} - -.enhancer-panel--container { - flex-grow: 0; - flex-shrink: 0; - z-index: 999; - height: 100vh; - background: var(--theme--sidebar); - color: var(--theme--text_ui); - font-weight: 500; - cursor: default; - transition: box-shadow 300ms ease-in, width 300ms ease-in-out; -} - -#enhancer-panel { - display: flex; - flex-direction: column; - position: relative; - pointer-events: auto; - background: var(--theme--sidebar); - cursor: auto; - max-height: 100%; - z-index: 1; - transition: transform 300ms ease-in-out, - opacity 300ms ease-in-out, - right 300ms ease-in-out; -} -#enhancer-panel[data-locked="false"] { - max-height: calc(100vh - 120px); - box-shadow: var(--theme--box-shadow_strong) !important; -} -#enhancer-panel[data-full-height="true"] { - height: 100%; -} -#enhancer-panel[data-locked="false"][data-full-height="true"] { - height: calc(100vh - 120px); -} - -.enhancer-panel--header { - flex-grow: 0; - flex-shrink: 0; - display: flex; - align-items: center; - height: 45px; - width: 100%; - color: var(--theme--text); - font-size: 14px; - padding: 2px 14px; - overflow: hidden; - user-select: none; - cursor: pointer; - transition: color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease; -} -.enhancer-panel--header:hover { - background: var(--theme--interactive_hover); - box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border); -} - -.enhancer-panel--icon { - flex-grow: 0; - flex-shrink: 0; - border-radius: 3px; - width: 22px; - height: 22px; - margin-right: 8px; - display: flex; - align-items: center; - justify-content: center; -} -.enhancer-panel--icon svg { - width: 100%; - height: 100%; -} - -.enhancer-panel--title { - margin-right: 6px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.enhancer-panel--reload-button { - flex-grow: 0; - flex-shrink: 0; - display: flex; - align-items: center; - justify-content: center; - width: 24px; - height: 24px; - padding: 6px; - margin-right: 6px; - border-radius: 3px; - transition: background 20ms ease-in; -} -.enhancer-panel--reload-button:hover { - background: var(--theme--main) -} - -.enhancer-panel--switcher-icon { - flex-grow: 0; - flex-shrink: 0; - width: 12px; - height: 12px; - fill: var(--theme--text_ui); -} -.enhancer-panel--reload-button svg, -.enhancer-panel--switcher-icon svg { - width: 100%; - height: 100%; - display: block; - fill: var(--theme--text_ui_info); -} - -.enhancer-panel--toggle { - flex-grow: 0; - flex-shrink: 0; - position: relative; - display: flex; - align-items: center; - justify-content: center; - margin-left: auto; - height: 24px; - width: 24px; - border-radius: 3px; - cursor: pointer; - opacity: 0; - transition: background 20ms ease-in, opacity 300ms ease-in; -} -#enhancer-panel:hover .enhancer-panel--toggle { - opacity: 1; -} -.enhancer-panel--toggle:hover { - background: var(--theme--interactive_hover); -} -.enhancer-panel--toggle svg { - width: 14px; - height: 14px; - fill: var(--theme--text_ui); - transition: transform 400ms ease-in; - fill: var(--theme--text_ui_info); -} -#enhancer-panel[data-locked="false"] .enhancer-panel--toggle svg { - transform: rotateZ(-180deg); -} - -#enhancer-panel--content { - flex: 1; - width: 100%; - color: var(--theme--text); - font-size: var(--theme--font_body-size); - display: flex; - flex-direction: column; - position: relative; - min-height: 0; -} - -.enhancer-panel--resize { - position: absolute; - top: 0px; - left: 0px; - height: 100vh; - width: 0px; - z-index: 1; -} -#enhancer-panel[data-locked="false"] .enhancer-panel--resize { - height: 100%; -} -.enhancer-panel--resize div { - height: 100%; - width: 6px; -} - -.enhancer-panel--hover-handle { - position: absolute; - right: 8px; - top: 60px; - height: 100%; - width: 20px; -} - -/* overlay */ - -.enhancer-panel--overlay-container { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 999; - overflow: hidden; -} - -.enhancer-panel--switcher { - max-width: 320px; - position: relative; - right: 14px; - border-radius: 3px; - padding: 8px 0; - box-shadow: var(--theme--box-shadow_strong); - background: var(--theme--card); - overflow: hidden; -} - -.enhancer-panel--switcher-item { - display: flex; - align-items: center; - width: 100%; - padding: 8px 14px; - color: var(--theme--text); - font-size: 14px; - user-select: none; - cursor: pointer; - overflow: hidden; - transition: background 300ms ease; -} -.enhancer-panel--switcher-item:hover, -.enhancer-panel--switcher-item:focus { - background: var(--theme--interactive_hover); -} diff --git a/mods/side-panel/icons/double-chevron.svg b/mods/side-panel/icons/double-chevron.svg deleted file mode 100644 index 725d191..0000000 --- a/mods/side-panel/icons/double-chevron.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/mods/side-panel/icons/reload.svg b/mods/side-panel/icons/reload.svg deleted file mode 100644 index d50b922..0000000 --- a/mods/side-panel/icons/reload.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/mods/side-panel/icons/switcher.svg b/mods/side-panel/icons/switcher.svg deleted file mode 100644 index e47e262..0000000 --- a/mods/side-panel/icons/switcher.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/mods/side-panel/mod.js b/mods/side-panel/mod.js deleted file mode 100644 index 6c155bb..0000000 --- a/mods/side-panel/mod.js +++ /dev/null @@ -1,615 +0,0 @@ -/* - * side panel - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement, getEnhancements } = require('../../pkg/helpers.js'), - path = require('path'), - fs = require('fs-extra'); - -module.exports = { - id: 'c8b1db83-ee37-45b4-bdb3-a7f3d36113db', - tags: ['extension', 'panel'], - name: 'side panel', - desc: 'adds a side panel to notion.', - version: '1.2.1', - author: 'CloudHill', - hacks: { - 'renderer/preload.js'(store, __exports) { - // load icons - let icons = {}; - (async () => { - icons.doubleChevron = await fs.readFile( path.resolve(__dirname, 'icons/double-chevron.svg') ); - icons.switcher = await fs.readFile( path.resolve(__dirname, 'icons/switcher.svg') ); - icons.reload = await fs.readFile( path.resolve(__dirname, 'icons/reload.svg') ); - })(); - - // load panel mods - let panelMods = - getEnhancements().loaded.filter( - mod => (mod.panel && (store('mods')[mod.id] || {}).enabled) - ); - // initialize panel values - panelMods.forEach(mod => initMod(mod)); - - // panelMods is an array containing objects with info about each panel - - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - // if no panel mods activated - if (panelMods.length < 1) return; - - const attempt_interval = setInterval(enhance, 500); - function enhance() { - // default panel width - if (!store().width) store().width = 220; - let curPanel = {}; - - if (!document.querySelector('.notion-sidebar')) return; - clearInterval(attempt_interval); - - // notion elements to manipulate - const frame = document.querySelector('.notion-frame'); - const notionSidebarContainer = document - .querySelector(".notion-cursor-listener > div[style*=\"flex-end\"]"); - - - // INITIALIZE PANEL - - const container = createElement( - '
' - ); - const panel = createElement( - `
` - ); - container.appendChild(panel); - - // panel contents - const header = createElement(` -
-
-
-
- `); - const content = createElement( - '
' - ); - const resize = createElement(` -
-
-
- `); - panel.append(header, content, resize); - - // add switcher if there is more than one panel mods - if (panelMods.length > 1) { - const switcherIcon = createElement( - `
${icons.switcher}
` - ) - header.appendChild(switcherIcon); - header.addEventListener('click', renderSwitcher); - } else { - header.addEventListener('click', togglePanel); - } - - // add panel lock toggle - const toggle = createElement( - `
${icons.doubleChevron}
` - ); - header.appendChild(toggle); - toggle.addEventListener('click', togglePanel); - - // render panel - notionSidebarContainer.after(container); - - // toggle panel keybind - document.addEventListener('keyup', e => { - const hotkey = { - code: 'Backslash', - ctrlKey: true, - shiftKey: false, - metaKey: false, - altKey: true, - }; - for (let prop in hotkey) - if (hotkey[prop] !== e[prop]) return; - togglePanel(); - }); - - // Restore lock state - if (store().locked === 'false') unlockPanel(false); - else lockPanel(); - - enableResize(); - - // attempt to load last opened mod - let loaded = false; - if (store().last_open) { - panelMods.forEach(mod => { - if (mod.id === store().last_open) { - loadPanelMod(mod); - loaded = true; - } - }); - } - if (!loaded) loadPanelMod(panelMods[0]); - - - // loads a panel mod - function loadPanelMod(mod) { - // call previous panel's onSwitch function - if (curPanel.js?.onSwitch) curPanel.js.onSwitch(); - - // set current panel - curPanel = mod.panel; - store().last_open = mod.id; - - setPanelTitle(mod.panel.name); - setPanelIcon(mod.panel.icon); - setPanelContent(mod.panel.html); - panel.dataset.fullHeight = mod.panel.fullHeight || false; - - // reload button - let reloadButton = panel.querySelector('.enhancer-panel--reload-button'); - if (reloadButton) reloadButton.remove(); - if (mod.panel.reload) { - reloadButton = createElement( - `
${icons.reload}
` - ) - reloadButton.addEventListener('click', e => { - e.stopPropagation(); - loadPanelMod(mod); - }) - panel.querySelector('.enhancer-panel--title').after(reloadButton); - } - - // execute panel's onLoad function - if (curPanel.js?.onLoad) curPanel.js.onLoad(); - } - - function setPanelTitle(title) { - panel.querySelector('.enhancer-panel--title').innerHTML = title; - } - - function setPanelIcon(icon) { - panel.querySelector('.enhancer-panel--icon').innerHTML = icon; - } - - function setPanelContent(content) { - document.getElementById('enhancer-panel--content').innerHTML = content; - } - - function setPanelWidth(width) { - // update width - store().width = width; - panel.style.width = width + 'px'; - - if (isLocked()) { - // panel container width - container.style.width = width + 'px'; - // adjust notion elements to make space on the right - frame.style.paddingRight = width + 'px'; - notionSidebarContainer.style.right = width + 'px'; - } else { - // hide panel to the right of window - panel.style.right = width + 'px'; - } - } - - // LOCK/OPEN - - function lockPanel() { - panel.dataset.locked = 'true'; - setPanelWidth(store().width); - - // anchor panel to right of window - panel.style.right = 0; - - // remove handle - const handle = panel.nextElementSibling; - handle?.remove(); - - // reset animation styles - panel.style.opacity = ''; - panel.style.transform = ''; - - // hover event listeners - disableHideListener(); - - // call panel's onLock function - if (curPanel.js?.onLock) curPanel.js.onLock(); - } - - function unlockPanel(animate) { - panel.dataset.locked = 'false'; - setPanelWidth(store().width); - - // hide panel container - container.style.width = 0; - // reset notion elements to full page - frame.style.paddingRight = 0; - notionSidebarContainer.style.right = 0; - - // add handle - const handle = createElement( - '
' - ) - panel.after(handle); - - const addListeners = () => { - // show panel when handle is hovered - handle.addEventListener('mouseover', showPanel); - handle.addEventListener('mousemove', showPanel); - - // hide panel when mouse leaves panel or handle - enableHideListener(); - handle.addEventListener('mouseleave', e => { - // don't hide if mouseover scrollbar or panel - if (e.relatedTarget?.closest(".enhancer-panel--container") || - e.relatedTarget?.classList.contains("notion-scroller")) return; - hidePanel(e); - }); - } - - // unlock animation - if (animate) { - panel.animate( - [ - { opacity: 1, transform: 'none' }, - { opacity: 1, transform: 'translateY(60px)', offset: 0.4}, - { opacity: 0, transform: `translateX(${store().width}px) translateY(60px)`}, - ], - { duration: 600, easing: 'ease-out' } - ).onfinish = () => addListeners(); - } else addListeners(); - - hidePanel(); - - // call panel's onUnlock function - if (curPanel.js?.onUnlock) curPanel.js.onUnlock(); - } - - function togglePanel(e) { - if (e) e.stopPropagation(); - - isLocked() ? unlockPanel(true) : lockPanel(); - - store().locked = panel.dataset.locked; - } - - function isLocked() { - return panel.dataset.locked === 'true'; - } - - // WHEN UNLOCKED - - function showPanel(e) { - if (isLocked()) return; - if (e.shiftKey) { - hidePanel(); - return; - } - - panel.style.opacity = 1; - panel.style.transform = 'translateY(60px)'; - } - - function hidePanel(e) { - if (isLocked()) return; - if (e?.type === 'mousemove' && !e.shiftKey) return; - - panel.style.opacity = 0; - panel.style.transform = `translateX(${store().width}px) translateY(60px)`; - } - - // panel hides when leaving panel body - // mousemove listeners to hide when holding shift - function enableHideListener() { - panel.addEventListener('mousemove', hidePanel); - panel.addEventListener('mouseleave', hidePanel); - } - function disableHideListener() { - panel.addEventListener('mousemove', hidePanel); - panel.removeEventListener('mouseleave', hidePanel); - } - - // SWITCHER - - function renderSwitcher() { - // switcher already rendered - if (document.querySelector('.enhancer-panel--overlay-container')) return; - - // overlay to close switcher - const overlayContainer = createElement( - '
' - ); - overlayContainer.addEventListener('click', hideSwitcher) - document - .querySelector('.notion-app-inner') - .appendChild(overlayContainer); - - // position switcher below header - const rect = panel.querySelector('.enhancer-panel--header').getBoundingClientRect(); - const div = createElement(` -
-
-
- `); - - // initialize switcher - const switcher = createElement( - '
' - ); - panelMods.forEach(mod => - switcher.append(renderSwitcherItem(mod)) - ); - - div.firstElementChild.appendChild(switcher); - overlayContainer.appendChild(div); - - // focus on first element - switcher.firstElementChild.focus(); - - // fade in - switcher.animate( - [ {opacity: 0}, {opacity: 1} ], - { duration: 200 } - ); - - // prevent panel from closing if unlocked - disableHideListener(); - - // keyboard shortcuts - document.addEventListener('keydown', switcherKeyEvent); - } - - function hideSwitcher() { - const overlayContainer = document - .querySelector('.enhancer-panel--overlay-container'); - overlayContainer.removeEventListener('click', hideSwitcher); - document.removeEventListener('keydown', switcherKeyEvent); - - // fade out - document.querySelector('.enhancer-panel--switcher').animate( - [ {opacity: 1}, {opacity: 0} ], - { duration: 200 } - ).onfinish = () => overlayContainer.remove(); - - if (!isLocked()) enableHideListener(); - } - - function renderSwitcherItem(mod) { - if (mod.panel) { - const item = createElement( - `
-
${mod.panel.icon}
-
${mod.panel.name}
-
` - ); - item.addEventListener('click', () => loadPanelMod(mod)); - return item; - } - } - - // handle switcher hotkeys - function switcherKeyEvent(e) { - e.stopPropagation(); - - // esc -> hide switcher - if (e.key === 'Escape') return hideSwitcher(); - - // space/enter -> select panel - const currentFocus = document.activeElement; - if ([' ', 'Enter'].includes(e.key)) return currentFocus.click(); - - // up/down/tab -> change focus - if (e.key === 'ArrowUp') focusPrevious(); - else if (e.key === 'ArrowDown') focusNext(); - else if (e.key === 'Tab') { - e.shiftKey ? focusPrevious() : focusNext(); - e.preventDefault(); - } - - function focusNext() { - const nextEl = currentFocus.nextElementSibling; - (nextEl || currentFocus.parentElement.firstElementChild).focus(); - } - function focusPrevious() { - const prevEl = currentFocus.previousElementSibling; - (prevEl || currentFocus.parentElement.lastElementChild).focus(); - } - } - - function enableResize() { - const resizeHandle = panel.querySelector('.enhancer-panel--resize div'); - resizeHandle.addEventListener('mousedown', initDrag); - - let startX, startWidth; - - const overlay = createElement( - '
' - ); - - // mousedown - function initDrag(e) { - // initialize start position - startX = e.clientX; - startWidth = store().width; - - panel.appendChild(overlay); - - // set transitions - container.style.transition = 'width 50ms ease-in'; - panel.style.transition = 'width 50ms ease-in, right 50ms ease-in'; - frame.style.transition = 'padding-right 50ms ease-in'; - notionSidebarContainer.style.transition = 'padding-right 50ms ease-in'; - - resizeHandle.style.cursor = ''; - - document.body.addEventListener('mousemove', drag); - document.body.addEventListener('mouseup', stopDrag); - } - - // mousemove - function drag(e) { - e.preventDefault(); - - let width = startWidth + (startX - e.clientX); - // minmax - if (width < 190) width = 190; - if (width > 480) width = 480; - - setPanelWidth(width); - - // prevent panel from closing if unlocked - disableHideListener(); - - // call panel's onResize function - if (curPanel.js?.onResize) curPanel.js.onResize(); - } - - // mouseup - function stopDrag() { - resizeHandle.style.cursor = 'col-resize'; - panel.removeChild(overlay); - - // reset transitions - container.style.transition = - panel.style.transition = - frame.style.transition = - notionSidebarContainer.style.transition = ''; - - - if (!isLocked()) enableHideListener(); - - document.body.removeEventListener('mousemove', drag); - document.body.removeEventListener('mouseup', stopDrag); - } - } - } - }); - - - // INITIALIZATION FUNCTIONS - - // set values for panel - async function initMod(mod) { - // load panel sites - if (mod.id === '0d541743-eb2c-4d77-83a8-3b2f5e8e5dff') { - panelMods = panelMods.filter(panelMod => panelMod !== mod); - return panelMods.push(...initPanelSites(mod)); - } - - try { - if (typeof mod.panel === 'object') { - - // html -> relative path to html file - mod.panel.html = await fs.readFile( - path.resolve(__dirname, `../${mod.dir}/${mod.panel.html}`) - ); - - // name - mod.panel.name = mod.panel.name || mod.name; - - // icon - if (mod.panel.icon) { - const iconPath = path.resolve(__dirname, `../${mod.dir}/${mod.panel.icon}`); - if (await fs.pathExists(iconPath)) - mod.panel.icon = await fs.readFile(iconPath); - } else { - mod.panel.icon = mod.panel.name[0]; - } - - // js -> relative path to js file - if (mod.panel.js) { - const jsPath = `../${mod.dir}/${mod.panel.js}`; - if (await fs.pathExists(path.resolve(__dirname, jsPath))) { - // execute js file - mod.panel.js = require(jsPath)(loadStore(mod), __exports); - } - } - } else if (typeof mod.panel === 'string') { - - // icon - mod.panel.icon = mod.name[0]; - - // mod.panel -> rel path to html file - mod.panel.html = await fs.readFile( - path.resolve(__dirname, `../${mod.dir}/${mod.panel}`) - ); - } else throw Error; - } catch (err) { - // remove mod from panel list - console.log('invalid panel mod: ' + mod.name); - panelMods = panelMods.filter(panelMod => panelMod !== mod); - } - } - - // returns an array of panels - function initPanelSites(mod) { - let panelSites = []; - const sitesPath = store(mod.id).sites; - if (sitesPath) { - try { - const sites = require(sitesPath); - const invalid = false; - // execute panel-sites/panel.js - const sitePanelJs = require('../panel-sites/panel.js')(loadStore(mod), __exports); - - // returns site's iframe - const frameUrl = (url, mobile) => { - if (!/(^https?:\/\/)/i.test(url)) url = 'https://' + url; - return ``; - } - - sites.forEach(site => { - if (site.url && site.name) { - - // get iframe and icon - const iframe = frameUrl(site.url, site.mobile); - const icon = ``; - - // add panel object to array - const panelMod = { - id: `${mod.id}-${site.url}`, - panel: { - name: site.name, - html: iframe, - icon: icon, - js: sitePanelJs, - fullHeight: true, - reload: true, - }, - } - panelSites.push(panelMod); - } else invalid = true; // continue initializing next sites - }); - if (invalid) throw Error; - } - catch (err) { - console.log('panel site error'); - } - } - return panelSites; - } - - function loadStore(mod) { - return (...args) => { - if (!args.length) return store(mod.id, mod.defaults); - if (args.length === 1 && typeof args[0] === 'object') - return store(mod.id, { ...mod.defaults, ...args[0] }); - const other_mod = modules.find((m) => m.id === args[0]); - return store(args[0], { - ...(other_mod ? other_mod.defaults : {}), - ...(args[1] || {}) - }) - } - } - }, - }, -}; diff --git a/mods/simpler-databases/app.css b/mods/simpler-databases/app.css deleted file mode 100644 index cbc016e..0000000 --- a/mods/simpler-databases/app.css +++ /dev/null @@ -1,373 +0,0 @@ -/* - * simpler databases - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - - .simpler-databases--config-button:hover { - background: var(--theme--interactive_hover); -} - -.simpler-databases--config-button svg { - width: 12px; - height: 12px; - fill: var(--theme--text_ui_info); -} - -.simpler-databases--overlay-container { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 999; - overflow: hidden; -} - -.simpler-databases--config-menu { - position: relative; - width: 220px; - max-height: 70vh; - padding: 8px 0; - border-radius: 3px; - box-shadow: var(--theme--box-shadow_strong); - background: var(--theme--card); - overflow: hidden auto; -} - -.simpler-databases--config-item-toggle, -.simpler-databases--config-item-input { - display: flex; - align-items: center; - width: 100%; - min-height: 28px; - font-size: var(--theme--font_label-size); - line-height: 1.2; - user-select: none; -} -.simpler-databases--config-item-toggle { - cursor: pointer; -} -.simpler-databases--config-item-toggle:hover, -.simpler-databases--config-item-toggle:focus { - background: var(--theme--interactive_hover); -} - -.simpler-databases--config-title { - margin: 0 14px; - min-width: 0; - flex: 1 1 auto; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.simpler-databases--config-toggle { - flex-shrink: 0; - position: relative; - height: 14px; - width: 26px; - margin-left: auto; - margin-right: 14px; - padding: 2px; - border-radius: 44px; - cursor: pointer; - user-select: none; - box-sizing: content-box; - background: rgba(202, 204, 206, 0.3); - transition: background 200ms ease 0s, box-shadow 200ms ease 0s; -} - -.simpler-databases--config-toggle[data-toggled="true"] { - background: var(--theme--primary); -} - -.simpler-databases--config-toggle::before { - content: ''; - position: absolute; - width: 14px; - height: 14px; - border-radius: 44px; - background: white; - transition: transform 200ms ease-out 0s, background 200ms ease-out 0s; -} -.simpler-databases--config-toggle[data-toggled="true"]::before { - transform: translateX(12px); -} - -.simpler-databases--config-item-input { - padding: 6px 0; -} - -.simpler-databases--config-input { - display: flex; - align-items: center; - height: 28px; - margin: 0 14px; - padding: 3px 6px; - background: var(--theme--select_input); - box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px inset; - border-radius: 3px; - font-size: 14px; - line-height: 20px; - cursor: text; -} - -.notion-dark-theme .simpler-databases--config-input { - background: rgba(15, 15, 15, 0.3); - box-shadow: rgba(15, 15, 15, 0.2) 0px 0px 0px 1px inset; -} - -.simpler-databases--config-input input { - font-size: inherit; - line-height: inherit; - border: none; - background: none; - width: 100%; - display: block; - resize: none; - padding: 0; -} - -.simpler-databases--config-divider { - border-bottom: 1px solid var(--theme--ui-border); - width: 100%; - margin: 6px 0; -} - -.notion-collection_view-block[data-tweaks*="[config-open]"] [style*=" height: 42px;"] > :not(:first-child) { - opacity: 1 !important; -} - - -/* TWEAKS */ - -/* Toggle */ -.simpler-databases--toggle { - flex-shrink: 0; - width: 24px; - height: 24px; - display: flex; - align-items: center; - justify-content: center; - border-radius: 3px; - cursor: pointer; - transition: background 20ms ease-in 0s; -} -.simpler-databases--toggle svg { - width: 12px; - height: 12px; - transform: rotateZ(180deg); - transition: transform 200ms ease-out 0s; -} -.simpler-databases--toggle:hover { - background: var(--theme--interactive_hover); -} - -.notion-collection_view-block[data-tweaks*="[toggle]"][data-toggled-hidden="true"] - .simpler-databases--toggle svg { - transform: rotateZ(90deg); -} - -.notion-collection_view-block[data-tweaks*="[toggle]"] > div > .notion-scroller { - transition: height 200ms ease-in, opacity 200ms ease-in; -} -.notion-collection_view-block[data-tweaks*="[toggle]"][data-toggled-hidden="true"] > div > .notion-scroller { - opacity: 0; - height: 0 !important; -} - -.notion-collection_view-block[data-tweaks*="[toggle]"][data-toggled-hidden="true"] - [data-hide-items] [class$="view"] > .notion-collection_view-block, -.notion-collection_view-block[data-tweaks*="[toggle]"][data-toggled-hidden="true"] - [data-hide-items] .notion-collection-item { - display: none !important; -} - -/* Title */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]) - [style*=" height: 42px;"] > [style*="white-space: nowrap; overflow: hidden;"] .notion-record-icon, -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]) - [style*=" height: 42px;"] > [style*="white-space: nowrap; overflow: hidden;"] [placeholder] { - display: none !important; -} - -/* Link Arrow - linked databases */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[link]"]) - [style*=" height: 42px;"] a :first-child[style*="margin-right: 6px"] { - display: none !important; -} - -/* Views */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[views]"]) - [style*=" height: 42px;"] > [role="button"] { - display: none !important; -} - -/* Toolbar */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[toolbar]"]) - .simpler-databases--config-button ~ * { - display: none !important; -} - -/* Header - table, calendar */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[header_row]"]) - .notion-table-view > .notion-collection_view-block > :first-child, -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[header_row]"]) - .notion-table-view > .notion-collection_view-block > :first-child + div { - display: none !important; -} - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[header_row]"]) - .notion-table-view .notion-collection_view-block > [style*="height: 34px"] + div { - border-top: 1px solid var(--theme--table-border_row); -} - -/* New Item - table, board, timeline, list, gallery */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_item]"]) - .notion-table-view-add-row, -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_item]"]) - .notion-board-view .notion-board-group > [role="button"]:not(.notion-collection-item), -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_item]"]) - .notion-timeline-item-row:last-child, -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_item]"]) - .notion-list-view > .notion-collection_view-block > [role="button"]:not(.notion-collection-item), -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_item]"]) - .notion-gallery-view > .notion-collection_view-block [style*="grid"] > [role="button"] { - display: none !important; -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_item]"]) - .notion-timeline-view > [style*="padding-bottom: 34px;"] { - padding-bottom: 0 !important; -} - -/* Calc Row - table, timeline */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[calc_row]"]) - .notion-table-view-add-row ~ div:not(.notion-selectable-halo):not([role="button"]), -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[calc_row]"]) - .notion-timeline-view > [style*="z-index: 4;"]:last-child { - display: none !important; -} - -/* Hidden Columns - board */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[hidden_column]"]) - .notion-board-view > .notion-collection_view-block [style*="width: 220px;"] { - display: none !important; -} - -/* Add Group - board */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[add_group]"]) - .notion-board-view > .notion-collection_view-block [style*="width: 180px;"] { - display: none !important; -} - -/* New Column - table */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_column]"]) - .notion-table-view-add-column, -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_column]"]) - .notion-table-view .notion-collection-item > [style*="width: 32px;"] { - display: none !important; -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[new_column]"]) - .notion-table-view-add-row + [style*="padding-right: 32px;"] { - padding-right: 0 !important; -} - -/* Full Width - table */ - -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[full_width]"]) - .notion-table-view > .notion-collection_view-block { - max-width: fit-content; -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[full_width]"]) - .notion-table-view .notion-collection_view-block > [style*="min-width"] { - min-width: 0 !important; -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[full_width]"]) - .notion-table-view .notion-collection-item { - width: fit-content; -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[full_width]"]) - .notion-table-view .notion-collection_view-block > [style*="height: 34px"] + div, -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[full_width]"]) - .notion-table-view .notion-collection_view-block > :first-child { - border-left: 1px solid var(--theme--table-border_row); -} - -/* COMPOUND TWEAKS */ - -/* Title and Link disabled > Hide title container */ -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]) - [style*=" height: 42px;"] > [style*="white-space: nowrap; overflow: hidden;"] { - display: none !important; -} - -/* New Row and Calc Row disabled > Add bottom border - table */ -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[calc_row]"]):not([data-tweaks*="[new_item]"]) - .notion-table-view .notion-collection_view-block > [style*="height: 34px"] + div { - border-bottom: 1px solid var(--theme--table-border_row); -} - -/* New Column enabled with Full Width disabled > Add right border - table */ -.notion-collection_view-block[data-tweaks][data-tweaks*="[new_column]"]:not([data-tweaks*="[full_width]"]) - .notion-table-view .notion-collection_view-block > [style*="height: 34px"] + div, -.notion-collection_view-block[data-tweaks][data-tweaks*="[new_column]"]:not([data-tweaks*="[full_width]"]) - .notion-table-view .notion-collection_view-block > :first-child { - border-right: 1px solid var(--theme--table-border_row); -} - -/* REMOVE DATABASE HEADER < Title, Link, Toggle, Views, and Toolbar disabled */ - -/* Hide Header */ -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]):not([data-tweaks*="[toggle]"]):not([data-tweaks*="[views"]):not([data-tweaks*="[toolbar]"]) - [style*="min-height: 42px"] { - min-height: 0 !important; - max-height: 0; - pointer-events: none; -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]):not([data-tweaks*="[toggle]"]):not([data-tweaks*="[views"]):not([data-tweaks*="[toolbar]"]) - [style*="height: 42px"] { - overflow: visible !important; -} - -/* Config Button */ -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]):not([data-tweaks*="[toggle]"]):not([data-tweaks*="[views"]):not([data-tweaks*="[toolbar]"]) - [style*=" height: 42px;"] > :last-child { - position: absolute; - top: 4px; - right: 0; - z-index: 99; - pointer-events: auto; -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]):not([data-tweaks*="[toggle]"]):not([data-tweaks*="[views"]):not([data-tweaks*="[toolbar]"]) - .simpler-databases--config-button { - background: var(--theme--main); - box-shadow: var(--theme--box-shadow); -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]):not([data-tweaks*="[toggle]"]):not([data-tweaks*="[views"]):not([data-tweaks*="[toolbar]"]) - .simpler-databases--config-button:hover { - background: var(--theme--interactive_hover); -} - -/* Hide Top Border */ -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]):not([data-tweaks*="[toggle]"]):not([data-tweaks*="[views"]):not([data-tweaks*="[toolbar]"]) - :not(.notion-table-view) > .notion-collection_view-block > [style*="box-shadow"] { - box-shadow: none !important; -} -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]):not([data-tweaks*="[toggle]"]):not([data-tweaks*="[views"]):not([data-tweaks*="[toolbar]"]) - :not(.notion-table-view) > .notion-collection_view-block[style*="border-top"], -.notion-collection_view-block[data-tweaks]:not([data-tweaks*="[title]"]):not([data-tweaks*="[link]"]):not([data-tweaks*="[toggle]"]):not([data-tweaks*="[views"]):not([data-tweaks*="[toolbar]"]) - :not(.notion-table-view) > .notion-collection_view-block > [style*="border-top"] { - border-top: none !important; -} diff --git a/mods/simpler-databases/mod.js b/mods/simpler-databases/mod.js deleted file mode 100644 index df8aef0..0000000 --- a/mods/simpler-databases/mod.js +++ /dev/null @@ -1,540 +0,0 @@ -/* - * simpler databases - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: '752933b5-1258-44e3-b49a-61b4885f8bda', - tags: ['extension'], - name: 'simpler databases', - desc: 'adds a menu to inline databases to toggle ui elements.', - version: '1.0.2', - author: 'CloudHill', - hacks: { - 'renderer/preload.js'(store, __exports) { - if (!store().blocks) store().blocks = {}; - - const menuItems = [ - { - key: 'replace_title', - name: 'Replace title...', - type: 'input', - linkedOnly: true, - default: '', - action: replaceTitle, - }, - { - key: 'title', - name: 'Title', - type: 'toggle', - default: true, - }, - { - key: 'toggle', - name: 'Toggle', - type: 'toggle', - default: false, - action: toggle, - }, - { - key: 'link', - name: 'Link arrow', - type: 'toggle', - default: true, - linkedOnly: true, - }, - { - key: 'views', - name: 'Views', - type: 'toggle', - default: true, - }, - { - key: 'toolbar', - name: 'Toolbar', - type: 'toggle', - default: true, - }, - { - key: 'divider', - views: ['table', 'board', 'timeline', 'list', 'gallery'], - }, - { - key: 'header_row', - name: 'Header row', - type: 'toggle', - default: true, - views: ['table'], - }, - { - key: 'new_item', - name: 'New row', - type: 'toggle', - default: true, - views: ['table', 'timeline'], - }, - { - key: 'new_item', - name: 'New item', - type: 'toggle', - default: true, - views: ['board', 'list', 'gallery'], - }, - { - key: 'calc_row', - name: 'Calculation row', - type: 'toggle', - default: true, - views: ['table', 'timeline'], - }, - { - key: 'divider', - views: ['table', 'board'], - }, - { - key: 'hidden_column', - name: 'Hidden columns', - type: 'toggle', - default: true, - views: ['board'], - }, - { - key: 'add_group', - name: 'Add group', - type: 'toggle', - default: true, - views: ['board'], - }, - { - key: 'new_column', - name: 'New column', - type: 'toggle', - default: true, - views: ['table'], - }, - { - key: 'full_width', - name: 'Full width', - type: 'toggle', - default: true, - views: ['table'], - }, - ] - - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - - // observe for new or moved collection blocks - const contentObserver = new MutationObserver((list, observer) => { - for (let { addedNodes } of list) { - if ( - addedNodes[0] && - addedNodes[0].querySelector && - addedNodes[0].querySelector('.notion-collection_view-block') - ) - findInlineCollections(); - } - }); - - // observe for page changes - let queue = []; - const pageObserver = new MutationObserver((list, observer) => { - if (!queue.length) requestAnimationFrame(() => process(queue)); - queue.push(...list); - }); - pageObserver.observe(document.body, { - childList: true, - subtree: true, - }); - function process(list) { - queue = []; - for (let { addedNodes } of list) { - if ( - addedNodes[0] && - addedNodes[0].className === 'notion-presence-container' - ) { - findInlineCollections(); - contentObserver.disconnect(); - contentObserver.observe(addedNodes[0], - { - childList: true, - subtree: true, - } - ); - } - } - } - }); - - function findInlineCollections() { - const collections = document.querySelectorAll('.notion-collection_view-block[style*="width"][style*="max-width"]'); - collections.forEach(collection => { - if (collection.querySelector('.simpler-databases--config-button')) return; - - const blockId = collection.dataset.blockId; - - // config button - const add = collection.querySelector('.notion-collection-view-item-add'); - if (!add) return; - - const configButton = add.previousElementSibling.cloneNode(); - configButton.className = 'simpler-databases--config-button'; - configButton.innerHTML = ``; - configButton.collectionBlock = collection; - configButton.addEventListener('click', renderConfig); - - add.parentElement.prepend(configButton); - - // initialize store variable - if (!store().blocks[blockId]) store().blocks[blockId] = {}; - - // restore stored states - menuItems.forEach( - item => { - if (item.key === 'divider') return; - - let storedValue = store().blocks[blockId][item.key]; - if (storedValue == null) // set defaults - storedValue = store().blocks[blockId][item.key] = item.default; - - if (item.action) item.action(storedValue, collection); - if ( - item.type !== 'input' && - !item.linkedOnly || isLinked(collection) - ) { - toggleDataTweaks(collection, item.key, storedValue); - } - } - ); - }); - } - - // config - - function renderConfig(e) { - if (document.querySelector('.simpler-databases--overlay-container')) return; - const button = e.currentTarget; - - const collection = button.collectionBlock; - if (!collection) return; - - const collectionView = getView(collection); - if (!collectionView) return; - - // layer to close config - const overlayContainer = createElement( - '
' - ); - overlayContainer.addEventListener('click', hideConfig) - document - .querySelector('.notion-app-inner') - .appendChild(overlayContainer); - - const div = createElement(` -
-
-
- `); - - // render config - - toggleDataTweaks(collection, 'config-open', true); - - const config = createElement( - '
' - ); - - // get menu items relevant to current view - const viewMenu = menuItems.filter( - item => (!item.views || item.views.includes(collectionView)) && - (!item.linkedOnly || isLinked(collection)) - ); - config.append(...viewMenu.map( - item => renderConfigItem(item, collection) - )); - - overlayContainer.appendChild(div); - div.firstElementChild.appendChild(config); - - focusConfigItem(config.firstElementChild); - - // config positioning - const rect = button.getBoundingClientRect(); - - div.style.left = Math.min( - rect.left + rect.width / 2, - window.innerWidth - (config.offsetWidth + 14) - ) + 'px'; - - div.style.top = Math.min( - rect.top + rect.height / 2, - window.innerHeight - (config.offsetHeight + 14) - ) + 'px'; - - // fade in - config.animate( - [ {opacity: 0}, {opacity: 1} ], - { duration: 200 } - ); - - // key bindings - document.addEventListener('keydown', configKeyEvent); - } - - function hideConfig() { - const overlayContainer = document.querySelector('.simpler-databases--overlay-container'); - if (!overlayContainer) return; - - overlayContainer.removeEventListener('click', hideConfig); - document.removeEventListener('keydown', configKeyEvent); - - toggleDataTweaks( - document.querySelector('[data-tweaks*="config-open"]'), - 'config-open', false - ); - - // fade out - document.querySelector('.simpler-databases--config-menu').animate( - [ {opacity: 1}, {opacity: 0} ], - { duration: 200 } - ).onfinish = () => overlayContainer.remove(); - } - - function renderConfigItem(menuItem, collection) { - if (menuItem.key === 'divider') - return createElement('
-
- `); - - const storedValue = store().blocks[blockId][menuItem.key]; - switch (menuItem.type) { - case 'toggle': - const toggleLabel = createElement(` -
${menuItem.name}
- `) - const toggle = createElement(` -
-
- `); - item.append(toggleLabel, toggle) - item.setAttribute('tabindex', 0); - - item.addEventListener('click', e => { - e.stopPropagation(); - - const newState = !(toggle.dataset.toggled === 'true'); - toggle.dataset.toggled = newState; - - - store().blocks[blockId][menuItem.key] = newState; - toggleDataTweaks(collection, menuItem.key, newState); - if (menuItem.action) menuItem.action(newState, collection); - }); - break; - - case 'input': - const input = createElement(` -
- -
- `); - item.appendChild(input) - item.addEventListener('click', e => e.stopPropagation()); - if (menuItem.action) { - input.firstElementChild.addEventListener('input', e => { - e.stopPropagation(); - const newValue = e.target.value; - - store().blocks[blockId][menuItem.key] = newValue; - menuItem.action(newValue, collection); - }); - } - break; - } - return item; - } - - function focusConfigItem(item) { - ( - item.getElementsByTagName('input')[0] || item - ).focus(); - } - - function configKeyEvent(e) { - e.stopPropagation(); - - if (e.key === 'Escape') return hideConfig(); - - let currentFocus = document.activeElement - .closest('[class^="simpler-databases--config-item"]'); - - const parentEl = currentFocus.parentElement; - if ( - [' ', 'Enter'].includes(e.key) - ) return currentFocus.click(); - - const focusNext = () => { - let nextEl = currentFocus.nextElementSibling; - if (nextEl) { - if (nextEl.className.includes('divider')) - nextEl = nextEl.nextElementSibling; - focusConfigItem(nextEl); - } - else focusConfigItem(parentEl.firstElementChild); - } - const focusPrevious = () => { - let prevEl = currentFocus.previousElementSibling; - if (prevEl) { - if (prevEl.className.includes('divider')) - prevEl = prevEl.previousElementSibling; - - if (prevEl.className.includes('input')) - prevEl.getElementsByTagName('input')[0].focus(); - focusConfigItem(prevEl); - } - else focusConfigItem(parentEl.lastElementChild); - } - - if (e.key === 'ArrowUp') focusPrevious(); - else if (e.key === 'ArrowDown') focusNext(); - else if (e.key === 'Tab') { - if (e.shiftKey) { - if (currentFocus === parentEl.firstElementChild) { - focusConfigItem(parentEl.lastElementChild); - e.preventDefault(); - } - } - else if (currentFocus === parentEl.lastElementChild) { - focusConfigItem(parentEl.firstElementChild); - e.preventDefault(); - } - } - } - - // get collection info - - function isLinked(collection) { - return collection.querySelector('[style*=" height: 42px;"] .alias'); - } - - function getView(collection) { - return collection.querySelector('.notion-scroller [class$="view"]') - ?.className.split('-')[1] - } - - // add/remove keys to data-tweaks - function toggleDataTweaks(collection, key, state) { - if (!collection.dataset.tweaks) collection.dataset.tweaks = ''; - - const isActive = collection.dataset.tweaks.includes(`[${key}]`); - if (state == null) state = !isActive; - - if (state && !isActive) { - collection.dataset.tweaks += `[${key}]`; - } else if (!state && isActive) { - collection.dataset.tweaks = collection.dataset.tweaks - .replace(`[${key}]`, ''); - } - } - - // menu actions - - // replace and add observer to linked database titles - function replaceTitle(value, collection) { - const titleDiv = collection.querySelector('[style*="height: 42px;"] a [placeholder]'); - if (!titleDiv) return; - if (!titleDiv.originalTitle && value) titleDiv.originalTitle = titleDiv.innerText; - - if (!titleDiv.titleObserver) { - if (!value) return; - // store reference to observer to disconnect() in future calls - titleDiv.titleObserver = new MutationObserver(() => { - const title = store().blocks[collection.dataset.blockId]['replace_title']; - if (title && titleDiv.innerText !== title) titleDiv.innerText = title; - }); - } else { - titleDiv.titleObserver.disconnect(); - } - - if (value) { // observe - titleDiv.innerText = value - titleDiv.titleObserver.observe(titleDiv, {characterData: true, childList: true}) - } else { // reset - titleDiv.titleObserver.disconnect(); - titleDiv.innerText = titleDiv.originalTitle; - delete titleDiv.originalTitle; - } - } - - // show or hide toggle - function toggle(state, collection) { - const header = collection.querySelector('[style*=" height: 42px"]'); - if (!header) return; - - // define functions - const collectionView = collection.querySelector('.notion-scroller'); - const hideCollection = () => { - collectionView.style.height = collectionView.offsetHeight + 'px'; - requestAnimationFrame(() => { - collection.dataset.toggledHidden = true; - setTimeout(() => collectionView.dataset.hideItems = 'true', 200); // hide drag handles - }); - } - const showCollection = () => { - // get height - collection.dataset.toggledHidden = false; - collectionView.style.height = ''; - collectionView.style.height = collectionView.offsetHeight + 'px'; - collection.dataset.toggledHidden = true; - - delete collectionView.dataset.hideItems; - requestAnimationFrame(() =>{ - collection.dataset.toggledHidden = false; - setTimeout(() => collectionView.style.height = '', 200); - }); - } - - // restore previous state - if (!collection.dataset.toggledHidden) { - const storedState = store().blocks[collection.dataset.blockId].toggledHidden || false; - if (storedState) hideCollection(); - } - - let toggle = header.querySelector('.simpler-databases--toggle'); - if (toggle) { - // return if toggle is already there - if (!state) toggle.remove(); - return; - } else if (state) { - // add toggle - toggle = createElement(` -
- - - -
- `); - toggle.addEventListener('click', () => { - const hide = !(collection.dataset.toggledHidden === 'true'); - store().blocks[collection.dataset.blockId].toggledHidden = hide; - if (hide) hideCollection(); - else showCollection(); - }); - header.prepend(toggle); - } - } - }, - }, -}; diff --git a/mods/tabs/mod.js b/mods/tabs/mod.js deleted file mode 100644 index 7e9d7dc..0000000 --- a/mods/tabs/mod.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * tabs - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -// this is just a pseudo mod to "separate" the options -// from the core module - the core still handles actually -// making it work. -module.exports = { - id: 'e1692c29-475e-437b-b7ff-3eee872e1a42', - tags: ['core', 'extension'], - name: 'tabs', - desc: 'have multiple notion pages open in a single window.', - version: '0.1.0', - author: 'dragonwocky', - options: [ - { - key: 'select_modifier', - label: - 'tab select modifier (key+1, +2, +3, ... +9 and key+left/right arrows):', - type: 'select', - value: [ - 'Alt', - 'Command', - 'Control', - 'Super', - 'Alt+Shift', - 'Command+Shift', - 'Control+Shift', - 'Super+Shift', - ], - }, - { - key: 'new_tab', - label: 'new tab keybinding:', - type: 'input', - value: 'CommandOrControl+T', - }, - { - key: 'close_tab', - label: 'close tab keybinding:', - type: 'input', - value: 'CommandOrControl+W', - }, - ], -}; diff --git a/mods/topbar-icons/app.css b/mods/topbar-icons/app.css deleted file mode 100644 index 23d74b6..0000000 --- a/mods/topbar-icons/app.css +++ /dev/null @@ -1,28 +0,0 @@ -/* - * topbar icons - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -.notion-topbar-icon { - width: 32px; - padding: 0 7px !important; -} - -.notion-topbar-icon:not(.notion-topbar-share-menu) > *:not(div) { - display: none !important; -} - -.notion-topbar-icon > div, -.notion-topbar-icon svg { - width: 18px; - height: 18px; -} - -.notion-topbar-icon[style*="padding-left: 8px"] > div > :last-child { - display: none; -} -.notion-topbar-icon[style*="padding-left: 6px"] > div > :first-child { - display: none; -} diff --git a/mods/topbar-icons/icons/favorite_off.svg b/mods/topbar-icons/icons/favorite_off.svg deleted file mode 100644 index 9fdc62d..0000000 --- a/mods/topbar-icons/icons/favorite_off.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/topbar-icons/icons/favorite_on.svg b/mods/topbar-icons/icons/favorite_on.svg deleted file mode 100644 index 49f2999..0000000 --- a/mods/topbar-icons/icons/favorite_on.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/topbar-icons/icons/share.svg b/mods/topbar-icons/icons/share.svg deleted file mode 100644 index f0fba07..0000000 --- a/mods/topbar-icons/icons/share.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/topbar-icons/icons/updates_off.svg b/mods/topbar-icons/icons/updates_off.svg deleted file mode 100644 index 87b5cd0..0000000 --- a/mods/topbar-icons/icons/updates_off.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/topbar-icons/icons/updates_on.svg b/mods/topbar-icons/icons/updates_on.svg deleted file mode 100644 index 8bbbc55..0000000 --- a/mods/topbar-icons/icons/updates_on.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mods/topbar-icons/mod.js b/mods/topbar-icons/mod.js deleted file mode 100644 index 410348a..0000000 --- a/mods/topbar-icons/mod.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * topbar icons - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 CloudHill - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'), - path = require('path'), - fs = require('fs-extra'); - -module.exports = { - id: 'e0700ce3-a9ae-45f5-92e5-610ded0e348d', - tags: ['extension'], - name: 'topbar icons', - desc: - 'replaces the topbar buttons with icons.', - options: [ - { - key: 'share', - label: 'share', - type: 'toggle', - value: true, - }, - { - key: 'updates', - label: 'updates', - type: 'toggle', - value: true, - }, - { - key: 'favorite', - label: 'favorite', - type: 'toggle', - value: true, - }, - ], - version: '1.1.0', - author: 'CloudHill', - hacks: { - 'renderer/preload.js'(store, __exports) { - const icons = { - selected: [ - ...(store().updates ? ['updates'] : []), - ...(store().favorite ? ['favorite'] : []), - ], - share: fs.readFile(path.resolve(`${__dirname}/icons/share.svg`)), - updates: { - on: fs.readFile(path.resolve(`${__dirname}/icons/updates_on.svg`)), - off: fs.readFile(path.resolve(`${__dirname}/icons/updates_off.svg`)), - }, - favorite: { - on: fs.readFile(path.resolve(`${__dirname}/icons/favorite_on.svg`)), - off: fs.readFile(path.resolve(`${__dirname}/icons/favorite_off.svg`)), - }, - }; - - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - const attempt_interval = setInterval(enhance, 500); - function enhance() { - if (!document.querySelector('.notion-topbar-actions')) return; - clearInterval(attempt_interval); - - setIcons(document.querySelector('.notion-topbar-actions')); - - let queue = []; - const observer = new MutationObserver((list, observer) => { - if (!queue.length) requestAnimationFrame(() => handle(queue)); - queue.push(...list); - }); - observer.observe(document.body, { - childList: true, - subtree: true, - }); - - function handle(list) { - queue = []; - for (let { addedNodes } of list) { - if ( - addedNodes[0] && - addedNodes[0].className === 'notion-page-content' && - document.querySelector('.notion-peek-renderer') - ) { - const $topbarButtons = document.querySelector( - '.notion-peek-renderer .notion-topbar-share-menu' - ).parentElement; - - if ($topbarButtons.className == 'notion-topbar-actions') return; - $topbarButtons.className = 'notion-topbar-actions'; - setIcons($topbarButtons); - } - } - } - - async function setIcons(buttons) { - const $shareButton = buttons.querySelector('.notion-topbar-share-menu'); - - if (store().share) { - $shareButton.classList.add('notion-topbar-icon'); - $shareButton.innerHTML = await icons.share; - } - - const elements = { - updates: $shareButton.nextElementSibling, - favorite: $shareButton.nextElementSibling.nextElementSibling, - }; - for (let btn of icons.selected) { - elements[btn].classList.add('notion-topbar-icon') - elements[btn].prepend( - createElement(` -
- ${(await icons[btn].off)} - ${(await icons[btn].on)} -
- `) - ); - } - } - } - }); - }, - }, -}; diff --git a/mods/truncated-titles/app.css b/mods/truncated-titles/app.css deleted file mode 100644 index 1ae02dc..0000000 --- a/mods/truncated-titles/app.css +++ /dev/null @@ -1,42 +0,0 @@ -/* - * truncated table titles - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -/* target tooltip */ -.admiraldus-truncated-table-titles-tooltip { - position: fixed; -} - -.admiraldus-truncated-table-titles-tooltip > div { - display: flex; - align-items: center; - border-radius: 3px; - background: var(--theme--card); - padding: 4px 8px; - box-shadow: var(--theme--box-shadow); -} - -/* target tooltip icon */ -.admiraldus-truncated-table-titles-tooltip-svg { - display: flex; - align-items: center; -} - -.admiraldus-truncated-table-titles-tooltip-svg > svg { - margin-right: 0.25em; - height: 1em; - width: 1em; - fill: var(--theme--text_ui_info); -} - -/* target tooltip text */ -.admiraldus-truncated-table-titles-tooltip-text { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - font-size: 12px; - font-weight: 500; - color: var(--theme--text_ui); -} \ No newline at end of file diff --git a/mods/truncated-titles/icons/eye.svg b/mods/truncated-titles/icons/eye.svg deleted file mode 100644 index b7b039a..0000000 --- a/mods/truncated-titles/icons/eye.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mods/truncated-titles/mod.js b/mods/truncated-titles/mod.js deleted file mode 100644 index cd0d568..0000000 --- a/mods/truncated-titles/mod.js +++ /dev/null @@ -1,207 +0,0 @@ -/* - * truncated table titles - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -'use strict'; - -const PATH = require('path'); -const FS = require('fs-extra'); - -module.exports = { - id: '1794c0bd-7b96-46ad-aa0b-fc4bd76fc7fb', - name: 'truncated table titles', - tags: ['extension'], - desc: 'see the full text of the truncated table titles on hover over.', - version: '0.1.0', - author: { - name: 'admiraldus', - link: 'https://github.com/admiraldus', - avatar: 'https://raw.githubusercontent.com/admiraldus/admiraldus/main/module.gif', - }, - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', () => { - if (document.readyState !== 'complete') return false; - - /** - * Wait until frame exists to avoid "cannot read property" error. - */ - function wait() { - const frame = document.querySelector('.notion-frame'); - - if (frame !== null) { - (async () => { - const notionOverlayContainer = document.querySelector('.notion-overlay-container'); - const createSvgContainer = document.createElement('div'); - const svgContainerHtml = await FS.readFile(PATH.resolve(`${__dirname}/icons/eye.svg`)); - - createSvgContainer.innerHTML = svgContainerHtml; - createSvgContainer.setAttribute('style', 'display: none;'); - createSvgContainer.classList.add('admiraldus-truncated-table-titles-rendered-svg'); - notionOverlayContainer.append(createSvgContainer); - })(); - } else { - setTimeout(wait, 500); - } - } - - wait(); - - /** - * Set the offset values of the created tooltip. - * - * @param {HTMLDivElement} cell Target the table header cell. - * @param {HTMLDivElement} tooltip Target the created tooltip. - * - * @return {string} Return the offset values. - */ - function setTooltipOffset(cell, tooltip) { - const body = document.querySelector('body'); - const sidebar = document.querySelector('.notion-sidebar:not([style*="transform"])'); - Object.defineProperty(Object.prototype, 'offset', { - get: function() { - return { - left: this.getBoundingClientRect().left + window.scrollX, - top: this.getBoundingClientRect().top + window.scrollY, - }; - }, - configurable: true, - }); - - if (body.offsetWidth < tooltip.offsetWidth + cell.offset.left) { - if (body.offsetWidth > cell.offsetWidth + cell.offset.left) { - const horizontalOffset = `right: ${body.offsetWidth - cell.offsetWidth - cell.offset.left}px;`; - - return `top: ${cell.offset.top + 40}px; ${horizontalOffset}`; - } else { - const horizontalOffset = 'right: 8px;'; - - return `top: ${cell.offset.top + 40}px; ${horizontalOffset}`; - } - } else if (sidebar == null && cell.offset.left <= 0) { - const horizontalOffset = 'left: 8px;'; - - return `top: ${cell.offset.top + 40}px; ${horizontalOffset}`; - } else if (sidebar !== null && sidebar.offsetWidth >= cell.offset.left) { - const horizontalOffset = `left: ${sidebar.offsetWidth + 8}px;`; - - console.warn('4'); - return `top: ${cell.offset.top + 40}px; ${horizontalOffset}`; - } else { - const horizontalOffset = `left: ${cell.offset.left}px;`; - - return `top: ${cell.offset.top + 40}px;${horizontalOffset}`; - } - } - - /** - * Create and append tooltip HTML. - * - * @param {HTMLDivElement} cell Target the table header cell. - * @param {string} text Get the title of the table header cell. - * @param {string} icon Get the HTML of the rendered svg. - */ - function createTooltip(cell, text, icon) { - const frame = document.querySelector('.notion-frame'); - const notionOverlayContainer = document.querySelector('.notion-overlay-container'); - const createTooltipContainer = document.createElement('div'); - const tooltipText = text.innerText; - const tooltipIcon = icon; - const tooltipContainerHtml = - `
-
- ${tooltipIcon} -
- -
- ${tooltipText} -
-
`; - - createTooltipContainer.innerHTML = tooltipContainerHtml; - createTooltipContainer.classList.add('admiraldus-truncated-table-titles-tooltip'); - createTooltipContainer.setAttribute('style', `max-width: ${cell.offsetWidth >= 450 ? cell.offsetWidth / 2 + 450 >= frame.offsetWidth ? frame.offsetWidth - 16 : cell.offsetWidth / 2 + 450 : 450}px;`); - notionOverlayContainer.append(createTooltipContainer); - - const tooltipOffset = setTooltipOffset(cell, document.querySelector('.admiraldus-truncated-table-titles-tooltip')); - createTooltipContainer.setAttribute('style', createTooltipContainer.getAttribute('style') + tooltipOffset); - } - - /** - * Remove all tooltips from the DOM. - */ - function removeTooltip() { - if (document.querySelector('.admiraldus-truncated-table-titles-tooltip')) { - while (document.querySelectorAll('.admiraldus-truncated-table-titles-tooltip').length !== 0) { - document.querySelectorAll('.admiraldus-truncated-table-titles-tooltip').forEach((tooltip) => tooltip.remove()); - } - } - } - - const BODY = document.querySelector('body'); - let tooltipDelay = null; - - BODY.addEventListener('mousedown', () => { - /** - * When the drag is detected, set the global variable to true and remove all tooltips. - */ - const dragStart = function() { - window.isCellDragging = true; - - window.clearTimeout(tooltipDelay); - removeTooltip(); - }; - - /** - * When the drag is over, set the global variable to false and remove the relevant event listeners. - */ - const dragEnd = function() { - window.isCellDragging = false; - - window.removeEventListener('mousemove', dragStart); - window.removeEventListener('mouseup', dragEnd); - }; - - window.addEventListener('mousemove', dragStart); - window.addEventListener('mouseup', dragEnd); - }); - - BODY.addEventListener('mouseenter', (event) => { - const el = event.target; - - if (window.isCellDragging !== true) { - if (el.classList.contains('notion-table-view-header-cell')) { - if (el.querySelector('div[style*="text-overflow"]').scrollWidth > el.querySelector('div[style*="text-overflow"]').clientWidth) { - tooltipDelay = window.setTimeout(function() { - createTooltip(el, el.querySelector('div[style*="text-overflow"]'), document.querySelector('.admiraldus-truncated-table-titles-rendered-svg').innerHTML); - }, 1000); - } - } - } - }, true); - - BODY.addEventListener('mouseleave', (event) => { - const el = event.target; - - if (el.classList.contains('notion-table-view-header-cell')) { - if (el.querySelector('div[style*="text-overflow"]').scrollWidth > el.querySelector('div[style*="text-overflow"]').clientWidth) { - window.clearTimeout(tooltipDelay); - removeTooltip(); - } - } - }, true); - - console.info( - '%cextension: ' + - `%c${module.exports.name} ` + - `%cfrom ${module.exports.author.name} ` + - '%c(operational)', 'font-weight: bold;', - 'font-weight: normal', - 'font-style: italic;', - 'color: #a5d6a7;'); - }); - }, - }, -}; diff --git a/mods/tweaks/app.css b/mods/tweaks/app.css deleted file mode 100644 index 6811304..0000000 --- a/mods/tweaks/app.css +++ /dev/null @@ -1,62 +0,0 @@ -/* - * tweaks - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -[data-tweaks*='[responsive_breakpoint]'] - .notion-column_list-block - [style='display: flex;'] - > div { - width: 100% !important; -} -[data-tweaks*='[responsive_breakpoint]'] - .notion-column_list-block - [style='display: flex;'] { - flex-direction: column !important; -} -[data-tweaks*='[responsive_breakpoint]'] .notion-app-inner { - --theme_dark--page_normal-width: 100%; - --theme_dark--page-padding: calc(48px + env(safe-area-inset-left)); - --theme_light--page_normal-width: 100%; - --theme_light--page-padding: calc(48px + env(safe-area-inset-left)); -} - -[data-tweaks*='[snappy_transitions]'] * { - animation-duration: 0s !important; - transition-duration: 0s !important; -} -[data-tweaks*='[snappy_transitions]'] .notion-selectable-halo { - opacity: 1 !important; -} - -[data-tweaks*='[hide_help]'] .notion-help-button { - display: none !important; -} - -[data-tweaks*='[thicker_bold]'] - .notion-page-content - span[style*='font-weight:600'] { - font-weight: 700 !important; -} - -[data-tweaks*='[spaced_lines]'] { - --theme_dark--text-block_line-height: 1.65; - --theme_dark--text-block_margin-top: 0.75em; - --theme_light--text-block_line-height: 1.65; - --theme_light--text-block_margin-top: 0.75em; -} - -[data-tweaks*='[condensed_bullets]'] - .notion-selectable.notion-bulleted_list-block { - line-height: 1.1 !important; - margin-top: -1.5px !important; - margin-bottom: -1.5px !important; -} - -[data-tweaks*='[scroll_db_toolbars]'] .notion-collection_view-block > [style*=" height: 42px"] { - overflow-x: auto !important; -} -[data-tweaks*='[scroll_db_toolbars]'] .notion-collection_view-block > [style*=" height: 42px"]::-webkit-scrollbar { - display: none; -} diff --git a/mods/tweaks/mod.js b/mods/tweaks/mod.js deleted file mode 100644 index daa5a67..0000000 --- a/mods/tweaks/mod.js +++ /dev/null @@ -1,120 +0,0 @@ -/* - * tweaks - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: 'cf8a7b27-5a4c-4d45-a4cb-1d2bbc9e9014', - alwaysActive: true, - tags: ['core', 'extension'], - name: 'tweaks', - desc: 'common style/layout changes.', - version: '0.1.0', - author: 'dragonwocky', - options: [ - { - key: 'dragarea_height', - label: 'height of frameless dragarea:', - desc: `the rectangle added at the top of a window in "integrated titlebar" mode,\ - used to drag/move the window.`, - type: 'input', - value: 15, - platformOverwrite: { - darwin: 0, - }, - }, - { - key: 'responsive_breakpoint', - label: 'width to wrap columns at:', - desc: `the size in pixels below which in-page columns are resized to appear\ - full width so content isn't squished.`, - type: 'input', - value: 600, - }, - { - key: 'smooth_scrollbars', - label: 'integrated scrollbars', - desc: - "use scrollbars that fit better into notion's ui instead of the default chrome ones.", - type: 'toggle', - value: true, - }, - { - key: 'snappy_transitions', - label: 'snappy transitions', - type: 'toggle', - value: false, - }, - { - key: 'thicker_bold', - label: 'thicker bold text', - type: 'toggle', - value: true, - }, - { - key: 'spaced_lines', - label: 'more readable line spacing', - type: 'toggle', - value: false, - }, - { - key: 'hide_help', - label: 'hide help button', - type: 'toggle', - value: false, - }, - { - key: 'condensed_bullets', - label: 'condense bullet points', - desc: - 'makes bullet point blocks closer together and have tighter line spacing', - type: 'toggle', - value: false, - }, - { - key: 'scroll_db_toolbars', - label: 'scroll database toolbars', - desc: - 'allows scrolling database toolbars horizontally if\ - part of the toolbar is hidden (hold shift while scrolling)', - type: 'toggle', - value: true, - }, - ], - hacks: { - 'renderer/preload.js': (store, __exports) => { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - document.body.dataset.tweaks = [ - 'smooth_scrollbars', - 'snappy_transitions', - 'thicker_bold', - 'spaced_lines', - 'hide_help', - 'condensed_bullets', - 'scroll_db_toolbars', - ] - .filter((tweak) => store()[tweak]) - .map((tweak) => `[${tweak}]`) - .join(''); - document.documentElement.style.setProperty( - '--configured--dragarea_height', - `${store().dragarea_height + 2}px` - ); - const addResponsiveBreakpoint = () => { - document.body.dataset.tweaks = document.body.dataset.tweaks.replace( - /\[responsive_breakpoint\]/g, - '' - ); - if (window.outerWidth <= store().responsive_breakpoint) - document.body.dataset.tweaks += '[responsive_breakpoint]'; - }; - window.addEventListener('resize', addResponsiveBreakpoint); - addResponsiveBreakpoint(); - }); - }, - }, -}; diff --git a/mods/view-scale/app.css b/mods/view-scale/app.css deleted file mode 100644 index 12fcbc9..0000000 --- a/mods/view-scale/app.css +++ /dev/null @@ -1,88 +0,0 @@ -/* - * view-scale - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 SP12893678 - * under the MIT license - */ - -.notion-topbar-actions{ - display: flex; - align-items: center !important; - justify-content: center; - -} - -.notion-scale-container{ - border: 1px solid rgba(200, 200, 200, 0.5); - border-radius: 9999px !important; - display: flex; - align-items: center; - justify-content: center; - margin: 0px 4px; -} - -.notion-scale-container div{ - margin: 2px 0px; - cursor: pointer; -} - -.notion-scale-view{ - font-size: 12px; - font-weight: bold; -} - -.notion-scale-button{ - display: flex; - align-items: center; - justify-content: center; - font-size: 16px; - font-weight: bold; - width: 28px; - height: 28px; - border-radius: 9999px; - transition: .5s; -} - -.notion-scale-button:hover{ - background: var(--theme--interactive_hover); -} - -.notion-scale-slider{ - margin-left: 8px; - margin-right: 4px; -} - -.notion-scale-slider[type="range"]{ - -webkit-appearance: none; - outline: 0; - border: 0px; - overflow:hidden; - width:150px; - height:20px; - cursor: ew-resize; - border-radius: 9999px; -} - -.notion-scale-slider[type="range"]::-webkit-slider-runnable-track { - height:20px; - -webkit-appearance: none; - background-color: #ddd; -} - -.notion-scale-slider[type="range"]::-webkit-slider-thumb{ - -webkit-appearance: none; - position: relative; - width:20px; - height:20px; - border-radius: 9999px; - border: 0px; - background: #1597ff; - box-shadow: -100px 0 0 90px #1597ff, inset 0 0 0 20px #1597ff; - filter: drop-shadow(0px 0px 2px rgba(87, 50, 50, 0.3)); - transition:.2s; -} - -.notion-scale-slider[type=range]:active::-webkit-slider-thumb { - background: #fff; - box-shadow: -100px 0 0 90px #1597ff, inset 0 0 0 2px #1597ff; -} \ No newline at end of file diff --git a/mods/view-scale/mod.js b/mods/view-scale/mod.js deleted file mode 100644 index 88c0f78..0000000 --- a/mods/view-scale/mod.js +++ /dev/null @@ -1,186 +0,0 @@ -/* - * view-scale - * (c) 2020 SP12893678 (https://github.com/SP12893678) - * under the MIT license - */ - -'use strict'; -const electron = require('electron'); -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: 'e71ce1e0-024c-435e-a25e-7dd50448d1df', - tags: ['extension'], - name: 'view-scale', - desc: 'scale the notion view', - version: '1.0.0', - author: 'SP12893678', - options: [ - { - key: 'show_ui', - label: 'show scale ui', - type: 'toggle', - value: true, - }, - { - key: 'offset', - label: 'set scale plus and minus offset', - type: 'input', - value: 10, - }, - { - key: 'zoom', - label: 'set scale default value', - type: 'input', - value: 100, - }, - { - key: 'can_hotkey', - label: 'use keyboard hotkey to scale', - type: 'toggle', - value: true, - }, - { - key: 'keyboard_select_modifier', - label: - 'keyboard hotkey select modifier', - type: 'select', - value: [ - 'Control', - 'Alt', - ], - }, - { - key: 'can_mouse_wheel', - label: 'use mouse wheel to scale', - type: 'toggle', - value: true, - }, - { - key: 'mouse_wheel_select_modifier', - label: - 'mouse wheel select modifier', - type: 'select', - value: [ - 'Control', - 'Alt', - 'Command', - 'Shift', - ], - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - - const attempt_interval = setInterval(enhance, 500); - function enhance() { - if (!document.querySelector('.notion-frame')) return; - if (!document.querySelector('.notion-topbar-actions')) return; - clearInterval(attempt_interval); - - electron.webFrame.setZoomFactor(store().zoom / 100) - let zoom = store().zoom / 100 - let offset = store().offset / 100 - let minZoom = 0.5 - let maxZoom = 2 - - const $topBarActionShareMenu = document.querySelector('.notion-topbar-share-menu'); - const $scaleSet = createElement('
'); - const $scaleSilder = createElement(''); - const $scaleView = createElement('
100%
'); - const $scalePlusButton = createElement('
'); - const $scaleMinusButton = createElement('
'); - - - if(store().show_ui){ - $scaleSilder.addEventListener('input',()=>{ - zoom = $scaleSilder.value/100 - changeScaleViewUIValue() - }) - $scaleSilder.addEventListener('change',()=> electron.webFrame.setZoomFactor(zoom)) - $scalePlusButton.addEventListener('click',()=> zoomPlus()) - $scaleMinusButton.addEventListener('click',()=> zoomMinus()) - - $scaleSet.append($scaleSilder) - $scaleSet.append($scaleView) - $scaleSet.append($scalePlusButton) - $scaleSet.append($scaleMinusButton) - - $topBarActionShareMenu.before($scaleSet); - changeScaleViewUIValue() - } - - if(store().can_mouse_wheel){ - document.defaultView.addEventListener('wheel', (event)=>{ - let key = getSelectModifierInKeyBoradKey(store().mouse_wheel_select_modifier) - if (event[key] && event.deltaY < 0) zoomPlus() - if (event[key] && event.deltaY > 0) zoomMinus() - }); - } - - if(store().can_hotkey){ - document.defaultView.addEventListener('keyup', (event) => { - let key = getSelectModifierInKeyBoradKey(store().keyboard_select_modifier) - if (event[key] && event.key == '+') zoomPlus() - if (event[key] && event.key == '-') zoomMinus() - }) - } - - document.defaultView.addEventListener('resize',(event) =>{ - zoom = electron.webFrame.getZoomFactor() - if(store().show_ui) changeScaleViewUIValue() - }); - - const observer = new MutationObserver((list, observer) => { - electron.webFrame.setZoomFactor(zoom) - }); - - observer.observe(document.querySelector('.notion-frame'), { - childList: true - }); - - function zoomPlus() { - zoom = electron.webFrame.getZoomFactor() - if(zoom + offset > maxZoom) return - zoom += offset - electron.webFrame.setZoomFactor(zoom) - } - - function zoomMinus() { - zoom = electron.webFrame.getZoomFactor() - if(zoom + offset < minZoom) return - zoom -= offset - electron.webFrame.setZoomFactor(zoom) - } - - function changeScaleViewUIValue() { - $scaleView.innerHTML = Math.round(zoom * 100) + "%" - } - - function getSelectModifierInKeyBoradKey(select_modifier) { - let key = 'ctrlKey' - switch (select_modifier) { - case 'Control': - key = 'ctrlKey' - break; - case 'Alt': - key = 'altKey' - break; - case 'Command': - key = 'metaKey' - break; - case 'Shift': - key = 'shiftKey' - break; - default: - break; - } - return key - } - } - }) - }, - }, -}; diff --git a/mods/weekly-view/mod.js b/mods/weekly-view/mod.js deleted file mode 100644 index 2b2220d..0000000 --- a/mods/weekly-view/mod.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * weekly view - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 adihd - * under the MIT license - */ - -'use strict'; - -module.exports = { - id: '4c7acaea-6596-4590-85e5-8ac5a1455e8f', - tags: ['extension'], - name: 'weekly view', - desc: 'calendar views named "weekly" will show only the 7 days of this week.', - version: '0.5.1', - author: 'adihd', - hacks: { - 'renderer/preload.js'(store, __exports) { - const attempt_interval = setInterval(enhance, 500); - function enhance() { - const notion_elem = document.querySelector('.notion-frame'); - if (!notion_elem) return; - clearInterval(attempt_interval); - handle([{ target: notion_elem }]); - const observer = new MutationObserver(handle); - observer.observe(notion_elem, { - childList: true, - subtree: true, - }); - function handle(list, observer) { - document - .querySelectorAll('.notion-collection-view-select') - .forEach((collection_view) => { - if (collection_view.innerText.toLowerCase() !== 'weekly') return; - const days = collection_view.parentElement.parentElement.parentElement.parentElement.getElementsByClassName( - 'notion-calendar-view-day' - ), - today = [...days].find((day) => day.style.background), - height = today - ? getComputedStyle( - today.parentElement.parentElement - ).getPropertyValue('height') - : 0; - for (let day of days) - day.parentElement.parentElement.style.height = 0; - if (today) - today.parentElement.parentElement.style.height = height; - }); - } - } - }, - }, -}; diff --git a/mods/word-counter/app.css b/mods/word-counter/app.css deleted file mode 100644 index 46ce67c..0000000 --- a/mods/word-counter/app.css +++ /dev/null @@ -1,59 +0,0 @@ -/* - * word counter - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -#word-counter-details { - width: 100%; - margin-bottom: 2em; -} -#word-counter-details > div { - display: flex; - flex-wrap: wrap; - margin: -0.5em; -} -#word-counter-details > div > p { - margin: 0.5em; - cursor: pointer; - font-size: var(--theme--font_label-size); - color: var(--theme--text); - border-radius: 3px; - padding: 0.25rem 0.5rem; - background: var(--theme--interactive_hover); - border: 1px solid transparent; -} -#word-counter-details > div > p:hover { - background: transparent; - border: 1px solid var(--theme--interactive_hover); -} - -#word-counter-details > div > span { - max-width: 10em; - padding: 0.4rem 0.5rem 0.25rem 0.5rem; - font-size: calc(var(--theme--font_label-size) * 0.8); - color: var(--theme--text_ui_info); -} - -#word-counter-details > div > p > svg { - height: 1em; - width: 1em; - margin: 0 0 -2px 0.3em; - color: var(--theme--text_ui_info); -} - -#word-counter-details-tooltip { - pointer-events: none; - position: absolute; - padding: 0.25em 0.5em; - border-radius: 3px; - box-shadow: var(--theme--box-shadow_strong); - border-right-width: 1px; - font-size: calc(var(--theme--font_label-size) * 0.8); - background: var(--theme--interactive_hover); - opacity: 0; - transition: opacity 120ms ease-in; -} -#word-counter-details-tooltip.active { - opacity: 1; -} diff --git a/mods/word-counter/mod.js b/mods/word-counter/mod.js deleted file mode 100644 index fa2ccbc..0000000 --- a/mods/word-counter/mod.js +++ /dev/null @@ -1,166 +0,0 @@ -/* - * word counter - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 admiraldus (https://github.com/admiraldus) - * under the MIT license - */ - -'use strict'; - -const { createElement } = require('../../pkg/helpers.js'); - -module.exports = { - id: 'b99deb52-6955-43d2-a53b-a31540cd19a5', - tags: ['extension'], - name: 'word counter', - desc: - 'add page details: word/character/sentence/block count & speaking/reading times.', - version: '0.2.0', - author: 'dragonwocky', - options: [ - { - key: 'hide_page_details_text', - label: 'hide "page details" text', - type: 'toggle', - value: false, - }, - ], - hacks: { - 'renderer/preload.js'(store, __exports) { - const copyToClipboard = (str) => { - const el = document.createElement('textarea'); - el.value = str; - el.setAttribute('readonly', ''); - el.style.position = 'absolute'; - el.style.left = '-9999px'; - document.body.appendChild(el); - el.select(); - document.execCommand('copy'); - document.body.removeChild(el); - }, - humanTime = (mins) => { - let readable = ''; - if (1 <= mins) { - readable += `${Math.floor(mins)} min`; - if (2 <= mins) readable += 's'; - } - const secs = Math.round((mins % 1) * 60); - if (1 <= secs) { - if (1 <= mins) readable += ' '; - readable += `${secs} sec`; - if (2 <= secs) readable += 's'; - } - return readable; - }; - - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - let queue = [], - $page = document.getElementsByClassName('notion-page-content')[0]; - const DOCUMENT_OBSERVER = new MutationObserver((list, observer) => { - if (!queue.length) requestIdleCallback(() => handle(queue)); - queue.push(...list); - }), - PAGE_OBSERVER = new MutationObserver(showPageWordDetails); - DOCUMENT_OBSERVER.observe(document.body, { - childList: true, - subtree: true, - }); - function handle(list) { - queue = []; - for (let { addedNodes } of list) { - if ( - addedNodes[0] && - addedNodes[0].className === 'notion-page-content' - ) { - $page = addedNodes[0]; - showPageWordDetails(); - - PAGE_OBSERVER.disconnect(); - PAGE_OBSERVER.observe($page, { - childList: true, - subtree: true, - characterData: true, - }); - } - } - } - const $container = createElement( - `
` - ), - $tooltip = createElement( - `` - ); - function showPageWordDetails() { - const details = { - words: $page.innerText.replace(/\s+/g, ' ').split(' ').length, - characters: $page.innerText.length, - sentences: $page.innerText.split('.').length, - blocks: $page.querySelectorAll('[data-block-id]').length, - }; - details['reading time'] = [ - humanTime(details.words / 275), - '~275 wpm', - ]; - details['speaking time'] = [ - humanTime(details.words / 180), - '~180 wpm', - ]; - - $container.children[0].innerHTML = ` - ${store().hide_page_details_text ? '' : 'page details
(click to copy)
'} - ${Object.keys(details).reduce( - (prev, key) => - prev + - (Array.isArray(details[key]) - ? `

- ${details[key][0]} ${key} - - - - -

` - : `

${details[key]} ${key}

`), - '' - )}`; - $page.previousElementSibling.children[0].appendChild($container); - if (!$container.offsetParent) return; - $container.offsetParent.appendChild($tooltip); - $container - .querySelectorAll('p') - .forEach((p) => - p.addEventListener('click', (e) => - copyToClipboard(e.target.innerText) - ) - ); - $container.querySelectorAll('[data-tooltip]').forEach((el) => { - el.addEventListener('mouseenter', (e) => { - $tooltip.innerText = el.getAttribute('data-tooltip'); - $tooltip.style.top = el.parentElement.offsetTop + 2.5 + 'px'; - $tooltip.style.left = - el.parentElement.offsetLeft + - el.parentElement.offsetWidth - - 5 + - 'px'; - $tooltip.classList.add('active'); - }); - el.addEventListener('mouseleave', (e) => - $tooltip.classList.remove('active') - ); - }); - } - }); - }, - }, -}; diff --git a/notion-enhancer v0.10.0 banner.jpg b/notion-enhancer v0.10.0 banner.jpg deleted file mode 100644 index e89d492..0000000 Binary files a/notion-enhancer v0.10.0 banner.jpg and /dev/null differ diff --git a/pkg/Info.plist b/pkg/Info.plist deleted file mode 100644 index 5f0c788..0000000 --- a/pkg/Info.plist +++ /dev/null @@ -1,107 +0,0 @@ - - - - - AsarIntegrity - {"checksums":{"app.asar":"ZpfV8GYpkh6txWRLY2kyhxy+u/IqxXQicxy6MJr5nNo+FpB7+OvoU+S+6vpgTFAriFyk1Vzdm3LL3r2YdtqkKQ==","electron.asar":"GSTmZZ4QxBFCHgDFXN5eV94sbMRBgM04kw+f9bM+XZB00NCsFz1+8yIOYHycj0X6OoxeOOi08sk4Epi5a2kCDQ=="}} - BuildMachineOSBuild - 17D102 - CFBundleDisplayName - Notion - CFBundleExecutable - Notion - CFBundleIconFile - Notion.icns - CFBundleIdentifier - notion.id - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Notion - CFBundlePackageType - APPL - CFBundleShortVersionString - 2.0.8 - CFBundleURLTypes - - - CFBundleTypeRole - Editor - CFBundleURLName - notion - CFBundleURLSchemes - - notion - - - - CFBundleVersion - 2.0.8 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTSDKBuild - 10.13 - DTSDKName - macosx10.13 - DTXcode - 0941 - DTXcodeBuild - 9F2000 - LSApplicationCategoryType - public.app-category.productivity - LSMinimumSystemVersion - 10.10.0 - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - NSAllowsLocalNetworking - - NSExceptionDomains - - 127.0.0.1 - - NSIncludesSubdomains - - NSTemporaryExceptionAllowsInsecureHTTPLoads - - NSTemporaryExceptionAllowsInsecureHTTPSLoads - - NSTemporaryExceptionMinimumTLSVersion - 1.0 - NSTemporaryExceptionRequiresForwardSecrecy - - - localhost - - NSIncludesSubdomains - - NSTemporaryExceptionAllowsInsecureHTTPLoads - - NSTemporaryExceptionAllowsInsecureHTTPSLoads - - NSTemporaryExceptionMinimumTLSVersion - 1.0 - NSTemporaryExceptionRequiresForwardSecrecy - - - - - NSCameraUsageDescription - This app needs access to the camera - NSHighResolutionCapable - - NSHumanReadableCopyright - Copyright © 2020 Notion Labs, Incorporated - NSMainNibFile - MainMenu - NSMicrophoneUsageDescription - This app needs access to the microphone - NSPrincipalClass - AtomApplication - NSSupportsAutomaticGraphicsSwitching - - NSRequiresAquaSystemAppearance - - - diff --git a/pkg/apply.js b/pkg/apply.js deleted file mode 100644 index ebfa5cb..0000000 --- a/pkg/apply.js +++ /dev/null @@ -1,193 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const fs = require('fs-extra'), - path = require('path'), - { readdirIterator } = require('readdir-enhanced'), - { extractAll } = require('asar'), - { readline, realpath, getNotionResources } = require('./helpers.js'), - { version } = require('../package.json'); - -// === title === -// ...information -// * warning -// > prompt -// -- response -// ~~ exit -// ### error ### - -module.exports = async function ({ overwrite_version, friendly_errors } = {}) { - const __notion = getNotionResources(); - try { - // handle pre-existing installations: app.asar present? version set in data folder? overwrite? - const check_app = await require('./check.js')(); - switch (check_app.code) { - case 1: - throw Error(check_app.msg); - case 2: - console.info(`~~ notion-enhancer v${version} already applied.`); - return true; - case 3: - console.warn(` * ${check_app.msg}`); - const valid = () => - typeof overwrite_version === 'string' && - ['y', 'n', ''].includes(overwrite_version.toLowerCase()); - if (valid()) { - console.info( - ` > overwrite? [Y/n]: ${overwrite_version.toLowerCase()}` - ); - } - while (!valid()) { - process.stdout.write(' > overwrite? [Y/n]: '); - overwrite_version = await readline(); - } - if (overwrite_version.toLowerCase() === 'n') { - console.info(' ~~ keeping previous version: exiting.'); - return false; - } - console.info( - ' -- removing previous enhancements before applying new version.' - ); - if ( - !(await require('./remove.js')({ - delete_data: 'n', - friendly_errors, - })) - ) { - return false; - } - } - if (check_app.executable.endsWith('app.asar')) { - console.info(' ...unpacking app.asar.'); - const asar_bak = path.resolve(`${__notion}/app.asar.bak`); - extractAll(check_app.executable, `${path.resolve(`${__notion}/app`)}`); - if (await fs.pathExists(asar_bak)) fs.remove(asar_bak); - await fs.move(check_app.executable, asar_bak); - } else { - console.info(' ...backing up default app.'); - await fs.copy(check_app.executable, check_app.executable + '.bak'); - } - - // patching launch script target of custom wrappers - if ( - [ - '/opt/notion-app', // https://aur.archlinux.org/packages/notion-app/ - '/opt/notion', // https://github.com/jaredallard/notion-app - ].includes(__notion) - ) { - console.info( - ' ...patching app launcher (notion-app linux wrappers only).' - ); - for (let bin_path of [ - `/usr/bin/${__notion.split('/')[2]}`, - `${__notion}/${__notion.split('/')[2]}`, - ]) { - const bin_script = await fs.readFile(bin_path, 'utf8'); - if (bin_script.includes('app.asar')) { - await fs.outputFile( - bin_path, - bin_script - .replace('electron app.asar', 'electron app') - .replace('electron6 app.asar', 'electron6 app') - ); - } - } - } - - // patching app properties so dark/light mode can be detected - if ( - process.platform === 'darwin' && - (await fs.pathExists(path.resolve(`${__notion}/../Info.plist`))) - ) { - fs.copy( - path.resolve(`${__dirname}/Info.plist`), - path.resolve(`${__notion}/../Info.plist`), - { overwrite: true } - ); - } - - for await (let insertion_target of readdirIterator( - path.resolve(`${__notion}/app`), - { - deep: (stats) => stats.path.indexOf('node_modules') === -1, - filter: (stats) => stats.isFile() && stats.path.endsWith('.js'), - } - )) { - const insertion_file = path.resolve( - `${__notion}/app/${insertion_target}` - ); - if (insertion_target === 'main/main.js') { - // https://github.com/notion-enhancer/notion-enhancer/issues/160 - // patch the notion:// url scheme/protocol to work on linux - fs.readFile(insertion_file, 'utf8', (err, data) => { - if (err) throw err; - fs.writeFile( - insertion_file, - `${data - .replace( - /process.platform === "win32"/g, - 'process.platform === "win32" || process.platform === "linux"' - ) - .replace( - /else \{[\s\n]+const win = createWindow_1\.createWindow\(relativeUrl\);/g, - 'else if (relativeUrl) { const win = createWindow_1.createWindow(relativeUrl);' - )}\n\n//notion-enhancer\nrequire('${realpath( - __dirname - )}/loader.js')(__filename, exports);`, - 'utf8', - (err) => { - if (err) throw err; - } - ); - }); - } else { - fs.appendFile( - insertion_file, - `\n\n//notion-enhancer\nrequire('${realpath( - __dirname - )}/loader.js')(__filename, exports);` - ); - } - } - - // not resolved, nothing else in apply process depends on it - // so it's just a "let it do its thing" - console.info(' ...recording enhancement version.'); - fs.outputFile( - path.resolve(`${__notion}/app/ENHANCER_VERSION.txt`), - version - ); - - console.info(' ~~ success.'); - return true; - } catch (err) { - console.error('### ERROR ###'); - if (err.code === 'EACCES' && friendly_errors) { - console.error( - `file access forbidden - ${ - process.platform === 'win32' - ? 'make sure your user has elevated permissions.' - : `try running "sudo chmod -R a+wr ${err.path.replace( - 'Notion.app', - 'Notion' - )}" ${ - err.dest - ? `and/or "sudo chmod -R a+wr ${err.dest.replace( - 'Notion.app', - 'Notion' - )}"` - : '' - }` - }, and make sure path(s) are not open.` - ); - } else if (['EIO', 'EBUSY'].includes(err.code) && friendly_errors) { - console.error("file access failed: make sure notion isn't running!"); - } else console.error(err); - return false; - } -}; diff --git a/pkg/check.js b/pkg/check.js deleted file mode 100644 index 6a19fde..0000000 --- a/pkg/check.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const fs = require('fs-extra'), - path = require('path'), - { getNotionResources } = require('./helpers.js'), - { version } = require('../package.json'); - -module.exports = async function () { - const __notion = getNotionResources(), - resolvePath = (filepath) => path.resolve(`${__notion}/${filepath}`), - pathExists = (filepath) => fs.pathExists(resolvePath(filepath)), - version_path = 'app/ENHANCER_VERSION.txt', - packed = await pathExists('app.asar.bak'); - let backup = packed - ? (await pathExists('app.asar.bak')) - ? `app.asar.bak` - : undefined - : (await pathExists('app.bak')) - ? 'app.bak' - : undefined; - if (!(await pathExists(version_path))) { - let executable = (await pathExists('app')) - ? 'app' - : (await pathExists('app.asar')) - ? 'app.asar' - : undefined; - if (!executable && backup) { - backup = resolvePath(backup); - executable = backup.replace(/\.bak$/, ''); - await fs.move(backup, executable); - } else executable = executable ? resolvePath(executable) : ''; - return executable - ? { - code: 0, - msg: `notion-enhancer has not been applied.`, - executable, - } - : { - code: 1, - msg: `notion installation has been corrupted: no executable found.`, - }; - } - const installed_version = await fs.readFile( - resolvePath(version_path), - 'utf8' - ), - meta = { - version: installed_version, - executable: resolvePath('app'), - packed: resolvePath(packed), - backup: resolvePath(backup), - }; - return installed_version === version - ? { - code: 2, - msg: `notion-enhancer v${version} applied.`, - ...meta, - } - : { - code: 3, - msg: `notion-enhancer v${installed_version} found applied != v${version} package.`, - ...meta, - }; -}; diff --git a/pkg/helpers.js b/pkg/helpers.js deleted file mode 100644 index 09f635f..0000000 --- a/pkg/helpers.js +++ /dev/null @@ -1,200 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (https://dragonwocky.me/notion-enhancer) under the MIT license - */ - -'use strict'; - -const os = require('os'), - path = require('path'), - fs = require('fs-extra'), - { execSync } = require('child_process'); - -// used to differentiate between "enhancer failed" and "code broken" errors. -class EnhancerError extends Error { - constructor(message) { - super(message); - this.name = 'EnhancerError'; - } -} - -// checks if being run on the windows subsystem for linux: -// used to modify windows notion app. -const is_wsl = - process.platform === 'linux' && - os.release().toLowerCase().includes('microsoft'), - // ~/.notion-enhancer absolute path. - __data = path.resolve( - `${ - is_wsl - ? (() => { - const stdout = execSync('cmd.exe /c echo %systemdrive%%homepath%', { - encoding: 'utf8', - }), - drive = stdout[0]; - return `/mnt/${drive.toLowerCase()}${stdout - .replace(/\\/g, '/') - .slice(2) - .trim()}`; - })() - : os.homedir() - }/.notion-enhancer` - ); - -// transform a wsl filepath to its relative windows filepath if necessary. -function realpath(hack_path) { - if (!is_wsl) return hack_path.replace(/\\/g, '/'); - hack_path = fs.realpathSync(hack_path); - if (hack_path.startsWith('/mnt/')) { - hack_path = `${hack_path[5].toUpperCase()}:${hack_path.slice(6)}`; - } else hack_path = `//wsl$/${process.env.WSL_DISTRO_NAME}${hack_path}`; - return hack_path; -} - -// gets possible system notion app filepaths. -function getNotionResources() { - let folder = ''; - switch (process.platform) { - case 'darwin': - for (let loc of [ - `/Users/${process.env.USER}/Applications/Notion.app/Contents/Resources`, // Notion is installed only for the current user - '/Applications/Notion.app/Contents/Resources' // Notion is installed globally - ]) { - if (fs.pathExistsSync(loc)) folder = loc; - } - break; - case 'win32': - folder = process.env.LOCALAPPDATA + '\\Programs\\Notion\\resources'; - break; - case 'linux': - if (is_wsl) { - const stdout = execSync('cmd.exe /c echo %localappdata%', { - encoding: 'utf8', - }), - drive = stdout[0]; - folder = `/mnt/${drive.toLowerCase()}${stdout - .replace(/\\/g, '/') - .slice(2) - .trim()}/Programs/Notion/resources`; - } else { - for (let loc of [ - '/usr/lib/notion-desktop/resources', // https://github.com/davidbailey00/notion-deb-builder/ - '/opt/notion-app', // https://aur.archlinux.org/packages/notion-app/ - '/opt/notion', // https://github.com/jaredallard/notion-app - ]) { - if (fs.pathExistsSync(loc)) folder = loc; - } - } - } - if (!folder) - throw new EnhancerError('nothing found: platform not supported.'); - return folder; -} - -// lists/fetches all available extensions + themes -function getEnhancements() { - const modules = { - loaded: [], - invalid: [], - dirs: fs - .readdirSync(path.resolve(`${__dirname}/../mods`)) - .filter((dir) => !dir.startsWith('.')), - IDs: [], - }; - for (let dir of modules.dirs) { - try { - const mod = require(`../mods/${dir}/mod.js`); - if (!mod.tags) mod.tags = []; - if ( - !mod.id || - modules.IDs.includes(mod.id) || - !mod.name || - !mod.version || - !mod.author || - !mod.tags.every((tag) => typeof tag === 'string') || - (mod.fonts && !mod.fonts.every((font) => typeof font === 'string')) || - (mod.options && - !mod.options.every((opt) => - ['toggle', 'select', 'input', 'file', 'color'].includes(opt.type) - )) - ) - throw Error; - mod.defaults = {}; - for (let opt of mod.options || []) { - if ( - Object.keys(opt.platformOverwrite || {}).some( - (platform) => process.platform === platform - ) - ) { - mod.defaults[opt.key] = opt.platformOverwrite[process.platform]; - } else - mod.defaults[opt.key] = Array.isArray(opt.value) - ? opt.value[0] - : opt.value; - } - modules.IDs.push(mod.id); - modules.loaded.push({ - ...mod, - dir, - }); - if (!mod.tags.includes('core')) mod.alwaysActive = false; - } catch (err) { - // console.error(err); - modules.invalid.push(dir); - } - } - modules.loaded = modules.loaded.sort((a, b) => a.name.localeCompare(b.name)); - const priority = require('./store.js')('mods', { priority: [] }).priority; - modules.loaded = [ - ...modules.loaded.filter((m) => m.tags.includes('core')), - ...modules.loaded.filter( - (m) => !m.tags.includes('core') && !priority.includes(m.id) - ), - ...priority - .map((id) => modules.loaded.find((m) => m.id === id)) - .filter((m) => m), - ]; - return modules; -} - -// attempts to read a JSON file, falls back to empty object. -function getJSON(from) { - try { - return fs.readJsonSync(from); - } catch (err) { - return {}; - } -} - -// wait for console input, returns keys when enter pressed. -function readline() { - return new Promise((res, rej) => { - process.stdin.resume(); - process.stdin.setEncoding('utf8'); - process.stdin.on('data', (key) => { - if (key === '\u0003') process.exit(); // CTRL+C - process.stdin.pause(); - res(key.trim()); - }); - }); -} - -// construct a HTMLElement from a string -function createElement(html) { - const template = document.createElement('template'); - template.innerHTML = html.trim(); - return template.content.firstElementChild; -} - -module.exports = { - EnhancerError, - is_wsl, - __data, - realpath, - getNotionResources, - getEnhancements, - getJSON, - readline, - createElement, -}; diff --git a/pkg/helpers.md b/pkg/helpers.md deleted file mode 100644 index 2e60e8a..0000000 --- a/pkg/helpers.md +++ /dev/null @@ -1,142 +0,0 @@ -# `helpers.js` - -these shared variables/classes/functions (used for consistency of error handling and -cross-platform functionality) were previously documented in the [module-creation docs](../DOCUMENTATION.md). -however, to ensure things can be toggled on/off no non-core code is executed on enhancement. -this does made certain modding more difficult, but with some clever code the same results can be achieved. - -it is unlikely any of these will need to be used, so they were removed from the main docs in -an attempt to keep things as simple as possible. - ---- - -```js -class EnhancerError(message) {} -``` - -use `throw new helpers.EnhancerError(message)` if ever something occurs that would cause enhancement to fail, -but is not caused by faulty programming: e.g. if a file that is known to exist cannot be found. - ---- - -```js -const is_wsl; -``` - -use `helpers.is_wsl` to check if the enhancer was run from the windows subsystem for linux. - -primarily used for internal handling of filepaths (e.g. in the `helpers.realpath` function). - ---- - -```js -const __data; -``` - -use `helpers.__data` to get the absolute path of the directory configuration -data is saved to by the enhancer. - -if used immediately after being accessed, it should always work. however, if fetching its value during enhancement -and then inserting it into something that will not be executed until the app is opened, it must be put through -`helpers.realpath` before insertion. - ---- - -```js -function realpath(hack_path) { - return runtime_path; -} -``` - -use `helpers.realpath(hack_path)` to transform a path valid at enhancement time into one valid when the app is opened. -this is particularly useful for wsl compatibility, so every filepath that is fetched during enhancement -and then inserted into something that will not be executed until the app is opened should be put through this. - -primarily used for internal handling of filepaths (e.g. for the modloader). - ---- - -```js -function getNotionResources() { - return __notionResourcesFolder; -} -``` - -use `helpers.getNotionResources()` to get the absolute path of the notion app parent folder. - -primarily used for internal modding of the app (e.g. to apply the modloader and patch launch scripts). - -if used immediately after being accessed, it should always work. however, if fetching its value during enhancement -and then inserting it into something that will not be executed until the app is opened, it must be put through -`helpers.realpath` before insertion. - ---- - -```js -function getEnhancements() { - return { loaded, invalid, dirs, IDs }; -} -``` - -use `helpers.getEnhancements()` to list all available extensions/themes. - -primarily used for internal moadloading/configuration of the app (e.g. in the menu). - ---- - -```js -function getJSON(from) { - return data; -} -``` - -use `helpers.getJSON(from)` to read/parse a JSON file. if the file has invalid contents or does not exist, -an empty object will be returned. - -primarily used for internal data management (e.g. in the module `store()`). - ---- - -```js -function readline() { - return Promise(input); -} -``` - -use `helpers.readline()` to receive user input from the terminal/shell/prompt during enhancement. - -example usage: - -```js -console.warn(' * conflicting file found.'); -let overwrite; -while ( - typeof overwrite !== 'string' || - !['y', 'n', ''].includes(overwrite.toLowerCase()) -) { - // using stdout.write means that there is no newline - // between prompt and input. - process.stdout.write(' > delete? [Y/n]: '); - // ask for a Y/n until a valid answer is received. - // pressing enter without input is assumed to be a "yes". - overwrite = await helpers.readline(); -} -if (overwrite.toLowerCase() === 'n') { - console.info(' -- keeping file: skipping step.'); -} else { - // do stuff - console.info(' -- overwriting file.'); -} -``` - ---- - -```js -function createElement(html) { - const template = document.createElement('template'); - template.innerHTML = html.trim(); - return template.content.firstElementChild; -} -``` - -use `helpers.createElement(html)` to turn a html-valid string into an element to add to the page. diff --git a/pkg/loader.js b/pkg/loader.js deleted file mode 100644 index f44da9c..0000000 --- a/pkg/loader.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const fs = require('fs-extra'), - path = require('path'), - { - getNotionResources, - getEnhancements, - createElement, - } = require('./helpers.js'), - store = require('./store.js'); - -module.exports = function (__file, __exports) { - __file = __file - .slice(path.resolve(`${getNotionResources()}/app`).length + 1) - .replace(/\\/g, '/'); - - if (__file === 'main/security.js') { - const electron = require('electron'); - electron.app.whenReady().then(() => { - electron.session - .fromPartition('persist:notion') - .protocol.registerFileProtocol('enhancement', (req, callback) => { - callback({ - path: path.resolve( - `${__dirname}/../mods/${req.url.slice('enhancement://'.length)}` - ), - }); - }); - }); - electron.protocol.registerSchemesAsPrivileged([ - { - scheme: 'notion', - privileges: { - standard: true, - secure: true, - allowServiceWorkers: true, - supportFetchAPI: true, - corsEnabled: true, - }, - }, - { - scheme: 'enhancement', - privileges: { - standard: true, - secure: true, - allowServiceWorkers: true, - supportFetchAPI: true, - corsEnabled: true, - bypassCSP: true, - }, - }, - ]); - } - - let modules = getEnhancements(); - modules = [ - ...modules.loaded.filter((m) => m.tags.includes('core')), - ...modules.loaded.filter((m) => !m.tags.includes('core')).reverse(), - ]; - if (__file === 'renderer/preload.js') { - document.addEventListener('readystatechange', (event) => { - if (document.readyState !== 'complete') return false; - for (let mod of modules) { - if ( - mod.alwaysActive || - store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled - ) { - const fileExists = (file) => fs.pathExistsSync(path.resolve(file)); - for (let sheet of ['app', 'variables']) { - if (fileExists(`${__dirname}/../mods/${mod.dir}/${sheet}.css`)) { - document.head.appendChild( - createElement( - `` - ) - ); - } - } - } - } - }); - } - for (let mod of modules) { - if ( - (mod.alwaysActive || - store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled) && - mod.hacks && - mod.hacks[__file] - ) { - mod.hacks[__file]((...args) => { - if (!args.length) return store(mod.id, mod.defaults); - if (args.length === 1 && typeof args[0] === 'object') - return store(mod.id, { ...mod.defaults, ...args[0] }); - const other_mod = modules.find((m) => m.id === args[0]); - return store(args[0], { - ...(other_mod ? other_mod.defaults : {}), - ...(args[1] || {}), - }); - }, __exports); - } - } -}; diff --git a/pkg/remove.js b/pkg/remove.js deleted file mode 100644 index b6e301c..0000000 --- a/pkg/remove.js +++ /dev/null @@ -1,111 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const fs = require('fs-extra'), - path = require('path'), - { readline, getNotionResources, __data } = require('./helpers.js'); - -// === title === -// ...information -// * warning -// > prompt -// -- response -// ~~ exit -// ### error ### - -module.exports = async function ({ delete_data, friendly_errors } = {}) { - try { - const __notion = getNotionResources(), - check_app = await require('./check.js')(); - // extracted asar: modded - if (check_app.code > 1 && check_app.executable) { - console.info(` ...removing enhancements`); - await fs.remove(check_app.executable); - } else console.warn(` * enhancements not found: step skipped.`); - - // restoring original asar - if (check_app.backup) { - console.info(' ...restoring backup'); - await fs.move(check_app.backup, check_app.backup.replace(/\.bak$/, '')); - } else console.warn(` * backup not found: step skipped.`); - - // cleaning data folder: ~/.notion-enhancer - if (await fs.pathExists(__data)) { - console.info(` ...data folder ${__data} found.`); - const valid = () => - typeof delete_data === 'string' && - ['y', 'n', ''].includes(delete_data.toLowerCase()); - if (valid()) - console.info(` > delete? [Y/n]: ${delete_data.toLowerCase()}`); - while (!valid()) { - process.stdout.write(' > delete? [Y/n]: '); - delete_data = await readline(); - } - console.info( - delete_data.toLowerCase() === 'n' - ? ` -- keeping ${__data}` - : ` -- deleting ${__data}` - ); - if (delete_data.toLowerCase() !== 'n') await fs.remove(__data); - } else console.warn(` * ${__data} not found: step skipped.`); - - // patching launch script target of custom wrappers - if ( - [ - '/opt/notion-app', // https://aur.archlinux.org/packages/notion-app/ - '/opt/notion', // https://github.com/jaredallard/notion-app - ].includes(__notion) - ) { - console.info( - ' ...patching app launcher (notion-app linux wrappers only).' - ); - for (let bin_path of [ - `/usr/bin/${__notion.split('/')[2]}`, - `${__notion}/${__notion.split('/')[2]}`, - ]) { - const bin_script = await fs.readFile(bin_path, 'utf8'); - if (!bin_script.includes('app.asar')) { - await fs.outputFile( - bin_path, - bin_script - .replace('electron app', 'electron app.asar') - .replace('electron6 app', 'electron6 app.asar') - .replace(/(.asar)+/g, '.asar') - ); - } - } - } - - console.info(' ~~ success.'); - return true; - } catch (err) { - console.error('### ERROR ###'); - if (err.code === 'EACCES' && friendly_errors) { - console.error( - `file access forbidden - ${ - process.platform === 'win32' - ? 'make sure your user has elevated permissions.' - : `try running "sudo chmod -R a+wr ${err.path.replace( - 'Notion.app', - 'Notion' - )}" ${ - err.dest - ? `and/or "sudo chmod -R a+wr ${err.dest.replace( - 'Notion.app', - 'Notion' - )}"` - : '' - }` - }, and make sure path(s) are not open.` - ); - } else if (['EIO', 'EBUSY'].includes(err.code) && friendly_errors) { - console.error("file access failed: make sure notion isn't running!"); - } else console.error(err); - return false; - } -}; diff --git a/pkg/store.js b/pkg/store.js deleted file mode 100644 index 406f725..0000000 --- a/pkg/store.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky (https://dragonwocky.me/) - * under the MIT license - */ - -'use strict'; - -const path = require('path'), - fs = require('fs-extra'), - { getJSON, __data } = require('./helpers.js'); - -// a wrapper for accessing data stored in a JSON file. -module.exports = (namespace, defaults = {}) => { - namespace = path.resolve(`${__data}/${namespace}.json`); - fs.ensureDirSync(__data); - - let data; - const saveData = () => fs.writeJsonSync(namespace, data), - handler = { - get(obj, prop) { - if (prop === 'isProxy') return true; - if ( - typeof obj[prop] === 'object' && - obj[prop] !== null && - !obj[prop].isProxy - ) - obj[prop] = new Proxy(obj[prop], handler); - return obj[prop]; - }, - set(obj, prop, val) { - obj[prop] = val; - saveData(); - return true; - }, - }; - data = new Proxy({ ...defaults, ...getJSON(namespace) }, handler); - return data; -};