@jbrowse/bandage-core 11.12.0 → 11.13.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.
Files changed (31) hide show
  1. package/dist/chunks/{chunk-5UIYXKTA.js → chunk-7AZ57C5C.js} +5 -5
  2. package/dist/chunks/{chunk-QOY6SPOS.js → chunk-ANWUCJZB.js} +2 -2
  3. package/dist/chunks/{chunk-Q2AMKXAX.js → chunk-C5FEIJFK.js} +6 -6
  4. package/dist/chunks/{chunk-JQYK6GVJ.js → chunk-EOB4Y3EM.js} +1 -1
  5. package/dist/chunks/{chunk-6ROK45LO.js → chunk-HL4U73TC.js} +2 -2
  6. package/dist/chunks/{chunk-EH5OIV2E.js → chunk-JUYPCLF4.js} +102 -36
  7. package/dist/chunks/{chunk-GGFR4SYO.js → chunk-K4RGSISK.js} +1 -1
  8. package/dist/chunks/{chunk-TOGXPJK7.js → chunk-OCYQIHFA.js} +1 -1
  9. package/dist/chunks/{chunk-A6ABMJR5.js → chunk-OYBYCF2O.js} +1 -1
  10. package/dist/chunks/{chunk-T2LYWZ5Q.js → chunk-QL673EK5.js} +1 -1
  11. package/dist/chunks/chunk-YUIKEUKY.js +919 -0
  12. package/dist/chunks/{chunk-UFF34SGO.js → chunk-ZHCQOC67.js} +1 -1
  13. package/dist/cli/figure.js +10 -10
  14. package/dist/figure.js +9 -9
  15. package/dist/figureData.js +7 -7
  16. package/dist/figureScene.js +5 -5
  17. package/dist/index.js +12 -12
  18. package/dist/layout/walkRowDraw.js +3 -3
  19. package/dist/layout/walkStrip.js +4 -4
  20. package/dist/referenceStrip.js +3 -3
  21. package/dist/renderer/GeometryBuilder.js +2 -2
  22. package/dist/renderer/walkLanes.js +3 -1
  23. package/dist/tubeMap/nodeColors.js +3 -3
  24. package/dist/types/renderer/types.d.ts +1 -0
  25. package/dist/types/renderer/walkLanes.d.ts +32 -18
  26. package/dist/types/version.d.ts +1 -1
  27. package/dist/version.js +1 -1
  28. package/dist/walkEncoding.js +3 -3
  29. package/dist/walkHighlight.js +4 -4
  30. package/package.json +1 -1
  31. package/dist/chunks/chunk-4KBZ7WPP.js +0 -579
@@ -12,21 +12,21 @@ import {
12
12
  } from "./chunk-HEYIAMTC.js";
13
13
  import {
14
14
  version
15
- } from "./chunk-TOGXPJK7.js";
15
+ } from "./chunk-OCYQIHFA.js";
16
16
  import {
17
17
  axisScaleOf
18
18
  } from "./chunk-OKPSS5PG.js";
19
19
  import {
20
20
  figureScene
21
- } from "./chunk-6ROK45LO.js";
21
+ } from "./chunk-HL4U73TC.js";
22
22
  import {
23
23
  encodingStops
24
- } from "./chunk-JQYK6GVJ.js";
24
+ } from "./chunk-EOB4Y3EM.js";
25
25
  import {
26
26
  laneSlideAt,
27
27
  passesKey,
28
28
  threadsPasses
29
- } from "./chunk-4KBZ7WPP.js";
29
+ } from "./chunk-YUIKEUKY.js";
30
30
  import {
31
31
  abgrAlpha,
32
32
  abgrBlue,
@@ -247,7 +247,7 @@ function figureData(graph, layout, o = {}) {
247
247
  pass: s.pass ?? null,
248
248
  nx: s.normals?.[k]?.nx ?? 0,
249
249
  ny: s.normals?.[k]?.ny ?? 0,
250
- offset: (s.offsetX ?? 0) * axis.scaleX
250
+ offset: (s.offsets?.[k] ?? s.offsetX ?? 0) * axis.scaleX
251
251
  });
