@kubex/zinc 1.1.24 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +402 -402
- package/dist/vscode.html-custom-data.json +45 -45
- package/dist/web-types.json +110 -110
- package/dist/zn.min.js +214 -214
- package/package.json +1 -1
- package/src/components/flow-builder/modules/flow-canvas/flow-canvas.component.ts +38 -14
- package/src/components/flow-builder/modules/flow-node/flow-node.scss +1 -1
package/package.json
CHANGED
|
@@ -513,7 +513,8 @@ export default class ZnFlowCanvas extends ZincElement {
|
|
|
513
513
|
child: FlowNodeInstance,
|
|
514
514
|
targetPort: string,
|
|
515
515
|
midOffset = 0,
|
|
516
|
-
sourceId?: string
|
|
516
|
+
sourceId?: string,
|
|
517
|
+
loop = false
|
|
517
518
|
) {
|
|
518
519
|
const {x: tx, y: ty} = this._inputAnchor(child, targetPort);
|
|
519
520
|
const ignore = new Set(sourceId ? [child.id, sourceId] : [child.id]);
|
|
@@ -551,12 +552,16 @@ export default class ZnFlowCanvas extends ZincElement {
|
|
|
551
552
|
|
|
552
553
|
// No simple route is clear (e.g. a card sits right under the exit) —
|
|
553
554
|
// side-step: drop to m1, jog sideways to sx, descend, and approach the
|
|
554
|
-
// input from above.
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
555
|
+
// input from above. The drop and the final approach share one run-in
|
|
556
|
+
// depth (equal lengths by construction); scan that depth and the jog.
|
|
557
|
+
const half = Math.floor(span / 2 / 10) * 10;
|
|
558
|
+
const baseDepth = Math.max(10, Math.round(span / 4 / 10) * 10);
|
|
559
|
+
for (let dStep = 0; dStep <= 12; dStep++) {
|
|
560
|
+
for (const depth of dStep === 0 ? [baseDepth] : [baseDepth + dStep * 10, baseDepth - dStep * 10]) {
|
|
561
|
+
if (depth < 10 || depth > half) continue;
|
|
562
|
+
const m1 = from.y + depth;
|
|
563
|
+
const m2 = ty - depth;
|
|
564
|
+
if (m2 < m1) continue;
|
|
560
565
|
for (let sStep = 1; sStep <= 14; sStep++) {
|
|
561
566
|
for (const dir of [1, -1]) {
|
|
562
567
|
const sx = from.x + dir * sStep * GRID_SIZE;
|
|
@@ -576,13 +581,30 @@ export default class ZnFlowCanvas extends ZincElement {
|
|
|
576
581
|
return fallback!;
|
|
577
582
|
}
|
|
578
583
|
|
|
579
|
-
// Child is beside/above: stub down, clear the card
|
|
580
|
-
//
|
|
581
|
-
//
|
|
584
|
+
// Child is beside/above: stub down, clear the card, rise above the input,
|
|
585
|
+
// then approach it from the top — widening the detour until nothing is
|
|
586
|
+
// crossed.
|
|
582
587
|
const stubY = from.y + WIRE_STUB;
|
|
583
588
|
const overY = ty - WIRE_APPROACH;
|
|
584
|
-
|
|
585
|
-
|
|
589
|
+
let rightSide: boolean;
|
|
590
|
+
let baseDetour: number;
|
|
591
|
+
if (loop) {
|
|
592
|
+
// Loop-backs travel around the OUTSIDE of everything they span
|
|
593
|
+
// vertically, instead of squeezing through corridors inside the flow —
|
|
594
|
+
// on whichever side costs less horizontal travel.
|
|
595
|
+
const spanned = this.nodes.filter(
|
|
596
|
+
n => n.y + NODE_HEIGHT > overY - GRID_SIZE && n.y < stubY + GRID_SIZE
|
|
597
|
+
);
|
|
598
|
+
const rightEdge = Math.max(...spanned.map(n => n.x + NODE_WIDTH)) + WIRE_DETOUR;
|
|
599
|
+
const leftEdge = Math.min(...spanned.map(n => n.x)) - WIRE_DETOUR;
|
|
600
|
+
const costRight = Math.abs(rightEdge - from.x) + Math.abs(rightEdge - tx);
|
|
601
|
+
const costLeft = Math.abs(from.x - leftEdge) + Math.abs(tx - leftEdge);
|
|
602
|
+
rightSide = costRight <= costLeft;
|
|
603
|
+
baseDetour = rightSide ? rightEdge : leftEdge;
|
|
604
|
+
} else {
|
|
605
|
+
rightSide = from.x >= child.x + NODE_WIDTH / 2;
|
|
606
|
+
baseDetour = rightSide ? child.x + NODE_WIDTH + WIRE_DETOUR : child.x - WIRE_DETOUR;
|
|
607
|
+
}
|
|
586
608
|
let fallback: { x: number; y: number }[] | null = null;
|
|
587
609
|
for (let step = 0; step <= 20; step++) {
|
|
588
610
|
const dx = baseDetour + (rightSide ? 1 : -1) * step * GRID_SIZE;
|
|
@@ -619,6 +641,7 @@ export default class ZnFlowCanvas extends ZincElement {
|
|
|
619
641
|
private _wirePoints() {
|
|
620
642
|
if (this.movingNodeId) return [];
|
|
621
643
|
const midOffsets = this._elbowMidOffsets();
|
|
644
|
+
const loops = loopConnections(this.nodes, this.connections);
|
|
622
645
|
const points: { connectionId: string; px: number; py: number }[] = [];
|
|
623
646
|
for (const node of this.nodes) {
|
|
624
647
|
const {branches} = this._outputLayout(node);
|
|
@@ -627,7 +650,8 @@ export default class ZnFlowCanvas extends ZincElement {
|
|
|
627
650
|
// Sit the "+" on the route's longest segment so it stays on the wire
|
|
628
651
|
// whatever shape the routing took.
|
|
629
652
|
const offset = midOffsets.get(b.conn.id) ?? 0;
|
|
630
|
-
const pts = this._routePoints(
|
|
653
|
+
const pts = this._routePoints(
|
|
654
|
+
{x: b.x, y: b.exitY}, b.child, b.conn.target.port, offset, node.id, loops.has(b.conn));
|
|
631
655
|
let seg = 0;
|
|
632
656
|
let best = -1;
|
|
633
657
|
for (let i = 0; i < pts.length - 1; i++) {
|
|
@@ -816,8 +840,8 @@ export default class ZnFlowCanvas extends ZincElement {
|
|
|
816
840
|
}
|
|
817
841
|
if (b.conn && b.child) {
|
|
818
842
|
const offset = midOffsets.get(b.conn.id) ?? 0;
|
|
819
|
-
const pts = this._routePoints({x: b.x, y: b.exitY}, b.child, b.conn.target.port, offset, node.id);
|
|
820
843
|
const loop = loops.has(b.conn);
|
|
844
|
+
const pts = this._routePoints({x: b.x, y: b.exitY}, b.child, b.conn.target.port, offset, node.id, loop);
|
|
821
845
|
paths.push(svg`<path
|
|
822
846
|
class="wire ${loop ? 'wire--loop' : ''}"
|
|
823
847
|
d="${ZnFlowCanvas._pathFrom(pts)}"
|