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,14 +1,14 @@
import type {Action} from "svelte/action"
import tippy from "tippy.js"
import type {SvelteComponent} from "svelte"
import Tooltip from "$lib/components/Tooltip.svelte"
import hotkeys from "hotkeys-js"
import type { Action } from "svelte/action";
import tippy from "tippy.js";
import type { SvelteComponent } from "svelte";
import Tooltip from "$lib/components/Tooltip.svelte";
import hotkeys from "hotkeys-js";
export const action: Action<Element, {title?: string; shortcut?: string}> = (
export const action: Action<Element, { title?: string; shortcut?: string }> = (
node: Element,
{title, shortcut},
{ title, shortcut },
) => {
let component: SvelteComponent | undefined
let component: SvelteComponent | undefined;
const tooltip = tippy(node, {
arrow: false,
theme: "tooltip",
@@ -16,30 +16,30 @@ export const action: Action<Element, {title?: string; shortcut?: string}> = (
onShow(instance) {
component ??= new Tooltip({
target: instance.popper.querySelector(".tippy-content") as Element,
props: {title, shortcut},
})
props: { title, shortcut },
});
},
onHidden() {
component?.$destroy()
component = undefined
component?.$destroy();
component = undefined;
},
})
});
if (shortcut && node instanceof HTMLElement) {
hotkeys(shortcut, function (keyboardEvent) {
keyboardEvent.preventDefault()
node.click()
})
keyboardEvent.preventDefault();
node.click();
});
}
return {
update(updated) {
title = updated.title
shortcut = updated.shortcut
title = updated.title;
shortcut = updated.shortcut;
},
destroy() {
tooltip.destroy()
hotkeys.unbind(shortcut)
tooltip.destroy();
hotkeys.unbind(shortcut);
},
}
}
};
};