mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-21 01:12:59 +00:00
refactor: update to Svelte 5 preview
feat: add charrecorder feat: dynamic os layouts for CC1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { Action } from "svelte/action";
|
||||
import tippy from "tippy.js";
|
||||
import type { SvelteComponent } from "svelte";
|
||||
import { mount, unmount, type SvelteComponent } from "svelte";
|
||||
import Tooltip from "$lib/components/Tooltip.svelte";
|
||||
|
||||
export const hotkeys = new Map<string, HTMLElement>();
|
||||
@@ -9,20 +9,22 @@ export const action: Action<Element, { title?: string; shortcut?: string }> = (
|
||||
node: Element,
|
||||
{ title, shortcut },
|
||||
) => {
|
||||
let component: SvelteComponent | undefined;
|
||||
let component: {} | undefined;
|
||||
const tooltip = tippy(node, {
|
||||
arrow: false,
|
||||
theme: "tooltip",
|
||||
animation: "fade",
|
||||
onShow(instance) {
|
||||
component ??= new Tooltip({
|
||||
component ??= mount(Tooltip, {
|
||||
target: instance.popper.querySelector(".tippy-content") as Element,
|
||||
props: { title, shortcut },
|
||||
});
|
||||
},
|
||||
onHidden() {
|
||||
component?.$destroy();
|
||||
component = undefined;
|
||||
if (component) {
|
||||
unmount(component);
|
||||
component = undefined;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user