@genspectrum/dashboard-components 0.10.4 → 0.11.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.
Files changed (53) hide show
  1. package/custom-elements.json +58 -58
  2. package/dist/components.d.ts +82 -32
  3. package/dist/components.js +57 -65
  4. package/dist/components.js.map +1 -1
  5. package/dist/{dateRangeOption-Doo6WHKu.js → dateRangeOption-Bh2p78z0.js} +9 -4
  6. package/dist/dateRangeOption-Bh2p78z0.js.map +1 -0
  7. package/dist/util.d.ts +623 -14
  8. package/dist/util.js +1 -1
  9. package/package.json +5 -5
  10. package/src/preact/aggregatedData/aggregate.stories.tsx +1 -1
  11. package/src/preact/aggregatedData/aggregate.tsx +11 -8
  12. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +3 -11
  13. package/src/preact/dateRangeSelector/date-range-selector.tsx +4 -4
  14. package/src/preact/mutationComparison/mutation-comparison.tsx +4 -6
  15. package/src/preact/mutationFilter/mutation-filter.tsx +4 -13
  16. package/src/preact/mutations/mutations.tsx +4 -4
  17. package/src/preact/mutationsOverTime/mutations-over-time.tsx +4 -4
  18. package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +4 -13
  19. package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +4 -4
  20. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +14 -25
  21. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +8 -8
  22. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +3 -14
  23. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +11 -7
  24. package/src/query/queryNumberOfSequencesOverTime.spec.ts +4 -4
  25. package/src/query/queryNumberOfSequencesOverTime.ts +1 -4
  26. package/src/query/queryPrevalenceOverTime.ts +1 -4
  27. package/src/types.ts +11 -4
  28. package/src/utilEntrypoint.ts +17 -4
  29. package/src/utils/utils.ts +0 -29
  30. package/src/web-components/app.ts +1 -1
  31. package/src/web-components/input/gs-date-range-selector.stories.ts +4 -4
  32. package/src/web-components/input/gs-date-range-selector.tsx +5 -5
  33. package/src/web-components/input/gs-lineage-filter.tsx +1 -1
  34. package/src/web-components/input/gs-location-filter.tsx +1 -1
  35. package/src/web-components/input/gs-mutation-filter.tsx +5 -8
  36. package/src/web-components/input/gs-text-input.tsx +1 -1
  37. package/src/web-components/visualization/gs-aggregate.stories.ts +3 -3
  38. package/src/web-components/visualization/gs-aggregate.tsx +10 -6
  39. package/src/web-components/visualization/gs-mutation-comparison.tsx +7 -2
  40. package/src/web-components/visualization/gs-mutations-over-time.tsx +7 -2
  41. package/src/web-components/visualization/gs-mutations.tsx +7 -2
  42. package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +5 -5
  43. package/src/web-components/visualization/gs-number-sequences-over-time.tsx +13 -15
  44. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +8 -8
  45. package/src/web-components/visualization/gs-prevalence-over-time.tsx +17 -14
  46. package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +4 -5
  47. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +17 -15
  48. package/src/web-components/visualization/gs-sequences-by-location.tsx +6 -1
  49. package/src/web-components/visualization/gs-statistics.tsx +12 -3
  50. package/standalone-bundle/dashboard-components.js +2520 -2516
  51. package/standalone-bundle/dashboard-components.js.map +1 -1
  52. package/dist/dateRangeOption-Doo6WHKu.js.map +0 -1
  53. package/src/utils/utils.spec.ts +0 -16
package/src/types.ts CHANGED
@@ -9,7 +9,17 @@ import {
9
9
  type SubstitutionClass,
10
10
  } from './utils/mutations';
11
11
 
