From d054c8830cf9b6506e9e1da4fe693b677b2e5d40 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 25 Nov 2024 15:53:18 +0100 Subject: [PATCH] Improve handling of localStorage and svelte stores Also moving the svelte-stored-writable package into the repo. So we have it closer for maintenance, we can eventually rewrite it in svelte 5 runes later. Reference: https://github.com/efstajas/svelte-stored-writable/pull/5 --- package-lock.json | 10 ---- package.json | 1 - src/App.svelte | 2 +- src/App/Settings.svelte | 17 +++--- src/lib/appearance.ts | 99 +++++++++++---------------------- src/lib/localStore.ts | 83 +++++++++++++++++++++++++++ src/views/nodes/SeedSelector.ts | 2 +- 7 files changed, 127 insertions(+), 87 deletions(-) create mode 100644 src/lib/localStore.ts diff --git a/package-lock.json b/package-lock.json index 1cb633e17..3b5609871 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "1.0.0", "hasInstallScript": true, "dependencies": { - "@efstajas/svelte-stored-writable": "^0.3.0", "@radicle/gray-matter": "4.1.0", "@wooorm/starry-night": "^3.5.0", "async-mutex": "^0.5.0", @@ -82,15 +81,6 @@ "node": ">=6.0.0" } }, - "node_modules/@efstajas/svelte-stored-writable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@efstajas/svelte-stored-writable/-/svelte-stored-writable-0.3.0.tgz", - "integrity": "sha512-TIhJ5gpivhCsN+ijt/bAWp20uoeRZHJCOCTLqfzN4n5fk6uMUVtPeqnmC5eCe1Tn23moBuKOC6wgK4APuyuT6A==", - "dependencies": { - "svelte": "^4.2.19", - "zod": "^3.21.4" - } - }, "node_modules/@esbuild/aix-ppc64": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", diff --git a/package.json b/package.json index 998438e60..523535c58 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "wait-on": "^8.0.1" }, "dependencies": { - "@efstajas/svelte-stored-writable": "^0.3.0", "@radicle/gray-matter": "4.1.0", "@wooorm/starry-night": "^3.5.0", "async-mutex": "^0.5.0", diff --git a/src/App.svelte b/src/App.svelte index 50f1e54df..41b8d3772 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -2,7 +2,7 @@ import * as router from "@app/lib/router"; import { unreachable } from "@app/lib/utils"; - import { codeFont, theme } from "@app/lib/appearance"; + import { codeFont, followSystemTheme, theme } from "@app/lib/appearance"; import FullscreenModalPortal from "./App/FullscreenModalPortal.svelte"; import Hotkeys from "./App/Hotkeys.svelte"; diff --git a/src/App/Settings.svelte b/src/App/Settings.svelte index 64ea5d211..da7ec8e47 100644 --- a/src/App/Settings.svelte +++ b/src/App/Settings.svelte @@ -2,8 +2,6 @@ import { codeFont, codeFonts, - storeCodeFont, - storeTheme, theme, followSystemTheme, } from "@app/lib/appearance"; @@ -11,7 +9,6 @@ import Button from "@app/components/Button.svelte"; import Icon from "@app/components/Icon.svelte"; import Radio from "@app/components/Radio.svelte"; -