make custom connection line component a normal prop instead of a snippet
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { getContext, setContext, onDestroy } from 'svelte';
|
||||
import cc from 'classcat';
|
||||
import { PanOnScrollMode } from '@xyflow/system';
|
||||
import { ConnectionLineType, PanOnScrollMode } from '@xyflow/system';
|
||||
|
||||
import { key, createStore } from '$lib/store';
|
||||
import { Zoom } from '$lib/container/Zoom';
|
||||
@@ -33,7 +33,6 @@
|
||||
onMoveStart,
|
||||
onMoveEnd,
|
||||
onMove,
|
||||
connectionLine,
|
||||
onnodeclick,
|
||||
onnodecontextmenu,
|
||||
onnodedrag,
|
||||
@@ -58,8 +57,10 @@
|
||||
panOnScroll = false,
|
||||
panOnDrag = true,
|
||||
selectionOnDrag = true,
|
||||
connectionLineContainerStyle = '',
|
||||
connectionLineComponent,
|
||||
connectionLineStyle = '',
|
||||
connectionLineContainerStyle = '',
|
||||
connectionLineType = ConnectionLineType.Bezier,
|
||||
attributionPosition,
|
||||
children,
|
||||
nodes = $bindable([]),
|
||||
@@ -167,9 +168,10 @@
|
||||
/>
|
||||
<ConnectionLine
|
||||
{store}
|
||||
type={connectionLineType}
|
||||
LineComponent={connectionLineComponent}
|
||||
containerStyle={connectionLineContainerStyle}
|
||||
style={connectionLineStyle}
|
||||
{connectionLine}
|
||||
/>
|
||||
<div class="svelte-flow__edgelabel-renderer"></div>
|
||||
<div class="svelte-flow__viewport-portal"></div>
|
||||
|
||||
@@ -35,7 +35,7 @@ import type {
|
||||
IsValidConnection
|
||||
} from '$lib/types';
|
||||
|
||||
import type { Snippet } from 'svelte';
|
||||
import type { Component } from 'svelte';
|
||||
import type { EdgeEvents, NodeEvents, NodeSelectionEvents, PaneEvents } from '$lib/types/events';
|
||||
|
||||
export type SvelteFlowProps = NodeEvents &
|
||||
@@ -180,7 +180,7 @@ export type SvelteFlowProps = NodeEvents &
|
||||
*/
|
||||
connectionMode?: ConnectionMode;
|
||||
/** Provide a custom snippet to be used insted of the default connection line */
|
||||
connectionLine?: Snippet;
|
||||
connectionLineComponent?: Component;
|
||||
/** Styles to be applied to the connection line */
|
||||
connectionLineStyle?: string;
|
||||
/** Styles to be applied to the container of the connection line */
|
||||
|
||||
Reference in New Issue
Block a user