@genspectrum/dashboard-components 0.6.13 → 0.6.15

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 (78) hide show
  1. package/README.md +29 -0
  2. package/custom-elements.json +23 -17
  3. package/dist/dashboard-components.js +8237 -37898
  4. package/dist/dashboard-components.js.map +1 -1
  5. package/dist/genspectrum-components.d.ts +26 -8
  6. package/dist/style.css +3 -3
  7. package/package.json +9 -8
  8. package/src/index.ts +8 -0
  9. package/src/lapisApi/lapisApi.ts +15 -7
  10. package/src/operator/FetchAggregatedOperator.ts +2 -7
  11. package/src/preact/components/color-scale-selector-dropdown.stories.tsx +1 -1
  12. package/src/preact/components/error-boundary.stories.tsx +21 -4
  13. package/src/preact/components/error-display.stories.tsx +20 -2
  14. package/src/preact/components/error-display.tsx +64 -10
  15. package/src/preact/components/info.stories.tsx +5 -5
  16. package/src/preact/components/info.tsx +2 -4
  17. package/src/preact/components/percent-intput.tsx +7 -2
  18. package/src/preact/components/proportion-selector.tsx +12 -2
  19. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +2 -3
  20. package/src/preact/dateRangeSelector/date-range-selector.tsx +4 -4
  21. package/src/preact/lineageFilter/lineage-filter.stories.tsx +2 -3
  22. package/src/preact/lineageFilter/lineage-filter.tsx +2 -2
  23. package/src/preact/locationFilter/fetchAutocompletionList.ts +1 -14
  24. package/src/preact/locationFilter/location-filter.stories.tsx +2 -3
  25. package/src/preact/locationFilter/location-filter.tsx +2 -2
  26. package/src/preact/mutationFilter/mutation-filter.stories.tsx +2 -3
  27. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_01.json +13 -0
  28. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_02.json +13 -0
  29. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_03.json +13 -0
  30. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_04.json +13 -0
  31. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_05.json +13 -0
  32. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_06.json +13 -0
  33. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_07.json +13 -0
  34. package/src/preact/mutationsOverTime/__mockData__/aggregated_20_01_2024.json +13 -0
  35. package/src/preact/mutationsOverTime/__mockData__/aggregated_21_01_2024.json +13 -0
  36. package/src/preact/mutationsOverTime/__mockData__/aggregated_22_01_2024.json +13 -0
  37. package/src/preact/mutationsOverTime/__mockData__/aggregated_23_01_2024.json +13 -0
  38. package/src/preact/mutationsOverTime/__mockData__/aggregated_24_01_2024.json +13 -0
  39. package/src/preact/mutationsOverTime/__mockData__/aggregated_25_01_2024.json +13 -0
  40. package/src/preact/mutationsOverTime/__mockData__/aggregated_26_01_2024.json +13 -0
  41. package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations_total.json +13 -0
  42. package/src/preact/mutationsOverTime/__mockData__/aggregated_week3_2024.json +13 -0
  43. package/src/preact/mutationsOverTime/__mockData__/aggregated_week4_2024.json +13 -0
  44. package/src/preact/mutationsOverTime/__mockData__/aggregated_week5_2024.json +13 -0
  45. package/src/preact/mutationsOverTime/__mockData__/aggregated_week6_2024.json +13 -0
  46. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +56 -8
  47. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +4 -2
  48. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +135 -0
  49. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +3 -3
  50. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +1 -1
  51. package/src/preact/shared/floating-ui/hooks.ts +1 -1
  52. package/src/preact/textInput/text-input.stories.tsx +2 -3
  53. package/src/preact/textInput/text-input.tsx +2 -2
  54. package/src/query/queryMutationsOverTime.spec.ts +210 -64
  55. package/src/query/queryMutationsOverTime.ts +10 -2
  56. package/src/web-components/app.stories.ts +0 -2
  57. package/src/web-components/errorHandling.mdx +8 -0
  58. package/src/web-components/input/gs-date-range-selector.stories.ts +2 -3
  59. package/src/web-components/input/gs-date-range-selector.tsx +24 -4
  60. package/src/web-components/input/gs-lineage-filter.stories.ts +2 -3
  61. package/src/web-components/input/gs-lineage-filter.tsx +15 -1
  62. package/src/web-components/input/gs-location-filter.stories.ts +2 -3
  63. package/src/web-components/input/gs-location-filter.tsx +13 -1
  64. package/src/web-components/input/gs-mutation-filter.stories.ts +2 -3
  65. package/src/web-components/input/gs-mutation-filter.tsx +1 -0
  66. package/src/web-components/input/gs-text-input.stories.ts +2 -3
  67. package/src/web-components/input/gs-text-input.tsx +13 -1
  68. package/src/web-components/visualization/gs-aggregate.tsx +17 -1
  69. package/src/web-components/visualization/gs-mutation-comparison.tsx +9 -0
  70. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +271 -0
  71. package/src/web-components/visualization/gs-mutations-over-time.tsx +7 -0
  72. package/src/web-components/visualization/gs-mutations.tsx +11 -5
  73. package/src/web-components/visualization/gs-number-sequences-over-time.tsx +15 -0
  74. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +8 -9
  75. package/src/web-components/visualization/gs-prevalence-over-time.tsx +26 -8
  76. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +43 -5
  77. package/standalone-bundle/dashboard-components.js +30920 -0
  78. package/standalone-bundle/dashboard-components.js.map +1 -0
