@genspectrum/dashboard-components 0.15.0 → 0.16.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 (80) hide show
  1. package/custom-elements.json +200 -56
  2. package/dist/components.d.ts +35 -35
  3. package/dist/components.js +311 -192
  4. package/dist/components.js.map +1 -1
  5. package/dist/style.css +9 -0
  6. package/dist/util.d.ts +46 -46
  7. package/package.json +1 -1
  8. package/src/preact/ReferenceGenomeContext.ts +14 -1
  9. package/src/preact/aggregatedData/aggregate-bar-chart.tsx +26 -5
  10. package/src/preact/aggregatedData/aggregate.stories.tsx +0 -1
  11. package/src/preact/aggregatedData/aggregate.tsx +5 -1
  12. package/src/preact/components/ReferenceGenomesAwaiter.tsx +1 -6
  13. package/src/preact/components/resize-container.tsx +1 -1
  14. package/src/preact/mutationComparison/mutation-comparison-venn.tsx +4 -2
  15. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +0 -1
  16. package/src/preact/mutationComparison/mutation-comparison.tsx +5 -1
  17. package/src/preact/mutationFilter/mutation-filter.stories.tsx +17 -1
  18. package/src/preact/mutationFilter/mutation-filter.tsx +8 -0
  19. package/src/preact/mutations/mutations.stories.tsx +0 -1
  20. package/src/preact/mutations/mutations.tsx +1 -1
  21. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +0 -2
  22. package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -1
  23. package/src/preact/numberSequencesOverTime/number-sequences-over-time-bar-chart.tsx +8 -3
  24. package/src/preact/numberSequencesOverTime/number-sequences-over-time-line-chart.tsx +8 -3
  25. package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +3 -1
  26. package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +18 -3
  27. package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +48 -35
  28. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +83 -70
  29. package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +48 -37
  30. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +0 -3
  31. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +6 -1
  32. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +31 -23
  33. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +0 -1
  34. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +5 -1
  35. package/src/preact/sequencesByLocation/__mockData__/worldAtlas.json +1 -0
  36. package/src/preact/{map → sequencesByLocation}/sequences-by-location-map.tsx +6 -3
  37. package/src/preact/{map → sequencesByLocation}/sequences-by-location-table.tsx +1 -1
  38. package/src/preact/{map → sequencesByLocation}/sequences-by-location.stories.tsx +58 -1
  39. package/src/preact/{map → sequencesByLocation}/sequences-by-location.tsx +10 -1
  40. package/src/preact/shared/aspectRatio/AspectRatio.tsx +13 -0
  41. package/src/preact/shared/charts/getMaintainAspectRatio.ts +3 -0
  42. package/src/preact/statistic/statistics.stories.tsx +0 -1
  43. package/src/preact/statistic/statistics.tsx +4 -4
  44. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +0 -1
  45. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +1 -1
  46. package/src/query/computeMapLocationData.spec.ts +1 -1
  47. package/src/query/computeMapLocationData.ts +1 -1
  48. package/src/query/querySequencesByLocationData.ts +1 -1
  49. package/src/utilEntrypoint.ts +1 -1
  50. package/src/web-components/ResizeContainer.mdx +4 -1
  51. package/src/web-components/visualization/gs-aggregate.stories.ts +13 -6
  52. package/src/web-components/visualization/gs-aggregate.tsx +1 -1
  53. package/src/web-components/visualization/gs-mutation-comparison.stories.ts +8 -1
  54. package/src/web-components/visualization/gs-mutation-comparison.tsx +1 -1
  55. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +9 -1
  56. package/src/web-components/visualization/gs-mutations-over-time.tsx +1 -1
  57. package/src/web-components/visualization/gs-mutations.stories.ts +8 -1
  58. package/src/web-components/visualization/gs-mutations.tsx +1 -1
  59. package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +11 -1
  60. package/src/web-components/visualization/gs-number-sequences-over-time.tsx +1 -1
  61. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +8 -2
  62. package/src/web-components/visualization/gs-prevalence-over-time.tsx +1 -1
  63. package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +8 -1
  64. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +1 -1
  65. package/src/web-components/visualization/gs-sequences-by-location.stories.ts +13 -7
  66. package/src/web-components/visualization/gs-sequences-by-location.tsx +6 -3
  67. package/src/web-components/visualization/gs-statistics.stories.ts +0 -1
  68. package/src/web-components/visualization/gs-statistics.tsx +1 -1
  69. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.stories.ts +9 -1
  70. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +1 -1
  71. package/standalone-bundle/dashboard-components.js +4965 -4876
  72. package/standalone-bundle/dashboard-components.js.map +1 -1
  73. package/standalone-bundle/style.css +1 -1
  74. package/src/preact/map/__mockData__/worldAtlas.json +0 -497127
  75. /package/src/preact/{map → sequencesByLocation}/__mockData__/aggregatedGermany.json +0 -0
  76. /package/src/preact/{map → sequencesByLocation}/__mockData__/aggregatedWorld.json +0 -0
  77. /package/src/preact/{map → sequencesByLocation}/__mockData__/germanyMap.json +0 -0
  78. /package/src/preact/{map → sequencesByLocation}/__mockData__/howToGenerateWorldMap.md +0 -0
  79. /package/src/preact/{map → sequencesByLocation}/leafletStyleModifications.css +0 -0
  80. /package/src/preact/{map → sequencesByLocation}/loadMapSource.tsx +0 -0
