@ngroznykh/papirus 0.8.2 → 0.8.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,WAAW,QAAc,CAAC;AAGvC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAM/C,CAAC;AAGF,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAG9C,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAGtC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAGtC,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAG5C,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,kGAAkG;AAClG,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAGhD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAG7C,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,sHAAsH;AACtH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAG5C,2FAA2F;AAC3F,eAAO,MAAM,sCAAsC,IAAI,CAAC;AACxD,sFAAsF;AACtF,eAAO,MAAM,iCAAiC,KAAK,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,WAAW,QAAc,CAAC;AAGvC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO/C,CAAC;AAGF,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAG9C,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAGtC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAGtC,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAG5C,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,kGAAkG;AAClG,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAGhD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAG7C,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,sHAAsH;AACtH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAG5C,2FAA2F;AAC3F,eAAO,MAAM,sCAAsC,IAAI,CAAC;AACxD,sFAAsF;AACtF,eAAO,MAAM,iCAAiC,KAAK,CAAC"}
@@ -21,18 +21,14 @@ export declare class EdgeEndpointUpdater {
21
21
  private resolveEdgeEndpoint;
22
22
  private lockAnchors;
23
23
  /**
24
- * When nodes are clearly stacked, retarget unset / OEF-lateral ports toward
25
- * facing sides. Intentional same-side wraps (bottom→bottom, top→top, left→left)
26
- * are kept — orthogonal routing clears them around the stack.
24
+ * When nodes are clearly stacked/side-by-side, assign facing sides only to
25
+ * unset endpoints. Intentional ports (including lateral reconnect with
26
+ * attachToOutline off) and outlineParams are kept — orthogonal routing clears
27
+ * same-side wraps around the stack.
27
28
  *
28
29
  * Uses bounding-box gaps (not center dx/dy): a large horizontal offset must not
29
30
  * flip bottom→left while the source is still below the target — that reintroduces
30
31
  * the left-edge contour jog when the user drags the node leftward.
31
- *
32
- * - Works for portId and outlineParam (OEF / attach-to-outline).
33
- * - Does NOT move an endpoint that is already on a chosen side — otherwise
34
- * dragging a locked/outline anchor snaps back on every updateAll.
35
- * - Keeps intentional source left/right exits for nest wrap around a parent.
36
32
  */
37
33
  private preferFacingSidePorts;
38
34
  private portSide;
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeEndpointUpdater.d.ts","sourceRoot":"","sources":["../../src/core/EdgeEndpointUpdater.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOrD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,IAAI,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,QAAQ,IAAI,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,gBAAgB,IAAI,YAAY,EAAE,CAAC;CACpC;AAOD,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,uBAAuB;IAE1D,aAAa,IAAI,IAAI;IAMrB,SAAS,IAAI,IAAI;IAIjB,OAAO,CAAC,MAAM;IA+Bd,OAAO,CAAC,kBAAkB;IA2D1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA8C9B,OAAO,CAAC,cAAc;IAWtB,OA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OAKG;IACH,OAAO,CAAC,mBAAmB;IA6B3B,OAAO,CAAC,uBAAuB;CAOhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeMarkerRenderer.d.ts","sourceRoot":"","sources":["../../../src/elements/edge/EdgeMarkerRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAQjF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,KAAK,EAAE,CAAC;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAevE;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,wBAAwB,EAC7B,OAAO,EAAE,uBAAuB,GAC/B,IAAI,CA4BN"}
1
+ {"version":3,"file":"EdgeMarkerRenderer.d.ts","sourceRoot":"","sources":["../../../src/elements/edge/EdgeMarkerRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AASjF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,KAAK,EAAE,CAAC;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAgBvE;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,wBAAwB,EAC7B,OAAO,EAAE,uBAAuB,GAC/B,IAAI,CA4BN"}
package/dist/papirus.js CHANGED
@@ -597,6 +597,7 @@ var ARROW_ANGLE = Math.PI / 6;
597
597
  var MARKER_SIZES = {
598
598
  arrow: 12,
599
599
  open: 12,
600
+ stealth: 12,
600
601
  diamond: 14,
601
602
  circle: 6,
602
603
  square: 6
@@ -5787,6 +5788,26 @@ function calculateArrowMarkerPoints(to, angle, size) {
5787
5788
  }
5788
5789
  };
5789
5790
  }
5791
+ /** Heel inset along the edge (fraction of arrow shaft length). Closer to tip = deeper notch. */
5792
+ var STEALTH_HEEL_DEPTH = .82;
5793
+ /**
5794
+ * Stealth (barbed) marker: tip + outer barbs + centerline heel (classic Graphviz stealth).
5795
+ */
5796
+ function calculateStealthMarkerPoints(to, angle, size) {
5797
+ const { left: leftOuter, right: rightOuter } = calculateArrowMarkerPoints(to, angle, size);
5798
+ const cos = Math.cos(angle);
5799
+ const sin = Math.sin(angle);
5800
+ const heelDepth = size * Math.cos(ARROW_ANGLE) * STEALTH_HEEL_DEPTH;
5801
+ return {
5802
+ tip: to,
5803
+ leftOuter,
5804
+ heel: {
5805
+ x: to.x - heelDepth * cos,
5806
+ y: to.y - heelDepth * sin
5807
+ },
5808
+ rightOuter
5809
+ };
5810
+ }
5790
5811
  /**
5791
5812
  * Calculate diamond marker vertex points
5792
5813
  */
@@ -5830,6 +5851,10 @@ function generateSvgArrowMarker(to, angle, size, fill, fillOpacity, stroke) {
5830
5851
  const { left, right } = calculateArrowMarkerPoints(to, angle, size);
5831
5852
  return `<path d="M ${to.x} ${to.y} L ${left.x} ${left.y} L ${right.x} ${right.y} Z" fill="${fill}" fill-opacity="${fillOpacity}" stroke="${stroke}" stroke-width="1"/>`;
5832
5853
  }
5854
+ function generateSvgStealthMarker(to, angle, size, fill, fillOpacity, stroke) {
5855
+ const { tip, leftOuter, heel, rightOuter } = calculateStealthMarkerPoints(to, angle, size);
5856
+ return `<path d="M ${tip.x} ${tip.y} L ${leftOuter.x} ${leftOuter.y} L ${heel.x} ${heel.y} L ${rightOuter.x} ${rightOuter.y} Z" fill="${fill}" fill-opacity="${fillOpacity}" stroke="${stroke}" stroke-width="1"/>`;
5857
+ }
5833
5858
  /**
5834
5859
  * Generate SVG path for open arrow marker
5835
5860
  */
@@ -5893,6 +5918,7 @@ function generateSvgMarker(marker, from, to, edgeStroke) {
5893
5918
  case "diamond": return generateSvgDiamondMarker(to, angle, size, fill, fillOpacity, stroke);
5894
5919
  case "circle": return generateSvgCircleMarker(to, angle, size, fill, fillOpacity, stroke);
5895
5920
  case "square": return generateSvgSquareMarker(to, angle, size, fill, fillOpacity, stroke);
5921
+ case "stealth": return generateSvgStealthMarker(to, angle, size, fill, fillOpacity, stroke);
5896
5922
  default: return generateSvgArrowMarker(to, angle, size, fill, fillOpacity, stroke);
5897
5923
  }
5898
5924
  }
