diff --git a/src/mixins/withEvents.ts b/src/components/canvas/EventedComponent/EventedComponent.ts similarity index 98% rename from src/mixins/withEvents.ts rename to src/components/canvas/EventedComponent/EventedComponent.ts index 04b5fcf..1fcab34 100644 --- a/src/mixins/withEvents.ts +++ b/src/components/canvas/EventedComponent/EventedComponent.ts @@ -1,4 +1,4 @@ -import { Component, TComponentContext, TComponentProps, TComponentState } from "../lib/Component"; +import { Component, TComponentContext, TComponentProps, TComponentState } from "../../../lib/Component"; type TEventedComponentListener = Component | ((e: Event) => void); diff --git a/src/components/canvas/anchors/index.ts b/src/components/canvas/anchors/index.ts index b29ea87..fdb07d2 100644 --- a/src/components/canvas/anchors/index.ts +++ b/src/components/canvas/anchors/index.ts @@ -4,7 +4,7 @@ import { AnchorState, EAnchorType } from "../../../store/anchor/Anchor"; import { TBlockId } from "../../../store/block/Block"; import { selectBlockAnchor } from "../../../store/block/selectors"; import { TPoint } from "../../../utils/types/shapes"; -import { GraphComponent } from "../graphComponent"; +import { GraphComponent } from "../GraphComponent"; import { GraphLayer, TGraphLayerContext } from "../layers/graphLayer/GraphLayer"; export type TAnchor = { diff --git a/src/components/canvas/blocks/Block.ts b/src/components/canvas/blocks/Block.ts index 1b97969..7bd610b 100644 --- a/src/components/canvas/blocks/Block.ts +++ b/src/components/canvas/blocks/Block.ts @@ -11,8 +11,8 @@ import { TMeasureTextOptions } from "../../../utils/functions/text"; import { TTExtRect, renderText } from "../../../utils/renderers/text"; import { EVENTS } from "../../../utils/types/events"; import { TPoint, TRect } from "../../../utils/types/shapes"; +import { GraphComponent } from "../GraphComponent"; import { Anchor, TAnchor } from "../anchors"; -import { GraphComponent } from "../graphComponent"; import { GraphLayer, TGraphLayerContext } from "../layers/graphLayer/GraphLayer"; import { BlockController } from "./controllers/BlockController"; diff --git a/src/components/canvas/connections/BaseConnection.ts b/src/components/canvas/connections/BaseConnection.ts index 91eddd7..1e04554 100644 --- a/src/components/canvas/connections/BaseConnection.ts +++ b/src/components/canvas/connections/BaseConnection.ts @@ -3,9 +3,9 @@ import { TComponentState } from "../../../lib/Component"; import { ConnectionState, TConnection, TConnectionId } from "../../../store/connection/ConnectionState"; import { selectConnectionById } from "../../../store/connection/selectors"; import { TPoint } from "../../../utils/types/shapes"; +import { GraphComponent, GraphComponentContext } from "../GraphComponent"; import { TAnchor } from "../anchors"; import { Block } from "../blocks/Block"; -import { GraphComponent, GraphComponentContext } from "../graphComponent"; export type TBaseConnectionProps = { id: TConnectionId; diff --git a/src/components/canvas/graphComponent/index.tsx b/src/components/canvas/graphComponent/index.tsx index 85ac15e..fbeedab 100644 --- a/src/components/canvas/graphComponent/index.tsx +++ b/src/components/canvas/graphComponent/index.tsx @@ -3,8 +3,8 @@ import { Signal } from "@preact/signals-core"; import { Graph } from "../../../graph"; import { Component } from "../../../lib"; import { TComponentContext, TComponentProps, TComponentState } from "../../../lib/Component"; -import { EventedComponent } from "../../../mixins/withEvents"; import { HitBox, HitBoxData } from "../../../services/HitTest"; +import { EventedComponent } from "../EventedComponent/EventedComponent"; import { TGraphLayerContext } from "../layers/graphLayer/GraphLayer"; diff --git a/src/components/canvas/layers/graphLayer/GraphLayer.ts b/src/components/canvas/layers/graphLayer/GraphLayer.ts index 07426dd..ff7ad6c 100644 --- a/src/components/canvas/layers/graphLayer/GraphLayer.ts +++ b/src/components/canvas/layers/graphLayer/GraphLayer.ts @@ -1,11 +1,11 @@ import { Graph } from "../../../../graph"; import { GraphMouseEventNames, isNativeGraphEventName } from "../../../../graphEvents"; import { Component } from "../../../../lib/Component"; -import { EventedComponent } from "../../../../mixins/withEvents"; import { Layer, LayerContext, LayerProps } from "../../../../services/Layer"; import { Camera, TCameraProps } from "../../../../services/camera/Camera"; import { ICamera } from "../../../../services/camera/CameraService"; import { getEventDelta } from "../../../../utils/functions"; +import { EventedComponent } from "../../EventedComponent/EventedComponent"; import { Blocks } from "../../blocks/Blocks"; import { BlockConnection } from "../../connections/BlockConnection"; import { BlockConnections } from "../../connections/BlockConnections"; diff --git a/src/components/canvas/layers/graphLayer/helpers.ts b/src/components/canvas/layers/graphLayer/helpers.ts index a27c808..2260ca1 100644 --- a/src/components/canvas/layers/graphLayer/helpers.ts +++ b/src/components/canvas/layers/graphLayer/helpers.ts @@ -1,4 +1,4 @@ -import { GraphComponent } from "../../graphComponent"; +import { GraphComponent } from "../../GraphComponent"; export class DrawBelow extends GraphComponent { protected shouldUpdateChildren = false; diff --git a/src/graph.ts b/src/graph.ts index 9116537..7bb781a 100644 --- a/src/graph.ts +++ b/src/graph.ts @@ -2,8 +2,8 @@ import { batch, signal } from "@preact/signals-core"; import merge from "lodash/merge"; import { PublicGraphApi, ZoomConfig } from "./api/PublicGraphApi"; +import { GraphComponent } from "./components/canvas/GraphComponent"; import { TBlock } from "./components/canvas/blocks/Block"; -import { GraphComponent } from "./components/canvas/graphComponent"; import { BelowLayer } from "./components/canvas/layers/belowLayer/BelowLayer"; import { GraphLayer } from "./components/canvas/layers/graphLayer/GraphLayer"; import { OverLayer } from "./components/canvas/layers/overLayer/OverLayer"; diff --git a/src/graphEvents.ts b/src/graphEvents.ts index 1e82e61..eed1731 100644 --- a/src/graphEvents.ts +++ b/src/graphEvents.ts @@ -1,6 +1,6 @@ +import { EventedComponent } from "./components/canvas/EventedComponent/EventedComponent"; import { GraphState } from "./graph"; import { TGraphColors, TGraphConstants } from "./graphConfig"; -import { EventedComponent } from "./mixins/withEvents"; import { TCameraState } from "./services/camera/CameraService"; export type GraphMouseEvent = CustomEvent<{ diff --git a/src/lib/Tree.ts b/src/lib/Tree.ts index 6216b57..56c9834 100644 --- a/src/lib/Tree.ts +++ b/src/lib/Tree.ts @@ -3,7 +3,7 @@ import { cache } from "./utils"; type TIterator = (node: Tree) => boolean; export interface ITree { - iterate(): void; + iterate(): boolean; } export class Tree { diff --git a/src/services/camera/Camera.ts b/src/services/camera/Camera.ts index f357b64..c408726 100644 --- a/src/services/camera/Camera.ts +++ b/src/services/camera/Camera.ts @@ -1,6 +1,6 @@ +import { EventedComponent } from "../../components/canvas/EventedComponent/EventedComponent"; import { TGraphLayerContext } from "../../components/canvas/layers/graphLayer/GraphLayer"; import { Component } from "../../lib"; -import { EventedComponent } from "../../mixins/withEvents"; import { getXY, isMetaKeyEvent, isTrackpadWheelEvent, isWindows } from "../../utils/functions"; import { clamp } from "../../utils/functions/clamp"; import { dragListener } from "../../utils/functions/dragListener";