@flowgram.ai/renderer 0.4.13 → 0.4.15

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
@@ -1,7 +1,7 @@
1
- import { LABEL_SIDE_TYPE, FlowNodeTransitionData, FlowNodeEntity, FlowNodeTransformData, FlowDocument, FlowDocumentTransformerEntity, FlowNodeRenderData, FlowDragService, FlowRendererStateEntity } from '@flowgram.ai/document';
2
- import { ConfigEntity, EntityOpts, PlaygroundDragEvent, PositionSchema, SizeSchema, Layer, PipelineRegistry, LayerRegistry, PlaygroundConfigEntity, PlaygroundDrag, EditorStateConfigEntity, LayerOptions, ContextMenuService, SelectionService, PlaygroundConfig, CommandRegistry } from '@flowgram.ai/core';
3
1
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
4
2
  import { Rectangle, Disposable, CacheOriginItem, ScrollSchema } from '@flowgram.ai/utils';
3
+ import { LABEL_SIDE_TYPE, FlowNodeTransitionData, FlowNodeEntity, FlowNodeTransformData, FlowDocument, FlowDocumentTransformerEntity, FlowNodeRenderData, FlowDragService, FlowRendererStateEntity } from '@flowgram.ai/document';
4
+ import { ConfigEntity, EntityOpts, PlaygroundDragEvent, PositionSchema, SizeSchema, Layer, PipelineRegistry, LayerRegistry, PlaygroundConfigEntity, PlaygroundDrag, EditorStateConfigEntity, LayerOptions, ContextMenuService, SelectionService, PlaygroundConfig, CommandRegistry } from '@flowgram.ai/core';
5
5
  import React from 'react';
6
6
  import { throttle } from 'lodash-es';
7
7
  import { ContainerModule } from 'inversify';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { LABEL_SIDE_TYPE, FlowNodeTransitionData, FlowNodeEntity, FlowNodeTransformData, FlowDocument, FlowDocumentTransformerEntity, FlowNodeRenderData, FlowDragService, FlowRendererStateEntity } from '@flowgram.ai/document';
2
- import { ConfigEntity, EntityOpts, PlaygroundDragEvent, PositionSchema, SizeSchema, Layer, PipelineRegistry, LayerRegistry, PlaygroundConfigEntity, PlaygroundDrag, EditorStateConfigEntity, LayerOptions, ContextMenuService, SelectionService, PlaygroundConfig, CommandRegistry } from '@flowgram.ai/core';
3
1
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
4
2
  import { Rectangle, Disposable, CacheOriginItem, ScrollSchema } from '@flowgram.ai/utils';
3
+ import { LABEL_SIDE_TYPE, FlowNodeTransitionData, FlowNodeEntity, FlowNodeTransformData, FlowDocument, FlowDocumentTransformerEntity, FlowNodeRenderData, FlowDragService, FlowRendererStateEntity } from '@flowgram.ai/document';
4
+ import { ConfigEntity, EntityOpts, PlaygroundDragEvent, PositionSchema, SizeSchema, Layer, PipelineRegistry, LayerRegistry, PlaygroundConfigEntity, PlaygroundDrag, EditorStateConfigEntity, LayerOptions, ContextMenuService, SelectionService, PlaygroundConfig, CommandRegistry } from '@flowgram.ai/core';
5
5
  import React from 'react';
6
6
  import { throttle } from 'lodash-es';
7
7
  import { ContainerModule } from 'inversify';
package/dist/index.js CHANGED
@@ -36,8 +36,8 @@ var __decorateClass = (decorators, target, key, kind) => {
36
36
  };
37
37
 
38
38
  // src/index.ts
