diff --git a/packages/controls/tsconfig.json b/packages/controls/tsconfig.json index 8300e148..f02b0a03 100644 --- a/packages/controls/tsconfig.json +++ b/packages/controls/tsconfig.json @@ -9,6 +9,6 @@ ] }, "include": [ - "./src", + "./src" ] } diff --git a/packages/core/package.json b/packages/core/package.json index 117f00fe..dc7252ba 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -50,7 +50,6 @@ "*.css" ], "scripts": { - "prepare": "ts-patch install -s", "dev": "pnpm types:watch & pnpm build:watch", "build": "vite build && vite build -c vite.config.iife.ts", "build:watch": "vite build --watch & vite build -c vite.config.iife.ts --watch", @@ -84,8 +83,6 @@ "postcss": "^8.4.31", "postcss-cli": "^10.1.0", "postcss-nested": "^6.0.1", - "ts-patch": "^3.0.2", - "typescript-transform-paths": "^3.4.6", "vite": "^4.4.11", "vue-tsc": "^1.8.16" }, diff --git a/packages/core/src/components/ConnectionLine/index.ts b/packages/core/src/components/ConnectionLine/index.ts index 2fc5cf5f..89bc8763 100644 --- a/packages/core/src/components/ConnectionLine/index.ts +++ b/packages/core/src/components/ConnectionLine/index.ts @@ -1,11 +1,11 @@ import type { DefineComponent } from 'vue' import { defineComponent, h, inject } from 'vue' -import type { ConnectionLineProps } from '~/types' -import { ConnectionLineType, ConnectionMode, Position } from '~/types' -import { getHandlePosition, getMarkerId } from '~/utils' -import { useVueFlow } from '~/composables' -import { Slots } from '~/context' -import { getBezierPath, getSimpleBezierPath, getSmoothStepPath } from '~/components/Edges/utils' +import type { ConnectionLineProps } from '../../types' +import { ConnectionLineType, ConnectionMode, Position } from '../../types' +import { getHandlePosition, getMarkerId } from '../../utils' +import { useVueFlow } from '../../composables' +import { Slots } from '../../context' +import { getBezierPath, getSimpleBezierPath, getSmoothStepPath } from '../Edges/utils' const oppositePosition = { [Position.Left]: Position.Right, diff --git a/packages/core/src/components/Edges/BezierEdge.ts b/packages/core/src/components/Edges/BezierEdge.ts index 4b471782..7dc0751f 100644 --- a/packages/core/src/components/Edges/BezierEdge.ts +++ b/packages/core/src/components/Edges/BezierEdge.ts @@ -1,8 +1,8 @@ import { defineComponent, h } from 'vue' +import type { BezierEdgeProps } from '../../types' +import { Position } from '../../types' import BaseEdge from './BaseEdge.vue' import { getBezierPath } from './utils' -import type { BezierEdgeProps } from '~/types' -import { Position } from '~/types' const BezierEdge = defineComponent({ name: 'BezierEdge', diff --git a/packages/core/src/components/Edges/EdgeAnchor.ts b/packages/core/src/components/Edges/EdgeAnchor.ts index b364ace8..ed1321c0 100644 --- a/packages/core/src/components/Edges/EdgeAnchor.ts +++ b/packages/core/src/components/Edges/EdgeAnchor.ts @@ -1,6 +1,6 @@ import type { FunctionalComponent, HTMLAttributes } from 'vue' import { h } from 'vue' -import { Position } from '~/types' +import { Position } from '../../types' interface Props extends HTMLAttributes { position: Position diff --git a/packages/core/src/components/Edges/EdgeWrapper.ts b/packages/core/src/components/Edges/EdgeWrapper.ts index fdfacb76..4a398c2f 100644 --- a/packages/core/src/components/Edges/EdgeWrapper.ts +++ b/packages/core/src/components/Edges/EdgeWrapper.ts @@ -1,10 +1,9 @@ import { computed, defineComponent, h, provide, ref } from 'vue' import { useVModel } from '@vueuse/core' -import EdgeAnchor from './EdgeAnchor' -import type { Connection, EdgeComponent, EdgeUpdatable, GraphEdge, HandleType, MouseTouchEvent } from '~/types' -import { ConnectionMode, Position } from '~/types' -import { useEdgeHooks, useHandle, useVueFlow } from '~/composables' -import { EdgeId, EdgeRef } from '~/context' +import type { Connection, EdgeComponent, EdgeUpdatable, GraphEdge, HandleType, MouseTouchEvent } from '../../types' +import { ConnectionMode, Position } from '../../types' +import { useEdgeHooks, useHandle, useVueFlow } from '../../composables' +import { EdgeId, EdgeRef } from '../../context' import { ARIA_EDGE_DESC_KEY, ErrorCode, @@ -13,7 +12,8 @@ import { getEdgePositions, getHandle, getMarkerId, -} from '~/utils' +} from '../../utils' +import EdgeAnchor from './EdgeAnchor' interface Props { id: string diff --git a/packages/core/src/components/Edges/SimpleBezierEdge.ts b/packages/core/src/components/Edges/SimpleBezierEdge.ts index 9a258217..a33e7c76 100644 --- a/packages/core/src/components/Edges/SimpleBezierEdge.ts +++ b/packages/core/src/components/Edges/SimpleBezierEdge.ts @@ -1,8 +1,8 @@ import { defineComponent, h } from 'vue' +import type { SimpleBezierEdgeProps } from '../../types' +import { Position } from '../../types' import BaseEdge from './BaseEdge.vue' import { getSimpleBezierPath } from './utils' -import type { SimpleBezierEdgeProps } from '~/types' -import { Position } from '~/types' const SimpleBezierEdge = defineComponent({ name: 'SimpleBezierEdge', diff --git a/packages/core/src/components/Edges/SmoothStepEdge.ts b/packages/core/src/components/Edges/SmoothStepEdge.ts index f8bb39bb..88fd824d 100644 --- a/packages/core/src/components/Edges/SmoothStepEdge.ts +++ b/packages/core/src/components/Edges/SmoothStepEdge.ts @@ -1,8 +1,8 @@ import { defineComponent, h } from 'vue' +import type { SmoothStepEdgeProps } from '../../types' +import { Position } from '../../types' import BaseEdge from './BaseEdge.vue' import { getSmoothStepPath } from './utils' -import type { SmoothStepEdgeProps } from '~/types' -import { Position } from '~/types' const SmoothStepEdge = defineComponent({ name: 'SmoothStepEdge', diff --git a/packages/core/src/components/Edges/StepEdge.ts b/packages/core/src/components/Edges/StepEdge.ts index 3d99c499..f1c55a80 100644 --- a/packages/core/src/components/Edges/StepEdge.ts +++ b/packages/core/src/components/Edges/StepEdge.ts @@ -1,6 +1,6 @@ import { defineComponent, h } from 'vue' +import type { StepEdgeProps } from '../../types' import SmoothStepEdge from './SmoothStepEdge' -import type { StepEdgeProps } from '~/types' const StepEdge = defineComponent({ name: 'StepEdge', diff --git a/packages/core/src/components/Edges/StraightEdge.ts b/packages/core/src/components/Edges/StraightEdge.ts index 5898b1f2..38752a90 100644 --- a/packages/core/src/components/Edges/StraightEdge.ts +++ b/packages/core/src/components/Edges/StraightEdge.ts @@ -1,7 +1,7 @@ import { defineComponent, h } from 'vue' +import type { StraightEdgeProps } from '../../types' import BaseEdge from './BaseEdge.vue' import { getStraightPath } from './utils' -import type { StraightEdgeProps } from '~/types' const StraightEdge = defineComponent({ name: 'StraightEdge', diff --git a/packages/core/src/components/Nodes/DefaultNode.ts b/packages/core/src/components/Nodes/DefaultNode.ts index e3316c9f..d6c83006 100644 --- a/packages/core/src/components/Nodes/DefaultNode.ts +++ b/packages/core/src/components/Nodes/DefaultNode.ts @@ -1,8 +1,8 @@ import type { Component, FunctionalComponent } from 'vue' import { h } from 'vue' import Handle from '../Handle/Handle.vue' -import type { NodeProps } from '~/types' -import { Position } from '~/types' +import type { NodeProps } from '../../types' +import { Position } from '../../types' const DefaultNode: FunctionalComponent = function ({ sourcePosition = Position.Bottom, diff --git a/packages/core/src/components/Nodes/InputNode.ts b/packages/core/src/components/Nodes/InputNode.ts index 6efcef88..6d1b1e8f 100644 --- a/packages/core/src/components/Nodes/InputNode.ts +++ b/packages/core/src/components/Nodes/InputNode.ts @@ -1,8 +1,8 @@ import type { Component, FunctionalComponent } from 'vue' import { h } from 'vue' import Handle from '../Handle/Handle.vue' -import type { NodeProps } from '~/types' -import { Position } from '~/types' +import type { NodeProps } from '../../types' +import { Position } from '../../types' const InputNode: FunctionalComponent = function ({ sourcePosition = Position.Bottom, diff --git a/packages/core/src/components/Nodes/NodeWrapper.ts b/packages/core/src/components/Nodes/NodeWrapper.ts index d147ee92..7bee292a 100644 --- a/packages/core/src/components/Nodes/NodeWrapper.ts +++ b/packages/core/src/components/Nodes/NodeWrapper.ts @@ -1,9 +1,16 @@ import { computed, defineComponent, h, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue' import { until, useVModel } from '@vueuse/core' -import type { GraphNode, HandleConnectable, NodeComponent } from '~/types' -import { NodeId, NodeRef } from '~/context' -import { isInputDOMNode, useDrag, useNodeHooks, useUpdateNodePositions, useVueFlow } from '~/composables' -import { ARIA_NODE_DESC_KEY, arrowKeyDiffs, calcNextPosition, elementSelectionKeys, getXYZPos, handleNodeClick } from '~/utils' +import { + ARIA_NODE_DESC_KEY, + arrowKeyDiffs, + calcNextPosition, + elementSelectionKeys, + getXYZPos, + handleNodeClick, +} from '../../utils' +import type { GraphNode, HandleConnectable, NodeComponent } from '../../types' +import { NodeId, NodeRef } from '../../context' +import { isInputDOMNode, useDrag, useNodeHooks, useUpdateNodePositions, useVueFlow } from '../../composables' interface Props { id: string diff --git a/packages/core/src/components/Nodes/OutputNode.ts b/packages/core/src/components/Nodes/OutputNode.ts index 6a6fda15..023c258f 100644 --- a/packages/core/src/components/Nodes/OutputNode.ts +++ b/packages/core/src/components/Nodes/OutputNode.ts @@ -1,8 +1,8 @@ import type { Component, FunctionalComponent } from 'vue' import { h } from 'vue' import Handle from '../Handle/Handle.vue' -import type { NodeProps } from '~/types' -import { Position } from '~/types' +import type { NodeProps } from '../../types' +import { Position } from '../../types' const OutputNode: FunctionalComponent = function ({ targetPosition = Position.Top, diff --git a/packages/core/src/components/NodesSelection/NodesSelection.vue b/packages/core/src/components/NodesSelection/NodesSelection.vue index 9ef1edea..95afeb75 100644 --- a/packages/core/src/components/NodesSelection/NodesSelection.vue +++ b/packages/core/src/components/NodesSelection/NodesSelection.vue @@ -1,7 +1,7 @@ diff --git a/packages/core/src/composables/useDrag.ts b/packages/core/src/composables/useDrag.ts index c0e094ae..9f6130d3 100644 --- a/packages/core/src/composables/useDrag.ts +++ b/packages/core/src/composables/useDrag.ts @@ -5,7 +5,7 @@ import type { Ref } from 'vue' import { ref, watch } from 'vue' import type { MaybeRefOrGetter } from '@vueuse/core' import { toValue } from '@vueuse/core' -import { useGetPointerPosition, useVueFlow } from '.' +import type { NodeDragEvent, NodeDragItem, XYPosition } from '../types' import { calcAutoPan, calcNextPosition, @@ -14,8 +14,8 @@ import { getEventPosition, handleNodeClick, hasSelector, -} from '~/utils' -import type { NodeDragEvent, NodeDragItem, XYPosition } from '~/types' +} from '../utils' +import { useGetPointerPosition, useVueFlow } from '.' export type UseDragEvent = D3DragEvent diff --git a/packages/core/src/composables/useEdge.ts b/packages/core/src/composables/useEdge.ts index cd77ee96..f39f2fbe 100644 --- a/packages/core/src/composables/useEdge.ts +++ b/packages/core/src/composables/useEdge.ts @@ -1,8 +1,8 @@ import { inject, ref } from 'vue' +import type { CustomEvent, ElementData } from '../types' +import { ErrorCode, VueFlowError } from '../utils' +import { EdgeId, EdgeRef } from '../context' import { useVueFlow } from './useVueFlow' -import type { CustomEvent, ElementData } from '~/types' -import { ErrorCode, VueFlowError } from '~/utils' -import { EdgeId, EdgeRef } from '~/context' /** * Access an edge diff --git a/packages/core/src/composables/useEdgeHooks.ts b/packages/core/src/composables/useEdgeHooks.ts index 8090cd76..29c2d791 100644 --- a/packages/core/src/composables/useEdgeHooks.ts +++ b/packages/core/src/composables/useEdgeHooks.ts @@ -1,5 +1,5 @@ -import type { EdgeEventsEmit, EdgeEventsOn, GraphEdge, VueFlowStore } from '~/types' -import { createExtendedEventHook } from '~/utils' +import type { EdgeEventsEmit, EdgeEventsOn, GraphEdge, VueFlowStore } from '../types' +import { createExtendedEventHook } from '../utils' function createEdgeHooks() { return { diff --git a/packages/core/src/composables/useHandle.ts b/packages/core/src/composables/useHandle.ts index 7b91060d..e1ba26b3 100644 --- a/packages/core/src/composables/useHandle.ts +++ b/packages/core/src/composables/useHandle.ts @@ -1,7 +1,6 @@ import type { MaybeRefOrGetter } from '@vueuse/core' import { toValue } from '@vueuse/core' -import { useVueFlow } from './useVueFlow' -import type { Connection, ConnectionHandle, HandleType, MouseTouchEvent, ValidConnectionFunc } from '~/types' +import type { Connection, ConnectionHandle, HandleType, MouseTouchEvent, ValidConnectionFunc } from '../types' import { calcAutoPan, getClosestHandle, @@ -15,7 +14,8 @@ import { pointToRendererPoint, rendererPointToPoint, resetRecentHandle, -} from '~/utils' +} from '../utils' +import { useVueFlow } from './useVueFlow' interface UseHandleProps { handleId: MaybeRefOrGetter diff --git a/packages/core/src/composables/useNode.ts b/packages/core/src/composables/useNode.ts index 17cbb776..4fc632fb 100644 --- a/packages/core/src/composables/useNode.ts +++ b/packages/core/src/composables/useNode.ts @@ -1,8 +1,8 @@ import { computed, inject, ref } from 'vue' +import type { CustomEvent, ElementData } from '../types' +import { ErrorCode, VueFlowError, getConnectedEdges } from '../utils' +import { NodeId, NodeRef } from '../context' import { useVueFlow } from './useVueFlow' -import type { CustomEvent, ElementData } from '~/types' -import { NodeId, NodeRef } from '~/context' -import { ErrorCode, VueFlowError, getConnectedEdges } from '~/utils' /** * Access a node, it's parent (if one exists) and connected edges diff --git a/packages/core/src/composables/useNodeHooks.ts b/packages/core/src/composables/useNodeHooks.ts index b37138ee..c00a87f2 100644 --- a/packages/core/src/composables/useNodeHooks.ts +++ b/packages/core/src/composables/useNodeHooks.ts @@ -1,5 +1,5 @@ -import type { GraphNode, NodeEventsEmit, NodeEventsOn, VueFlowStore } from '~/types' -import { createExtendedEventHook } from '~/utils' +import type { GraphNode, NodeEventsEmit, NodeEventsOn, VueFlowStore } from '../types' +import { createExtendedEventHook } from '../utils' function createNodeHooks() { return { diff --git a/packages/core/src/composables/useUpdateNodePositions.ts b/packages/core/src/composables/useUpdateNodePositions.ts index aac61047..92a71273 100644 --- a/packages/core/src/composables/useUpdateNodePositions.ts +++ b/packages/core/src/composables/useUpdateNodePositions.ts @@ -1,6 +1,6 @@ +import type { NodeDragItem, XYPosition } from '../types' +import { calcNextPosition } from '../utils' import { useVueFlow } from './useVueFlow' -import type { NodeDragItem, XYPosition } from '~/types' -import { calcNextPosition } from '~/utils' export function useUpdateNodePositions() { const { getSelectedNodes, nodeExtent, updateNodePositions, findNode, snapGrid, snapToGrid, nodesDraggable, emits } = diff --git a/packages/core/src/composables/useViewport.ts b/packages/core/src/composables/useViewport.ts index 61ea0990..53fbedc4 100644 --- a/packages/core/src/composables/useViewport.ts +++ b/packages/core/src/composables/useViewport.ts @@ -1,8 +1,8 @@ import { until } from '@vueuse/core' import { zoomIdentity } from 'd3-zoom' import { computed, ref } from 'vue' -import type { ComputedGetters, D3Selection, GraphNode, Project, State, ViewportFunctions } from '~/types' -import { clampPosition, getRectOfNodes, getTransformForBounds, pointToRendererPoint, rendererPointToPoint, warn } from '~/utils' +import type { ComputedGetters, D3Selection, GraphNode, Project, State, ViewportFunctions } from '../types' +import { clampPosition, getRectOfNodes, getTransformForBounds, pointToRendererPoint, rendererPointToPoint, warn } from '../utils' interface ExtendedViewport extends ViewportFunctions { initialized: boolean diff --git a/packages/core/src/composables/useVueFlow.ts b/packages/core/src/composables/useVueFlow.ts index 0208fb39..e7eabe74 100644 --- a/packages/core/src/composables/useVueFlow.ts +++ b/packages/core/src/composables/useVueFlow.ts @@ -1,10 +1,10 @@ import { toRefs, tryOnScopeDispose } from '@vueuse/core' import type { EffectScope } from 'vue' import { computed, effectScope, getCurrentScope, inject, provide, reactive, watch } from 'vue' -import { useActions, useGetters, useState } from '~/store' -import type { EdgeChange, FlowOptions, FlowProps, NodeChange, State, VueFlowStore } from '~/types' -import { VueFlow } from '~/context' -import { warn } from '~/utils' +import type { EdgeChange, FlowOptions, FlowProps, NodeChange, State, VueFlowStore } from '../types' +import { warn } from '../utils' +import { useActions, useGetters, useState } from '../store' +import { VueFlow } from '../context' /** * Stores all currently created store instances diff --git a/packages/core/src/composables/useWatchProps.ts b/packages/core/src/composables/useWatchProps.ts index 8b58c2d5..9d79f875 100644 --- a/packages/core/src/composables/useWatchProps.ts +++ b/packages/core/src/composables/useWatchProps.ts @@ -2,8 +2,8 @@ import type { ToRefs } from 'vue' import { effectScope, isRef, nextTick, onScopeDispose, watch } from 'vue' import type { WatchPausableReturn } from '@vueuse/core' import { toRef, watchPausable } from '@vueuse/core' -import type { Connection, FlowProps, VueFlowStore } from '~/types' -import { isDef } from '~/utils' +import type { Connection, FlowProps, VueFlowStore } from '../types' +import { isDef } from '../utils' export function useWatchProps( models: ToRefs>, diff --git a/packages/core/src/composables/useZoomPanHelper.ts b/packages/core/src/composables/useZoomPanHelper.ts index dbf50251..642ef7a2 100644 --- a/packages/core/src/composables/useZoomPanHelper.ts +++ b/packages/core/src/composables/useZoomPanHelper.ts @@ -1,6 +1,6 @@ +import type { ComputedGetters, State, ViewportFunctions } from '../types' import { useVueFlow } from './useVueFlow' import { useViewport } from './useViewport' -import type { ComputedGetters, State, ViewportFunctions } from '~/types' /** * @deprecated use {@link useVueFlow} instead (all viewport functions are also available in {@link useVueFlow}) diff --git a/packages/core/src/container/Pane/utils.ts b/packages/core/src/container/Pane/utils.ts index 7466bc41..72d7d249 100644 --- a/packages/core/src/container/Pane/utils.ts +++ b/packages/core/src/container/Pane/utils.ts @@ -1,4 +1,4 @@ -import type { XYPosition } from '~/types' +import type { XYPosition } from '../../types' export function getMousePosition(event: MouseEvent, containerBounds: DOMRect): XYPosition { return { diff --git a/packages/core/src/context/index.ts b/packages/core/src/context/index.ts index 1b7214e4..33704d86 100644 --- a/packages/core/src/context/index.ts +++ b/packages/core/src/context/index.ts @@ -1,5 +1,5 @@ import type { InjectionKey, Ref } from 'vue' -import type { FlowSlots, VueFlowStore } from '~/types' +import type { FlowSlots, VueFlowStore } from '../types' export const VueFlow: InjectionKey = Symbol('vueFlow') export const NodeId: InjectionKey = Symbol('nodeId') diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index c080c77c..59e0f26e 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -1,7 +1,6 @@ import { zoomIdentity } from 'd3-zoom' import type { ComputedRef } from 'vue' import { until } from '@vueuse/core' -import { useState } from './state' import type { Actions, ComputedGetters, @@ -21,8 +20,8 @@ import type { NodeSelectionChange, Rect, State, -} from '~/types' -import { useViewport } from '~/composables' +} from '../types' +import { useViewport } from '../composables' import { ErrorCode, VueFlowError, @@ -49,7 +48,8 @@ import { nodeToRect, parseEdge, updateEdgeAction, -} from '~/utils' +} from '../utils' +import { useState } from './state' export function useActions( id: string, diff --git a/packages/core/src/store/getters.ts b/packages/core/src/store/getters.ts index d6d8689e..cb163fc5 100644 --- a/packages/core/src/store/getters.ts +++ b/packages/core/src/store/getters.ts @@ -1,8 +1,8 @@ import type { ComputedRef } from 'vue' import { computed } from 'vue' +import type { ComputedGetters, GraphEdge, GraphNode, State } from '../types' +import { ErrorCode, VueFlowError, getNodesInside, isEdgeVisible } from '../utils' import { defaultEdgeTypes, defaultNodeTypes } from './state' -import type { ComputedGetters, GraphEdge, GraphNode, State } from '~/types' -import { ErrorCode, VueFlowError, getNodesInside, isEdgeVisible } from '~/utils' export function useGetters(state: State, nodeIds: ComputedRef, edgeIds: ComputedRef): ComputedGetters { /** diff --git a/packages/core/src/store/hooks.ts b/packages/core/src/store/hooks.ts index 3be18625..da98ca53 100644 --- a/packages/core/src/store/hooks.ts +++ b/packages/core/src/store/hooks.ts @@ -1,8 +1,8 @@ import { tryOnScopeDispose } from '@vueuse/core' import type { Ref } from 'vue' import { onBeforeMount } from 'vue' -import type { FlowHooks } from '~/types' -import { createExtendedEventHook, warn } from '~/utils' +import type { FlowHooks } from '../types' +import { createExtendedEventHook, warn } from '../utils' // flow event hooks export function createHooks(): FlowHooks { diff --git a/packages/core/src/store/state.ts b/packages/core/src/store/state.ts index 89ad5e1d..bdfdaa02 100644 --- a/packages/core/src/store/state.ts +++ b/packages/core/src/store/state.ts @@ -1,6 +1,5 @@ -import { createHooks } from './hooks' -import type { DefaultEdgeTypes, DefaultNodeTypes, FlowOptions, State } from '~/types' -import { ConnectionLineType, ConnectionMode, PanOnScrollMode, SelectionMode } from '~/types' +import type { DefaultEdgeTypes, DefaultNodeTypes, FlowOptions, State } from '../types' +import { ConnectionLineType, ConnectionMode, PanOnScrollMode, SelectionMode } from '../types' import { BezierEdge, DefaultNode, @@ -10,8 +9,9 @@ import { SmoothStepEdge, StepEdge, StraightEdge, -} from '~/components' -import { isDef, isMacOs } from '~/utils' +} from '../components' +import { isDef, isMacOs } from '../utils' +import { createHooks } from './hooks' export const defaultNodeTypes: DefaultNodeTypes = { input: InputNode, diff --git a/packages/core/src/types/components.ts b/packages/core/src/types/components.ts index 00bbe143..05a1c5f7 100644 --- a/packages/core/src/types/components.ts +++ b/packages/core/src/types/components.ts @@ -1,7 +1,7 @@ import type { CSSProperties, Component, DefineComponent, VNode } from 'vue' +import type { BezierEdge, SimpleBezierEdge, SmoothStepEdge, StepEdge, StraightEdge } from '../components' import type { NodeProps } from './node' import type { EdgeProps } from './edge' -import type { BezierEdge, SimpleBezierEdge, SmoothStepEdge, StepEdge, StraightEdge } from '~/components' /** Global component names are components registered to the vue instance and are "autoloaded" by their string name */ type GlobalComponentName = string diff --git a/packages/core/src/types/flow.ts b/packages/core/src/types/flow.ts index 88e100e7..b07e84f4 100644 --- a/packages/core/src/types/flow.ts +++ b/packages/core/src/types/flow.ts @@ -1,6 +1,7 @@ import type { CSSProperties } from 'vue' import type { KeyFilter } from '@vueuse/core' import type { D3ZoomEvent } from 'd3-zoom' +import type { VueFlowError } from '../utils' import type { DefaultEdgeOptions, Edge, EdgeProps, EdgeUpdatable, GraphEdge } from './edge' import type { CoordinateExtent, CoordinateExtentRange, GraphNode, Node, NodeProps } from './node' import type { @@ -16,9 +17,8 @@ import type { PanOnScrollMode, ViewportTransform } from './zoom' import type { EdgeTypesObject, NodeTypesObject } from './components' import type { CustomEvent, EdgeMouseEvent, EdgeUpdateEvent, NodeDragEvent, NodeMouseEvent } from './hooks' import type { ValidConnectionFunc } from './handle' -import type { EdgeChange, NodeChange } from '~/types/changes' -import type { VueFlowStore } from '~/types/store' -import type { VueFlowError } from '~/utils' +import type { EdgeChange, NodeChange } from './changes' +import type { VueFlowStore } from './store' export type ElementData = any diff --git a/packages/core/src/types/hooks.ts b/packages/core/src/types/hooks.ts index 15fa28ea..982ca8f6 100644 --- a/packages/core/src/types/hooks.ts +++ b/packages/core/src/types/hooks.ts @@ -1,13 +1,13 @@ import type { EventHookOn, EventHookTrigger } from '@vueuse/core' import type { D3ZoomEvent } from 'd3-zoom' +import type { VueFlowError } from '../utils/errors' +import type { EventHookExtended } from '../utils/createExtendedEventHook' import type { GraphEdge } from './edge' import type { GraphNode } from './node' import type { Connection, OnConnectStartParams } from './connection' import type { ViewportTransform } from './zoom' import type { EdgeChange, NodeChange } from './changes' import type { VueFlowStore } from './store' -import type { VueFlowError } from '~/utils/errors' -import type { EventHookExtended } from '~/utils' export type MouseTouchEvent = MouseEvent | TouchEvent diff --git a/packages/core/src/utils/a11y.ts b/packages/core/src/utils/a11y.ts index 57fd15a1..16d759f2 100644 --- a/packages/core/src/utils/a11y.ts +++ b/packages/core/src/utils/a11y.ts @@ -1,4 +1,4 @@ -import type { XYPosition } from '~/types' +import type { XYPosition } from '../types' export const ARIA_NODE_DESC_KEY = 'vue-flow__node-desc' export const ARIA_EDGE_DESC_KEY = 'vue-flow__edge-desc' diff --git a/packages/core/src/utils/autopan.ts b/packages/core/src/utils/autopan.ts index 54502ba6..f5a7e042 100644 --- a/packages/core/src/utils/autopan.ts +++ b/packages/core/src/utils/autopan.ts @@ -1,5 +1,5 @@ +import type { Dimensions, XYPosition } from '../types' import { clamp } from './graph' -import type { Dimensions, XYPosition } from '~/types' // returns a number between 0 and 1 that represents the velocity of the movement // when the mouse is close to the edge of the canvas diff --git a/packages/core/src/utils/changes.ts b/packages/core/src/utils/changes.ts index f2f527e8..d54f55a1 100644 --- a/packages/core/src/utils/changes.ts +++ b/packages/core/src/utils/changes.ts @@ -1,5 +1,4 @@ import { nextTick } from 'vue' -import { isDef, isGraphNode } from '.' import type { EdgeAddChange, EdgeChange, @@ -16,7 +15,8 @@ import type { NodeSelectionChange, StyleFunc, Styles, -} from '~/types' +} from '../types' +import { isDef, isGraphNode } from '.' function handleParentExpand(updateItem: GraphNode, parent: GraphNode) { if (parent) { diff --git a/packages/core/src/utils/drag.ts b/packages/core/src/utils/drag.ts index 0a425dd3..3e1dc875 100644 --- a/packages/core/src/utils/drag.ts +++ b/packages/core/src/utils/drag.ts @@ -1,5 +1,4 @@ import { markRaw } from 'vue' -import { ErrorCode, VueFlowError, clampPosition, isParentSelected } from '.' import type { Actions, CoordinateExtent, @@ -9,7 +8,8 @@ import type { NodeDragItem, State, XYPosition, -} from '~/types' +} from '../types' +import { ErrorCode, VueFlowError, clampPosition, isParentSelected } from '.' export function hasSelector(target: Element, selector: string, node: Element): boolean { let current = target diff --git a/packages/core/src/utils/edge.ts b/packages/core/src/utils/edge.ts index b10c24a9..a1c239e3 100644 --- a/packages/core/src/utils/edge.ts +++ b/packages/core/src/utils/edge.ts @@ -1,6 +1,6 @@ +import type { Actions, EdgePositions, GraphEdge, GraphNode, HandleElement, Rect, ViewportTransform, XYPosition } from '../types' +import { Position } from '../types' import { rectToBox } from '.' -import type { Actions, EdgePositions, GraphEdge, GraphNode, HandleElement, Rect, ViewportTransform, XYPosition } from '~/types' -import { Position } from '~/types' export function getHandlePosition(position: Position, rect: Rect, handle: HandleElement | null): XYPosition { const x = (handle?.x ?? 0) + rect.x diff --git a/packages/core/src/utils/graph.ts b/packages/core/src/utils/graph.ts index 18eee15d..c93a2f5d 100644 --- a/packages/core/src/utils/graph.ts +++ b/packages/core/src/utils/graph.ts @@ -1,5 +1,4 @@ import { markRaw } from 'vue' -import { isDef, warn } from '.' import type { Actions, Box, @@ -21,7 +20,8 @@ import type { ViewportTransform, XYPosition, XYZPosition, -} from '~/types' +} from '../types' +import { isDef, warn } from '.' import { useWindow } from '~/composables' export function nodeToRect(node: GraphNode): Rect { diff --git a/packages/core/src/utils/handle.ts b/packages/core/src/utils/handle.ts index 2940b5c6..3264d097 100644 --- a/packages/core/src/utils/handle.ts +++ b/packages/core/src/utils/handle.ts @@ -1,5 +1,4 @@ -import { getEventPosition } from '.' -import { ConnectionMode } from '~/types' +import { ConnectionMode } from '../types' import type { Actions, Connection, @@ -12,7 +11,8 @@ import type { ValidConnectionFunc, ValidHandleResult, XYPosition, -} from '~/types' +} from '../types' +import { getEventPosition } from '.' export interface ConnectionHandle extends XYPosition, Dimensions { id: string | null diff --git a/packages/core/src/utils/node.ts b/packages/core/src/utils/node.ts index 8d98addf..d2eaa97b 100644 --- a/packages/core/src/utils/node.ts +++ b/packages/core/src/utils/node.ts @@ -1,7 +1,7 @@ import type { Ref } from 'vue' import { nextTick } from 'vue' +import type { Actions, GraphNode, HandleElement, Position } from '../types' import { getDimensions } from '.' -import type { Actions, GraphNode, HandleElement, Position } from '~/types' export function getHandleBounds(selector: string, nodeElement: HTMLDivElement, zoom: number): HandleElement[] | undefined { const handles = nodeElement.querySelectorAll(`.vue-flow__handle${selector}`) diff --git a/packages/core/src/utils/store.ts b/packages/core/src/utils/store.ts index ae79bf98..24c84f75 100644 --- a/packages/core/src/utils/store.ts +++ b/packages/core/src/utils/store.ts @@ -1,6 +1,6 @@ import { unref } from 'vue' +import type { Actions, Connection, Edge, GraphEdge, GraphNode, Node, State } from '../types' import { ErrorCode, VueFlowError, connectionExists, getEdgeId, isEdge, isNode, parseEdge, parseNode } from '.' -import type { Actions, Connection, Edge, GraphEdge, GraphNode, Node, State } from '~/types' type NonUndefined = T extends undefined ? never : T diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index a28c93fd..85005ecc 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -6,19 +6,7 @@ "resolveJsonModule": true, "types": [ "vite/client", - "vue/macros", - ], - "paths": { - "~/*": [ - "src/*" - ] - }, - "plugins": [ - // Transform paths in output .d.ts files (Include this line if you output declarations files) - { - "transform": "typescript-transform-paths", - "afterDeclarations": true - } + "vue/macros" ] }, "include": [ diff --git a/packages/core/tsconfig.node.json b/packages/core/tsconfig.node.json index 13059dfb..1418c515 100644 --- a/packages/core/tsconfig.node.json +++ b/packages/core/tsconfig.node.json @@ -6,6 +6,11 @@ "resolveJsonModule": true, "allowSyntheticDefaultImports": true }, - "include": ["vite.config.ts", "vite.config.iife.ts"], - "files": ["package.json"] + "include": [ + "vite.config.ts", + "vite.config.iife.ts" + ], + "files": [ + "package.json" + ] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8b87e324..3a9d17ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -330,12 +330,6 @@ importers: postcss-nested: specifier: ^6.0.1 version: 6.0.1(postcss@8.4.31) - ts-patch: - specifier: ^3.0.2 - version: 3.0.2 - typescript-transform-paths: - specifier: ^3.4.6 - version: 3.4.6(typescript@4.9.5) vite: specifier: ^4.4.11 version: 4.4.11(@types/node@18.18.4) @@ -6622,15 +6616,6 @@ packages: ini: 2.0.0 dev: true - /global-prefix@3.0.0: - resolution: {integrity: sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==} - engines: {node: '>=6'} - dependencies: - ini: 1.3.8 - kind-of: 6.0.3 - which: 1.3.1 - dev: true - /globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} @@ -10392,18 +10377,6 @@ packages: engines: {node: '>=8'} dev: true - /ts-patch@3.0.2: - resolution: {integrity: sha512-iTg8euqiNsNM1VDfOsVIsP0bM4kAVXU38n7TGQSkky7YQX/syh6sDPIRkvSS0HjT8ZOr0pq1h+5Le6jdB3hiJQ==} - hasBin: true - dependencies: - chalk: 4.1.2 - global-prefix: 3.0.0 - minimist: 1.2.8 - resolve: 1.22.6 - semver: 7.5.4 - strip-ansi: 6.0.1 - dev: true - /tsconfig-paths@3.14.2: resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} dependencies: @@ -10629,15 +10602,6 @@ packages: typescript: 4.9.5 dev: true - /typescript-transform-paths@3.4.6(typescript@4.9.5): - resolution: {integrity: sha512-qdgpCk9oRHkIBhznxaHAapCFapJt5e4FbFik7Y4qdqtp6VyC3smAIPoDEIkjZ2eiF7x5+QxUPYNwJAtw0thsTw==} - peerDependencies: - typescript: '>=3.6.5' - dependencies: - minimatch: 3.1.2 - typescript: 4.9.5 - dev: true - /typescript@4.9.5: resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} engines: {node: '>=4.2.0'}