@flowgram.ai/document 0.3.5 → 0.4.0

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
@@ -542,6 +542,7 @@ declare class FlowNodeTransformData extends EntityData<FlowNodeTransformSchema>
542
542
  */
543
543
  get size(): SizeSchema;
544
544
  get position(): PositionSchema;
545
+ set position(position: PositionSchema);
545
546
  set size(size: SizeSchema);
546
547
  get inputPoint(): IPoint;
547
548
  get defaultInputPoint(): IPoint;
@@ -878,6 +879,10 @@ interface Vertex extends IPoint {
878
879
  radiusY?: number;
879
880
  moveX?: number;
880
881
  moveY?: number;
882
+ /**
883
+ * Strategy for handling arc curvature when space is insufficient, defaults to compress
884
+ */
885
+ radiusOverflow?: 'compress' | 'truncate';
881
886
  }
882
887
  interface FlowTransitionLine {
883
888
  type: FlowTransitionLineEnum;
@@ -907,6 +912,14 @@ interface FlowTransitionLabel {
907
912
  offset: IPoint;
908
913
  width?: number;
909
914
  rotate?: string;
915
+ /**
916
+ * Anchor point for positioning, relative to the label's bounding box
917
+ * 重心偏移量,相对于标签边界框
918
+ *
919
+ * Format: [x, y] / 格式:[x, y]
920
+ * Default Value: [0.5, 0.5] indicates center / 默认值:[0.5, 0.5] 表示居中
921
+ */
922
+ origin?: [number, number];
910
923
  props?: Record<string, any>;
911
924
  labelId?: string;
912
925
  }
package/dist/index.d.ts CHANGED
@@ -542,6 +542,7 @@ declare class FlowNodeTransformData extends EntityData<FlowNodeTransformSchema>
542
542
  */
543
543
  get size(): SizeSchema;
544
544
  get position(): PositionSchema;
545
+ set position(position: PositionSchema);
545
546
  set size(size: SizeSchema);
546
547
  get inputPoint(): IPoint;
547
548
  get defaultInputPoint(): IPoint;
@@ -878,6 +879,10 @@ interface Vertex extends IPoint {
878
879
  radiusY?: number;
879
880
  moveX?: number;
880
881
  moveY?: number;
882
+ /**
883
+ * Strategy for handling arc curvature when space is insufficient, defaults to compress
884
+ */
885
+ radiusOverflow?: 'compress' | 'truncate';
881
886
  }
882
887
  interface FlowTransitionLine {
883
888
  type: FlowTransitionLineEnum;
@@ -907,6 +912,14 @@ interface FlowTransitionLabel {
907
912
  offset: IPoint;
908
913
  width?: number;
909
914
  rotate?: string;
915
+ /**
916
+ * Anchor point for positioning, relative to the label's bounding box
917
+ * 重心偏移量,相对于标签边界框
918
+ *
919
+ * Format: [x, y] / 格式:[x, y]
920
+ * Default Value: [0.5, 0.5] indicates center / 默认值:[0.5, 0.5] 表示居中
921
+ */
922
+ origin?: [number, number];
910
923
  props?: Record<string, any>;
911
924
  labelId?: string;
912
925
  }
package/dist/index.js CHANGED
@@ -194,7 +194,8 @@ var DEFAULT_SPACING = {
194
194
  // block 底部留白
195
195
  INLINE_BLOCKS_PADDING_TOP: 30,
196
196
  // block list 上部留白间距
197
- [DefaultSpacingKey.INLINE_BLOCKS_PADDING_BOTTOM]: 40,
197
+ // JS 浮点数有误差,1046.6 -1006.6 = 39.9999999,会导致 间距/20 < 2 导致布局计算问题,因此需要额外增加 0.1 像素
198
+ [DefaultSpacingKey.INLINE_BLOCKS_PADDING_BOTTOM]: 40.1,
198
199
  // block lit 下部留白间距,因为有两个拐弯,所以翻一倍
199
200
  MIN_INLINE_BLOCK_SPACING: 200,
200
201
  // 分支间最小边距 (垂直布局)
@@ -538,6 +539,11 @@ var _FlowNodeTransformData = class _FlowNodeTransformData extends import_core2.E
538
539
  y: position.y
539
540
  };
540
541
  }
542
+ set position(position) {
543
+ this.transform.update({
544
+ position
545
+ });
546
+ }
541
547
  set size(size) {
542
548
  const { width, height } = this.data.size;
543
549
  if (this.isContainer) return;