Skip to content

Commit 08a864c

Browse files
author
shuzarevich
committed
feat(index): enhance public API by exporting additional modules and interfaces
- Added exports for core functionalities to the main index file - Introduced new interfaces for node resize and rotate event data - Implemented a store for connection markers and plugins - Refactored existing methods to utilize the new store structure - Updated drag handler to improve event handling consistency
1 parent 8a48f35 commit 08a864c

File tree

119 files changed

+665
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+665
-450
lines changed

projects/f-flow/src/domain/f-canvas/center-group-or-node/center-group-or-node.execution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ export class CenterGroupOrNodeExecution implements IExecution<CenterGroupOrNodeR
4040
}
4141

4242
private getNode(id: string): FNodeBase | undefined {
43-
return this._store.fNodes.find((x) => x.fId() === id);
43+
return this._store.nodes.getAll<FNodeBase>().find((x) => x.fId() === id);
4444
}
4545

4646
private getNodeRect(fNode: FNodeBase): IRect {
4747
return RectExtensions.fromElement(fNode.hostElement);
4848
}
4949

5050
private getFlowRect(): IRect {
51-
return RectExtensions.fromElement(this._store.fFlow!.hostElement);
51+
return RectExtensions.fromElement(this._store.flowHost);
5252
}
5353
}

projects/f-flow/src/domain/f-canvas/fit-to-flow/fit-to-flow.execution.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { FExecutionRegister, FMediator, IExecution } from '@foblex/mediator';
44
import { IPoint, IRect, ITransformModel, PointExtensions, RectExtensions } from '@foblex/2d';
55
import { FComponentsStore } from '../../../f-storage';
66
import { CalculateNodesBoundingBoxRequest, RedrawCanvasWithAnimationRequest } from '../../../domain';
7+
import { FNodeBase } from '../../../f-node';
78

