@flowgram.ai/renderer 0.1.0-alpha.13 → 0.1.0-alpha.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/esm/index.js CHANGED
@@ -433,7 +433,7 @@ import { ConfigEntity as ConfigEntity2 } from "@flowgram.ai/core";
433
433
  import { Compare, Rectangle as Rectangle2 } from "@flowgram.ai/utils";
434
434
 
435
435
  // src/utils/find-selected-nodes.ts
436
- import { uniq } from "lodash";
436
+ import { uniq } from "lodash-es";
437
437
  function getNodePath(node) {
438
438
  const path = [node];
439
439
  node = node.parent;
@@ -626,7 +626,7 @@ import { injectable } from "inversify";
626
626
  import { Disposable } from "@flowgram.ai/utils";
627
627
 
628
628
  // src/utils/element.ts
629
- import { isNil } from "lodash";
629
+ import { isNil } from "lodash-es";
630
630
  var isHidden = (dom) => {
631
631
  if (!dom || isNil(dom?.offsetParent)) {
632
632
  return true;
@@ -843,7 +843,8 @@ var FlowRendererKey = /* @__PURE__ */ ((FlowRendererKey2) => {
843
843
  FlowRendererKey2["CONTEXT_MENU_POPOVER"] = "context-menu-popover";
844
844
  FlowRendererKey2["SUB_CANVAS"] = "sub-canvas";
845
845
  FlowRendererKey2["SLOT_ADDER"] = "slot-adder";
846
- FlowRendererKey2["SLOT_COLLPASE"] = "slot-collapse";
846
+ FlowRendererKey2["SLOT_LABEL"] = "slot-label";
847
+ FlowRendererKey2["SLOT_COLLAPSE"] = "slot-collapse";
847
848
  FlowRendererKey2["ARROW_RENDERER"] = "arrow-renderer";
848
849
  FlowRendererKey2["MARKER_ARROW"] = "marker-arrow";
849
850
  FlowRendererKey2["MARKER_ACTIVATE_ARROW"] = "marker-active-arrow";
@@ -1041,7 +1042,7 @@ FlowNodesContentLayer = __decorateClass([
1041
1042
 
1042
1043
  // src/layers/flow-lines-layer.tsx
1043
1044
  import React8 from "react";
1044
- import { groupBy, throttle } from "lodash";
1045
+ import { groupBy, throttle } from "lodash-es";
1045
1046
  import { inject as inject4, injectable as injectable5 } from "inversify";
1046
1047
  import { domUtils as domUtils3 } from "@flowgram.ai/utils";
1047
1048
  import {
@@ -1083,7 +1084,7 @@ var StraightLine_default = StraightLine;
1083
1084
 
1084
1085
  // src/components/RoundedTurningLine.tsx
1085
1086
  import React5, { useMemo } from "react";
1086
- import { isNil as isNil2 } from "lodash";
1087
+ import { isNil as isNil2 } from "lodash-es";
1087
1088
  import { Point } from "@flowgram.ai/utils";
1088
1089
  import { useService as useService2 } from "@flowgram.ai/core";
1089
1090
 
@@ -1194,6 +1195,10 @@ function RoundedTurningLine(props) {
1194
1195
  const moveY = isNil2(point.moveY) ? ry : point.moveY;
1195
1196
  outPoint.y += to.y < point.y ? -moveY : +moveY;
1196
1197
  }
1198
+ if (point.radiusOverflow === "truncate") {
1199
+ rx = radiusX;
1200
+ ry = radiusY;
1201
+ }
1197
1202
  const crossProduct = (point.x - inPoint.x) * (outPoint.y - inPoint.y) - (point.y - inPoint.y) * (outPoint.x - inPoint.x);
1198
1203
  const isClockWise = crossProduct > 0;
1199
1204
  return `L ${inPoint.x} ${inPoint.y} A ${rx} ${ry} 0 0 ${isClockWise ? 1 : 0} ${outPoint.x} ${outPoint.y}`;
@@ -1384,7 +1389,7 @@ FlowLinesLayer = __decorateClass([
1384
1389
 
1385
1390
  // src/layers/flow-labels-layer.tsx
1386
1391
  import React14 from "react";
1387
- import { throttle as throttle2 } from "lodash";
1392
+ import { throttle as throttle2 } from "lodash-es";
1388
1393
  import { inject as inject5, injectable as injectable6 } from "inversify";
1389
1394
  import { domUtils as domUtils4 } from "@flowgram.ai/utils";
1390
1395
  import {
@@ -1662,7 +1667,7 @@ function createLabels(labelProps) {
1662
1667
  const { labels, renderData } = data || {};
1663
1668
  const { activated } = renderData || {};
1664
1669
  const renderLabel = (label, index) => {
1665
- const { offset, renderKey, props, rotate, type } = label || {};
1670
+ const { offset, renderKey, props, rotate, origin, type } = label || {};
1666
1671
  const offsetX = offset.x;
1667
1672
  const offsetY = offset.y;
1668
1673
  let child = null;
@@ -1752,6 +1757,8 @@ function createLabels(labelProps) {
1752
1757
  default:
1753
1758
  break;
1754
1759
  }
1760
+ const originX = typeof origin?.[0] === "number" ? origin?.[0] : 0.5;
1761
+ const originY = typeof origin?.[1] === "number" ? origin?.[1] : 0.5;
1755
1762
  return /* @__PURE__ */ React13.createElement(
1756
1763
  "div",
1757
1764
  {
@@ -1761,7 +1768,7 @@ function createLabels(labelProps) {
1761
1768
  position: "absolute",
1762
1769
  left: offsetX,
1763
1770
  top: offsetY,
1764
- transform: "translate(-50%, -50%)"
1771
+ transform: `translate(-${originX * 100}%, -${originY * 100}%)`
1765
1772
  }
1766
1773
  },
1767
1774
  child