1
1
<script setup lang="ts">
2
- import { readonly , ref , toRef , useSlots , computed , nextTick , watch , CSSProperties } from " vue"
2
+ import { readonly , ref , toRef , computed , nextTick , watch , CSSProperties } from " vue"
3
3
import { EventHandlers , Nodes , Edges , InputPaths , Layouts , UserLayouts } from " @/common/types"
4
4
import { Layers , LayerPosition , LayerPositions , Point , Sizes } from " @/common/types"
5
5
import { Reactive , nonNull } from " @/common/common"
@@ -20,7 +20,7 @@ import { SvgPanZoomInstance, Box } from "@/modules/svg-pan-zoom-ex"
20
20
import { exportSvgElement , exportSvgElementWithOptions , ExportOptions } from " @/utils/svg"
21
21
import { provideSelections } from " @/composables/selection"
22
22
import { provideLayouts } from " @/composables/layout"
23
- import { LayerSlots , useBuiltInLayerOrder } from " @/composables/layer"
23
+ import { LayerSlotProps , useBuiltInLayerOrder } from " @/composables/layer"
24
24
import { asyncNextTick } from " @/modules/vue/nextTick"
25
25
import { isPromise } from " @/utils/object"
26
26
import { calculateFit , parseFitContentMargin } from " @/modules/view/fit"
@@ -63,10 +63,6 @@ interface Props {
63
63
eventHandlers? : EventHandlers
64
64
}
65
65
66
- interface LayerSlot {
67
- scale: number
68
- }
69
-
70
66
const props = withDefaults (defineProps <Props >(), {
71
67
nodes : () => ({}),
72
68
edges : () => ({}),
@@ -89,7 +85,10 @@ const emit = defineEmits<{
89
85
(e : " update:layouts" , v : Layouts ): void
90
86
}>()
91
87
92
- const slots = defineSlots <LayerSlots >()
88
+ const slots = defineSlots <{
89
+ default: (props : LayerSlotProps ) => any
90
+ [key : string ]: (props : LayerSlotProps ) => any
91
+ }>()
93
92
94
93
const nodesRef = toRef (props , " nodes" )
95
94
const edgesRef = toRef (props , " edges" )
@@ -705,12 +704,9 @@ function stopEventPropagation(event: Event) {
705
704
height =" 100%"
706
705
>
707
706
<!-- outside of viewport -->
708
- <slot
709
- v-for =" layerName in layerDefs['root']"
710
- :key =" layerName"
711
- :name =" layerName"
712
- :scale =" scale"
713
- />
707
+ <template v-for =" layerName in layerDefs [' root' ]" :key =" layerName " >
708
+ <slot :name =" layerName" :scale =" scale" />
709
+ </template >
714
710
715
711
<defs v-if =" Object.keys(markerState.markers).length > 0" >
716
712
<v-marker-head
0 commit comments