chore(svelte): cleanup

This commit is contained in:
moklick
2023-06-05 16:10:48 +02:00
parent 8354759f57
commit 1b4f4a034e
14 changed files with 44 additions and 44 deletions
@@ -1,13 +1,13 @@
import type { Writable } from 'svelte/store'; import type { Writable } from 'svelte/store';
import type { import {
CoordinateExtent,
OnPanZoom,
PanOnScrollMode, PanOnScrollMode,
PanZoomInstance, XYPanZoom,
Transform, type CoordinateExtent,
Viewport type OnPanZoom,
type PanZoomInstance,
type Transform,
type Viewport
} from '@xyflow/system'; } from '@xyflow/system';
import { XYPanZoom } from '@xyflow/system';
type ZoomParams = { type ZoomParams = {
transform: Writable<Transform>; transform: Writable<Transform>;
@@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher, type SvelteComponentTyped } from 'svelte'; import { createEventDispatcher, type SvelteComponentTyped } from 'svelte';
import { Position } from '@xyflow/system'; import { Position, getMarkerId } from '@xyflow/system';
import { getMarkerId } from '@xyflow/system';
import { useStore } from '$lib/store'; import { useStore } from '$lib/store';
import BezierEdge from '$lib/components/edges/BezierEdge.svelte'; import BezierEdge from '$lib/components/edges/BezierEdge.svelte';
@@ -1,8 +1,7 @@
<script lang="ts"> <script lang="ts">
import { getContext, createEventDispatcher } from 'svelte'; import { getContext, createEventDispatcher } from 'svelte';
import cc from 'classcat'; import cc from 'classcat';
import { Position, type Connection } from '@xyflow/system'; import { Position, type Connection, XYHandle, isMouseEvent } from '@xyflow/system';
import { XYHandle, isMouseEvent } from '@xyflow/system';
import { useStore } from '$lib/store'; import { useStore } from '$lib/store';
import type { HandleComponentProps } from '$lib/types'; import type { HandleComponentProps } from '$lib/types';
@@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import { onDestroy } from 'svelte'; import { onDestroy } from 'svelte';
import { internalsSymbol } from '@xyflow/system'; import { internalsSymbol, getPositionWithOrigin } from '@xyflow/system';
import { getPositionWithOrigin } from '@xyflow/system';
import { NodeWrapper } from '$lib/components/NodeWrapper'; import { NodeWrapper } from '$lib/components/NodeWrapper';
import { useStore } from '$lib/store'; import { useStore } from '$lib/store';
@@ -30,8 +30,7 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
import { SelectionMode } from '@xyflow/system'; import { SelectionMode, getEventPosition, getNodesInside } from '@xyflow/system';
import { getEventPosition, getNodesInside } from '@xyflow/system';
import { useStore } from '$lib/store'; import { useStore } from '$lib/store';
import { getConnectedEdges } from '$lib/utils'; import { getConnectedEdges } from '$lib/utils';
@@ -15,7 +15,7 @@
import { Attribution } from '$lib/components/Attribution'; import { Attribution } from '$lib/components/Attribution';
import { useStore } from '$lib/store'; import { useStore } from '$lib/store';
import type { SvelteFlowProps } from './types'; import type { SvelteFlowProps } from './types';
import type { EdgeTypes, NodeTypes } from '$lib/types'; import type { EdgeTypes, NodeTypes } from '$lib/types';
type $$Props = SvelteFlowProps; type $$Props = SvelteFlowProps;
@@ -1,13 +1,13 @@
import { get, writable, type Writable } from 'svelte/store'; import { get, writable, type Writable } from 'svelte/store';
import type { import {
Project, pointToRendererPoint,
SetCenterOptions, type Project,
Viewport, type SetCenterOptions,
ViewportHelperFunctionOptions, type Viewport,
XYPosition, type ViewportHelperFunctionOptions,
ZoomInOut type XYPosition,
type ZoomInOut
} from '@xyflow/system'; } from '@xyflow/system';
import { pointToRendererPoint } from '@xyflow/system';
import { useStore } from '$lib/store'; import { useStore } from '$lib/store';
import type { FitViewOptions } from '$lib/types'; import type { FitViewOptions } from '$lib/types';
-2
View File
@@ -17,8 +17,6 @@ export * from '$lib/utils';
export * from '$lib/hooks/useSvelteFlow'; export * from '$lib/hooks/useSvelteFlow';
export * from '@xyflow/system';
export * from '@xyflow/system';
export * from '@xyflow/system'; export * from '@xyflow/system';
export default SvelteFlow; export default SvelteFlow;
@@ -1,6 +1,13 @@
import { derived } from 'svelte/store'; import { derived } from 'svelte/store';
import { getBezierPath, getSmoothStepPath, getStraightPath } from '@xyflow/system'; import {
import { ConnectionLineType, ConnectionMode, Position, internalsSymbol } from '@xyflow/system'; getBezierPath,
getSmoothStepPath,
getStraightPath,
ConnectionLineType,
ConnectionMode,
Position,
internalsSymbol
} from '@xyflow/system';
import type { SvelteFlowStoreState } from './types'; import type { SvelteFlowStoreState } from './types';
@@ -1,6 +1,5 @@
import { derived } from 'svelte/store'; import { derived } from 'svelte/store';
import { Position } from '@xyflow/system'; import { Position, getHandle } from '@xyflow/system';
import { getHandle } from '@xyflow/system';
import { getEdgePositions, getNodeData } from '$lib/container/EdgeRenderer/utils'; import { getEdgePositions, getNodeData } from '$lib/container/EdgeRenderer/utils';
import type { EdgeLayouted } from '$lib/types'; import type { EdgeLayouted } from '$lib/types';
+8 -10
View File
@@ -1,26 +1,24 @@
import { getContext } from 'svelte'; import { getContext } from 'svelte';
import { derived, get } from 'svelte/store'; import { derived, get } from 'svelte/store';
import { import {
internalsSymbol,
createMarkerIds,
fitView as fitViewUtil,
getDimensions,
getElementsToRemove,
getHandleBounds,
infiniteExtent,
type UpdateNodePositions, type UpdateNodePositions,
type NodeDimensionUpdate, type NodeDimensionUpdate,
internalsSymbol,
type ViewportHelperFunctionOptions, type ViewportHelperFunctionOptions,
type Connection, type Connection,
type XYPosition, type XYPosition,
type CoordinateExtent, type CoordinateExtent,
type UpdateConnection type UpdateConnection
} from '@xyflow/system'; } from '@xyflow/system';
import {
createMarkerIds,
fitView as fitViewUtil,
getDimensions,
getElementsToRemove,
getHandleBounds,
infiniteExtent
} from '@xyflow/system';
import { addEdge as addEdgeUtil } from '$lib/utils'; import { addEdge as addEdgeUtil } from '$lib/utils';
import type { EdgeTypes, NodeTypes, Node, Edge, ConnectionData, FitViewOptions } from '$lib/types'; import type { EdgeTypes, NodeTypes, Node, Edge, FitViewOptions } from '$lib/types';
import { getEdgesLayouted } from './edges-layouted'; import { getEdgesLayouted } from './edges-layouted';
import { getConnectionPath } from './connection-path'; import { getConnectionPath } from './connection-path';
import { import {
@@ -1,5 +1,6 @@
import { readable, writable } from 'svelte/store'; import { readable, writable } from 'svelte/store';
import { import {
infiniteExtent,
SelectionMode, SelectionMode,
ConnectionMode, ConnectionMode,
ConnectionLineType, ConnectionLineType,
@@ -20,7 +21,6 @@ import StraightEdge from '$lib/components/edges/StraightEdge.svelte';
import SmoothStepEdge from '$lib/components/edges/SmoothStepEdge.svelte'; import SmoothStepEdge from '$lib/components/edges/SmoothStepEdge.svelte';
import StepEdge from '$lib/components/edges/StepEdge.svelte'; import StepEdge from '$lib/components/edges/StepEdge.svelte';
import type { ConnectionData, NodeTypes, EdgeTypes, EdgeLayouted, Edge, Node } from '$lib/types'; import type { ConnectionData, NodeTypes, EdgeTypes, EdgeLayouted, Edge, Node } from '$lib/types';
import { infiniteExtent } from '@xyflow/system';
export const initConnectionData = { export const initConnectionData = {
connectionStartHandle: null, connectionStartHandle: null,
+1 -1
View File
@@ -1,3 +1,4 @@
import type { Writable } from 'svelte/store';
import type { import type {
NodeDimensionUpdate, NodeDimensionUpdate,
XYPosition, XYPosition,
@@ -10,7 +11,6 @@ import type {
import type { initialStoreState } from './initial-store'; import type { initialStoreState } from './initial-store';
import type { Node, Edge, NodeTypes, EdgeTypes, FitViewOptions } from '$lib/types'; import type { Node, Edge, NodeTypes, EdgeTypes, FitViewOptions } from '$lib/types';
import type { Writable } from 'svelte/store';
export type SvelteFlowStoreActions = { export type SvelteFlowStoreActions = {
setNodeTypes: (nodeTypes: NodeTypes) => void; setNodeTypes: (nodeTypes: NodeTypes) => void;
+4 -2
View File
@@ -8,9 +8,11 @@ import {
updateEdgeBase, updateEdgeBase,
getConnectedEdgesBase, getConnectedEdgesBase,
isNumeric, isNumeric,
getNodePositionWithOrigin getNodePositionWithOrigin,
internalsSymbol,
type XYZPosition
} from '@xyflow/system'; } from '@xyflow/system';
import { internalsSymbol, type XYZPosition } from '@xyflow/system';
import type { DefaultEdgeOptions, DefaultNodeOptions, Edge, Node } from '$lib/types'; import type { DefaultEdgeOptions, DefaultNodeOptions, Edge, Node } from '$lib/types';
export const isNode = isNodeBase<Node, Edge>; export const isNode = isNodeBase<Node, Edge>;