mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-07 14:09:03 +00:00
add unofficial notion api wrapper (capable of getting, searching, creating and editing all content)
This commit is contained in:
parent
a86b363ea2
commit
9bb779149b
@ -15,6 +15,8 @@ export * as fs from './fs.mjs';
|
|||||||
/** environment-specific data persistence */
|
/** environment-specific data persistence */
|
||||||
export * as storage from './storage.mjs';
|
export * as storage from './storage.mjs';
|
||||||
|
|
||||||
|
/** a basic wrapper around notion's unofficial api */
|
||||||
|
export * as notion from './notion.mjs';
|
||||||
/** helpers for formatting, validating and parsing values */
|
/** helpers for formatting, validating and parsing values */
|
||||||
export * as fmt from './fmt.mjs';
|
export * as fmt from './fmt.mjs';
|
||||||
/** interactions with the enhancer's repository of mods */
|
/** interactions with the enhancer's repository of mods */
|
||||||
|
@ -28,9 +28,10 @@ export { feather } from './feather.mjs';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* adds a view to the enhancer's side panel
|
* adds a view to the enhancer's side panel
|
||||||
* @param {string} param0.id - a uuid, used to restore it on reload if it was last open
|
* @param {object} panel- information used to construct and render the panel
|
||||||
* @param {string} param0.icon - an svg string
|
* @param {string} panel.id - a uuid, used to restore the last open view on reload
|
||||||
* @param {string} param0.title - the name of the view
|
* @param {string} panel.icon - an svg string
|
||||||
* @param {Element} param0.$content - an element containing the content of the view
|
* @param {string} panel.title - the name of the view
|
||||||
|
* @param {Element} panel.$content - an element containing the content of the view
|
||||||
*/
|
*/
|
||||||
export { addPanelView } from './panel.mjs';
|
export { addPanelView } from './panel.mjs';
|
||||||
|
@ -222,10 +222,11 @@ web.loadStylesheet('api/components/panel.css');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* adds a view to the enhancer's side panel
|
* adds a view to the enhancer's side panel
|
||||||
* @param {string} param0.id - a uuid, used to restore the last open view on reload
|
* @param {object} panel- information used to construct and render the panel
|
||||||
* @param {string} param0.icon - an svg string
|
* @param {string} panel.id - a uuid, used to restore the last open view on reload
|
||||||
* @param {string} param0.title - the name of the view
|
* @param {string} panel.icon - an svg string
|
||||||
* @param {Element} param0.$content - an element containing the content of the view
|
* @param {string} panel.title - the name of the view
|
||||||
|
* @param {Element} panel.$content - an element containing the content of the view
|
||||||
*/
|
*/
|
||||||
export const addPanelView = async ({ id, icon, title, $content }) => {
|
export const addPanelView = async ({ id, icon, title, $content }) => {
|
||||||
const view = {
|
const view = {
|
||||||
|
12
api/fmt.mjs
12
api/fmt.mjs
@ -81,6 +81,18 @@ export const slugger = (heading, slugs = new Set()) => {
|
|||||||
return slug;
|
return slug;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* generate a reasonably random uuidv4 string. uses crypto implementation if available
|
||||||
|
* (from https://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid)
|
||||||
|
* @returns {string} a uuidv4
|
||||||
|
*/
|
||||||
|
export const uuidv4 = () =>
|
||||||
|
crypto?.randomUUID
|
||||||
|
? crypto.randomUUID()
|
||||||
|
: ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
|
||||||
|
(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16)
|
||||||
|
);
|
||||||
|
|
||||||
const patterns = {
|
const patterns = {
|
||||||
alphanumeric: /^[\w\.-]+$/,
|
alphanumeric: /^[\w\.-]+$/,
|
||||||
uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
||||||
|
@ -24,7 +24,7 @@ export const jscolor = JSColor;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* wait until a page is loaded and ready for modification
|
* wait until a page is loaded and ready for modification
|
||||||
* @param {array} [selectors=[]] - wait for the existence of elements that match these css selectors
|
* @param {array} [selectors] - wait for the existence of elements that match these css selectors
|
||||||
* @returns {Promise} a promise that will resolve when the page is ready
|
* @returns {Promise} a promise that will resolve when the page is ready
|
||||||
*/
|
*/
|
||||||
export const whenReady = (selectors = []) => {
|
export const whenReady = (selectors = []) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user