From 6874b905eb12648a231d7ad16111cc5a82bb8b3b Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 30 Nov 2021 18:01:15 +1100 Subject: [PATCH] update imports for api folder structure --- repo/indentation-lines/client.css | 3 +- repo/integrated-titlebar/buttons.css | 0 repo/integrated-titlebar/client.mjs | 11 +++ repo/integrated-titlebar/createWindow.cjs | 82 +++++++++++++++++++++++ repo/integrated-titlebar/menu.mjs | 11 +++ repo/integrated-titlebar/mod.json | 34 ++++++++++ repo/menu/components.mjs | 2 +- repo/menu/menu.mjs | 2 +- repo/menu/notifications.mjs | 2 +- repo/menu/router.mjs | 2 +- repo/menu/styles.mjs | 28 ++++---- repo/registry.json | 31 ++++----- 12 files changed, 174 insertions(+), 34 deletions(-) create mode 100644 repo/integrated-titlebar/buttons.css create mode 100644 repo/integrated-titlebar/client.mjs create mode 100644 repo/integrated-titlebar/createWindow.cjs create mode 100644 repo/integrated-titlebar/menu.mjs create mode 100644 repo/integrated-titlebar/mod.json diff --git a/repo/indentation-lines/client.css b/repo/indentation-lines/client.css index f4c106e..394c6e0 100644 --- a/repo/indentation-lines/client.css +++ b/repo/indentation-lines/client.css @@ -50,6 +50,7 @@ [style*='position: absolute; top: 3px; left: -20px; width: 18px; height: 24px; pointer-events: auto; cursor: -webkit-grab;'] [data-block-id] { background: var(--theme--bg) !important; + border-radius: 3px; } .notion-frame > [style*='position: absolute; top: 0px; left: 0px;'] @@ -90,5 +91,5 @@ [style*='position: absolute; top: 3px; left: -20px; width: 18px; height: 24px; pointer-events: auto; cursor: -webkit-grab;'] + .notion-focusable > .plus:hover { - background: rgba(255, 255, 255, 0.1) !important; + background: var(--theme--ui_interactive-hover) !important; } diff --git a/repo/integrated-titlebar/buttons.css b/repo/integrated-titlebar/buttons.css new file mode 100644 index 0000000..e69de29 diff --git a/repo/integrated-titlebar/client.mjs b/repo/integrated-titlebar/client.mjs new file mode 100644 index 0000000..7966334 --- /dev/null +++ b/repo/integrated-titlebar/client.mjs @@ -0,0 +1,11 @@ +/* + * notion-enhancer: integrated titlebar + * (c) 2021 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +'use strict'; + +export default async function (api, db) { + // +} diff --git a/repo/integrated-titlebar/createWindow.cjs b/repo/integrated-titlebar/createWindow.cjs new file mode 100644 index 0000000..6fde278 --- /dev/null +++ b/repo/integrated-titlebar/createWindow.cjs @@ -0,0 +1,82 @@ +/* + * notion-enhancer: integrated titlebar + * (c) 2021 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +'use strict'; + +module.exports = async function (api, db, __exports) { + const notionCreateWindow = __exports.createWindow; + // __exports.createWindow = (relativeUrl = '', args) => { + // const windowState = require('electron-window-state').default({ + // defaultWidth: 1320, + // defaultHeight: 860, + // }); + // const focusedWindow = electron_1.BrowserWindow.getFocusedWindow(); + // const rect = getRectFromFocusedWindow(windowState); + // const windowCreationArgs = Object.assign(Object.assign({}, rect), { + // show: false, + // backgroundColor: '#ffffff', + // titleBarStyle: 'hiddenInset', + // autoHideMenuBar: true, + // webPreferences: { + // preload: path_1.default.resolve(__dirname, '../renderer/index.js'), + // webviewTag: true, + // session: electron_1.session.fromPartition(constants_1.electronSessionPartition), + // enableRemoteModule: true, + // }, + // }); + // const { window, warmed } = getNextWindow(windowCreationArgs); + // window.setMenuBarVisibility(false); + // warmWindowState.warmedWindow = undefined; + // window.once('ready-to-show', () => { + // if (args && args.isLocalhost) { + // return; + // } + // if (!warmed) { + // window.show(); + // } + // }); + // if (warmed) { + // if (warmWindowState.warmedLoaded) { + // notionIpc.sendMainToNotionWindow(window, 'notion:navigate-to-url', relativeUrl); + // } else { + // void window.loadURL(urlHelpers_1.getIndexUrl(relativeUrl)); + // } + // window.setBounds(getRectFromFocusedWindow(windowState)); + // window.show(); + // } else { + // void window.loadURL(urlHelpers_1.getIndexUrl(relativeUrl)); + // } + // if (focusedWindow) { + // if (focusedWindow.isFullScreen()) { + // window.setFullScreen(true); + // } + // } else { + // if (windowState.isFullScreen) { + // window.setFullScreen(true); + // } + // } + // window.on('close', () => { + // windowState.saveState(window); + // if (process.platform === 'win32') { + // const currentWindows = electron_1.BrowserWindow.getAllWindows(); + // const hasNoOtherOpenWindows = currentWindows.every((currentWindow) => + // Boolean( + // currentWindow.id === window.id || + // (warmWindowState.warmedWindow && + // currentWindow.id === warmWindowState.warmedWindow.id) + // ) + // ); + // if (hasNoOtherOpenWindows) { + // electron_2.app.quit(); + // } + // } + // }); + // setImmediate(() => { + // warmWindowState.warmedLoaded = false; + // }); + // return window; + // }; +}; diff --git a/repo/integrated-titlebar/menu.mjs b/repo/integrated-titlebar/menu.mjs new file mode 100644 index 0000000..7966334 --- /dev/null +++ b/repo/integrated-titlebar/menu.mjs @@ -0,0 +1,11 @@ +/* + * notion-enhancer: integrated titlebar + * (c) 2021 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +'use strict'; + +export default async function (api, db) { + // +} diff --git a/repo/integrated-titlebar/mod.json b/repo/integrated-titlebar/mod.json new file mode 100644 index 0000000..2a79050 --- /dev/null +++ b/repo/integrated-titlebar/mod.json @@ -0,0 +1,34 @@ +{ + "name": "integrated titlebar", + "id": "a5658d03-21c6-4088-bade-fa4780459133", + "environments": ["linux", "win32"], + "version": "0.11.0", + "description": "replaces the native window titlebar with buttons inset into the app.", + "tags": ["extension", "layout"], + "authors": [ + { + "name": "dragonwocky", + "email": "thedragonring.bod@gmail.com", + "homepage": "https://dragonwocky.me/", + "avatar": "https://dragonwocky.me/avatar.jpg" + } + ], + "css": { + "client": ["buttons.css"], + "menu": ["buttons.css"] + }, + "js": { + "client": ["client.mjs"], + "menu": ["menu.mjs"], + "electron": [{ "source": "createWindow.cjs", "target": "main/createWindow.js" }] + }, + "options": [ + { + "type": "toggle", + "key": "tiling", + "label": "tiling window manager mode", + "tooltip": "**completely remove the close/minimise/maximise buttons** (only for advanced use, not recommended)", + "value": false + } + ] +} diff --git a/repo/menu/components.mjs b/repo/menu/components.mjs index d013ec2..7e72271 100644 --- a/repo/menu/components.mjs +++ b/repo/menu/components.mjs @@ -6,7 +6,7 @@ 'use strict'; -import { fmt, web, registry, components } from '../../api/_.mjs'; +import { fmt, web, registry, components } from '../../api/index.mjs'; import { notifications } from './notifications.mjs'; export const modComponents = { diff --git a/repo/menu/menu.mjs b/repo/menu/menu.mjs index 9f18c51..374818f 100644 --- a/repo/menu/menu.mjs +++ b/repo/menu/menu.mjs @@ -6,7 +6,7 @@ 'use strict'; -import * as api from '../../api/_.mjs'; +import * as api from '../../api/index.mjs'; import { notifications, $changelogModal } from './notifications.mjs'; import { modComponents, options } from './components.mjs'; import * as router from './router.mjs'; diff --git a/repo/menu/notifications.mjs b/repo/menu/notifications.mjs index 69f6171..1fbbb48 100644 --- a/repo/menu/notifications.mjs +++ b/repo/menu/notifications.mjs @@ -4,7 +4,7 @@ * (https://notion-enhancer.github.io/) under the MIT license */ -import { env, fs, storage, fmt, web, components } from '../../api/_.mjs'; +import { env, fs, storage, fmt, web, components } from '../../api/index.mjs'; import { tw } from './styles.mjs'; const notificationsURL = 'https://notion-enhancer.github.io/notifications.json'; diff --git a/repo/menu/router.mjs b/repo/menu/router.mjs index 127321a..8004c71 100644 --- a/repo/menu/router.mjs +++ b/repo/menu/router.mjs @@ -6,7 +6,7 @@ 'use strict'; -import { web } from '../../api/_.mjs'; +import { web } from '../../api/index.mjs'; const _queryListeners = new Set(); diff --git a/repo/menu/styles.mjs b/repo/menu/styles.mjs index 0f1b61c..0e529a0 100644 --- a/repo/menu/styles.mjs +++ b/repo/menu/styles.mjs @@ -10,21 +10,21 @@ import { tw, apply, setup } from '../../dep/twind.mjs'; import { content } from '../../dep/twind-content.mjs'; -const pseudoContent = content('""'); -const mapColorVariables = (color) => ({ - 'text': `var(--theme--text_${color})`, - 'highlight': `var(--theme--highlight_${color})`, - 'highlight-text': `var(--theme--highlight_${color}-text)`, - 'callout': `var(--theme--callout_${color})`, - 'callout-text': `var(--theme--callout_${color}-text)`, - 'tag': `var(--theme--tag_${color})`, - 'tag-text': `var(--theme--tag_${color}-text)`, - 'board': `var(--theme--board_${color})`, - 'board-text': `var(--theme--board_${color}-text)`, - 'board-card': `var(--theme--board_${color}-card)`, - 'board-card_text': `var(--theme--board_${color}-card_text)`, -}); +const pseudoContent = content('""'), + mapColorVariables = (color) => ({ + 'text': `var(--theme--text_${color})`, + 'highlight': `var(--theme--highlight_${color})`, + 'highlight-text': `var(--theme--highlight_${color}-text)`, + 'callout': `var(--theme--callout_${color})`, + 'callout-text': `var(--theme--callout_${color}-text)`, + 'tag': `var(--theme--tag_${color})`, + 'tag-text': `var(--theme--tag_${color}-text)`, + 'board': `var(--theme--board_${color})`, + 'board-text': `var(--theme--board_${color}-text)`, + 'board-card': `var(--theme--board_${color}-card)`, + 'board-card_text': `var(--theme--board_${color}-card_text)`, + }); const customClasses = { 'notifications-container': apply`absolute bottom-0 right-0 px-4 py-3 max-w-full w-96 z-10`, diff --git a/repo/registry.json b/repo/registry.json index 2109777..d468c32 100644 --- a/repo/registry.json +++ b/repo/registry.json @@ -2,21 +2,9 @@ "menu", "theming", "components", + + "integrated-titlebar", "tweaks", - - "material-ocean", - "cherry-cola", - "dark+", - "light+", - "dracula", - "pastel-dark", - "neutral", - "nord", - "gruvbox-dark", - "gruvbox-light", - "playful-purple", - "pinky-boom", - "font-chooser", "outliner", "scroll-to-top", @@ -37,5 +25,18 @@ "global-block-links", "icon-sets", - "quick-note" + "quick-note", + + "material-ocean", + "cherry-cola", + "dark+", + "light+", + "dracula", + "pastel-dark", + "neutral", + "nord", + "gruvbox-dark", + "gruvbox-light", + "playful-purple", + "pinky-boom" ]