diff --git a/public/font/hack/hack-bold.woff b/assets/font/hack/hack-bold.woff
similarity index 100%
rename from public/font/hack/hack-bold.woff
rename to assets/font/hack/hack-bold.woff
diff --git a/public/font/hack/hack-bold.woff2 b/assets/font/hack/hack-bold.woff2
similarity index 100%
rename from public/font/hack/hack-bold.woff2
rename to assets/font/hack/hack-bold.woff2
diff --git a/public/font/hack/hack-bolditalic.woff b/assets/font/hack/hack-bolditalic.woff
similarity index 100%
rename from public/font/hack/hack-bolditalic.woff
rename to assets/font/hack/hack-bolditalic.woff
diff --git a/public/font/hack/hack-bolditalic.woff2 b/assets/font/hack/hack-bolditalic.woff2
similarity index 100%
rename from public/font/hack/hack-bolditalic.woff2
rename to assets/font/hack/hack-bolditalic.woff2
diff --git a/public/font/hack/hack-italic.woff b/assets/font/hack/hack-italic.woff
similarity index 100%
rename from public/font/hack/hack-italic.woff
rename to assets/font/hack/hack-italic.woff
diff --git a/public/font/hack/hack-italic.woff2 b/assets/font/hack/hack-italic.woff2
similarity index 100%
rename from public/font/hack/hack-italic.woff2
rename to assets/font/hack/hack-italic.woff2
diff --git a/public/font/hack/hack-regular.woff b/assets/font/hack/hack-regular.woff
similarity index 100%
rename from public/font/hack/hack-regular.woff
rename to assets/font/hack/hack-regular.woff
diff --git a/public/font/hack/hack-regular.woff2 b/assets/font/hack/hack-regular.woff2
similarity index 100%
rename from public/font/hack/hack-regular.woff2
rename to assets/font/hack/hack-regular.woff2
diff --git a/public/font/open-sans/fonts/Bold/OpenSans-Bold.woff b/assets/font/open-sans/fonts/Bold/OpenSans-Bold.woff
similarity index 100%
rename from public/font/open-sans/fonts/Bold/OpenSans-Bold.woff
rename to assets/font/open-sans/fonts/Bold/OpenSans-Bold.woff
diff --git a/public/font/open-sans/fonts/Bold/OpenSans-Bold.woff2 b/assets/font/open-sans/fonts/Bold/OpenSans-Bold.woff2
similarity index 100%
rename from public/font/open-sans/fonts/Bold/OpenSans-Bold.woff2
rename to assets/font/open-sans/fonts/Bold/OpenSans-Bold.woff2
diff --git a/public/font/open-sans/fonts/BoldItalic/OpenSans-BoldItalic.woff b/assets/font/open-sans/fonts/BoldItalic/OpenSans-BoldItalic.woff
similarity index 100%
rename from public/font/open-sans/fonts/BoldItalic/OpenSans-BoldItalic.woff
rename to assets/font/open-sans/fonts/BoldItalic/OpenSans-BoldItalic.woff
diff --git a/public/font/open-sans/fonts/BoldItalic/OpenSans-BoldItalic.woff2 b/assets/font/open-sans/fonts/BoldItalic/OpenSans-BoldItalic.woff2
similarity index 100%
rename from public/font/open-sans/fonts/BoldItalic/OpenSans-BoldItalic.woff2
rename to assets/font/open-sans/fonts/BoldItalic/OpenSans-BoldItalic.woff2
diff --git a/public/font/open-sans/fonts/ExtraBold/OpenSans-ExtraBold.woff b/assets/font/open-sans/fonts/ExtraBold/OpenSans-ExtraBold.woff
similarity index 100%
rename from public/font/open-sans/fonts/ExtraBold/OpenSans-ExtraBold.woff
rename to assets/font/open-sans/fonts/ExtraBold/OpenSans-ExtraBold.woff
diff --git a/public/font/open-sans/fonts/ExtraBold/OpenSans-ExtraBold.woff2 b/assets/font/open-sans/fonts/ExtraBold/OpenSans-ExtraBold.woff2
similarity index 100%
rename from public/font/open-sans/fonts/ExtraBold/OpenSans-ExtraBold.woff2
rename to assets/font/open-sans/fonts/ExtraBold/OpenSans-ExtraBold.woff2
diff --git a/public/font/open-sans/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff b/assets/font/open-sans/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff
similarity index 100%
rename from public/font/open-sans/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff
rename to assets/font/open-sans/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff
diff --git a/public/font/open-sans/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff2 b/assets/font/open-sans/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff2
similarity index 100%
rename from public/font/open-sans/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff2
rename to assets/font/open-sans/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff2
diff --git a/public/font/open-sans/fonts/Italic/OpenSans-Italic.woff b/assets/font/open-sans/fonts/Italic/OpenSans-Italic.woff
similarity index 100%
rename from public/font/open-sans/fonts/Italic/OpenSans-Italic.woff
rename to assets/font/open-sans/fonts/Italic/OpenSans-Italic.woff
diff --git a/public/font/open-sans/fonts/Italic/OpenSans-Italic.woff2 b/assets/font/open-sans/fonts/Italic/OpenSans-Italic.woff2
similarity index 100%
rename from public/font/open-sans/fonts/Italic/OpenSans-Italic.woff2
rename to assets/font/open-sans/fonts/Italic/OpenSans-Italic.woff2
diff --git a/public/font/open-sans/fonts/Light/OpenSans-Light.woff b/assets/font/open-sans/fonts/Light/OpenSans-Light.woff
similarity index 100%
rename from public/font/open-sans/fonts/Light/OpenSans-Light.woff
rename to assets/font/open-sans/fonts/Light/OpenSans-Light.woff
diff --git a/public/font/open-sans/fonts/Light/OpenSans-Light.woff2 b/assets/font/open-sans/fonts/Light/OpenSans-Light.woff2
similarity index 100%
rename from public/font/open-sans/fonts/Light/OpenSans-Light.woff2
rename to assets/font/open-sans/fonts/Light/OpenSans-Light.woff2
diff --git a/public/font/open-sans/fonts/LightItalic/OpenSans-LightItalic.woff b/assets/font/open-sans/fonts/LightItalic/OpenSans-LightItalic.woff
similarity index 100%
rename from public/font/open-sans/fonts/LightItalic/OpenSans-LightItalic.woff
rename to assets/font/open-sans/fonts/LightItalic/OpenSans-LightItalic.woff
diff --git a/public/font/open-sans/fonts/LightItalic/OpenSans-LightItalic.woff2 b/assets/font/open-sans/fonts/LightItalic/OpenSans-LightItalic.woff2
similarity index 100%
rename from public/font/open-sans/fonts/LightItalic/OpenSans-LightItalic.woff2
rename to assets/font/open-sans/fonts/LightItalic/OpenSans-LightItalic.woff2
diff --git a/public/font/open-sans/fonts/Regular/OpenSans-Regular.woff b/assets/font/open-sans/fonts/Regular/OpenSans-Regular.woff
similarity index 100%
rename from public/font/open-sans/fonts/Regular/OpenSans-Regular.woff
rename to assets/font/open-sans/fonts/Regular/OpenSans-Regular.woff
diff --git a/public/font/open-sans/fonts/Regular/OpenSans-Regular.woff2 b/assets/font/open-sans/fonts/Regular/OpenSans-Regular.woff2
similarity index 100%
rename from public/font/open-sans/fonts/Regular/OpenSans-Regular.woff2
rename to assets/font/open-sans/fonts/Regular/OpenSans-Regular.woff2
diff --git a/public/font/open-sans/fonts/Semibold/OpenSans-Semibold.woff b/assets/font/open-sans/fonts/Semibold/OpenSans-Semibold.woff
similarity index 100%
rename from public/font/open-sans/fonts/Semibold/OpenSans-Semibold.woff
rename to assets/font/open-sans/fonts/Semibold/OpenSans-Semibold.woff
diff --git a/public/font/open-sans/fonts/Semibold/OpenSans-Semibold.woff2 b/assets/font/open-sans/fonts/Semibold/OpenSans-Semibold.woff2
similarity index 100%
rename from public/font/open-sans/fonts/Semibold/OpenSans-Semibold.woff2
rename to assets/font/open-sans/fonts/Semibold/OpenSans-Semibold.woff2
diff --git a/public/font/open-sans/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff b/assets/font/open-sans/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff
similarity index 100%
rename from public/font/open-sans/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff
rename to assets/font/open-sans/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff
diff --git a/public/font/open-sans/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff2 b/assets/font/open-sans/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff2
similarity index 100%
rename from public/font/open-sans/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff2
rename to assets/font/open-sans/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff2
diff --git a/public/font/open-sans/open-sans.scss b/assets/font/open-sans/open-sans.scss
similarity index 100%
rename from public/font/open-sans/open-sans.scss
rename to assets/font/open-sans/open-sans.scss
diff --git a/public/font/open-sans/sass/.gitignore b/assets/font/open-sans/sass/.gitignore
similarity index 100%
rename from public/font/open-sans/sass/.gitignore
rename to assets/font/open-sans/sass/.gitignore
diff --git a/public/font/open-sans/sass/_Bold.scss b/assets/font/open-sans/sass/_Bold.scss
similarity index 100%
rename from public/font/open-sans/sass/_Bold.scss
rename to assets/font/open-sans/sass/_Bold.scss
diff --git a/public/font/open-sans/sass/_BoldItalic.scss b/assets/font/open-sans/sass/_BoldItalic.scss
similarity index 100%
rename from public/font/open-sans/sass/_BoldItalic.scss
rename to assets/font/open-sans/sass/_BoldItalic.scss
diff --git a/public/font/open-sans/sass/_ExtraBold.scss b/assets/font/open-sans/sass/_ExtraBold.scss
similarity index 100%
rename from public/font/open-sans/sass/_ExtraBold.scss
rename to assets/font/open-sans/sass/_ExtraBold.scss
diff --git a/public/font/open-sans/sass/_ExtraBoldItalic.scss b/assets/font/open-sans/sass/_ExtraBoldItalic.scss
similarity index 100%
rename from public/font/open-sans/sass/_ExtraBoldItalic.scss
rename to assets/font/open-sans/sass/_ExtraBoldItalic.scss
diff --git a/public/font/open-sans/sass/_Italic.scss b/assets/font/open-sans/sass/_Italic.scss
similarity index 100%
rename from public/font/open-sans/sass/_Italic.scss
rename to assets/font/open-sans/sass/_Italic.scss
diff --git a/public/font/open-sans/sass/_Light.scss b/assets/font/open-sans/sass/_Light.scss
similarity index 100%
rename from public/font/open-sans/sass/_Light.scss
rename to assets/font/open-sans/sass/_Light.scss
diff --git a/public/font/open-sans/sass/_LightItalic.scss b/assets/font/open-sans/sass/_LightItalic.scss
similarity index 100%
rename from public/font/open-sans/sass/_LightItalic.scss
rename to assets/font/open-sans/sass/_LightItalic.scss
diff --git a/public/font/open-sans/sass/_Regular.scss b/assets/font/open-sans/sass/_Regular.scss
similarity index 100%
rename from public/font/open-sans/sass/_Regular.scss
rename to assets/font/open-sans/sass/_Regular.scss
diff --git a/public/font/open-sans/sass/_Semibold.scss b/assets/font/open-sans/sass/_Semibold.scss
similarity index 100%
rename from public/font/open-sans/sass/_Semibold.scss
rename to assets/font/open-sans/sass/_Semibold.scss
diff --git a/public/font/open-sans/sass/_SemiboldItalic.scss b/assets/font/open-sans/sass/_SemiboldItalic.scss
similarity index 100%
rename from public/font/open-sans/sass/_SemiboldItalic.scss
rename to assets/font/open-sans/sass/_SemiboldItalic.scss
diff --git a/public/font/open-sans/sass/_mixins.scss b/assets/font/open-sans/sass/_mixins.scss
similarity index 100%
rename from public/font/open-sans/sass/_mixins.scss
rename to assets/font/open-sans/sass/_mixins.scss
diff --git a/assets/font/open-sans/sass/_variables.scss b/assets/font/open-sans/sass/_variables.scss
new file mode 100755
index 0000000..59462d2
--- /dev/null
+++ b/assets/font/open-sans/sass/_variables.scss
@@ -0,0 +1,2 @@
+$OpenSansPath: "@/assets/font/open-sans/fonts" !default;
+$OpenSansVersion: "1.1.0" !default;
diff --git a/public/font/open-sans/sass/open-sans.scss b/assets/font/open-sans/sass/open-sans.scss
similarity index 100%
rename from public/font/open-sans/sass/open-sans.scss
rename to assets/font/open-sans/sass/open-sans.scss
diff --git a/public/icons/both-mode.png b/assets/icons/both-mode.png
similarity index 100%
rename from public/icons/both-mode.png
rename to assets/icons/both-mode.png
diff --git a/public/icons/dark-mode.png b/assets/icons/dark-mode.png
similarity index 100%
rename from public/icons/dark-mode.png
rename to assets/icons/dark-mode.png
diff --git a/public/icons/download.svg b/assets/icons/download.svg
similarity index 100%
rename from public/icons/download.svg
rename to assets/icons/download.svg
diff --git a/public/icons/format.svg b/assets/icons/format.svg
similarity index 100%
rename from public/icons/format.svg
rename to assets/icons/format.svg
diff --git a/public/icons/light-mode.png b/assets/icons/light-mode.png
similarity index 100%
rename from public/icons/light-mode.png
rename to assets/icons/light-mode.png
diff --git a/public/icons/update.svg b/assets/icons/update.svg
similarity index 100%
rename from public/icons/update.svg
rename to assets/icons/update.svg
diff --git a/electron/preload/index.ts b/electron/preload/index.ts
index e2ac6c9..c3db29f 100644
--- a/electron/preload/index.ts
+++ b/electron/preload/index.ts
@@ -1,5 +1,5 @@
const { contextBridge } = require('electron')
-import darkMode from "./theme-mode"
+import themeMode from "./theme-mode"
import { isMac, isWindows, isLinux } from "../detect-platform"
import { ipcRenderer } from "electron"
import {
@@ -18,8 +18,6 @@ import {
import CONFIG from "../config"
import getCurrencyData from "./currency"
-//contextBridge.exposeInMainWorld("platform", )
-contextBridge.exposeInMainWorld("darkMode", darkMode)
contextBridge.exposeInMainWorld("heynote", {
platform: {
@@ -28,6 +26,8 @@ contextBridge.exposeInMainWorld("heynote", {
isLinux,
},
+ themeMode: themeMode,
+
quit() {
console.log("quitting")
//ipcRenderer.invoke("app_quit")
diff --git a/electron/preload/theme-mode.ts b/electron/preload/theme-mode.ts
index cbae8d1..72bbd3c 100644
--- a/electron/preload/theme-mode.ts
+++ b/electron/preload/theme-mode.ts
@@ -2,7 +2,7 @@ const { ipcRenderer } = require('electron')
const getComputedTheme = () => window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light"
const mediaMatch = window.matchMedia('(prefers-color-scheme: dark)')
-let darkModeChangeListener = null
+let themeModeChangeListener = null
export default {
set: (mode) => ipcRenderer.invoke('dark-mode:set', mode),
@@ -14,14 +14,14 @@ export default {
}
},
onChange: (callback) => {
- darkModeChangeListener = (event) => {
+ themeModeChangeListener = (event) => {
callback(event.matches ? "dark" : "light")
}
- mediaMatch.addEventListener('change', darkModeChangeListener)
+ mediaMatch.addEventListener('change', themeModeChangeListener)
return mediaMatch
},
removeListener() {
- mediaMatch.removeEventListener('change', darkModeChangeListener)
+ mediaMatch.removeEventListener('change', themeModeChangeListener)
},
initial: getComputedTheme(),
}
diff --git a/package-lock.json b/package-lock.json
index 7741b60..6087403 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -48,7 +48,7 @@
"rollup-plugin-license": "^3.0.1",
"sass": "^1.57.1",
"typescript": "^4.9.4",
- "vite": "^4.0.5",
+ "vite": "^4.5.1",
"vite-plugin-electron": "^0.11.1",
"vite-plugin-electron-renderer": "^0.11.4",
"vue": "^3.2.45",
diff --git a/package.json b/package.json
index feb2a38..d352e1a 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,9 @@
"build": "vue-tsc --noEmit && vite build && electron-builder -c electron-builder.json5",
"prebuild": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
- "build_grammar": "lezer-generator src/editor/lang-heynote/heynote.grammar -o src/editor/lang-heynote/parser.js"
+ "build_grammar": "lezer-generator src/editor/lang-heynote/heynote.grammar -o src/editor/lang-heynote/parser.js",
+ "webapp:dev": "vite webapp",
+ "webapp:build": "vite build webapp"
},
"devDependencies": {
"@codemirror/autocomplete": "^6.11.1",
@@ -63,7 +65,7 @@
"rollup-plugin-license": "^3.0.1",
"sass": "^1.57.1",
"typescript": "^4.9.4",
- "vite": "^4.0.5",
+ "vite": "^4.5.1",
"vite-plugin-electron": "^0.11.1",
"vite-plugin-electron-renderer": "^0.11.4",
"vue": "^3.2.45",
diff --git a/public/font/open-sans/sass/_variables.scss b/public/font/open-sans/sass/_variables.scss
deleted file mode 100755
index 5144c5b..0000000
--- a/public/font/open-sans/sass/_variables.scss
+++ /dev/null
@@ -1,2 +0,0 @@
-$OpenSansPath: "font/open-sans/fonts" !default;
-$OpenSansVersion: "1.1.0" !default;
diff --git a/src/components/App.vue b/src/components/App.vue
index 209e2b8..6b0a326 100644
--- a/src/components/App.vue
+++ b/src/components/App.vue
@@ -19,8 +19,8 @@
selectionSize: 0,
language: "plaintext",
languageAuto: true,
- theme: window.darkMode.initial,
- initialTheme: window.darkMode.initial,
+ theme: window.heynote.themeMode.initial,
+ initialTheme: window.heynote.themeMode.initial,
systemTheme: 'system',
development: window.location.href.indexOf("dev=1") !== -1,
showLanguageSelector: false,
@@ -30,13 +30,20 @@
},
mounted() {
- window.darkMode.get().then((mode) => {
+ window.heynote.themeMode.get().then((mode) => {
this.theme = mode.computed
this.systemTheme = mode.theme
})
- window.darkMode.onChange((theme) => {
+ const onChangeCallback = (theme) => {
this.theme = theme
- })
+ if (theme === "system") {
+ document.body.setAttribute("theme", window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
+ } else {
+ document.body.setAttribute("theme", theme)
+ }
+ }
+ onChangeCallback(window.heynote.themeMode.initial)
+ window.heynote.themeMode.onChange(onChangeCallback)
window.heynote.onSettingsChange((settings) => {
this.settings = settings
})
@@ -46,7 +53,7 @@
},
beforeUnmount() {
- window.darkMode.removeListener()
+ window.heynote.themeMode.removeListener()
},
methods: {
@@ -66,7 +73,7 @@
} else {
newTheme = this.systemTheme === "system" ? "light" : (this.systemTheme === "light" ? "dark" : "system")
}
- window.darkMode.set(newTheme)
+ window.heynote.themeMode.set(newTheme)
this.systemTheme = newTheme
this.$refs.editor.focus()
},
diff --git a/src/components/StatusBar.vue b/src/components/StatusBar.vue
index 2320f52..04b53c2 100644
--- a/src/components/StatusBar.vue
+++ b/src/components/StatusBar.vue
@@ -50,6 +50,10 @@
changeLanguageTitle() {
return `Change language for current block (${this.cmdKey} + L)`
},
+
+ updatesEnabled() {
+ return !!window.heynote.autoUpdate
+ },
},
}
@@ -80,7 +84,7 @@
>
-