39
- var src_exports = {};
40
- __export(src_exports, {
39
+ var index_exports = {};
40
+ __export(index_exports, {
41
41
  FlowContextMenuLayer: () => FlowContextMenuLayer,
42
42
  FlowDebugLayer: () => FlowDebugLayer,
43
43
  FlowDragEntity: () => FlowDragEntity,
@@ -65,12 +65,12 @@ __export(src_exports, {
65
65
  createLines: () => createLines,
66
66
  useBaseColor: () => useBaseColor
67
67
  });
68
- module.exports = __toCommonJS(src_exports);
68
+ module.exports = __toCommonJS(index_exports);
69
69
 
70
70
  // src/entities/flow-drag-entity.tsx
71
+ var import_utils = require("@flowgram.ai/utils");
71
72
  var import_document3 = require("@flowgram.ai/document");
72
73
  var import_core2 = require("@flowgram.ai/core");
73
- var import_utils = require("@flowgram.ai/utils");
74
74
 
75
75
  // src/components/utils.tsx
76
76
  var import_document2 = require("@flowgram.ai/document");
@@ -444,23 +444,24 @@ var FlowDragEntity = class extends import_core2.ConfigEntity {
444
444
  this.containerDom = containerDom;
445
445
  this.containerX = x;
446
446
  this.containerY = y;
447
- const mouseToBottom = playgroundConfig.height + playgroundConfig.clientY - e.clientY;
447
+ const clientRect = this.playgroundConfigEntity.playgroundDomNode.getBoundingClientRect();
448
+ const mouseToBottom = playgroundConfig.height + clientRect.y - e.clientY;
448
449
  if (mouseToBottom < SCROLL_BOUNDING) {
449
450
  this._startScrollY(currentScrollY, true);
450
451
  return 1 /* BOTTOM */;
451
452
  }
452
- const mouseToTop = e.clientY - playgroundConfig.clientY;
453
+ const mouseToTop = e.clientY - clientRect.y;
453
454
  if (mouseToTop < SCROLL_BOUNDING) {
454
455
  this._startScrollY(currentScrollY, false);
455
456
  return 0 /* TOP */;
456
457
  }
457
458
  this._stopScrollY();
458
- const mouseToRight = playgroundConfig.width + playgroundConfig.clientX - e.clientX;
459
+ const mouseToRight = playgroundConfig.width + clientRect.x - e.clientX;
459
460
  if (mouseToRight < SCROLL_BOUNDING) {
460
461
  this._startScrollX(currentScrollX, true);
461
462
  return 3 /* RIGHT */;
462
463
  }
463
- const mouseToLeft = e.clientX - playgroundConfig.clientX;
464
+ const mouseToLeft = e.clientX - clientRect.x;
464
465
  if (mouseToLeft < SCROLL_BOUNDING + EDITOR_LEFT_BAR_WIDTH) {
465
466
  this._startScrollX(currentScrollX, false);
466
467
  return 2 /* LEFT */;
@@ -2393,8 +2394,9 @@ var FlowDragLayer = class extends import_core15.Layer {
2393
2394
  const scale = this.playgroundConfigEntity.finalScale;
2394
2395
  if (this.containerRef.current) {
2395
2396
  const dragNode = this.containerRef.current.children?.[0];
2396
- const dragBlockX = event.clientX - (this.pipelineNode.offsetLeft || 0) - this.playgroundConfigEntity.config.clientX - (dragNode.clientWidth - this.dragOffset.x) * scale;
2397
- const dragBlockY = event.clientY - (this.pipelineNode.offsetTop || 0) - this.playgroundConfigEntity.config.clientY - (dragNode.clientHeight - this.dragOffset.y) * scale;
2397
+ const clientBounds = this.playgroundConfigEntity.getClientBounds();
2398
+ const dragBlockX = event.clientX - (this.pipelineNode.offsetLeft || 0) - clientBounds.x - (dragNode.clientWidth - this.dragOffset.x) * scale;
2399
+ const dragBlockY = event.clientY - (this.pipelineNode.offsetTop || 0) - clientBounds.y - (dragNode.clientHeight - this.dragOffset.y) * scale;
2398
2400
  const isBranch = this.service.isDragBranch;
2399
2401
  const draggingRect = new import_utils22.Rectangle(
2400
2402
  dragBlockX,
@@ -2860,8 +2862,8 @@ FlowSelectorBoundsLayer = __decorateClass([
2860
2862
  // src/layers/flow-context-menu-layer.tsx
2861
2863
  var import_react17 = __toESM(require("react"));
2862
2864
  var import_inversify12 = require("inversify");
2863
- var import_core19 = require("@flowgram.ai/core");
2864
2865
  var import_utils25 = require("@flowgram.ai/utils");
2866
+ var import_core19 = require("@flowgram.ai/core");
2865
2867
  var FlowContextMenuLayer = class extends import_core19.Layer {
2866
2868
  constructor() {
2867
2869
  super(...arguments);
@@ -2888,8 +2890,9 @@ var FlowContextMenuLayer = class extends import_core19.Layer {
2888
2890
  e.stopPropagation();
2889
2891
  e.preventDefault();
2890
2892
  this.nodeRef.current?.setVisible(true);
2891
- const dragBlockX = e.clientX - (this.pipelineNode.offsetLeft || 0) - this.playgroundConfigEntity.config.clientX;
2892
- const dragBlockY = e.clientY - (this.pipelineNode.offsetTop || 0) - this.playgroundConfigEntity.config.clientY;
2893
+ const clientBounds = this.playgroundConfigEntity.getClientBounds();
2894
+ const dragBlockX = e.clientX - (this.pipelineNode.offsetLeft || 0) - clientBounds.x;
2895
+ const dragBlockY = e.clientY - (this.pipelineNode.offsetTop || 0) - clientBounds.y;
2893
2896
  this.node.style.left = `${dragBlockX}px`;
2894
2897
  this.node.style.top = `${dragBlockY}px`;
2895
2898
  },