chore(system): rename BaseNode/BaseEdge types to NodeBase/EdgeBase

This commit is contained in:
moklick
2023-06-13 16:54:26 +02:00
parent 65d1c3bbd4
commit 9dfec49ed5
25 changed files with 499 additions and 550 deletions
+6 -2
View File
@@ -13,7 +13,9 @@ import {
type Connection,
type XYPosition,
type CoordinateExtent,
type UpdateConnection
type UpdateConnection,
type NodeBase,
type NodeDragItem
} from '@xyflow/system';
import { addEdge as addEdgeUtil } from '$lib/utils';
@@ -57,7 +59,9 @@ export function createStore(): SvelteFlowStore {
const updateNodePositions: UpdateNodePositions = (nodeDragItems, dragging = false) => {
store.nodes.update((nds) => {
return nds.map((n) => {
const nodeDragItem = nodeDragItems.find((ndi) => ndi.id === n.id);
const nodeDragItem = (nodeDragItems as Array<NodeBase | NodeDragItem>).find(
(ndi) => ndi.id === n.id
);
if (nodeDragItem) {
return {
+2 -2
View File
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { SvelteComponentTyped } from 'svelte';
import type {
BaseEdge,
EdgeBase,
BezierPathOptions,
DefaultEdgeOptionsBase,
EdgePosition,
@@ -10,7 +10,7 @@ import type {
import type { Node } from '$lib/types';
export type DefaultEdge<EdgeData = any> = BaseEdge<EdgeData> & {
export type DefaultEdge<EdgeData = any> = EdgeBase<EdgeData> & {
label?: string;
labelStyle?: string;
style?: string;
+2 -2
View File
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { SvelteComponentTyped } from 'svelte';
import type { BaseNode, NodeProps } from '@xyflow/system';
import type { NodeBase, NodeProps } from '@xyflow/system';
// @todo: currently the helper function only like Node from '@reactflow/core'
// we need a base node type or helpes that accept Node like types
@@ -9,7 +9,7 @@ import type { BaseNode, NodeProps } from '@xyflow/system';
export type Node<
NodeData = any,
NodeType extends string | undefined = string | undefined
> = BaseNode<NodeData, NodeType> & {
> = NodeBase<NodeData, NodeType> & {
class?: string;
style?: string;
};