Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

changes

thecodrra660803694b2
diff --git a/apps/web/package.json b/apps/web/package.json
index 52712d0a6..c913e4062 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -11,6 +11,7 @@
"@mdi/react": "^1.4.0",
"@notesnook/crypto": "^1.0.0",
"@notesnook/desktop": "file:desktop",
+ "@notesnook/theme": "file:../themeprovider",
"@rebass/forms": "^4.0.6",
"@streetwriters/tinymce-plugins": "^1.5.18",
"@tinymce/tinymce-react": "^3.13.0",
diff --git a/apps/web/src/components/dialogs/onboarding-dialog.js b/apps/web/src/components/dialogs/onboarding-dialog.js
index f61e9bcbf..51f3b4828 100644
--- a/apps/web/src/components/dialogs/onboarding-dialog.js
+++ b/apps/web/src/components/dialogs/onboarding-dialog.js
@@ -17,10 +17,10 @@ import { showBuyDialog } from "../../common/dialog-controller";
import { TaskManager } from "../../common/task-manager";
import { db } from "../../common/db";
import { usePersistentState } from "../../utils/hooks";
-import accents from "../../theme/accents";
import AccentItem from "../accent-item";
import { useCallback, useState } from "react";
import Config from "../../utils/config";
+import { getAllAccents } from "@notesnook/theme";
const newUserSteps = [
{
@@ -249,7 +249,7 @@ function AccentSelector() {
gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr",
}}
>
- {accents.map((color) => (
+ {getAllAccents().map((color) => (
<AccentItem key={color.code} code={color.code} label={color.label} />
))}
</Box>
diff --git a/apps/web/src/components/editor/header.js b/apps/web/src/components/editor/header.js
index 200637bc9..621361ef9 100644
--- a/apps/web/src/components/editor/header.js
+++ b/apps/web/src/components/editor/header.js
@@ -22,6 +22,7 @@ function Header({ readonly }) {
<>
<TitleBox
readonly={readonly}
+ placeholder={"Note title"}
title={title}
setTitle={(title) => {
const sessionId = store.get().session.id;
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx
index 3bb6d1a0d..ef492f453 100644
--- a/apps/web/src/components/editor/index.tsx
+++ b/apps/web/src/components/editor/index.tsx
@@ -282,7 +282,7 @@ function Editor({
px={[2, 2, 35]}
mt={[2, 2, 25]}
>
- <Header readonly={isReadonly} />
+ {/* <Header readonly={isReadonly} /> */}
{isSessionReady && (
<Suspense fallback={<div />}>
diff --git a/apps/web/src/components/editor/tinymce.js b/apps/web/src/components/editor/tinymce.js
index 7712d7cc3..089b26410 100644
--- a/apps/web/src/components/editor/tinymce.js
+++ b/apps/web/src/components/editor/tinymce.js
@@ -229,7 +229,7 @@ function TinyMCE(props) {
inline_boundaries_selector: "a[href]",
toolbar: simple
? false
- : `bold italic underline strikethrough inlinecode | fontselect | blockquote codeblock | fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent subscript superscript | numlist bullist checklist | forecolor backcolor removeformat | hr | image attachment media link table | ltr rtl | searchreplace`,
+ : `bold italic underline strikethrough inlinecode | fontselect | blockquote codeblock | fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent subscript superscript | numlist bullist checklist | forecolor backcolor removeformat | hr | image attachment media link table | ltr rtl | searchreplace`,
font_formats:
"Serif=serif; Classic=courier new; Monospace=courier; System font=Open Sans",
quickbars_selection_toolbar: false,
diff --git a/apps/web/src/components/editor/tiptap.css b/apps/web/src/components/editor/tiptap.css
index be82c1fd0..738e1a75a 100644
--- a/apps/web/src/components/editor/tiptap.css
+++ b/apps/web/src/components/editor/tiptap.css
@@ -6,6 +6,100 @@
pointer-events: none;
}
-/* .ProseMirror-focused .is-editor-empty::before {
- content: "";
-} */
+.ProseMirror {
+ color: var(--text);
+}
+
+.ProseMirror code:not(pre code) {
+ background-color: var(--bgSecondary);
+}
+
+.ProseMirror code:not(pre code) {
+ background-color: var(--bgSecondary);
+ border: 1px solid var(--border);
+ border-radius: 5px;
+ padding: 3px 5px 0px 5px;
+ font-family: ui-monospace, SFMono-Regular, SF Mono, Consolas, Liberation Mono,
+ Menlo, monospace !important;
+ font-size: 10pt !important;
+}
+
+.ProseMirror li p {
+ margin: 0px;
+}
+
+.ProseMirror li {
+ margin-bottom: 5px;
+}
+
+.ProseMirror a {
+ color: var(--primary);
+ cursor: pointer;
+}
+
+.ProseMirror a:hover {
+ filter: brightness(70%);
+}
+
+.ProseMirror {
+ position: relative;
+}
+.ProseMirror {
+ word-wrap: break-word;
+ white-space: pre-wrap;
+ white-space: break-spaces;
+ -webkit-font-variant-ligatures: none;
+ font-variant-ligatures: none;
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
+}
+.ProseMirror [contenteditable="false"] {
+ white-space: normal;
+}
+.ProseMirror [contenteditable="false"] [contenteditable="true"] {
+ white-space: pre-wrap;
+}
+.ProseMirror pre {
+ white-space: pre-wrap;
+}
+img.ProseMirror-separator {
+ display: inline !important;
+ border: none !important;
+ margin: 0 !important;
+ width: 1px !important;
+ height: 1px !important;
+}
+.ProseMirror-gapcursor {
+ display: none;
+ pointer-events: none;
+ position: absolute;
+ margin: 0;
+}
+.ProseMirror-gapcursor:after {
+ content: "";
+ display: block;
+ position: absolute;
+ top: -2px;
+ width: 20px;
+ border-top: 1px solid var(--text);
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
+}
+@keyframes ProseMirror-cursor-blink {
+ to {
+ visibility: hidden;
+ }
+}
+.ProseMirror-hideselection *::selection {
+ background: transparent;
+}
+.ProseMirror-hideselection *::-moz-selection {
+ background: transparent;
+}
+.ProseMirror-hideselection * {
+ caret-color: transparent;
+}
+.ProseMirror-focused .ProseMirror-gapcursor {
+ display: block;
+}
+.tippy-box[data-animation="fade"][data-state="hidden"] {
+ opacity: 0;
+}
diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsx
index 0bc9a6496..4dd9fc175 100644
--- a/apps/web/src/components/editor/tiptap.tsx
+++ b/apps/web/src/components/editor/tiptap.tsx
@@ -1,6 +1,7 @@
import { EditorContent, HTMLContent } from "@tiptap/react";
-import { useTiptap } from "notesnook-editor";
-import { useEffect } from "react";
+import { Toolbar, useTiptap } from "notesnook-editor";
+import { Box } from "rebass";
+import { useStore as useThemeStore } from "../../stores/theme-store";
export type CharacterCounter = {
words: () => number;
@@ -21,6 +22,9 @@ type TipTapProps = {
};
function TipTap(props: TipTapProps) {
+ const theme = useThemeStore((store) => store.theme);
+ const accent = useThemeStore((store) => store.accent);
+
const { onInit, onChange, onFocus, onDestroy } = props;
let counter: CharacterCounter | undefined;
const editor = useTiptap(
@@ -28,7 +32,6 @@ function TipTap(props: TipTapProps) {
autofocus: "start",
onFocus,
onCreate: ({ editor }) => {
- console.log("CREATING NEW EDITOR");
counter = editor.storage.characterCount as CharacterCounter;
if (onInit)
onInit({
@@ -36,6 +39,7 @@ function TipTap(props: TipTapProps) {
setContent: (content) => {
editor.commands.clearContent(false);
editor.commands.setContent(content, false);
+ console.log("SETTING CONTENT", content);
},
clearContent: () => editor.commands.clearContent(false),
});
@@ -44,18 +48,25 @@ function TipTap(props: TipTapProps) {
if (onChange) onChange(editor.getHTML(), counter);
},
onDestroy,
+ injectCSS: false,
+ theme,
+ accent,
+ scale: 1,
},
- []
+ [theme, accent]
);
return (
- <EditorContent
- style={{ flex: 1, cursor: "text" }}
- onClick={() => {
- editor?.commands.focus();
- }}
- editor={editor}
- />
+ <Box>
+ <Toolbar editor={editor} theme={theme} accent={accent} />
+ <EditorContent
+ style={{ flex: 1, cursor: "text" }}
+ onClick={() => {
+ editor?.commands.focus();
+ }}
+ editor={editor}
+ />
+ </Box>
);
}
export default TipTap;
diff --git a/apps/web/src/components/editor/titlebox.js b/apps/web/src/components/editor/titlebox.js
index a08c3ffde..a2fe2876d 100644
--- a/apps/web/src/components/editor/titlebox.js
+++ b/apps/web/src/components/editor/titlebox.js
@@ -3,7 +3,7 @@ import { Text, Flex } from "rebass";
import { Input } from "@rebass/forms";
function TitleBox(props) {
- const { title, setTitle, shouldFocus, readonly } = props;
+ const { title, setTitle, shouldFocus, readonly, placeholder } = props;
const [height, setHeight] = useState(0);
const inputRef = useRef();
@@ -54,7 +54,7 @@ function TitleBox(props) {
data-test-id="editor-title"
className="editorTitle"
autoFocus={shouldFocus}
- placeholder="Note title"
+ placeholder={placeholder}
as="textarea"
width="100%"
minHeight={[30, 30, 60]}
@@ -85,6 +85,7 @@ export default React.memo(TitleBox, (prevProps, nextProps) => {
return (
prevProps.shouldFocus === nextProps.shouldFocus &&
prevProps.title === nextProps.title &&
- prevProps.readonly === nextProps.readonly
+ prevProps.readonly === nextProps.readonly &&
+ prevProps.placeholder === nextProps.placeholder
);
});
diff --git a/apps/web/src/components/editor/toolbar.js b/apps/web/src/components/editor/toolbar.js
index f66309dd6..5466ad21c 100644
--- a/apps/web/src/components/editor/toolbar.js
+++ b/apps/web/src/components/editor/toolbar.js
@@ -40,12 +40,12 @@ function Toolbar(props) {
if (!editorScroll) return;
function onScroll(e) {
- const headerOffset = document.querySelector(".editorTitle").scrollHeight;
- const hideOffset = headerOffset + 60;
- if (e.target.scrollTop > hideOffset && !isTitleVisible)
- setIsTitleVisible(true);
- else if (e.target.scrollTop <= hideOffset && isTitleVisible)
- setIsTitleVisible(false);
+ // const headerOffset = document.querySelector(".editorTitle").scrollHeight;
+ // const hideOffset = headerOffset + 60;
+ // if (e.target.scrollTop > hideOffset && !isTitleVisible)
+ // setIsTitleVisible(true);
+ // else if (e.target.scrollTop <= hideOffset && isTitleVisible)
+ // setIsTitleVisible(false);
}
editorScroll.addEventListener("scroll", onScroll);
return () => {
diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.js
index 9b93262ec..50c9da5b5 100644
--- a/apps/web/src/components/icons/index.js
+++ b/apps/web/src/components/icons/index.js
@@ -159,6 +159,7 @@ import { AnimatedFlex } from "../animated";
function Icon({ title, name, size = 24, color = "icon", stroke, rotate }) {
const theme = useTheme();
+
return (
<MDIIcon
title={title}
diff --git a/apps/web/src/components/theme-provider/index.js b/apps/web/src/components/theme-provider/index.js
index 8c4c48240..d05e5491d 100644
--- a/apps/web/src/components/theme-provider/index.js
+++ b/apps/web/src/components/theme-provider/index.js
@@ -1,28 +1,18 @@
-import React from "react";
-import { ThemeProvider as EmotionThemeProvider } from "emotion-theming";
import { useStore } from "../../stores/theme-store";
-import ThemeFactory from "../../theme";
-import { injectCss } from "../../utils/css";
-
-const factory = new ThemeFactory();
+import { ThemeProvider as EmotionThemeProvider } from "emotion-theming";
+import { useTheme } from "@notesnook/theme";
-function ThemeProvider(props) {
- const themeType = useStore((store) => store.theme);
+function ThemeProviderWrapper(props) {
+ const theme = useStore((store) => store.theme);
const accent = useStore((store) => store.accent);
-
- const theme = factory.construct({
- theme: themeType,
- accent,
- scale: 1,
- });
- injectCss(factory.transform("css", theme));
+ const themeProperties = useTheme({ accent, theme });
return (
- <EmotionThemeProvider theme={theme}>
+ <EmotionThemeProvider theme={themeProperties}>
{props.children instanceof Function
- ? props.children(theme)
+ ? props.children(themeProperties)
: props.children}
</EmotionThemeProvider>
);
}
-export default ThemeProvider;
+export default ThemeProviderWrapper;
diff --git a/apps/web/src/stores/theme-store.js b/apps/web/src/stores/theme-store.js
index 4d358a088..d1f4afd32 100644
--- a/apps/web/src/stores/theme-store.js
+++ b/apps/web/src/stores/theme-store.js
@@ -1,8 +1,8 @@
import createStore from "../common/store";
import BaseStore from "./index";
import Config from "../utils/config";
-import { getDefaultAccentColor } from "../theme/accents";
import changeAppTheme from "../commands/change-app-theme";
+import { getDefaultAccentColor } from "@notesnook/theme";
class ThemeStore extends BaseStore {
theme = Config.get("theme", "light");
diff --git a/apps/web/src/theme/accents.js b/apps/web/src/theme/accents.js
deleted file mode 100644
index 782080956..000000000
--- a/apps/web/src/theme/accents.js
+++ /dev/null
@@ -1,20 +0,0 @@
-const accents = [
- { label: "orange", code: "#FF5722" },
- { label: "yellow", code: "#FFA000" },
- { label: "green", code: "#1B5E20" },
- { label: "green2", code: "#008837" },
- { label: "gray", code: "#757575" },
- { label: "blue", code: "#0560ff" },
- { label: "teal", code: "#009688" },
- { label: "lightblue", code: "#2196F3" },
- { label: "indigo", code: "#880E4F" },
- { label: "purple", code: "#9C27B0" },
- { label: "pink", code: "#FF1744" },
- { label: "red", code: "#B71C1C" },
-];
-
-export function getDefaultAccentColor() {
- return accents.find((a) => a.label === "green2").code;
-}
-
-export default accents;
diff --git a/apps/web/src/theme/colorscheme/dark.js b/apps/web/src/theme/colorscheme/dark.js
deleted file mode 100644
index 09d0158dc..000000000
--- a/apps/web/src/theme/colorscheme/dark.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import { hexToRGB } from "../../utils/color";
-import StaticColorSchemeFactory from "./static";
-
-class DarkColorSchemeFactory {
- constructor(accent) {
- return {
- primary: accent,
- placeholder: hexToRGB("#ffffff", 0.6),
- background: "#1b1b1b",
- bgTransparent: "#1f1f1f99",
- accent: "#000",
- bgSecondary: "#2b2b2b",
- bgSecondaryText: "#A1A1A1",
- border: "#353535",
- hover: "#2f2f2f",
- fontSecondary: "#000",
- fontTertiary: "#A1A1A1",
- text: "#d3d3d3",
- overlay: "rgba(53, 53, 53, 0.5)",
- secondary: "black",
- icon: "#dbdbdb",
- disabled: "#5b5b5b",
- ...new StaticColorSchemeFactory(accent),
-
- // COLORS
- red: "#f44336",
- orange: "#FF9800",
- yellow: "#FFD600",
- green: "#4CAF50",
- blue: "#2196F3",
- purple: "#9568ED",
- gray: "#9E9E9E",
- };
- }
-}
-export default DarkColorSchemeFactory;
diff --git a/apps/web/src/theme/colorscheme/index.js b/apps/web/src/theme/colorscheme/index.js
deleted file mode 100644
index 252386e62..000000000
--- a/apps/web/src/theme/colorscheme/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import DarkColorSchemeFactory from "./dark";
-import LightColorSchemeFactory from "./light";
-
-const colorSchemes = {
- dark: DarkColorSchemeFactory,
- light: LightColorSchemeFactory
-};
-
-class ColorSchemeFactory {
- constructor(theme, accent) {
- return new colorSchemes[theme](accent);
- }
-}
-export default ColorSchemeFactory;
diff --git a/apps/web/src/theme/colorscheme/light.js b/apps/web/src/theme/colorscheme/light.js
deleted file mode 100644
index 88622f1f8..000000000
--- a/apps/web/src/theme/colorscheme/light.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import { hexToRGB } from "../../utils/color";
-import StaticColorSchemeFactory from "./static";
-
-class LightColorSchemeFactory {
- constructor(accent) {
- return {
- primary: accent,
- background: "white",
- bgTransparent: "#ffffff99",
- accent: "white",
- bgSecondary: "#f7f7f7",
- bgSecondaryText: "#5E5E5E",
- border: "#e5e5e5",
- hover: "#f0f0f0",
- fontSecondary: "white",
- fontTertiary: "#656565",
- text: "#202124",
- overlay: "rgba(0, 0, 0, 0.1)",
- secondary: "white",
- icon: "#3b3b3b",
- disabled: "#9b9b9b",
- placeholder: hexToRGB("#000000", 0.6),
- ...new StaticColorSchemeFactory(accent),
-
- // COLORS
- // red: "#D93B30",
- // orange: "#C75301",
- // yellow: "#AC660D",
- // green: "#4CAF50",
- // blue: "#197AC7",
- // purple: "#673AB7",
- // gray: "#777777",
-
- red: "#f44336",
- orange: "#FF9800",
- yellow: "#f0c800",
- green: "#4CAF50",
- blue: "#2196F3",
- purple: "#9568ED",
- gray: "#9E9E9E",
- };
- }
-}
-export default LightColorSchemeFactory;
diff --git a/apps/web/src/theme/colorscheme/static.js b/apps/web/src/theme/colorscheme/static.js
deleted file mode 100644
index 084c74e85..000000000
--- a/apps/web/src/theme/colorscheme/static.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import { hexToRGB } from "../../utils/color";
-
-class StaticColorSchemeFactory {
- constructor(accent) {
- return {
- shade: hexToRGB(accent, 0.1),
- textSelection: hexToRGB(accent, 0.2),
- dimPrimary: hexToRGB(accent, 0.7),
- transparent: "transparent",
- static: "white",
- error: "#E53935",
- errorBg: "#E5393520",
- success: "#4F8A10",
- warn: "#FF5722",
- warnBg: "#FF572220",
- favorite: "#ffd700",
- };
- }
-}
-export default StaticColorSchemeFactory;
diff --git a/apps/web/src/theme/font/fontsize.js b/apps/web/src/theme/font/fontsize.js
deleted file mode 100644
index c70a7799c..000000000
--- a/apps/web/src/theme/font/fontsize.js
+++ /dev/null
@@ -1,15 +0,0 @@
-class FontSizeFactory {
- constructor() {
- return {
- heading: "1.5rem",
- subheading: "1.2rem",
- input: "0.875rem",
- title: "0.95rem",
- subtitle: "0.85rem",
- body: "0.8rem",
- menu: "0.8rem",
- subBody: "0.750rem",
- };
- }
-}
-export default FontSizeFactory;
diff --git a/apps/web/src/theme/font/index.js b/apps/web/src/theme/font/index.js
deleted file mode 100644
index 5fa2f1d69..000000000
--- a/apps/web/src/theme/font/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import FontSizeFactory from "./fontsize";
-
-class FontFactory {
- constructor(scale) {
- return {
- fontSizes: new FontSizeFactory(scale),
- fontWeights: {
- normal: 400,
- body: 400,
- heading: 600,
- bold: 600,
- },
- fonts: {
- body: `Open Sans,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Oxygen-Sans,Ubuntu,Cantarell,sans-serif;`,
- heading: `Open Sans,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Oxygen-Sans,Ubuntu,Cantarell,sans-serif;`,
- },
- };
- }
-}
-export default FontFactory;
diff --git a/apps/web/src/theme/index.js b/apps/web/src/theme/index.js
deleted file mode 100644
index d0a748def..000000000
--- a/apps/web/src/theme/index.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import ColorSchemeFactory from "./colorscheme";
-import VariantsFactory from "./variants";
-import FontFactory from "./font";
-import TransformerFactory from "./transformer";
-
-class ThemeFactory {
- transform(type, theme) {
- const factory = new TransformerFactory();
- return factory.construct(type, theme);
- }
-
- construct(config) {
- return {
- breakpoints: ["480px", "1000px", "1000px"],
- space: [0, 5, 10, 15, 20, 25, 30, 35],
- sizes: { full: "100%", half: "50%" },
- radii: { none: 0, default: 5, dialog: 10 },
- colors: new ColorSchemeFactory(config.theme, config.accent),
- ...new FontFactory(config.scale),
- ...new VariantsFactory(),
- };
- }
-}
-
-export default ThemeFactory;
diff --git a/apps/web/src/theme/transformer/css.js b/apps/web/src/theme/transformer/css.js
deleted file mode 100644
index 71588bea3..000000000
--- a/apps/web/src/theme/transformer/css.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function transform(theme) {
- let root = ":root {";
- for (let color in theme.colors) {
- root += `--${color}: ${theme.colors[color]};`;
- }
- return root + "}";
-}
-export default transform;
diff --git a/apps/web/src/theme/transformer/index.js b/apps/web/src/theme/transformer/index.js
deleted file mode 100644
index b8b829b00..000000000
--- a/apps/web/src/theme/transformer/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import css from "./css";
-
-const transformers = {
- css: css
-};
-
-class TransformerFactory {
- construct(type, theme) {
- return transformers[type](theme);
- }
-}
-export default TransformerFactory;
diff --git a/apps/web/src/theme/variants/button.js b/apps/web/src/theme/variants/button.js
deleted file mode 100644
index 155c61a06..000000000
--- a/apps/web/src/theme/variants/button.js
+++ /dev/null
@@ -1,201 +0,0 @@
-class ButtonFactory {
- constructor() {
- return {
- default: new Default(),
- primary: new Primary(),
- secondary: new Secondary(),
- tertiary: new Tertiary(),
- list: new List(),
- anchor: new Anchor(),
- tool: new Tool(),
- icon: new Icon(),
- dialog: new Dialog(),
- statusitem: new StatusItem(),
- menuitem: new MenuItem(),
- };
- }
-}
-export default ButtonFactory;
-
-class Default {
- constructor() {
- return {
- bg: "transparent",
- fontFamily: "body",
- fontWeight: "body",
- fontSize: "body",
- borderRadius: "default",
- cursor: "pointer",
- p: 2,
- py: "7.5px",
- transition: "filter 200ms ease-in, box-shadow 200ms ease-out",
- ":hover:not(:disabled)": {
- filter: "brightness(90%)",
- },
- ":active": {
- filter: "brightness(98%)",
- },
- outline: "none",
- ":focus-visible:not(:active)": {
- filter: "brightness(90%)",
- bg: "bgSecondary",
- },
- ":disabled": {
- opacity: 0.5,
- cursor: "not-allowed",
- },
- };
- }
-}
-
-class Primary {
- constructor() {
- return {
- variant: "buttons.default",
- color: "static",
- bg: "primary",
- };
- }
-}
-
-class Dialog {
- constructor() {
- return {
- variant: "buttons.primary",
- color: "primary",
- fontWeight: "bold",
- bg: "transparent",
- ":hover": { bg: "bgSecondary" },
- ":focus:not(:active), :focus-within:not(:active), :focus-visible:not(:active)":
- {
- bg: "hover",
- filter: "brightness(90%)",
- },
- ":disabled": {
- opacity: 0.7,
- cursor: "not-allowed",
- },
- };
- }
-}
-
-class Secondary {
- constructor() {
- return {
- variant: "buttons.default",
- color: "text",
- bg: "border",
- };
- }
-}
-
-class Tertiary {
- constructor() {
- return {
- variant: "buttons.default",
- color: "text",
- bg: "transparent",
- border: "2px solid",
- borderColor: "border",
- ":hover": {
- borderColor: "primary",
- },
- };
- }
-}
-
-class List {
- constructor() {
- return {
- variant: "buttons.tertiary",
- border: "0px solid",
- borderBottom: "1px solid",
- borderBottomColor: "border",
- borderRadius: 0,
- textAlign: "left",
- py: 2,
- px: 0,
- cursor: "pointer",
- ":hover": {
- borderBottomColor: "primary",
- },
- };
- }
-}
-
-class Anchor {
- constructor() {
- return {
- variant: "buttons.default",
- color: "primary",
- fontSize: "subBody",
- p: 0,
- m: 0,
- px: 0,
- py: 0,
- ":hover": {
- textDecoration: "underline",
- },
- };
- }
-}
-
-class Icon {
- constructor() {
- return {
- variant: "buttons.default",
- color: "text",
- borderRadius: "none",
- ":hover": {
- backgroundColor: "hover",
- filter: "brightness(90%)",
- },
- };
- }
-}
-
-class Tool {
- constructor() {
- return {
- variant: "buttons.default",
- color: "text",
- backgroundColor: "bgSecondary",
- borderRadius: "default",
- ":hover": {
- backgroundColor: "hover",
- },
- };
- }
-}
-
-class StatusItem {
- constructor() {
- return {
- variant: "buttons.icon",
- p: 0,
- py: 1,
- px: 1,
- };
- }
-}
-
-class MenuItem {
- constructor() {
- return {
- variant: "buttons.default",
- // bg: "transparent",
- py: "8px",
- px: 3,
- borderRadius: 0,
- color: "text",
- cursor: "pointer",
- ":hover:not(:disabled),:focus:not(:disabled)": {
- backgroundColor: "hover",
- boxShadow: "none",
- },
- ":active:not(:disabled)": {
- backgroundColor: "border",
- },
- };
- }
-}
diff --git a/apps/web/src/theme/variants/flex.js b/apps/web/src/theme/variants/flex.js
deleted file mode 100644
index 05710aa7f..000000000
--- a/apps/web/src/theme/variants/flex.js
+++ /dev/null
@@ -1,44 +0,0 @@
-class FlexFactory {
- constructor(direction) {
- const variants = {
- Center: new Center(direction),
- Fill: new Fill(direction),
- CenterFill: new CenterFill(direction)
- };
- return Object.fromEntries(
- Object.entries(variants).map(([key, value]) => {
- return [`${direction}${key}`, value];
- })
- );
- }
-}
-export default FlexFactory;
-
-class Center {
- constructor(direction) {
- return {
- justifyContent: "center",
- alignItems: "center",
- flexDirection: direction
- };
- }
-}
-
-class Fill {
- constructor(direction) {
- return {
- flex: "1 1 auto",
- flexDirection: direction
- };
- }
-}
-
-class CenterFill {
- constructor(direction) {
- return {
- variant: `variants.${direction}Center`,
- flex: "1 1 auto",
- flexDirection: direction
- };
- }
-}
diff --git a/apps/web/src/theme/variants/index.js b/apps/web/src/theme/variants/index.js
deleted file mode 100644
index c7bff13dc..000000000
--- a/apps/web/src/theme/variants/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import ButtonFactory from "./button";
-import InputFactory from "./input";
-import TextFactory from "./text";
-import FlexFactory from "./flex";
-
-class VariantFactory {
- constructor() {
- return {
- buttons: new ButtonFactory(),
- forms: new InputFactory(),
- text: new TextFactory(),
- variants: {
- ...new FlexFactory("row"),
- ...new FlexFactory("column")
- }
- };
- }
-}
-export default VariantFactory;
diff --git a/apps/web/src/theme/variants/input.js b/apps/web/src/theme/variants/input.js
deleted file mode 100644
index 77d2b7ccb..000000000
--- a/apps/web/src/theme/variants/input.js
+++ /dev/null
@@ -1,64 +0,0 @@
-class InputFactory {
- constructor() {
- return {
- input: new Default(),
- error: new Error(),
- clean: new Clean(),
- };
- }
-}
-export default InputFactory;
-
-class Default {
- constructor() {
- return {
- borderRadius: "default",
- border: "none",
- // borderColor: "border",
- boxShadow: "0px 0px 0px 1px var(--border) inset",
- fontFamily: "body",
- fontWeight: "body",
- fontSize: "input",
- color: "text",
- outline: "none",
- ":focus": {
- boxShadow: "0px 0px 0px 1.5px var(--primary) inset",
- },
- ":hover:not(:focus)": {
- boxShadow: "0px 0px 0px 1px var(--dimPrimary) inset",
- },
- };
- }
-}
-
-class Clean {
- constructor() {
- return {
- variant: "forms.input",
- outline: "none",
- boxShadow: "none",
- ":focus": {
- boxShadow: "none",
- },
- ":hover:not(:focus)": {
- boxShadow: "none",
- },
- };
- }
-}
-
-class Error {
- constructor() {
- return {
- variant: "forms.input",
- boxShadow: "0px 0px 0px 1px var(--error) inset",
- outline: "none",
- ":focus": {
- boxShadow: "0px 0px 0px 1.5px var(--error) inset",
- },
- ":hover:not(:focus)": {
- boxShadow: "0px 0px 0px 1px var(--error) inset",
- },
- };
- }
-}
diff --git a/apps/web/src/theme/variants/text.js b/apps/web/src/theme/variants/text.js
deleted file mode 100644
index 5c058ad74..000000000
--- a/apps/web/src/theme/variants/text.js
+++ /dev/null
@@ -1,75 +0,0 @@
-class TextFactory {
- constructor() {
- return {
- default: new Default(),
- heading: new Heading(),
- title: new Title(),
- subtitle: new Subtitle(),
- body: new Body(),
- subBody: new SubBody(),
- error: new Error(),
- };
- }
-}
-export default TextFactory;
-
-class Default {
- constructor() {
- return {
- color: "text",
- fontFamily: "body",
- };
- }
-}
-
-class Heading {
- constructor() {
- return {
- variant: "text.default",
- fontFamily: "heading",
- fontWeight: "bold",
- fontSize: "heading",
- };
- }
-}
-
-class Title {
- constructor() {
- return {
- variant: "text.heading",
- fontSize: "title",
- fontWeight: "bold",
- };
- }
-}
-class Subtitle {
- constructor() {
- return {
- variant: "text.heading",
- fontSize: "subtitle",
- fontWeight: "bold",
- };
- }
-}
-
-class Body {
- constructor() {
- return { variant: "text.default", fontSize: "body" };
- }
-}
-
-class SubBody {
- constructor() {
- return {
- variant: "text.default",
- fontSize: "subBody",
- color: "fontTertiary",
- };
- }
-}
-
-class Error {
- constructor() {
- return { variant: "text.default", fontSize: "subBody", color: "error" };
- }
-}
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 849d78184..5c3eedac9 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -7,7 +7,6 @@ import { useStore as useThemeStore } from "../stores/theme-store";
import { useStore as useSettingStore } from "../stores/setting-store";
import { useStore as useAppStore } from "../stores/app-store";
import AccentItem from "../components/accent-item";
-import accents from "../theme/accents";
import {
showEmailVerificationDialog,
showImportDialog,
@@ -44,6 +43,7 @@ import useZoomFactor from "../hooks/use-zoom-factor";
import debounce from "just-debounce-it";
import { PATHS } from "@notesnook/desktop/paths";
import { openPath } from "../commands/open";
+import { getAllAccents } from "@notesnook/theme";
function subscriptionStatusToString(user) {
const status = user?.subscription?.type;
@@ -367,7 +367,7 @@ function Settings(props) {
borderRadius: "default",
}}
>
- {accents.map((color) => (
+ {getAllAccents().map((color) => (
<AccentItem
key={color.code}
code={color.code}