package/dist/style.css CHANGED
@@ -3065,6 +3065,9 @@ input.tab:checked + .tab-content,
3065
3065
  .relative {
3066
3066
  position: relative;
3067
3067
  }
3068
+ .inset-0 {
3069
+ inset: 0px;
3070
+ }
3068
3071
  .-right-3 {
3069
3072
  right: -0.75rem;
3070
3073
  }
@@ -3248,6 +3251,9 @@ input.tab:checked + .tab-content,
3248
3251
  .min-w-32 {
3249
3252
  min-width: 8rem;
3250
3253
  }
3254
+ .min-w-\[180px\] {
3255
+ min-width: 180px;
3256
+ }
3251
3257
  .min-w-\[7\.5rem\] {
3252
3258
  min-width: 7.5rem;
3253
3259
  }
@@ -3331,6 +3337,9 @@ input.tab:checked + .tab-content,
3331
3337
  .whitespace-nowrap {
3332
3338
  white-space: nowrap;
3333
3339
  }
3340
+ .text-wrap {
3341
+ text-wrap: wrap;
3342
+ }
3334
3343
  .text-nowrap {
3335
3344
  text-wrap: nowrap;
3336
3345
  }
package/dist/util.d.ts CHANGED
@@ -25,7 +25,7 @@ declare const aggregatePropsSchema: default_2.ZodObject<{
25
25
  initialSortDirection: default_2.ZodUnion<[default_2.ZodLiteral<"ascending">, default_2.ZodLiteral<"descending">]>;
26
26
  pageSize: default_2.ZodUnion<[default_2.ZodBoolean, default_2.ZodNumber]>;
27
27
  width: default_2.ZodString;
28
- height: default_2.ZodString;
28
+ height: default_2.ZodOptional<default_2.ZodString>;
29
29
  maxNumberOfBars: default_2.ZodNumber;
30
30
  }, "strip", default_2.ZodTypeAny, {
31
31
  lapisFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
@@ -35,13 +35,13 @@ declare const aggregatePropsSchema: default_2.ZodObject<{
35
35
  aminoAcidInsertions?: string[] | undefined;
36
36
  };
37
37
  fields: string[];
38
- height: string;
39
38
  width: string;
40
39
  pageSize: number | boolean;
41
40
  views: ("table" | "bar")[];
42
41
  initialSortField: string;
43
42
  initialSortDirection: "ascending" | "descending";
44
43
  maxNumberOfBars: number;
44
+ height?: string | undefined;
45
45
  }, {
46
46
  lapisFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
47
47
  nucleotideMutations?: string[] | undefined;
@@ -50,13 +50,13 @@ declare const aggregatePropsSchema: default_2.ZodObject<{
50
50
  aminoAcidInsertions?: string[] | undefined;
51
51
  };
52
52
  fields: string[];
53
- height: string;
54
53
  width: string;
55
54
  pageSize: number | boolean;
56
55
  views: ("table" | "bar")[];
57
56
  initialSortField: string;
58
57
  initialSortDirection: "ascending" | "descending";
59
58
  maxNumberOfBars: number;
59
+ height?: string | undefined;
60
60
  }>;
61
61
 
62
62
  export declare type AggregateView = default_2.infer<typeof aggregateViewSchema>;
@@ -206,7 +206,7 @@ export declare type MutationComparisonProps = default_2.infer<typeof mutationCom
206
206
 
