refactor(packages): add @reactflow/system

This commit is contained in:
moklick
2023-02-16 16:37:47 +01:00
parent 216bf1bcd3
commit a12c893226
40 changed files with 1104 additions and 78 deletions
@@ -1,7 +1,7 @@
<script lang="ts">
import { getContext } from 'svelte';
import cc from 'classcat';
import { type HandleType, Position } from '@reactflow/core';
import { type HandleType, Position } from '@reactflow/system';
export let type: HandleType = 'source';
export let position: Position = Position.Top;
@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount, setContext } from 'svelte';
import type { XYPosition } from '@reactflow/core';
import type { XYPosition } from '@reactflow/system';
import drag from '$lib/hooks/drag'
import { useStore } from '$lib/store';
@@ -1,5 +1,5 @@
<script lang="ts">
import { Position } from '@reactflow/core';
import { Position } from '@reactflow/system';
import Handle from '$lib/components/Handle.svelte';
@@ -6,7 +6,7 @@ import {
type XYPosition,
Position,
internalsSymbol
} from '@reactflow/core';
} from '@reactflow/system';
export function getNodeData(node?: Node): [Rect, NodeHandleBounds | null, boolean] {
const handleBounds = node?.[internalsSymbol]?.handleBounds || null;
@@ -1,7 +1,7 @@
<script lang="ts">
import { setContext, onMount } from 'svelte'
import cc from 'classcat';
import type { Node, Edge } from '@reactflow/core';
import type { Node, Edge } from '@reactflow/system';
import { key, createStore } from '$lib/store';
import Viewport from '$lib/container/Viewport.svelte';
+1 -1
View File
@@ -1,7 +1,7 @@
import { get, type Writable } from 'svelte/store';
import { drag as d3Drag, type D3DragEvent, type SubjectPosition } from 'd3-drag';
import { select } from 'd3-selection';
import type { XYPosition, CoordinateExtent, Node, Transform } from '@reactflow/core';
import type { XYPosition, CoordinateExtent, Node, Transform } from '@reactflow/system';
import { getDragItems, hasSelector, calcNextPosition } from './utils';
+1 -1
View File
@@ -5,7 +5,7 @@ import type {
NodeInternals,
NodeOrigin,
XYPosition
} from '@reactflow/core';
} from '@reactflow/system';
import { clampPosition, isNumeric } from '../../../utils';
+1 -1
View File
@@ -3,7 +3,7 @@ import type { Writable } from 'svelte/store';
import { select } from 'd3-selection';
import { zoom as d3Zoom, zoomIdentity } from 'd3-zoom';
import type { D3ZoomEvent } from 'd3-zoom';
import type { Transform } from '@reactflow/core';
import type { Transform } from '@reactflow/system';
const isWrappedWithClass = (event: any, className: string | undefined) =>
event.target.closest(`.${className}`);
-1
View File
@@ -1,4 +1,3 @@
// Reexport your entry components here
import SvelteFlow from '$lib/container/SvelteFlow.svelte';
export default SvelteFlow;
+3 -3
View File
@@ -6,9 +6,9 @@ import {
type NodeDragItem,
type NodeDimensionUpdate,
type Edge,
Position
} from '@reactflow/core';
import { internalsSymbol } from '@reactflow/core';
Position,
internalsSymbol
} from '@reactflow/system';
import { getDimensions, getHandleBounds } from '../../utils';
import {
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import type { Node, Edge } from '@reactflow/core';
import type { Node, Edge } from '@reactflow/system';
import SvelteFlow from '../lib/index';
+1 -1
View File
@@ -7,7 +7,7 @@ import {
type HandleElement,
internalsSymbol,
Position
} from '@reactflow/core';
} from '@reactflow/system';
export const clamp = (val: number, min = 0, max = 1): number => Math.min(Math.max(val, min), max);