refactor: use standard prettier formatting

This commit is contained in:
2024-04-06 13:15:35 +02:00
parent 86ec8651b6
commit 854ab6d3be
106 changed files with 2703 additions and 2046 deletions

View File

@@ -1,37 +1,43 @@
import type { Action } from "svelte/action"
import { persistentWritable } from "$lib/storage"
import type { Action } from "svelte/action";
import { persistentWritable } from "$lib/storage";
export interface UserPreferences {
backup: boolean
autoConnect: boolean
backup: boolean;
autoConnect: boolean;
}
export const theme = persistentWritable("user-theme", {
color: "#6D81C7",
mode: "dark" as "light" | "dark" | "auto",
})
});
export const userPreferences = persistentWritable<UserPreferences>("user-preferences", {
backup: false,
autoConnect: false,
})
export const userPreferences = persistentWritable<UserPreferences>(
"user-preferences",
{
backup: false,
autoConnect: false,
},
);
export const preference: Action<HTMLInputElement, keyof UserPreferences> = (node, key) => {
const unsubscribe = userPreferences.subscribe(it => {
node.checked = it[key]
})
export const preference: Action<HTMLInputElement, keyof UserPreferences> = (
node,
key,
) => {
const unsubscribe = userPreferences.subscribe((it) => {
node.checked = it[key];
});
function update() {
userPreferences.update(value => {
value[key] = node.checked
return value
})
userPreferences.update((value) => {
value[key] = node.checked;
return value;
});
}
node.addEventListener("input", update)
node.addEventListener("input", update);
return {
destroy() {
unsubscribe()
node.removeEventListener("input", update)
unsubscribe();
node.removeEventListener("input", update);
},
}
}
};
};