Skip to content

Commit 8d4976e

Browse files
committed
chore(core): cleanup
1 parent aa2b47c commit 8d4976e

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>

Diff for: packages/core/src/context/VueFlowProvider.vue

-15
This file was deleted.

Diff for: packages/core/src/types/flow.ts

+6
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,9 @@ export interface FlowSlots extends NodeSlots, EdgeSlots {
300300
'zoom-pane': () => any
301301
'default': () => any
302302
}
303+
304+
export interface VueFlowProviderProps {
305+
initialNodes?: Node[]
306+
initialEdges?: Edge[]
307+
fitViewOnInit?: boolean
308+
}

0 commit comments

Comments
 (0)