react-msaview-cli 9.1.1 → 9.2.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 (2) hide show
  1. package/dist/index.js +41 -15
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -46935,7 +46935,7 @@ function drawArcs({ ctx, arcs, color: color2, colWidth, trackHeight, offsetX, bl
46935
46935
  ctx.stroke();
46936
46936
  }
46937
46937
  }
46938
- function drawTextTrackContent({ ctx, data, colorScheme, contrastText, bgColor, drawLetters, colWidth, rowHeight, offsetX, blockSize }) {
46938
+ function drawTextTrackContent({ ctx, data, colorAt, contrastText, bgColor, drawLetters, colWidth, rowHeight, offsetX, blockSize }) {
46939
46939
  const { xStart, xEnd } = visibleColRange({
46940
46940
  offsetX,
46941
46941
  blockWidth: blockSize,
@@ -46944,9 +46944,9 @@ function drawTextTrackContent({ ctx, data, colorScheme, contrastText, bgColor, d
46944
46944
  const str = data?.slice(xStart, xEnd);
46945
46945
  for (let i2 = 0; str && i2 < str.length; i2++) {
46946
46946
  const letter = str[i2];
46947
- const upper = letter.toUpperCase();
46948
- const fill = bgColor ? colorScheme[upper] : void 0;
46949
- const x2 = (xStart + i2) * colWidth;
46947
+ const col = xStart + i2;
46948
+ const fill = bgColor ? colorAt(col, letter) : void 0;
46949
+ const x2 = col * colWidth;
46950
46950
  if (fill) {
46951
46951
  ctx.fillStyle = fill;
46952
46952
  ctx.fillRect(x2, 0, colWidth, rowHeight);
@@ -47106,15 +47106,19 @@ function drawTrackBlock({ model: model2, ctx, track, offsetX, offsetY = 0, theme
47106
47106
  });
47107
47107
  break;
47108
47108
  }
47109
- case "text": {
47109
+ case "text":
47110
+ case "reference": {
47110
47111
  const { bgColor, fontSize: fontSize2, rowHeight, showMsaLetters } = model2;
47112
+ const scheme = customColorScheme ?? model2.colorScheme;
47111
47113
  ctx.textAlign = "center";
47112
47114
  ctx.textBaseline = "middle";
47113
47115
  setFontSize(ctx, fontSize2);
47114
47116
  drawTextTrackContent({
47115
47117
  ctx,
47116
47118
  data,
47117
- colorScheme: customColorScheme ?? model2.colorScheme,
47119
+ // the reference row takes its colors from the alignment's own
47120
+ // scheme, per column under a dynamic one
47121
+ colorAt: kind === "reference" ? tileColorFn(model2) : (_col, letter) => scheme[letter.toUpperCase()],
47118
47122
  contrastText: contrastTextFn(theme),
47119
47123
  bgColor,
47120
47124
  drawLetters: showMsaLetters,
@@ -47151,6 +47155,7 @@ var init_drawTracks = __esm({
47151
47155
  init_sequenceLogo();
47152
47156
  init_setFontSize();
47153
47157
  init_util3();
47158
+ init_tileColor();
47154
47159
  init_visibleColRange();
47155
47160
  RULER_FONT_SIZE = 10;
47156
47161
  TICK_HEIGHT = 4;
@@ -85264,7 +85269,8 @@ var init_TrackTooltipContent = __esm({
85264
85269
  case "logo": {
85265
85270
  return import_react43.default.createElement(LogoTooltip, { model: model2, col });
85266
85271
  }
85267
- case "text": {
85272
+ case "text":
85273
+ case "reference": {
85268
85274
  return import_react43.default.createElement(TextTooltip, { model: model2, track, col });
85269
85275
  }
85270
85276
  case "arc": {
@@ -86496,7 +86502,7 @@ var version2;
86496
86502
  var init_version3 = __esm({
86497
86503
  "../lib/dist/version.js"() {
86498
86504
  "use strict";
86499
- version2 = "9.1.1";
86505
+ version2 = "9.2.0";
86500
86506
  }
86501
86507
  });
86502
86508
 
@@ -88825,16 +88831,15 @@ function trackGroups(model2) {
88825
88831
  const computed3 = new Set(model2.computedTrackModels.map((t3) => t3.model.id));
88826
88832
  const computedEntries = [];
88827
88833
  const alignmentEntries = [];
88834
+ const referenceEntries = [];
88828
88835
  for (const { model: t3 } of model2.tracks) {
88829
- ;
88830
- (computed3.has(t3.id) ? computedEntries : alignmentEntries).push({
88831
- id: t3.id,
88832
- label: t3.name
88833
- });
88836
+ const entries3 = t3.kind === "reference" ? referenceEntries : computed3.has(t3.id) ? computedEntries : alignmentEntries;
88837
+ entries3.push({ id: t3.id, label: t3.name });
88834
88838
  }
88835
88839
  return [
88836
88840
  { title: "Computed from the alignment", entries: computedEntries },
88837
- { title: "Alignment annotations", entries: alignmentEntries }
88841
+ { title: "Alignment annotations", entries: alignmentEntries },
88842
+ { title: "Reference row", entries: referenceEntries }
88838
88843
  ].filter((g2) => g2.entries.length > 0);
88839
88844
  }
88840
88845
  var import_react89, import_mobx_react64, filterFrom, TrackList, TrackList_default;
@@ -94648,6 +94653,26 @@ function stateModelFactory({ maxInlineSnapshotBytes: maxInlineSnapshotBytes2 = m
94648
94653
  }
94649
94654
  }));
94650
94655
  },
94656
+ /**
94657
+ * #getter
94658
+ * the reference row (`relativeTo`) repeated above the alignment, so it
94659
+ * stays in view while the rows compared against it scroll
94660
+ */
94661
+ get referenceTrackModels() {
94662
+ const { relativeTo } = self;
94663
+ const data = relativeTo === void 0 ? void 0 : self.columns.get(relativeTo);
94664
+ return relativeTo === void 0 || data === void 0 ? [] : [
94665
+ {
94666
+ model: {
94667
+ id: "reference-row",
94668
+ name: relativeTo,
94669
+ kind: "reference",
94670
+ data,
94671
+ height: self.rowHeight
94672
+ }
94673
+ }
94674
+ ];
94675
+ },
94651
94676
  get tracks() {
94652
94677
  return [
94653
94678
  ...this.adapterTrackModels,
@@ -94655,7 +94680,8 @@ function stateModelFactory({ maxInlineSnapshotBytes: maxInlineSnapshotBytes2 = m
94655
94680
  ...self.columnTrackModels,
94656
94681
  // every computed track reads the alignment's columns, and a tree, a
94657
94682
  // GFF and a features panel draw a figure with none
94658
- ...self.numColumns > 0 ? this.computedTrackModels : []
94683
+ ...self.numColumns > 0 ? this.computedTrackModels : [],
94684
+ ...this.referenceTrackModels
94659
94685
  ];
94660
94686
  },
94661
94687
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-msaview-cli",
3
- "version": "9.1.1",
3
+ "version": "9.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "@types/node": "^26.6.5",
21
21
  "esbuild": "^0.28.2",
22
22
  "mobx-react": "^10.0.2",
23
- "msa-parsers": "9.1.1",
24
- "react-msaview": "9.1.1"
23
+ "msa-parsers": "9.2.0",
24
+ "react-msaview": "9.2.0"
25
25
  },
26
26
  "dependencies": {
27
27
  "jsdom": "^30.1.3"