@yuneta/gobj-ui 7.23.155 → 7.23.157

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.
@@ -29314,301 +29314,6 @@ function tidy_tree_lr(nodes, edges, o) {
29314
29314
  }
29315
29315
  return pos;
29316
29316
  }
29317
- /************************************************************
29318
- * The compact tree.
29319
- *
29320
- * The tidy tree above gives every subtree its whole BLOCK: open a
29321
- * hall with twenty-four devices and its block widens, and with it
29322
- * every block above it, so the siblings of its ancestors move apart
29323
- * at depths where nothing of theirs touches. This one keeps the
29324
- * CONTOUR of each subtree instead -- its outline on each side, depth
29325
- * by depth -- and slides every sibling against the outline of the
29326
- * ones before it. A folded region then sits as close to an open one
29327
- * as their cards allow at each depth, which is what a folded treedb
29328
- * is: one branch open among closed ones.
29329
- *
29330
- * Same spanning tree, same order, same rows as the tidy tree: only
29331
- * the packing across the depths differs, so switching between the
29332
- * two moves cards sideways and never reorders them.
29333
- *
29334
- * And a run of three or more LEAF children -- a hall's devices, a
29335
- * region's places when none is open -- is STACKED: two columns
29336
- * under the parent with a corridor between them, row after row.
29337
- * That is what makes it compact when a whole level is open, where
29338
- * the contour alone gains nothing: every parent needed the whole
29339
- * row of its children beside it. The tree grows taller instead of
29340
- * wider. Its elbow edges run down the corridor (elbow_combs).
29341
- *
29342
- * The contour arithmetic is Moen's ("Drawing dynamic trees", IEEE
29343
- * Software, 1990) in the form mxGraph gave it in mxCompactTreeLayout
29344
- * -- Copyright (c) 2006-2015 JGraph Ltd, Apache License 2.0 -- read in
29345
- * maxGraph's CompactTreeLayout.ts: leaf, join, merge, offset and
29346
- * bridge below follow that form. What is ours: it runs on the
29347
- * spanning tree of a FOREST, every depth is a row as wide as its
29348
- * widest card (mxGraph's `alignRanks`), several roots sit side by
29349
- * side, and there is no recursion.
29350
- ************************************************************/
29351
- function layout_compact(nodes, edges, opts) {
29352
- let o = Object.assign({}, DEFAULTS, opts || {});
29353
- if (o.direction === "LR") return compact_tree_lr(nodes, edges, o);
29354
- let lr = compact_tree_lr(nodes.map((n) => Object.assign({}, n, {
29355
- w: n.h,
29356
- h: n.w
29357
- })), edges, o);
29358
- let pos = /* @__PURE__ */ new Map();
29359
- for (let [id, p] of lr) pos.set(id, {
29360
- x: p.y,
29361
- y: p.x
29362
- });
29363
- return pos;
29364
- }
29365
- function contour_line(dx, dy, next) {
29366
- return {
29367
- dx,
29368
- dy,
29369
- next: next || null
29370
- };
29371
- }
29372
- function contour_offset(p1, p2, a1, a2, b1, b2) {
29373
- if (b1 <= p1 || p1 + a1 <= 0) return 0;
29374
- let d;
29375
- if (b1 * a2 - a1 * b2 > 0) {
29376
- if (p1 < 0) d = p1 * a2 / a1 - p2;
29377
- else if (p1 > 0) d = p1 * b2 / b1 - p2;
29378
- else d = -p2;
29379
- } else if (b1 < p1 + a1) d = b2 - (p2 + (b1 - p1) * a2 / a1);
29380
- else if (b1 > p1 + a1) d = (a1 + p1) * b2 / b1 - (p2 + a2);
29381
- else d = b2 - (p2 + a2);
29382
- return d > 0 ? d : 0;
29383
- }
29384
- function contour_bridge(line1, x1, y1, line2, x2, y2) {
29385
- let dx = x2 + line2.dx - x1;
29386
- let dy = line2.dx === 0 ? line2.dy : dx * line2.dy / line2.dx;
29387
- let r = contour_line(dx, dy, line2.next);
29388
- line1.next = contour_line(0, y2 + line2.dy - dy - y1, r);
29389
- return r;
29390
- }
29391
- function contour_merge(p1, p2) {
29392
- let x = 0;
29393
- let y = 0;
29394
- let total = 0;
29395
- let upper = p1.lower_head;
29396
- let lower = p2.upper_head;
29397
- while (lower && upper) {
29398
- let d = contour_offset(x, y, lower.dx, lower.dy, upper.dx, upper.dy);
29399
- y += d;
29400
- total += d;
29401
- if (x + lower.dx <= upper.dx) {
29402
- x += lower.dx;
29403
- y += lower.dy;
29404
- lower = lower.next;
29405
- } else {
29406
- x -= upper.dx;
29407
- y -= upper.dy;
29408
- upper = upper.next;
29409
- }
29410
- }
29411
- if (lower) {
29412
- let b = contour_bridge(p1.upper_tail, 0, 0, lower, x, y);
29413
- p1.upper_tail = b.next ? p2.upper_tail : b;
29414
- p1.lower_tail = p2.lower_tail;
29415
- } else {
29416
- let b = contour_bridge(p2.lower_tail, x, y, upper, 0, 0);
29417
- if (!b.next) p1.lower_tail = b;
29418
- }
29419
- p1.lower_head = p2.lower_head;
29420
- return total;
29421
- }
29422
- function stack_trunk_width(k) {
29423
- let lanes = Math.max(0, k - 2);
29424
- return Math.max(36, 20 + Math.max(0, lanes - 1) * 6);
29425
- }
29426
- function stack_geometry(t, st, col_x, col_w) {
29427
- let d = st.depth;
29428
- let k = st.ids.length;
29429
- let rows = Math.ceil(k / 2);
29430
- let side = [0, 0];
29431
- let row_len = [];
29432
- for (let i = 0; i < k; i++) {
29433
- let n = t.by_id.get(st.ids[i]);
29434
- let r = Math.floor(i / 2);
29435
- side[i % 2] = Math.max(side[i % 2], n.h);
29436
- row_len[r] = Math.max(row_len[r] || 0, n.w);
29437
- }
29438
- row_len[0] = col_w[d];
29439
- let trunk = stack_trunk_width(k);
29440
- let starts = [col_x[d]];
29441
- for (let r = 1; r < rows; r++) starts[r] = starts[r - 1] + row_len[r - 1] + 40;
29442
- return {
29443
- side,
29444
- trunk,
29445
- starts,
29446
- row_len,
29447
- len: starts[rows - 1] + row_len[rows - 1] - col_x[d],
29448
- ext: side[0] + trunk + side[1]
29449
- };
29450
- }
29451
- function place_stack(t, st, g, top, pos) {
29452
- for (let i = 0; i < st.ids.length; i++) {
29453
- let n = t.by_id.get(st.ids[i]);
29454
- let r = Math.floor(i / 2);
29455
- let across = i % 2 === 0 ? top + g.side[0] - n.h / 2 : top + g.side[0] + g.trunk + n.h / 2;
29456
- pos.set(st.ids[i], {
29457
- x: g.starts[r] + g.row_len[r] / 2,
29458
- y: across
29459
- });
29460
- }
29461
- }
29462
- function compact_tree_lr(nodes, edges, o) {
29463
- let t = spanning_tree(nodes, edges);
29464
- let pos = /* @__PURE__ */ new Map();
29465
- let kids_of = /* @__PURE__ */ new Map();
29466
- let stacks = /* @__PURE__ */ new Map();
29467
- for (let [id, kids] of t.children) {
29468
- let out = [];
29469
- let run = [];
29470
- let flush = () => {
29471
- if (run.length >= 3) {
29472
- let key = { stack: stacks.size };
29473
- stacks.set(key, {
29474
- ids: run,
29475
- depth: t.depth.get(run[0])
29476
- });
29477
- out.push(key);
29478
- } else out.push(...run);
29479
- run = [];
29480
- };
29481
- for (let kid of kids) if ((t.children.get(kid) || []).length === 0) run.push(kid);
29482
- else {
29483
- flush();
29484
- out.push(kid);
29485
- }
29486
- flush();
29487
- kids_of.set(id, out);
29488
- }
29489
- let order = [];
29490
- let todo = t.roots.slice().reverse();
29491
- while (todo.length) {
29492
- let id = todo.pop();
29493
- order.push(id);
29494
- let kids = kids_of.get(id) || [];
29495
- for (let i = kids.length - 1; i >= 0; i--) todo.push(kids[i]);
29496
- }
29497
- let col_w = [];
29498
- for (let [id, d] of t.depth) col_w[d] = Math.max(col_w[d] || 0, t.by_id.get(id).w);
29499
- let col_x = [];
29500
- let x = 0;
29501
- for (let d = 0; d < col_w.length; d++) {
29502
- col_x[d] = x;
29503
- x += (col_w[d] || 0) + o.ranksep;
29504
- }
29505
- let pad = o.nodesep / 2;
29506
- let dist = o.nodesep;
29507
- let level_distance = o.ranksep - pad;
29508
- let tn = /* @__PURE__ */ new Map();
29509
- for (let id of order) {
29510
- let st = stacks.get(id);
29511
- if (st) {
29512
- let g = stack_geometry(t, st, col_x, col_w);
29513
- tn.set(id, {
29514
- len: g.len,
29515
- ext: g.ext,
29516
- geom: g,
29517
- off_x: 0,
29518
- off_y: 0,
29519
- y: 0,
29520
- contour: null
29521
- });
29522
- } else tn.set(id, {
29523
- len: col_w[t.depth.get(id)],
29524
- ext: t.by_id.get(id).h,
29525
- off_x: 0,
29526
- off_y: 0,
29527
- y: 0,
29528
- contour: null
29529
- });
29530
- }
29531
- for (let i = order.length - 1; i >= 0; i--) {
29532
- let id = order[i];
29533
- let n = tn.get(id);
29534
- let kids = kids_of.get(id) || [];
29535
- if (!kids.length) {
29536
- let upper = contour_line(n.len + dist, 0);
29537
- let lower_tail = contour_line(0, -n.ext - dist);
29538
- n.contour = {
29539
- upper_head: upper,
29540
- upper_tail: upper,
29541
- lower_tail,
29542
- lower_head: contour_line(n.len + dist, 0, lower_tail)
29543
- };
29544
- continue;
29545
- }
29546
- let first = tn.get(kids[0]);
29547
- n.contour = first.contour;
29548
- let h = first.ext + dist;
29549
- let span = h;
29550
- for (let k = 1; k < kids.length; k++) {
29551
- let kid = tn.get(kids[k]);
29552
- let d = contour_merge(n.contour, kid.contour);
29553
- kid.off_y = d + h;
29554
- kid.off_x = 0;
29555
- h = kid.ext + dist;
29556
- span += d + h;
29557
- }
29558
- let gap = pad + level_distance;
29559
- let y2 = (span - n.ext) / 2 - pad;
29560
- let y1 = y2 + n.ext + 2 * pad - span;
29561
- first.off_x = gap + n.len;
29562
- first.off_y = y1;
29563
- n.contour.upper_head = contour_line(n.len, 0, contour_line(gap, y1, n.contour.upper_head));
29564
- n.contour.lower_head = contour_line(n.len, 0, contour_line(gap, y2, n.contour.lower_head));
29565
- }
29566
- let root_of = /* @__PURE__ */ new Map();
29567
- for (let id of order) {
29568
- let n = tn.get(id);
29569
- if (!root_of.has(id)) root_of.set(id, id);
29570
- let kids = kids_of.get(id) || [];
29571
- if (!kids.length) continue;
29572
- let running = n.y + tn.get(kids[0]).off_y;
29573
- tn.get(kids[0]).y = running;
29574
- root_of.set(kids[0], root_of.get(id));
29575
- for (let k = 1; k < kids.length; k++) {
29576
- let kid = tn.get(kids[k]);
29577
- kid.y = running + kid.off_y;
29578
- running = kid.y;
29579
- root_of.set(kids[k], root_of.get(id));
29580
- }
29581
- }
29582
- let lo = /* @__PURE__ */ new Map();
29583
- let hi = /* @__PURE__ */ new Map();
29584
- for (let id of order) {
29585
- let r = root_of.get(id);
29586
- let n = tn.get(id);
29587
- lo.set(r, Math.min(lo.has(r) ? lo.get(r) : Infinity, n.y));
29588
- hi.set(r, Math.max(hi.has(r) ? hi.get(r) : -Infinity, n.y + n.ext));
29589
- }
29590
- let shift = /* @__PURE__ */ new Map();
29591
- let top = 0;
29592
- for (let r of t.roots) {
29593
- shift.set(r, top - lo.get(r));
29594
- top += hi.get(r) - lo.get(r) + o.nodesep * 2;
29595
- }
29596
- for (let id of order) {
29597
- let n = tn.get(id);
29598
- let y = n.y + shift.get(root_of.get(id));
29599
- let st = stacks.get(id);
29600
- if (st) {
29601
- place_stack(t, st, n.geom, y, pos);
29602
- continue;
29603
- }
29604
- let d = t.depth.get(id);
29605
- pos.set(id, {
29606
- x: col_x[d] + col_w[d] / 2,
29607
- y: y + n.ext / 2
29608
- });
29609
- }
29610
- return pos;
29611
- }
29612
29317
  function extent_at(n, a) {
29613
29318
  if (!n) return 0;
29614
29319
  return Math.abs(n.w * Math.cos(a)) + Math.abs(n.h * Math.sin(a));
@@ -29738,23 +29443,6 @@ function elbow_lane(ids, id) {
29738
29443
  if (k <= 0) return 0;
29739
29444
  return (k % 2 ? 1 : -1) * Math.ceil(k / 2);
29740
29445
  }
29741
- /************************************************************
29742
- * The rank of `id` among `items` ([{id, span}]): the forward
29743
- * edges that share one end with it, each with how far it runs
29744
- * ACROSS. Farthest first; a tie goes to the edge made first.
29745
- * Returns {rank, count}.
29746
- ************************************************************/
29747
- function elbow_rank(items, id) {
29748
- let sorted = items.slice().sort((a, b) => {
29749
- if (b.span !== a.span) return b.span - a.span;
29750
- return String(a.id).localeCompare(String(b.id), void 0, { numeric: true });
29751
- });
29752
- let rank = sorted.findIndex((it) => it.id === id);
29753
- return {
29754
- rank: rank < 0 ? 0 : rank,
29755
- count: sorted.length
29756
- };
29757
- }
29758
29446
  function swap(p) {
29759
29447
  return [p[1], p[0]];
29760
29448
  }
@@ -29766,136 +29454,6 @@ function swap_box(b) {
29766
29454
  y2: b.x2
29767
29455
  };
29768
29456
  }