207
207
  declare const mutationComparisonPropsSchema: default_2.ZodObject<{
208
208
  width: default_2.ZodString;
209
- height: default_2.ZodString;
209
+ height: default_2.ZodOptional<default_2.ZodString>;
210
210
  lapisFilters: default_2.ZodArray<default_2.ZodObject<{
211
211
  lapisFilter: default_2.ZodIntersection<default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodArray<default_2.ZodString, "many">, default_2.ZodNumber, default_2.ZodNull, default_2.ZodBoolean, default_2.ZodUndefined]>>, default_2.ZodObject<{
212
212
  nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
@@ -246,7 +246,6 @@ declare const mutationComparisonPropsSchema: default_2.ZodObject<{
246
246
  views: default_2.ZodArray<default_2.ZodUnion<[default_2.ZodLiteral<"table">, default_2.ZodLiteral<"venn">]>, "many">;
247
247
  pageSize: default_2.ZodUnion<[default_2.ZodBoolean, default_2.ZodNumber]>;
248
248
  }, "strip", default_2.ZodTypeAny, {
249
- height: string;
250
249
  width: string;
251
250
  pageSize: number | boolean;
252
251
  lapisFilters: {
@@ -260,8 +259,8 @@ declare const mutationComparisonPropsSchema: default_2.ZodObject<{
260
259
  }[];
261
260
  sequenceType: "nucleotide" | "amino acid";
262
261
  views: ("table" | "venn")[];
262
+ height?: string | undefined;
263
263
  }, {
264
- height: string;
265
264
  width: string;
266
265
  pageSize: number | boolean;
267
266
  lapisFilters: {
@@ -275,6 +274,7 @@ declare const mutationComparisonPropsSchema: default_2.ZodObject<{
275
274
  }[];
276
275
  sequenceType: "nucleotide" | "amino acid";
277
276
  views: ("table" | "venn")[];
277
+ height?: string | undefined;
278
278
  }>;
279
279
 
280
280
  export declare type MutationComparisonView = default_2.infer<typeof mutationComparisonViewSchema>;
@@ -339,7 +339,7 @@ declare const mutationsPropsSchema: default_2.ZodObject<{
339
339
  views: default_2.ZodArray<default_2.ZodUnion<[default_2.ZodLiteral<"table">, default_2.ZodLiteral<"grid">, default_2.ZodLiteral<"insertions">]>, "many">;
340
340
  pageSize: default_2.ZodUnion<[default_2.ZodBoolean, default_2.ZodNumber]>;
341
341
  width: default_2.ZodString;
342
- height: default_2.ZodString;
342
+ height: default_2.ZodOptional<default_2.ZodString>;
343
343
  }, "strip", default_2.ZodTypeAny, {
344
344
  lapisFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
345
345
  nucleotideMutations?: string[] | undefined;
@@ -347,11 +347,11 @@ declare const mutationsPropsSchema: default_2.ZodObject<{
347
347
  nucleotideInsertions?: string[] | undefined;
348
348
  aminoAcidInsertions?: string[] | undefined;
349
349
  };
350
- height: string;
351
350
  width: string;
352
351
  pageSize: number | boolean;
353
352
  sequenceType: "nucleotide" | "amino acid";
354
353
  views: ("table" | "grid" | "insertions")[];
354
+ height?: string | undefined;
355
355
  baselineLapisFilter?: (Record<string, string | number | boolean | string[] | null | undefined> & {
356
356
  nucleotideMutations?: string[] | undefined;
357
357
  aminoAcidMutations?: string[] | undefined;
@@ -365,11 +365,11 @@ declare const mutationsPropsSchema: default_2.ZodObject<{
365
365
  nucleotideInsertions?: string[] | undefined;
366
366
  aminoAcidInsertions?: string[] | undefined;
367
367
  };
368
- height: string;
369
368
  width: string;
370
369
  pageSize: number | boolean;
371
370
  sequenceType: "nucleotide" | "amino acid";
372
371
  views: ("table" | "grid" | "insertions")[];
372
+ height?: string | undefined;
373
373
  baselineLapisFilter?: (Record<string, string | number | boolean | string[] | null | undefined> & {
374
374
  nucleotideMutations?: string[] | undefined;
375
375
  aminoAcidMutations?: string[] | undefined;
@@ -424,7 +424,7 @@ export declare type NumberSequencesOverTimeProps = default_2.infer<typeof number
424
424
 
425
425
  declare const numberSequencesOverTimePropsSchema: default_2.ZodObject<{
426
426
  width: default_2.ZodString;
427
- height: default_2.ZodString;
427
+ height: default_2.ZodOptional<default_2.ZodString>;
428
428
  lapisFilters: default_2.ZodArray<default_2.ZodObject<{
429
429
  lapisFilter: default_2.ZodIntersection<default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodArray<default_2.ZodString, "many">, default_2.ZodNumber, default_2.ZodNull, default_2.ZodBoolean, default_2.ZodUndefined]>>, default_2.ZodObject<{
430
430
  nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
@@ -466,7 +466,6 @@ declare const numberSequencesOverTimePropsSchema: default_2.ZodObject<{
466
466
  smoothingWindow: default_2.ZodNumber;
467
467
  pageSize: default_2.ZodUnion<[default_2.ZodBoolean, default_2.ZodNumber]>;
468
468
  }, "strip", default_2.ZodTypeAny, {
469
- height: string;
470
469
  width: string;
471
470
  pageSize: number | boolean;
472
471
  lapisFilters: {
@@ -482,8 +481,8 @@ declare const numberSequencesOverTimePropsSchema: default_2.ZodObject<{
482
481
  granularity: "day" | "week" | "month" | "year";
483
482
  smoothingWindow: number;
484
483
  lapisDateField: string;
484
+ height?: string | undefined;
485
485
  }, {
486
- height: string;
487
486
  width: string;
488
487
  pageSize: number | boolean;
489
488
  lapisFilters: {
@@ -499,6 +498,7 @@ declare const numberSequencesOverTimePropsSchema: default_2.ZodObject<{
499
498
  granularity: "day" | "week" | "month" | "year";
500
499
  smoothingWindow: number;
501
500
  lapisDateField: string;
501
+ height?: string | undefined;
502
502
  }>;
503
503
 
504
504
  export declare type NumberSequencesOverTimeView = default_2.infer<typeof numberSequencesOverTimeViewSchema>;
@@ -509,7 +509,7 @@ export declare type PrevalenceOverTimeProps = default_2.infer<typeof prevalenceO
509
509
 
510
510
  declare const prevalenceOverTimePropsSchema: default_2.ZodObject<{
511
511
  width: default_2.ZodString;
512
- height: default_2.ZodString;
512
+ height: default_2.ZodOptional<default_2.ZodString>;
513
513
  numeratorFilters: default_2.ZodArray<default_2.ZodObject<{
514
514
  lapisFilter: default_2.ZodIntersection<default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodArray<default_2.ZodString, "many">, default_2.ZodNumber, default_2.ZodNull, default_2.ZodBoolean, default_2.ZodUndefined]>>, default_2.ZodObject<{
515
515
  nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
@@ -570,7 +570,6 @@ declare const prevalenceOverTimePropsSchema: default_2.ZodObject<{
570
570
  yAxisMaxLinear: default_2.ZodUnion<[default_2.ZodLiteral<"maxInData">, default_2.ZodLiteral<"limitTo1">, default_2.ZodNumber]>;
571
571
  yAxisMaxLogarithmic: default_2.ZodUnion<[default_2.ZodLiteral<"maxInData">, default_2.ZodLiteral<"limitTo1">, default_2.ZodNumber]>;
572
572
  }, "strip", default_2.ZodTypeAny, {
573
- height: string;
574
573
  width: string;
575
574
  pageSize: number | boolean;
576
575
  views: ("table" | "bar" | "line" | "bubble")[];
@@ -595,8 +594,8 @@ declare const prevalenceOverTimePropsSchema: default_2.ZodObject<{
595
594
  lapisDateField: string;
596
595
  yAxisMaxLinear: number | "maxInData" | "limitTo1";
597
596
  yAxisMaxLogarithmic: number | "maxInData" | "limitTo1";
597
+ height?: string | undefined;
598
598
  }, {
599
- height: string;
600
599
  width: string;
601
600
  pageSize: number | boolean;
602
601
  views: ("table" | "bar" | "line" | "bubble")[];
@@ -621,6 +620,7 @@ declare const prevalenceOverTimePropsSchema: default_2.ZodObject<{
621
620
  lapisDateField: string;
622
621
  yAxisMaxLinear: number | "maxInData" | "limitTo1";
623
622
  yAxisMaxLogarithmic: number | "maxInData" | "limitTo1";
623
+ height?: string | undefined;
624
624
  }>;
625
625
 
626
626
  export declare type PrevalenceOverTimeView = default_2.infer<typeof prevalenceOverTimeViewSchema>;
@@ -631,7 +631,7 @@ export declare type RelativeGrowthAdvantageProps = default_2.infer<typeof relati
631
631
 
632
632
  declare const relativeGrowthAdvantagePropsSchema: default_2.ZodObject<{
633
633
  width: default_2.ZodString;
634
- height: default_2.ZodString;
634
+ height: default_2.ZodOptional<default_2.ZodString>;
635
635
  numeratorFilter: default_2.ZodIntersection<default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodArray<default_2.ZodString, "many">, default_2.ZodNumber, default_2.ZodNull, default_2.ZodBoolean, default_2.ZodUndefined]>>, default_2.ZodObject<{
636
636
  nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
637
637
  aminoAcidMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
@@ -670,7 +670,6 @@ declare const relativeGrowthAdvantagePropsSchema: default_2.ZodObject<{
670
670
  yAxisMaxLinear: default_2.ZodUnion<[default_2.ZodLiteral<"maxInData">, default_2.ZodLiteral<"limitTo1">, default_2.ZodNumber]>;
671
671
  yAxisMaxLogarithmic: default_2.ZodUnion<[default_2.ZodLiteral<"maxInData">, default_2.ZodLiteral<"limitTo1">, default_2.ZodNumber]>;
672
672
  }, "strip", default_2.ZodTypeAny, {
673
- height: string;
674
673
  width: string;
675
674
  views: "line"[];
676
675
  denominatorFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
@@ -689,8 +688,8 @@ declare const relativeGrowthAdvantagePropsSchema: default_2.ZodObject<{
689
688
  aminoAcidInsertions?: string[] | undefined;
690
689
  };
691
690
  generationTime: number;
691
+ height?: string | undefined;
692
692
  }, {
693
- height: string;
694
693
  width: string;
695
694
  views: "line"[];
696
695
  denominatorFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
@@ -709,6 +708,7 @@ declare const relativeGrowthAdvantagePropsSchema: default_2.ZodObject<{
709
708
  aminoAcidInsertions?: string[] | undefined;
710
709
  };
711
710
  generationTime: number;
711
+ height?: string | undefined;
712
712
  }>;
713
713
 
714
714
  export declare type RelativeGrowthAdvantageView = default_2.infer<typeof relativeGrowthAdvantageViewSchema>;
@@ -723,7 +723,7 @@ export declare type StatisticsProps = default_2.infer<typeof statisticsPropsSche
723
723
 
724
724
  declare const statisticsPropsSchema: default_2.ZodObject<{
725
725
  width: default_2.ZodString;
726
- height: default_2.ZodString;
726
+ height: default_2.ZodOptional<default_2.ZodString>;
727
727
  numeratorFilter: default_2.ZodIntersection<default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodArray<default_2.ZodString, "many">, default_2.ZodNumber, default_2.ZodNull, default_2.ZodBoolean, default_2.ZodUndefined]>>, default_2.ZodObject<{
728
728
  nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
729
729
  aminoAcidMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
@@ -757,7 +757,6 @@ declare const statisticsPropsSchema: default_2.ZodObject<{
757
757
  aminoAcidInsertions?: string[] | undefined;
758
758
  }>>;
759
759
  }, "strip", default_2.ZodTypeAny, {
760
- height: string;
761
760
  width: string;
762
761
  denominatorFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
763
762
  nucleotideMutations?: string[] | undefined;
@@ -771,8 +770,8 @@ declare const statisticsPropsSchema: default_2.ZodObject<{
771
770
  nucleotideInsertions?: string[] | undefined;
772
771
  aminoAcidInsertions?: string[] | undefined;
773
772
  };
773
+ height?: string | undefined;
774
774
  }, {
775
- height: string;
776
775
  width: string;
777
776
  denominatorFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
778
777
  nucleotideMutations?: string[] | undefined;
@@ -786,6 +785,7 @@ declare const statisticsPropsSchema: default_2.ZodObject<{
786
785
  nucleotideInsertions?: string[] | undefined;
787
786
  aminoAcidInsertions?: string[] | undefined;
788
787
  };
788
+ height?: string | undefined;
789
789
  }>;
790
790
 
791
791
  export declare type TemporalGranularity = default_2.infer<typeof temporalGranularitySchema>;
@@ -846,22 +846,6 @@ declare global {
846
846
  }
847
847
 
848
848
 
849
- declare global {
850
- interface HTMLElementTagNameMap {
851
- 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
852
- }
853
- }
854
-
855
-
856
- declare global {
857
- namespace JSX {
858
- interface IntrinsicElements {
859
- 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
860
- }
861
- }
862
- }
863
-
864
-
865
849
  declare global {
866
850
  interface HTMLElementTagNameMap {
867
851
  'gs-mutation-comparison-component': MutationComparisonComponent;
@@ -928,7 +912,7 @@ declare global {
928
912
 
929
913
  declare global {
930
914
  interface HTMLElementTagNameMap {
931
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
915
+ 'gs-aggregate': AggregateComponent;
932
916
  }
933
917
  }
934
918
 
@@ -936,7 +920,7 @@ declare global {
936
920
  declare global {
937
921
  namespace JSX {
938
922
  interface IntrinsicElements {
939
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
923
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
940
924
  }
941
925
  }
942
926
  }
@@ -944,7 +928,7 @@ declare global {
944
928
 
945
929
  declare global {
946
930
  interface HTMLElementTagNameMap {
947
- 'gs-aggregate': AggregateComponent;
931
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
948
932
  }
949
933
  }
950
934
 
@@ -952,7 +936,7 @@ declare global {
952
936
  declare global {
953
937
  namespace JSX {
954
938
  interface IntrinsicElements {
955
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
939
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
956
940
  }
957
941
  }
958
942
  }
@@ -1064,6 +1048,25 @@ declare global {
1064
1048
  }
1065
1049
 
1066
1050
 
1051
+ declare global {
1052
+ interface HTMLElementTagNameMap {
1053
+ 'gs-mutation-filter': MutationFilterComponent;
1054
+ }
1055
+ interface HTMLElementEventMap {
1056
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1057
+ }
1058
+ }
1059
+
1060
+
1061
+ declare global {
1062
+ namespace JSX {
1063
+ interface IntrinsicElements {
1064
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1065
+ }
1066
+ }
1067
+ }
1068
+
1069
+
1067
1070
  declare global {
1068
1071
  interface HTMLElementTagNameMap {
1069
1072
  'gs-lineage-filter': LineageFilterComponent;
@@ -1085,10 +1088,7 @@ declare global {
1085
1088
 
1086
1089
  declare global {
1087
1090
  interface HTMLElementTagNameMap {
1088
- 'gs-mutation-filter': MutationFilterComponent;
1089
- }
1090
- interface HTMLElementEventMap {
1091
- 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1091
+ 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1092
1092
  }
1093
1093
  }
1094
1094
 
@@ -1096,7 +1096,7 @@ declare global {
1096
1096
  declare global {
1097
1097
  namespace JSX {
1098
1098
  interface IntrinsicElements {
1099
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1099
+ 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1100
1100
  }
1101
1101
  }
1102
1102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -2,4 +2,17 @@ import { createContext } from 'preact';
2
2
 
3
3
  import { type ReferenceGenome } from '../lapisApi/ReferenceGenome';
4
4
 
5
- export const ReferenceGenomeContext = createContext<ReferenceGenome>({ nucleotideSequences: [], genes: [] });
5
+ const UNINITIALIZED_SEQUENCE = '__uninitialized__';
6
+
7
+ export const ReferenceGenomeContext = createContext<ReferenceGenome>({
8
+ nucleotideSequences: [{ name: UNINITIALIZED_SEQUENCE, sequence: '' }],
9
+ genes: [],
10
+ });
11
+
12
+ export function isNotInitialized(referenceGenome: ReferenceGenome) {
13
+ return (
14
+ referenceGenome.genes.length === 0 &&
15
+ referenceGenome.nucleotideSequences.length === 1 &&
16
+ referenceGenome.nucleotideSequences[0].name === UNINITIALIZED_SEQUENCE
17
+ );
18
+ }
@@ -13,6 +13,7 @@ interface AggregateBarChartProps {
13
13
  data: AggregateData;
14
14
  fields: string[];
15
15
  maxNumberOfBars: number;
16
+ maintainAspectRatio: boolean;
16
17
  }
17
18
 
18
19
  Chart.register(...registerables, BarController);
@@ -23,7 +24,12 @@ type DataPoint = {
23
24
  proportion: number;
24
25
  };
25
26
 
26
- export const AggregateBarChart: FunctionComponent<AggregateBarChartProps> = ({ data, fields, maxNumberOfBars }) => {
27
+ export const AggregateBarChart: FunctionComponent<AggregateBarChartProps> = ({
28
+ data,
29
+ fields,
30
+ maxNumberOfBars,
31
+ maintainAspectRatio,
32
+ }) => {
27
33
  if (data.length === 0) {
28
34
  return <NoDataDisplay />;
29
35
  }
@@ -42,10 +48,22 @@ export const AggregateBarChart: FunctionComponent<AggregateBarChartProps> = ({ d
42
48
  );
43
49
  }
44
50
 
45
- return <AggregateBarChartInner data={data} fields={fields} maxNumberOfBars={maxNumberOfBars} />;
51
+ return (
52
+ <AggregateBarChartInner
53
+ data={data}
54
+ fields={fields}
55
+ maxNumberOfBars={maxNumberOfBars}
56
+ maintainAspectRatio={maintainAspectRatio}
57
+ />
58
+ );
46
59
  };
47
60
 
48
- const AggregateBarChartInner: FunctionComponent<AggregateBarChartProps> = ({ data, fields, maxNumberOfBars }) => {
61
+ const AggregateBarChartInner: FunctionComponent<AggregateBarChartProps> = ({
62
+ data,
63
+ fields,
64
+ maxNumberOfBars,
65
+ maintainAspectRatio,
66
+ }) => {
49
67
  const config = useMemo((): ChartConfiguration<'bar', DataPoint[]> => {
50
68
  const { datasets, countsOfEachBar } = getDatasets(fields, maxNumberOfBars, data);
51
69
 
@@ -55,7 +73,7 @@ const AggregateBarChartInner: FunctionComponent<AggregateBarChartProps> = ({ dat
55
73
  datasets,
56
74
  },
57
75
  options: {
58
- maintainAspectRatio: false,
76
+ maintainAspectRatio,
59
77
  animation: false,
60
78
  indexAxis: 'y',
61
79
  scales: {
@@ -64,6 +82,9 @@ const AggregateBarChartInner: FunctionComponent<AggregateBarChartProps> = ({ dat
64
82
  },
65
83
  y: {
66
84
  stacked: true,
85
+ ticks: {
86
+ autoSkip: false,
87
+ },
67
88
  },
68
89
  },
69
90
  plugins: {
@@ -92,7 +113,7 @@ const AggregateBarChartInner: FunctionComponent<AggregateBarChartProps> = ({ dat
92
113
  },
93
114
  },
94
115
  };
95
- }, [data, fields, maxNumberOfBars]);
116
+ }, [data, fields, maintainAspectRatio, maxNumberOfBars]);
96
117
 
97
118
  return <GsChart configuration={config} />;
98
119
  };
@@ -55,7 +55,6 @@ export const Default: StoryObj<AggregateProps> = {
55
55
  country: 'USA',
56
56
  },
57
57
  width: '100%',
58
- height: '700px',
59
58
  initialSortField: 'count',
60
59
  initialSortDirection: 'descending',
61
60
  pageSize: 10,
@@ -15,6 +15,7 @@ import { ResizeContainer } from '../components/resize-container';
15
15
  import Tabs from '../components/tabs';
16
16
  import { useQuery } from '../useQuery';
17
17
  import { AggregateBarChart } from './aggregate-bar-chart';
18
+ import { getMaintainAspectRatio } from '../shared/charts/getMaintainAspectRatio';
18
19
 
19
20
  const aggregateViewSchema = z.union([z.literal(views.table), z.literal(views.bar)]);
20
21
  export type AggregateView = z.infer<typeof aggregateViewSchema>;
@@ -27,7 +28,7 @@ const aggregatePropsSchema = z.object({
27
28
  initialSortDirection: z.union([z.literal('ascending'), z.literal('descending')]),
28
29
  pageSize: z.union([z.boolean(), z.number()]),
29
30
  width: z.string(),
30
- height: z.string(),
31
+ height: z.string().optional(),
31
32
  maxNumberOfBars: z.number(),
32
33
  });
33
34
  export type AggregateProps = z.infer<typeof aggregatePropsSchema>;
@@ -74,6 +75,8 @@ type AggregatedDataTabsProps = {
74
75
  };
75
76
 
76
77
  const AggregatedDataTabs: FunctionComponent<AggregatedDataTabsProps> = ({ data, originalComponentProps }) => {
78
+ const maintainAspectRatio = getMaintainAspectRatio(originalComponentProps.height);
79
+
77
80
  const getTab = (view: AggregateView) => {
78
81
  switch (view) {
79
82
  case views.table:
@@ -97,6 +100,7 @@ const AggregatedDataTabs: FunctionComponent<AggregatedDataTabsProps> = ({ data,
97
100
  data={data}
98
101
  fields={originalComponentProps.fields}
99
102
  maxNumberOfBars={originalComponentProps.maxNumberOfBars}
103
+ maintainAspectRatio={maintainAspectRatio}
100
104
  />
101
105
  ),
102
106
  };
@@ -1,8 +1,7 @@
1
1
  import { type ComponentChildren, type FunctionalComponent } from 'preact';
2
2
  import { useContext } from 'preact/hooks';
3
3
 
4
- import { type ReferenceGenome } from '../../lapisApi/ReferenceGenome';
5
- import { ReferenceGenomeContext } from '../ReferenceGenomeContext';
4
+ import { isNotInitialized, ReferenceGenomeContext } from '../ReferenceGenomeContext';
6
5
 
7
6
  /**
8
7
  * Sometimes the reference genome is not immediately available.
@@ -19,7 +18,3 @@ export const ReferenceGenomesAwaiter: FunctionalComponent<{ children: ComponentC
19
18
 
20
19
  return <>{children}</>;
21
20
  };
22
-
23
- function isNotInitialized(referenceGenome: ReferenceGenome) {
24
- return referenceGenome.nucleotideSequences.length === 0 && referenceGenome.genes.length === 0;
25
- }
@@ -2,7 +2,7 @@ import { type FunctionComponent } from 'preact';
2
2
 
3
3
  export type Size = {
4
4
  width: string;
5
- height: string;
5
+ height?: string;
6
6
  };
7
7
 
8
8
  export interface ResizeContainerProps {
@@ -13,11 +13,13 @@ Chart.register(...registerables, VennDiagramController, ArcSlice);
13
13
  export interface MutationComparisonVennProps {
14
14
  data: Dataset<MutationData>;
15
15
  proportionInterval: ProportionInterval;
16
+ maintainAspectRatio: boolean;
16
17
  }
17
18
 
18
19
  export const MutationComparisonVenn: FunctionComponent<MutationComparisonVennProps> = ({
19
20
  data,
20
21
  proportionInterval,
22
+ maintainAspectRatio,
21
23
  }) => {
22
24
  const [selectedDatasetIndex, setSelectedDatasetIndex] = useState<null | number>(null);
23
25
 
@@ -48,7 +50,7 @@ export const MutationComparisonVenn: FunctionComponent<MutationComparisonVennPro
48
50
  type: 'venn',
49
51
  data: sets,
50
52
  options: {
51
- maintainAspectRatio: false,
53
+ maintainAspectRatio,
52
54
  scales: {
53
55
  x: {
54
56
  ticks: {
@@ -91,7 +93,7 @@ export const MutationComparisonVenn: FunctionComponent<MutationComparisonVennPro
91
93
  },
92
94
  },
93
95
  }),
94
- [sets],
96
+ [maintainAspectRatio, sets],
95
97
  );
96
98
 
97
99
  if (data.content.length > 5) {
@@ -112,7 +112,6 @@ export const TwoVariants: StoryObj<MutationComparisonProps> = {
112
112
  sequenceType: 'nucleotide',
113
113
  views: ['table', 'venn'],
114
114
  width: '100%',
115
- height: '700px',
116
115
  pageSize: 10,
117
116
  },
118
117
  };
@@ -21,6 +21,7 @@ import { ProportionSelectorDropdown } from '../components/proportion-selector-dr
21
21
  import { ResizeContainer } from '../components/resize-container';
22
22
  import { type DisplayedSegment, SegmentSelector, useDisplayedSegments } from '../components/segment-selector';
23
23
  import Tabs from '../components/tabs';
24
+ import { getMaintainAspectRatio } from '../shared/charts/getMaintainAspectRatio';
24
25
  import { useQuery } from '../useQuery';
25
26
 
26
27
  export const mutationComparisonViewSchema = z.union([z.literal(views.table), z.literal(views.venn)]);
@@ -28,7 +29,7 @@ export type MutationComparisonView = z.infer<typeof mutationComparisonViewSchema
28
29
 
29
30
  const mutationComparisonPropsSchema = z.object({
30
31
  width: z.string(),
31
- height: z.string(),
32
+ height: z.string().optional(),
32
33
  lapisFilters: z.array(namedLapisFilterSchema).min(1),
33
34
  sequenceType: sequenceTypeSchema,
34
35
  views: z.array(mutationComparisonViewSchema),
@@ -91,6 +92,8 @@ const MutationComparisonTabs: FunctionComponent<MutationComparisonTabsProps> = (
91
92
  [data, displayedSegments, displayedMutationTypes],
92
93
  );
93
94
 
95
+ const maintainAspectRatio = getMaintainAspectRatio(originalComponentProps.height);
96
+
94
97
  const getTab = (view: MutationComparisonView) => {
95
98
  switch (view) {
96
99
  case 'table':
@@ -111,6 +114,7 @@ const MutationComparisonTabs: FunctionComponent<MutationComparisonTabsProps> = (
111
114
  <MutationComparisonVenn
112
115
  data={{ content: filteredData }}
113
116
  proportionInterval={proportionInterval}
117
+ maintainAspectRatio={maintainAspectRatio}
114
118
  />
115
119
  ),
116
120
  };
@@ -1,4 +1,4 @@
1
- import { type PreactRenderer, type Meta, type StoryObj } from '@storybook/preact';
1
+ import { type Meta, type PreactRenderer, type StoryObj } from '@storybook/preact';
2
2
  import { expect, fireEvent, fn, userEvent, waitFor, within } from '@storybook/test';
3
3
  import { type StepFunction } from '@storybook/types';
4
4
 
@@ -8,6 +8,7 @@ import { LAPIS_URL } from '../../constants';
8
8
  import referenceGenome from '../../lapisApi/__mockData__/referenceGenome.json';
9
9
  import { LapisUrlContextProvider } from '../LapisUrlContext';
10
10
  import { ReferenceGenomeContext } from '../ReferenceGenomeContext';
11
+ import { playThatExpectsErrorMessage } from '../shared/stories/expectErrorMessage';
11
12
 
12
13
  const meta: Meta<MutationFilterProps> = {
13
14
  title: 'Input/MutationFilter',
@@ -219,6 +220,21 @@ export const WithInitialValue: StoryObj<MutationFilterProps> = {
219
220
  },
220
221
  };
221
222
 
223
+ export const WithNoReferenceSequencesDefined: StoryObj<MutationFilterProps> = {
224
+ ...Default,
225
+ render: (args) => (
226
+ <LapisUrlContextProvider value={LAPIS_URL}>
227
+ <ReferenceGenomeContext.Provider value={{ nucleotideSequences: [], genes: [] }}>
228
+ <MutationFilter {...args} />
229
+ </ReferenceGenomeContext.Provider>
230
+ </LapisUrlContextProvider>
231
+ ),
232
+ play: playThatExpectsErrorMessage(
233
+ 'Error - No reference sequences available',
234
+ 'This organism has neither nucleotide nor amino acid sequences',
235
+ ),
236
+ };
237
+
222
238
  async function prepare(canvasElement: HTMLElement, step: StepFunction<PreactRenderer, unknown>) {
223
239
  const canvas = within(canvasElement);
224
240