chore(svelte): cleanup

This commit is contained in:
moklick
2023-09-27 16:15:43 +02:00
parent 4e64b57d6d
commit 335e116d44
5 changed files with 8 additions and 7 deletions

View File

@@ -1,5 +1,8 @@
## 0.0.22
- add `connectionLine` slot for rendering a custom connection line
- add `connectionLineStyle` and `connectionLineContainerStyle` props
- add `useConnection` hook
- add `nodeDragThreshold` prop
- add `fitViewOptions` prop
- add `defaultEdgeOptions` prop

View File

@@ -5,7 +5,7 @@
export let containerStyle: string = '';
export let style: string = '';
export let usingCustomLine: boolean = false;
export let isCustomComponent: boolean = false;
const { width, height, connection } = useStore();
</script>
@@ -15,7 +15,7 @@
<g class={cc(['svelte-flow__connection', $connection.status])} {style}>
<slot name="connectionLine" />
<!-- slot fallbacks do not work if slots are forwarded in parent -->
{#if !usingCustomLine}
{#if !isCustomComponent}
<path d={$connection.path} fill="none" class="svelte-flow__connection-path" />
{/if}
</g>

View File

@@ -167,7 +167,7 @@
<ConnectionLine
containerStyle={connectionLineContainerStyle}
style={connectionLineStyle}
usingCustomLine={$$slots.connectionLine}
isCustomComponent={$$slots.connectionLine}
>
<slot name="connectionLine" slot="connectionLine" />
</ConnectionLine>

View File

@@ -95,9 +95,7 @@ export function useSvelteFlow(): {
{ duration: options?.duration }
);
},
fitView: (fitViewOptions?: FitViewOptions) => {
fitView(get(nodes), fitViewOptions);
},
fitView,
project: (position: XYPosition) => {
const _snapGrid = get(snapGrid);
return pointToRendererPoint(

View File

@@ -23,7 +23,7 @@ export type SvelteFlowStoreActions = {
setMinZoom: (minZoom: number) => void;
setMaxZoom: (maxZoom: number) => void;
setTranslateExtent: (extent: CoordinateExtent) => void;
fitView: (nodes: Node[], options?: FitViewOptions) => boolean;
fitView: (options?: FitViewOptions) => boolean;
updateNodePositions: UpdateNodePositions;
updateNodeDimensions: (updates: NodeDimensionUpdate[]) => void;
unselectNodesAndEdges: () => void;