@genspectrum/dashboard-components 0.13.7 → 0.14.2

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 (82) hide show
  1. package/custom-elements.json +24 -62
  2. package/dist/{LineageFilterChangedEvent-GedKNGFI.js → LineageFilterChangedEvent-C9dXOxt6.js} +11 -3
  3. package/dist/LineageFilterChangedEvent-C9dXOxt6.js.map +1 -0
  4. package/dist/assets/mutationOverTimeWorker-Dxnxrfe0.js.map +1 -1
  5. package/dist/components.d.ts +40 -50
  6. package/dist/components.js +112 -91
  7. package/dist/components.js.map +1 -1
  8. package/dist/util.d.ts +38 -28
  9. package/dist/util.js +1 -1
  10. package/package.json +2 -2
  11. package/src/lapisApi/lapisApi.ts +1 -1
  12. package/src/operator/FillMissingOperator.spec.ts +1 -1
  13. package/src/operator/GroupByAndSumOperator.spec.ts +1 -1
  14. package/src/operator/GroupByOperator.spec.ts +2 -2
  15. package/src/operator/MapOperator.spec.ts +1 -1
  16. package/src/operator/MockOperator.spec.ts +1 -1
  17. package/src/operator/MockOperator.ts +6 -4
  18. package/src/operator/SortOperator.spec.ts +1 -1
  19. package/src/preact/LapisUrlContext.ts +14 -1
  20. package/src/preact/aggregatedData/aggregate.stories.tsx +4 -4
  21. package/src/preact/aggregatedData/aggregate.tsx +3 -4
  22. package/src/preact/components/csv-download-button.stories.tsx +2 -2
  23. package/src/preact/components/csv-download-button.tsx +1 -1
  24. package/src/preact/components/error-boundary.stories.tsx +5 -5
  25. package/src/preact/components/error-boundary.tsx +14 -3
  26. package/src/preact/components/error-display.stories.tsx +9 -9
  27. package/src/preact/components/fullscreen.tsx +3 -3
  28. package/src/preact/components/info.tsx +1 -1
  29. package/src/preact/components/mutation-type-selector.stories.tsx +1 -1
  30. package/src/preact/components/table.stories.tsx +3 -3
  31. package/src/preact/components/table.tsx +1 -1
  32. package/src/preact/dateRangeSelector/computeInitialValues.spec.ts +34 -20
  33. package/src/preact/dateRangeSelector/computeInitialValues.ts +25 -21
  34. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +107 -46
  35. package/src/preact/dateRangeSelector/date-range-selector.tsx +31 -22
  36. package/src/preact/dateRangeSelector/dateRangeOption.ts +11 -1
  37. package/src/preact/lineageFilter/lineage-filter.stories.tsx +9 -9
  38. package/src/preact/lineageFilter/lineage-filter.tsx +3 -4
  39. package/src/preact/locationFilter/fetchAutocompletionList.ts +1 -1
  40. package/src/preact/locationFilter/location-filter.stories.tsx +9 -9
  41. package/src/preact/locationFilter/location-filter.tsx +4 -4
  42. package/src/preact/map/sequences-by-location.stories.tsx +4 -4
  43. package/src/preact/map/sequences-by-location.tsx +3 -4
  44. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +3 -3
  45. package/src/preact/mutationComparison/mutation-comparison.tsx +4 -4
  46. package/src/preact/mutationFilter/mutation-filter-info.tsx +3 -3
  47. package/src/preact/mutationFilter/mutation-filter.stories.tsx +7 -7
  48. package/src/preact/mutations/getMutationsGridData.ts +1 -1
  49. package/src/preact/mutations/mutations.stories.tsx +3 -3
  50. package/src/preact/mutations/mutations.tsx +4 -4
  51. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +3 -3
  52. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +4 -4
  53. package/src/preact/mutationsOverTime/mutations-over-time.tsx +5 -4
  54. package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +4 -4
  55. package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +4 -4
  56. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +4 -4
  57. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +4 -4
  58. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +4 -4
  59. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +4 -4
  60. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +4 -4
  61. package/src/preact/shared/floating-ui/hooks.ts +1 -1
  62. package/src/preact/statistic/statistics.stories.tsx +3 -3
  63. package/src/preact/statistic/statistics.tsx +2 -3
  64. package/src/preact/textInput/text-input.stories.tsx +7 -7
  65. package/src/preact/textInput/text-input.tsx +3 -4
  66. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +3 -3
  67. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +4 -4
  68. package/src/utils/map2d.ts +1 -0
  69. package/src/web-components/PreactLitAdapter.tsx +3 -3
  70. package/src/web-components/gs-app.stories.ts +7 -7
  71. package/src/web-components/gs-app.ts +3 -1
  72. package/src/web-components/input/gs-date-range-selector.stories.ts +10 -17
  73. package/src/web-components/input/gs-date-range-selector.tsx +15 -38
  74. package/src/web-components/input/gs-lineage-filter.stories.ts +1 -1
  75. package/src/web-components/input/gs-location-filter.stories.ts +1 -1
  76. package/src/web-components/input/gs-mutation-filter.stories.ts +7 -7
  77. package/src/web-components/input/gs-text-input.stories.ts +3 -3
  78. package/src/web-components/visualization/gs-aggregate.tsx +2 -2
  79. package/standalone-bundle/assets/mutationOverTimeWorker-CmSrq4SZ.js.map +1 -1
  80. package/standalone-bundle/dashboard-components.js +6068 -6055
  81. package/standalone-bundle/dashboard-components.js.map +1 -1
  82. package/dist/LineageFilterChangedEvent-GedKNGFI.js.map +0 -1