@@ -5901,7 +5927,8 @@ function generateSvgMarker(marker, from, to, edgeStroke) {
5901
5927
  function getCanvasMarkerLength(config) {
5902
5928
  const size = config.size ?? MARKER_SIZES[config.type] ?? 10;
5903
5929
  switch (config.type) {
5904
- case "arrow": return size * Math.cos(ARROW_ANGLE);
5930
+ case "arrow":
5931
+ case "stealth": return size * Math.cos(ARROW_ANGLE);
5905
5932
  case "open": return 0;
5906
5933
  case "diamond": return size;
5907
5934
  case "circle":
@@ -5944,6 +5971,9 @@ function drawMarker(ctx, from, to, config) {
5944
5971
  case "arrow":
5945
5972
  drawArrowMarker(ctx, to, angle, size, fillColor, fillOpacity);
5946
5973
  break;
5974
+ case "stealth":
5975
+ drawStealthMarker(ctx, to, angle, size, fillColor, fillOpacity);
5976
+ break;
5947
5977
  case "open":
5948
5978
  drawOpenArrowMarker(ctx, to, angle, size);
5949
5979
  break;
@@ -5968,6 +5998,16 @@ function drawArrowMarker(ctx, to, angle, size, fillColor, fillOpacity) {
5968
5998
  ctx.closePath();
5969
5999
  fillAndStroke(ctx, fillColor, fillOpacity);
5970
6000
  }
6001
+ function drawStealthMarker(ctx, to, angle, size, fillColor, fillOpacity) {
6002
+ const { tip, leftOuter, heel, rightOuter } = calculateStealthMarkerPoints(to, angle, size);
6003
+ ctx.beginPath();
6004
+ ctx.moveTo(tip.x, tip.y);
6005
+ ctx.lineTo(leftOuter.x, leftOuter.y);
6006
+ ctx.lineTo(heel.x, heel.y);
6007
+ ctx.lineTo(rightOuter.x, rightOuter.y);
6008
+ ctx.closePath();
6009
+ fillAndStroke(ctx, fillColor, fillOpacity);
6010
+ }
5971
6011
  function drawOpenArrowMarker(ctx, to, angle, size) {
5972
6012
  const { left, right } = calculateArrowMarkerPoints(to, angle, size);
5973
6013
  ctx.beginPath();
@@ -8391,18 +8431,14 @@ var EdgeEndpointUpdater = class {
8391
8431
  }
8392
8432
  }
8393
8433
  /**
8394
- * When nodes are clearly stacked, retarget unset / OEF-lateral ports toward
8395
- * facing sides. Intentional same-side wraps (bottom→bottom, top→top, left→left)
8396
- * are kept — orthogonal routing clears them around the stack.
8434
+ * When nodes are clearly stacked/side-by-side, assign facing sides only to
8435
+ * unset endpoints. Intentional ports (including lateral reconnect with
8436
+ * attachToOutline off) and outlineParams are kept — orthogonal routing clears
8437
+ * same-side wraps around the stack.
8397
8438
  *
8398
8439
  * Uses bounding-box gaps (not center dx/dy): a large horizontal offset must not
8399
8440
  * flip bottom→left while the source is still below the target — that reintroduces
8400
8441
  * the left-edge contour jog when the user drags the node leftward.
8401
- *
8402
- * - Works for portId and outlineParam (OEF / attach-to-outline).
8403
- * - Does NOT move an endpoint that is already on a chosen side — otherwise
8404
- * dragging a locked/outline anchor snaps back on every updateAll.
8405
- * - Keeps intentional source left/right exits for nest wrap around a parent.
8406
8442
  */
8407
8443
  preferFacingSidePorts(edge, fromNode, toNode) {
8408
8444
  if (!edge.lockAnchors) return;
@@ -8420,19 +8456,15 @@ var EdgeEndpointUpdater = class {
8420
8456
  if (fromBelow > 0 || fromAbove > 0) {
8421
8457
  const fromSide = fromBelow > 0 ? "top" : "bottom";
8422
8458
  const toSide = fromBelow > 0 ? "bottom" : "top";
8423
- const toOutlineLateral = (curTo === "left" || curTo === "right") && isNodeEdgeEndpoint(edge.to) && edge.to.outlineParam !== void 0;
8424
- const toPortLateral = (curTo === "left" || curTo === "right") && !toOutlineLateral;
8425
8459
  if (!curFrom) this.setEndpointSidePort(edge, "from", fromNode, fromSide, tc);
8426
- if (!curTo || toPortLateral) this.setEndpointSidePort(edge, "to", toNode, toSide, fc);
8460
+ if (!curTo) this.setEndpointSidePort(edge, "to", toNode, toSide, fc);
8427
8461
  return;
8428
8462
  }
8429
8463
  if (fromLeft > 0 || fromRight > 0) {
8430
8464
  const fromSide = fromRight > 0 ? "left" : "right";
8431
8465
  const toSide = fromRight > 0 ? "right" : "left";
8432
- const toOutlineVertical = (curTo === "top" || curTo === "bottom") && isNodeEdgeEndpoint(edge.to) && edge.to.outlineParam !== void 0;
8433
- const toPortVertical = (curTo === "top" || curTo === "bottom") && !toOutlineVertical;
8434
8466
  if (!curFrom) this.setEndpointSidePort(edge, "from", fromNode, fromSide, tc);
8435
- if (!curTo || toPortVertical) this.setEndpointSidePort(edge, "to", toNode, toSide, fc);
8467
+ if (!curTo) this.setEndpointSidePort(edge, "to", toNode, toSide, fc);
8436
8468
  }
8437
8469
  }
8438
8470
  portSide(portId) {