Skip to content

Commit

Permalink
chore(core): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bcakmakoglu committed Jun 24, 2024
1 parent 495a1e8 commit 1ae4e4b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
23 changes: 23 additions & 0 deletions packages/core/src/components/VueFlowProvider/VueFlowProvider.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script lang="ts" setup>
import { inject } from 'vue'
import { useVueFlow } from '../../composables'
import { VueFlow } from '../../context'
import type { VueFlowProviderProps } from '../../types'
const props = defineProps<VueFlowProviderProps>()
const hasInjection = inject(VueFlow, null)
if (!hasInjection) {
// createVueFlow() or setupVueFlow()
useVueFlow({
nodes: props.initialNodes,
edges: props.initialEdges,
fitViewOnInit: props.fitViewOnInit,
})
}
</script>

<template>
<slot />
</template>
15 changes: 0 additions & 15 deletions packages/core/src/context/VueFlowProvider.vue

This file was deleted.

6 changes: 6 additions & 0 deletions packages/core/src/types/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,9 @@ export interface FlowSlots extends NodeSlots, EdgeSlots {
'zoom-pane': () => any
'default': () => any
}

export interface VueFlowProviderProps {
initialNodes?: Node[]
initialEdges?: Edge[]
fitViewOnInit?: boolean
}

0 comments on commit 1ae4e4b

Please sign in to comment.