diff --git a/CHANGELOG.md b/CHANGELOG.md index a189168..fdd284c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ a complete rework of the enhancer, with new features and a port to the browser a - a hotkey option type that allows typing in/pressing a hotkey to enter it, instead of typing. - a rainbow indentation lines style. - border & background style options for the code line numbers extension. +- an icon sets option to encode images to data urls to prevent quality reduction. #### improved diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b503961 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 dragonwocky (https://dragonwocky.me/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/insert/api b/insert/api index 7b48867..32e51cf 160000 --- a/insert/api +++ b/insert/api @@ -1 +1 @@ -Subproject commit 7b488677b7e97dc80befc4281058f51ff3d7cd07 +Subproject commit 32e51cfe45c90f9757ef3427cf60bb54aa95427a diff --git a/insert/client.mjs b/insert/client.mjs index d4aa005..c7e940f 100644 --- a/insert/client.mjs +++ b/insert/client.mjs @@ -12,7 +12,7 @@ signedIn = localStorage['LRU:KeyValueStore2:current-user-id']; if (page || (whitelisted && signedIn)) { - const api = await import('./api/_.mjs'), + const api = await import('./api/index.mjs'), { fs, registry, web } = api; for (const mod of await registry.list((mod) => registry.enabled(mod.id))) { diff --git a/insert/electronApi.cjs b/insert/electronApi.cjs index 46776d6..5e74b2f 100644 --- a/insert/electronApi.cjs +++ b/insert/electronApi.cjs @@ -6,7 +6,7 @@ 'use strict'; -const api = require('notion-enhancer/api/_.cjs'); +const api = require('notion-enhancer/api/index.cjs'); window.__enhancerElectronApi = { platform: api.env.name, diff --git a/insert/env/storage.cjs b/insert/env/storage.cjs index 2a78f6e..bc0cb7f 100644 --- a/insert/env/storage.cjs +++ b/insert/env/storage.cjs @@ -84,9 +84,7 @@ module.exports.set = (path, value) => { pointer = pointer[key]; } saveData(values); - _onChangeListeners.forEach((listener) => - listener({ type: 'set', path: pathClone, new: value, old }) - ); + _onChangeListeners.forEach((listener) => listener({ path: pathClone, new: value, old })); res(value); }); _queue.push(interaction); @@ -132,9 +130,7 @@ module.exports.removeChangeListener = (callback) => { /** * @callback onStorageChangeCallback * @param {object} event - * @param {string} event.type - 'set' or 'reset' - * @param {string} event.namespace- the name of the store, e.g. a mod id - * @param {string} [event.key] - the key associated with the changed value + * @param {string} event.path- the path of keys to the changed value * @param {string} [event.new] - the new value being persisted to the store * @param {string} [event.old] - the previous value associated with the key */ diff --git a/insert/env/storage.mjs b/insert/env/storage.mjs index a4cc72f..f4106ed 100644 --- a/insert/env/storage.mjs +++ b/insert/env/storage.mjs @@ -66,9 +66,7 @@ export const removeChangeListener = (callback) => { /** * @callback onStorageChangeCallback * @param {object} event - * @param {string} event.type - 'set' or 'reset' - * @param {string} event.namespace- the name of the store, e.g. a mod id - * @param {string} [event.key] - the key associated with the changed value + * @param {string} event.path- the path of keys to the changed value * @param {string} [event.new] - the new value being persisted to the store * @param {string} [event.old] - the previous value associated with the key */ diff --git a/insert/init.cjs b/insert/init.cjs index ed29a6c..55ee86e 100644 --- a/insert/init.cjs +++ b/insert/init.cjs @@ -23,7 +23,7 @@ module.exports = async function (target, __exports) { app.whenReady().then(require('notion-enhancer/worker.cjs').listen); } - const api = require('notion-enhancer/api/_.cjs'), + const api = require('notion-enhancer/api/index.cjs'), { registry } = api; for (const mod of await registry.list((mod) => registry.enabled(mod.id))) { for (const { source, target: scriptTarget } of (mod.js ? mod.js.electron : []) || []) { diff --git a/insert/repo b/insert/repo index 9725eb9..7707136 160000 --- a/insert/repo +++ b/insert/repo @@ -1 +1 @@ -Subproject commit 9725eb9983edb8e3e1958e38bcfd73e34f199eb5 +Subproject commit 7707136dfecd1d2b69bcb1db6d56dca35ea2b329 diff --git a/insert/worker.cjs b/insert/worker.cjs index 71c8c38..1f0f0bb 100644 --- a/insert/worker.cjs +++ b/insert/worker.cjs @@ -20,7 +20,7 @@ let enhancerMenu; module.exports.focusMenu = () => { if (enhancerMenu) return enhancerMenu.show(); - const { fs } = require('notion-enhancer/api/_.cjs'), + const { fs } = require('notion-enhancer/api/index.cjs'), { session, BrowserWindow } = require('electron'), windowState = require('electron-window-state')({ file: 'enhancer-menu-window-state.json', @@ -52,7 +52,7 @@ module.exports.focusMenu = () => { }; module.exports.focusNotion = () => { - const { env } = require('notion-enhancer/api/_.cjs'), + const { env } = require('notion-enhancer/api/index.cjs'), { BrowserWindow } = require('electron'), { createWindow } = env.notionRequire('main/createWindow.js'); let window = BrowserWindow.getAllWindows().find((win) => win.id !== enhancerMenu.id);