@genspectrum/dashboard-components 0.18.1 → 0.18.3

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 (39) hide show
  1. package/custom-elements.json +9 -9
  2. package/dist/{LineageFilterChangedEvent-DkvWdq_G.js → LineageFilterChangedEvent-ixHQkq8y.js} +2 -2
  3. package/dist/{LineageFilterChangedEvent-DkvWdq_G.js.map → LineageFilterChangedEvent-ixHQkq8y.js.map} +1 -1
  4. package/dist/assets/{mutationOverTimeWorker-ChQTFL68.js.map → mutationOverTimeWorker--b8ZHlji.js.map} +1 -1
  5. package/dist/components.d.ts +22 -291
  6. package/dist/components.js +220 -124
  7. package/dist/components.js.map +1 -1
  8. package/dist/style.css +2 -2
  9. package/dist/util.d.ts +25 -292
  10. package/dist/util.js +1 -1
  11. package/package.json +3 -3
  12. package/src/preact/MutationAnnotationsContext.spec.tsx +103 -34
  13. package/src/preact/MutationAnnotationsContext.tsx +49 -7
  14. package/src/preact/components/annotated-mutation.stories.tsx +0 -5
  15. package/src/preact/components/annotated-mutation.tsx +6 -2
  16. package/src/preact/dateRangeFilter/computeInitialValues.spec.ts +2 -2
  17. package/src/preact/dateRangeFilter/computeInitialValues.ts +1 -1
  18. package/src/preact/dateRangeFilter/date-range-filter.stories.tsx +3 -5
  19. package/src/preact/dateRangeFilter/date-range-filter.tsx +12 -7
  20. package/src/preact/dateRangeFilter/dateRangeOption.ts +1 -1
  21. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +3 -1
  22. package/src/preact/mutations/mutations.stories.tsx +4 -1
  23. package/src/preact/mutationsOverTime/mutations-over-time-grid-tooltip.stories.tsx +108 -0
  24. package/src/preact/mutationsOverTime/mutations-over-time-grid-tooltip.tsx +93 -0
  25. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +7 -78
  26. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +3 -1
  27. package/src/preact/sequencesByLocation/leafletStyleModifications.css +5 -0
  28. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +25 -0
  29. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +65 -13
  30. package/src/web-components/MutationAnnotations.mdx +8 -0
  31. package/src/web-components/gs-app.stories.ts +2 -0
  32. package/src/web-components/gs-app.ts +4 -2
  33. package/src/web-components/input/gs-date-range-filter.stories.ts +1 -1
  34. package/src/web-components/input/gs-date-range-filter.tsx +7 -5
  35. package/src/web-components/mutation-annotations-context.ts +6 -2
  36. package/standalone-bundle/assets/mutationOverTimeWorker-jChgWnwp.js.map +1 -1
  37. package/standalone-bundle/dashboard-components.js +5778 -5707
  38. package/standalone-bundle/dashboard-components.js.map +1 -1
  39. package/standalone-bundle/style.css +1 -1
@@ -19,7 +19,9 @@ The mutation annotations can be (optionally) supplied to `gs-app` as a JSON obje
19
19
  description: 'This describes what is special about these mutations.',
20
20
  symbol: '+',
21
21
  nucleotideMutations: ['C44T', 'C774T', 'G24872T', 'T23011-'],
22
+ nucleotidePositions: ['123', '234'],
22
23
  aminoAcidMutations: ['S:501Y', 'S:S31-', 'ORF1a:S4286C'],
24
+ aminoAcidPositions: ['S:123', 'ORF1a:234']
23
25
  },
24
26
  ]"
25
27
  >
@@ -31,3 +33,9 @@ The mutation annotations are then distributed to child components.
31
33
  Whenever we display a mutation (e.g. in the `gs-mutations` table view)
32
34
  we will append the `symbol` of all matching annotations: <span>C44T<sup class='text-red-600'>+</sup></span>.
33
35
  Users can click on the mutation to open a modal that shows the `name` and `description` of the annotation.
