orcasvn-react-diagrams 0.1.8 → 0.1.10

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.
Files changed (47) hide show
  1. package/dist/cjs/index.js +1435 -197
  2. package/dist/cjs/types/components/ports/port.d.ts +1 -1
  3. package/dist/cjs/types/components/shapes/halfCircle.d.ts +1 -1
  4. package/dist/cjs/types/components/shapes/polygon.d.ts +1 -1
  5. package/dist/cjs/types/components/shapes/rectangle.d.ts +1 -1
  6. package/dist/cjs/types/components/shapes/rectangularFrame.d.ts +1 -1
  7. package/dist/cjs/types/mocks/customPortWithBuiltinShape.d.ts +2 -0
  8. package/dist/cjs/types/mocks/port1.d.ts +2 -2
  9. package/dist/cjs/types/mocks/portIn.d.ts +2 -2
  10. package/dist/cjs/types/mocks/textsWithFlexBox.d.ts +2 -0
  11. package/dist/cjs/types/models/IElement.d.ts +4 -0
  12. package/dist/cjs/types/models/IElementProps.d.ts +4 -0
  13. package/dist/cjs/types/models/IFlexboxType.d.ts +20 -0
  14. package/dist/cjs/types/models/IPortProps.d.ts +1 -0
  15. package/dist/cjs/types/models/IText.d.ts +2 -0
  16. package/dist/cjs/types/models/ITextProps.d.ts +2 -0
  17. package/dist/cjs/types/models/implementations/CustomPortFromJSXElement.d.ts +7 -0
  18. package/dist/cjs/types/models/implementations/CustomPortFromShape.d.ts +7 -0
  19. package/dist/cjs/types/models/implementations/Element.d.ts +5 -1
  20. package/dist/cjs/types/models/implementations/Text.d.ts +3 -1
  21. package/dist/cjs/types/models/implementations/index.d.ts +1 -1
  22. package/dist/cjs/types/models/implementations/rectangularFrameElement.d.ts +3 -1
  23. package/dist/esm/index.js +1359 -121
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/types/components/ports/port.d.ts +1 -1
  26. package/dist/esm/types/components/shapes/halfCircle.d.ts +1 -1
  27. package/dist/esm/types/components/shapes/polygon.d.ts +1 -1
  28. package/dist/esm/types/components/shapes/rectangle.d.ts +1 -1
  29. package/dist/esm/types/components/shapes/rectangularFrame.d.ts +1 -1
  30. package/dist/esm/types/mocks/customPortWithBuiltinShape.d.ts +2 -0
  31. package/dist/esm/types/mocks/port1.d.ts +2 -2
  32. package/dist/esm/types/mocks/portIn.d.ts +2 -2
  33. package/dist/esm/types/mocks/textsWithFlexBox.d.ts +2 -0
  34. package/dist/esm/types/models/IElement.d.ts +4 -0
  35. package/dist/esm/types/models/IElementProps.d.ts +4 -0
  36. package/dist/esm/types/models/IFlexboxType.d.ts +20 -0
  37. package/dist/esm/types/models/IPortProps.d.ts +1 -0
  38. package/dist/esm/types/models/IText.d.ts +2 -0
  39. package/dist/esm/types/models/ITextProps.d.ts +2 -0
  40. package/dist/esm/types/models/implementations/CustomPortFromJSXElement.d.ts +7 -0
  41. package/dist/esm/types/models/implementations/CustomPortFromShape.d.ts +7 -0
  42. package/dist/esm/types/models/implementations/Element.d.ts +5 -1
  43. package/dist/esm/types/models/implementations/Text.d.ts +3 -1
  44. package/dist/esm/types/models/implementations/index.d.ts +1 -1
  45. package/dist/esm/types/models/implementations/rectangularFrameElement.d.ts +3 -1
  46. package/dist/index.d.ts +43 -9
  47. package/package.json +3 -2
package/dist/cjs/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var React = require('react');
5
+ var React$1 = require('react');
6
6
  var require$$0 = require('react-dom');
7
7
 
8
8
  exports.PositioningAnchor = void 0;
@@ -36,6 +36,8 @@ exports.TextAlign = void 0;
36
36
  TextAlign[TextAlign["center"] = 2] = "center";
37
37
  })(exports.TextAlign || (exports.TextAlign = {}));
38
38
 
39
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
40
+
39
41
  function getDefaultExportFromCjs (x) {
40
42
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
41
43
  }
@@ -441,7 +443,7 @@ function generateUniqueId() {
441
443
  }
442
444
 