@@ -6,7 +6,7 @@ import { options, createContext as createContext$1, Fragment, render, Component,
6
6
  import { Grid } from "gridjs";
7
7
  import { Chart, registerables, Scale, BarController } from "chart.js";
8
8
  import { VennDiagramController, ArcSlice, extractSets } from "chartjs-chart-venn";
9
- import { v as views, n as namedLapisFilterSchema, s as sequenceTypeSchema, l as lapisFilterSchema, t as temporalGranularitySchema, b as dateRangeOptionSchema, c as toYYYYMMDD, D as DateRangeOptionChangedEvent, e as lapisLocationFilterSchema, L as LocationChangedEvent, T as TextInputChangedEvent, m as mutationsFilterSchema, a as LineageFilterChangedEvent } from "./LineageFilterChangedEvent-GedKNGFI.js";
9
+ import { v as views, n as namedLapisFilterSchema, s as sequenceTypeSchema, l as lapisFilterSchema, t as temporalGranularitySchema, b as dateRangeOptionSchema, c as dateRangeValueSchema, e as toYYYYMMDD, D as DateRangeOptionChangedEvent, f as lapisLocationFilterSchema, L as LocationChangedEvent, T as TextInputChangedEvent, m as mutationsFilterSchema, a as LineageFilterChangedEvent } from "./LineageFilterChangedEvent-C9dXOxt6.js";
10
10
  import { autoUpdate, computePosition, offset, shift, flip } from "@floating-ui/dom";
11
11
  import { ReactiveElement } from "@lit/reactive-element";
12
12
  import { BarWithErrorBarsController, BarWithErrorBar } from "chartjs-chart-error-bars";
@@ -561,7 +561,9 @@ let AppComponent = class extends LitElement {
561
561
  this.updateReferenceGenome = new Task(this, {
562
562
  task: async () => {
563
563
  const lapisUrl = lapisUrlSchema.parse(this.lapis);
564
- this.referenceGenome = await fetchReferenceGenome(lapisUrl);
564
+ this.referenceGenome = await fetchReferenceGenome(
565
+ lapisUrl.endsWith("/") ? lapisUrl.slice(0, -1) : lapisUrl
566
+ );
565
567
  },
566
568
  args: () => [this.lapis]
567
569
  });
@@ -1255,6 +1257,14 @@ function filterBySegmentAndMutationType(data, displayedSegments, displayedMutati
1255
1257
  return data.filter(byDisplayedSegments).filter(byDisplayedMutationTypes);
1256
1258
  }
1257
1259
  const LapisUrlContext = createContext$1("");
1260
+ const LapisUrlContextProvider = LapisUrlContext.Provider;
1261
+ const useLapisUrl = () => {
1262
+ const lapisUrl = x$1(LapisUrlContext);
1263
+ if (lapisUrl.endsWith("/")) {
1264
+ return lapisUrl.slice(0, -1);
1265
+ }
1266
+ return lapisUrl;
1267
+ };
1258
1268
  const CsvDownloadButton = ({
1259
1269
  label = "Download",
1260
1270
  filename = "data.csv",
@@ -1544,6 +1554,15 @@ const ErrorBoundary = ({
1544
1554
  }) => {
1545
1555
  const [internalError, resetError] = b2();
1546
1556
  const componentPropsParseError = useCheckComponentProps(schema, componentProps);
1557
+ y(
1558
+ () => {
1559
+ if (internalError) {
1560
+ resetError();
1561
+ }
1562
+ },
1563
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- this should run if and only if the props of the component change
1564
+ [componentProps]
1565
+ );
1547
1566
  if (internalError) {
1548
1567
  return /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(ErrorDisplay, { error: internalError, resetError, layout }) });
1549
1568
  }
@@ -1571,14 +1590,14 @@ const Fullscreen = () => {
1571
1590
  "button",
1572
1591
  {
1573
1592
  ref: element,
1574
- onClick: async () => {
1593
+ onClick: () => {
1575
1594
  if (element.current) {
1576
1595
  if (isFullscreen) {
1577
- await document.exitFullscreen();
1596
+ void document.exitFullscreen();
1578
1597
  } else {
1579
1598
  const componentRoot = findComponentRoot(element.current);
1580
1599
  if (componentRoot) {
1581
- await componentRoot.requestFullscreen();
1600
+ void componentRoot.requestFullscreen();
1582
1601
  }
1583
1602
  }
1584
1603
  }
@@ -1656,7 +1675,7 @@ function useFloatingUi(referenceRef, floatingRef, middleware, placement) {
1656
1675
  const { current: reference } = referenceRef;
1657
1676
  const { current: floating } = floatingRef;
1658
1677
  const update = () => {
1659
- computePosition(reference, floating, {
1678
+ void computePosition(reference, floating, {
1660
1679
  placement,
1661
1680
  middleware
1662
1681
  }).then(({ x: x2, y: y2 }) => {
@@ -2108,7 +2127,7 @@ const MutationComparison = (componentProps) => {
2108
2127
  };
2109
2128
  const MutationComparisonInner = (componentProps) => {
2110
2129
  const { lapisFilters, sequenceType } = componentProps;
2111
- const lapis = x$1(LapisUrlContext);
2130
+ const lapis = useLapisUrl();
2112
2131
  const { data, error, isLoading } = useQuery(async () => {
2113
2132
  return queryMutationData(lapisFilters, sequenceType, lapis);
2114
2133
  }, [lapisFilters, sequenceType, lapis]);
@@ -2222,7 +2241,7 @@ const Toolbar$7 = ({
2222
2241
  ] });
2223
2242
  };
2224
2243
  const MutationComparisonInfo = ({ originalComponentProps }) => {
2225
- const lapis = x$1(LapisUrlContext);
2244
+ const lapis = useLapisUrl();
2226
2245
  return /* @__PURE__ */ u$1(Info, { children: [
2227
2246
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Info for mutation comparison" }),
2228
2247
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -5546,7 +5565,7 @@ const _PreactLitAdapter = class _PreactLitAdapter extends ReactiveElement {
5546
5565
  };
5547
5566
  }
5548
5567
  update(changedProperties) {
5549
- const vdom = /* @__PURE__ */ u$1(LapisUrlContext.Provider, { value: this.lapis, children: /* @__PURE__ */ u$1(ReferenceGenomeContext.Provider, { value: this.referenceGenome, children: this.render() }) });
5568
+ const vdom = /* @__PURE__ */ u$1(LapisUrlContextProvider, { value: this.lapis, children: /* @__PURE__ */ u$1(ReferenceGenomeContext.Provider, { value: this.referenceGenome, children: this.render() }) });
5550
5569
  super.update(changedProperties);
5551
5570
  render(vdom, this.renderRoot);
5552
5571
  }
@@ -5972,7 +5991,7 @@ const Mutations = (componentProps) => {
5972
5991
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, componentProps, schema: mutationsPropsSchema, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(MutationsInner, { ...componentProps }) }) });
5973
5992
  };
5974
5993
  const MutationsInner = (componentProps) => {
5975
- const lapis = x$1(LapisUrlContext);
5994
+ const lapis = useLapisUrl();
5976
5995
  const { lapisFilter, baselineLapisFilter, sequenceType } = componentProps;
5977
5996
  const { data, error, isLoading } = useQuery(async () => {
5978
5997
  return queryMutationsData(lapisFilter, baselineLapisFilter, sequenceType, lapis);
@@ -6114,7 +6133,7 @@ const Toolbar$6 = ({
6114
6133
  ] });
6115
6134
  };
6116
6135
  const MutationsInfo = ({ originalComponentProps }) => {
6117
- const lapis = x$1(LapisUrlContext);
6136
+ const lapis = useLapisUrl();
6118
6137
  return /* @__PURE__ */ u$1(Info, { children: [
6119
6138
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Mutations" }),
6120
6139
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -7855,7 +7874,7 @@ const PrevalenceOverTime = (componentProps) => {
7855
7874
  };
7856
7875
  const PrevalenceOverTimeInner = (componentProps) => {
7857
7876
  const { numeratorFilters, denominatorFilter, granularity, smoothingWindow, lapisDateField } = componentProps;
7858
- const lapis = x$1(LapisUrlContext);
7877
+ const lapis = useLapisUrl();
7859
7878
  const { data, error, isLoading } = useQuery(
7860
7879
  () => queryPrevalenceOverTime(
7861
7880
  numeratorFilters,
@@ -7989,7 +8008,7 @@ const Toolbar$5 = ({
7989
8008
  };
7990
8009
  const PrevalenceOverTimeInfo = (componentProps) => {
7991
8010
  const { granularity, smoothingWindow, views: views2 } = componentProps;
7992
- const lapis = x$1(LapisUrlContext);
8011
+ const lapis = useLapisUrl();
7993
8012
  return /* @__PURE__ */ u$1(Info, { children: [
7994
8013
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Prevalence over time" }),
7995
8014
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -8344,7 +8363,7 @@ const RelativeGrowthAdvantage = (componentProps) => {
8344
8363
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, schema: relativeGrowthAdvantagePropsSchema, componentProps, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(RelativeGrowthAdvantageInner, { ...componentProps }) }) });
8345
8364
  };
8346
8365
  const RelativeGrowthAdvantageInner = (componentProps) => {
8347
- const lapis = x$1(LapisUrlContext);
8366
+ const lapis = useLapisUrl();
8348
8367
  const { numeratorFilter, denominatorFilter, generationTime, lapisDateField } = componentProps;
8349
8368
  const [yAxisScaleType, setYAxisScaleType] = h("linear");
8350
8369
  const { data, error, isLoading } = useQuery(
@@ -8427,7 +8446,7 @@ const RelativeGrowthAdvantageToolbar = ({
8427
8446
  const RelativeGrowthAdvantageInfo = ({
8428
8447
  originalComponentProps
8429
8448
  }) => {
8430
- const lapis = x$1(LapisUrlContext);
8449
+ const lapis = useLapisUrl();
8431
8450
  const generationTime = originalComponentProps.generationTime;
8432
8451
  return /* @__PURE__ */ u$1(Info, { children: [
8433
8452
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Relative growth advantage" }),
@@ -8722,7 +8741,7 @@ const Aggregate = (componentProps) => {
8722
8741
  };
8723
8742
  const AggregateInner = (componentProps) => {
8724
8743
  const { fields, lapisFilter, initialSortField, initialSortDirection } = componentProps;
8725
- const lapis = x$1(LapisUrlContext);
8744
+ const lapis = useLapisUrl();
8726
8745
  const { data, error, isLoading } = useQuery(async () => {
8727
8746
  return queryAggregateData(lapisFilter, fields, lapis);
8728
8747
  }, [lapisFilter, fields, lapis, initialSortField, initialSortDirection]);
@@ -8779,7 +8798,7 @@ const Toolbar$4 = ({ data, originalComponentProps }) => {
8779
8798
  ] });
8780
8799
  };
8781
8800
  const AggregateInfo = ({ originalComponentProps }) => {
8782
- const lapis = x$1(LapisUrlContext);
8801
+ const lapis = useLapisUrl();
8783
8802
  return /* @__PURE__ */ u$1(Info, { children: [
8784
8803
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Aggregated data" }),
8785
8804
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -9038,7 +9057,7 @@ const NumberSequencesOverTime = (componentProps) => {
9038
9057
  };
9039
9058
  const NumberSequencesOverTimeInner = (componentProps) => {
9040
9059
  const { lapisFilters, lapisDateField, granularity, smoothingWindow } = componentProps;
9041
- const lapis = x$1(LapisUrlContext);
9060
+ const lapis = useLapisUrl();
9042
9061
  const { data, error, isLoading } = useQuery(
9043
9062
  () => queryNumberOfSequencesOverTime(lapis, lapisFilters, lapisDateField, granularity, smoothingWindow),
9044
9063
  [lapis, lapisFilters, lapisDateField, granularity, smoothingWindow]
@@ -9126,7 +9145,7 @@ const Toolbar$3 = ({ activeTab, data, yAxisScaleType, setYAxisScaleType, origina
9126
9145
  const NumberSequencesOverTimeInfo = ({
9127
9146
  originalComponentProps
9128
9147
  }) => {
9129
- const lapis = x$1(LapisUrlContext);
9148
+ const lapis = useLapisUrl();
9130
9149
  return /* @__PURE__ */ u$1(Info, { children: [
9131
9150
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Number of sequences over time" }),
9132
9151
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -9547,7 +9566,7 @@ const MutationsOverTimeGrid = ({
9547
9566
  style: { gridRowStart: rowIndex + 2, gridColumnStart: 1 },
9548
9567
  children: /* @__PURE__ */ u$1(MutationCell, { mutation })
9549
9568
  },
9550
- `mutation-${mutation.toString()}`
9569
+ `mutation-${mutation.code}`
9551
9570
  ),
9552
9571
  dates.map((date, columnIndex) => {
9553
9572
  const value = data.get(mutation, date) ?? null;
@@ -9572,10 +9591,10 @@ const MutationsOverTimeGrid = ({
9572
9591
  }
9573
9592
  )
9574
9593
  },
9575
- `${mutation.toString()}-${date.toString()}`
9594
+ `${mutation.code}-${date.dateString}`
9576
9595
  );
9577
9596
  })
9578
- ] }, `fragment-${mutation.toString()}`);
9597
+ ] }, `fragment-${mutation.code}`);
9579
9598
  })
9580
9599
  ]
9581
9600
  }
@@ -9702,7 +9721,7 @@ const MutationsOverTime = (componentProps) => {
9702
9721
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, schema: mutationOverTimeSchema, componentProps, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(MutationsOverTimeInner, { ...componentProps }) }) });
9703
9722
  };
9704
9723
  const MutationsOverTimeInner = (componentProps) => {
9705
- const lapis = x$1(LapisUrlContext);
9724
+ const lapis = useLapisUrl();
9706
9725
  const { lapisFilter, sequenceType, granularity, lapisDateField } = componentProps;
9707
9726
  const messageToWorker = T$1(() => {
9708
9727
  return {
@@ -9715,6 +9734,7 @@ const MutationsOverTimeInner = (componentProps) => {
9715
9734
  }, [granularity, lapis, lapisDateField, lapisFilter, sequenceType]);
9716
9735
  const { data, error, isLoading } = useWebWorker(
9717
9736
  messageToWorker,
9737
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
9718
9738
  WorkerWrapper
9719
9739
  );
9720
9740
  if (isLoading) {
@@ -9837,7 +9857,7 @@ const Toolbar$2 = ({
9837
9857
  ] });
9838
9858
  };
9839
9859
  const MutationsOverTimeInfo = ({ originalComponentProps }) => {
9840
- const lapis = x$1(LapisUrlContext);
9860
+ const lapis = useLapisUrl();
9841
9861
  return /* @__PURE__ */ u$1(Info, { children: [
9842
9862
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Mutations over time" }),
9843
9863
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -10896,7 +10916,7 @@ const SequencesByLocation = (componentProps) => {
10896
10916
  };
10897
10917
  const SequencesByLocationMapInner = (props) => {
10898
10918
  const { lapisFilter, lapisLocationField, mapSource } = props;
10899
- const lapis = x$1(LapisUrlContext);
10919
+ const lapis = useLapisUrl();
10900
10920
  const {
10901
10921
  data,
10902
10922
  error,
@@ -10978,7 +10998,7 @@ const Toolbar$1 = ({ originalComponentProps, tableData }) => {
10978
10998
  ] });
10979
10999
  };
10980
11000
  const SequencesByLocationMapInfo = ({ originalComponentProps }) => {
10981
- const lapis = x$1(LapisUrlContext);
11001
+ const lapis = useLapisUrl();
10982
11002
  return /* @__PURE__ */ u$1(Info, { children: [
10983
11003
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Prevalence by location" }),
10984
11004
  /* @__PURE__ */ u$1(InfoParagraph, { children: "TODO: Add description https://github.com/GenSpectrum/dashboard-components/issues/598" }),
@@ -11089,7 +11109,7 @@ const Statistics = (componentProps) => {
11089
11109
  };
11090
11110
  const StatisticsInner = (componentProps) => {
11091
11111
  const { numeratorFilter, denominatorFilter } = componentProps;
11092
- const lapis = x$1(LapisUrlContext);
11112
+ const lapis = useLapisUrl();
11093
11113
  const { data, error, isLoading } = useQuery(async () => {
11094
11114
  return queryGeneralStatistics(numeratorFilter, denominatorFilter, lapis);
11095
11115
  }, [numeratorFilter, denominatorFilter, lapis]);
@@ -11263,7 +11283,7 @@ const WastewaterMutationsOverTime = (componentProps) => {
11263
11283
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, schema: wastewaterMutationOverTimeSchema, componentProps, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(WastewaterMutationsOverTimeInner, { ...componentProps }) }) });
11264
11284
  };
11265
11285
  const WastewaterMutationsOverTimeInner = (componentProps) => {
11266
- const lapis = x$1(LapisUrlContext);
11286
+ const lapis = useLapisUrl();
11267
11287
  const {
11268
11288
  data: mutationOverTimeDataPerLocation,
11269
11289
  error,
@@ -11325,7 +11345,7 @@ const Toolbar = ({ colorScale, setColorScale, originalComponentProps }) => {
11325
11345
  const WastewaterMutationsOverTimeInfo = ({
11326
11346
  originalComponentProps
11327
11347
  }) => {
11328
- const lapis = x$1(LapisUrlContext);
11348
+ const lapis = useLapisUrl();
11329
11349
  return /* @__PURE__ */ u$1(Info, { children: [
11330
11350
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Info for mutations over time" }),
11331
11351
  /* @__PURE__ */ u$1(InfoParagraph, { children: /* @__PURE__ */ u$1("slot", { name: "infoText" }) }),
@@ -11409,42 +11429,48 @@ const getDatesForSelectorValue = (initialSelectedDateRange, dateRangeOptions, ea
11409
11429
  }
11410
11430
  return defaultDates;
11411
11431
  };
11412
- function computeInitialValues(initialValue, initialDateFrom, initialDateTo, earliestDate, dateRangeOptions) {
11432
+ function computeInitialValues(value, earliestDate, dateRangeOptions) {
11413
11433
  var _a;
11414
- if (isUndefinedOrEmpty(initialDateFrom) && isUndefinedOrEmpty(initialDateTo)) {
11434
+ if (value === void 0) {
11435
+ const { dateFrom: dateFrom2, dateTo: dateTo2 } = getDatesForSelectorValue(void 0, dateRangeOptions, earliestDate);
11436
+ return {
11437
+ initialSelectedDateRange: void 0,
11438
+ initialSelectedDateFrom: dateFrom2,
11439
+ initialSelectedDateTo: dateTo2
11440
+ };
11441
+ }
11442
+ if (typeof value === "string") {
11415
11443
  const selectableOptions = getSelectableOptions(dateRangeOptions);
11416
- const initialSelectedDateRange = (_a = selectableOptions.find((option) => option.value === initialValue)) == null ? void 0 : _a.value;
11417
- if (initialValue !== void 0 && initialSelectedDateRange === void 0) {
11444
+ const initialSelectedDateRange = (_a = selectableOptions.find((option) => option.value === value)) == null ? void 0 : _a.value;
11445
+ if (initialSelectedDateRange === void 0) {
11418
11446
  if (selectableOptions.length === 0) {
11419
- throw new UserFacingError(
11420
- "Invalid initialValue",
11421
- "There are no selectable options, but initialValue is set."
11422
- );
11447
+ throw new UserFacingError("Invalid value", "There are no selectable options, but value is set.");
11423
11448
  }
11424
11449
  throw new UserFacingError(
11425
- "Invalid initialValue",
11426
- `Invalid initialValue "${initialValue}", It must be one of ${selectableOptions.map((option) => `'${option.value}'`).join(", ")}`
11450
+ "Invalid value",
11451
+ `Invalid value "${value}", It must be one of ${selectableOptions.map((option) => `'${option.value}'`).join(", ")}`
11427
11452
  );
11428
11453
  }
11429
- const { dateFrom, dateTo } = getDatesForSelectorValue(initialSelectedDateRange, dateRangeOptions, earliestDate);
11454
+ const { dateFrom: dateFrom2, dateTo: dateTo2 } = getDatesForSelectorValue(initialSelectedDateRange, dateRangeOptions, earliestDate);
11430
11455
  return {
11431
11456
  initialSelectedDateRange,
11432
- initialSelectedDateFrom: dateFrom,
11433
- initialSelectedDateTo: dateTo
11457
+ initialSelectedDateFrom: dateFrom2,
11458
+ initialSelectedDateTo: dateTo2
11434
11459
  };
11435
11460
  }
11436
- const initialSelectedDateFrom = isUndefinedOrEmpty(initialDateFrom) ? new Date(earliestDate) : new Date(initialDateFrom);
11437
- let initialSelectedDateTo = isUndefinedOrEmpty(initialDateTo) ? /* @__PURE__ */ new Date() : new Date(initialDateTo);
11461
+ const { dateFrom, dateTo } = value;
11462
+ const initialSelectedDateFrom = isUndefinedOrEmpty(dateFrom) ? new Date(earliestDate) : new Date(dateFrom);
11463
+ let initialSelectedDateTo = isUndefinedOrEmpty(dateTo) ? /* @__PURE__ */ new Date() : new Date(dateTo);
11438
11464
  if (isNaN(initialSelectedDateFrom.getTime())) {
11439
11465
  throw new UserFacingError(
11440
- "Invalid initialDateFrom",
11441
- `Invalid initialDateFrom "${initialDateFrom}", It must be of the format YYYY-MM-DD`
11466
+ "Invalid value.dateFrom",
11467
+ `Invalid value.dateFrom "${dateFrom}", It must be of the format YYYY-MM-DD`
11442
11468
  );
11443
11469
  }
11444
11470
  if (isNaN(initialSelectedDateTo.getTime())) {
11445
11471
  throw new UserFacingError(
11446
- "Invalid initialDateTo",
11447
- `Invalid initialDateTo "${initialDateTo}", It must be of the format YYYY-MM-DD`
11472
+ "Invalid value.dateTo",
11473
+ `Invalid value.dateTo "${dateTo}", It must be of the format YYYY-MM-DD`
11448
11474
  );
11449
11475
  }
11450
11476
  if (initialSelectedDateFrom > initialSelectedDateTo) {
@@ -11463,9 +11489,7 @@ const customOption = "Custom";
11463
11489
  const dateRangeSelectorInnerPropsSchema = z$2.object({
11464
11490
  dateRangeOptions: z$2.array(dateRangeOptionSchema),
11465
11491
  earliestDate: z$2.string().date(),
11466
- initialValue: z$2.string().optional(),
11467
- initialDateFrom: z$2.string().date().optional(),
11468
- initialDateTo: z$2.string().date().optional(),
11492
+ value: dateRangeValueSchema.optional(),
11469
11493
  lapisDateField: z$2.string().min(1)
11470
11494
  });
11471
11495
  const dateRangeSelectorPropsSchema = dateRangeSelectorInnerPropsSchema.extend({
@@ -11479,17 +11503,12 @@ const DateRangeSelector = (props) => {
11479
11503
  const DateRangeSelectorInner = ({
11480
11504
  dateRangeOptions,
11481
11505
  earliestDate = "1900-01-01",
11482
- initialValue,
11483
- lapisDateField,
11484
- initialDateFrom,
11485
- initialDateTo
11506
+ value,
11507
+ lapisDateField
11486
11508
  }) => {
11487
- const initialValues = computeInitialValues(
11488
- initialValue,
11489
- initialDateFrom,
11490
- initialDateTo,
11491
- earliestDate,
11492
- dateRangeOptions
11509
+ const initialValues = T$1(
11510
+ () => computeInitialValues(value, earliestDate, dateRangeOptions),
11511
+ [value, earliestDate, dateRangeOptions]
11493
11512
  );
11494
11513
  const fromDatePickerRef = A$1(null);
11495
11514
  const toDatePickerRef = A$1(null);
@@ -11504,6 +11523,11 @@ const DateRangeSelectorInner = ({
11504
11523
  dateTo: initialValues.initialSelectedDateTo
11505
11524
  });
11506
11525
  y(() => {
11526
+ setSelectedDateRange(initialValues.initialSelectedDateRange);
11527
+ setSelectedDates({
11528
+ dateFrom: initialValues.initialSelectedDateFrom,
11529
+ dateTo: initialValues.initialSelectedDateTo
11530
+ });
11507
11531
  const commonConfig = {
11508
11532
  allowInput: true,
11509
11533
  dateFormat: "Y-m-d"
@@ -11512,7 +11536,7 @@ const DateRangeSelectorInner = ({
11512
11536
  setDateFromPicker(
11513
11537
  flatpickr(fromDatePickerRef.current, {
11514
11538
  ...commonConfig,
11515
- defaultDate: selectedDates.dateFrom
11539
+ defaultDate: initialValues.initialSelectedDateFrom
11516
11540
  })
11517
11541
  );
11518
11542
  }
@@ -11520,18 +11544,24 @@ const DateRangeSelectorInner = ({
11520
11544
  setDateToPicker(
11521
11545
  flatpickr(toDatePickerRef.current, {
11522
11546
  ...commonConfig,
11523
- defaultDate: selectedDates.dateTo
11547
+ defaultDate: initialValues.initialSelectedDateTo
11524
11548
  })
11525
11549
  );
11526
11550
  }
11527
11551
  return () => {
11528
- dateFromPicker == null ? void 0 : dateFromPicker.destroy();
11529
- dateToPicker == null ? void 0 : dateToPicker.destroy();
11552
+ setDateFromPicker((prev) => {
11553
+ prev == null ? void 0 : prev.destroy();
11554
+ return null;
11555
+ });
11556
+ setDateToPicker((prev) => {
11557
+ prev == null ? void 0 : prev.destroy();
11558
+ return null;
11559
+ });
11530
11560
  };
11531
- }, [fromDatePickerRef, toDatePickerRef]);
11532
- const onSelectChange = (value) => {
11533
- setSelectedDateRange(value);
11534
- const dateRange = getDatesForSelectorValue(value, dateRangeOptions, earliestDate);
11561
+ }, [fromDatePickerRef, toDatePickerRef, initialValues]);
11562
+ const onSelectChange = (value2) => {
11563
+ setSelectedDateRange(value2);
11564
+ const dateRange = getDatesForSelectorValue(value2, dateRangeOptions, earliestDate);
11535
11565
  dateToPicker == null ? void 0 : dateToPicker.set("minDate", dateRange.dateFrom);
11536
11566
  dateFromPicker == null ? void 0 : dateFromPicker.set("maxDate", dateRange.dateTo);
11537
11567
  dateFromPicker == null ? void 0 : dateFromPicker.setDate(dateRange.dateFrom);
@@ -11541,7 +11571,7 @@ const DateRangeSelectorInner = ({
11541
11571
  dateTo: dateRange.dateTo
11542
11572
  });
11543
11573
  fireFilterChangedEvent();
11544
- fireOptionChangedEvent(value);
11574
+ fireOptionChangedEvent(value2);
11545
11575
  };
11546
11576
  const onChangeDateFrom = () => {
11547
11577
  if (selectedDates.dateFrom.toDateString() === (dateFromPicker == null ? void 0 : dateFromPicker.selectedDates[0].toDateString())) {
@@ -11606,8 +11636,8 @@ const DateRangeSelectorInner = ({
11606
11636
  onChange: (event) => {
11607
11637
  event.preventDefault();
11608
11638
  const select = event.target;
11609
- const value = select.value;
11610
- onSelectChange(value);
11639
+ const value2 = select.value;
11640
+ onSelectChange(value2);
11611
11641
  }
11612
11642
  }
11613
11643
  ),
@@ -11652,9 +11682,7 @@ let DateRangeSelectorComponent = class extends PreactLitAdapter {
11652
11682
  super(...arguments);
11653
11683
  this.dateRangeOptions = [];
11654
11684
  this.earliestDate = "1900-01-01";
11655
- this.initialValue = void 0;
11656
- this.initialDateFrom = void 0;
11657
- this.initialDateTo = void 0;
11685
+ this.value = void 0;
11658
11686
  this.width = "100%";
11659
11687
  this.lapisDateField = "";
11660
11688
  }
@@ -11664,9 +11692,7 @@ let DateRangeSelectorComponent = class extends PreactLitAdapter {
11664
11692
  {
11665
11693
  dateRangeOptions: this.dateRangeOptions,
11666
11694
  earliestDate: this.earliestDate,
11667
- initialValue: this.initialValue,
11668
- initialDateFrom: this.initialDateFrom,
11669
- initialDateTo: this.initialDateTo,
11695
+ value: this.value,
11670
11696
  lapisDateField: this.lapisDateField,
11671
11697
  width: this.width
11672
11698
  }
@@ -11680,14 +11706,8 @@ __decorateClass$4([
11680
11706
  n$1({ type: String })
11681
11707
  ], DateRangeSelectorComponent.prototype, "earliestDate", 2);
11682
11708
  __decorateClass$4([
11683
- n$1()
11684
- ], DateRangeSelectorComponent.prototype, "initialValue", 2);
11685
- __decorateClass$4([
11686
- n$1()
11687
- ], DateRangeSelectorComponent.prototype, "initialDateFrom", 2);
11688
- __decorateClass$4([
11689
- n$1()
11690
- ], DateRangeSelectorComponent.prototype, "initialDateTo", 2);
11709
+ n$1({ type: Object })
11710
+ ], DateRangeSelectorComponent.prototype, "value", 2);
11691
11711
  __decorateClass$4([
11692
11712
  n$1({ type: String })
11693
11713
  ], DateRangeSelectorComponent.prototype, "width", 2);
@@ -14823,7 +14843,7 @@ const LocationFilter = (props) => {
14823
14843
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, layout: "horizontal", componentProps: props, schema: locationFilterPropsSchema, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(LocationFilterInner, { ...innerProps }) }) });
14824
14844
  };
14825
14845
  const LocationFilterInner = ({ value, fields, placeholderText, lapisFilter }) => {
14826
- const lapis = x$1(LapisUrlContext);
14846
+ const lapis = useLapisUrl();
14827
14847
  const { data, error, isLoading } = useQuery(
14828
14848
  () => fetchAutocompletionList({ fields, lapis, lapisFilter }),
14829
14849
  [fields, lapis, lapisFilter]
@@ -14991,7 +15011,7 @@ const TextInputInner = ({
14991
15011
  placeholderText,
14992
15012
  lapisFilter
14993
15013
  }) => {
14994
- const lapis = x$1(LapisUrlContext);
15014
+ const lapis = useLapisUrl();
14995
15015
  const { data, error, isLoading } = useQuery(
14996
15016
  () => fetchStringAutocompleteList({ lapis, field: lapisField, lapisFilter }),
14997
15017
  [lapisField, lapis, lapisFilter]
@@ -15190,12 +15210,13 @@ const QuickStart = () => {
15190
15210
  /* @__PURE__ */ u$1(ExampleMutation, { mutationType: "insertion", sequenceType: "amino acid" })
15191
15211
  ] })
15192
15212
  ] }) }),
15193
- referenceGenome.nucleotideSequences.length > 1 ? /* @__PURE__ */ u$1(InfoParagraph, { children: [
15213
+ referenceGenome.nucleotideSequences.length > 1 && /* @__PURE__ */ u$1(InfoParagraph, { children: [
15194
15214
  "This organism has the following segments:",
15195
15215
  " ",
15196
15216
  referenceGenome.nucleotideSequences.map((gene) => gene.name).join(", "),
15197
15217
  "."
15198
- ] }) : /* @__PURE__ */ u$1(InfoParagraph, { children: "This organism doesn't support nucleotide sequences." }),
15218
+ ] }),
15219
+ referenceGenome.nucleotideSequences.length === 0 && /* @__PURE__ */ u$1(InfoParagraph, { children: "This organism doesn't support nucleotide sequences." }),
15199
15220
  referenceGenome.genes.length !== 0 ? /* @__PURE__ */ u$1(InfoParagraph, { children: [
15200
15221
  "This organism has the following genes: ",
15201
15222
  referenceGenome.genes.map((gene) => gene.name).join(", "),
@@ -15838,7 +15859,7 @@ const LineageFilterInner = ({
15838
15859
  value,
15839
15860
  lapisFilter
15840
15861
  }) => {
15841
- const lapis = x$1(LapisUrlContext);
15862
+ const lapis = useLapisUrl();
15842
15863
  const { data, error, isLoading } = useQuery(
15843
15864
  () => fetchLineageAutocompleteList({ lapis, field: lapisField, lapisFilter }),
15844
15865
  [lapisField, lapis, lapisFilter]