@flowgram.ai/free-layout-core 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
2
2
  export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, useRefresh, useService } from '@flowgram.ai/core';
3
3
  import { NodeFormProps } from '@flowgram.ai/node';
4
4
  import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
5
- import { W as WorkflowJSON, L as LineCenterPoint, a as WorkflowDocument, b as WorkflowNodeEntity, c as WorkflowHoverService, d as WorkflowLinesManager, e as WorkflowSelectService, f as WorkflowDocumentOptions, g as LineEventProps, N as NodesDragEvent, h as WorkflowNodeJSON, i as WorkflowPortEntity, j as WorkflowLineEntity, O as OnDragLineEnd, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-node-entity-DgQT-wl9.mjs';
6
- export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-DgQT-wl9.mjs';
5
+ import { W as WorkflowJSON, L as LineCenterPoint, a as WorkflowDocument, b as WorkflowNodeEntity, c as WorkflowHoverService, d as WorkflowLinesManager, e as WorkflowSelectService, f as WorkflowDocumentOptions, g as LineEventProps, N as NodesDragEvent, h as WorkflowNodeJSON, i as WorkflowPortEntity, j as WorkflowLineEntity, O as OnDragLineEnd, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-node-entity-DH5qlw7I.mjs';
6
+ export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-DH5qlw7I.mjs';
7
7
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
8
8
  import { IPoint, Rectangle, DisposableCollection, Disposable } from '@flowgram.ai/utils';
9
9
  export { compose, composeAsync, delay } from '@flowgram.ai/utils';
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
2
2
  export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, useRefresh, useService } from '@flowgram.ai/core';
3
3
  import { NodeFormProps } from '@flowgram.ai/node';
4
4
  import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
5
- import { W as WorkflowJSON, L as LineCenterPoint, a as WorkflowDocument, b as WorkflowNodeEntity, c as WorkflowHoverService, d as WorkflowLinesManager, e as WorkflowSelectService, f as WorkflowDocumentOptions, g as LineEventProps, N as NodesDragEvent, h as WorkflowNodeJSON, i as WorkflowPortEntity, j as WorkflowLineEntity, O as OnDragLineEnd, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-node-entity-kGsp2Roz.js';
6
- export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-kGsp2Roz.js';
5
+ import { W as WorkflowJSON, L as LineCenterPoint, a as WorkflowDocument, b as WorkflowNodeEntity, c as WorkflowHoverService, d as WorkflowLinesManager, e as WorkflowSelectService, f as WorkflowDocumentOptions, g as LineEventProps, N as NodesDragEvent, h as WorkflowNodeJSON, i as WorkflowPortEntity, j as WorkflowLineEntity, O as OnDragLineEnd, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-node-entity-DWVtlA2a.js';
6
+ export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-DWVtlA2a.js';
7
7
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
8
8
  import { IPoint, Rectangle, DisposableCollection, Disposable } from '@flowgram.ai/utils';
9
9
  export { compose, composeAsync, delay } from '@flowgram.ai/utils';
package/dist/index.js CHANGED
@@ -225,6 +225,27 @@ var import_core5 = require("@flowgram.ai/core");
225
225
  var import_utils5 = require("@flowgram.ai/utils");
226
226
  var import_document3 = require("@flowgram.ai/document");
227
227
  var import_core4 = require("@flowgram.ai/core");
228
+
229
+ // src/utils/location-config-to-point.ts
230
+ function locationConfigToPoint(bounds, config, _offset = { x: 0, y: 0 }) {
231
+ const offset = { ..._offset };
232
+ if (config.left !== void 0) {
233
+ offset.x += typeof config.left === "string" ? parseFloat(config.left) * 0.01 * bounds.width : config.left;
234
+ } else if (config.right !== void 0) {
235
+ offset.x += bounds.width - (typeof config.right === "string" ? parseFloat(config.right) * 0.01 * bounds.width : config.right);
236
+ }
237
+ if (config.top !== void 0) {
238
+ offset.y += typeof config.top === "string" ? parseFloat(config.top) * 0.01 * bounds.height : config.top;
239
+ } else if (config.bottom !== void 0) {
240
+ offset.y += bounds.height - (typeof config.bottom === "string" ? parseFloat(config.bottom) * 0.01 * bounds.height : config.bottom);
241
+ }
242
+ return {
243
+ x: bounds.x + offset.x,
244
+ y: bounds.y + offset.y
245
+ };
246
+ }
247
+
248
+ // src/entities/workflow-port-entity.ts
228
249
  var PORT_SIZE = 24;
229
250
  var WorkflowPortEntity = class extends import_core4.Entity {
230
251
  constructor(opts) {
@@ -237,6 +258,7 @@ var WorkflowPortEntity = class extends import_core4.Entity {
237
258
  this.portType = opts.type;
238
259
  this._disabled = opts.disabled;
239
260
  this._offset = opts.offset;
261
+ this._locationConfig = opts.locationConfig;
240
262
  this._location = opts.location;
241
263
  this._size = opts.size;
242
264
  this.node = opts.node;
@@ -284,7 +306,7 @@ var WorkflowPortEntity = class extends import_core4.Entity {
284
306
  return "right";
285
307
  }
286
308
  get point() {
287
- const { targetElement } = this;
309
+ const { targetElement, _locationConfig } = this;
288
310
  const { bounds } = this.node.getData(import_document3.FlowNodeTransformData);
289
311
  const location2 = this.location;
290
312
  if (targetElement) {
@@ -299,8 +321,14 @@ var WorkflowPortEntity = class extends import_core4.Entity {
299
321
  location: location2
300
322
  };
301
323
  }
302
- let point = { x: 0, y: 0 };
324
+ if (_locationConfig) {
325
+ return {
326
+ ...locationConfigToPoint(bounds, _locationConfig, this._offset),
327
+ location: location2
328
+ };
329
+ }
303
330
  const offset = this._offset || { x: 0, y: 0 };
331
+ let point = { x: 0, y: 0 };
304
332
  switch (location2) {
305
333
  case "left":
306
334
  point = bounds.leftCenter;
@@ -413,6 +441,10 @@ var WorkflowPortEntity = class extends import_core4.Entity {
413
441
  this._offset = data.offset;
414
442
  changed = true;
415
443
  }
444
+ if (import_utils5.Compare.isChanged(data.locationConfig, this._locationConfig)) {
445
+ this._locationConfig = data.locationConfig;
446
+ changed = true;
447
+ }
416
448
  if (import_utils5.Compare.isChanged(data.size, this._size)) {
417
449
  this._size = data.size;
418
450
  changed = true;