Skip to content

Commit 495a1e8

Browse files
committed
feat(core): add VueFlowProvider
1 parent 09c32c5 commit 495a1e8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/core/src/composables/useVueFlow.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Scope = (EffectScope & { vueFlowId: string }) | undefined
1919
*
2020
* @public
2121
* @returns a vue flow store instance
22-
* @param idOrOpts - id of the store instance or options to create a new store instance
22+
* @param idOrOpts - id of the store instance or options to pass to the store instance (options are deprecated!)
2323
*/
2424
export function useVueFlow(id?: string): VueFlowStore
2525
export function useVueFlow(options?: FlowOptions): VueFlowStore
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script lang="ts" setup>
2+
import { inject } from 'vue'
3+
import { useVueFlow } from '../composables'
4+
import { VueFlow } from './'
5+
6+
const hasInjection = inject(VueFlow, null)
7+
8+
if (!hasInjection) {
9+
useVueFlow()
10+
}
11+
</script>
12+
13+
<template>
14+
<slot />
15+
</template>

0 commit comments

Comments
 (0)