252
252
  });
253
253
  }
@@ -2,10 +2,10 @@ import {
2
2
  encodedColor,
3
3
  resolveEncoding,
4
4
  splitFamilies
5
- } from "./chunk-JQYK6GVJ.js";
5
+ } from "./chunk-EOB4Y3EM.js";
6
6
  import {
7
7
  rampFraction
8
- } from "./chunk-EH5OIV2E.js";
8
+ } from "./chunk-JUYPCLF4.js";
9
9
  import {
10
10
  gapParts
11
11
  } from "./chunk-LG2UK4MB.js";
@@ -5,7 +5,7 @@ import {
5
5
  stripGeneGaps,
6
6
  walkStripFrame,
7
7
  walkStripLabelsTree
8
- } from "./chunk-T2LYWZ5Q.js";
8
+ } from "./chunk-QL673EK5.js";
9
9
  import {
10
10
  Canvas2DRenderer
11
11
  } from "./chunk-4DMSPNYV.js";
@@ -13,7 +13,7 @@ import {
13
13
  walkRowsKey,
14
14
  walkRowsKeyTree,
15
15
  walkRowsTree
16
- } from "./chunk-A6ABMJR5.js";
16
+ } from "./chunk-OYBYCF2O.js";
17
17
  import {
18
18
  EXON_COLOR,
19
19
  exonOutlineTree,
@@ -30,21 +30,21 @@ import {
30
30
  } from "./chunk-HEYIAMTC.js";
31
31
  import {
32
32
  version
33
- } from "./chunk-TOGXPJK7.js";
33
+ } from "./chunk-OCYQIHFA.js";
34
34
  import {
35
35
  axisScaleOf
36
36
  } from "./chunk-OKPSS5PG.js";
37
37
  import {
38
38
  figureScene
39
- } from "./chunk-6ROK45LO.js";
39
+ } from "./chunk-HL4U73TC.js";
40
40
  import {
41
41
  encodingStops
42
- } from "./chunk-JQYK6GVJ.js";
42
+ } from "./chunk-EOB4Y3EM.js";
43
43
  import {
44
44
  THREAD_PX,
45
45
  passesKey,
46
46
  threadsPasses
47
- } from "./chunk-4KBZ7WPP.js";
47
+ } from "./chunk-YUIKEUKY.js";
48
48
  import {
49
49
  rangeText
50
50
  } from "./chunk-IZKM4NY7.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  REFERENCE_RAMP_ALT_COLOR,
3
3
  hslToRgb
4
- } from "./chunk-EH5OIV2E.js";
4
+ } from "./chunk-JUYPCLF4.js";
5
5
  import {
6
6
  packAbgr
7
7
  } from "./chunk-G2FD7S3C.js";
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  facetLifts,
6
6
  walkLift
7
- } from "./chunk-QOY6SPOS.js";
7
+ } from "./chunk-ANWUCJZB.js";
8
8
  import {
9
9
  buildGeometry,
10
10
  computeReferenceRamp
11
- } from "./chunk-EH5OIV2E.js";
11
+ } from "./chunk-JUYPCLF4.js";
12
12
  import {
13
13
  walkKey
14
14
  } from "./chunk-IZKM4NY7.js";