12
- export const lapisFilterSchema = z.record(z.union([z.string(), z.number(), z.null(), z.boolean()]));
12
+ export const mutationsFilterSchema = z.object({
13
+ nucleotideMutations: z.array(z.string()),
14
+ aminoAcidMutations: z.array(z.string()),
15
+ nucleotideInsertions: z.array(z.string()),
16
+ aminoAcidInsertions: z.array(z.string()),
17
+ });
18
+ export type MutationsFilter = z.infer<typeof mutationsFilterSchema>;
19
+
20
+ export const lapisFilterSchema = z
21
+ .record(z.union([z.string(), z.array(z.string()), z.number(), z.null(), z.boolean(), z.undefined()]))
22
+ .and(mutationsFilterSchema.partial());
13
23
  export type LapisFilter = z.infer<typeof lapisFilterSchema>;
14
24
 
15
25
  export const namedLapisFilterSchema = z.object({
@@ -66,6 +76,3 @@ export const views = {
66
76
  bubble: 'bubble',
67
77
  map: 'map',
68
78
  } as const;
69
-
70
- export const mutationComparisonViewSchema = z.union([z.literal(views.table), z.literal(views.venn)]);
71
- export type MutationComparisonView = z.infer<typeof mutationComparisonViewSchema>;
@@ -10,12 +10,25 @@ export {
10
10
  type LapisFilter,
11
11
  type SequenceType,
12
12
  views,
13
- type MutationComparisonView,
14
13
  type TemporalGranularity,
14
+ type MutationsFilter,
15
15
  } from './types';
16
16
 
17
- export { type SelectedMutationFilterStrings } from './preact/mutationFilter/mutation-filter';
17
+ export type { MutationComparisonView, MutationComparisonProps } from './preact/mutationComparison/mutation-comparison';
18
+ export type { MutationsView, MutationsProps } from './preact/mutations/mutations';
19
+ export type { AggregateView, AggregateProps } from './preact/aggregatedData/aggregate';
20
+ export type {
21
+ NumberSequencesOverTimeView,
22
+ NumberSequencesOverTimeProps,
23
+ } from './preact/numberSequencesOverTime/number-sequences-over-time';
24
+ export type { PrevalenceOverTimeView, PrevalenceOverTimeProps } from './preact/prevalenceOverTime/prevalence-over-time';
25
+ export type {
26
+ RelativeGrowthAdvantageView,
27
+ RelativeGrowthAdvantageProps,
28
+ } from './preact/relativeGrowthAdvantage/relative-growth-advantage';
29
+ export type { StatisticsProps } from './preact/statistic/statistics';
30
+ export type { MapSource } from './preact/map/useGeoJsonMap';
18
31
 
19
- export { type ConfidenceIntervalMethod } from './preact/shared/charts/confideceInterval';
32
+ export type { ConfidenceIntervalMethod } from './preact/shared/charts/confideceInterval';
20
33
 
21
- export { type AxisMax, type YAxisMaxConfig } from './preact/shared/charts/getYAxisMax';
34
+ export type { AxisMax, YAxisMaxConfig } from './preact/shared/charts/getYAxisMax';
@@ -1,5 +1,3 @@
1
- import { type LapisFilter } from '../types';
2
-
3
1
  export function getMinMaxNumber(values: Iterable<number>): [number, number] | null {
4
2
  let min = null;
5
3
  let max = null;
@@ -16,30 +14,3 @@ export function getMinMaxNumber(values: Iterable<number>): [number, number] | nu
16
14
  }
17
15
  return [min, max];
18
16
  }
19
-
20
- export function mapLapisFilterToUrlParams(filter: LapisFilter): URLSearchParams {
21
- const params = Object.entries(filter).map(([key, value]) => [key, stringifyLapisFilterValue(value)]);
22
-
23
- return new URLSearchParams(params);
24
- }
25
-
26
- function stringifyLapisFilterValue(value: LapisFilter[string]) {
27
- if (value === null) {
28
- return 'null';
29
- }
30
- switch (typeof value) {
31
- case 'boolean':
32
- return value ? 'true' : 'false';
33
- case 'number':
34
- return value.toString();
35
- case 'string':
36
- return value;
37
- }
38
- }
39
-
40
- export function makeArray<T>(arrayOrSingleItem: T | T[]) {
41
- if (Array.isArray(arrayOrSingleItem)) {
42
- return arrayOrSingleItem;
43
- }
44
- return [arrayOrSingleItem];
45
- }
@@ -2,7 +2,7 @@ import { provide } from '@lit/context';
2
2
  import { Task } from '@lit/task';
3
3
  import { html, LitElement } from 'lit';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
5
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
6
6
  import z from 'zod';
7
7
 
8
8
  import { lapisContext } from './lapis-context';
@@ -20,7 +20,7 @@ const codeExample = String.raw`
20
20
  initialDateFrom="2020-01-01"
21
21
  initialDateTo="2021-01-01"
22
22
  width="100%"
23
- dateColumn="myDateColumn"
23
+ lapisDateField="myDateColumn"
24
24
  ></gs-date-range-selector>`;
25
25
 
26
26
  const customDateRange = { label: 'CustomDateRange', dateFrom: '2021-01-01', dateTo: '2021-12-31' };
@@ -46,7 +46,7 @@ const meta: Meta<Required<DateRangeSelectorProps>> = {
46
46
  },
47
47
  options: [dateRangeOptionPresets.lastMonth.label, dateRangeOptionPresets.allTimes.label, 'CustomDateRange'],
48
48
  },
