selection utilities

This commit is contained in:
vcoppe
2024-05-24 13:16:41 +02:00
parent cb2d541de7
commit c313d9a5c7
10 changed files with 268 additions and 88 deletions

View File

@@ -3,7 +3,7 @@
import { Button } from '$lib/components/ui/button';
import { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-svelte';
import { getContext, setContext } from 'svelte';
import type { Writable } from 'svelte/store';
import { get, type Writable } from 'svelte/store';
export let id: string | number;
@@ -23,6 +23,14 @@
}
return value;
});
export function openNode() {
if (get(open)[fullId]) return;
open.update((value) => {
value[fullId] = true;
return value;
});
}
</script>
<Collapsible.Root bind:open={$open[fullId]} class={$$props.class ?? ''}>