29769
- function staggered_turn(lo, hi, st) {
29770
- let mid = (lo + hi) / 2;
29771
- let group = null;
29772
- let k = 0;
29773
- if (st.dep && st.dep.count > 1) {
29774
- group = st.dep;
29775
- k = st.dep.rank;
29776
- } else if (st.arr && st.arr.count > 1) {
29777
- group = st.arr;
29778
- k = st.arr.count - 1 - st.arr.rank;
29779
- }
29780
- if (group) {
29781
- let room = Math.max(0, hi - lo - 12);
29782
- let step = Math.min(10, room / (group.count - 1));
29783
- mid = mid - (group.count - 1) * step / 2 + k * step;
29784
- }
29785
- return mid;
29786
- }
29787
- /************************************************************
29788
- * The combs of the stacks under one card.
29789
- *
29790
- * treedb_layout.js lays a run of leaf children out as two columns
29791
- * with a corridor between them. A card in the first row is reached
29792
- * from the channel like any other; one in a lower row cannot be --
29793
- * the card above it stands in the way -- so its edge runs down
29794
- * the corridor in a LANE of its own and turns into the gap above
29795
- * its card, which it shares only with the other card of its row,
29796
- * reached from the other side.
29797
- *
29798
- * targets [{id, box}]: the forward edges leaving one card,
29799
- * each with the box of the card it reaches
29800
- * vertical as in elbow_points; false swaps the boxes
29801
- *
29802
- * Returns Map id -> {lane, z, top}: the lane, the height of the
29803
- * gap it turns into, and the top of the stack's first row (where
29804
- * the channel over the stack ends). Only for a card that stands
29805
- * under another of the group, within a stack gap and lined up
29806
- * with it on the corridor side -- what a stack looks like.
29807
- *
29808
- * Lanes go outermost first, row by row: a line into a higher row
29809
- * keeps outside the lines going deeper, and none crosses another.
29810
- ************************************************************/
29811
- function elbow_combs(targets, vertical) {
29812
- let list = vertical ? targets : targets.map((it) => ({
29813
- id: it.id,
29814
- box: swap_box(it.box)
29815
- }));
29816
- let cy = (b) => (b.y1 + b.y2) / 2;
29817
- let near = (a, b) => Math.abs(a - b) < 1.5;
29818
- let under = [];
29819
- for (let it of list) {
29820
- let b = it.box;
29821
- let above = null;
29822
- for (let o of list) {
29823
- let a = o.box;
29824
- if (o === it || a.y2 > b.y1 || b.y1 - a.y2 > 40) continue;
29825
- if (!(near(a.x2, b.x2) || near(a.x1, b.x1))) continue;
29826
- if (!above || a.y2 > above.y2) above = a;
29827
- }
29828
- if (!above) continue;
29829
- let side;
29830
- if (near(above.x2, b.x2) && !near(above.x1, b.x1)) side = 0;
29831
- else if (near(above.x1, b.x1) && !near(above.x2, b.x2)) side = 1;
29832
- else side = list.some((o) => o !== it && near(cy(o.box), cy(b)) && o.box.x2 <= b.x1) ? 1 : 0;
29833
- under.push({
29834
- id: it.id,
29835
- box: b,
29836
- above,
29837
- side
29838
- });
29839
- }
29840
- let corridor = (u) => {
29841
- if (u.side === 0) {
29842
- let l = u.box.x2;
29843
- let col = list.filter((o) => near(o.box.x2, l));
29844
- let r = Infinity;
29845
- for (let c of col) for (let o of list) if (o !== c && near(cy(o.box), cy(c.box)) && o.box.x1 >= l - .5) r = Math.min(r, o.box.x1);
29846
- return {
29847
- l,
29848
- r: isFinite(r) ? r : l + 36,
29849
- col
29850
- };
29851
- }
29852
- let r = u.box.x1;
29853
- let col = list.filter((o) => near(o.box.x1, r));
29854
- let l = -Infinity;
29855
- for (let c of col) for (let o of list) if (o !== c && near(cy(o.box), cy(c.box)) && o.box.x2 <= r + .5) l = Math.max(l, o.box.x2);
29856
- return {
29857
- l: isFinite(l) ? l : r - 36,
29858
- r,
29859
- col
29860
- };
29861
- };
29862
- let groups = /* @__PURE__ */ new Map();
29863
- for (let u of under) {
29864
- let c = corridor(u);
29865
- u.top = Math.min(...c.col.map((o) => o.box.y1));
29866
- let key = `${Math.round(c.l)}|${Math.round(c.r)}`;
29867
- if (!groups.has(key)) groups.set(key, {
29868
- l: c.l,
29869
- r: c.r,
29870
- left: [],
29871
- right: []
29872
- });
29873
- groups.get(key)[u.side === 0 ? "left" : "right"].push(u);
29874
- }
29875
- let out = /* @__PURE__ */ new Map();
29876
- for (let g of groups.values()) {
29877
- g.left.sort((a, b) => a.box.y1 - b.box.y1);
29878
- g.right.sort((a, b) => a.box.y1 - b.box.y1);
29879
- let n = g.left.length + g.right.length;
29880
- let room = g.r - g.l - 20;
29881
- let step = n > 1 ? Math.max(0, Math.min(6, room / (n - 1))) : 0;
29882
- g.left.forEach((u, i) => {
29883
- out.set(u.id, {
29884
- lane: g.l + 10 + i * step,
29885
- z: (u.above.y2 + u.box.y1) / 2,
29886
- top: u.top
29887
- });
29888
- });
29889
- g.right.forEach((u, j) => {
29890
- out.set(u.id, {
29891
- lane: g.r - 10 - j * step,
29892
- z: (u.above.y2 + u.box.y1) / 2,
29893
- top: u.top
29894
- });
29895
- });
29896
- }
29897
- return out;
29898
- }
29899
29457
  /************************************************************
29900
29458
  * The control points of an elbow from the port `s` to the port
29901
29459
  * `t` ([x, y] each), knowing the boxes of the two cards
@@ -29903,33 +29461,13 @@ function elbow_combs(targets, vertical) {
29903
29461
  *
29904
29462
  * vertical the rows are stacked (top to bottom); false
29905
29463
  * when they are side by side (left to right)
29906
- * stagger {dep, arr, comb}: the edge's rank among the
29907
- * forward edges leaving its source card and among
29908
- * those reaching its target card (elbow_rank), and
29909
- * its comb when the target is in a lower row of a
29910
- * stack (elbow_combs). Absent, the channel is the
29911
- * middle.
29912
- ************************************************************/
29913
- function elbow_points(s, t, box_s, box_t, lane, vertical, stagger) {
29914
- if (!vertical) return elbow_points(swap(s), swap(t), swap_box(box_s), swap_box(box_t), lane, true, stagger).map(swap);
29464
+ ************************************************************/
29465
+ function elbow_points(s, t, box_s, box_t, lane, vertical) {
29466
+ if (!vertical) return elbow_points(swap(s), swap(t), swap_box(box_s), swap_box(box_t), lane, true).map(swap);
29915
29467
  let shift = lane * 10;
29916
29468
  if (t[1] - s[1] > 20) {
29917
- let st = stagger || {};
29918
- let lo = Math.max(s[1], box_s.y2);
29919
- if (st.comb) {
29920
- let c = st.comb;
29921
- let turn = staggered_turn(lo, c.top, { dep: st.dep }) + shift;
29922
- turn = Math.min(Math.max(turn, lo + 4), c.top - 4);
29923
- return [
29924
- [s[0], turn],
29925
- [c.lane, turn],
29926
- [c.lane, c.z],
29927
- [t[0], c.z]
29928
- ];
29929
- }
29930
- let hi = Math.min(t[1], box_t.y1);
29931
- let mid = staggered_turn(lo, hi, st) + shift;
29932
- mid = Math.min(Math.max(mid, lo + 4), hi - 4);
29469
+ let mid = (s[1] + t[1]) / 2 + shift;
29470
+ mid = Math.min(Math.max(mid, s[1] + 10), t[1] - 10);
29933
29471
  return [[s[0], mid], [t[0], mid]];
29934
29472
  }
29935
29473
  let out = 16 + Math.abs(shift);
@@ -30023,12 +29561,8 @@ function heap_pop(h) {
30023
29561
  /************************************************************
30024
29562
  * The shortest orthogonal line from `a` to `z` that enters none
30025
29563
  * of `boxes` (already expanded by the clearance), a turn costing
30026
- * ROUTE_BEND. The line leaves `a` SIDEWAYS and reaches `z`
30027
- * SIDEWAYS: the column straight under a port and the one straight
30028
- * over it belong to the forward edges that share that port, which
30029
- * run along them to their staggered turns -- a route going down
30030
- * that column lay on top of them. So a routed line shares only
30031
- * the stub between the port and `a` (or `z`).
29564
+ * ROUTE_BEND. The line leaves `a` going down and ends at `z`
29565
+ * going down, since after `z` it drops into a port.
30032
29566
  *
30033
29567
  * The grid is SPARSE: only the lines of the boxes' borders and
30034
29568
  * of the two ends, which is all an orthogonal shortest path ever
@@ -30094,8 +29628,7 @@ function orth_search(a, z, boxes) {
30094
29628
  let k = state >> 2;
30095
29629
  let dir = state & 3;
30096
29630
  if (k === goal) {
30097
- if (dir >= 2) continue;
30098
- let total = cost + 40;
29631
+ let total = cost + (dir === 2 ? 0 : 40);
30099
29632
  if (total < found_cost) {
30100
29633
  found_cost = total;
30101
29634
  found = state;
@@ -30103,7 +29636,6 @@ function orth_search(a, z, boxes) {
30103
29636
  continue;
30104
29637
  }
30105
29638
  for (let [nk, nd, len] of moves(k)) {
30106
- if (k === start && nd >= 2) continue;
30107
29639
  let c = cost + len + (nd === dir ? 0 : 40);
30108
29640
  let ns = nk * 4 + nd;
30109
29641
  if (c < best[ns]) {
@@ -30144,11 +29676,10 @@ function orth_search(a, z, boxes) {
30144
29676
  * coincide. Nearby cards first; all of them if that finds no way;
30145
29677
  * the simple elbow if nothing does.
30146
29678
  ************************************************************/
30147
- function elbow_route(s, t, box_s, box_t, lane, vertical, boxes, stagger) {
29679
+ function elbow_route(s, t, box_s, box_t, lane, vertical, boxes) {
30148
29680
  let others = boxes || [];
30149
- if (!vertical) return elbow_route(swap(s), swap(t), swap_box(box_s), swap_box(box_t), lane, true, others.map(swap_box), stagger).map(swap);
30150
- if (stagger && stagger.comb) return elbow_points(s, t, box_s, box_t, lane, true, stagger);
30151
- let simple = elbow_points(s, t, box_s, box_t, lane, true, stagger);
29681
+ if (!vertical) return elbow_route(swap(s), swap(t), swap_box(box_s), swap_box(box_t), lane, true, others.map(swap_box)).map(swap);
29682
+ let simple = elbow_points(s, t, box_s, box_t, lane, true);
30152
29683
  if (!elbow_path_hits([
30153
29684
  s,
30154
29685
  ...simple,
@@ -30168,112 +29699,6 @@ function elbow_route(s, t, box_s, box_t, lane, vertical, boxes, stagger) {
30168
29699
  if (!route && near.length < others.length) route = orth_search(a, z, others.map((b) => box_expand(b, m)));
30169
29700
  return route || simple;
30170
29701
  }
30171
- function path_points(path) {
30172
- let pts = [];
30173
- let cur = null;
30174
- for (let c of path) if (c[0] === "M" || c[0] === "L") {
30175
- cur = [c[1], c[2]];
30176
- pts.push(cur);
30177
- } else if (c[0] === "C" && cur) {
30178
- let [x0, y0] = cur;
30179
- for (let k = 1; k <= 16; k++) {
30180
- let u = k / 16;
30181
- let v = 1 - u;
30182
- pts.push([v * v * v * x0 + 3 * v * v * u * c[1] + 3 * v * u * u * c[3] + u * u * u * c[5], v * v * v * y0 + 3 * v * v * u * c[2] + 3 * v * u * u * c[4] + u * u * u * c[6]]);
30183
- }
30184
- cur = [c[5], c[6]];
30185
- } else if (c[0] === "Q" && cur) {
30186
- let [x0, y0] = cur;
30187
- for (let k = 1; k <= 16; k++) {
30188
- let u = k / 16;
30189
- let v = 1 - u;
30190
- pts.push([v * v * x0 + 2 * v * u * c[1] + u * u * c[3], v * v * y0 + 2 * v * u * c[2] + u * u * c[4]]);
30191
- }
30192
- cur = [c[3], c[4]];
30193
- }
30194
- return pts;
30195
- }
30196
- /************************************************************
30197
- * Does the G6 path `path` of a curved edge cross a card other than
30198
- * its own two? Measured on the curve itself -- the path G6 would
30199
- * draw, sampled -- and not on the rectangle round it, which took
30200
- * every card the curve merely passed near: the ports of a row
30201
- * stick well into the space above it. Its own two cards are left
30202
- * out: the curve starts and ends on their ports.
30203
- ************************************************************/
30204
- function curve_hits(path, boxes, box_s, box_t) {
30205
- let pts = path_points(path);
30206
- if (pts.length < 2) return false;
30207
- let bb = {
30208
- x1: Infinity,
30209
- y1: Infinity,
30210
- x2: -Infinity,
30211
- y2: -Infinity
30212
- };
30213
- for (let p of pts) {
30214
- bb.x1 = Math.min(bb.x1, p[0]);
30215
- bb.y1 = Math.min(bb.y1, p[1]);
30216
- bb.x2 = Math.max(bb.x2, p[0]);
30217
- bb.y2 = Math.max(bb.y2, p[1]);
30218
- }
30219
- for (let b of boxes || []) {
30220
- if (same_box(b, box_s) || same_box(b, box_t) || !box_overlaps(b, box_expand(bb, 1))) continue;
30221
- let inner = box_expand(b, -1);
30222
- for (let k = 0; k + 1 < pts.length; k++) if (segment_hits(pts[k], pts[k + 1], inner)) return true;
30223
- }
30224
- return false;
30225
- }
30226
- /************************************************************
30227
- * A G6 path (['M'|'L'|'Q', ...]) along `points` with every corner
30228
- * rounded -- by `radius`, or by half the shorter of its two
30229
- * segments, so a short run is never overshot. The rounding is the
30230
- * quadratic G6's own polyline uses.
30231
- ************************************************************/
30232
- function rounded_path(points, radius) {
30233
- let path = [[
30234
- "M",
30235
- points[0][0],
30236
- points[0][1]
30237
- ]];
30238
- for (let i = 1; i + 1 < points.length; i++) {
30239
- let a = points[i - 1];
30240
- let m = points[i];
30241
- let b = points[i + 1];
30242
- let len_in = Math.hypot(m[0] - a[0], m[1] - a[1]);
30243
- let len_out = Math.hypot(b[0] - m[0], b[1] - m[1]);
30244
- let r = Math.min(radius, len_in / 2, len_out / 2);
30245
- let collinear = Math.abs((m[0] - a[0]) * (b[1] - m[1]) - (m[1] - a[1]) * (b[0] - m[0])) < 1e-9;
30246
- if (r <= 0 || collinear) {
30247
- path.push([
30248
- "L",
30249
- m[0],
30250
- m[1]
30251
- ]);
30252
- continue;
30253
- }
30254
- let p1 = [m[0] - (m[0] - a[0]) / len_in * r, m[1] - (m[1] - a[1]) / len_in * r];
30255
- let p2 = [m[0] + (b[0] - m[0]) / len_out * r, m[1] + (b[1] - m[1]) / len_out * r];
30256
- path.push([
30257
- "L",
30258
- p1[0],
30259
- p1[1]
30260
- ]);
30261
- path.push([
30262
- "Q",
30263
- m[0],
30264
- m[1],
30265
- p2[0],
30266
- p2[1]
30267
- ]);
30268
- }
30269
- let last = points[points.length - 1];
30270
- path.push([
30271
- "L",
30272
- last[0],
30273
- last[1]
30274
- ]);
30275
- return path;
30276
- }
30277
29702
  //#endregion
30278
29703
  //#region node_modules/@babel/runtime/helpers/esm/typeof.js
30279
29704
  function _typeof(o) {
@@ -55161,7 +54586,7 @@ Easing Functions from anime.js, they are tried and true, so, its better to use t
55161
54586
  var Quad = function Quad(t) {
55162
54587
  return Math.pow(t, 2);
55163
54588
  };
55164
- var Cubic$1 = function Cubic(t) {
54589
+ var Cubic = function Cubic(t) {
55165
54590
  return Math.pow(t, 3);
55166
54591
  };
55167
54592
  var Quart = function Quart(t) {
@@ -55298,10 +54723,10 @@ var EasingFunctions = {
55298
54723
  "out-quad": EaseOut(Quad),
55299
54724
  "in-out-quad": EaseInOut(Quad),
55300
54725
  "out-in-quad": EaseOutIn(Quad),
55301
- "in-cubic": Cubic$1,
55302
- "out-cubic": EaseOut(Cubic$1),
55303
- "in-out-cubic": EaseInOut(Cubic$1),
55304
- "out-in-cubic": EaseOutIn(Cubic$1),
54726
+ "in-cubic": Cubic,
54727
+ "out-cubic": EaseOut(Cubic),
54728
+ "in-out-cubic": EaseInOut(Cubic),
54729
+ "out-in-cubic": EaseOutIn(Cubic),
55305
54730
  "in-quart": Quart,
55306
54731
  "out-quart": EaseOut(Quart),
55307
54732
  "in-out-quart": EaseInOut(Quart),
@@ -57138,12 +56563,6 @@ var _layouts = {
57138
56563
  nodesep: 18,
57139
56564
  ranksep: 90
57140
56565
  },
57141
- "compact-tree": {
57142
- type: "treedb-compact",
57143
- direction: "TB",
57144
- nodesep: 18,
57145
- ranksep: 90
57146
- },
57147
56566
  "dagre": {
57148
56567
  type: "dagre",
57149
56568
  rankdir: "LR",
@@ -57471,11 +56890,8 @@ function register_layouts(gobj) {
57471
56890
  _g6_extensions_registered = true;
57472
56891
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.LAYOUT, "manual", ManualLayout);
57473
56892
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.LAYOUT, "treedb-tree", TreedbTreeLayout);
57474
- (0, _antv_g6.register)(_antv_g6.ExtensionCategory.LAYOUT, "treedb-compact", TreedbCompactLayout);
57475
56893
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.EDGE, "treedb-elbow-v", TreedbElbowV);
57476
56894
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.EDGE, "treedb-elbow-h", TreedbElbowH);
57477
- (0, _antv_g6.register)(_antv_g6.ExtensionCategory.EDGE, "treedb-curve-v", TreedbCurveV);
57478
- (0, _antv_g6.register)(_antv_g6.ExtensionCategory.EDGE, "treedb-curve-h", TreedbCurveH);
57479
56895
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.LAYOUT, "treedb-radial", TreedbRadialLayout);
57480
56896
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.NODE, "light", LightNode);
57481
56897
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.NODE, "treedb-card", TreedbCard);
@@ -58170,9 +57586,7 @@ function layout_direction(gobj) {
58170
57586
  function edge_type_for(gobj) {
58171
57587
  let lr = layout_direction(gobj) === "LR";
58172
57588
  let rowless = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "rowless_layouts") || [];
58173
- let rows = !(0, _yuneta_gobj_js.str_in_list)(rowless, gobj.priv.layout);
58174
- if (rows && (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "edge_shape") === "elbow") return lr ? "treedb-elbow-h" : "treedb-elbow-v";
58175
- if (rows) return lr ? "treedb-curve-h" : "treedb-curve-v";
57589
+ if ((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "edge_shape") === "elbow" && !(0, _yuneta_gobj_js.str_in_list)(rowless, gobj.priv.layout)) return lr ? "treedb-elbow-h" : "treedb-elbow-v";
58176
57590
  return lr ? "cubic-horizontal" : "cubic";
58177
57591
  }
58178
57592
  /************************************************************
@@ -59659,9 +59073,8 @@ var TreedbTreeLayout = class extends _antv_g6.BaseLayout {
59659
59073
  * dragged card, a fold or a layout needs nothing else. `-v` runs
59660
59074
  * between rows (top to bottom), `-h` between columns. An edge that
59661
59075
  * does not run forward goes round the two cards, the edges joining
59662
- * the same two cards take lanes, the edges sharing an end turn at
59663
- * staggered heights, and a line that would cross any other card is
59664
- * routed round it (treedb_elbow.js).
59076
+ * the same two cards take lanes, and a line that would cross any
59077
+ * other card is routed round it (treedb_elbow.js).
59665
59078
  ************************************************************/
59666
59079
  var ELBOW_RADIUS = 6;
59667
59080
  function elbow_box(node) {
@@ -59713,55 +59126,10 @@ function elbow_lane_of(edge) {
59713
59126
  return 0;
59714
59127
  }
59715
59128
  }
59716
- function elbow_stagger_of(edge, vertical) {
59717
- let graph = edge.context && edge.context.graph;
59718
- let element = edge.context && edge.context.element;
59719
- let s = edge.sourceNode && edge.sourceNode.id;
59720
- let t = edge.targetNode && edge.targetNode.id;
59721
- if (!graph || !element || s === void 0 || t === void 0) return null;
59722
- let across = vertical ? 0 : 1;
59723
- let along = vertical ? 1 : 0;
59724
- let pos = (id) => graph.getElementPosition(id);
59725
- let port_of = (node_id, key) => {
59726
- let node = element.getElement(node_id);
59727
- let ports = node && typeof node.getPorts === "function" ? node.getPorts() : {};
59728
- let port = key ? ports[key] : null;
59729
- return port ? port.getPosition() : pos(node_id);
59730
- };
59731
- try {
59732
- let ps = pos(s);
59733
- let pt = pos(t);
59734
- let leaving = graph.getRelatedEdgesData(s, "out").filter((d) => d.source === s && pos(d.target)[along] > ps[along]);
59735
- let combs = elbow_combs(leaving.map((d) => ({
59736
- id: d.id,
59737
- box: elbow_box(element.getElement(d.target))
59738
- })), vertical);
59739
- let dep = leaving.map((d) => {
59740
- let comb = combs.get(d.id);
59741
- let far = comb ? comb.lane : pos(d.target)[across];
59742
- return {
59743
- id: d.id,
59744
- span: Math.abs(far - port_of(s, d.style && d.style.sourcePort)[across])
59745
- };
59746
- });
59747
- let arr = graph.getRelatedEdgesData(t, "in").filter((d) => d.target === t && pos(d.source)[along] < pt[along]).map((d) => ({
59748
- id: d.id,
59749
- span: Math.abs(port_of(d.source, d.style && d.style.sourcePort)[across] - pt[across])
59750
- }));
59751
- return {
59752
- dep: elbow_rank(dep, edge.id),
59753
- arr: elbow_rank(arr, edge.id),
59754
- comb: combs.get(edge.id) || null
59755
- };
59756
- } catch (e) {
59757
- (0, _yuneta_gobj_js.log_error)(`elbow edge ${edge.id}: cannot read the edges sharing its ends: ${e}`);
59758
- return null;
59759
- }
59760
- }
59761
59129
  var TreedbElbowV = class extends _antv_g6.Polyline {
59762
59130
  getControlPoints(attributes) {
59763
59131
  let [s, t] = this.getEndpoints(attributes, false);
59764
- return elbow_route(s, t, elbow_box(this.sourceNode), elbow_box(this.targetNode), elbow_lane_of(this), true, elbow_obstacles(this), elbow_stagger_of(this, true));
59132
+ return elbow_route(s, t, elbow_box(this.sourceNode), elbow_box(this.targetNode), elbow_lane_of(this), true, elbow_obstacles(this));
59765
59133
  }
59766
59134
  getKeyPath(attributes) {
59767
59135
  return super.getKeyPath(Object.assign({}, attributes, { radius: attributes.radius || ELBOW_RADIUS }));
@@ -59770,52 +59138,12 @@ var TreedbElbowV = class extends _antv_g6.Polyline {
59770
59138
  var TreedbElbowH = class extends _antv_g6.Polyline {
59771
59139
  getControlPoints(attributes) {
59772
59140
  let [s, t] = this.getEndpoints(attributes, false);
59773
- return elbow_route(s, t, elbow_box(this.sourceNode), elbow_box(this.targetNode), elbow_lane_of(this), false, elbow_obstacles(this), elbow_stagger_of(this, false));
59141
+ return elbow_route(s, t, elbow_box(this.sourceNode), elbow_box(this.targetNode), elbow_lane_of(this), false, elbow_obstacles(this));
59774
59142
  }
59775
59143
  getKeyPath(attributes) {
59776
59144
  return super.getKeyPath(Object.assign({}, attributes, { radius: attributes.radius || ELBOW_RADIUS }));
59777
59145
  }
59778
59146
  };
59779
- /************************************************************
59780
- * A CURVED edge that keeps off the cards. G6's cubic, as before,
59781
- * unless that very curve -- sampled, not guessed from the
59782
- * rectangle round it -- would cross a card other than its own two,
59783
- * or when it does not run forward and so would cross its own:
59784
- * the card above a lower row of a stack, a row between a parent
59785
- * and a far child. Then it goes the way an elbow would (the comb,
59786
- * the detour, the route: the same lanes and staggered turns) with
59787
- * round corners, so it still reads as a curve. `-v` for rows
59788
- * stacked top to bottom, `-h` for columns.
59789
- ************************************************************/
59790
- function curve_key_path(edge, attributes, vertical, plain) {
59791
- let [s, t] = edge.getEndpoints(attributes, false);
59792
- let along = vertical ? 1 : 0;
59793
- let box_s = elbow_box(edge.sourceNode);
59794
- let box_t = elbow_box(edge.targetNode);
59795
- let boxes = elbow_obstacles(edge);
59796
- if (t[along] - s[along] > 20 && !curve_hits(plain, boxes, box_s, box_t)) return plain;
59797
- return rounded_path([
59798
- s,
59799
- ...elbow_route(s, t, box_s, box_t, elbow_lane_of(edge), vertical, boxes, elbow_stagger_of(edge, vertical)),
59800
- t
59801
- ], 24);
59802
- }
59803
- var TreedbCurveV = class extends _antv_g6.Cubic {
59804
- getKeyPath(attributes) {
59805
- return curve_key_path(this, attributes, true, super.getKeyPath(attributes));
59806
- }
59807
- };
59808
- var TreedbCurveH = class extends _antv_g6.CubicHorizontal {
59809
- getKeyPath(attributes) {
59810
- return curve_key_path(this, attributes, false, super.getKeyPath(attributes));
59811
- }
59812
- };
59813
- var TreedbCompactLayout = class extends _antv_g6.BaseLayout {
59814
- async execute(data, options) {
59815
- let input = treedb_layout_input(data);
59816
- return treedb_layout_output(layout_compact(input.nodes, input.edges, options));
59817
- }
59818
- };
59819
59147
  var TreedbRadialLayout = class extends _antv_g6.BaseLayout {
59820
59148
  async execute(data, options) {
59821
59149
  let input = treedb_layout_input(data);
@@ -65309,7 +64637,6 @@ function option_label(name) {
65309
64637
  case "edition": return (0, i18next.t)("edition");
65310
64638
  case "manual": return (0, i18next.t)("manual");
65311
64639
  case "treedb-tree": return (0, i18next.t)("treedb-tree");
65312
- case "compact-tree": return (0, i18next.t)("compact-tree");
65313
64640
  case "radial": return (0, i18next.t)("radial");
65314
64641
  case "dagre": return (0, i18next.t)("dagre");
65315
64642
  case "antv-dagre": return (0, i18next.t)("antv-dagre");