89
/**
910
* Fits all nodes and groups to the flow by scaling and positioning them
@@ -28,8 +29,8 @@ export class FitToFlowExecution implements IExecution<FitToFlowRequest, void> {
2829

2930
this.fitToParent(
3031
fNodesRect,
31-
RectExtensions.fromElement(this._store.fFlow!.hostElement),
32-
this._store.fNodes.map((x) => x._position),
32+
RectExtensions.fromElement(this._store.flowHost),
33+
this._store.nodes.getAll<FNodeBase>().map((x) => x._position),
3334
request.toCenter,
3435
);
3536

projects/f-flow/src/domain/f-canvas/reset-scale-and-center/reset-scale-and-center.execution.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { FExecutionRegister, FMediator, IExecution } from '@foblex/mediator';
44
import { IPoint, IRect, ITransformModel, PointExtensions, RectExtensions } from '@foblex/2d';
55
import { CalculateNodesBoundingBoxRequest, RedrawCanvasWithAnimationRequest } from '../../../domain';
66
import { FComponentsStore } from '../../../f-storage';
7+
import { FNodeBase } from '../../../f-node';
78

89
/**
910
* Execution that resets the scale of the canvas and centers the nodes and groups inside the flow.
@@ -26,8 +27,8 @@ export class ResetScaleAndCenterExecution implements IExecution<ResetScaleAndCen
2627
}
2728
this._oneToOneCentering(
2829
fNodesRect,
29-
RectExtensions.fromElement(this._store.fFlow!.hostElement),
30-
this._store.fNodes.map((x) => x._position),
30+
RectExtensions.fromElement(this._store.flowHost),
31+
this._store.nodes.getAll<FNodeBase>().map((x) => x._position),
3132
);
3233

3334
this._fMediator.execute(new RedrawCanvasWithAnimationRequest(request.animated));

projects/f-flow/src/domain/f-connection/add-connection-for-create-to-store/add-connection-for-create-to-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export class AddConnectionForCreateToStore
1414
private readonly _store = inject(FComponentsStore);
1515

1616
public handle({ connection }: AddConnectionForCreateToStoreRequest): void {
17-
this._store.fTempConnection = connection;
17+
this._store.connections.addForCreate(connection);
1818
}
1919
}

projects/f-flow/src/domain/f-connection/add-connection-marker-to-store/add-connection-marker-to-store-request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { FConnectionMarkerBase } from '../../../f-connection-v2';
33
export class AddConnectionMarkerToStoreRequest {
44
static readonly fToken = Symbol('AddConnectionMarkerToStoreRequest');
55

6-
constructor(public readonly component: FConnectionMarkerBase) {}
6+
constructor(public readonly instance: FConnectionMarkerBase) {}
77
}

projects/f-flow/src/domain/f-connection/add-connection-marker-to-store/add-connection-marker-to-store.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export class AddConnectionMarkerToStore
1313
{
1414
private readonly _store = inject(FComponentsStore);
1515

16-
public handle({ component }: AddConnectionMarkerToStoreRequest): void {
17-
this._store.addComponent(this._store.fMarkers, component);
16+
public handle({ instance }: AddConnectionMarkerToStoreRequest): void {
17+
this._store.connectionMarkers.add(instance);
18+
this._store.countChanged();
1819
}
1920
}

projects/f-flow/src/domain/f-connection/add-connection-to-store/add-connection-to-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class AddConnectionToStore implements IExecution<AddConnectionToStoreRequ
1212
private readonly _store = inject(FComponentsStore);
1313

1414
public handle({ connection }: AddConnectionToStoreRequest): void {
15-
this._store.fConnections.push(connection);
15+
this._store.connections.add(connection);
1616
this._store.dataChanged();
1717
}
1818
}

projects/f-flow/src/domain/f-connection/add-snap-connection-to-store/add-snap-connection-to-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export class AddSnapConnectionToStore implements IExecution<AddSnapConnectionToS
1212
private readonly _store = inject(FComponentsStore);
1313

1414
public handle({ connection }: AddSnapConnectionToStoreRequest): void {
15-
this._store.fSnapConnection = connection;
15+
this._store.connections.addForSnap(connection);
1616
}
1717
}

projects/f-flow/src/domain/f-connection/create-connection-markers/create-connection-markers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class CreateConnectionMarkers implements IExecution<CreateConnectionMarke
4040
}
4141

4242
public _findConnectionMarkers(connection: FConnectionBase): FConnectionMarkerBase[] {
43-
return this._store.fMarkers.filter((x) => connection.hostElement.contains(x.hostElement));
43+
return this._store.connectionMarkers.getAll<FConnectionMarkerBase>().filter((x) => connection.hostElement.contains(x.hostElement));
4444
}
4545

4646
// Safari does not support markers on path elements if markers are defined after the path element

projects/f-flow/src/domain/f-connection/redraw-connections/redraw-connections.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ export class RedrawConnections implements IExecution<RedrawConnectionsRequest, v
2828
public handle(_request: RedrawConnectionsRequest): void {
2929
this._resetConnectors();
3030

31-
if (this._store.fTempConnection) {
32-
this._createMarkers(this._store.fTempConnection);
31+
const instanceForCreate = this._store.connections.getForCreate<FConnectionBase>();
32+
if (instanceForCreate) {
33+
this._createMarkers(instanceForCreate);
3334
}
3435

35-
if (this._store.fSnapConnection) {
36-
this._createMarkers(this._store.fSnapConnection);
36+
const instanceForSnap = this._store.connections.getForSnap<FConnectionBase>();
37+
if (instanceForSnap) {
38+
this._createMarkers(instanceForSnap);
3739
}
3840

39-
this._store.fConnections.forEach((connection) => {
41+
this._store.connections.getAll<FConnectionBase>().forEach((connection) => {
4042
this._setupConnection(
4143
this._getSourceConnector(connection.fOutputId()),
4244
this._getTargetConnector(connection.fInputId()),

0 commit comments

Comments
 (0)