@@ -1,7 +1,6 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
2
 
3
- import { Mutations, type View } from '../../preact/mutations/mutations';
4
- import { type LapisFilter, type SequenceType } from '../../types';
3
+ import { Mutations, type MutationsProps } from '../../preact/mutations/mutations';
5
4
  import type { Equals, Expect } from '../../utils/typeAssertions';
6
5
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
7
6
 
@@ -98,7 +97,14 @@ declare global {
98
97
  }
99
98
 
100
99
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
101
- type LapisFilterMatches = Expect<Equals<typeof MutationsComponent.prototype.lapisFilter, LapisFilter>>;
102
- type SequenceTypeMatches = Expect<Equals<typeof MutationsComponent.prototype.sequenceType, SequenceType>>;
103
- type ViewsMatches = Expect<Equals<typeof MutationsComponent.prototype.views, View[]>>;
100
+ type LapisFilterMatches = Expect<
101
+ Equals<typeof MutationsComponent.prototype.lapisFilter, MutationsProps['lapisFilter']>
102
+ >;
103
+ type SequenceTypeMatches = Expect<
104
+ Equals<typeof MutationsComponent.prototype.sequenceType, MutationsProps['sequenceType']>
105
+ >;
106
+ type ViewsMatches = Expect<Equals<typeof MutationsComponent.prototype.views, MutationsProps['views']>>;
107
+ type WidthMatches = Expect<Equals<typeof MutationsComponent.prototype.width, MutationsProps['width']>>;
108
+ type HeightMatches = Expect<Equals<typeof MutationsComponent.prototype.height, MutationsProps['height']>>;
109
+ type PageSizeMatches = Expect<Equals<typeof MutationsComponent.prototype.pageSize, MutationsProps['pageSize']>>;
104
110
  /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -128,9 +128,21 @@ declare global {
128
128
  type LapisFilterMatches = Expect<
129
129
  Equals<typeof NumberSequencesOverTimeComponent.prototype.lapisFilter, NumberSequencesOverTimeProps['lapisFilter']>
130
130
  >;
131
+ type LapisDateFieldMatches = Expect<
132
+ Equals<
133
+ typeof NumberSequencesOverTimeComponent.prototype.lapisDateField,
134
+ NumberSequencesOverTimeProps['lapisDateField']
135
+ >
136
+ >;
131
137
  type ViewsMatches = Expect<
132
138
  Equals<typeof NumberSequencesOverTimeComponent.prototype.views, NumberSequencesOverTimeProps['views']>
133
139
  >;
140
+ type WidhtMatches = Expect<
141
+ Equals<typeof NumberSequencesOverTimeComponent.prototype.width, NumberSequencesOverTimeProps['width']>
142
+ >;
143
+ type HeightMatches = Expect<
144
+ Equals<typeof NumberSequencesOverTimeComponent.prototype.height, NumberSequencesOverTimeProps['height']>
145
+ >;
134
146
  type GranularityMatches = Expect<
135
147
  Equals<typeof NumberSequencesOverTimeComponent.prototype.granularity, NumberSequencesOverTimeProps['granularity']>
136
148
  >;
@@ -140,4 +152,7 @@ type SmoothingWindowMatches = Expect<
140
152
  NumberSequencesOverTimeProps['smoothingWindow']
141
153
  >
142
154
  >;
155
+ type PageSizeMatches = Expect<
156
+ Equals<typeof NumberSequencesOverTimeComponent.prototype.pageSize, NumberSequencesOverTimeProps['pageSize']>
157
+ >;
143
158
  /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -4,8 +4,6 @@ import { html } from 'lit';
4
4
 
5
5
  import '../app';
6
6
  import './gs-prevalence-over-time';
7
- // eslint-disable-next-line no-duplicate-imports
8
- import { type PrevalenceOverTimeComponentProps } from './gs-prevalence-over-time';
9
7
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
10
8
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
11
9
  import denominatorFilter from '../../preact/prevalenceOverTime/__mockData__/denominatorFilter.json';
@@ -13,6 +11,7 @@ import denominatorFilterOneDataset from '../../preact/prevalenceOverTime/__mockD
13
11
  import numeratorFilterEG from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterEG.json';
14
12
  import numeratorFilterJN1 from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterJN1.json';
15
13
  import numeratorFilterOneDataset from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterOneDataset.json';
14
+ import { type PrevalenceOverTimeProps } from '../../preact/prevalenceOverTime/prevalence-over-time';
16
15
  import { withinShadowRoot } from '../withinShadowRoot.story';
17
16
 
18
17
  const codeExample = String.raw`
@@ -31,7 +30,7 @@ const codeExample = String.raw`
31
30
  yAxisMaxLogarithmic="limitTo1"
32
31
  ></gs-prevalence-over-time>`;
33
32
 
34
- const meta: Meta<Required<PrevalenceOverTimeComponentProps>> = {
33
+ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
35
34
  title: 'Visualization/Prevalence over time',
36
35
  component: 'gs-prevalence-over-time',
37
36
  argTypes: {
@@ -68,7 +67,7 @@ const meta: Meta<Required<PrevalenceOverTimeComponentProps>> = {
68
67
 
69
68
  export default meta;
70
69
 
71
- const Template: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
70
+ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
72
71
  render: (args) => html`
73
72
  <gs-app lapis="${LAPIS_URL}">
74
73
  <gs-prevalence-over-time
@@ -89,7 +88,7 @@ const Template: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
89
88
  `,
90
89
  };
91
90
 
92
- export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
91
+ export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeProps>> = {
93
92
  ...Template,
94
93
  args: {
95
94
  numeratorFilter: [
@@ -163,7 +162,7 @@ export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeComponentProps>> =
163
162
  },
164
163
  };
165
164
 
166
- export const OneDataset: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
165
+ export const OneDataset: StoryObj<Required<PrevalenceOverTimeProps>> = {
167
166
  ...Template,
168
167
  args: {
169
168
  numeratorFilter: {
@@ -221,7 +220,7 @@ export const OneDataset: StoryObj<Required<PrevalenceOverTimeComponentProps>> =
221
220
  },
222
221
  };
223
222
 
224
- export const OneDatasetOnLineTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
223
+ export const OneDatasetOnLineTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
225
224
  ...OneDataset,
226
225
  play: async ({ canvasElement }) => {
227
226
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
@@ -232,7 +231,7 @@ export const OneDatasetOnLineTab: StoryObj<Required<PrevalenceOverTimeComponentP
232
231
  },
233
232
  };
234
233
 
235
- export const OneDatasetOnBubbleTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
234
+ export const OneDatasetOnBubbleTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
236
235
  ...OneDataset,
237
236
  play: async ({ canvasElement }) => {
238
237
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
@@ -243,7 +242,7 @@ export const OneDatasetOnBubbleTab: StoryObj<Required<PrevalenceOverTimeComponen
243
242
  },
244
243
  };
245
244
 
246
- export const OneDatasetOnTableTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
245
+ export const OneDatasetOnTableTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
247
246
  ...OneDataset,
248
247
  play: async ({ canvasElement }) => {
249
248
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
@@ -1,7 +1,6 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
2
 
3
3
  import { PrevalenceOverTime, type PrevalenceOverTimeProps } from '../../preact/prevalenceOverTime/prevalence-over-time';
4
- import { type AxisMax } from '../../preact/shared/charts/getYAxisMax';
5
4
  import { type Equals, type Expect } from '../../utils/typeAssertions';
6
5
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
7
6
 
@@ -57,7 +56,7 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
57
56
  * It should be human-readable.
58
57
  *
59
58
  */
60
- @property({ type: Object })
59
+ @property({type: Object})
61
60
  numeratorFilter:
62
61
  {
63
62
  lapisFilter: Record<string, string | number | null | boolean>;
@@ -66,7 +65,7 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
66
65
  | {
67
66
  lapisFilter: Record<string, string | number | null | boolean>;
68
67
  displayName: string;
69
- }[] = { displayName: '', lapisFilter: {} };
68
+ }[] = {displayName: '', lapisFilter: {}};
70
69
 
71
70
  /**
72
71
  * Required.
@@ -182,11 +181,6 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
182
181
  }
183
182
  }
184
183
 
185
- export interface PrevalenceOverTimeComponentProps extends Omit<PrevalenceOverTimeProps, 'yAxisMaxConfig'> {
186
- yAxisMaxLinear?: AxisMax;
187
- yAxisMaxLogarithmic?: AxisMax;
188
- }
189
-
190
184
  declare global {
191
185
  interface HTMLElementTagNameMap {
192
186
  'gs-prevalence-over-time': PrevalenceOverTimeComponent;
@@ -203,6 +197,9 @@ type DenominatorMatches = Expect<
203
197
  type GranularityMatches = Expect<
204
198
  Equals<typeof PrevalenceOverTimeComponent.prototype.granularity, PrevalenceOverTimeProps['granularity']>
205
199
  >;
200
+ type SmoothingWindowMatches = Expect<
201
+ Equals<typeof PrevalenceOverTimeComponent.prototype.smoothingWindow, PrevalenceOverTimeProps['smoothingWindow']>
202
+ >;
206
203
  type ViewsMatches = Expect<
207
204
  Equals<typeof PrevalenceOverTimeComponent.prototype.views, PrevalenceOverTimeProps['views']>
208
205
  >;
@@ -212,4 +209,25 @@ type ConfidenceIntervalMethodsMatches = Expect<
212
209
  PrevalenceOverTimeProps['confidenceIntervalMethods']
213
210
  >
214
211
  >;
212
+ type WidhtMatches = Expect<
213
+ Equals<typeof PrevalenceOverTimeComponent.prototype.width, PrevalenceOverTimeProps['width']>
214
+ >;
215
+ type HeightMatches = Expect<
216
+ Equals<typeof PrevalenceOverTimeComponent.prototype.height, PrevalenceOverTimeProps['height']>
217
+ >;
218
+ type LapisDateFieldMatches = Expect<
219
+ Equals<typeof PrevalenceOverTimeComponent.prototype.lapisDateField, PrevalenceOverTimeProps['lapisDateField']>
220
+ >;
221
+ type PageSizeMatches = Expect<
222
+ Equals<typeof PrevalenceOverTimeComponent.prototype.pageSize, PrevalenceOverTimeProps['pageSize']>
223
+ >;
224
+ type YAxisMaxLinearMatches = Expect<
225
+ Equals<typeof PrevalenceOverTimeComponent.prototype.yAxisMaxLinear, PrevalenceOverTimeProps['yAxisMaxLinear']>
226
+ >;
227
+ type YAxisMaxLogarithmicMatches = Expect<
228
+ Equals<
229
+ typeof PrevalenceOverTimeComponent.prototype.yAxisMaxLogarithmic,
230
+ PrevalenceOverTimeProps['yAxisMaxLogarithmic']
231
+ >
232
+ >;
215
233
  /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -3,10 +3,8 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import {
4
4
  RelativeGrowthAdvantage,
5
5
  type RelativeGrowthAdvantageProps,
6
- type View,
7
6
  } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
8
7
  import { type AxisMax } from '../../preact/shared/charts/getYAxisMax';
9
- import type { LapisFilter } from '../../types';
10
8
  import { type Equals, type Expect } from '../../utils/typeAssertions';
11
9
  import { PreactLitAdapter } from '../PreactLitAdapter';
12
10
 
@@ -146,9 +144,49 @@ declare global {
146
144
  }
147
145
 
148
146
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
149
- type NumeratorMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.numeratorFilter, LapisFilter>>;
147
+ type NumeratorMatches = Expect<
148
+ Equals<
149
+ typeof RelativeGrowthAdvantageComponent.prototype.numeratorFilter,
150
+ RelativeGrowthAdvantageProps['numeratorFilter']
151
+ >
152
+ >;
150
153
  type DenominatorMatches = Expect<
151
- Equals<typeof RelativeGrowthAdvantageComponent.prototype.denominatorFilter, LapisFilter>
154
+ Equals<
155
+ typeof RelativeGrowthAdvantageComponent.prototype.denominatorFilter,
156
+ RelativeGrowthAdvantageProps['denominatorFilter']
157
+ >
158
+ >;
159
+ type GenerationTimeMatches = Expect<
160
+ Equals<
161
+ typeof RelativeGrowthAdvantageComponent.prototype.generationTime,
162
+ RelativeGrowthAdvantageProps['generationTime']
163
+ >
164
+ >;
165
+ type ViewsMatches = Expect<
166
+ Equals<typeof RelativeGrowthAdvantageComponent.prototype.views, RelativeGrowthAdvantageProps['views']>
167
+ >;
168
+ type WidthMatches = Expect<
169
+ Equals<typeof RelativeGrowthAdvantageComponent.prototype.width, RelativeGrowthAdvantageProps['width']>
170
+ >;
171
+ type HeightMatches = Expect<
172
+ Equals<typeof RelativeGrowthAdvantageComponent.prototype.height, RelativeGrowthAdvantageProps['height']>
173
+ >;
174
+ type LapisDateFieldMatches = Expect<
175
+ Equals<
176
+ typeof RelativeGrowthAdvantageComponent.prototype.lapisDateField,
177
+ RelativeGrowthAdvantageProps['lapisDateField']
178
+ >
179
+ >;
180
+ type YAxisMaxLinearMatches = Expect<
181
+ Equals<
182
+ typeof RelativeGrowthAdvantageComponent.prototype.yAxisMaxLinear,
183
+ Required<RelativeGrowthAdvantageProps['yAxisMaxConfig']>['linear']
184
+ >
185
+ >;
186
+ type YAxisMaxLogarithmicMatches = Expect<
187
+ Equals<
188
+ typeof RelativeGrowthAdvantageComponent.prototype.yAxisMaxLogarithmic,
189
+ Required<RelativeGrowthAdvantageProps['yAxisMaxConfig']>['logarithmic']
190
+ >
152
191
  >;
153
- type ViewsMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.views, View[]>>;
154
192
  /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */