@genspectrum/dashboard-components 1.9.0 → 1.9.1

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.
@@ -1653,7 +1653,7 @@ declare global {
1653
1653
 
1654
1654
  declare global {
1655
1655
  interface HTMLElementTagNameMap {
1656
- 'gs-genome-data-viewer': GenomeDataViewerComponent;
1656
+ 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1657
1657
  }
1658
1658
  }
1659
1659
 
@@ -1661,7 +1661,7 @@ declare global {
1661
1661
  declare global {
1662
1662
  namespace JSX {
1663
1663
  interface IntrinsicElements {
1664
- 'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1664
+ 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1665
1665
  }
1666
1666
  }
1667
1667
  }
@@ -1669,7 +1669,7 @@ declare global {
1669
1669
 
1670
1670
  declare global {
1671
1671
  interface HTMLElementTagNameMap {
1672
- 'gs-mutation-comparison-component': MutationComparisonComponent;
1672
+ 'gs-genome-data-viewer': GenomeDataViewerComponent;
1673
1673
  }
1674
1674
  }
1675
1675
 
@@ -1677,7 +1677,7 @@ declare global {
1677
1677
  declare global {
1678
1678
  namespace JSX {
1679
1679
  interface IntrinsicElements {
1680
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1680
+ 'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1681
1681
  }
1682
1682
  }
1683
1683
  }
@@ -1685,7 +1685,7 @@ declare global {
1685
1685
 
1686
1686
  declare global {
1687
1687
  interface HTMLElementTagNameMap {
1688
- 'gs-mutations': MutationsComponent;
1688
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
1689
1689
  }
1690
1690
  }
1691
1691
 
@@ -1693,7 +1693,7 @@ declare global {
1693
1693
  declare global {
1694
1694
  namespace JSX {
1695
1695
  interface IntrinsicElements {
1696
- 'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1696
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1697
1697
  }
1698
1698
  }
1699
1699
  }
@@ -1701,7 +1701,7 @@ declare global {
1701
1701
 
1702
1702
  declare global {
1703
1703
  interface HTMLElementTagNameMap {
1704
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1704
+ 'gs-mutations': MutationsComponent;
1705
1705
  }
1706
1706
  }
1707
1707
 
@@ -1709,7 +1709,7 @@ declare global {
1709
1709
  declare global {
1710
1710
  namespace JSX {
1711
1711
  interface IntrinsicElements {
1712
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1712
+ 'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1713
1713
  }
1714
1714
  }
1715
1715
  }
@@ -1717,7 +1717,7 @@ declare global {
1717
1717
 
1718
1718
  declare global {
1719
1719
  interface HTMLElementTagNameMap {
1720
- 'gs-aggregate': AggregateComponent;
1720
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1721
1721
  }
1722
1722
  }
1723
1723
 
@@ -1725,7 +1725,7 @@ declare global {
1725
1725
  declare global {
1726
1726
  namespace JSX {
1727
1727
  interface IntrinsicElements {
1728
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1728
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1729
1729
  }
1730
1730
  }
1731
1731
  }
@@ -1733,7 +1733,7 @@ declare global {
1733
1733
 
1734
1734
  declare global {
1735
1735
  interface HTMLElementTagNameMap {
1736
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1736
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1737
1737
  }
1738
1738
  }
1739
1739
 
@@ -1741,7 +1741,7 @@ declare global {
1741
1741
  declare global {
1742
1742
  namespace JSX {
1743
1743
  interface IntrinsicElements {
1744
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1744
+ 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1745
1745
  }
1746
1746
  }
1747
1747
  }
@@ -1749,7 +1749,7 @@ declare global {
1749
1749
 
1750
1750
  declare global {
1751
1751
  interface HTMLElementTagNameMap {
1752
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1752
+ 'gs-aggregate': AggregateComponent;
1753
1753
  }
1754
1754
  }
1755
1755
 
@@ -1757,7 +1757,7 @@ declare global {
1757
1757
  declare global {
1758
1758
  namespace JSX {
1759
1759
  interface IntrinsicElements {
1760
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1760
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1761
1761
  }
1762
1762
  }
1763
1763
  }
@@ -1765,7 +1765,7 @@ declare global {
1765
1765
 
1766
1766
  declare global {
1767
1767
  interface HTMLElementTagNameMap {
1768
- 'gs-sequences-by-location': SequencesByLocationComponent;
1768
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1769
1769
  }
1770
1770
  }
1771
1771
 
@@ -1773,7 +1773,7 @@ declare global {
1773
1773
  declare global {
1774
1774
  namespace JSX {
1775
1775
  interface IntrinsicElements {
1776
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1776
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1777
1777
  }
1778
1778
  }
1779
1779
  }
@@ -1797,7 +1797,7 @@ declare global {
1797
1797
 
1798
1798
  declare global {
1799
1799
  interface HTMLElementTagNameMap {
1800
- 'gs-statistics': StatisticsComponent;
1800
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1801
1801
  }
1802
1802
  }
1803
1803
 
@@ -1805,7 +1805,7 @@ declare global {
1805
1805
  declare global {
1806
1806
  namespace JSX {
1807
1807
  interface IntrinsicElements {
1808
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1808
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1809
1809
  }
1810
1810
  }
1811
1811
  }
@@ -1813,11 +1813,7 @@ declare global {
1813
1813
 
1814
1814
  declare global {
1815
1815
  interface HTMLElementTagNameMap {
1816
- 'gs-date-range-filter': DateRangeFilterComponent;
1817
- }
1818
- interface HTMLElementEventMap {
1819
- [gsEventNames.dateRangeFilterChanged]: CustomEvent<Record<string, string>>;
1820
- [gsEventNames.dateRangeOptionChanged]: DateRangeOptionChangedEvent;
1816
+ 'gs-statistics': StatisticsComponent;
1821
1817
  }
1822
1818
  }
1823
1819
 
@@ -1825,7 +1821,7 @@ declare global {
1825
1821
  declare global {
1826
1822
  namespace JSX {
1827
1823
  interface IntrinsicElements {
1828
- 'gs-date-range-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1824
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1829
1825
  }
1830
1826
  }
1831
1827
  }
@@ -1833,7 +1829,10 @@ declare global {
1833
1829
 
1834
1830
  declare global {
1835
1831
  interface HTMLElementTagNameMap {
1836
- 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1832
+ 'gs-location-filter': LocationFilterComponent;
1833
+ }
1834
+ interface HTMLElementEventMap {
1835
+ [gsEventNames.locationChanged]: LocationChangedEvent;
1837
1836
  }
1838
1837
  }
1839
1838
 
@@ -1841,7 +1840,7 @@ declare global {
1841
1840
  declare global {
1842
1841
  namespace JSX {
1843
1842
  interface IntrinsicElements {
1844
- 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1843
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1845
1844
  }
1846
1845
  }
1847
1846
  }
@@ -1849,10 +1848,11 @@ declare global {
1849
1848
 
1850
1849
  declare global {
1851
1850
  interface HTMLElementTagNameMap {
1852
- 'gs-location-filter': LocationFilterComponent;
1851
+ 'gs-date-range-filter': DateRangeFilterComponent;
1853
1852
  }
1854
1853
  interface HTMLElementEventMap {
1855
- [gsEventNames.locationChanged]: LocationChangedEvent;
1854
+ [gsEventNames.dateRangeFilterChanged]: CustomEvent<Record<string, string>>;
1855
+ [gsEventNames.dateRangeOptionChanged]: DateRangeOptionChangedEvent;
1856
1856
  }
1857
1857
  }
1858
1858
 
@@ -1860,7 +1860,7 @@ declare global {
1860
1860
  declare global {
1861
1861
  namespace JSX {
1862
1862
  interface IntrinsicElements {
1863
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1863
+ 'gs-date-range-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1864
1864
  }
1865
1865
  }
1866
1866
  }
@@ -15396,27 +15396,35 @@ async function fetchLineageAutocompleteList({
15396
15396
  lapisFilter,
15397
15397
  signal
15398
15398
  }) {
15399
- const [countsByLineage, lineageTree] = await Promise.all([
15399
+ const [countsByLineage, { lineageTree, aliasMapping }] = await Promise.all([
15400
15400
  getCountsByLineage({
15401
15401
  lapisUrl,
15402
15402
  lapisField,
15403
15403
  lapisFilter,
15404
15404
  signal
15405
15405
  }),
15406
- getLineageTree({ lapisUrl, lapisField, signal })
15406
+ getLineageTreeAndAliases({ lapisUrl, lapisField, signal })
15407
15407
  ]);
15408
- return Array.from(lineageTree.keys()).sort((a2, b2) => a2.localeCompare(b2)).map((lineage2) => {
15409
- return [
15410
- {
15411
- lineage: lineage2,
15412
- count: countsByLineage.get(lineage2) ?? 0
15413
- },
15414
- {
15415
- lineage: `${lineage2}*`,
15416
- count: getCountsIncludingSublineages(lineage2, lineageTree, countsByLineage)
15417
- }
15418
- ];
15419
- }).flat();
15408
+ const prefixToLineage = findMissingPrefixMappings(lineageTree, aliasMapping);
15409
+ const actualLineageItems = Array.from(lineageTree.keys()).flatMap((lineage2) => [
15410
+ {
15411
+ lineage: lineage2,
15412
+ count: countsByLineage.get(lineage2) ?? 0
15413
+ },
15414
+ {
15415
+ lineage: `${lineage2}*`,
15416
+ count: getCountsIncludingSublineages(lineage2, lineageTree, countsByLineage)
15417
+ }
15418
+ ]);
15419
+ const prefixAliasItems = Array.from(prefixToLineage.entries()).map(([prefix, actualLineage]) => ({
15420
+ lineage: `${prefix}*`,
15421
+ count: getCountsIncludingSublineages(actualLineage, lineageTree, countsByLineage)
15422
+ }));
15423
+ return [...actualLineageItems, ...prefixAliasItems].sort((a2, b2) => {
15424
+ const aKey = a2.lineage.replace(/\*/g, " ");
15425
+ const bKey = b2.lineage.replace(/\*/g, " ");
15426
+ return aKey.localeCompare(bKey);
15427
+ });
15420
15428
  }
15421
15429
  async function getCountsByLineage({
15422
15430
  lapisUrl,
@@ -15430,18 +15438,22 @@ async function getCountsByLineage({
15430
15438
  const countsByLineageArray = (await fetchAggregatedOperator.evaluate(lapisUrl, signal)).content;
15431
15439
  return new Map(countsByLineageArray.map((value) => [value[lapisField], value.count]));
15432
15440
  }
15433
- async function getLineageTree({
15441
+ async function getLineageTreeAndAliases({
15434
15442
  lapisUrl,
15435
15443
  lapisField,
15436
15444
  signal
15437
15445
  }) {
15438
15446
  const lineageDefinitions = await fetchLineageDefinition({ lapisUrl, lapisField, signal });
15439
15447
  const lineageTree = /* @__PURE__ */ new Map();
15448
+ const aliasMapping = /* @__PURE__ */ new Map();
15440
15449
  Object.entries(lineageDefinitions).forEach(([lineage2, definition]) => {
15441
15450
  var _a;
15442
15451
  if (!lineageTree.has(lineage2)) {
15443
15452
  lineageTree.set(lineage2, { children: [] });
15444
15453
  }
15454
+ if (definition.aliases && definition.aliases.length > 0) {
15455
+ aliasMapping.set(lineage2, definition.aliases);
15456
+ }
15445
15457
  (_a = definition.parents) == null ? void 0 : _a.forEach((parent) => {
15446
15458
  var _a2;
15447
15459
  const parentChildren = (_a2 = lineageTree.get(parent)) == null ? void 0 : _a2.children;
@@ -15449,7 +15461,7 @@ async function getLineageTree({
15449
15461
  lineageTree.set(parent, { children: newParentChildren });
15450
15462
  });
15451
15463
  });
15452
- return lineageTree;
15464
+ return { lineageTree, aliasMapping };
15453
15465
  }
15454
15466
  function getCountsIncludingSublineages(lineage2, lineageTree, countsByLineage) {
15455
15467
  const descendants = getAllDescendants(lineage2, lineageTree);
@@ -15467,6 +15479,29 @@ function getAllDescendants(lineage2, lineageTree) {
15467
15479
  });
15468
15480
  return /* @__PURE__ */ new Set([...children, ...childrenOfChildren.flatMap((child) => Array.from(child))]);
15469
15481
  }
15482
+ function findMissingPrefixMappings(lineageTree, aliasMapping) {
15483
+ const lineages = Array.from(lineageTree.keys());
15484
+ const lineagesSet = new Set(lineages);
15485
+ const allPrefixes = lineages.flatMap((lineage2) => {
15486
+ const parts = lineage2.split(".");
15487
+ return parts.map((_2, i2) => parts.slice(0, i2 + 1).join("."));
15488
+ });
15489
+ const missingPrefixes = new Set(allPrefixes.filter((prefix) => !lineagesSet.has(prefix)));
15490
+ const reverseAliasMapping = /* @__PURE__ */ new Map();
15491
+ aliasMapping.forEach((aliases, lineage2) => {
15492
+ aliases.forEach((alias) => {
15493
+ reverseAliasMapping.set(alias, lineage2);
15494
+ });
15495
+ });
15496
+ const prefixToLineage = /* @__PURE__ */ new Map();
15497
+ missingPrefixes.forEach((prefix) => {
15498
+ const actualLineage = reverseAliasMapping.get(prefix);
15499
+ if (actualLineage) {
15500
+ prefixToLineage.set(prefix, actualLineage);
15501
+ }
15502
+ });
15503
+ return prefixToLineage;
15504
+ }
15470
15505
  const lineageSelectorPropsSchema = z$2.object({
15471
15506
  lapisField: z$2.string().min(1),
15472
15507
  placeholderText: z$2.string().optional(),