refactor(core): remove primtive typeguards

This commit is contained in:
braks
2023-10-30 13:36:07 +01:00
committed by Braks
parent 785f147236
commit 3b175a553e
10 changed files with 35 additions and 54 deletions
@@ -1,7 +1,6 @@
<script lang="ts" setup>
import { ref, useAttrs } from 'vue'
import type { BaseEdgeProps } from '../../types'
import { isNumber } from '../../utils'
import EdgeText from './EdgeText.vue'
const { interactionWidth = 20, labelShowBg = true, ...props } = defineProps<BaseEdgeProps>()
@@ -52,7 +51,7 @@ export default {
/>
<EdgeText
v-if="label && isNumber(labelX) && isNumber(labelY)"
v-if="label && labelX && labelY"
ref="labelEl"
:x="labelX"
:y="labelY"
@@ -2,7 +2,6 @@
import { computed, onMounted, ref, watch } from 'vue'
import type { EdgeTextProps } from '../../types/components'
import type { Rect as RectType } from '../../types'
import { isString } from '../../utils'
const {
x,
@@ -61,7 +60,7 @@ export default {
<text v-bind="$attrs" ref="el" class="vue-flow__edge-text" :y="box.height / 2" dy="0.3em" :style="labelStyle">
<slot>
<component :is="label as any" v-if="!isString(label)" />
<component :is="label" v-if="typeof label !== 'string'" />
<template v-else>
{{ label }}
</template>