@@ -6,8 +6,9 @@ import {
6
6
  laneSlideAt,
7
7
  liftLanes,
8
8
  slotCentres,
9
- threadsPasses
10
- } from "./chunk-4KBZ7WPP.js";
9
+ threadsPasses,
10
+ walkSteps
11
+ } from "./chunk-YUIKEUKY.js";
11
12
  import {
12
13
  abgrToCssRgba,
13
14
  fadeAbgr,
@@ -214,9 +215,10 @@ function pointNormalsOf(rawPoints, yToX = 1) {
214
215
  function offsetPolyline(points, normals, distance, yToX = 1) {
215
216
  const out = new Array(points.length);
216
217
  for (let i = 0; i < points.length; i++) {
218
+ const d = typeof distance === "number" ? distance : distance[i];
217
219
  out[i] = {
218
- x: points[i].x + normals[i].nx * distance,
219
- y: points[i].y + normals[i].ny * distance / yToX
220
+ x: points[i].x + normals[i].nx * d,
221
+ y: points[i].y + normals[i].ny * d / yToX
220
222
  };
221
223
  }
222
224
  return out;
@@ -473,6 +475,7 @@ function pathSlotsOf(graph) {
473
475
  return slots;
474
476
  }
475
477
  var lanesCache = weakMemo();
478
+ var stepsCache = weakMemo();
476
479
  var linksCache = /* @__PURE__ */ new WeakMap();
477
480
  function linksOf(graph) {
478
481
  let links = linksCache.get(graph);
@@ -550,7 +553,20 @@ function buildGeometry(options) {
550
553
  const fields = highlight && liftedWalks.length > 1 ? lanesCache(
551
554
  highlight,
552
555
  [nodePositions, version, axis.scaleX, axis.scaleY],
553
- () => liftLanes(liftedWalks, nodePositions, yToX, worldPerScreenPx)
556
+ () => liftLanes(
557
+ liftedWalks,
558
+ nodePositions,
559
+ yToX,
560
+ worldPerScreenPx,
561
+ stepsCache(
562
+ highlight,
563
+ [nodePositions, version],
564
+ () => walkSteps(
565
+ liftedWalks.map((w) => w.route),
566
+ nodePositions
567
+ )
568
+ )
569
+ )
554
570
  ) : void 0;
555
571
  const lines = fields?.lines;
556
572
  const threads = fields?.threads;
@@ -567,14 +583,32 @@ function buildGeometry(options) {
567
583
  return centres;
568
584
  };
569
585
  const laneOffset = (nodeId, laneWidth, lane, pass) => threaded ? (centresOf(nodeId)[lane] + pass * THREAD_PITCH_PX) * thinned : (lane - (liftedWalks.length - 1) / 2) * laneWidth;
586
+ const threadOffsetAt = (frame, at, fallback) => {
587
+ const eased = frame?.offsets?.[at] ?? frame?.offset;
588
+ return eased === void 0 ? fallback : eased * thinned;
589
+ };
570
590
  const laneHalfWidth = (laneWidth) => threaded ? THREAD_PX / 2 * thinned : laneWidth / 2;
571
- const laneNormals = /* @__PURE__ */ new Map();
572
- const laneNormalsOf = (nodeId, segments) => {
573
- let normals = laneNormals.get(nodeId);
591
+ const plainNormals = /* @__PURE__ */ new Map();
592
+ const visitNormals = /* @__PURE__ */ new WeakMap();
593
+ const visitOf = (lane, nodeId, thread) => threads?.[lane]?.threadPasses.get(nodeId)?.[thread] ?? 0;
594
+ const plainNormalsOf = (nodeId, segments) => {
595
+ let normals = plainNormals.get(nodeId);
596
+ if (!normals) {
597
+ normals = pointNormalsOf(segments, yToX);
598
+ plainNormals.set(nodeId, normals);
599
+ }
600
+ return normals;
601
+ };
602
+ const laneNormalsOf = (nodeId, segments, frame) => {
603
+ if (!frame) {
604
+ return plainNormalsOf(nodeId, segments);
605
+ }
606
+ let normals = visitNormals.get(frame.normals);
574
607
  if (!normals) {
575
- const smoothed = lines?.normals.get(nodeId);
576
- normals = smoothed ? pointNormalsOf(segments, yToX).map((n, i) => smoothed[i] ?? n) : pointNormalsOf(segments, yToX);
577
- laneNormals.set(nodeId, normals);
608
+ normals = plainNormalsOf(nodeId, segments).map(
609
+ (n, i) => frame.normals[i] ?? n
610
+ );
611
+ visitNormals.set(frame.normals, normals);
578
612
  }
579
613
  return normals;
580
614
  };
@@ -591,14 +625,14 @@ function buildGeometry(options) {
591
625
  }
592
626
  return width;
593
627
  };
594
- const laneShiftOf = (nodeId, index) => lines?.shifts.get(nodeId)?.[index] ?? NO_SHIFT;
595
- const laneEndOf = (id, segments, atStart) => {
628
+ const laneEndOf = (id, frames, segments, atStart, lane, thread) => {
596
629
  const at = atStart ? 0 : segments.length - 1;
630
+ const frame = frames?.[lane]?.[visitOf(lane, id, thread)];
631
+ const eased = frame?.offsets?.[at] ?? frame?.offset;
597
632
  return {
598
- id,
599
- laneWidth: laneWidthOf(id),
600
- normal: laneNormalsOf(id, segments)[at] ?? { nx: 0, ny: 0 },
601
- shift: laneShiftOf(id, at)
633
+ normal: frame?.normals[at] ?? plainNormalsOf(id, segments)[at] ?? { nx: 0, ny: 0 },
634
+ shift: frame?.shifts[at] ?? NO_SHIFT,
635
+ offset: eased === void 0 ? laneOffset(id, laneWidthOf(id), lane, thread) : eased * thinned
602
636
  };
603
637
  };
604
638
  const lanesMayShow = (curves, fromId) => {
@@ -628,10 +662,22 @@ function buildGeometry(options) {
628
662
  return ahead ? [...ahead, ...turned] : turned;
629
663
  };
630
664
  const threadColor = (lane, nodeId, thread) => liftedWalks[lane]?.passColors.get(nodeId)?.[threads?.[lane]?.threadPasses.get(nodeId)?.[thread] ?? 0];
631
- const lanePointsOf = (nodeId, segments) => lines?.shifts.has(nodeId) ? segments.map((p, i) => {
632
- const { dx, dy } = laneShiftOf(nodeId, i);
633
- return { ...p, x: p.x + dx, y: p.y + dy };
634
- }) : segments;
665
+ const visitPoints = /* @__PURE__ */ new WeakMap();
666
+ const lanePointsOf = (segments, frame) => {
667
+ if (!frame || !threaded) {
668
+ return segments;
669
+ }
670
+ let points = visitPoints.get(frame.shifts);
671
+ if (!points) {
672
+ const { shifts } = frame;
673
+ points = segments.map((p, i) => {
674
+ const { dx, dy } = shifts[i] ?? NO_SHIFT;
675
+ return { ...p, x: p.x + dx, y: p.y + dy };
676
+ });
677
+ visitPoints.set(frame.shifts, points);
678
+ }
679
+ return points;
680
+ };
635
681
  const showArrows = scale > (linearLayout ? 1 : MIN_ARROW_SCALE);
636
682
  for (let ei = 0; ei < graph.edges.length; ei++) {
637
683
  const edge = graph.edges[ei];
@@ -718,27 +764,40 @@ function buildGeometry(options) {
718
764
  continue;
719
765
  }
720
766
  if (laneWalks) {
721
- const from = laneEndOf(
722
- edge.from,
767
+ const fromAtStart = leavesStart(
768
+ edge,
723
769
  fromSegments,
724
- leavesStart(edge, fromSegments, baseCurves[0], stranded, yToX)
770
+ baseCurves[0],
771
+ stranded,
772
+ yToX
725
773
  );
726
774
  const last = baseCurves.at(-1);
727
- const to = threaded ? laneEndOf(
728
- edge.to,
775
+ const toAtStart = nearerStart(
776
+ { x: last.x1, y: last.y1 },
729
777
  toSegments,
730
- nearerStart({ x: last.x1, y: last.y1 }, toSegments, yToX)
731
- ) : from;
778
+ yToX
779
+ );
732
780
  const single = laneWalks.length === 1;
733
- const thickness = laneHalfWidth(from.laneWidth);
781
+ const thickness = laneHalfWidth(laneWidthOf(edge.from));
782
+ const fromFrames = lines?.frames.get(edge.from);
783
+ const toFrames = lines?.frames.get(edge.to);
734
784
  for (let lane = 0; lane < laneWalks.length; lane++) {
735
785
  const walk = laneWalks[lane];
736
786
  if (!walk.edgeIndexes.has(ei)) {
737
787
  continue;
738
788
  }
739
789
  for (const [pass, toPass] of threadPairs(lane, edge.from, edge.to)) {
740
- const offsetX = single ? 0 : laneOffset(from.id, from.laneWidth, lane, pass) * worldPerScreenPx;
741
- const endOffsetX = threaded ? laneOffset(to.id, to.laneWidth, lane, toPass) * worldPerScreenPx : offsetX;
790
+ const from = laneEndOf(
791
+ edge.from,
792
+ fromFrames,
793
+ fromSegments,
794
+ fromAtStart,
795
+ lane,
796
+ pass
797
+ );
798
+ const to = threaded ? laneEndOf(edge.to, toFrames, toSegments, toAtStart, lane, toPass) : from;
799
+ const offsetX = single ? 0 : from.offset * worldPerScreenPx;
800
+ const endOffsetX = threaded ? to.offset * worldPerScreenPx : offsetX;
742
801
  const curves = threaded ? slideCurves(
743
802
  baseCurves,
744
803
  from.shift.dx + from.normal.nx * offsetX,
@@ -832,9 +891,8 @@ function buildGeometry(options) {
832
891
  const lanes = highlight?.walks.length && !faded && !slots?.length ? highlight.walks : void 0;
833
892
  if (drawable && lanes) {
834
893
  const laneWidth = walkLaneWidthPx(width, lanes.length);
835
- const normals = lanes.length > 1 ? laneNormalsOf(nodeId, segments) : [];
836
- const points = lanes.length > 1 ? lanePointsOf(nodeId, segments) : segments;
837
894
  const thickness = laneHalfWidth(laneWidth);
895
+ const frames = lines?.frames.get(nodeId);
838
896
  for (let lane = 0; lane < lanes.length; lane++) {
839
897
  const laneColor = lanes[lane].colors.get(nodeId);
840
898
  if (laneColor === void 0) {
@@ -853,15 +911,23 @@ function buildGeometry(options) {
853
911
  });
854
912
  continue;
855
913
  }
856
- const offsetX = laneOffset(nodeId, laneWidth, lane, pass) * worldPerScreenPx;
914
+ const frame = frames?.[lane]?.[visitOf(lane, nodeId, pass)];
915
+ const normals = laneNormalsOf(nodeId, segments, frame);
916
+ const points = lanePointsOf(segments, frame);
917
+ const plain = laneOffset(nodeId, laneWidth, lane, pass);
918
+ const offsets = frame?.offsets?.map(
919
+ (o) => o * thinned * worldPerScreenPx
920
+ );
921
+ const offsetX = offsets ? offsets[Math.floor(offsets.length / 2)] : threadOffsetAt(frame, 0, plain) * worldPerScreenPx;
857
922
  nodeStrokes.push({
858
- points: offsetPolyline(points, normals, offsetX, yToX),
923
+ points: offsetPolyline(points, normals, offsets ?? offsetX, yToX),
859
924
  thickness,
860
925
  color: color2,
861
926
  walk: lane,
862
927
  pass,
863
928
  normals,
864
- offsetX
929
+ offsetX,
930
+ ...offsets && { offsets }
865
931
  });
866
932
  }
867
933
  }
@@ -2,7 +2,7 @@ import {
2
2
  LIFT_BACKDROP_CSS,
3
3
  computeColorSchemeRange,
4
4
  getNodeColor
5
- } from "./chunk-EH5OIV2E.js";
5
+ } from "./chunk-JUYPCLF4.js";
6
6
  import {
7
7
  abgrToCssRgba
8
8
  } from "./chunk-G2FD7S3C.js";
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var version = "11.12.0";
2
+ var version = "11.13.0";
3
3
 
4
4
  export {
5
5
  version
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  REFERENCE_RAMP_ALT_CSS
3
- } from "./chunk-EH5OIV2E.js";
3
+ } from "./chunk-JUYPCLF4.js";
4
4
  import {
5
5
  RAMP_GRADIENT_CSS,
6
6
  RAMP_GRADIENT_STOPS,
@@ -3,7 +3,7 @@ import {
3
3
  boxesGenes,
4
4
  rowPitch,
5
5
  rowSpan
6
- } from "./chunk-A6ABMJR5.js";
6
+ } from "./chunk-OYBYCF2O.js";
7
7
  import {
8
8
  READOUT_ROOM,
9
9
  longestBar