feat(hooks): add useConnection
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { useStore } from '@xyflow/svelte';
|
import { useConnection } from '@xyflow/svelte';
|
||||||
|
|
||||||
const { connection } = useStore();
|
const connection = useConnection();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $connection.path}
|
{#if $connection.path}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import type { Readable } from 'svelte/store';
|
||||||
|
|
||||||
|
import { useStore } from '$lib/store';
|
||||||
|
import type { ConnectionProps } from '$lib/store/derived-connection-props';
|
||||||
|
|
||||||
|
export function useConnection(): Readable<ConnectionProps> {
|
||||||
|
const { connection } = useStore();
|
||||||
|
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ export { useStore } from '$lib/store';
|
|||||||
export * from '$lib/utils';
|
export * from '$lib/utils';
|
||||||
export * from '$lib/hooks/useSvelteFlow';
|
export * from '$lib/hooks/useSvelteFlow';
|
||||||
export * from '$lib/hooks/useUpdateNodeInternals';
|
export * from '$lib/hooks/useUpdateNodeInternals';
|
||||||
|
export * from '$lib/hooks/useConnection';
|
||||||
|
|
||||||
// types
|
// types
|
||||||
export type { Edge, EdgeProps, EdgeTypes, DefaultEdgeOptions } from '$lib/types/edges';
|
export type { Edge, EdgeProps, EdgeTypes, DefaultEdgeOptions } from '$lib/types/edges';
|
||||||
|
|||||||
Reference in New Issue
Block a user