443
445
  var Element$1 = /** @class */ (function () {
444
- function Element(x, y, width, height, cssClass, renderShape, texts, ports, portMovealeAreas, portSlideRailSVGClassName, portDirection, parentElement) {
446
+ function Element(x, y, width, height, cssClass, renderShape, texts, ports, portMovealeAreas, portSlideRailSVGClassName, portDirection, parentElement, textsPlaceHolderClassName, textsPlaceHolderFlexStyle, textsPlaceHolderFlexboxPosition) {
445
447
  if (portMovealeAreas === void 0) { portMovealeAreas = []; }
446
448
  this.resizability = {
447
449
  enabled: true,
@@ -460,6 +462,9 @@ var Element$1 = /** @class */ (function () {
460
462
  this.portSlideRailSVGClassName = portSlideRailSVGClassName;
461
463
  this.portDirection = portDirection;
462
464
  this.parentElement = parentElement;
465
+ this.textsPlaceHolderClassName = textsPlaceHolderClassName;
466
+ this.textsPlaceHolderFlexStyle = textsPlaceHolderFlexStyle;
467
+ this.textsPlaceHolderFlexboxPosition = textsPlaceHolderFlexboxPosition;
463
468
  }
464
469
  Object.defineProperty(Element.prototype, "id", {
465
470
  get: function () {
@@ -612,13 +617,14 @@ var ElementLink$1 = /** @class */ (function () {
612
617
  }());
613
618
 
614
619
  var Text$2 = /** @class */ (function () {
615
- function Text(content, width, height, x, y, align, fontSize, border) {
620
+ function Text(content, width, height, x, y, align, fontSize, border, style) {
616
621
  this._id = generateUniqueId();
617
622
  this.content = content;
618
623
  this.align = align;
619
624
  this.fontSize = fontSize;
620
625
  this.border = border;
621
626
  this.size = { width: width, height: height };
627
+ this.style = style;
622
628
  if (x && y) {
623
629
  this.position = { x: x, y: y };
624
630
  }
@@ -747,7 +753,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
747
753
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
748
754
  };
749
755
 
750
- var ShapeWrapper = React.forwardRef(function (shapeProps, ref) {
756
+ var ShapeWrapper = React$1.forwardRef(function (shapeProps, ref) {
751
757
  //if direction is provided, rotation is based on direction
752
758
  var rotation = shapeProps.rotation || 0;
753
759
  if (shapeProps.direction) {
@@ -777,7 +783,7 @@ var ShapeWrapper = React.forwardRef(function (shapeProps, ref) {
777
783
  position.x = position.x - shapeProps.width / 2;
778
784
  position.y = position.y - shapeProps.height / 2;
779
785
  }
780
- var objectOfAllEventAttributes = React.useMemo(function () {
786
+ var objectOfAllEventAttributes = React$1.useMemo(function () {
781
787
  var arrayOfAllEventAttributes = Object.entries(shapeProps).filter(function (_a) {
782
788
  var k = _a[0]; _a[1];
783
789
  return k.startsWith('on');
@@ -787,26 +793,26 @@ var ShapeWrapper = React.forwardRef(function (shapeProps, ref) {
787
793
  var viewboxWidth = shapeProps.width > shapeProps.height ? 100 : shapeProps.width / shapeProps.height * 100;
788
794
  var viewBoxHeight = shapeProps.height > shapeProps.width ? 100 : shapeProps.height / shapeProps.width * 100;
789
795
  var viewBox = shapeProps.viewBox || "0 0 ".concat(viewboxWidth, " ").concat(viewBoxHeight);
790
- return (React.createElement("g", { transform: "rotate(".concat(rotation, ")"), style: { transformOrigin: transformOrigin, transformBox: "content-box" } },
791
- React.createElement("svg", __assign({ ref: ref, style: { overflow: "visible" }, x: position.x, y: position.y, width: shapeProps.width, height: shapeProps.height, className: shapeProps.cssClass, viewBox: viewBox }, objectOfAllEventAttributes), shapeProps.children)));
796
+ return (React$1.createElement("g", { transform: "rotate(".concat(rotation, ")"), style: { transformOrigin: transformOrigin, transformBox: "content-box" } },
797
+ React$1.createElement("svg", __assign({ ref: ref, style: { overflow: "visible" }, x: position.x, y: position.y, width: shapeProps.width, height: shapeProps.height, className: shapeProps.cssClass, viewBox: viewBox }, objectOfAllEventAttributes), shapeProps.children)));
792
798
  });
793
799
 
794
- var CustomShape = React.forwardRef(function (props, ref) {
795
- return (React.createElement(ShapeWrapper, __assign({}, props, { ref: ref }), props.children));
800
+ var CustomShape = React$1.forwardRef(function (props, ref) {
801
+ return (React$1.createElement(ShapeWrapper, __assign({}, props, { ref: ref }), props.children));
796
802
  });
797
803
 
798
- var CustomPort = /** @class */ (function (_super) {
799
- __extends(CustomPort, _super);
800
- function CustomPort(x, y, width, height, renderShape, shapePositioningAnchor, label) {
801
- var _this = _super.call(this, x, y, width, height, label, React.forwardRef(function (props, ref) {
802
- return (React.createElement(CustomShape, { ref: ref, x: props.x, y: props.y, width: props.width, height: props.height, rotation: props.rotation, positioningAnchor: shapePositioningAnchor, onClick: function (e) { var _a; return (_a = props.onSelected) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseDown: function (e) { var _a; return (_a = props.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseUp: function (e) { var _a; return (_a = props.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); } }, renderShape));
804
+ var CustomPortFromJSXElement = /** @class */ (function (_super) {
805
+ __extends(CustomPortFromJSXElement, _super);
806
+ function CustomPortFromJSXElement(x, y, width, height, renderCustomShape, label, shapePositioningAnchor) {
807
+ var _this = _super.call(this, x, y, width, height, label, React$1.forwardRef(function (props, ref) {
808
+ return (React$1.createElement(CustomShape, { ref: ref, x: props.x, y: props.y, width: props.width, height: props.height, rotation: props.rotation, positioningAnchor: shapePositioningAnchor, onClick: function (e) { var _a; return (_a = props.onSelected) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseDown: function (e) { var _a; return (_a = props.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseUp: function (e) { var _a; return (_a = props.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); } }, renderCustomShape));
803
809
  })) || this;
804
810
  return _this;
805
811
  }
806
- return CustomPort;
812
+ return CustomPortFromJSXElement;
807
813
  }(Port$1));
808
814
 
809
- var Circle = React.forwardRef(function (props, ref) {
815
+ var Circle = React$1.forwardRef(function (props, ref) {
810
816
  var s = { height: 100, width: 100 };
811
817
  if (props.r) {
812
818
  s.height = props.r * 2;
@@ -819,11 +825,11 @@ var Circle = React.forwardRef(function (props, ref) {
819
825
  s.height = props.height;
820
826
  s.width = props.width;
821
827
  }
822
- return (React.createElement(ShapeWrapper, __assign({ viewBox: '0 0 100 100' }, props, { width: s.width, height: s.height, ref: ref }),
823
- React.createElement("circle", { className: "".concat(props.portMoveableAreaCssClass), vectorEffect: "non-scaling-stroke", cx: 50, cy: 50, r: 50, fill: props.fill || 'transparent', stroke: props.stroke || "none", strokeWidth: props.strokeWidth })));
828
+ return (React$1.createElement(ShapeWrapper, __assign({ viewBox: '0 0 100 100' }, props, { width: s.width, height: s.height, ref: ref }),
829
+ React$1.createElement("circle", { className: "".concat(props.portMoveableAreaCssClass), vectorEffect: "non-scaling-stroke", cx: 50, cy: 50, r: 50, fill: props.fill || 'transparent', stroke: props.stroke || "none", strokeWidth: props.strokeWidth })));
824
830
  });
825
831
 
826
- var Crescent = function (props) {
832
+ var Crescent = React$1.forwardRef(function (props, ref) {
827
833
  var s = { height: 100, width: 100 };
828
834
  if (props.r) {
829
835
  s.height = props.r * 2;
@@ -837,11 +843,12 @@ var Crescent = function (props) {
837
843
  s.width = props.width;
838
844
  }
839
845
  var sw = props.stroke ? (props.strokeWidth || 1) : 0;
840
- return (React.createElement(ShapeWrapper, __assign({ viewBox: '0 0 100 100' }, props, { width: s.width, height: s.height }),
841
- React.createElement("path", { className: "".concat(props.portMoveableAreaCssClass), vectorEffect: "non-scaling-stroke", d: "M0,75 A50,50 0 1,1 100,75 Z", fill: props.fill || 'none', stroke: props.stroke || 'none', strokeWidth: sw })));
842
- };
846
+ return (React$1.createElement(ShapeWrapper, __assign({ ref: ref, viewBox: '0 0 100 100' }, props, { width: s.width, height: s.height }),
847
+ React$1.createElement("rect", { width: 100, height: 100, stroke: "transparent", fill: 'transparent' }),
848
+ React$1.createElement("path", { className: "".concat(props.portMoveableAreaCssClass), vectorEffect: "non-scaling-stroke", d: "M 0 75 A 50 50 0 1 1 100 75 Z", fill: props.fill || 'none', stroke: props.stroke || 'none', strokeWidth: sw })));
849
+ });
843
850
 
844
- var Rectangle = function (props) {
851
+ var Rectangle = React$1.forwardRef(function (props, ref) {
845
852
  var scaledWidth = props.width;
846
853
  var scaledHeight = props.height;
847
854
  if (props.width > 100 || props.height > 100) {
@@ -857,11 +864,11 @@ var Rectangle = function (props) {
857
864
  }
858
865
  }
859
866
  var sw = props.stroke ? (props.strokeWidth || 1) : 0;
860
- return (React.createElement(ShapeWrapper, __assign({}, props, { height: props.height, width: props.width }),
861
- React.createElement("rect", { className: "rect-border ".concat(props.portMoveableAreaCssClass), vectorEffect: "non-scaling-stroke", width: scaledWidth, height: scaledHeight, fill: props.fill || "transparent", stroke: props.stroke || "none", strokeWidth: sw })));
862
- };
867
+ return (React$1.createElement(ShapeWrapper, __assign({}, props, { ref: ref, height: props.height, width: props.width }),
868
+ React$1.createElement("rect", { className: "rect-border ".concat(props.portMoveableAreaCssClass), vectorEffect: "non-scaling-stroke", width: scaledWidth, height: scaledHeight, fill: props.fill || "transparent", stroke: props.stroke || "none", strokeWidth: sw })));
869
+ });
863
870
 
864
- var RectangularFrame = function (props) {
871
+ var RectangularFrame = React$1.forwardRef(function (props, ref) {
865
872
  var scaledWidth = props.width;
866
873
  var scaledHeight = props.height;
867
874
  if (props.width > 100 || props.height > 100) {
@@ -881,11 +888,11 @@ var RectangularFrame = function (props) {
881
888
  var fw = props.frameColor ? (props.frameWidth || 1) : 0;
882
889
  var scaledFw = scaledWidth / props.width * fw;
883
890
  var sw = props.stroke ? (props.strokeWidth || 1) : 0;
884
- return (React.createElement(ShapeWrapper, __assign({}, props, { height: props.height, width: props.width }),
885
- React.createElement("rect", { vectorEffect: "non-scaling-stroke", className: "rectangular-frame-outer-border ".concat(props.portMoveableAreaCssClass), x: vbX, y: vbY, width: scaledWidth, height: scaledHeight, fill: "none", stroke: props.stroke || "none", strokeWidth: sw }),
886
- React.createElement("rect", { vectorEffect: "non-scaling-stroke", className: 'rectangular-frame-hallway', x: vbX + scaledFw / 2, y: vbY + scaledFw / 2, width: scaledWidth - scaledFw, height: scaledHeight - scaledFw, stroke: props.frameColor || "none", strokeWidth: fw, fill: props.fill || "transparent" }),
887
- React.createElement("rect", { vectorEffect: "non-scaling-stroke", className: 'rectangular-frame-inner-border', x: vbX + scaledFw, y: vbY + scaledFw, width: scaledWidth - scaledFw * 2, height: scaledHeight - scaledFw * 2, stroke: props.stroke || "none", strokeWidth: sw, fill: props.fill || "transparent" })));
888
- };
891
+ return (React$1.createElement(ShapeWrapper, __assign({}, props, { ref: ref, height: props.height, width: props.width }),
892
+ React$1.createElement("rect", { vectorEffect: "non-scaling-stroke", className: "rectangular-frame-outer-border ".concat(props.portMoveableAreaCssClass), x: vbX, y: vbY, width: scaledWidth, height: scaledHeight, fill: "none", stroke: props.stroke || "none", strokeWidth: sw }),
893
+ React$1.createElement("rect", { vectorEffect: "non-scaling-stroke", className: 'rectangular-frame-hallway', x: vbX + scaledFw / 2, y: vbY + scaledFw / 2, width: scaledWidth - scaledFw, height: scaledHeight - scaledFw, stroke: props.frameColor || "none", strokeWidth: fw, fill: props.fill || "transparent" }),
894
+ React$1.createElement("rect", { vectorEffect: "non-scaling-stroke", className: 'rectangular-frame-inner-border', x: vbX + scaledFw, y: vbY + scaledFw, width: scaledWidth - scaledFw * 2, height: scaledHeight - scaledFw * 2, stroke: props.stroke || "none", strokeWidth: sw, fill: props.fill || "transparent" })));
895
+ });
889
896
 
890
897
  var createRoot;
891
898
 
@@ -959,17 +966,17 @@ var PORT_MOVING_OFFSET_THRESHOLD = 15;
959
966
  var SelectionFrame = function (props) {
960
967
  var _a;
961
968
  var bbox = (_a = props.targetSVGElement) === null || _a === void 0 ? void 0 : _a.getBBox();
962
- var _b = React.useState(props.width || (bbox === null || bbox === void 0 ? void 0 : bbox.width) || MIN_ELEMENT_SIZE), width = _b[0], setWidth = _b[1];
963
- var _c = React.useState(props.height || (bbox === null || bbox === void 0 ? void 0 : bbox.height) || MIN_ELEMENT_SIZE), height = _c[0], setHeight = _c[1];
969
+ var _b = React$1.useState(props.width || (bbox === null || bbox === void 0 ? void 0 : bbox.width) || MIN_ELEMENT_SIZE), width = _b[0], setWidth = _b[1];
970
+ var _c = React$1.useState(props.height || (bbox === null || bbox === void 0 ? void 0 : bbox.height) || MIN_ELEMENT_SIZE), height = _c[0], setHeight = _c[1];
964
971
  var x = 0;
965
972
  var y = 0;
966
973
  var framePadding = props.framePadding || 0;
967
974
  var r = 5;
968
- var _d = React.useState(false), draggingRect = _d[0], setDraggingRect = _d[1];
969
- var _e = React.useState(false), draggingCircle = _e[0], setDraggingCircle = _e[1];
970
- var _f = React.useState(0), startX = _f[0], setStartX = _f[1];
971
- var _g = React.useState(0), startY = _g[0], setStartY = _g[1];
972
- var _h = React.useState(0), lastMoveTime = _h[0], setLastMoveTime = _h[1];
975
+ var _d = React$1.useState(false), draggingRect = _d[0], setDraggingRect = _d[1];
976
+ var _e = React$1.useState(false), draggingCircle = _e[0], setDraggingCircle = _e[1];
977
+ var _f = React$1.useState(0), startX = _f[0], setStartX = _f[1];
978
+ var _g = React$1.useState(0), startY = _g[0], setStartY = _g[1];
979
+ var _h = React$1.useState(0), lastMoveTime = _h[0], setLastMoveTime = _h[1];
973
980
  var addRectHandleMouseDown = function (event) {
974
981
  event.stopPropagation();
975
982
  if (!draggingCircle) {
@@ -979,7 +986,7 @@ var SelectionFrame = function (props) {
979
986
  setStartY(event.clientY);
980
987
  }
981
988
  };
982
- var rectHandleMouseMove = React.useCallback(function (event) {
989
+ var rectHandleMouseMove = React$1.useCallback(function (event) {
983
990
  var mouseEvent = event;
984
991
  if (draggingRect) {
985
992
  var offsetX = mouseEvent.clientX - startX;
@@ -1002,7 +1009,7 @@ var SelectionFrame = function (props) {
1002
1009
  }
1003
1010
  }
1004
1011
  }, [draggingRect, props.onMove, props.movingRate, startX, startY, lastMoveTime]);
1005
- React.useEffect(function () {
1012
+ React$1.useEffect(function () {
1006
1013
  var addRectHandleMouseUp = function () {
1007
1014
  //mouse up
1008
1015
  setDraggingRect(false);
@@ -1027,7 +1034,7 @@ var SelectionFrame = function (props) {
1027
1034
  setDraggingCircle(true);
1028
1035
  }
1029
1036
  };
1030
- React.useEffect(function () {
1037
+ React$1.useEffect(function () {
1031
1038
  var circleHandleMouseMove = function (event) {
1032
1039
  var mouseEvent = event;
1033
1040
  if (draggingCircle) {
@@ -1083,15 +1090,15 @@ var SelectionFrame = function (props) {
1083
1090
  leftX -= rectangleSize / 2;
1084
1091
  topY -= rectangleSize / 2;
1085
1092
  }
1086
- return (React.createElement(React.Fragment, null,
1087
- props.dragDropHandlerElement && React.createElement(props.dragDropHandlerElement, { dragging: draggingRect, onMouseDown: addRectHandleMouseDown }),
1088
- React.createElement("rect", { vectorEffect: "non-scaling-stroke", x: leftX, y: topY, width: width, height: height, fill: 'none', stroke: 'blue', strokeWidth: props.strokeWidth || 5, cursor: draggingRect ? 'grabbing' : 'grab', onMouseDown: addRectHandleMouseDown }),
1093
+ return (React$1.createElement(React$1.Fragment, null,
1094
+ props.dragDropHandlerElement && React$1.createElement(props.dragDropHandlerElement, { dragging: draggingRect, onMouseDown: addRectHandleMouseDown }),
1095
+ React$1.createElement("rect", { vectorEffect: "non-scaling-stroke", x: leftX, y: topY, width: width, height: height, fill: 'none', stroke: 'blue', strokeWidth: props.strokeWidth || 5, cursor: draggingRect ? 'grabbing' : 'grab', onMouseDown: addRectHandleMouseDown }),
1089
1096
  props.resizability.enabled ?
1090
- (React.createElement("circle", { cursor: 'se-resize', cx: leftX + width, cy: topY + height, r: r, fill: 'blue', stroke: 'blue', onMouseDown: circleHandleMouseDown })) : null));
1097
+ (React$1.createElement("circle", { cursor: 'se-resize', cx: leftX + width, cy: topY + height, r: r, fill: 'blue', stroke: 'blue', onMouseDown: circleHandleMouseDown })) : null));
1091
1098
  };
1092
1099
 
1093
1100
  var useSelectionFrame = function (props) {
1094
- React.useEffect(function () {
1101
+ React$1.useEffect(function () {
1095
1102
  if (props.targetSVGElement && props.container) {
1096
1103
  //render SelectionFrame component to the parent element of the targetSVGElement
1097
1104
  if (props.container) {
@@ -1100,7 +1107,7 @@ var useSelectionFrame = function (props) {
1100
1107
  svg_1.style.outline = 'none';
1101
1108
  props.targetSVGElement.appendChild(svg_1);
1102
1109
  var root_1 = createRoot(svg_1);
1103
- root_1.render(React.createElement(SelectionFrame, __assign({}, props, { container: props.container })));
1110
+ root_1.render(React$1.createElement(SelectionFrame, __assign({}, props, { container: props.container })));
1104
1111
  return function () {
1105
1112
  root_1.unmount();
1106
1113
  if (props.targetSVGElement) {
@@ -1257,7 +1264,7 @@ var onElementLinkEnded = function (callback) {
1257
1264
  off: off
1258
1265
  };
1259
1266
  };
1260
- var paperEventEmitterContext = React.createContext({
1267
+ var paperEventEmitterContext = React$1.createContext({
1261
1268
  emitter: eventEmitter,
1262
1269
  emitPaperClicked: emitPaperClicked,
1263
1270
  onPaperClicked: onPaperClicked,
@@ -1285,13 +1292,13 @@ var paperEventEmitterContext = React.createContext({
1285
1292
  onElementLinkEnded: onElementLinkEnded,
1286
1293
  });
1287
1294
 
1288
- var Text = React.forwardRef(function (_a, ref) {
1295
+ var Text = React$1.forwardRef(function (_a, ref) {
1289
1296
  var id = _a.id, content = _a.content, x = _a.x, y = _a.y, width = _a.width, height = _a.height, _b = _a.align, align = _b === void 0 ? exports.TextAlign.left : _b, fontSizeProp = _a.fontSize, border = _a.border, container = _a.container, onSelected = _a.onSelected, onMoved = _a.onMoved, onResized = _a.onResized, onContentChanged = _a.onContentChanged;
1290
- var _c = React.useState(false), isSelected = _c[0], setIsSelected = _c[1];
1291
- var _d = React.useState(false), isEditing = _d[0], setIsEditing = _d[1];
1292
- var svgRef = React.useRef();
1293
- var onPaperClicked = React.useContext(paperEventEmitterContext).onPaperClicked;
1294
- React.useEffect(function () {
1297
+ var _c = React$1.useState(false), isSelected = _c[0], setIsSelected = _c[1];
1298
+ var _d = React$1.useState(false), isEditing = _d[0], setIsEditing = _d[1];
1299
+ var svgRef = React$1.useRef();
1300
+ var onPaperClicked = React$1.useContext(paperEventEmitterContext).onPaperClicked;
1301
+ React$1.useEffect(function () {
1295
1302
  var paperClickListener = onPaperClicked(function (ev) {
1296
1303
  var _a;
1297
1304
  var textareaELe = (_a = svgRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('textarea');
@@ -1338,7 +1345,7 @@ var Text = React.forwardRef(function (_a, ref) {
1338
1345
  strokeWidth: 3,
1339
1346
  movingOffsetThreshold: TEXT_MOVING_OFFSET_THRESHOLD,
1340
1347
  });
1341
- var textAlign = React.useMemo(function () {
1348
+ var textAlign = React$1.useMemo(function () {
1342
1349
  switch (align) {
1343
1350
  case exports.TextAlign.left:
1344
1351
  return 'left';
@@ -1352,7 +1359,7 @@ var Text = React.forwardRef(function (_a, ref) {
1352
1359
  }, [align]);
1353
1360
  var fontSize = fontSizeProp || TEXT_FONT_SIZE;
1354
1361
  var borderStyle = border || 'none';
1355
- return (React.createElement("svg", { style: { overflow: "visible" }, x: x, y: y, ref: function (node) {
1362
+ return (React$1.createElement("svg", { style: { overflow: "visible" }, x: x, y: y, ref: function (node) {
1356
1363
  svgRef.current = node;
1357
1364
  if (typeof ref === 'function') {
1358
1365
  ref(node);
@@ -1361,13 +1368,13 @@ var Text = React.forwardRef(function (_a, ref) {
1361
1368
  ref.current = node;
1362
1369
  }
1363
1370
  }, onClick: handleClick },
1364
- React.createElement("foreignObject", { width: width, height: height, style: {
1371
+ React$1.createElement("foreignObject", { width: width, height: height, style: {
1365
1372
  overflow: 'visible',
1366
1373
  userSelect: 'none',
1367
1374
  WebkitUserSelect: 'none',
1368
1375
  msUserSelect: 'none'
1369
1376
  } },
1370
- React.createElement("div", { style: {
1377
+ React$1.createElement("div", { style: {
1371
1378
  width: '100%',
1372
1379
  height: '100%',
1373
1380
  borderWidth: '1px',
@@ -1376,7 +1383,7 @@ var Text = React.forwardRef(function (_a, ref) {
1376
1383
  // whiteSpace: 'pre-wrap',
1377
1384
  boxSizing: 'border-box',
1378
1385
  } },
1379
- React.createElement("textarea", { style: {
1386
+ React$1.createElement("textarea", { style: {
1380
1387
  fontFamily: 'initial',
1381
1388
  display: 'inline-block',
1382
1389
  width: '100%',
@@ -1394,29 +1401,35 @@ var Text = React.forwardRef(function (_a, ref) {
1394
1401
  }
1395
1402
  }, value: content, onChange: handleChangeText })))));
1396
1403
  });
1397
- var Text$1 = React.memo(Text);
1404
+ var Text$1 = React$1.memo(Text);
1398
1405
 
1399
- var Port = React.forwardRef(function (props, ref) {
1400
- var id = props.id, x = props.x, y = props.y, width = props.width, height = props.height, container = props.container, label = props.label, onPortLabelMoved = props.onPortLabelMoved, onPortLabelResized = props.onPortLabelResized, onPortLabelContentChanged = props.onPortLabelContentChanged, onSelected = props.onSelected, onMouseDown = props.onMouseDown, onMouseUp = props.onMouseUp, renderShape = props.renderShape;
1401
- var textRef = React.useRef(null);
1406
+ var Port1 = React$1.forwardRef(function (props, ref) {
1407
+ var id = props.id, x = props.x, y = props.y, width = props.width, height = props.height, container = props.container, label = props.label, onPortLabelMoved = props.onPortLabelMoved, onPortLabelResized = props.onPortLabelResized, onPortLabelContentChanged = props.onPortLabelContentChanged, onSelected = props.onSelected, onMouseDown = props.onMouseDown, onMouseUp = props.onMouseUp, calculateRotationAngle = props.calculateRotationAngle, renderShape = props.renderShape;
1408
+ var textRef = React$1.useRef(null);
1409
+ var rotationAngle = React$1.useMemo(function () {
1410
+ if (!calculateRotationAngle)
1411
+ return 0;
1412
+ return calculateRotationAngle(x, y);
1413
+ }, [calculateRotationAngle, x, y]);
1402
1414
  var renderLabel = function (label) {
1403
1415
  var content = label.content, size = label.size;
1404
1416
  var position = label.position || PORT_LABEL_POSITION;
1405
- return React.createElement(Text$1, { id: label.id, ref: textRef, x: x + position.x, y: y + position.y, width: size.width, height: size.height, content: content, fontSize: label.fontSize, border: label.border, container: container, onMoved: onPortLabelMoved, onResized: onPortLabelResized, onContentChanged: onPortLabelContentChanged });
1417
+ return React$1.createElement(Text$1, { id: label.id, ref: textRef, x: x + position.x, y: y + position.y, width: size.width, height: size.height, content: content, fontSize: label.fontSize, border: label.border, container: container, onMoved: onPortLabelMoved, onResized: onPortLabelResized, onContentChanged: onPortLabelContentChanged });
1406
1418
  };
1407
- var renderedShape = React.useMemo(function () {
1419
+ var renderedShape = React$1.useMemo(function () {
1408
1420
  if (renderShape) {
1409
1421
  var RenderShape = renderShape;
1410
- return (React.createElement(RenderShape, __assign({ ref: ref }, props)));
1422
+ return (React$1.createElement(RenderShape, __assign({ ref: ref }, props, { rotation: rotationAngle })));
1411
1423
  }
1412
1424
  else {
1413
- return React.createElement(Circle, { onMouseDown: function (e) { return onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(id, e); }, onMouseUp: function (e) { return onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(id, e); }, onClick: function (e) { return onSelected === null || onSelected === void 0 ? void 0 : onSelected(id, e); }, ref: ref, x: x, y: y, positioningAnchor: exports.PositioningAnchor.Center, height: height, width: width, stroke: "black", fill: "black" });
1425
+ return React$1.createElement(Circle, { onMouseDown: function (e) { return onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(id, e); }, onMouseUp: function (e) { return onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(id, e); }, onClick: function (e) { return onSelected === null || onSelected === void 0 ? void 0 : onSelected(id, e); }, ref: ref, x: x, y: y, positioningAnchor: exports.PositioningAnchor.Center, height: height, width: width, stroke: "black", fill: "black" });
1414
1426
  }
1415
1427
  }, [props]);
1416
- return (React.createElement(React.Fragment, null,
1428
+ return (React$1.createElement(React$1.Fragment, null,
1417
1429
  renderedShape,
1418
1430
  label && renderLabel(label)));
1419
- });
1431
+ });
1432
+ var Port = React$1.memo(Port1);
1420
1433
 
1421
1434
  // Render the svg <path> element
1422
1435
  function getCurvePathData(points, smoothing, closed) {
@@ -1577,14 +1590,14 @@ function calculateAngleWithOx(pStart, pEnd) {
1577
1590
  //Defined remove icon for element link, shown when element link is selected.
1578
1591
  function CloseIcon(_a) {
1579
1592
  var onClick = _a.onClick;
1580
- return (React.createElement("svg", { width: 20, height: 20, viewBox: "0 0 24.00 24.00", xmlns: "http://www.w3.org/2000/svg", fill: "#ff0000", transform: "rotate(0)", onMouseDown: function (ev) { ev.stopPropagation(); }, onClick: onClick, cursor: 'pointer' },
1581
- React.createElement("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0", transform: "translate(3.84,3.84), scale(0.68)" },
1582
- React.createElement("rect", { x: "0", y: "0", width: "24.00", height: "24.00", rx: "12", fill: "#ffffff", strokeWidth: "0" })),
1583
- React.createElement("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round", stroke: "#CCCCCC", "stroke-width": "0.048" }),
1584
- React.createElement("g", { id: "SVGRepo_iconCarrier" },
1585
- React.createElement("g", null,
1586
- React.createElement("path", { fill: "none", d: "M0 0h24v24H0z" }),
1587
- React.createElement("path", { d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-11.414L9.172 7.757 7.757 9.172 10.586 12l-2.829 2.828 1.415 1.415L12 13.414l2.828 2.829 1.415-1.415L13.414 12l2.829-2.828-1.415-1.415L12 10.586z" })))));
1593
+ return (React$1.createElement("svg", { width: 20, height: 20, viewBox: "0 0 24.00 24.00", xmlns: "http://www.w3.org/2000/svg", fill: "#ff0000", transform: "rotate(0)", onMouseDown: function (ev) { ev.stopPropagation(); }, onClick: onClick, cursor: 'pointer' },
1594
+ React$1.createElement("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0", transform: "translate(3.84,3.84), scale(0.68)" },
1595
+ React$1.createElement("rect", { x: "0", y: "0", width: "24.00", height: "24.00", rx: "12", fill: "#ffffff", strokeWidth: "0" })),
1596
+ React$1.createElement("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round", stroke: "#CCCCCC", "stroke-width": "0.048" }),
1597
+ React$1.createElement("g", { id: "SVGRepo_iconCarrier" },
1598
+ React$1.createElement("g", null,
1599
+ React$1.createElement("path", { fill: "none", d: "M0 0h24v24H0z" }),
1600
+ React$1.createElement("path", { d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-11.414L9.172 7.757 7.757 9.172 10.586 12l-2.829 2.828 1.415 1.415L12 13.414l2.828 2.829 1.415-1.415L13.414 12l2.829-2.828-1.415-1.415L12 10.586z" })))));
1588
1601
  }
1589
1602
 
1590
1603
  /**
@@ -7339,25 +7352,25 @@ var getRelativePosition = function (clientPosition, relativeElement) {
7339
7352
  };
7340
7353
  };
7341
7354
 
7342
- var makerStart = React.createElement("circle", { cx: 10, cy: 10, r: 10, fill: "blue" });
7343
- var makerEnd = React.createElement("path", { d: "M0 0 L 20 10 L0 20 Z", fill: "blue" }); //<path d="M0 0 L 10 5 L0 10 Z"></path>
7355
+ var makerStart = React$1.createElement("circle", { cx: 10, cy: 10, r: 10, fill: "blue" });
7356
+ var makerEnd = React$1.createElement("path", { d: "M0 0 L 20 10 L0 20 Z", fill: "blue" }); //<path d="M0 0 L 10 5 L0 10 Z"></path>
7344
7357
  var IElementLink = function (_a) {
7345
7358
  var _b, _c;
7346
7359
  var id = _a.id, path = _a.path, stroke = _a.stroke, _d = _a.strokeWidth, strokeWidth = _d === void 0 ? 4 : _d, pointsProp = _a.points, sourcePosition = _a.sourcePosition, targetPosition = _a.targetPosition, onPathChanged = _a.onPathChanged, onClickDelete = _a.onClickDelete, onSelected = _a.onSelected, onDeselected = _a.onDeselected, container = _a.container, _e = _a.markerStart, markerStart = _e === void 0 ? makerStart : _e, _f = _a.markerEnd, markerEnd = _f === void 0 ? makerEnd : _f, _g = _a.markerDistanceFromPort, markerDistanceFromPort = _g === void 0 ? LINK_MARKER_DISTANCE_FROM_PORT : _g, _h = _a.markerSize, markerSize = _h === void 0 ? LINK_MARKER_SIZE : _h, label = _a.label, sourceLabel = _a.sourceLabel, targetLabel = _a.targetLabel, onLabelMoved = _a.onLabelMoved, onLabelResized = _a.onLabelResized, onLabelContentChanged = _a.onLabelContentChanged;
7347
- var _j = React.useState(path), pathStr = _j[0], setPathStr = _j[1];
7348
- var _k = React.useState(pointsProp !== null && pointsProp !== void 0 ? pointsProp : []), points = _k[0], setPoints = _k[1];
7349
- var _l = React.useState(false), isDragging = _l[0], setIsDragging = _l[1];
7350
- var _m = React.useState(), draggingPointIndex = _m[0], setDraggingPointIndex = _m[1];
7351
- var _o = React.useState({
7360
+ var _j = React$1.useState(path), pathStr = _j[0], setPathStr = _j[1];
7361
+ var _k = React$1.useState(pointsProp !== null && pointsProp !== void 0 ? pointsProp : []), points = _k[0], setPoints = _k[1];
7362
+ var _l = React$1.useState(false), isDragging = _l[0], setIsDragging = _l[1];
7363
+ var _m = React$1.useState(), draggingPointIndex = _m[0], setDraggingPointIndex = _m[1];
7364
+ var _o = React$1.useState({
7352
7365
  current: null,
7353
7366
  }), selectedLabelRef = _o[0], setSelectedLabelRef = _o[1];
7354
- var _p = React.useState(false), isSelectedLink = _p[0], setIsSelectedLink = _p[1];
7355
- var onPaperClicked = React.useContext(paperEventEmitterContext).onPaperClicked;
7356
- var pathRef = React.useRef(null);
7357
- var labelRef = React.useRef(null);
7358
- var sourceLabelRef = React.useRef(null);
7359
- var targetLabelRef = React.useRef(null);
7360
- React.useEffect(function () {
7367
+ var _p = React$1.useState(false), isSelectedLink = _p[0], setIsSelectedLink = _p[1];
7368
+ var onPaperClicked = React$1.useContext(paperEventEmitterContext).onPaperClicked;
7369
+ var pathRef = React$1.useRef(null);
7370
+ var labelRef = React$1.useRef(null);
7371
+ var sourceLabelRef = React$1.useRef(null);
7372
+ var targetLabelRef = React$1.useRef(null);
7373
+ React$1.useEffect(function () {
7361
7374
  var paperClickListener = onPaperClicked(function () {
7362
7375
  setSelectedLabelRef({
7363
7376
  current: null,
@@ -7369,17 +7382,17 @@ var IElementLink = function (_a) {
7369
7382
  paperClickListener.off();
7370
7383
  };
7371
7384
  }, []);
7372
- React.useLayoutEffect(function () {
7385
+ React$1.useLayoutEffect(function () {
7373
7386
  var pointsList = __spreadArray(__spreadArray([sourcePosition], points, true), [targetPosition], false);
7374
7387
  var _pathStr = createSmoothPathString(pointsList, undefined);
7375
7388
  setPathStr(_pathStr);
7376
7389
  }, [sourcePosition, points, targetPosition]);
7377
- React.useEffect(function () {
7390
+ React$1.useEffect(function () {
7378
7391
  if (!pathStr)
7379
7392
  return;
7380
7393
  onPathChanged === null || onPathChanged === void 0 ? void 0 : onPathChanged(pathStr, id);
7381
7394
  }, [pathStr, id]);
7382
- React.useLayoutEffect(function () {
7395
+ React$1.useLayoutEffect(function () {
7383
7396
  //handle when creating and moving point
7384
7397
  var handleMouseMove = function (ev) {
7385
7398
  var mouseEvent = ev;
@@ -7535,7 +7548,7 @@ var IElementLink = function (_a) {
7535
7548
  x: relativePosition.x + relativePositionTo.x,
7536
7549
  y: relativePosition.y + relativePositionTo.y,
7537
7550
  };
7538
- return (React.createElement(Text$1, { id: label.id, x: position.x, y: position.y, width: size.width, height: size.height, content: content, fontSize: label.fontSize, border: label.border, ref: curLabelRef, container: container, onSelected: function () { return setSelectedLabelRef(curLabelRef); }, onMoved: handleLabelMoved, onResized: handleLabelResized, onContentChanged: handleLabelContentChanged }));
7551
+ return (React$1.createElement(Text$1, { id: label.id, x: position.x, y: position.y, width: size.width, height: size.height, content: content, fontSize: label.fontSize, border: label.border, ref: curLabelRef, container: container, onSelected: function () { return setSelectedLabelRef(curLabelRef); }, onMoved: handleLabelMoved, onResized: handleLabelResized, onContentChanged: handleLabelContentChanged }));
7539
7552
  };
7540
7553
  var angleMarkerStart = '0';
7541
7554
  var angleMarkerEnd = '0';
@@ -7553,28 +7566,28 @@ var IElementLink = function (_a) {
7553
7566
  }
7554
7567
  centerPathPosition = (_c = pathRef.current) === null || _c === void 0 ? void 0 : _c.getPointAtLength(pathRef.current.getTotalLength() / 2);
7555
7568
  }
7556
- return (React.createElement("g", null,
7557
- React.createElement("path", { ref: pathRef, d: pathStr, className: isSelectedLink ? CSS_CLASS_LINK_SELECTED : '', fill: "none", stroke: stroke || LINK_DEFAULT_COLOR, strokeWidth: strokeWidth }),
7558
- React.createElement("path", { d: pathStr, fill: "none", stroke: 'transparent', strokeWidth: LINK_CLICKABLE_STROKE_WIDTH, onClick: handleClickPath, onMouseDown: handleMouseDownOnPath }),
7559
- isSelectedLink && centerPathPosition && React.createElement("svg", { x: centerPathPosition.x - 10, y: centerPathPosition.y - 10 },
7560
- React.createElement(CloseIcon, { onClick: onClickDelete })),
7569
+ return (React$1.createElement("g", null,
7570
+ React$1.createElement("path", { ref: pathRef, d: pathStr, className: isSelectedLink ? CSS_CLASS_LINK_SELECTED : '', fill: "none", stroke: stroke || LINK_DEFAULT_COLOR, strokeWidth: strokeWidth }),
7571
+ React$1.createElement("path", { d: pathStr, fill: "none", stroke: 'transparent', strokeWidth: LINK_CLICKABLE_STROKE_WIDTH, onClick: handleClickPath, onMouseDown: handleMouseDownOnPath }),
7572
+ isSelectedLink && centerPathPosition && React$1.createElement("svg", { x: centerPathPosition.x - 10, y: centerPathPosition.y - 10 },
7573
+ React$1.createElement(CloseIcon, { onClick: onClickDelete })),
7561
7574
  label && renderLabel(label, 'middle', centerPathPosition),
7562
7575
  sourceLabel && renderLabel(sourceLabel, 'source', sourcePosition),
7563
7576
  targetLabel && renderLabel(targetLabel, 'target', targetPosition),
7564
- markerStartPosition && React.createElement("g", { transform: "rotate(".concat(angleMarkerStart, ")"), style: { transformOrigin: 'center', transformBox: 'content-box' } },
7565
- React.createElement("svg", { x: markerStartPosition.x - markerSize / 2, y: markerStartPosition.y - markerSize / 2, width: markerSize, height: markerSize }, markerStart)),
7566
- markerEndPosition && React.createElement("g", { transform: "rotate(".concat(angleMarkerEnd, ")"), style: { transformOrigin: 'center', transformBox: 'content-box' } },
7567
- React.createElement("svg", { x: markerEndPosition.x - markerSize / 2, y: markerEndPosition.y - markerSize / 2, width: markerSize, height: markerSize }, markerEnd))));
7577
+ markerStartPosition && React$1.createElement("g", { transform: "rotate(".concat(angleMarkerStart, ")"), style: { transformOrigin: 'center', transformBox: 'content-box' } },
7578
+ React$1.createElement("svg", { x: markerStartPosition.x - markerSize / 2, y: markerStartPosition.y - markerSize / 2, width: markerSize, height: markerSize }, markerStart)),
7579
+ markerEndPosition && React$1.createElement("g", { transform: "rotate(".concat(angleMarkerEnd, ")"), style: { transformOrigin: 'center', transformBox: 'content-box' } },
7580
+ React$1.createElement("svg", { x: markerEndPosition.x - markerSize / 2, y: markerEndPosition.y - markerSize / 2, width: markerSize, height: markerSize }, markerEnd))));
7568
7581
  };
7569
- var ElementLink = React.memo(IElementLink);
7582
+ var ElementLink = React$1.memo(IElementLink);
7570
7583
 
7571
7584
  var Ruler = function (_a) {
7572
7585
  var squareSize = _a.squareSize, border = _a.border;
7573
7586
  var numColumns = Math.ceil(3000 / squareSize);
7574
7587
  var numRows = Math.ceil(3000 / squareSize);
7575
7588
  var tableWidth = numColumns * squareSize;
7576
- return (React.createElement("table", { style: { position: 'absolute', zIndex: -1, top: 0, left: 0, borderCollapse: 'collapse', width: tableWidth } },
7577
- React.createElement("tbody", null, Array.from({ length: numRows }).map(function (_, rowIndex) { return (React.createElement("tr", { key: rowIndex, style: { margin: 0, padding: 0 } }, Array.from({ length: numColumns }).map(function (_, colIndex) { return (React.createElement("td", { key: colIndex, style: {
7589
+ return (React$1.createElement("table", { style: { position: 'absolute', zIndex: -1, top: 0, left: 0, borderCollapse: 'collapse', width: tableWidth } },
7590
+ React$1.createElement("tbody", null, Array.from({ length: numRows }).map(function (_, rowIndex) { return (React$1.createElement("tr", { key: rowIndex, style: { margin: 0, padding: 0 } }, Array.from({ length: numColumns }).map(function (_, colIndex) { return (React$1.createElement("td", { key: colIndex, style: {
7578
7591
  width: squareSize,
7579
7592
  height: squareSize,
7580
7593
  border: border,
@@ -7585,16 +7598,16 @@ var Ruler = function (_a) {
7585
7598
  position: 'relative',
7586
7599
  fontSize: 12,
7587
7600
  } },
7588
- rowIndex === 0 ? React.createElement("span", { style: { marginLeft: "-12px" } }, colIndex * squareSize) : "",
7589
- colIndex === 0 ? React.createElement("span", { style: { top: "-9px", position: "absolute" } }, rowIndex * squareSize) : "")); }))); }))));
7601
+ rowIndex === 0 ? React$1.createElement("span", { style: { marginLeft: "-12px" } }, colIndex * squareSize) : "",
7602
+ colIndex === 0 ? React$1.createElement("span", { style: { top: "-9px", position: "absolute" } }, rowIndex * squareSize) : "")); }))); }))));
7590
7603
  };
7591
7604
 
7592
- var ElementWrapper = React.forwardRef(function (_a, ref) {
7605
+ var ElementWrapper = React$1.forwardRef(function (_a, ref) {
7593
7606
  var x = _a.x, y = _a.y, children = _a.children; _a.portPlaceholders; _a.ports; var onClick = _a.onClick, onMouseMove = _a.onMouseMove, onMouseLeave = _a.onMouseLeave, onMouseUp = _a.onMouseUp;
7594
7607
  var handleMouseDown = function (ev) {
7595
7608
  ev.stopPropagation();
7596
7609
  };
7597
- return (React.createElement("svg", { x: x, y: y, onClick: onClick, onMouseDown: handleMouseDown, ref: ref, style: { overflow: "visible" }, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, onMouseUp: onMouseUp }, children));
7610
+ return (React$1.createElement("svg", { x: x, y: y, onClick: onClick, onMouseDown: handleMouseDown, ref: ref, style: { overflow: "visible" }, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, onMouseUp: onMouseUp }, children));
7598
7611
  });
7599
7612
 
7600
7613
  // Calculate the position of the 4 vertices of a rectangle relative to its parent svg
@@ -7640,27 +7653,1249 @@ var checkPositionOnLine = function (position, line) {
7640
7653
  return _line.contains(point);
7641
7654
  };
7642
7655
 
7656
+ var bundle = {exports: {}};
7657
+
7658
+ var cssLayout = {exports: {}};
7659
+
7660
+ (function (module, exports) {
7661
+ // UMD (Universal Module Definition)
7662
+ // See https://github.com/umdjs/umd for reference
7663
+ //
7664
+ // This file uses the following specific UMD implementation:
7665
+ // https://github.com/umdjs/umd/blob/master/returnExports.js
7666
+ (function(root, factory) {
7667
+ {
7668
+ // Node. Does not work with strict CommonJS, but
7669
+ // only CommonJS-like environments that support module.exports,
7670
+ // like Node.
7671
+ module.exports = factory();
7672
+ }
7673
+ }(commonjsGlobal, function() {
7674
+ /**
7675
+ * Copyright (c) 2014, Facebook, Inc.
7676
+ * All rights reserved.
7677
+ *
7678
+ * This source code is licensed under the BSD-style license found in the
7679
+ * LICENSE file in the root directory of this source tree. An additional grant
7680
+ * of patent rights can be found in the PATENTS file in the same directory.
7681
+ */
7682
+
7683
+ var computeLayout = (function() {
7684
+
7685
+ var CSS_UNDEFINED;
7686
+
7687
+ var CSS_DIRECTION_INHERIT = 'inherit';
7688
+ var CSS_DIRECTION_LTR = 'ltr';
7689
+ var CSS_DIRECTION_RTL = 'rtl';
7690
+
7691
+ var CSS_FLEX_DIRECTION_ROW = 'row';
7692
+ var CSS_FLEX_DIRECTION_ROW_REVERSE = 'row-reverse';
7693
+ var CSS_FLEX_DIRECTION_COLUMN = 'column';
7694
+ var CSS_FLEX_DIRECTION_COLUMN_REVERSE = 'column-reverse';
7695
+
7696
+ var CSS_JUSTIFY_FLEX_START = 'flex-start';
7697
+ var CSS_JUSTIFY_CENTER = 'center';
7698
+ var CSS_JUSTIFY_FLEX_END = 'flex-end';
7699
+ var CSS_JUSTIFY_SPACE_BETWEEN = 'space-between';
7700
+ var CSS_JUSTIFY_SPACE_AROUND = 'space-around';
7701
+
7702
+ var CSS_ALIGN_FLEX_START = 'flex-start';
7703
+ var CSS_ALIGN_CENTER = 'center';
7704
+ var CSS_ALIGN_FLEX_END = 'flex-end';
7705
+ var CSS_ALIGN_STRETCH = 'stretch';
7706
+
7707
+ var CSS_POSITION_RELATIVE = 'relative';
7708
+ var CSS_POSITION_ABSOLUTE = 'absolute';
7709
+
7710
+ var leading = {
7711
+ 'row': 'left',
7712
+ 'row-reverse': 'right',
7713
+ 'column': 'top',
7714
+ 'column-reverse': 'bottom'
7715
+ };
7716
+ var trailing = {
7717
+ 'row': 'right',
7718
+ 'row-reverse': 'left',
7719
+ 'column': 'bottom',
7720
+ 'column-reverse': 'top'
7721
+ };
7722
+ var pos = {
7723
+ 'row': 'left',
7724
+ 'row-reverse': 'right',
7725
+ 'column': 'top',
7726
+ 'column-reverse': 'bottom'
7727
+ };
7728
+ var dim = {
7729
+ 'row': 'width',
7730
+ 'row-reverse': 'width',
7731
+ 'column': 'height',
7732
+ 'column-reverse': 'height'
7733
+ };
7734
+
7735
+ // When transpiled to Java / C the node type has layout, children and style
7736
+ // properties. For the JavaScript version this function adds these properties
7737
+ // if they don't already exist.
7738
+ function fillNodes(node) {
7739
+ if (!node.layout || node.isDirty) {
7740
+ node.layout = {
7741
+ width: undefined,
7742
+ height: undefined,
7743
+ top: 0,
7744
+ left: 0,
7745
+ right: 0,
7746
+ bottom: 0
7747
+ };
7748
+ }
7749
+
7750
+ if (!node.style) {
7751
+ node.style = {};
7752
+ }
7753
+
7754
+ if (!node.children) {
7755
+ node.children = [];
7756
+ }
7757
+ node.children.forEach(fillNodes);
7758
+ return node;
7759
+ }
7760
+
7761
+ function isUndefined(value) {
7762
+ return value === undefined;
7763
+ }
7764
+
7765
+ function isRowDirection(flexDirection) {
7766
+ return flexDirection === CSS_FLEX_DIRECTION_ROW ||
7767
+ flexDirection === CSS_FLEX_DIRECTION_ROW_REVERSE;
7768
+ }
7769
+
7770
+ function isColumnDirection(flexDirection) {
7771
+ return flexDirection === CSS_FLEX_DIRECTION_COLUMN ||
7772
+ flexDirection === CSS_FLEX_DIRECTION_COLUMN_REVERSE;
7773
+ }
7774
+
7775
+ function getLeadingMargin(node, axis) {
7776
+ if (node.style.marginStart !== undefined && isRowDirection(axis)) {
7777
+ return node.style.marginStart;
7778
+ }
7779
+
7780
+ var value = null;
7781
+ switch (axis) {
7782
+ case 'row': value = node.style.marginLeft; break;
7783
+ case 'row-reverse': value = node.style.marginRight; break;
7784
+ case 'column': value = node.style.marginTop; break;
7785
+ case 'column-reverse': value = node.style.marginBottom; break;
7786
+ }
7787
+
7788
+ if (value !== undefined) {
7789
+ return value;
7790
+ }
7791
+
7792
+ if (node.style.margin !== undefined) {
7793
+ return node.style.margin;
7794
+ }
7795
+
7796
+ return 0;
7797
+ }
7798
+
7799
+ function getTrailingMargin(node, axis) {
7800
+ if (node.style.marginEnd !== undefined && isRowDirection(axis)) {
7801
+ return node.style.marginEnd;
7802
+ }
7803
+
7804
+ var value = null;
7805
+ switch (axis) {
7806
+ case 'row': value = node.style.marginRight; break;
7807
+ case 'row-reverse': value = node.style.marginLeft; break;
7808
+ case 'column': value = node.style.marginBottom; break;
7809
+ case 'column-reverse': value = node.style.marginTop; break;
7810
+ }
7811
+
7812
+ if (value != null) {
7813
+ return value;
7814
+ }
7815
+
7816
+ if (node.style.margin !== undefined) {
7817
+ return node.style.margin;
7818
+ }
7819
+
7820
+ return 0;
7821
+ }
7822
+
7823
+ function getLeadingPadding(node, axis) {
7824
+ if (node.style.paddingStart !== undefined && node.style.paddingStart >= 0
7825
+ && isRowDirection(axis)) {
7826
+ return node.style.paddingStart;
7827
+ }
7828
+
7829
+ var value = null;
7830
+ switch (axis) {
7831
+ case 'row': value = node.style.paddingLeft; break;
7832
+ case 'row-reverse': value = node.style.paddingRight; break;
7833
+ case 'column': value = node.style.paddingTop; break;
7834
+ case 'column-reverse': value = node.style.paddingBottom; break;
7835
+ }
7836
+
7837
+ if (value != null && value >= 0) {
7838
+ return value;
7839
+ }
7840
+
7841
+ if (node.style.padding !== undefined && node.style.padding >= 0) {
7842
+ return node.style.padding;
7843
+ }
7844
+
7845
+ return 0;
7846
+ }
7847
+
7848
+ function getTrailingPadding(node, axis) {
7849
+ if (node.style.paddingEnd !== undefined && node.style.paddingEnd >= 0
7850
+ && isRowDirection(axis)) {
7851
+ return node.style.paddingEnd;
7852
+ }
7853
+
7854
+ var value = null;
7855
+ switch (axis) {
7856
+ case 'row': value = node.style.paddingRight; break;
7857
+ case 'row-reverse': value = node.style.paddingLeft; break;
7858
+ case 'column': value = node.style.paddingBottom; break;
7859
+ case 'column-reverse': value = node.style.paddingTop; break;
7860
+ }
7861
+
7862
+ if (value != null && value >= 0) {
7863
+ return value;
7864
+ }
7865
+
7866
+ if (node.style.padding !== undefined && node.style.padding >= 0) {
7867
+ return node.style.padding;
7868
+ }
7869
+
7870
+ return 0;
7871
+ }
7872
+
7873
+ function getLeadingBorder(node, axis) {
7874
+ if (node.style.borderStartWidth !== undefined && node.style.borderStartWidth >= 0
7875
+ && isRowDirection(axis)) {
7876
+ return node.style.borderStartWidth;
7877
+ }
7878
+
7879
+ var value = null;
7880
+ switch (axis) {
7881
+ case 'row': value = node.style.borderLeftWidth; break;
7882
+ case 'row-reverse': value = node.style.borderRightWidth; break;
7883
+ case 'column': value = node.style.borderTopWidth; break;
7884
+ case 'column-reverse': value = node.style.borderBottomWidth; break;
7885
+ }
7886
+
7887
+ if (value != null && value >= 0) {
7888
+ return value;
7889
+ }
7890
+
7891
+ if (node.style.borderWidth !== undefined && node.style.borderWidth >= 0) {
7892
+ return node.style.borderWidth;
7893
+ }
7894
+
7895
+ return 0;
7896
+ }
7897
+
7898
+ function getTrailingBorder(node, axis) {
7899
+ if (node.style.borderEndWidth !== undefined && node.style.borderEndWidth >= 0
7900
+ && isRowDirection(axis)) {
7901
+ return node.style.borderEndWidth;
7902
+ }
7903
+
7904
+ var value = null;
7905
+ switch (axis) {
7906
+ case 'row': value = node.style.borderRightWidth; break;
7907
+ case 'row-reverse': value = node.style.borderLeftWidth; break;
7908
+ case 'column': value = node.style.borderBottomWidth; break;
7909
+ case 'column-reverse': value = node.style.borderTopWidth; break;
7910
+ }
7911
+
7912
+ if (value != null && value >= 0) {
7913
+ return value;
7914
+ }
7915
+
7916
+ if (node.style.borderWidth !== undefined && node.style.borderWidth >= 0) {
7917
+ return node.style.borderWidth;
7918
+ }
7919
+
7920
+ return 0;
7921
+ }
7922
+
7923
+ function getLeadingPaddingAndBorder(node, axis) {
7924
+ return getLeadingPadding(node, axis) + getLeadingBorder(node, axis);
7925
+ }
7926
+
7927
+ function getTrailingPaddingAndBorder(node, axis) {
7928
+ return getTrailingPadding(node, axis) + getTrailingBorder(node, axis);
7929
+ }
7930
+
7931
+ function getBorderAxis(node, axis) {
7932
+ return getLeadingBorder(node, axis) + getTrailingBorder(node, axis);
7933
+ }
7934
+
7935
+ function getMarginAxis(node, axis) {
7936
+ return getLeadingMargin(node, axis) + getTrailingMargin(node, axis);
7937
+ }
7938
+
7939
+ function getPaddingAndBorderAxis(node, axis) {
7940
+ return getLeadingPaddingAndBorder(node, axis) +
7941
+ getTrailingPaddingAndBorder(node, axis);
7942
+ }
7943
+
7944
+ function getJustifyContent(node) {
7945
+ if (node.style.justifyContent) {
7946
+ return node.style.justifyContent;
7947
+ }
7948
+ return 'flex-start';
7949
+ }
7950
+
7951
+ function getAlignContent(node) {
7952
+ if (node.style.alignContent) {
7953
+ return node.style.alignContent;
7954
+ }
7955
+ return 'flex-start';
7956
+ }
7957
+
7958
+ function getAlignItem(node, child) {
7959
+ if (child.style.alignSelf) {
7960
+ return child.style.alignSelf;
7961
+ }
7962
+ if (node.style.alignItems) {
7963
+ return node.style.alignItems;
7964
+ }
7965
+ return 'stretch';
7966
+ }
7967
+
7968
+ function resolveAxis(axis, direction) {
7969
+ if (direction === CSS_DIRECTION_RTL) {
7970
+ if (axis === CSS_FLEX_DIRECTION_ROW) {
7971
+ return CSS_FLEX_DIRECTION_ROW_REVERSE;
7972
+ } else if (axis === CSS_FLEX_DIRECTION_ROW_REVERSE) {
7973
+ return CSS_FLEX_DIRECTION_ROW;
7974
+ }
7975
+ }
7976
+
7977
+ return axis;
7978
+ }
7979
+
7980
+ function resolveDirection(node, parentDirection) {
7981
+ var direction;
7982
+ if (node.style.direction) {
7983
+ direction = node.style.direction;
7984
+ } else {
7985
+ direction = CSS_DIRECTION_INHERIT;
7986
+ }
7987
+
7988
+ if (direction === CSS_DIRECTION_INHERIT) {
7989
+ direction = (parentDirection === undefined ? CSS_DIRECTION_LTR : parentDirection);
7990
+ }
7991
+
7992
+ return direction;
7993
+ }
7994
+
7995
+ function getFlexDirection(node) {
7996
+ if (node.style.flexDirection) {
7997
+ return node.style.flexDirection;
7998
+ }
7999
+ return CSS_FLEX_DIRECTION_COLUMN;
8000
+ }
8001
+
8002
+ function getCrossFlexDirection(flexDirection, direction) {
8003
+ if (isColumnDirection(flexDirection)) {
8004
+ return resolveAxis(CSS_FLEX_DIRECTION_ROW, direction);
8005
+ } else {
8006
+ return CSS_FLEX_DIRECTION_COLUMN;
8007
+ }
8008
+ }
8009
+
8010
+ function getPositionType(node) {
8011
+ if (node.style.position) {
8012
+ return node.style.position;
8013
+ }
8014
+ return 'relative';
8015
+ }
8016
+
8017
+ function isFlex(node) {
8018
+ return (
8019
+ getPositionType(node) === CSS_POSITION_RELATIVE &&
8020
+ node.style.flex > 0
8021
+ );
8022
+ }
8023
+
8024
+ function isFlexWrap(node) {
8025
+ return node.style.flexWrap === 'wrap';
8026
+ }
8027
+
8028
+ function getDimWithMargin(node, axis) {
8029
+ return node.layout[dim[axis]] + getMarginAxis(node, axis);
8030
+ }
8031
+
8032
+ function isDimDefined(node, axis) {
8033
+ return node.style[dim[axis]] !== undefined && node.style[dim[axis]] >= 0;
8034
+ }
8035
+
8036
+ function isPosDefined(node, pos) {
8037
+ return node.style[pos] !== undefined;
8038
+ }
8039
+
8040
+ function isMeasureDefined(node) {
8041
+ return node.style.measure !== undefined;
8042
+ }
8043
+
8044
+ function getPosition(node, pos) {
8045
+ if (node.style[pos] !== undefined) {
8046
+ return node.style[pos];
8047
+ }
8048
+ return 0;
8049
+ }
8050
+
8051
+ function boundAxis(node, axis, value) {
8052
+ var min = {
8053
+ 'row': node.style.minWidth,
8054
+ 'row-reverse': node.style.minWidth,
8055
+ 'column': node.style.minHeight,
8056
+ 'column-reverse': node.style.minHeight
8057
+ }[axis];
8058
+
8059
+ var max = {
8060
+ 'row': node.style.maxWidth,
8061
+ 'row-reverse': node.style.maxWidth,
8062
+ 'column': node.style.maxHeight,
8063
+ 'column-reverse': node.style.maxHeight
8064
+ }[axis];
8065
+
8066
+ var boundValue = value;
8067
+ if (max !== undefined && max >= 0 && boundValue > max) {
8068
+ boundValue = max;
8069
+ }
8070
+ if (min !== undefined && min >= 0 && boundValue < min) {
8071
+ boundValue = min;
8072
+ }
8073
+ return boundValue;
8074
+ }
8075
+
8076
+ function fmaxf(a, b) {
8077
+ if (a > b) {
8078
+ return a;
8079
+ }
8080
+ return b;
8081
+ }
8082
+
8083
+ // When the user specifically sets a value for width or height
8084
+ function setDimensionFromStyle(node, axis) {
8085
+ // The parent already computed us a width or height. We just skip it
8086
+ if (node.layout[dim[axis]] !== undefined) {
8087
+ return;
8088
+ }
8089
+ // We only run if there's a width or height defined
8090
+ if (!isDimDefined(node, axis)) {
8091
+ return;
8092
+ }
8093
+
8094
+ // The dimensions can never be smaller than the padding and border
8095
+ node.layout[dim[axis]] = fmaxf(
8096
+ boundAxis(node, axis, node.style[dim[axis]]),
8097
+ getPaddingAndBorderAxis(node, axis)
8098
+ );
8099
+ }
8100
+
8101
+ function setTrailingPosition(node, child, axis) {
8102
+ child.layout[trailing[axis]] = node.layout[dim[axis]] -
8103
+ child.layout[dim[axis]] - child.layout[pos[axis]];
8104
+ }
8105
+
8106
+ // If both left and right are defined, then use left. Otherwise return
8107
+ // +left or -right depending on which is defined.
8108
+ function getRelativePosition(node, axis) {
8109
+ if (node.style[leading[axis]] !== undefined) {
8110
+ return getPosition(node, leading[axis]);
8111
+ }
8112
+ return -getPosition(node, trailing[axis]);
8113
+ }
8114
+
8115
+ function layoutNodeImpl(node, parentMaxWidth, /*css_direction_t*/parentDirection) {
8116
+ var/*css_direction_t*/ direction = resolveDirection(node, parentDirection);
8117
+ var/*(c)!css_flex_direction_t*//*(java)!int*/ mainAxis = resolveAxis(getFlexDirection(node), direction);
8118
+ var/*(c)!css_flex_direction_t*//*(java)!int*/ crossAxis = getCrossFlexDirection(mainAxis, direction);
8119
+ var/*(c)!css_flex_direction_t*//*(java)!int*/ resolvedRowAxis = resolveAxis(CSS_FLEX_DIRECTION_ROW, direction);
8120
+
8121
+ // Handle width and height style attributes
8122
+ setDimensionFromStyle(node, mainAxis);
8123
+ setDimensionFromStyle(node, crossAxis);
8124
+
8125
+ // Set the resolved resolution in the node's layout
8126
+ node.layout.direction = direction;
8127
+
8128
+ // The position is set by the parent, but we need to complete it with a
8129
+ // delta composed of the margin and left/top/right/bottom
8130
+ node.layout[leading[mainAxis]] += getLeadingMargin(node, mainAxis) +
8131
+ getRelativePosition(node, mainAxis);
8132
+ node.layout[trailing[mainAxis]] += getTrailingMargin(node, mainAxis) +
8133
+ getRelativePosition(node, mainAxis);
8134
+ node.layout[leading[crossAxis]] += getLeadingMargin(node, crossAxis) +
8135
+ getRelativePosition(node, crossAxis);
8136
+ node.layout[trailing[crossAxis]] += getTrailingMargin(node, crossAxis) +
8137
+ getRelativePosition(node, crossAxis);
8138
+
8139
+ // Inline immutable values from the target node to avoid excessive method
8140
+ // invocations during the layout calculation.
8141
+ var/*int*/ childCount = node.children.length;
8142
+ var/*float*/ paddingAndBorderAxisResolvedRow = getPaddingAndBorderAxis(node, resolvedRowAxis);
8143
+
8144
+ if (isMeasureDefined(node)) {
8145
+ var/*bool*/ isResolvedRowDimDefined = !isUndefined(node.layout[dim[resolvedRowAxis]]);
8146
+
8147
+ var/*float*/ width = CSS_UNDEFINED;
8148
+ if (isDimDefined(node, resolvedRowAxis)) {
8149
+ width = node.style.width;
8150
+ } else if (isResolvedRowDimDefined) {
8151
+ width = node.layout[dim[resolvedRowAxis]];
8152
+ } else {
8153
+ width = parentMaxWidth -
8154
+ getMarginAxis(node, resolvedRowAxis);
8155
+ }
8156
+ width -= paddingAndBorderAxisResolvedRow;
8157
+
8158
+ // We only need to give a dimension for the text if we haven't got any
8159
+ // for it computed yet. It can either be from the style attribute or because
8160
+ // the element is flexible.
8161
+ var/*bool*/ isRowUndefined = !isDimDefined(node, resolvedRowAxis) && !isResolvedRowDimDefined;
8162
+ var/*bool*/ isColumnUndefined = !isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) &&
8163
+ isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]);
8164
+
8165
+ // Let's not measure the text if we already know both dimensions
8166
+ if (isRowUndefined || isColumnUndefined) {
8167
+ var/*css_dim_t*/ measureDim = node.style.measure(
8168
+ /*(c)!node->context,*/
8169
+ /*(java)!layoutContext.measureOutput,*/
8170
+ width
8171
+ );
8172
+ if (isRowUndefined) {
8173
+ node.layout.width = measureDim.width +
8174
+ paddingAndBorderAxisResolvedRow;
8175
+ }
8176
+ if (isColumnUndefined) {
8177
+ node.layout.height = measureDim.height +
8178
+ getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN);
8179
+ }
8180
+ }
8181
+ if (childCount === 0) {
8182
+ return;
8183
+ }
8184
+ }
8185
+
8186
+ var/*bool*/ isNodeFlexWrap = isFlexWrap(node);
8187
+
8188
+ var/*css_justify_t*/ justifyContent = getJustifyContent(node);
8189
+
8190
+ var/*float*/ leadingPaddingAndBorderMain = getLeadingPaddingAndBorder(node, mainAxis);
8191
+ var/*float*/ leadingPaddingAndBorderCross = getLeadingPaddingAndBorder(node, crossAxis);
8192
+ var/*float*/ paddingAndBorderAxisMain = getPaddingAndBorderAxis(node, mainAxis);
8193
+ var/*float*/ paddingAndBorderAxisCross = getPaddingAndBorderAxis(node, crossAxis);
8194
+
8195
+ var/*bool*/ isMainDimDefined = !isUndefined(node.layout[dim[mainAxis]]);
8196
+ var/*bool*/ isCrossDimDefined = !isUndefined(node.layout[dim[crossAxis]]);
8197
+ var/*bool*/ isMainRowDirection = isRowDirection(mainAxis);
8198
+
8199
+ var/*int*/ i;
8200
+ var/*int*/ ii;
8201
+ var/*css_node_t**/ child;
8202
+ var/*(c)!css_flex_direction_t*//*(java)!int*/ axis;
8203
+
8204
+ var/*css_node_t**/ firstAbsoluteChild = null;
8205
+ var/*css_node_t**/ currentAbsoluteChild = null;
8206
+
8207
+ var/*float*/ definedMainDim = CSS_UNDEFINED;
8208
+ if (isMainDimDefined) {
8209
+ definedMainDim = node.layout[dim[mainAxis]] - paddingAndBorderAxisMain;
8210
+ }
8211
+
8212
+ // We want to execute the next two loops one per line with flex-wrap
8213
+ var/*int*/ startLine = 0;
8214
+ var/*int*/ endLine = 0;
8215
+ // var/*int*/ nextOffset = 0;
8216
+ var/*int*/ alreadyComputedNextLayout = 0;
8217
+ // We aggregate the total dimensions of the container in those two variables
8218
+ var/*float*/ linesCrossDim = 0;
8219
+ var/*float*/ linesMainDim = 0;
8220
+ var/*int*/ linesCount = 0;
8221
+ while (endLine < childCount) {
8222
+ // <Loop A> Layout non flexible children and count children by type
8223
+
8224
+ // mainContentDim is accumulation of the dimensions and margin of all the
8225
+ // non flexible children. This will be used in order to either set the
8226
+ // dimensions of the node if none already exist, or to compute the
8227
+ // remaining space left for the flexible children.
8228
+ var/*float*/ mainContentDim = 0;
8229
+
8230
+ // There are three kind of children, non flexible, flexible and absolute.
8231
+ // We need to know how many there are in order to distribute the space.
8232
+ var/*int*/ flexibleChildrenCount = 0;
8233
+ var/*float*/ totalFlexible = 0;
8234
+ var/*int*/ nonFlexibleChildrenCount = 0;
8235
+
8236
+ // Use the line loop to position children in the main axis for as long
8237
+ // as they are using a simple stacking behaviour. Children that are
8238
+ // immediately stacked in the initial loop will not be touched again
8239
+ // in <Loop C>.
8240
+ var/*bool*/ isSimpleStackMain =
8241
+ (isMainDimDefined && justifyContent === CSS_JUSTIFY_FLEX_START) ||
8242
+ (!isMainDimDefined && justifyContent !== CSS_JUSTIFY_CENTER);
8243
+ var/*int*/ firstComplexMain = (isSimpleStackMain ? childCount : startLine);
8244
+
8245
+ // Use the initial line loop to position children in the cross axis for
8246
+ // as long as they are relatively positioned with alignment STRETCH or
8247
+ // FLEX_START. Children that are immediately stacked in the initial loop
8248
+ // will not be touched again in <Loop D>.
8249
+ var/*bool*/ isSimpleStackCross = true;
8250
+ var/*int*/ firstComplexCross = childCount;
8251
+
8252
+ var/*css_node_t**/ firstFlexChild = null;
8253
+ var/*css_node_t**/ currentFlexChild = null;
8254
+
8255
+ var/*float*/ mainDim = leadingPaddingAndBorderMain;
8256
+ var/*float*/ crossDim = 0;
8257
+
8258
+ var/*float*/ maxWidth;
8259
+ for (i = startLine; i < childCount; ++i) {
8260
+ child = node.children[i];
8261
+ child.lineIndex = linesCount;
8262
+
8263
+ child.nextAbsoluteChild = null;
8264
+ child.nextFlexChild = null;
8265
+
8266
+ var/*css_align_t*/ alignItem = getAlignItem(node, child);
8267
+
8268
+ // Pre-fill cross axis dimensions when the child is using stretch before
8269
+ // we call the recursive layout pass
8270
+ if (alignItem === CSS_ALIGN_STRETCH &&
8271
+ getPositionType(child) === CSS_POSITION_RELATIVE &&
8272
+ isCrossDimDefined &&
8273
+ !isDimDefined(child, crossAxis)) {
8274
+ child.layout[dim[crossAxis]] = fmaxf(
8275
+ boundAxis(child, crossAxis, node.layout[dim[crossAxis]] -
8276
+ paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)),
8277
+ // You never want to go smaller than padding
8278
+ getPaddingAndBorderAxis(child, crossAxis)
8279
+ );
8280
+ } else if (getPositionType(child) === CSS_POSITION_ABSOLUTE) {
8281
+ // Store a private linked list of absolutely positioned children
8282
+ // so that we can efficiently traverse them later.
8283
+ if (firstAbsoluteChild === null) {
8284
+ firstAbsoluteChild = child;
8285
+ }
8286
+ if (currentAbsoluteChild !== null) {
8287
+ currentAbsoluteChild.nextAbsoluteChild = child;
8288
+ }
8289
+ currentAbsoluteChild = child;
8290
+
8291
+ // Pre-fill dimensions when using absolute position and both offsets for the axis are defined (either both
8292
+ // left and right or top and bottom).
8293
+ for (ii = 0; ii < 2; ii++) {
8294
+ axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;
8295
+ if (!isUndefined(node.layout[dim[axis]]) &&
8296
+ !isDimDefined(child, axis) &&
8297
+ isPosDefined(child, leading[axis]) &&
8298
+ isPosDefined(child, trailing[axis])) {
8299
+ child.layout[dim[axis]] = fmaxf(
8300
+ boundAxis(child, axis, node.layout[dim[axis]] -
8301
+ getPaddingAndBorderAxis(node, axis) -
8302
+ getMarginAxis(child, axis) -
8303
+ getPosition(child, leading[axis]) -
8304
+ getPosition(child, trailing[axis])),
8305
+ // You never want to go smaller than padding
8306
+ getPaddingAndBorderAxis(child, axis)
8307
+ );
8308
+ }
8309
+ }
8310
+ }
8311
+
8312
+ var/*float*/ nextContentDim = 0;
8313
+
8314
+ // It only makes sense to consider a child flexible if we have a computed
8315
+ // dimension for the node.
8316
+ if (isMainDimDefined && isFlex(child)) {
8317
+ flexibleChildrenCount++;
8318
+ totalFlexible += child.style.flex;
8319
+
8320
+ // Store a private linked list of flexible children so that we can
8321
+ // efficiently traverse them later.
8322
+ if (firstFlexChild === null) {
8323
+ firstFlexChild = child;
8324
+ }
8325
+ if (currentFlexChild !== null) {
8326
+ currentFlexChild.nextFlexChild = child;
8327
+ }
8328
+ currentFlexChild = child;
8329
+
8330
+ // Even if we don't know its exact size yet, we already know the padding,
8331
+ // border and margin. We'll use this partial information, which represents
8332
+ // the smallest possible size for the child, to compute the remaining
8333
+ // available space.
8334
+ nextContentDim = getPaddingAndBorderAxis(child, mainAxis) +
8335
+ getMarginAxis(child, mainAxis);
8336
+
8337
+ } else {
8338
+ maxWidth = CSS_UNDEFINED;
8339
+ if (!isMainRowDirection) {
8340
+ if (isDimDefined(node, resolvedRowAxis)) {
8341
+ maxWidth = node.layout[dim[resolvedRowAxis]] -
8342
+ paddingAndBorderAxisResolvedRow;
8343
+ } else {
8344
+ maxWidth = parentMaxWidth -
8345
+ getMarginAxis(node, resolvedRowAxis) -
8346
+ paddingAndBorderAxisResolvedRow;
8347
+ }
8348
+ }
8349
+
8350
+ // This is the main recursive call. We layout non flexible children.
8351
+ if (alreadyComputedNextLayout === 0) {
8352
+ layoutNode(/*(java)!layoutContext, */child, maxWidth, direction);
8353
+ }
8354
+
8355
+ // Absolute positioned elements do not take part of the layout, so we
8356
+ // don't use them to compute mainContentDim
8357
+ if (getPositionType(child) === CSS_POSITION_RELATIVE) {
8358
+ nonFlexibleChildrenCount++;
8359
+ // At this point we know the final size and margin of the element.
8360
+ nextContentDim = getDimWithMargin(child, mainAxis);
8361
+ }
8362
+ }
8363
+
8364
+ // The element we are about to add would make us go to the next line
8365
+ if (isNodeFlexWrap &&
8366
+ isMainDimDefined &&
8367
+ mainContentDim + nextContentDim > definedMainDim &&
8368
+ // If there's only one element, then it's bigger than the content
8369
+ // and needs its own line
8370
+ i !== startLine) {
8371
+ nonFlexibleChildrenCount--;
8372
+ alreadyComputedNextLayout = 1;
8373
+ break;
8374
+ }
8375
+
8376
+ // Disable simple stacking in the main axis for the current line as
8377
+ // we found a non-trivial child. The remaining children will be laid out
8378
+ // in <Loop C>.
8379
+ if (isSimpleStackMain &&
8380
+ (getPositionType(child) !== CSS_POSITION_RELATIVE || isFlex(child))) {
8381
+ isSimpleStackMain = false;
8382
+ firstComplexMain = i;
8383
+ }
8384
+
8385
+ // Disable simple stacking in the cross axis for the current line as
8386
+ // we found a non-trivial child. The remaining children will be laid out
8387
+ // in <Loop D>.
8388
+ if (isSimpleStackCross &&
8389
+ (getPositionType(child) !== CSS_POSITION_RELATIVE ||
8390
+ (alignItem !== CSS_ALIGN_STRETCH && alignItem !== CSS_ALIGN_FLEX_START) ||
8391
+ isUndefined(child.layout[dim[crossAxis]]))) {
8392
+ isSimpleStackCross = false;
8393
+ firstComplexCross = i;
8394
+ }
8395
+
8396
+ if (isSimpleStackMain) {
8397
+ child.layout[pos[mainAxis]] += mainDim;
8398
+ if (isMainDimDefined) {
8399
+ setTrailingPosition(node, child, mainAxis);
8400
+ }
8401
+
8402
+ mainDim += getDimWithMargin(child, mainAxis);
8403
+ crossDim = fmaxf(crossDim, boundAxis(child, crossAxis, getDimWithMargin(child, crossAxis)));
8404
+ }
8405
+
8406
+ if (isSimpleStackCross) {
8407
+ child.layout[pos[crossAxis]] += linesCrossDim + leadingPaddingAndBorderCross;
8408
+ if (isCrossDimDefined) {
8409
+ setTrailingPosition(node, child, crossAxis);
8410
+ }
8411
+ }
8412
+
8413
+ alreadyComputedNextLayout = 0;
8414
+ mainContentDim += nextContentDim;
8415
+ endLine = i + 1;
8416
+ }
8417
+
8418
+ // <Loop B> Layout flexible children and allocate empty space
8419
+
8420
+ // In order to position the elements in the main axis, we have two
8421
+ // controls. The space between the beginning and the first element
8422
+ // and the space between each two elements.
8423
+ var/*float*/ leadingMainDim = 0;
8424
+ var/*float*/ betweenMainDim = 0;
8425
+
8426
+ // The remaining available space that needs to be allocated
8427
+ var/*float*/ remainingMainDim = 0;
8428
+ if (isMainDimDefined) {
8429
+ remainingMainDim = definedMainDim - mainContentDim;
8430
+ } else {
8431
+ remainingMainDim = fmaxf(mainContentDim, 0) - mainContentDim;
8432
+ }
8433
+
8434
+ // If there are flexible children in the mix, they are going to fill the
8435
+ // remaining space
8436
+ if (flexibleChildrenCount !== 0) {
8437
+ var/*float*/ flexibleMainDim = remainingMainDim / totalFlexible;
8438
+ var/*float*/ baseMainDim;
8439
+ var/*float*/ boundMainDim;
8440
+
8441
+ // If the flex share of remaining space doesn't meet min/max bounds,
8442
+ // remove this child from flex calculations.
8443
+ currentFlexChild = firstFlexChild;
8444
+ while (currentFlexChild !== null) {
8445
+ baseMainDim = flexibleMainDim * currentFlexChild.style.flex +
8446
+ getPaddingAndBorderAxis(currentFlexChild, mainAxis);
8447
+ boundMainDim = boundAxis(currentFlexChild, mainAxis, baseMainDim);
8448
+
8449
+ if (baseMainDim !== boundMainDim) {
8450
+ remainingMainDim -= boundMainDim;
8451
+ totalFlexible -= currentFlexChild.style.flex;
8452
+ }
8453
+
8454
+ currentFlexChild = currentFlexChild.nextFlexChild;
8455
+ }
8456
+ flexibleMainDim = remainingMainDim / totalFlexible;
8457
+
8458
+ // The non flexible children can overflow the container, in this case
8459
+ // we should just assume that there is no space available.
8460
+ if (flexibleMainDim < 0) {
8461
+ flexibleMainDim = 0;
8462
+ }
8463
+
8464
+ currentFlexChild = firstFlexChild;
8465
+ while (currentFlexChild !== null) {
8466
+ // At this point we know the final size of the element in the main
8467
+ // dimension
8468
+ currentFlexChild.layout[dim[mainAxis]] = boundAxis(currentFlexChild, mainAxis,
8469
+ flexibleMainDim * currentFlexChild.style.flex +
8470
+ getPaddingAndBorderAxis(currentFlexChild, mainAxis)
8471
+ );
8472
+
8473
+ maxWidth = CSS_UNDEFINED;
8474
+ if (isDimDefined(node, resolvedRowAxis)) {
8475
+ maxWidth = node.layout[dim[resolvedRowAxis]] -
8476
+ paddingAndBorderAxisResolvedRow;
8477
+ } else if (!isMainRowDirection) {
8478
+ maxWidth = parentMaxWidth -
8479
+ getMarginAxis(node, resolvedRowAxis) -
8480
+ paddingAndBorderAxisResolvedRow;
8481
+ }
8482
+
8483
+ // And we recursively call the layout algorithm for this child
8484
+ layoutNode(/*(java)!layoutContext, */currentFlexChild, maxWidth, direction);
8485
+
8486
+ child = currentFlexChild;
8487
+ currentFlexChild = currentFlexChild.nextFlexChild;
8488
+ child.nextFlexChild = null;
8489
+ }
8490
+
8491
+ // We use justifyContent to figure out how to allocate the remaining
8492
+ // space available
8493
+ } else if (justifyContent !== CSS_JUSTIFY_FLEX_START) {
8494
+ if (justifyContent === CSS_JUSTIFY_CENTER) {
8495
+ leadingMainDim = remainingMainDim / 2;
8496
+ } else if (justifyContent === CSS_JUSTIFY_FLEX_END) {
8497
+ leadingMainDim = remainingMainDim;
8498
+ } else if (justifyContent === CSS_JUSTIFY_SPACE_BETWEEN) {
8499
+ remainingMainDim = fmaxf(remainingMainDim, 0);
8500
+ if (flexibleChildrenCount + nonFlexibleChildrenCount - 1 !== 0) {
8501
+ betweenMainDim = remainingMainDim /
8502
+ (flexibleChildrenCount + nonFlexibleChildrenCount - 1);
8503
+ } else {
8504
+ betweenMainDim = 0;
8505
+ }
8506
+ } else if (justifyContent === CSS_JUSTIFY_SPACE_AROUND) {
8507
+ // Space on the edges is half of the space between elements
8508
+ betweenMainDim = remainingMainDim /
8509
+ (flexibleChildrenCount + nonFlexibleChildrenCount);
8510
+ leadingMainDim = betweenMainDim / 2;
8511
+ }
8512
+ }
8513
+
8514
+ // <Loop C> Position elements in the main axis and compute dimensions
8515
+
8516
+ // At this point, all the children have their dimensions set. We need to
8517
+ // find their position. In order to do that, we accumulate data in
8518
+ // variables that are also useful to compute the total dimensions of the
8519
+ // container!
8520
+ mainDim += leadingMainDim;
8521
+
8522
+ for (i = firstComplexMain; i < endLine; ++i) {
8523
+ child = node.children[i];
8524
+
8525
+ if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&
8526
+ isPosDefined(child, leading[mainAxis])) {
8527
+ // In case the child is position absolute and has left/top being
8528
+ // defined, we override the position to whatever the user said
8529
+ // (and margin/border).
8530
+ child.layout[pos[mainAxis]] = getPosition(child, leading[mainAxis]) +
8531
+ getLeadingBorder(node, mainAxis) +
8532
+ getLeadingMargin(child, mainAxis);
8533
+ } else {
8534
+ // If the child is position absolute (without top/left) or relative,
8535
+ // we put it at the current accumulated offset.
8536
+ child.layout[pos[mainAxis]] += mainDim;
8537
+
8538
+ // Define the trailing position accordingly.
8539
+ if (isMainDimDefined) {
8540
+ setTrailingPosition(node, child, mainAxis);
8541
+ }
8542
+
8543
+ // Now that we placed the element, we need to update the variables
8544
+ // We only need to do that for relative elements. Absolute elements
8545
+ // do not take part in that phase.
8546
+ if (getPositionType(child) === CSS_POSITION_RELATIVE) {
8547
+ // The main dimension is the sum of all the elements dimension plus
8548
+ // the spacing.
8549
+ mainDim += betweenMainDim + getDimWithMargin(child, mainAxis);
8550
+ // The cross dimension is the max of the elements dimension since there
8551
+ // can only be one element in that cross dimension.
8552
+ crossDim = fmaxf(crossDim, boundAxis(child, crossAxis, getDimWithMargin(child, crossAxis)));
8553
+ }
8554
+ }
8555
+ }
8556
+
8557
+ var/*float*/ containerCrossAxis = node.layout[dim[crossAxis]];
8558
+ if (!isCrossDimDefined) {
8559
+ containerCrossAxis = fmaxf(
8560
+ // For the cross dim, we add both sides at the end because the value
8561
+ // is aggregate via a max function. Intermediate negative values
8562
+ // can mess this computation otherwise
8563
+ boundAxis(node, crossAxis, crossDim + paddingAndBorderAxisCross),
8564
+ paddingAndBorderAxisCross
8565
+ );
8566
+ }
8567
+
8568
+ // <Loop D> Position elements in the cross axis
8569
+ for (i = firstComplexCross; i < endLine; ++i) {
8570
+ child = node.children[i];
8571
+
8572
+ if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&
8573
+ isPosDefined(child, leading[crossAxis])) {
8574
+ // In case the child is absolutely positionned and has a
8575
+ // top/left/bottom/right being set, we override all the previously
8576
+ // computed positions to set it correctly.
8577
+ child.layout[pos[crossAxis]] = getPosition(child, leading[crossAxis]) +
8578
+ getLeadingBorder(node, crossAxis) +
8579
+ getLeadingMargin(child, crossAxis);
8580
+
8581
+ } else {
8582
+ var/*float*/ leadingCrossDim = leadingPaddingAndBorderCross;
8583
+
8584
+ // For a relative children, we're either using alignItems (parent) or
8585
+ // alignSelf (child) in order to determine the position in the cross axis
8586
+ if (getPositionType(child) === CSS_POSITION_RELATIVE) {
8587
+ /*eslint-disable */
8588
+ // This variable is intentionally re-defined as the code is transpiled to a block scope language
8589
+ var/*css_align_t*/ alignItem = getAlignItem(node, child);
8590
+ /*eslint-enable */
8591
+ if (alignItem === CSS_ALIGN_STRETCH) {
8592
+ // You can only stretch if the dimension has not already been set
8593
+ // previously.
8594
+ if (isUndefined(child.layout[dim[crossAxis]])) {
8595
+ child.layout[dim[crossAxis]] = fmaxf(
8596
+ boundAxis(child, crossAxis, containerCrossAxis -
8597
+ paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)),
8598
+ // You never want to go smaller than padding
8599
+ getPaddingAndBorderAxis(child, crossAxis)
8600
+ );
8601
+ }
8602
+ } else if (alignItem !== CSS_ALIGN_FLEX_START) {
8603
+ // The remaining space between the parent dimensions+padding and child
8604
+ // dimensions+margin.
8605
+ var/*float*/ remainingCrossDim = containerCrossAxis -
8606
+ paddingAndBorderAxisCross - getDimWithMargin(child, crossAxis);
8607
+
8608
+ if (alignItem === CSS_ALIGN_CENTER) {
8609
+ leadingCrossDim += remainingCrossDim / 2;
8610
+ } else { // CSS_ALIGN_FLEX_END
8611
+ leadingCrossDim += remainingCrossDim;
8612
+ }
8613
+ }
8614
+ }
8615
+
8616
+ // And we apply the position
8617
+ child.layout[pos[crossAxis]] += linesCrossDim + leadingCrossDim;
8618
+
8619
+ // Define the trailing position accordingly.
8620
+ if (isCrossDimDefined) {
8621
+ setTrailingPosition(node, child, crossAxis);
8622
+ }
8623
+ }
8624
+ }
8625
+
8626
+ linesCrossDim += crossDim;
8627
+ linesMainDim = fmaxf(linesMainDim, mainDim);
8628
+ linesCount += 1;
8629
+ startLine = endLine;
8630
+ }
8631
+
8632
+ // <Loop E>
8633
+ //
8634
+ // Note(prenaux): More than one line, we need to layout the crossAxis
8635
+ // according to alignContent.
8636
+ //
8637
+ // Note that we could probably remove <Loop D> and handle the one line case
8638
+ // here too, but for the moment this is safer since it won't interfere with
8639
+ // previously working code.
8640
+ //
8641
+ // See specs:
8642
+ // http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#layout-algorithm
8643
+ // section 9.4
8644
+ //
8645
+ if (linesCount > 1 && isCrossDimDefined) {
8646
+ var/*float*/ nodeCrossAxisInnerSize = node.layout[dim[crossAxis]] -
8647
+ paddingAndBorderAxisCross;
8648
+ var/*float*/ remainingAlignContentDim = nodeCrossAxisInnerSize - linesCrossDim;
8649
+
8650
+ var/*float*/ crossDimLead = 0;
8651
+ var/*float*/ currentLead = leadingPaddingAndBorderCross;
8652
+
8653
+ var/*css_align_t*/ alignContent = getAlignContent(node);
8654
+ if (alignContent === CSS_ALIGN_FLEX_END) {
8655
+ currentLead += remainingAlignContentDim;
8656
+ } else if (alignContent === CSS_ALIGN_CENTER) {
8657
+ currentLead += remainingAlignContentDim / 2;
8658
+ } else if (alignContent === CSS_ALIGN_STRETCH) {
8659
+ if (nodeCrossAxisInnerSize > linesCrossDim) {
8660
+ crossDimLead = (remainingAlignContentDim / linesCount);
8661
+ }
8662
+ }
8663
+
8664
+ var/*int*/ endIndex = 0;
8665
+ for (i = 0; i < linesCount; ++i) {
8666
+ var/*int*/ startIndex = endIndex;
8667
+
8668
+ // compute the line's height and find the endIndex
8669
+ var/*float*/ lineHeight = 0;
8670
+ for (ii = startIndex; ii < childCount; ++ii) {
8671
+ child = node.children[ii];
8672
+ if (getPositionType(child) !== CSS_POSITION_RELATIVE) {
8673
+ continue;
8674
+ }
8675
+ if (child.lineIndex !== i) {
8676
+ break;
8677
+ }
8678
+ if (!isUndefined(child.layout[dim[crossAxis]])) {
8679
+ lineHeight = fmaxf(
8680
+ lineHeight,
8681
+ child.layout[dim[crossAxis]] + getMarginAxis(child, crossAxis)
8682
+ );
8683
+ }
8684
+ }
8685
+ endIndex = ii;
8686
+ lineHeight += crossDimLead;
8687
+
8688
+ for (ii = startIndex; ii < endIndex; ++ii) {
8689
+ child = node.children[ii];
8690
+ if (getPositionType(child) !== CSS_POSITION_RELATIVE) {
8691
+ continue;
8692
+ }
8693
+
8694
+ var/*css_align_t*/ alignContentAlignItem = getAlignItem(node, child);
8695
+ if (alignContentAlignItem === CSS_ALIGN_FLEX_START) {
8696
+ child.layout[pos[crossAxis]] = currentLead + getLeadingMargin(child, crossAxis);
8697
+ } else if (alignContentAlignItem === CSS_ALIGN_FLEX_END) {
8698
+ child.layout[pos[crossAxis]] = currentLead + lineHeight - getTrailingMargin(child, crossAxis) - child.layout[dim[crossAxis]];
8699
+ } else if (alignContentAlignItem === CSS_ALIGN_CENTER) {
8700
+ var/*float*/ childHeight = child.layout[dim[crossAxis]];
8701
+ child.layout[pos[crossAxis]] = currentLead + (lineHeight - childHeight) / 2;
8702
+ } else if (alignContentAlignItem === CSS_ALIGN_STRETCH) {
8703
+ child.layout[pos[crossAxis]] = currentLead + getLeadingMargin(child, crossAxis);
8704
+ // TODO(prenaux): Correctly set the height of items with undefined
8705
+ // (auto) crossAxis dimension.
8706
+ }
8707
+ }
8708
+
8709
+ currentLead += lineHeight;
8710
+ }
8711
+ }
8712
+
8713
+ var/*bool*/ needsMainTrailingPos = false;
8714
+ var/*bool*/ needsCrossTrailingPos = false;
8715
+
8716
+ // If the user didn't specify a width or height, and it has not been set
8717
+ // by the container, then we set it via the children.
8718
+ if (!isMainDimDefined) {
8719
+ node.layout[dim[mainAxis]] = fmaxf(
8720
+ // We're missing the last padding at this point to get the final
8721
+ // dimension
8722
+ boundAxis(node, mainAxis, linesMainDim + getTrailingPaddingAndBorder(node, mainAxis)),
8723
+ // We can never assign a width smaller than the padding and borders
8724
+ paddingAndBorderAxisMain
8725
+ );
8726
+
8727
+ if (mainAxis === CSS_FLEX_DIRECTION_ROW_REVERSE ||
8728
+ mainAxis === CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
8729
+ needsMainTrailingPos = true;
8730
+ }
8731
+ }
8732
+
8733
+ if (!isCrossDimDefined) {
8734
+ node.layout[dim[crossAxis]] = fmaxf(
8735
+ // For the cross dim, we add both sides at the end because the value
8736
+ // is aggregate via a max function. Intermediate negative values
8737
+ // can mess this computation otherwise
8738
+ boundAxis(node, crossAxis, linesCrossDim + paddingAndBorderAxisCross),
8739
+ paddingAndBorderAxisCross
8740
+ );
8741
+
8742
+ if (crossAxis === CSS_FLEX_DIRECTION_ROW_REVERSE ||
8743
+ crossAxis === CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
8744
+ needsCrossTrailingPos = true;
8745
+ }
8746
+ }
8747
+
8748
+ // <Loop F> Set trailing position if necessary
8749
+ if (needsMainTrailingPos || needsCrossTrailingPos) {
8750
+ for (i = 0; i < childCount; ++i) {
8751
+ child = node.children[i];
8752
+
8753
+ if (needsMainTrailingPos) {
8754
+ setTrailingPosition(node, child, mainAxis);
8755
+ }
8756
+
8757
+ if (needsCrossTrailingPos) {
8758
+ setTrailingPosition(node, child, crossAxis);
8759
+ }
8760
+ }
8761
+ }
8762
+
8763
+ // <Loop G> Calculate dimensions for absolutely positioned elements
8764
+ currentAbsoluteChild = firstAbsoluteChild;
8765
+ while (currentAbsoluteChild !== null) {
8766
+ // Pre-fill dimensions when using absolute position and both offsets for
8767
+ // the axis are defined (either both left and right or top and bottom).
8768
+ for (ii = 0; ii < 2; ii++) {
8769
+ axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;
8770
+
8771
+ if (!isUndefined(node.layout[dim[axis]]) &&
8772
+ !isDimDefined(currentAbsoluteChild, axis) &&
8773
+ isPosDefined(currentAbsoluteChild, leading[axis]) &&
8774
+ isPosDefined(currentAbsoluteChild, trailing[axis])) {
8775
+ currentAbsoluteChild.layout[dim[axis]] = fmaxf(
8776
+ boundAxis(currentAbsoluteChild, axis, node.layout[dim[axis]] -
8777
+ getBorderAxis(node, axis) -
8778
+ getMarginAxis(currentAbsoluteChild, axis) -
8779
+ getPosition(currentAbsoluteChild, leading[axis]) -
8780
+ getPosition(currentAbsoluteChild, trailing[axis])
8781
+ ),
8782
+ // You never want to go smaller than padding
8783
+ getPaddingAndBorderAxis(currentAbsoluteChild, axis)
8784
+ );
8785
+ }
8786
+
8787
+ if (isPosDefined(currentAbsoluteChild, trailing[axis]) &&
8788
+ !isPosDefined(currentAbsoluteChild, leading[axis])) {
8789
+ currentAbsoluteChild.layout[leading[axis]] =
8790
+ node.layout[dim[axis]] -
8791
+ currentAbsoluteChild.layout[dim[axis]] -
8792
+ getPosition(currentAbsoluteChild, trailing[axis]);
8793
+ }
8794
+ }
8795
+
8796
+ child = currentAbsoluteChild;
8797
+ currentAbsoluteChild = currentAbsoluteChild.nextAbsoluteChild;
8798
+ child.nextAbsoluteChild = null;
8799
+ }
8800
+ }
8801
+
8802
+ function layoutNode(node, parentMaxWidth, parentDirection) {
8803
+ node.shouldUpdate = true;
8804
+
8805
+ var direction = node.style.direction || CSS_DIRECTION_LTR;
8806
+ var skipLayout =
8807
+ !node.isDirty &&
8808
+ node.lastLayout &&
8809
+ node.lastLayout.requestedHeight === node.layout.height &&
8810
+ node.lastLayout.requestedWidth === node.layout.width &&
8811
+ node.lastLayout.parentMaxWidth === parentMaxWidth &&
8812
+ node.lastLayout.direction === direction;
8813
+
8814
+ if (skipLayout) {
8815
+ node.layout.width = node.lastLayout.width;
8816
+ node.layout.height = node.lastLayout.height;
8817
+ node.layout.top = node.lastLayout.top;
8818
+ node.layout.left = node.lastLayout.left;
8819
+ } else {
8820
+ if (!node.lastLayout) {
8821
+ node.lastLayout = {};
8822
+ }
8823
+
8824
+ node.lastLayout.requestedWidth = node.layout.width;
8825
+ node.lastLayout.requestedHeight = node.layout.height;
8826
+ node.lastLayout.parentMaxWidth = parentMaxWidth;
8827
+ node.lastLayout.direction = direction;
8828
+
8829
+ // Reset child layouts
8830
+ node.children.forEach(function(child) {
8831
+ child.layout.width = undefined;
8832
+ child.layout.height = undefined;
8833
+ child.layout.top = 0;
8834
+ child.layout.left = 0;
8835
+ });
8836
+
8837
+ layoutNodeImpl(node, parentMaxWidth, parentDirection);
8838
+
8839
+ node.lastLayout.width = node.layout.width;
8840
+ node.lastLayout.height = node.layout.height;
8841
+ node.lastLayout.top = node.layout.top;
8842
+ node.lastLayout.left = node.layout.left;
8843
+ }
8844
+ }
8845
+
8846
+ return {
8847
+ layoutNodeImpl: layoutNodeImpl,
8848
+ computeLayout: layoutNode,
8849
+ fillNodes: fillNodes
8850
+ };
8851
+ })();
8852
+
8853
+ // This module export is only used for the purposes of unit testing this file. When
8854
+ // the library is packaged this file is included within css-layout.js which forms
8855
+ // the public API.
8856
+ {
8857
+ module.exports = computeLayout;
8858
+ }
8859
+
8860
+
8861
+ return function(node) {
8862
+ /*eslint-disable */
8863
+ // disabling ESLint because this code relies on the above include
8864
+ computeLayout.fillNodes(node);
8865
+ computeLayout.computeLayout(node);
8866
+ /*eslint-enable */
8867
+ };
8868
+ }));
8869
+ } (cssLayout));
8870
+
8871
+ var cssLayoutExports = cssLayout.exports;
8872
+
8873
+ function _interopDefault$1(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var React=_interopDefault$1(React$1),reactDom=require$$0,computeLayout=_interopDefault$1(cssLayoutExports);function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_defineProperty(e,t,r[t]);});}return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),e}function _typeof2(e){return (_typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _typeof(e){return (_typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(e){return _typeof2(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof2(e)})(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return !t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _getPrototypeOf(e){return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return (_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t);}var Flexbox=function(e){function t(){var e;return _classCallCheck(this,t),(e=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).childRefs=[],e.shouldUpdateAgain=!1,e.state={layout:{children:[]}},e}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.forceUpdate();}},{key:"componentDidUpdate",value:function(){if(this.shouldUpdateAgain=!this.shouldUpdateAgain,this.shouldUpdateAgain){var e=this.props,t=e.children,r=e.onLayout,n=e.style,o=this.getChildrenMeasured(this.childRefs),i=this.getFlattenedChildren(t),u=this.getChildrenAsMergedStyles(i,o),c=this.getComputedLayout(u,n);r(c),this.setState({layout:c});}}},{key:"getFlattenedChildren",value:function(e){return e.filter(function(e){return e}).filter(function(e){return "string"!=typeof e}).map(function(e){return Array.isArray(e)?e:[e]}).reduce(function(e,t){return e.concat(t)},[])}},{key:"getChildrenAsMergedStyles",value:function(e,t){return t.map(function(t,r){var n=e[r]||{},o=n&&n.props?n.props.style:{};return {style:_objectSpread({},o,{height:t.height||o.height,width:t.width||o.width})}})}},{key:"getChildrenMeasured",value:function(e){return e&&e.length?e.map(function(e){return e.getBBox?e.getBBox():reactDom.findDOMNode(e).getBBox()}):[]}},{key:"getComputedLayout",value:function(e,t){var r={children:Array.from(e||[]),style:_objectSpread({},t)};return computeLayout(r),r}},{key:"getLayoutChildren",value:function(e){return e&&e.children&&e.children.length?e.children:[]}},{key:"getLayoutAttributesForChild",value:function(e,t){if(t&&t.layout){var r=t.layout,n=r.left,o=r.top;switch(e.type){case"circle":var i=e.props.r||0;return {cx:n+i,cy:o+i};case"ellipse":return {cx:n+(e.props.rx||0),cy:o+(e.props.ry||0)};case"g":case"path":case"polygon":case"polyline":return {transform:"translate(".concat(n," ").concat(o,")")};default:return {x:n,y:o}}}return {}}},{key:"render",value:function(){var e=this,t=this.props,r=t.children,n=t.className,o=t.x,i=t.y,u=this.state.layout;this.childRefs=[];var c=this.getFlattenedChildren(r),a=this.getLayoutChildren(u);return React.createElement("g",{className:n,transform:"translate(".concat(o," ").concat(i,")")},c.map(function(t,r){return React.cloneElement(t,_objectSpread({},t.props,e.getLayoutAttributesForChild(t,a[r]),{key:"child-".concat(r),ref:function(t){return t?e.childRefs.push(t):null}}))}))}}]),t}();Flexbox.defaultProps={children:[],className:null,onLayout:function(){},style:{},x:0,y:0},bundle.exports=Flexbox;
8874
+
8875
+ var bundleExports = bundle.exports;
8876
+ var Flexbox$1 = /*@__PURE__*/getDefaultExportFromCjs(bundleExports);
8877
+
7643
8878
  var Element = function (props) {
7644
- var _a, _b, _c;
7645
- var id = props.id, x = props.x, y = props.y, width = props.width, height = props.height, portPlaceholderShape = props.portPlaceholderShape, children = props.children, container = props.container, texts = props.texts, portSlideRailSVGClassName = props.portSlideRailSVGClassName, portMoveableAreas = props.portMoveableAreas, portDirection = props.portDirection, onClick = props.onClick, renderShape = props.renderShape; props.onMoved; var onPortMoved = props.onPortMoved; props.onResized; var onPortMouseDown = props.onPortMouseDown, onPortMouseUp = props.onPortMouseUp; props.onMouseMove; props.onMouseLeave; props.onMouseUp; var onMouseUpAtLinkedPortPlaceholder = props.onMouseUpAtLinkedPortPlaceholder, onTextUpdated = props.onTextUpdated;
7646
- var _d = React.useState(), selectedPort = _d[0], setSelectedPort = _d[1];
7647
- var _e = React.useState((_b = (_a = props.ports) === null || _a === void 0 ? void 0 : _a.map(function (p) {
7648
- return __assign(__assign({}, p), { id: p.id, ref: React.createRef() });
7649
- })) !== null && _b !== void 0 ? _b : []), ports = _e[0], setPorts = _e[1];
7650
- var _f = React.useState(false), someElementLinkStarted = _f[0], setSomeElementLinkStarted = _f[1];
7651
- var _g = React.useState(), potentialPortPosition = _g[0], setPotentialPortPosition = _g[1];
7652
- var _paperEventEmitterContext = React.useContext(paperEventEmitterContext);
7653
- var elementRef = React.useRef(null);
7654
- var elementLinkStarted = React.useRef();
8879
+ var _a, _b;
8880
+ var id = props.id, x = props.x, y = props.y, width = props.width, height = props.height, portPlaceholderShape = props.portPlaceholderShape, children = props.children, container = props.container, textsPlaceHolderFlexStyle = props.textsPlaceHolderFlexStyle, textsPlaceHolderFlexboxPosition = props.textsPlaceHolderFlexboxPosition, textsPlaceHolderClassName = props.textsPlaceHolderClassName, texts = props.texts, portSlideRailSVGClassName = props.portSlideRailSVGClassName, portMoveableAreas = props.portMoveableAreas, portDirection = props.portDirection, onClick = props.onClick, renderShape = props.renderShape; props.onMoved; var onPortMoved = props.onPortMoved; props.onResized; var onPortMouseDown = props.onPortMouseDown, onPortMouseUp = props.onPortMouseUp; props.onMouseMove; props.onMouseLeave; props.onMouseUp; var onMouseUpAtLinkedPortPlaceholder = props.onMouseUpAtLinkedPortPlaceholder, onTextUpdated = props.onTextUpdated;
8881
+ var _c = React$1.useState(), selectedPort = _c[0], setSelectedPort = _c[1];
8882
+ var _d = React$1.useState((_b = (_a = props.ports) === null || _a === void 0 ? void 0 : _a.map(function (p) {
8883
+ return __assign(__assign({}, p), { id: p.id, ref: React$1.createRef() });
8884
+ })) !== null && _b !== void 0 ? _b : []), ports = _d[0], setPorts = _d[1];
8885
+ var _e = React$1.useState(false), someElementLinkStarted = _e[0], setSomeElementLinkStarted = _e[1];
8886
+ var _f = React$1.useState(), potentialPortPosition = _f[0], setPotentialPortPosition = _f[1];
8887
+ var _paperEventEmitterContext = React$1.useContext(paperEventEmitterContext);
8888
+ var elementRef = React$1.useRef(null);
8889
+ var elementLinkStarted = React$1.useRef();
7655
8890
  //Listen a new port is created, after add new port to ports state
7656
- React.useEffect(function () {
8891
+ React$1.useEffect(function () {
7657
8892
  var _a, _b;
7658
8893
  setPorts((_b = (_a = props.ports) === null || _a === void 0 ? void 0 : _a.map(function (p) {
7659
- return __assign(__assign({}, p), { id: p.id, ref: React.createRef() });
8894
+ return __assign(__assign({}, p), { id: p.id, ref: React$1.createRef() });
7660
8895
  })) !== null && _b !== void 0 ? _b : []);
7661
8896
  }, [props.ports]);
7662
8897
  //Listen trigger of Delete key, handle delete port is selected
7663
- React.useEffect(function () {
8898
+ React$1.useEffect(function () {
7664
8899
  var listener = _paperEventEmitterContext.onCommandDeleteSelectedPort(function () {
7665
8900
  if (selectedPort) {
7666
8901
  setPorts(function (prev) { return prev.filter(function (p) { return p.id !== selectedPort.id; }); });
@@ -7671,7 +8906,7 @@ var Element = function (props) {
7671
8906
  listener.off();
7672
8907
  };
7673
8908
  }, [selectedPort]);
7674
- React.useEffect(function () {
8909
+ React$1.useEffect(function () {
7675
8910
  //Listener onMouseDown event on #paper-container
7676
8911
  var eventListener = _paperEventEmitterContext.onPaperClicked(function (ev) {
7677
8912
  setSelectedPort(undefined);
@@ -7694,7 +8929,7 @@ var Element = function (props) {
7694
8929
  };
7695
8930
  }, [ports, onPortMoved]);
7696
8931
  //Listen creating element link started, ended.
7697
- React.useEffect(function () {
8932
+ React$1.useEffect(function () {
7698
8933
  var elementStartedListener = _paperEventEmitterContext.onElementLinkStarted(function (tempLink) {
7699
8934
  elementLinkStarted.current = tempLink;
7700
8935
  setSomeElementLinkStarted(true);
@@ -7770,11 +9005,11 @@ var Element = function (props) {
7770
9005
  }
7771
9006
  return coordinates;
7772
9007
  };
7773
- var getSlideRailSVG = function (portSlideRailSVGClassName) {
9008
+ var getSlideRailSVG = React$1.useCallback(function (portSlideRailSVGClassName) {
7774
9009
  var _a;
7775
9010
  var slideRailSVG = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(".".concat(portSlideRailSVGClassName));
7776
9011
  return slideRailSVG;
7777
- };
9012
+ }, [elementRef.current]);
7778
9013
  var normalizePortPositionOnSlideRailSVG = function (portSlideRailSVGClassName, position) {
7779
9014
  var slideRailSVG = getSlideRailSVG(portSlideRailSVGClassName);
7780
9015
  if (!slideRailSVG)
@@ -7937,17 +9172,16 @@ var Element = function (props) {
7937
9172
  }
7938
9173
  };
7939
9174
  //Get rotate angle of port by port direction is defined.
7940
- var rotatePort = React.useCallback(function (port) {
7941
- console.info('calculating port rotation', port);
9175
+ var rotatePort = React$1.useCallback(function (x, y) {
9176
+ console.info('calculating port rotation', x, y);
7942
9177
  if (!portSlideRailSVGClassName)
7943
9178
  return 0;
7944
9179
  var slideRailSVG = getSlideRailSVG(portSlideRailSVGClassName);
7945
9180
  if (!slideRailSVG)
7946
9181
  return 0;
7947
9182
  var rotationAngle = 0;
7948
- port.id; var position = port.position; port.size;
7949
9183
  //Standardize the port position to be in the correct position
7950
- var normalizedPosition = normalizePortPosition(position);
9184
+ var normalizedPosition = normalizePortPosition({ x: x, y: y });
7951
9185
  switch (portDirection) {
7952
9186
  case exports.SubObjectDirection.Radial:
7953
9187
  var center = {
@@ -7977,8 +9211,8 @@ var Element = function (props) {
7977
9211
  break;
7978
9212
  }
7979
9213
  return rotationAngle;
7980
- }, [portSlideRailSVGClassName, portDirection]);
7981
- var renderedShape = React.useMemo(function () {
9214
+ }, [portSlideRailSVGClassName, portDirection, getSlideRailSVG]);
9215
+ var renderedShape = React$1.useMemo(function () {
7982
9216
  if (renderShape)
7983
9217
  return renderShape(props);
7984
9218
  return null;
@@ -7986,7 +9220,7 @@ var Element = function (props) {
7986
9220
  //Re-render port again after rendered to automation rotate port
7987
9221
  //Because elementRef.current equals null in first render so automation rotate port is incorrect.
7988
9222
  //TODO: check if this is still needed -> Still needed
7989
- React.useLayoutEffect(function () {
9223
+ React$1.useLayoutEffect(function () {
7990
9224
  if (elementRef.current) {
7991
9225
  setPorts(function (prev) { return __spreadArray([], prev, true); });
7992
9226
  }
@@ -7994,26 +9228,30 @@ var Element = function (props) {
7994
9228
  //use selection frame
7995
9229
  useSelectionFrame({
7996
9230
  container: container,
7997
- targetSVGElement: ((_c = selectedPort === null || selectedPort === void 0 ? void 0 : selectedPort.ref) === null || _c === void 0 ? void 0 : _c.current) || undefined,
9231
+ targetSVGElement: (selectedPort === null || selectedPort === void 0 ? void 0 : selectedPort.ref.current) || undefined,
7998
9232
  resizability: {
7999
9233
  enabled: false,
8000
9234
  keepRatio: false
8001
9235
  },
9236
+ // width: selectedPort?.size.width,
9237
+ // height: selectedPort?.size.height,
8002
9238
  movingOffsetThreshold: PORT_MOVING_OFFSET_THRESHOLD,
8003
9239
  onMove: handlePortMove
8004
9240
  });
8005
- return (React.createElement(ElementWrapper, { ref: elementRef, x: x, y: y, onClick: function (e) { return onClick ? onClick(id, e, elementRef.current) : true; }, onMouseMove: handleElementMouseMove, onMouseLeave: handleElementMouseLeave, onMouseUp: handleElementMouseUp },
9241
+ return (React$1.createElement(ElementWrapper, { ref: elementRef, x: x, y: y, onClick: function (e) { return onClick ? onClick(id, e, elementRef.current) : true; }, onMouseMove: handleElementMouseMove, onMouseLeave: handleElementMouseLeave, onMouseUp: handleElementMouseUp },
8006
9242
  renderedShape,
8007
9243
  potentialPortPosition && (portPlaceholderShape
8008
- ? React.createElement("svg", { x: potentialPortPosition.x, y: potentialPortPosition.y }, portPlaceholderShape)
8009
- : React.createElement("rect", { x: potentialPortPosition.x - PORT_PLACEHOLDER_DEFAULT_STROKE_WIDTH / 2, y: potentialPortPosition.y - PORT_PLACEHOLDER_DEFAULT_STROKE_WIDTH / 2, width: PORT_PLACEHOLDER_DEFAULT_STROKE_WIDTH, height: PORT_PLACEHOLDER_DEFAULT_STROKE_WIDTH, rx: PORT_PLACEHOLDER_DEFAULT_SIZE, ry: PORT_PLACEHOLDER_DEFAULT_SIZE, stroke: PORT_PLACEHOLDER_DEFAULT_STROKE, fill: "none", strokeWidth: 3 })), ports === null || ports === void 0 ? void 0 :
9244
+ ? React$1.createElement("svg", { x: potentialPortPosition.x, y: potentialPortPosition.y }, portPlaceholderShape)
9245
+ : React$1.createElement("rect", { x: potentialPortPosition.x - PORT_PLACEHOLDER_DEFAULT_STROKE_WIDTH / 2, y: potentialPortPosition.y - PORT_PLACEHOLDER_DEFAULT_STROKE_WIDTH / 2, width: PORT_PLACEHOLDER_DEFAULT_STROKE_WIDTH, height: PORT_PLACEHOLDER_DEFAULT_STROKE_WIDTH, rx: PORT_PLACEHOLDER_DEFAULT_SIZE, ry: PORT_PLACEHOLDER_DEFAULT_SIZE, stroke: PORT_PLACEHOLDER_DEFAULT_STROKE, fill: "none", strokeWidth: 3 })), ports === null || ports === void 0 ? void 0 :
8010
9246
  ports.map(function (p, index) {
8011
- return React.createElement(Port, { key: p.id, ref: p.ref, id: p.id, x: p.position.x, y: p.position.y, width: p.size.width, height: p.size.height, container: container, rotation: rotatePort(p), label: p.label, onPortLabelMoved: function (x, y) { return handlePortLabelMoved(x, y, p, index); }, onPortLabelResized: function (w, h) { return handlePortLabelResized(w, h, p, index); }, onPortLabelContentChanged: function (ev, newValue) { return handlePortLabelContentChanged(newValue, p, index); }, onSelected: function (portId, event) { return handleSelectedPort(p, event); }, onMouseDown: handlePortMouseDown, onMouseUp: handlePortMouseUp, renderShape: p.renderShape });
8012
- }), texts === null || texts === void 0 ? void 0 :
8013
- texts.map(function (t, index) {
8014
- var _a, _b;
8015
- return React.createElement(Text$1, { id: t.id, key: index, content: t.content, x: (_a = t.position) === null || _a === void 0 ? void 0 : _a.x, y: (_b = t.position) === null || _b === void 0 ? void 0 : _b.y, width: t.size.width, height: t.size.height, align: t.align, fontSize: t.fontSize, border: t.border, container: container, onContentChanged: function (ev, newContent) { return onTextUpdated === null || onTextUpdated === void 0 ? void 0 : onTextUpdated(t.id, newContent); } });
9247
+ return React$1.createElement(Port, { key: p.id, ref: p.ref, id: p.id, x: p.position.x, y: p.position.y, width: p.size.width, height: p.size.height, container: container,
9248
+ // rotation={rotatePort(p)}
9249
+ calculateRotationAngle: rotatePort, label: p.label, onPortLabelMoved: function (x, y) { return handlePortLabelMoved(x, y, p, index); }, onPortLabelResized: function (w, h) { return handlePortLabelResized(w, h, p, index); }, onPortLabelContentChanged: function (ev, newValue) { return handlePortLabelContentChanged(newValue, p, index); }, onSelected: function (portId, event) { return handleSelectedPort(p, event); }, onMouseDown: handlePortMouseDown, onMouseUp: handlePortMouseUp, renderShape: p.renderShape });
8016
9250
  }),
9251
+ React$1.createElement(Flexbox$1, { className: textsPlaceHolderClassName, style: textsPlaceHolderFlexStyle, x: textsPlaceHolderFlexboxPosition === null || textsPlaceHolderFlexboxPosition === void 0 ? void 0 : textsPlaceHolderFlexboxPosition.x, y: textsPlaceHolderFlexboxPosition === null || textsPlaceHolderFlexboxPosition === void 0 ? void 0 : textsPlaceHolderFlexboxPosition.y }, texts === null || texts === void 0 ? void 0 : texts.map(function (t, index) {
9252
+ var _a, _b;
9253
+ return React$1.createElement(Text$1, { id: t.id, key: index, content: t.content, x: (_a = t.position) === null || _a === void 0 ? void 0 : _a.x, y: (_b = t.position) === null || _b === void 0 ? void 0 : _b.y, width: t.size.width, height: t.size.height, align: t.align, fontSize: t.fontSize, border: t.border, container: container, style: t.style, onContentChanged: function (ev, newContent) { return onTextUpdated === null || onTextUpdated === void 0 ? void 0 : onTextUpdated(t.id, newContent); } });
9254
+ })),
8017
9255
  children));
8018
9256
  };
8019
9257
 
@@ -8033,9 +9271,9 @@ var createRect = function (x, y, width, height, strokeWidth, transformOrigin, tr
8033
9271
  };
8034
9272
  function BBoxDebugger(_a) {
8035
9273
  var elementSVG = _a.elementSVG;
8036
- var _b = React.useState(false), isTurnOn = _b[0], setIsTurnOn = _b[1];
8037
- var displayedBBoxDebug = React.useRef([]);
8038
- React.useEffect(function () {
9274
+ var _b = React$1.useState(false), isTurnOn = _b[0], setIsTurnOn = _b[1];
9275
+ var displayedBBoxDebug = React$1.useRef([]);
9276
+ React$1.useEffect(function () {
8039
9277
  var keyPress = function (ev) {
8040
9278
  if (ev.ctrlKey && ev.key === 'b') {
8041
9279
  setIsTurnOn(function (prev) { return !prev; });
@@ -8115,7 +9353,7 @@ function BBoxDebugger(_a) {
8115
9353
  }, 1000);
8116
9354
  return intervalId;
8117
9355
  };
8118
- React.useEffect(function () {
9356
+ React$1.useEffect(function () {
8119
9357
  if (!isTurnOn || !elementSVG)
8120
9358
  return;
8121
9359
  var listChildrenGroupByLevel = getListChildrenAndGroupSameLevel(elementSVG);
@@ -8127,12 +9365,12 @@ function BBoxDebugger(_a) {
8127
9365
  clearBBoxDebugger(displayedBBoxDebug.current);
8128
9366
  };
8129
9367
  }, [isTurnOn, elementSVG]);
8130
- return (React.createElement("div", { style: {
9368
+ return (React$1.createElement("div", { style: {
8131
9369
  position: 'fixed',
8132
9370
  top: 20,
8133
9371
  right: 20
8134
9372
  } },
8135
- React.createElement("div", { style: {
9373
+ React$1.createElement("div", { style: {
8136
9374
  backgroundColor: 'white',
8137
9375
  boxShadow: '0px 1px 4px 1px',
8138
9376
  borderRadius: 4,
@@ -8156,9 +9394,9 @@ var createDebuggerPoint = function (cx, cy) {
8156
9394
  };
8157
9395
  var LinkDebugger = function (_a) {
8158
9396
  var links = _a.links, svgContainer = _a.svgContainer;
8159
- var _b = React.useState(false), isTurnOn = _b[0], setIsTurnOn = _b[1];
8160
- var displayedDebuggerPoint = React.useRef([]);
8161
- React.useEffect(function () {
9397
+ var _b = React$1.useState(false), isTurnOn = _b[0], setIsTurnOn = _b[1];
9398
+ var displayedDebuggerPoint = React$1.useRef([]);
9399
+ React$1.useEffect(function () {
8162
9400
  var keyPress = function (ev) {
8163
9401
  if (ev.ctrlKey && ev.key === 'l') {
8164
9402
  setIsTurnOn(function (prev) { return !prev; });
@@ -8175,7 +9413,7 @@ var LinkDebugger = function (_a) {
8175
9413
  ele === null || ele === void 0 ? void 0 : ele.remove();
8176
9414
  }
8177
9415
  };
8178
- React.useEffect(function () {
9416
+ React$1.useEffect(function () {
8179
9417
  if (isTurnOn) {
8180
9418
  links.forEach(function (link) {
8181
9419
  var _a;
@@ -8190,13 +9428,13 @@ var LinkDebugger = function (_a) {
8190
9428
  clearDebuggerPoint();
8191
9429
  };
8192
9430
  }, [isTurnOn, links]);
8193
- return (React.createElement("div", null));
9431
+ return (React$1.createElement("div", null));
8194
9432
  };
8195
9433
 
8196
9434
  function useKeyboardCommands(_a) {
8197
9435
  var element = _a.element;
8198
- var _b = React.useContext(paperEventEmitterContext), emitCommandDeleteSelectedElement = _b.emitCommandDeleteSelectedElement, emitCommandDeleteSelectedLink = _b.emitCommandDeleteSelectedLink, emitCommandDeleteSelectedPort = _b.emitCommandDeleteSelectedPort, emitCommandDeleteSelectedText = _b.emitCommandDeleteSelectedText;
8199
- React.useEffect(function () {
9436
+ var _b = React$1.useContext(paperEventEmitterContext), emitCommandDeleteSelectedElement = _b.emitCommandDeleteSelectedElement, emitCommandDeleteSelectedLink = _b.emitCommandDeleteSelectedLink, emitCommandDeleteSelectedPort = _b.emitCommandDeleteSelectedPort, emitCommandDeleteSelectedText = _b.emitCommandDeleteSelectedText;
9437
+ React$1.useEffect(function () {
8200
9438
  var callback = function (ev) {
8201
9439
  var keyboardEv = ev;
8202
9440
  if (keyboardEv.key === "Delete") {
@@ -8246,18 +9484,18 @@ function convertElementsToTree(elements) {
8246
9484
  }
8247
9485
  var Paper = function (props) {
8248
9486
  var _a;
8249
- var _b = React.useState(props.elements), elements = _b[0], setElements = _b[1];
8250
- var _c = React.useState([]), elementsInTree = _c[0], setElementsInTree = _c[1];
8251
- var _d = React.useState(), selectedElement = _d[0], setSelectedElement = _d[1];
8252
- var _e = React.useState((_a = props.links) !== null && _a !== void 0 ? _a : []), links = _e[0], setLinks = _e[1];
8253
- var _f = React.useState(), selectedLink = _f[0], setSelectedLink = _f[1];
8254
- var _g = React.useState(), tempLink = _g[0], setTempLink = _g[1];
8255
- var _h = React.useState(props.texts), texts = _h[0], setTexts = _h[1];
8256
- var _j = React.useState(), selectedText = _j[0], setSelectedText = _j[1];
8257
- var _k = React.useState(null), selectedElementSVG = _k[0], setSelectedElementSVG = _k[1];
8258
- var _l = React.useState(false), mouseDownedOnPaper = _l[0], setMouseDownedOnPaper = _l[1];
8259
- var paperEventEmitter = React.useContext(paperEventEmitterContext);
8260
- var paperContainerRef = React.useRef(null);
9487
+ var _b = React$1.useState(props.elements), elements = _b[0], setElements = _b[1];
9488
+ var _c = React$1.useState([]), elementsInTree = _c[0], setElementsInTree = _c[1];
9489
+ var _d = React$1.useState(), selectedElement = _d[0], setSelectedElement = _d[1];
9490
+ var _e = React$1.useState((_a = props.links) !== null && _a !== void 0 ? _a : []), links = _e[0], setLinks = _e[1];
9491
+ var _f = React$1.useState(), selectedLink = _f[0], setSelectedLink = _f[1];
9492
+ var _g = React$1.useState(), tempLink = _g[0], setTempLink = _g[1];
9493
+ var _h = React$1.useState(props.texts), texts = _h[0], setTexts = _h[1];
9494
+ var _j = React$1.useState(), selectedText = _j[0], setSelectedText = _j[1];
9495
+ var _k = React$1.useState(null), selectedElementSVG = _k[0], setSelectedElementSVG = _k[1];
9496
+ var _l = React$1.useState(false), mouseDownedOnPaper = _l[0], setMouseDownedOnPaper = _l[1];
9497
+ var paperEventEmitter = React$1.useContext(paperEventEmitterContext);
9498
+ var paperContainerRef = React$1.useRef(null);
8261
9499
  useKeyboardCommands({
8262
9500
  element: paperContainerRef.current
8263
9501
  });
@@ -8265,7 +9503,7 @@ var Paper = function (props) {
8265
9503
  var parsedElementsInTree = convertElementsToTree(elements);
8266
9504
  setElementsInTree(parsedElementsInTree);
8267
9505
  };
8268
- React.useEffect(function () {
9506
+ React$1.useEffect(function () {
8269
9507
  //Listen parent of elements changed, then update elements tree
8270
9508
  var parentChangedCancelers = elements.map(function (element) {
8271
9509
  var _a;
@@ -8292,7 +9530,7 @@ var Paper = function (props) {
8292
9530
  };
8293
9531
  }, elements);
8294
9532
  //Update elements tree when length of elements change
8295
- React.useEffect(function () {
9533
+ React$1.useEffect(function () {
8296
9534
  updateElementsTree();
8297
9535
  }, [elements.length]);
8298
9536
  //Get all child elements of the deleted element
@@ -8306,7 +9544,7 @@ var Paper = function (props) {
8306
9544
  return __spreadArray(__spreadArray([], childElms, true), childOfChildElements, true);
8307
9545
  };
8308
9546
  //Listen command delete selected for element
8309
- React.useEffect(function () {
9547
+ React$1.useEffect(function () {
8310
9548
  var listener = paperEventEmitter.onCommandDeleteSelectedElement(function () {
8311
9549
  if (selectedElement) {
8312
9550
  var deletedChildElements = getDeletedChildElements(selectedElement);
@@ -8321,7 +9559,7 @@ var Paper = function (props) {
8321
9559
  };
8322
9560
  }, [selectedElement]);
8323
9561
  //Listen command delete selected for link
8324
- React.useEffect(function () {
9562
+ React$1.useEffect(function () {
8325
9563
  var listener = paperEventEmitter.onCommandDeleteSelectedLink(function () {
8326
9564
  if (selectedLink) {
8327
9565
  setLinks(function (prev) { return prev.filter(function (l) { return l.id !== selectedLink.id; }); });
@@ -8333,7 +9571,7 @@ var Paper = function (props) {
8333
9571
  };
8334
9572
  }, [selectedLink]);
8335
9573
  //Listen command delete selected for Text
8336
- React.useEffect(function () {
9574
+ React$1.useEffect(function () {
8337
9575
  var listener = paperEventEmitter.onCommandDeleteSelectedText(function () {
8338
9576
  if (selectedText) {
8339
9577
  setTexts(function (prev) { return prev.filter(function (t) { return t.id !== selectedText.id; }); });
@@ -8419,7 +9657,7 @@ var Paper = function (props) {
8419
9657
  }
8420
9658
  setMouseDownedOnPaper(false);
8421
9659
  };
8422
- var handlePathChange = React.useCallback(function (path, id) {
9660
+ var handlePathChange = React$1.useCallback(function (path, id) {
8423
9661
  //Update path of element link, that changed
8424
9662
  setLinks(function (prevLinks) {
8425
9663
  var updatedLinkIndex = prevLinks.findIndex(function (l) { return l.id === id; });
@@ -8506,7 +9744,7 @@ var Paper = function (props) {
8506
9744
  setTempLink(undefined);
8507
9745
  }
8508
9746
  };
8509
- var handleLinkLabelMoved = React.useCallback(function (offsetX, offsetY, index, labelType) {
9747
+ var handleLinkLabelMoved = React$1.useCallback(function (offsetX, offsetY, index, labelType) {
8510
9748
  setLinks(function (prevLinks) {
8511
9749
  var newLinks = __spreadArray([], prevLinks, true);
8512
9750
  var currentLink = newLinks[index];
@@ -8542,7 +9780,7 @@ var Paper = function (props) {
8542
9780
  return newLinks;
8543
9781
  });
8544
9782
  }, []);
8545
- var handleLinkLabelResized = React.useCallback(function (width, height, index, labelType) {
9783
+ var handleLinkLabelResized = React$1.useCallback(function (width, height, index, labelType) {
8546
9784
  setLinks(function (prevLinks) {
8547
9785
  var newLinks = __spreadArray([], prevLinks, true);
8548
9786
  var currentLink = newLinks[index];
@@ -8575,7 +9813,7 @@ var Paper = function (props) {
8575
9813
  return newLinks;
8576
9814
  });
8577
9815
  }, []);
8578
- var handleLinkLabelContentChanged = React.useCallback(function (newValue, index, labelType) {
9816
+ var handleLinkLabelContentChanged = React$1.useCallback(function (newValue, index, labelType) {
8579
9817
  setLinks(function (prevLinks) {
8580
9818
  var newLinks = __spreadArray([], prevLinks, true);
8581
9819
  var currentLink = newLinks[index];
@@ -8659,7 +9897,7 @@ var Paper = function (props) {
8659
9897
  Cache to avoid re-initializing the function when the component re-renders to
8660
9898
  avoid causing the components using it to re-render unnecessarily
8661
9899
  */
8662
- var onLabelMoved = React.useCallback(function (index) {
9900
+ var onLabelMoved = React$1.useCallback(function (index) {
8663
9901
  return function (offsetX, offsetY, labelType) {
8664
9902
  handleLinkLabelMoved(offsetX, offsetY, index, labelType);
8665
9903
  };
@@ -8668,7 +9906,7 @@ var Paper = function (props) {
8668
9906
  Cache to avoid re-initializing the function when the component re-renders to
8669
9907
  avoid causing the components using it to re-render unnecessarily
8670
9908
  */
8671
- var onLabelResized = React.useCallback(function (index) {
9909
+ var onLabelResized = React$1.useCallback(function (index) {
8672
9910
  return function (width, height, labelType) {
8673
9911
  handleLinkLabelResized(width, height, index, labelType);
8674
9912
  };
@@ -8677,12 +9915,12 @@ var Paper = function (props) {
8677
9915
  Cache to avoid re-initializing the function when the component re-renders to
8678
9916
  avoid causing the components using it to re-render unnecessarily
8679
9917
  */
8680
- var onLabelContentChanged = React.useCallback(function (index) {
9918
+ var onLabelContentChanged = React$1.useCallback(function (index) {
8681
9919
  return function (newValue, labelType) {
8682
9920
  handleLinkLabelContentChanged(newValue, index, labelType);
8683
9921
  };
8684
9922
  }, [handleLinkLabelContentChanged]);
8685
- var handleClickLinkDelete = React.useCallback(function (link, index) {
9923
+ var handleClickLinkDelete = React$1.useCallback(function (link, index) {
8686
9924
  return function () {
8687
9925
  setLinks(function (prevLinks) {
8688
9926
  var newLinks = __spreadArray([], prevLinks, true);
@@ -8733,24 +9971,24 @@ var Paper = function (props) {
8733
9971
  var _a, _b;
8734
9972
  //use the defined react element or the default Element component
8735
9973
  var ReactElement = element.reactElement || Element;
8736
- return (React.createElement("g", { key: element.id }, React.createElement(ReactElement, { key: "element-".concat(element.id), id: element.id, height: element.size.height, width: element.size.width, x: (_a = element.relativePosition) === null || _a === void 0 ? void 0 : _a.x, y: (_b = element.relativePosition) === null || _b === void 0 ? void 0 : _b.y, onClick: function (id, e, ref) {
9974
+ return (React$1.createElement("g", { key: element.id }, React$1.createElement(ReactElement, { key: "element-".concat(element.id), id: element.id, height: element.size.height, width: element.size.width, x: (_a = element.relativePosition) === null || _a === void 0 ? void 0 : _a.x, y: (_b = element.relativePosition) === null || _b === void 0 ? void 0 : _b.y, onClick: function (id, e, ref) {
8737
9975
  e.stopPropagation();
8738
9976
  setSelectedElementSVG(ref);
8739
9977
  setSelectedElement(element);
8740
9978
  setMouseDownedOnPaper(false);
8741
9979
  }, container: paperContainerRef.current, renderShape: element.renderShape, cssClass: element.cssClass, texts: element.texts, ports: element.ports, portMoveableAreas: element.portMoveableAreas, portSlideRailSVGClassName: element.portSlideRailSVGClassName, portDirection: element.portDirection, onPortMoved: handlePortMoved, onPortMouseDown: handlePortMouseDown, onPortMouseUp: handlePortMouseUp,
8742
9980
  // portPlaceholderShape={(<Circle x={0} y={0} width={10} height={10} fill='red' positioningAnchor={PositioningAnchor.Center} />)}
8743
- onMouseUpAtLinkedPortPlaceholder: function (elementLink, position) { return handleMouseUpAtLinkedPortPlaceholder(elementLink, position, element); }, onTextUpdated: function (textId, newContent) { return handleElementTextChange(element, textId, newContent); } }, element.childrenElements && element.childrenElements.map(renderElementInTree))));
9981
+ onMouseUpAtLinkedPortPlaceholder: function (elementLink, position) { return handleMouseUpAtLinkedPortPlaceholder(elementLink, position, element); }, onTextUpdated: function (textId, newContent) { return handleElementTextChange(element, textId, newContent); }, textsPlaceHolderClassName: element.textsPlaceHolderClassName, textsPlaceHolderFlexStyle: element.textsPlaceHolderFlexStyle, textsPlaceHolderFlexboxPosition: element.textsPlaceHolderFlexboxPosition }, element.childrenElements && element.childrenElements.map(renderElementInTree))));
8744
9982
  };
8745
- return (React.createElement("div", { style: { position: "relative" } },
8746
- React.createElement(Ruler, { squareSize: 100, border: '1px dashed grey' }),
8747
- React.createElement("svg", { tabIndex: 0, width: size.width, height: size.height, ref: paperContainerRef, id: "paper-container", onMouseMove: handlePaperMouseMove, onMouseDown: handleMouseDownOnPaper, onMouseUp: handleMouseUpOnPaper },
9983
+ return (React$1.createElement("div", { style: { position: "relative" } },
9984
+ React$1.createElement(Ruler, { squareSize: 100, border: '1px dashed grey' }),
9985
+ React$1.createElement("svg", { tabIndex: 0, width: size.width, height: size.height, ref: paperContainerRef, id: "paper-container", onMouseMove: handlePaperMouseMove, onMouseDown: handleMouseDownOnPaper, onMouseUp: handleMouseUpOnPaper },
8748
9986
  paperContainerRef.current ? elementsInTree.map(function (element, index) {
8749
9987
  return renderElementInTree(element);
8750
9988
  }) : "",
8751
9989
  links && links.map(function (link, index) {
8752
9990
  var _a, _b, _c, _d;
8753
- return (React.createElement(ElementLink, { key: link.id, id: link.id, path: link.path, sourcePosition: {
9991
+ return (React$1.createElement(ElementLink, { key: link.id, id: link.id, path: link.path, sourcePosition: {
8754
9992
  x: link.sourceElement.position.x + link.sourcePort.position.x,
8755
9993
  y: link.sourceElement.position.y + link.sourcePort.position.y
8756
9994
  }, targetPosition: {
@@ -8758,26 +9996,26 @@ var Paper = function (props) {
8758
9996
  y: ((_c = link.targetElement) === null || _c === void 0 ? void 0 : _c.position.y) + ((_d = link.targetPort) === null || _d === void 0 ? void 0 : _d.position.y)
8759
9997
  }, points: link.points, onPathChanged: handlePathChange, onClickDelete: handleClickLinkDelete(link, index), onSelected: function () { return handleSelectLink(link); }, onDeselected: function () { return handleDeselectLink(); }, container: paperContainerRef.current, markerStart: link.markerStart, markerEnd: link.markerEnd, markerDistanceFromPort: link.markerDistanceFromPort, markerSize: link.markerSize, label: link.label, sourceLabel: link.sourceLabel, targetLabel: link.targetLabel, onLabelMoved: onLabelMoved(index), onLabelResized: onLabelResized(index), onLabelContentChanged: onLabelContentChanged(index) }));
8760
9998
  }),
8761
- (tempLink === null || tempLink === void 0 ? void 0 : tempLink.tempTargetPosition) && React.createElement(ElementLink, { id: tempLink.id, points: tempLink.points, sourcePosition: {
9999
+ (tempLink === null || tempLink === void 0 ? void 0 : tempLink.tempTargetPosition) && React$1.createElement(ElementLink, { id: tempLink.id, points: tempLink.points, sourcePosition: {
8762
10000
  x: tempLink.sourceElement.position.x + tempLink.sourcePort.position.x,
8763
10001
  y: tempLink.sourceElement.position.y + tempLink.sourcePort.position.y
8764
10002
  }, targetPosition: tempLink.tempTargetPosition, container: paperContainerRef.current, markerStart: tempLink.markerStart, markerEnd: tempLink.markerEnd, markerDistanceFromPort: tempLink.markerDistanceFromPort, markerSize: tempLink.markerSize }),
8765
- texts.map(function (text, index) { return (React.createElement(Text$1, { key: text.id, id: text.id, x: text.position.x, y: text.position.y, width: text.size.width, height: text.size.height, fontSize: text.fontSize, border: text.border, container: paperContainerRef.current, content: text.content, align: text.align, onSelected: function () {
10003
+ texts.map(function (text, index) { return (React$1.createElement(Text$1, { key: text.id, id: text.id, x: text.position.x, y: text.position.y, width: text.size.width, height: text.size.height, fontSize: text.fontSize, border: text.border, container: paperContainerRef.current, content: text.content, align: text.align, onSelected: function () {
8766
10004
  setSelectedText(text);
8767
10005
  } })); })),
8768
- React.createElement(BBoxDebugger, { elementSVG: selectedElementSVG }),
8769
- React.createElement(LinkDebugger, { links: links, svgContainer: paperContainerRef.current })));
10006
+ React$1.createElement(BBoxDebugger, { elementSVG: selectedElementSVG }),
10007
+ React$1.createElement(LinkDebugger, { links: links, svgContainer: paperContainerRef.current })));
8770
10008
  };
8771
10009
 
8772
10010
  function Editor(_a) {
8773
10011
  var editorContext = _a.editorContext;
8774
- return (React.createElement(React.Fragment, null,
8775
- React.createElement(Paper, { size: { width: 3000, height: 3000 }, elements: editorContext.elements, links: editorContext.links, texts: editorContext.texts, onPaperClicked: editorContext.onPaperClicked, onPortMoved: editorContext.onPortMoved, onElementMoved: editorContext.onElementMoved, onElementResized: editorContext.onElementResized, onLinkValidation: editorContext.validateLink, onCreatingLink: editorContext.onCreatingLink, onCreatingPortByLinking: editorContext.onCreatingPortByLinking })));
10012
+ return (React$1.createElement(React$1.Fragment, null,
10013
+ React$1.createElement(Paper, { size: { width: 3000, height: 3000 }, elements: editorContext.elements, links: editorContext.links, texts: editorContext.texts, onPaperClicked: editorContext.onPaperClicked, onPortMoved: editorContext.onPortMoved, onElementMoved: editorContext.onElementMoved, onElementResized: editorContext.onElementResized, onLinkValidation: editorContext.validateLink, onCreatingLink: editorContext.onCreatingLink, onCreatingPortByLinking: editorContext.onCreatingPortByLinking })));
8776
10014
  }
8777
10015
 
8778
10016
  exports.CircleRC = Circle;
8779
10017
  exports.CrescentRC = Crescent;
8780
- exports.CustomPort = CustomPort;
10018
+ exports.CustomPortFromJSXElement = CustomPortFromJSXElement;
8781
10019
  exports.CustomShapeRC = CustomShape;
8782
10020
  exports.EditorContext = EditorContext;
8783
10021
  exports.Element = Element$1;