chore(core): add comments
This commit is contained in:
@@ -53,6 +53,7 @@ const modelEdges = useVModel(props, 'edges', emit)
|
|||||||
|
|
||||||
const { vueFlowRef, hooks, getNodeTypes, getEdgeTypes, ...rest } = useVueFlow(props)
|
const { vueFlowRef, hooks, getNodeTypes, getEdgeTypes, ...rest } = useVueFlow(props)
|
||||||
|
|
||||||
|
// watch props and update store state
|
||||||
const dispose = useWatchProps({ modelValue, nodes: modelNodes, edges: modelEdges }, props, {
|
const dispose = useWatchProps({ modelValue, nodes: modelNodes, edges: modelEdges }, props, {
|
||||||
vueFlowRef,
|
vueFlowRef,
|
||||||
hooks,
|
hooks,
|
||||||
@@ -63,9 +64,13 @@ const dispose = useWatchProps({ modelValue, nodes: modelNodes, edges: modelEdges
|
|||||||
|
|
||||||
useHooks(emit, hooks)
|
useHooks(emit, hooks)
|
||||||
|
|
||||||
|
// slots will be passed via provide
|
||||||
|
// this is to avoid having to pass them down through all the components
|
||||||
|
// as that would require a lot of boilerplate and causes significant performance drops
|
||||||
provide(Slots, slots)
|
provide(Slots, slots)
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
// clean up watcher scope
|
||||||
dispose()
|
dispose()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -88,11 +93,11 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<div ref="vueFlowRef" class="vue-flow">
|
<div ref="vueFlowRef" class="vue-flow">
|
||||||
<Viewport>
|
<Viewport>
|
||||||
<!-- This slot will be passed down to the transformation-pane and rendered inside there, meaning it's affected by zooming/panning -->
|
<!-- This slot is affected by zooming & panning -->
|
||||||
<slot name="zoom-pane" />
|
<slot name="zoom-pane" />
|
||||||
</Viewport>
|
</Viewport>
|
||||||
|
|
||||||
<!-- This slot will render outside the transformation-pane, meaning it's *not* affected by zooming and panning -->
|
<!-- This slot is _not_ affected by zooming & panning -->
|
||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
<A11yDescriptions />
|
<A11yDescriptions />
|
||||||
|
|||||||
Reference in New Issue
Block a user