36
+
37
+ The annotation can be applied to specific mutations:
38
+
39
+ - `nucleotideMutations: [C44T]` matches only the nucleotide mutation `C44T`,
40
+ - `aminoAcidPositions: [S:123]` matches all amino acid mutations that occur on the gene `S` at position `123`
41
+ - If the pathogen has only one segment, one can omit the segment, writing `123` for any mutation at position `123`.
@@ -51,7 +51,9 @@ const Template: StoryObj<StoryProps> = {
51
51
  description: 'This describes what is special about these mutations.',
52
52
  symbol: '*',
53
53
  nucleotideMutations: ['C44T', 'C774T', 'G24872T', 'T23011-'],
54
+ nucleotidePositions: ['123', '456'],
54
55
  aminoAcidMutations: ['S:501Y', 'S:S31-', 'ORF1a:S4286C'],
56
+ aminoAcidPositions: ['S:123'],
55
57
  },
56
58
  ],
57
59
  },
@@ -53,8 +53,10 @@ export class AppComponent extends LitElement {
53
53
  name: string;
54
54
  description: string;
55
55
  symbol: string;
56
- nucleotideMutations: string[];
57
- aminoAcidMutations: string[];
56
+ nucleotideMutations?: string[];
57
+ nucleotidePositions?: string[];
58
+ aminoAcidMutations?: string[];
59
+ aminoAcidPositions?: string[];
58
60
  }[] = [];
59
61
 
60
62
  /**
@@ -98,7 +98,7 @@ export const TestRenderAttributesInHtmlInsteadOfUsingPropertyExpression: StoryOb
98
98
  <gs-date-range-filter
99
99
  .dateRangeOptions=${args.dateRangeOptions}
100
100
  earliestDate="${args.earliestDate}"
101
- value="${args.value}"
101
+ value="${args.value ?? 'null'}"
102
102
  width="${args.width}"
103
103
  lapisDateField="${args.lapisDateField}"
104
104
  placeholder="${args.placeholder}"
@@ -38,12 +38,14 @@ import { PreactLitAdapter } from '../PreactLitAdapter';
38
38
  * Use this event, when you want to use the filter directly as a LAPIS filter.
39
39
  *
40
40
  *
41
- * @fires {CustomEvent<{ string | {dateFrom: string, dateTo: string}}>} gs-date-range-option-changed
41
+ * @fires {CustomEvent<string | {dateFrom: string, dateTo: string} | null>} gs-date-range-option-changed
42
42
  * Fired when:
43
43
  * - The select field is changed,
44
44
  * - A date is selected in either of the date pickers,
45
- * - A date was typed into either of the date input fields, and the input field loses focus ("on blur").
46
- * Contains the selected dateRangeOption or when users select custom values it contains the selected dates.
45
+ * - A date was typed into either of the date input fields, and the input field loses focus ("on blur"),
46
+ * - The user deletes the current value by clicking the 'x' button.
47
+ * Contains the selected dateRangeOption or when users select custom values it contains the selected dates
48
+ * or `null` when the input was deleted.
47
49
  *
48
50
  * Use this event, when you want to control this component in your JS application.
49
51
  * You can supply the `detail` of this event to the `value` attribute of this component.
@@ -80,7 +82,7 @@ export class DateRangeFilterComponent extends PreactLitAdapter {
80
82
  @property({
81
83
  converter: (value) => {
82
84
  if (value === null) {
83
- return undefined;
85
+ return null;
84
86
  }
85
87
  try {
86
88
  const result = JSON.parse(value) as unknown;
@@ -93,7 +95,7 @@ export class DateRangeFilterComponent extends PreactLitAdapter {
93
95
  }
94
96
  },
95
97
  })
96
- value: string | { dateFrom?: string; dateTo?: string } | undefined = undefined;
98
+ value: string | { dateFrom?: string; dateTo?: string } | null = null;
97
99
 
98
100
  /**
99
101
  * The width of the component.
@@ -1,12 +1,16 @@
1
1
  import { createContext } from '@lit/context';
2
2
  import z from 'zod';
3
3
 
4
+ const annotations = z.array(z.string());
5
+
4
6
  const mutationAnnotationSchema = z.object({
5
7
  name: z.string(),
6
8
  description: z.string(),
7
9
  symbol: z.string(),
8
- nucleotideMutations: z.array(z.string()),
9
- aminoAcidMutations: z.array(z.string()),
10
+ nucleotideMutations: annotations.optional(),
11
+ nucleotidePositions: annotations.optional(),
12
+ aminoAcidMutations: annotations.optional(),
13
+ aminoAcidPositions: annotations.optional(),
10
14
  });
11
15
  export type MutationAnnotation = z.infer<typeof mutationAnnotationSchema>;
12
16