Skip to content

Commit 6f799d0

Browse files
committed
chore(core): cleanup
1 parent bec6cc0 commit 6f799d0

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<script lang="ts" setup>
2+
import { inject } from 'vue'
3+
import { useVueFlow } from '../../composables'
4+
import { VueFlow } from '../../context'
5+
import type { VueFlowProviderProps } from '../../types'
6+
7+
const props = defineProps<VueFlowProviderProps>()
8+
9+
const hasInjection = inject(VueFlow, null)
10+
11+
if (!hasInjection) {
12+
// createVueFlow() or setupVueFlow()
13+
useVueFlow({
14+
nodes: props.initialNodes,
15+
edges: props.initialEdges,
16+
fitViewOnInit: props.fitViewOnInit,
17+
})
18+
}
19+
</script>
20+
21+
<template>
22+
<slot />
23+
</template>

packages/core/src/context/VueFlowProvider.vue

-15
This file was deleted.

packages/core/src/types/flow.ts

+6
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,9 @@ export interface FlowSlots extends NodeSlots, EdgeSlots {
331331
'zoom-pane': () => any
332332
'default': () => any
333333
}
334+
335+
export interface VueFlowProviderProps {
336+
initialNodes?: Node[]
337+
initialEdges?: Edge[]
338+
fitViewOnInit?: boolean
339+
}

0 commit comments

Comments
 (0)