refactor(nodes): use plugin to import prop interface

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-12-20 19:29:52 +01:00
parent 419b123fee
commit 076ff4ce54
6 changed files with 68 additions and 60 deletions
+5 -12
View File
@@ -1,18 +1,12 @@
<script lang="ts" setup>
import Handle from '../Handle/Handle.vue'
import { NodeProps, Position, ValidConnectionFunc } from '../../types'
import { Position } from '../../types'
import type { NodeProps } from '../../types/node'
interface InputNodeProps extends NodeProps {
data?: NodeProps['data']
connectable?: NodeProps['connectable']
sourcePosition?: NodeProps['sourcePosition']
isValidSourcePos?: ValidConnectionFunc
}
const props = withDefaults(defineProps<InputNodeProps>(), {
const props = withDefaults(defineProps<NodeProps>(), {
data: () => {},
connectable: false,
sourcePosition: Position.Bottom,
sourcePosition: 'bottom' as Position,
})
</script>
<script lang="ts">
@@ -23,8 +17,7 @@ export default {
</script>
<template>
<slot v-bind="props">
<component :is="props.data?.label" v-if="typeof props.data?.label !== 'string'" />
<span v-else v-html="props.data?.label"></span>
<span v-if="props.label" v-html="props.label" />
</slot>
<Handle
type="source"