Skip to content

Commit

Permalink
feat(core): add VueFlowProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
bcakmakoglu committed Jun 17, 2024
1 parent 192b154 commit 09cea83
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/composables/useVueFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Scope = (EffectScope & { vueFlowId: string }) | undefined
*
* @public
* @returns a vue flow store instance
* @param idOrOpts - id of the store instance or options to create a new store instance
* @param idOrOpts - id of the store instance or options to pass to the store instance (options are deprecated!)

Check warning on line 22 in packages/core/src/composables/useVueFlow.ts

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest, 18)

Expected @param names to be "id". Got "idOrOpts"
*/
export function useVueFlow(id?: string): VueFlowStore
export function useVueFlow(options?: FlowOptions): VueFlowStore
Expand Down
15 changes: 15 additions & 0 deletions packages/core/src/context/VueFlowProvider.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script lang="ts" setup>
import { inject } from 'vue'
import { useVueFlow } from '../composables'
import { VueFlow } from './'
const hasInjection = inject(VueFlow, null)
if (!hasInjection) {
useVueFlow()
}
</script>

<template>
<slot />
</template>

0 comments on commit 09cea83

Please sign in to comment.