49
- dateColumn: { control: { type: 'text' } },
49
+ lapisDateField: { control: { type: 'text' } },
50
50
  dateRangeOptions: {
51
51
  control: {
52
52
  type: 'object',
@@ -72,7 +72,7 @@ const meta: Meta<Required<DateRangeSelectorProps>> = {
72
72
  ],
73
73
  earliestDate: '1970-01-01',
74
74
  initialValue: dateRangeOptionPresets.lastMonth.label,
75
- dateColumn: 'aDateColumn',
75
+ lapisDateField: 'aDateColumn',
76
76
  width: '100%',
77
77
  initialDateFrom: undefined,
78
78
  initialDateTo: undefined,
@@ -93,7 +93,7 @@ export const Default: StoryObj<Required<DateRangeSelectorProps>> = {
93
93
  .initialDateFrom=${args.initialDateFrom}
94
94
  .initialDateTo=${args.initialDateTo}
95
95
  .width=${args.width}
96
- .dateColumn=${args.dateColumn}
96
+ .lapisDateField=${args.lapisDateField}
97
97
  ></gs-date-range-selector>
98
98
  </div>
99
99
  </gs-app>`,
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { DateRangeSelector, type DateRangeSelectorProps } from '../../preact/dateRangeSelector/date-range-selector';
5
5
  import { type DateRangeOptionChangedEvent } from '../../preact/dateRangeSelector/dateRangeOption';
@@ -103,10 +103,10 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
103
103
  width: string = '100%';
104
104
 
105
105
  /**
106
- * The name of the column in LAPIS that contains the date information.
106
+ * The name of the metadata field in LAPIS that contains the date information.
107
107
  */
108
108
  @property({ type: String })
109
- dateColumn: string = '';
109
+ lapisDateField: string = '';
110
110
 
111
111
  override render() {
112
112
  return (
@@ -116,7 +116,7 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
116
116
  initialValue={this.initialValue}
117
117
  initialDateFrom={this.initialDateFrom}
118
118
  initialDateTo={this.initialDateTo}
119
- dateColumn={this.dateColumn}
119
+ lapisDateField={this.lapisDateField}
120
120
  width={this.width}
121
121
  />
122
122
  );
@@ -161,6 +161,6 @@ type InitialDateToMatches = Expect<
161
161
  >;
162
162
  type WidthMatches = Expect<Equals<typeof DateRangeSelectorComponent.prototype.width, DateRangeSelectorProps['width']>>;
163
163
  type DateColumnMatches = Expect<
164
- Equals<typeof DateRangeSelectorComponent.prototype.dateColumn, DateRangeSelectorProps['dateColumn']>
164
+ Equals<typeof DateRangeSelectorComponent.prototype.lapisDateField, DateRangeSelectorProps['lapisDateField']>
165
165
  >;
166
166
  /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { LineageFilter, type LineageFilterProps } from '../../preact/lineageFilter/lineage-filter';
5
5
  import type { Equals, Expect } from '../../utils/typeAssertions';
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { LocationFilter, type LocationFilterProps } from '../../preact/locationFilter/location-filter';
5
5
  import type { Equals, Expect } from '../../utils/typeAssertions';
@@ -1,12 +1,9 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { ReferenceGenomesAwaiter } from '../../preact/components/ReferenceGenomesAwaiter';
5
- import {
6
- MutationFilter,
7
- type MutationFilterProps,
8
- type SelectedMutationFilterStrings,
9
- } from '../../preact/mutationFilter/mutation-filter';
5
+ import { MutationFilter, type MutationFilterProps } from '../../preact/mutationFilter/mutation-filter';
6
+ import type { MutationsFilter } from '../../types';
10
7
  import type { Equals, Expect } from '../../utils/typeAssertions';
11
8
  import { PreactLitAdapter } from '../PreactLitAdapter';
12
9
 
@@ -64,7 +61,7 @@ export class MutationFilterComponent extends PreactLitAdapter {
64
61
  * All values provided must be valid mutations or insertions.
65
62
  * Invalid values will be ignored.
66
63
  */
67
- @property({ type: Object })
64
+ @property({type: Object})
68
65
  initialValue:
69
66
  {
70
67
  nucleotideMutations: string[];
@@ -98,7 +95,7 @@ declare global {
98
95
  }
99
96
 
100
97
  interface HTMLElementEventMap {
101
- 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
98
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
102
99
  }
103
100
  }
104
101
 
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { TextInput, type TextInputProps } from '../../preact/textInput/text-input';
5
5
  import type { Equals, Expect } from '../../utils/typeAssertions';
@@ -12,7 +12,7 @@ import '../app';
12
12
  const codeExample = `
13
13
  <gs-aggregate
14
14
  fields='["division", "host"]'
15
- filter='{"country": "USA"}'
15
+ lapisFilter='{"country": "USA"}'
16
16
  views='["table"]'
17
17
  width='100%'
18
18
  height='700px'
@@ -74,7 +74,7 @@ export const Table: StoryObj<Required<AggregateProps>> = {
74
74
  <gs-app lapis="${LAPIS_URL}">
75
75
  <gs-aggregate
76
76
  .fields=${args.fields}
77
- .filter=${args.filter}
77
+ .lapisFilter=${args.lapisFilter}
78
78
  .views=${args.views}
79
79
  .width=${args.width}
80
80
  .height=${args.height}
@@ -87,7 +87,7 @@ export const Table: StoryObj<Required<AggregateProps>> = {
87
87
  args: {
88
88
  fields: ['division', 'host'],
89
89
  views: ['table'],
90
- filter: {
90
+ lapisFilter: {
91
91
  country: 'USA',
92
92
  },
93
93
  width: '100%',
@@ -1,8 +1,7 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
2
  import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
- import { Aggregate, type AggregateProps, type View } from '../../preact/aggregatedData/aggregate';
5
- import { type LapisFilter } from '../../types';
4
+ import { Aggregate, type AggregateProps, type AggregateView } from '../../preact/aggregatedData/aggregate';
6
5
  import { type Equals, type Expect } from '../../utils/typeAssertions';
7
6
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
8
7
 
@@ -38,14 +37,19 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
38
37
  * A list of tabs with views that this component should provide.
39
38
  */
40
39
  @property({ type: Array })
41
- views: View[] = ['table'];
40
+ views: AggregateView[] = ['table'];
42
41
 
43
42
  /**
44
43
  * The filter to apply to the data.
45
44
  * It must be a valid LAPIS filter object.
46
45
  */
47
46
  @property({ type: Object })
48
- filter: LapisFilter = {};
47
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
48
+ nucleotideMutations?: string[];
49
+ aminoAcidMutations?: string[];
50
+ nucleotideInsertions?: string[];
51
+ aminoAcidInsertions?: string[];
52
+ } = {};
49
53
 
50
54
  /**
51
55
  * The width of the component.
@@ -88,7 +92,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
88
92
  <Aggregate
89
93
  fields={this.fields}
90
94
  views={this.views}
91
- filter={this.filter}
95
+ lapisFilter={this.lapisFilter}
92
96
  width={this.width}
93
97
  height={this.height}
94
98
  initialSortField={this.initialSortField}
@@ -117,7 +121,7 @@ declare global {
117
121
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
118
122
  type FieldsMatches = Expect<Equals<typeof AggregateComponent.prototype.fields, AggregateProps['fields']>>;
119
123
  type ViewsMatches = Expect<Equals<typeof AggregateComponent.prototype.views, AggregateProps['views']>>;
120
- type FilterMatches = Expect<Equals<typeof AggregateComponent.prototype.filter, AggregateProps['filter']>>;
124
+ type FilterMatches = Expect<Equals<typeof AggregateComponent.prototype.lapisFilter, AggregateProps['lapisFilter']>>;
121
125
  type WidthMatches = Expect<Equals<typeof AggregateComponent.prototype.width, AggregateProps['width']>>;
122
126
  type HeightMatches = Expect<Equals<typeof AggregateComponent.prototype.height, AggregateProps['height']>>;
123
127
  type InitialSortFieldMatches = Expect<
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { MutationComparison, type MutationComparisonProps } from '../../preact/mutationComparison/mutation-comparison';
5
5
  import { type Equals, type Expect } from '../../utils/typeAssertions';
@@ -44,7 +44,12 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
44
44
  */
45
45
  @property({ type: Array })
46
46
  lapisFilters: {
47
- lapisFilter: Record<string, string | number | null | boolean>;
47
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
48
+ nucleotideMutations?: string[];
49
+ aminoAcidMutations?: string[];
50
+ nucleotideInsertions?: string[];
51
+ aminoAcidInsertions?: string[];
52
+ };
48
53
  displayName: string;
49
54
  }[] = [];
50
55
 
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { MutationsOverTime, type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
5
5
  import type { Equals, Expect } from '../../utils/typeAssertions';
@@ -36,7 +36,12 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
36
36
  * LAPIS filter to select the displayed data. If not provided, all data is displayed.
37
37
  */
38
38
  @property({ type: Object })
39
- lapisFilter: Record<string, string | number | null | boolean> = {};
39
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
40
+ nucleotideMutations?: string[];
41
+ aminoAcidMutations?: string[];
42
+ nucleotideInsertions?: string[];
43
+ aminoAcidInsertions?: string[];
44
+ } = {};
40
45
 
41
46
  /**
42
47
  * The type of the sequence for which the mutations should be shown.
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { Mutations, type MutationsProps } from '../../preact/mutations/mutations';
5
5
  import type { Equals, Expect } from '../../utils/typeAssertions';
@@ -38,7 +38,12 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
38
38
  * LAPIS filter to select the displayed data. If not provided, all data is displayed.
39
39
  */
40
40
  @property({ type: Object })
41
- lapisFilter: Record<string, string | number | null | boolean> = {};
41
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
42
+ nucleotideMutations?: string[];
43
+ aminoAcidMutations?: string[];
44
+ nucleotideInsertions?: string[];
45
+ aminoAcidInsertions?: string[];
46
+ } = {};
42
47
 
43
48
  /**
44
49
  * The type of the sequence for which the mutations should be shown.
@@ -15,7 +15,7 @@ import { withinShadowRoot } from '../withinShadowRoot.story';
15
15
 
16
16
  const codeExample = String.raw`
17
17
  <gs-number-sequences-over-time
18
- lapisFilter='[{ "displayName": "EG", "lapisFilter": { "country": "USA", "pangoLineage": "EG*" }}, { "displayName": "JN.1", "lapisFilter": { "country": "USA", "pangoLineage": "JN.1*" }}]'
18
+ lapisFilters='[{ "displayName": "EG", "lapisFilter": { "country": "USA", "pangoLineage": "EG*" }}, { "displayName": "JN.1", "lapisFilter": { "country": "USA", "pangoLineage": "JN.1*" }}]'
19
19
  lapisDateField="date"
20
20
  views='["bar", "line", "table"]'
21
21
  width="100%"
@@ -55,7 +55,7 @@ const Template: StoryObj<NumberSequencesOverTimeProps> = {
55
55
  render: (args) => html`
56
56
  <gs-app lapis="${LAPIS_URL}">
57
57
  <gs-number-sequences-over-time
58
- .lapisFilter=${args.lapisFilter}
58
+ .lapisFilters=${args.lapisFilters}
59
59
  .lapisDateField=${args.lapisDateField}
60
60
  .views=${args.views}
61
61
  .width=${args.width}
@@ -68,7 +68,7 @@ const Template: StoryObj<NumberSequencesOverTimeProps> = {
68
68
  `,
69
69
  args: {
70
70
  views: ['bar', 'line', 'table'],
71
- lapisFilter: [
71
+ lapisFilters: [
72
72
  { displayName: 'EG', lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2022-12-01' } },
73
73
  ],
74
74
  lapisDateField: 'date',
@@ -139,7 +139,7 @@ export const TwoDatasets: StoryObj<NumberSequencesOverTimeProps> = {
139
139
  ...Template,
140
140
  args: {
141
141
  ...Template.args,
142
- lapisFilter: [
142
+ lapisFilters: [
143
143
  {
144
144
  displayName: 'EG',
145
145
  lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2022-10-01' },
@@ -191,7 +191,7 @@ export const TwoDatasetsWithNonOverlappingDates: StoryObj<NumberSequencesOverTim
191
191
  ...Template,
192
192
  args: {
193
193
  ...Template.args,
194
- lapisFilter: [
194
+ lapisFilters: [
195
195
  {
196
196
  displayName: 'XBB',
197
197
  lapisFilter: { country: 'USA', pangoLineage: 'XBB*', dateFrom: '2022-01-01', dateTo: '2022-12-31' },
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import {
5
5
  NumberSequencesOverTime,
@@ -22,8 +22,6 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
22
22
  */
23
23
  @customElement('gs-number-sequences-over-time')
24
24
  export class NumberSequencesOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
25
- // prettier-ignore
26
- // The multiline union type must not start with `|` because it looks weird in the Storybook docs
27
25
  /**
28
26
  * Either a LAPIS filter or an array of LAPIS filters to fetch the number of sequences for.
29
27
  *
@@ -33,16 +31,16 @@ export class NumberSequencesOverTimeComponent extends PreactLitAdapterWithGridJs
33
31
  * The `displayName` will be used to label the component views.
34
32
  * It should be human-readable.
35
33
  *
36
- */ @property({type: Object})
37
- lapisFilter:
38
- {
39
- lapisFilter: Record<string, string | number | null | boolean>;
40
- displayName: string;
41
- }
42
- | {
43
- lapisFilter: Record<string, string | number | null | boolean>;
44
- displayName: string;
45
- }[]= { displayName: '', lapisFilter: {} };
34
+ */ @property({ type: Object })
35
+ lapisFilters: {
36
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
37
+ nucleotideMutations?: string[];
38
+ aminoAcidMutations?: string[];
39
+ nucleotideInsertions?: string[];
40
+ aminoAcidInsertions?: string[];
41
+ };
42
+ displayName: string;
43
+ }[] = [];
46
44
 
47
45
  /**
48
46
  * Required.
@@ -104,7 +102,7 @@ export class NumberSequencesOverTimeComponent extends PreactLitAdapterWithGridJs
104
102
  override render() {
105
103
  return (
106
104
  <NumberSequencesOverTime
107
- lapisFilter={this.lapisFilter}
105
+ lapisFilters={this.lapisFilters}
108
106
  lapisDateField={this.lapisDateField}
109
107
  views={this.views}
110
108
  width={this.width}
@@ -134,7 +132,7 @@ declare global {
134
132
 
135
133
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
136
134
  type LapisFilterMatches = Expect<
137
- Equals<typeof NumberSequencesOverTimeComponent.prototype.lapisFilter, NumberSequencesOverTimeProps['lapisFilter']>
135
+ Equals<typeof NumberSequencesOverTimeComponent.prototype.lapisFilters, NumberSequencesOverTimeProps['lapisFilters']>
138
136
  >;
139
137
  type LapisDateFieldMatches = Expect<
140
138
  Equals<
@@ -34,8 +34,6 @@ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
34
34
  title: 'Visualization/Prevalence over time',
35
35
  component: 'gs-prevalence-over-time',
36
36
  argTypes: {
37
- numeratorFilter: { control: 'object' },
38
- denominatorFilter: { control: 'object' },
39
37
  granularity: {
40
38
  options: ['day', 'week', 'month', 'year'],
41
39
  control: { type: 'radio' },
@@ -71,7 +69,7 @@ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
71
69
  render: (args) => html`
72
70
  <gs-app lapis="${LAPIS_URL}">
73
71
  <gs-prevalence-over-time
74
- .numeratorFilter=${args.numeratorFilter}
72
+ .numeratorFilters=${args.numeratorFilters}
75
73
  .denominatorFilter=${args.denominatorFilter}
76
74
  .granularity=${args.granularity}
77
75
  .smoothingWindow=${args.smoothingWindow}
@@ -91,7 +89,7 @@ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
91
89
  export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeProps>> = {
92
90
  ...Template,
93
91
  args: {
94
- numeratorFilter: [
92
+ numeratorFilters: [
95
93
  { displayName: 'EG', lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' } },
96
94
  { displayName: 'JN.1', lapisFilter: { country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' } },
97
95
  ],
@@ -165,10 +163,12 @@ export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeProps>> = {
165
163
  export const OneDataset: StoryObj<Required<PrevalenceOverTimeProps>> = {
166
164
  ...Template,
167
165
  args: {
168
- numeratorFilter: {
169
- displayName: 'EG',
170
- lapisFilter: { country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
171
- },
166
+ numeratorFilters: [
167
+ {
168
+ displayName: 'EG',
169
+ lapisFilter: { country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
170
+ },
171
+ ],
172
172
  denominatorFilter: { country: 'USA', dateFrom: '2023-10-01' },
173
173
  granularity: 'week',
174
174
  smoothingWindow: 2,
@@ -1,5 +1,5 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
- import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
2
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
4
  import { PrevalenceOverTime, type PrevalenceOverTimeProps } from '../../preact/prevalenceOverTime/prevalence-over-time';
5
5
  import { type Equals, type Expect } from '../../utils/typeAssertions';
@@ -44,8 +44,6 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
44
44
  */
45
45
  @customElement('gs-prevalence-over-time')
46
46
  export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
47
- // prettier-ignore
48
- // The multiline union type must not start with `|` because it looks weird in the Storybook docs
49
47
  /**
50
48
  * Either a LAPIS filter or an array of LAPIS filters to calculate the prevalence for.
51
49
  *
@@ -57,22 +55,27 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
57
55
  *
58
56
  */
59
57
  @property({ type: Object })
60
- numeratorFilter:
61
- {
62
- lapisFilter: Record<string, string | number | null | boolean>;
63
- displayName: string;
64
- }
65
- | {
66
- lapisFilter: Record<string, string | number | null | boolean>;
58
+ numeratorFilters: {
59
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
60
+ nucleotideMutations?: string[];
61
+ aminoAcidMutations?: string[];
62
+ nucleotideInsertions?: string[];
63
+ aminoAcidInsertions?: string[];
64
+ };
67
65
  displayName: string;
68
- }[] = { displayName: '', lapisFilter: {} };
66
+ }[] = [];
69
67
 
70
68
  /**
71
69
  * The LAPIS filter, to select the data of the reference.
72
70
  * It must be a valid LAPIS filter object.
73
71
  */
74
72
  @property({ type: Object })
75
- denominatorFilter: Record<string, string | number | null | boolean> = {};
73
+ denominatorFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
74
+ nucleotideMutations?: string[];
75
+ aminoAcidMutations?: string[];
76
+ nucleotideInsertions?: string[];
77
+ aminoAcidInsertions?: string[];
78
+ } = {};
76
79
 
77
80
  /**
78
81
  * The granularity of the time axis.
@@ -162,7 +165,7 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
162
165
  override render() {
163
166
  return (
164
167
  <PrevalenceOverTime
165
- numeratorFilter={this.numeratorFilter}
168
+ numeratorFilters={this.numeratorFilters}
166
169
  denominatorFilter={this.denominatorFilter}
167
170
  granularity={this.granularity}
168
171
  smoothingWindow={this.smoothingWindow}
@@ -196,7 +199,7 @@ declare global {
196
199
 
197
200
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
198
201
  type NumeratorMatches = Expect<
199
- Equals<typeof PrevalenceOverTimeComponent.prototype.numeratorFilter, PrevalenceOverTimeProps['numeratorFilter']>
202
+ Equals<typeof PrevalenceOverTimeComponent.prototype.numeratorFilters, PrevalenceOverTimeProps['numeratorFilters']>
200
203
  >;
201
204
  type DenominatorMatches = Expect<
202
205
  Equals<typeof PrevalenceOverTimeComponent.prototype.denominatorFilter, PrevalenceOverTimeProps['denominatorFilter']>
@@ -3,12 +3,11 @@ import { html } from 'lit';
3
3
 
4
4
  import './gs-relative-growth-advantage';
5
5
  import '../app';
6
- // eslint-disable-next-line no-duplicate-imports
7
- import { type RelativeGrowthAdvantageComponentProps } from './gs-relative-growth-advantage';
8
6
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
9
7
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
10
8
  import denominatorFilter from '../../preact/relativeGrowthAdvantage/__mockData__/denominatorFilter.json';
11
9
  import numeratorFilter from '../../preact/relativeGrowthAdvantage/__mockData__/numeratorFilter.json';
10
+ import type { RelativeGrowthAdvantageProps } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
12
11
 
13
12
  const codeExample = String.raw`
14
13
  <gs-relative-growth-advantage
@@ -23,7 +22,7 @@ const codeExample = String.raw`
23
22
  yAxisMaxLogarithmic="limitTo1"
24
23
  ></gs-relative-growth-advantage>`;
25
24
 
26
- const meta: Meta<RelativeGrowthAdvantageComponentProps> = {
25
+ const meta: Meta<RelativeGrowthAdvantageProps> = {
27
26
  title: 'Visualization/Relative growth advantage',
28
27
  component: 'gs-relative-growth-advantage',
29
28
  argTypes: {
@@ -51,7 +50,7 @@ const meta: Meta<RelativeGrowthAdvantageComponentProps> = {
51
50
 
52
51
  export default meta;
53
52
 
54
- const Template: StoryObj<Required<RelativeGrowthAdvantageComponentProps>> = {
53
+ const Template: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
55
54
  render: (args) => html`
56
55
  <gs-app lapis="${LAPIS_URL}">
57
56
  <gs-relative-growth-advantage
@@ -69,7 +68,7 @@ const Template: StoryObj<Required<RelativeGrowthAdvantageComponentProps>> = {
69
68
  `,
70
69
  };
71
70
 
72
- export const Default: StoryObj<Required<RelativeGrowthAdvantageComponentProps>> = {
71
+ export const Default: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
73
72
  ...Template,
74
73
  args: {
75
74
  numeratorFilter: {