@particle-academy/fancy-flow 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -81,19 +81,19 @@ function we(e, n, t, r) {
81
81
  }
82
82
  function Nn(e, n, t, r) {
83
83
  let o = {}, i, s = 0, a = e.nodes(), d = function(c) {
84
- let h = t(c);
85
- o[c.v].distance + h < o[c.w].distance && (o[c.w] = { distance: o[c.v].distance + h, predecessor: c.v }, i = true);
84
+ let h2 = t(c);
85
+ o[c.v].distance + h2 < o[c.w].distance && (o[c.w] = { distance: o[c.v].distance + h2, predecessor: c.v }, i = true);
86
86
  }, l = function() {
87
87
  a.forEach(function(c) {
88
- r(c).forEach(function(h) {
89
- let f = h.v === c ? h.v : h.w, g = f === h.v ? h.w : h.v;
88
+ r(c).forEach(function(h2) {
89
+ let f = h2.v === c ? h2.v : h2.w, g = f === h2.v ? h2.w : h2.v;
90
90
  d({ v: f, w: g });
91
91
  });
92
92
  });
93
93
  };
94
94
  a.forEach(function(c) {
95
- let h = c === n ? 0 : Number.POSITIVE_INFINITY;
96
- o[c] = { distance: h, predecessor: "" };
95
+ let h2 = c === n ? 0 : Number.POSITIVE_INFINITY;
96
+ o[c] = { distance: h2, predecessor: "" };
97
97
  });
98
98
  let u = a.length;
99
99
  for (let c = 1; c < u && (i = false, s++, l(), !!i); c++) ;
@@ -117,8 +117,8 @@ function F(e, n, t, r) {
117
117
  }
118
118
  function vn(e, n, t, r) {
119
119
  let o = {}, i = new Ne(), s, a, d = function(l) {
120
- let u = l.v !== s ? l.v : l.w, c = o[u], h = t(l), f = a.distance + h;
121
- if (h < 0) throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + l + " Weight: " + h);
120
+ let u = l.v !== s ? l.v : l.w, c = o[u], h2 = t(l), f = a.distance + h2;
121
+ if (h2 < 0) throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + l + " Weight: " + h2);
122
122
  f < c.distance && (c.distance = f, c.predecessor = s, i.decrease(u, f));
123
123
  };
124
124
  for (e.nodes().forEach(function(l) {
@@ -174,8 +174,8 @@ function In(e, n, t) {
174
174
  o.forEach(function(a) {
175
175
  let d = r[a];
176
176
  o.forEach(function(l) {
177
- let u = d[i], c = s[l], h = d[l], f = u.distance + c.distance;
178
- f < h.distance && (h.distance = f, h.predecessor = c.predecessor);
177
+ let u = d[i], c = s[l], h2 = d[l], f = u.distance + c.distance;
178
+ f < h2.distance && (h2.distance = f, h2.predecessor = c.predecessor);
179
179
  });
180
180
  });
181
181
  }), r;
@@ -268,7 +268,7 @@ function Fn(e, n, t, r) {
268
268
  }
269
269
  return F(e, n, t, r);
270
270
  }
271
- function w(e, n, t, r) {
271
+ function w2(e, n, t, r) {
272
272
  let o = r;
273
273
  for (; e.hasNode(o); ) o = j(r);
274
274
  return t.dummy = n, e.setNode(o, t), o;
@@ -324,7 +324,7 @@ function Oe(e) {
324
324
  }
325
325
  function q(e, n, t, r) {
326
326
  let o = { width: 0, height: 0 };
327
- return arguments.length >= 4 && (o.rank = t, o.order = r), w(e, "border", o, n);
327
+ return arguments.length >= 4 && (o.rank = t, o.order = r), w2(e, "border", o, n);
328
328
  }
329
329
  function Dn(e, n = Ie) {
330
330
  let t = [];
@@ -431,8 +431,8 @@ function Yn(e, n) {
431
431
  }), e.edges().forEach((a) => {
432
432
  let d = t.edge(a.v, a.w) || 0, l = n(a), u = d + l;
433
433
  t.setEdge(a.v, a.w, u);
434
- let c = t.node(a.v), h = t.node(a.w);
435
- o = Math.max(o, c.out += l), r = Math.max(r, h.in += l);
434
+ let c = t.node(a.v), h2 = t.node(a.w);
435
+ o = Math.max(o, c.out += l), r = Math.max(r, h2.in += l);
436
436
  });
437
437
  let i = zn(o + r + 3).map(() => new Me()), s = r + 1;
438
438
  return t.nodes().forEach((a) => {
@@ -484,7 +484,7 @@ function Xn(e, n) {
484
484
  if (i === r + 1) return;
485
485
  e.removeEdge(n);
486
486
  let l, u, c;
487
- for (c = 0, ++r; r < i; ++c, ++r) a.points = [], u = { width: 0, height: 0, edgeLabel: a, edgeObj: n, rank: r }, l = w(e, "edge", u, "_d"), r === d && (u.width = a.width, u.height = a.height, u.dummy = "edge-label", u.labelpos = a.labelpos), e.setEdge(t, l, { weight: a.weight }, s), c === 0 && e.graph().dummyChains.push(l), t = l;
487
+ for (c = 0, ++r; r < i; ++c, ++r) a.points = [], u = { width: 0, height: 0, edgeLabel: a, edgeObj: n, rank: r }, l = w2(e, "edge", u, "_d"), r === d && (u.width = a.width, u.height = a.height, u.dummy = "edge-label", u.labelpos = a.labelpos), e.setEdge(t, l, { weight: a.weight }, s), c === 0 && e.graph().dummyChains.push(l), t = l;
488
488
  e.setEdge(t, o, { weight: a.weight }, s);
489
489
  }
490
490
  function De(e) {
@@ -557,10 +557,10 @@ function We(e, n, t) {
557
557
  return d && d.forEach((l) => {
558
558
  let u = l.v === t, c = u ? l.w : l.v;
559
559
  if (c !== o) {
560
- let h = u === i, f = n.edge(l).weight;
561
- if (a += h ? f : -f, rt(e, t, c)) {
560
+ let h2 = u === i, f = n.edge(l).weight;
561
+ if (a += h2 ? f : -f, rt(e, t, c)) {
562
562
  let b = e.edge(t, c).cutvalue;
563
- a += h ? -b : b;
563
+ a += h2 ? -b : b;
564
564
  }
565
565
  }
566
566
  }), a;
@@ -665,7 +665,7 @@ function lt(e) {
665
665
  return e.children(_).forEach(r), n;
666
666
  }
667
667
  function Ke(e) {
668
- let n = w(e, "root", {}, "_root"), t = ut(e), r = Object.values(t), o = L(Math.max, r) - 1, i = 2 * o + 1;
668
+ let n = w2(e, "root", {}, "_root"), t = ut(e), r = Object.values(t), o = L(Math.max, r) - 1, i = 2 * o + 1;
669
669
  e.graph().nestingRoot = n, e.edges().forEach((a) => e.edge(a).minlen *= i);
670
670
  let s = ct(e) + 1;
671
671
  e.children(_).forEach((a) => $e(e, n, i, s, o, t, a)), e.graph().nodeRankFactor = i;
@@ -678,10 +678,10 @@ function $e(e, n, t, r, o, i, s) {
678
678
  return;
679
679
  }
680
680
  let d = q(e, "_bt"), l = q(e, "_bb"), u = e.node(s);
681
- e.setParent(d, s), u.borderTop = d, e.setParent(l, s), u.borderBottom = l, a.forEach((h) => {
681
+ e.setParent(d, s), u.borderTop = d, e.setParent(l, s), u.borderBottom = l, a.forEach((h2) => {
682
682
  var y;
683
- $e(e, n, t, r, o, i, h);
684
- let f = e.node(h), g = f.borderTop ? f.borderTop : h, b = f.borderBottom ? f.borderBottom : h, m = f.borderTop ? r : 2 * r, E = g !== b ? 1 : o - ((y = i[s]) != null ? y : 0) + 1;
683
+ $e(e, n, t, r, o, i, h2);
684
+ let f = e.node(h2), g = f.borderTop ? f.borderTop : h2, b = f.borderBottom ? f.borderBottom : h2, m = f.borderTop ? r : 2 * r, E = g !== b ? 1 : o - ((y = i[s]) != null ? y : 0) + 1;
685
685
  e.setEdge(d, g, { weight: m, minlen: E, nestingEdge: true }), e.setEdge(b, l, { weight: m, minlen: E, nestingEdge: true });
686
686
  }), e.parent(s) || e.setEdge(n, d, { weight: 0, minlen: o + ((c = i[s]) != null ? c : 0) });
687
687
  }
@@ -713,7 +713,7 @@ function ft(e) {
713
713
  e.children(_).forEach(n);
714
714
  }
715
715
  function Qe(e, n, t, r, o, i) {
716
- let s = { width: 0, height: 0, rank: i, borderType: n }, a = o[n][i - 1], d = w(e, "border", s, t);
716
+ let s = { width: 0, height: 0, rank: i, borderType: n }, a = o[n][i - 1], d = w2(e, "border", s, t);
717
717
  o[n][i] = d, e.setParent(d, r), a && e.setEdge(a, d, { weight: 1 });
718
718
  }
719
719
  function nn(e) {
@@ -774,7 +774,7 @@ function oe(e, n) {
774
774
  function mt(e, n, t) {
775
775
  let r = Re(t, t.map((l, u) => u)), o = n.flatMap((l) => {
776
776
  let u = e.outEdges(l);
777
- return u ? u.map((c) => ({ pos: r[c.w], weight: e.edge(c).weight })).sort((c, h) => c.pos - h.pos) : [];
777
+ return u ? u.map((c) => ({ pos: r[c.w], weight: e.edge(c).weight })).sort((c, h2) => c.pos - h2.pos) : [];
778
778
  }), i = 1;
779
779
  for (; i < t.length; ) i <<= 1;
780
780
  let s = 2 * i - 1;
@@ -853,12 +853,12 @@ function yt(e) {
853
853
  }
854
854
  function W(e, n, t, r) {
855
855
  let o = e.children(n), i = e.node(n), s = i ? i.borderLeft : void 0, a = i ? i.borderRight : void 0, d = {};
856
- s && (o = o.filter((h) => h !== s && h !== a));
856
+ s && (o = o.filter((h2) => h2 !== s && h2 !== a));
857
857
  let l = ie(e, o);
858
- l.forEach((h) => {
859
- if (e.children(h.v).length) {
860
- let f = W(e, h.v, t, r);
861
- d[h.v] = f, Object.hasOwn(f, "barycenter") && Nt(h, f);
858
+ l.forEach((h2) => {
859
+ if (e.children(h2.v).length) {
860
+ let f = W(e, h2.v, t, r);
861
+ d[h2.v] = f, Object.hasOwn(f, "barycenter") && Nt(h2, f);
862
862
  }
863
863
  });
864
864
  let u = se(l, t);
@@ -866,9 +866,9 @@ function W(e, n, t, r) {
866
866
  let c = ae(u, r);
867
867
  if (s && a) {
868
868
  c.vs = [s, c.vs, a].flat(1);
869
- let h = e.predecessors(s);
870
- if (h && h.length) {
871
- let f = e.node(h[0]), g = e.predecessors(a), b = e.node(g[0]);
869
+ let h2 = e.predecessors(s);
870
+ if (h2 && h2.length) {
871
+ let f = e.node(h2[0]), g = e.predecessors(a), b = e.node(g[0]);
872
872
  Object.hasOwn(c, "barycenter") || (c.barycenter = 0, c.weight = 0), c.barycenter = (c.barycenter * c.weight + f.order + b.order) / (c.weight + 2), c.weight += 2;
873
873
  }
874
874
  }
@@ -891,7 +891,7 @@ function de(e, n, t, r) {
891
891
  i.setNode(s), i.setParent(s, d || o);
892
892
  let l = e[t](s);
893
893
  l && l.forEach((u) => {
894
- let c = u.v === s ? u.w : u.v, h = i.edge(c, s), f = h !== void 0 ? h.weight : 0;
894
+ let c = u.v === s ? u.w : u.v, h2 = i.edge(c, s), f = h2 !== void 0 ? h2.weight : 0;
895
895
  i.setEdge(c, s, { weight: e.edge(u).weight + f });
896
896
  }), Object.hasOwn(a, "minRank") && i.setNode(s, { borderLeft: a.borderLeft[n], borderRight: a.borderRight[n] });
897
897
  }
@@ -958,8 +958,8 @@ function vt(e, n) {
958
958
  function r(o, i) {
959
959
  let s = 0, a = 0, d = o.length, l = i[i.length - 1];
960
960
  return i.forEach((u, c) => {
961
- let h = xt(e, u), f = h ? e.node(h).order : d;
962
- (h || u === l) && (i.slice(a, c + 1).forEach((g) => {
961
+ let h2 = xt(e, u), f = h2 ? e.node(h2).order : d;
962
+ (h2 || u === l) && (i.slice(a, c + 1).forEach((g) => {
963
963
  let b = e.predecessors(g);
964
964
  b && b.forEach((m) => {
965
965
  let E = e.node(m), y = E.order;
@@ -976,8 +976,8 @@ function _t(e, n) {
976
976
  k(s, a).forEach((u) => {
977
977
  let c = i[u];
978
978
  if (c !== void 0 && e.node(c).dummy) {
979
- let h = e.predecessors(c);
980
- h && h.forEach((f) => {
979
+ let h2 = e.predecessors(c);
980
+ h2 && h2.forEach((f) => {
981
981
  if (f === void 0) return;
982
982
  let g = e.node(f);
983
983
  g.dummy && (g.order < d || g.order > l) && dn(t, f, c);
@@ -989,9 +989,9 @@ function _t(e, n) {
989
989
  let a = -1, d = -1, l = 0;
990
990
  return s.forEach((u, c) => {
991
991
  if (e.node(u).dummy === "border") {
992
- let h = e.predecessors(u);
993
- if (h && h.length) {
994
- let f = h[0];
992
+ let h2 = e.predecessors(u);
993
+ if (h2 && h2.length) {
994
+ let f = h2[0];
995
995
  if (f === void 0) return;
996
996
  d = e.node(f).order, r(s, l, c, a, d), l = c, a = d;
997
997
  }
@@ -1037,8 +1037,8 @@ function Ot(e, n, t, r) {
1037
1037
  let c = u.sort((f, g) => {
1038
1038
  let b = s[f], m = s[g];
1039
1039
  return (b !== void 0 ? b : 0) - (m !== void 0 ? m : 0);
1040
- }), h = (c.length - 1) / 2;
1041
- for (let f = Math.floor(h), g = Math.ceil(h); f <= g; ++f) {
1040
+ }), h2 = (c.length - 1) / 2;
1041
+ for (let f = Math.floor(h2), g = Math.ceil(h2); f <= g; ++f) {
1042
1042
  let b = c[f];
1043
1043
  if (b === void 0) continue;
1044
1044
  let m = s[b];
@@ -1084,10 +1084,10 @@ function It(e, n, t, r, o = false) {
1084
1084
  function c(f) {
1085
1085
  return s.predecessors(f) || [];
1086
1086
  }
1087
- function h(f) {
1087
+ function h2(f) {
1088
1088
  return s.successors(f) || [];
1089
1089
  }
1090
- return d(l, c), d(u, h), Object.keys(r).forEach((f) => {
1090
+ return d(l, c), d(u, h2), Object.keys(r).forEach((f) => {
1091
1091
  var b;
1092
1092
  let g = t[f];
1093
1093
  g !== void 0 && (i[f] = (b = i[g]) != null ? b : 0);
@@ -1103,8 +1103,8 @@ function Ct(e, n, t, r) {
1103
1103
  if (o.setNode(u), d !== void 0) {
1104
1104
  let c = t[d];
1105
1105
  if (c !== void 0) {
1106
- let h = o.edge(c, u);
1107
- o.setEdge(c, u, Math.max(s(e, l, d), h || 0));
1106
+ let h2 = o.edge(c, u);
1107
+ o.setEdge(c, u, Math.max(s(e, l, d), h2 || 0));
1108
1108
  }
1109
1109
  }
1110
1110
  d = l;
@@ -1248,7 +1248,7 @@ function Kt(e) {
1248
1248
  let t = e.edge(n);
1249
1249
  if (t.width && t.height) {
1250
1250
  let r = e.node(n.v), i = { rank: (e.node(n.w).rank - r.rank) / 2 + r.rank, e: n };
1251
- w(e, "edge-proxy", i, "_ep");
1251
+ w2(e, "edge-proxy", i, "_ep");
1252
1252
  }
1253
1253
  });
1254
1254
  }
@@ -1271,8 +1271,8 @@ function Jt(e) {
1271
1271
  function Qt(e) {
1272
1272
  let n = Number.POSITIVE_INFINITY, t = 0, r = Number.POSITIVE_INFINITY, o = 0, i = e.graph(), s = i.marginx || 0, a = i.marginy || 0;
1273
1273
  function d(l) {
1274
- let u = l.x, c = l.y, h = l.width, f = l.height;
1275
- n = Math.min(n, u - h / 2), t = Math.max(t, u + h / 2), r = Math.min(r, c - f / 2), o = Math.max(o, c + f / 2);
1274
+ let u = l.x, c = l.y, h2 = l.width, f = l.height;
1275
+ n = Math.min(n, u - h2 / 2), t = Math.max(t, u + h2 / 2), r = Math.min(r, c - f / 2), o = Math.max(o, c + f / 2);
1276
1276
  }
1277
1277
  e.nodes().forEach((l) => d(e.node(l))), e.edges().forEach((l) => {
1278
1278
  let u = e.edge(l);
@@ -1336,7 +1336,7 @@ function or(e) {
1336
1336
  t.forEach((o, i) => {
1337
1337
  let s = e.node(o);
1338
1338
  s.order = i + r, (s.selfEdges || []).forEach((a) => {
1339
- w(e, "selfedge", { width: a.label.width, height: a.label.height, rank: s.rank, order: i + ++r, e: a.e, label: a.label }, "_se");
1339
+ w2(e, "selfedge", { width: a.label.width, height: a.label.height, rank: s.rank, order: i + ++r, e: a.e, label: a.label }, "_se");
1340
1340
  }), delete s.selfEdges;
1341
1341
  });
1342
1342
  });
@@ -3319,11 +3319,11 @@ function hex(value) {
3319
3319
  value = clampi(value);
3320
3320
  return (value < 16 ? "0" : "") + value.toString(16);
3321
3321
  }
3322
- function hsla(h, s, l, a) {
3323
- if (a <= 0) h = s = l = NaN;
3324
- else if (l <= 0 || l >= 1) h = s = NaN;
3325
- else if (s <= 0) h = NaN;
3326
- return new Hsl(h, s, l, a);
3322
+ function hsla(h2, s, l, a) {
3323
+ if (a <= 0) h2 = s = l = NaN;
3324
+ else if (l <= 0 || l >= 1) h2 = s = NaN;
3325
+ else if (s <= 0) h2 = NaN;
3326
+ return new Hsl(h2, s, l, a);
3327
3327
  }
3328
3328
  function hslConvert(o) {
3329
3329
  if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
@@ -3331,23 +3331,23 @@ function hslConvert(o) {
3331
3331
  if (!o) return new Hsl();
3332
3332
  if (o instanceof Hsl) return o;
3333
3333
  o = o.rgb();
3334
- var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;
3334
+ var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h2 = NaN, s = max - min, l = (max + min) / 2;
3335
3335
  if (s) {
3336
- if (r === max) h = (g - b) / s + (g < b) * 6;
3337
- else if (g === max) h = (b - r) / s + 2;
3338
- else h = (r - g) / s + 4;
3336
+ if (r === max) h2 = (g - b) / s + (g < b) * 6;
3337
+ else if (g === max) h2 = (b - r) / s + 2;
3338
+ else h2 = (r - g) / s + 4;
3339
3339
  s /= l < 0.5 ? max + min : 2 - max - min;
3340
- h *= 60;
3340
+ h2 *= 60;
3341
3341
  } else {
3342
- s = l > 0 && l < 1 ? 0 : h;
3342
+ s = l > 0 && l < 1 ? 0 : h2;
3343
3343
  }
3344
- return new Hsl(h, s, l, o.opacity);
3344
+ return new Hsl(h2, s, l, o.opacity);
3345
3345
  }
3346
- function hsl(h, s, l, opacity) {
3347
- return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
3346
+ function hsl(h2, s, l, opacity) {
3347
+ return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s, l, opacity == null ? 1 : opacity);
3348
3348
  }
3349
- function Hsl(h, s, l, opacity) {
3350
- this.h = +h;
3349
+ function Hsl(h2, s, l, opacity) {
3350
+ this.h = +h2;
3351
3351
  this.s = +s;
3352
3352
  this.l = +l;
3353
3353
  this.opacity = +opacity;
@@ -3362,11 +3362,11 @@ define_default(Hsl, hsl, extend(Color, {
3362
3362
  return new Hsl(this.h, this.s, this.l * k2, this.opacity);
3363
3363
  },
3364
3364
  rgb() {
3365
- var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
3365
+ var h2 = this.h % 360 + (this.h < 0) * 360, s = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
3366
3366
  return new Rgb(
3367
- hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
3368
- hsl2rgb(h, m1, m2),
3369
- hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
3367
+ hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
3368
+ hsl2rgb(h2, m1, m2),
3369
+ hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
3370
3370
  this.opacity
3371
3371
  );
3372
3372
  },
@@ -3388,8 +3388,8 @@ function clamph(value) {
3388
3388
  function clampt(value) {
3389
3389
  return Math.max(0, Math.min(1, value || 0));
3390
3390
  }
3391
- function hsl2rgb(h, m1, m2) {
3392
- return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
3391
+ function hsl2rgb(h2, m1, m2) {
3392
+ return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255;
3393
3393
  }
3394
3394
 
3395
3395
  // node_modules/d3-interpolate/src/constant.js
@@ -4651,11 +4651,11 @@ function zoom_default2() {
4651
4651
  }).on("interrupt.zoom end.zoom", function() {
4652
4652
  gesture(this, arguments).event(event).end();
4653
4653
  }).tween("zoom", function() {
4654
- var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p2 = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w2 = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i = interpolate(a.invert(p2).concat(w2 / a.k), b.invert(p2).concat(w2 / b.k));
4654
+ var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p2 = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w3 = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i = interpolate(a.invert(p2).concat(w3 / a.k), b.invert(p2).concat(w3 / b.k));
4655
4655
  return function(t) {
4656
4656
  if (t === 1) t = b;
4657
4657
  else {
4658
- var l = i(t), k2 = w2 / l[2];
4658
+ var l = i(t), k2 = w3 / l[2];
4659
4659
  t = new Transform(k2, p2[0] - l[0] * k2, p2[1] - l[1] * k2);
4660
4660
  }
4661
4661
  g.zoom(null, t);
@@ -6558,7 +6558,7 @@ function getHandle(nodeId, handleType, handleId, nodeLookup, connectionMode, wit
6558
6558
  return null;
6559
6559
  }
6560
6560
  const handles = connectionMode === "strict" ? node.internals.handleBounds?.[handleType] : [...node.internals.handleBounds?.source ?? [], ...node.internals.handleBounds?.target ?? []];
6561
- const handle = (handleId ? handles?.find((h) => h.id === handleId) : handles?.[0]) ?? null;
6561
+ const handle = (handleId ? handles?.find((h2) => h2.id === handleId) : handles?.[0]) ?? null;
6562
6562
  return handle && withAbsolutePosition ? { ...handle, ...getHandlePosition(node, handle, handle.position, true) } : handle;
6563
6563
  }
6564
6564
  function getHandleType(edgeUpdaterType, handleDomNode) {
@@ -10455,6 +10455,14 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
10455
10455
  return jsxRuntime.jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxRuntime.jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode, children: [jsxRuntime.jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, edgesFocusable, edgesReconnectable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, connectionDragThreshold, onBeforeDelete, debug, ariaLabelConfig, zIndexMode }), jsxRuntime.jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes, edgeTypes, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, autoPanOnSelection, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeExtent, viewport, onViewportChange }), jsxRuntime.jsx(SelectionListener, { onSelectionChange }), children2, jsxRuntime.jsx(Attribution, { proOptions, position: attributionPosition }), jsxRuntime.jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
10456
10456
  }
10457
10457
  var index = fixedForwardRef(ReactFlow);
10458
+ var selector$5 = (s) => s.domNode?.querySelector(".react-flow__viewport-portal");
10459
+ function ViewportPortal({ children: children2 }) {
10460
+ const viewPortalDiv = useStore(selector$5);
10461
+ if (!viewPortalDiv) {
10462
+ return null;
10463
+ }
10464
+ return reactDom.createPortal(children2, viewPortalDiv);
10465
+ }
10458
10466
  function LinePattern({ dimensions, lineWidth, variant, className }) {
10459
10467
  return jsxRuntime.jsx("path", { strokeWidth: lineWidth, d: `M${dimensions[0] / 2} 0 V${dimensions[1]} M0 ${dimensions[1] / 2} H${dimensions[0]}`, className: cc(["react-flow__background-pattern", variant, className]) });
10460
10468
  }
@@ -12342,6 +12350,97 @@ function distributeNodes(nodes, axis) {
12342
12350
  return { ...n, position: axis === "h" ? { ...n.position, x: p2 } : { ...n.position, y: p2 } };
12343
12351
  });
12344
12352
  }
12353
+
12354
+ // src/components/canvas/helper-lines.ts
12355
+ var w = (n) => n.width ?? n.measured?.width ?? 0;
12356
+ var h = (n) => n.height ?? n.measured?.height ?? 0;
12357
+ function getHelperLines(change, nodes, distance2 = 6) {
12358
+ const result = { snapPosition: { x: void 0, y: void 0 } };
12359
+ const a = nodes.find((n) => n.id === change.id);
12360
+ if (!a || !change.position) return result;
12361
+ const A2 = {
12362
+ left: change.position.x,
12363
+ right: change.position.x + w(a),
12364
+ top: change.position.y,
12365
+ bottom: change.position.y + h(a),
12366
+ width: w(a),
12367
+ height: h(a)
12368
+ };
12369
+ let vDist = distance2;
12370
+ let hDist = distance2;
12371
+ for (const b of nodes) {
12372
+ if (b.id === a.id) continue;
12373
+ const B2 = { left: b.position.x, right: b.position.x + w(b), top: b.position.y, bottom: b.position.y + h(b) };
12374
+ const ll = Math.abs(A2.left - B2.left);
12375
+ if (ll < vDist) {
12376
+ result.snapPosition.x = B2.left;
12377
+ result.vertical = B2.left;
12378
+ vDist = ll;
12379
+ }
12380
+ const rr2 = Math.abs(A2.right - B2.right);
12381
+ if (rr2 < vDist) {
12382
+ result.snapPosition.x = B2.right - A2.width;
12383
+ result.vertical = B2.right;
12384
+ vDist = rr2;
12385
+ }
12386
+ const lr = Math.abs(A2.left - B2.right);
12387
+ if (lr < vDist) {
12388
+ result.snapPosition.x = B2.right;
12389
+ result.vertical = B2.right;
12390
+ vDist = lr;
12391
+ }
12392
+ const rl = Math.abs(A2.right - B2.left);
12393
+ if (rl < vDist) {
12394
+ result.snapPosition.x = B2.left - A2.width;
12395
+ result.vertical = B2.left;
12396
+ vDist = rl;
12397
+ }
12398
+ const tt2 = Math.abs(A2.top - B2.top);
12399
+ if (tt2 < hDist) {
12400
+ result.snapPosition.y = B2.top;
12401
+ result.horizontal = B2.top;
12402
+ hDist = tt2;
12403
+ }
12404
+ const bb = Math.abs(A2.bottom - B2.bottom);
12405
+ if (bb < hDist) {
12406
+ result.snapPosition.y = B2.bottom - A2.height;
12407
+ result.horizontal = B2.bottom;
12408
+ hDist = bb;
12409
+ }
12410
+ const tb = Math.abs(A2.top - B2.bottom);
12411
+ if (tb < hDist) {
12412
+ result.snapPosition.y = B2.bottom;
12413
+ result.horizontal = B2.bottom;
12414
+ hDist = tb;
12415
+ }
12416
+ const bt2 = Math.abs(A2.bottom - B2.top);
12417
+ if (bt2 < hDist) {
12418
+ result.snapPosition.y = B2.top - A2.height;
12419
+ result.horizontal = B2.top;
12420
+ hDist = bt2;
12421
+ }
12422
+ }
12423
+ return result;
12424
+ }
12425
+ function HelperLines({ horizontal, vertical }) {
12426
+ if (horizontal === void 0 && vertical === void 0) return null;
12427
+ return /* @__PURE__ */ jsxRuntime.jsxs(ViewportPortal, { children: [
12428
+ vertical !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
12429
+ "div",
12430
+ {
12431
+ className: "ff-helper-line",
12432
+ style: { position: "absolute", transform: `translateX(${vertical}px)`, top: -5e3, height: 1e4, width: 1, pointerEvents: "none" }
12433
+ }
12434
+ ),
12435
+ horizontal !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
12436
+ "div",
12437
+ {
12438
+ className: "ff-helper-line",
12439
+ style: { position: "absolute", transform: `translateY(${horizontal}px)`, left: -5e3, width: 1e4, height: 1, pointerEvents: "none" }
12440
+ }
12441
+ )
12442
+ ] });
12443
+ }
12345
12444
  var DEFAULT_FIT_VIEW = { padding: 0.2 };
12346
12445
  var DEFAULT_EDGE_OPTIONS = {
12347
12446
  type: "smoothstep",
@@ -12356,6 +12455,9 @@ function FlowCanvas({
12356
12455
  height = 600,
12357
12456
  validateConnections = true,
12358
12457
  isValidConnection,
12458
+ colorMode,
12459
+ showHelperLines = false,
12460
+ onNodesChange,
12359
12461
  toolbar,
12360
12462
  nodeTypes,
12361
12463
  edgeTypes,
@@ -12382,31 +12484,66 @@ function FlowCanvas({
12382
12484
  [edgeTypes]
12383
12485
  );
12384
12486
  const orderedNodes = ReactExports.useMemo(() => sortNodesParentFirst(nodes), [nodes]);
12385
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["ff-canvas", className ?? ""].filter(Boolean).join(" "), style: { height, ...style2 }, children: [
12386
- toolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-canvas__toolbar", children: toolbar }),
12387
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-canvas__surface", children: /* @__PURE__ */ jsxRuntime.jsxs(
12388
- index,
12389
- {
12390
- nodes: orderedNodes,
12391
- edges,
12392
- nodeTypes: mergedNodeTypes,
12393
- edgeTypes: mergedEdgeTypes,
12394
- fitView: true,
12395
- fitViewOptions: DEFAULT_FIT_VIEW,
12396
- defaultEdgeOptions: DEFAULT_EDGE_OPTIONS,
12397
- proOptions: { hideAttribution: true },
12398
- zoomActivationKeyCode: "Shift",
12399
- preventScrolling: false,
12400
- isValidConnection: resolvedIsValidConnection,
12401
- ...rest,
12402
- children: [
12403
- background !== "none" && /* @__PURE__ */ jsxRuntime.jsx(Background, { variant: background, gap: 20, size: 1, color: "rgba(0,0,0,0.18)" }),
12404
- showControls && /* @__PURE__ */ jsxRuntime.jsx(Controls, { className: "ff-controls", position: "bottom-right" }),
12405
- showMinimap && /* @__PURE__ */ jsxRuntime.jsx(MiniMap, { className: "ff-minimap", pannable: true, zoomable: true })
12406
- ]
12487
+ const [helperLines, setHelperLines] = ReactExports.useState({});
12488
+ const handleNodesChange = ReactExports.useCallback(
12489
+ (changes) => {
12490
+ if (showHelperLines) {
12491
+ const pos = changes.filter((c) => c.type === "position" && c.position);
12492
+ if (pos.length === 1 && pos[0].dragging) {
12493
+ const lines = getHelperLines(pos[0], nodesRef.current);
12494
+ if (lines.snapPosition.x !== void 0) pos[0].position.x = lines.snapPosition.x;
12495
+ if (lines.snapPosition.y !== void 0) pos[0].position.y = lines.snapPosition.y;
12496
+ setHelperLines({ horizontal: lines.horizontal, vertical: lines.vertical });
12497
+ } else {
12498
+ setHelperLines({});
12499
+ }
12407
12500
  }
12408
- ) })
12409
- ] });
12501
+ onNodesChange?.(changes);
12502
+ },
12503
+ [showHelperLines, onNodesChange]
12504
+ );
12505
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12506
+ "div",
12507
+ {
12508
+ className: [
12509
+ "ff-canvas",
12510
+ // colorMode drives BOTH react-flow's chrome (below) and our `ff-` styles
12511
+ // via the shared `.dark` class / light opt-out — one theme signal.
12512
+ colorMode === "dark" ? "dark" : "",
12513
+ colorMode === "light" ? "ff-canvas--light" : "",
12514
+ className ?? ""
12515
+ ].filter(Boolean).join(" "),
12516
+ style: { height, ...style2 },
12517
+ children: [
12518
+ toolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-canvas__toolbar", children: toolbar }),
12519
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-canvas__surface", children: /* @__PURE__ */ jsxRuntime.jsxs(
12520
+ index,
12521
+ {
12522
+ nodes: orderedNodes,
12523
+ edges,
12524
+ onNodesChange: handleNodesChange,
12525
+ colorMode,
12526
+ nodeTypes: mergedNodeTypes,
12527
+ edgeTypes: mergedEdgeTypes,
12528
+ fitView: true,
12529
+ fitViewOptions: DEFAULT_FIT_VIEW,
12530
+ defaultEdgeOptions: DEFAULT_EDGE_OPTIONS,
12531
+ proOptions: { hideAttribution: true },
12532
+ zoomActivationKeyCode: "Shift",
12533
+ preventScrolling: false,
12534
+ isValidConnection: resolvedIsValidConnection,
12535
+ ...rest,
12536
+ children: [
12537
+ background !== "none" && /* @__PURE__ */ jsxRuntime.jsx(Background, { variant: background, gap: 20, size: 1, color: "rgba(0,0,0,0.18)" }),
12538
+ showControls && /* @__PURE__ */ jsxRuntime.jsx(Controls, { className: "ff-controls", position: "bottom-right" }),
12539
+ showMinimap && /* @__PURE__ */ jsxRuntime.jsx(MiniMap, { className: "ff-minimap", pannable: true, zoomable: true }),
12540
+ showHelperLines && /* @__PURE__ */ jsxRuntime.jsx(HelperLines, { horizontal: helperLines.horizontal, vertical: helperLines.vertical })
12541
+ ]
12542
+ }
12543
+ ) })
12544
+ ]
12545
+ }
12546
+ );
12410
12547
  }
12411
12548
  var CATEGORY_ORDER = ["trigger", "logic", "data", "ai", "io", "human", "output", "layout", "custom"];
12412
12549
  var CATEGORY_LABELS = {
@@ -13136,6 +13273,7 @@ function useFlowHistory(flow) {
13136
13273
  function useFlowRun({ maxFeed = 200 } = {}) {
13137
13274
  const [statuses, setStatuses] = ReactExports.useState({});
13138
13275
  const [statusText, setStatusText] = ReactExports.useState({});
13276
+ const [outputs, setOutputs] = ReactExports.useState({});
13139
13277
  const [feed, setFeed] = ReactExports.useState([]);
13140
13278
  const [running, setRunning] = ReactExports.useState(false);
13141
13279
  const [lastResult, setLastResult] = ReactExports.useState(null);
@@ -13149,6 +13287,7 @@ function useFlowRun({ maxFeed = 200 } = {}) {
13149
13287
  appendFeed({ level: "status", text: `${e.nodeId} \u2192 ${e.status}${e.text ? ` (${e.text})` : ""}`, nodeId: e.nodeId });
13150
13288
  break;
13151
13289
  case "node-output":
13290
+ setOutputs((o) => ({ ...o, [e.nodeId]: e.value }));
13152
13291
  appendFeed({ level: "info", text: `${e.nodeId}.${e.portId} = ${preview(e.value)}`, nodeId: e.nodeId, detail: e.value });
13153
13292
  break;
13154
13293
  case "log":
@@ -13185,6 +13324,7 @@ function useFlowRun({ maxFeed = 200 } = {}) {
13185
13324
  for (const n of graph.nodes) idleStatuses[n.id] = "idle";
13186
13325
  setStatuses(idleStatuses);
13187
13326
  setStatusText({});
13327
+ setOutputs({});
13188
13328
  setRunning(true);
13189
13329
  try {
13190
13330
  const result = await runFlow(graph, executors, handleEvent, { ...options, signal: controller.signal });
@@ -13201,10 +13341,18 @@ function useFlowRun({ maxFeed = 200 } = {}) {
13201
13341
  const reset = ReactExports.useCallback(() => {
13202
13342
  setStatuses({});
13203
13343
  setStatusText({});
13344
+ setOutputs({});
13204
13345
  setFeed([]);
13205
13346
  setLastResult(null);
13206
13347
  }, []);
13207
- return { statuses, statusText, feed, running, lastResult, run, cancel, reset };
13348
+ return { statuses, statusText, outputs, feed, running, lastResult, run, cancel, reset };
13349
+ }
13350
+ function applyOutputsToNodes(nodes, outputs) {
13351
+ return nodes.map((n) => {
13352
+ const kind = getNodeKind(n.data?.kind ?? n.type ?? "");
13353
+ if (!kind?.reactive || !(n.id in outputs)) return n;
13354
+ return { ...n, data: { ...n.data, output: outputs[n.id] } };
13355
+ });
13208
13356
  }
13209
13357
  function applyStatusesToNodes(nodes, statuses, statusText) {
13210
13358
  return nodes.map((n) => ({
@@ -13446,6 +13594,10 @@ function RegistryNodeInner(props) {
13446
13594
  data.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ff-node__desc", children: data.description }),
13447
13595
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-node__body", children: kind.renderBody ? kind.renderBody({ nodeId: props.id, config, selected: props.selected ?? false }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultBody, { config, kind: kind.configSchema }) }),
13448
13596
  data.statusText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ff-node__status-text", children: data.statusText }),
13597
+ data.output !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "ff-node__output", title: "Latest output", children: [
13598
+ "\u2192 ",
13599
+ previewValue(data.output)
13600
+ ] }),
13449
13601
  inputs.map((p2, i) => /* @__PURE__ */ jsxRuntime.jsx(
13450
13602
  Handle,
13451
13603
  {
@@ -13595,8 +13747,11 @@ function FlowEditorInner({
13595
13747
  ReactExports.useEffect(() => onNodeKindsChanged(() => force((n) => n + 1)), []);
13596
13748
  const nodeTypes = ReactExports.useMemo(() => buildNodeTypes(), [listNodeKinds().length]);
13597
13749
  const renderedNodes = ReactExports.useMemo(
13598
- () => applyStatusesToNodes(flow.nodes, runner.statuses, runner.statusText),
13599
- [flow.nodes, runner.statuses, runner.statusText]
13750
+ () => applyOutputsToNodes(
13751
+ applyStatusesToNodes(flow.nodes, runner.statuses, runner.statusText),
13752
+ runner.outputs
13753
+ ),
13754
+ [flow.nodes, runner.statuses, runner.statusText, runner.outputs]
13600
13755
  );
13601
13756
  const [selectedId, setSelectedId] = ReactExports.useState(null);
13602
13757
  const selected2 = ReactExports.useMemo(() => flow.nodes.find((n) => n.id === selectedId) ?? null, [flow.nodes, selectedId]);
@@ -13780,10 +13935,10 @@ function FlowEditorInner({
13780
13935
  (orientation = "horizontal", title) => {
13781
13936
  const vertical = orientation === "vertical";
13782
13937
  const lanes = flow.nodes.filter(isLaneNode);
13783
- const w2 = vertical ? 280 : 680;
13784
- const h = vertical ? 480 : 168;
13938
+ const w3 = vertical ? 280 : 680;
13939
+ const h2 = vertical ? 480 : 168;
13785
13940
  const end = lanes.reduce(
13786
- (m, l) => Math.max(m, vertical ? l.position.x + (l.width ?? w2) : l.position.y + (l.height ?? h)),
13941
+ (m, l) => Math.max(m, vertical ? l.position.x + (l.width ?? w3) : l.position.y + (l.height ?? h2)),
13787
13942
  0
13788
13943
  );
13789
13944
  const id2 = newNodeId();
@@ -13792,8 +13947,8 @@ function FlowEditorInner({
13792
13947
  id: id2,
13793
13948
  type: "@particle-academy/lane",
13794
13949
  position: vertical ? { x: lanes.length ? end + 12 : 0, y: 0 } : { x: 0, y: lanes.length ? end + 12 : 0 },
13795
- width: w2,
13796
- height: h,
13950
+ width: w3,
13951
+ height: h2,
13797
13952
  data: { kind: "@particle-academy/lane", label: name, config: { title: name, orientation } }
13798
13953
  };
13799
13954
  flow.setNodes((all) => [...all, node]);
@@ -14269,6 +14424,7 @@ exports.TriggerNode = TriggerNode;
14269
14424
  exports.WORKFLOW_SCHEMA_URL = WORKFLOW_SCHEMA_URL;
14270
14425
  exports.WORKFLOW_SCHEMA_VERSION = WORKFLOW_SCHEMA_VERSION;
14271
14426
  exports.alignNodes = alignNodes;
14427
+ exports.applyOutputsToNodes = applyOutputsToNodes;
14272
14428
  exports.applyStatusesToNodes = applyStatusesToNodes;
14273
14429
  exports.buildNodeTypes = buildNodeTypes;
14274
14430
  exports.categoryAccent = categoryAccent;