@genspectrum/dashboard-components 0.19.7 → 0.19.9

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 (29) hide show
  1. package/custom-elements.json +33 -15
  2. package/dist/assets/mutationOverTimeWorker-BzmkceEA.js.map +1 -0
  3. package/dist/components.d.ts +24 -24
  4. package/dist/components.js +121 -21
  5. package/dist/components.js.map +1 -1
  6. package/dist/util.d.ts +24 -24
  7. package/package.json +1 -1
  8. package/src/lapisApi/LineageDefinition.ts +9 -0
  9. package/src/lapisApi/lapisApi.ts +27 -0
  10. package/src/preact/lineageFilter/__mockData__/lineageDefinition.json +38118 -0
  11. package/src/preact/lineageFilter/fetchLineageAutocompleteList.spec.ts +264 -6
  12. package/src/preact/lineageFilter/fetchLineageAutocompleteList.ts +104 -7
  13. package/src/preact/lineageFilter/lineage-filter.stories.tsx +13 -1
  14. package/src/preact/lineageFilter/lineage-filter.tsx +21 -11
  15. package/src/web-components/input/gs-lineage-filter.stories.ts +13 -1
  16. package/src/web-components/input/introduction.mdx +57 -2
  17. package/src/web-components/tutorials/CreateYourFirstOwnDashboard.mdx +85 -0
  18. package/src/web-components/tutorials/UseTheComponentsWithPlainJavaScript.mdx +140 -0
  19. package/src/web-components/tutorials/UseTheComponentsWithReact.mdx +166 -0
  20. package/src/web-components/visualization/gs-mutations.tsx +2 -2
  21. package/src/web-components/visualization/introduction.mdx +51 -0
  22. package/standalone-bundle/assets/mutationOverTimeWorker-jUeItsGM.js.map +1 -0
  23. package/standalone-bundle/dashboard-components.js +7007 -6953
  24. package/standalone-bundle/dashboard-components.js.map +1 -1
  25. package/dist/assets/mutationOverTimeWorker-DQGh08AS.js.map +0 -1
  26. package/src/web-components/visualization/data_visualization_statistical_analysis.mdx +0 -26
  27. package/standalone-bundle/assets/mutationOverTimeWorker-DAf2_NiP.js.map +0 -1
  28. /package/src/web-components/{MutationAnnotations.mdx → mutationAnnotations.mdx} +0 -0
  29. /package/src/web-components/{ResizeContainer.mdx → sizeOfComponents.mdx} +0 -0
package/dist/util.d.ts CHANGED
@@ -938,7 +938,7 @@ declare global {
938
938
 
939
939
  declare global {
940
940
  interface HTMLElementTagNameMap {
941
- 'gs-genome-data-viewer': GenomeDataViewerComponent;
941
+ 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
942
942
  }
943
943
  }
944
944
 
@@ -946,7 +946,7 @@ declare global {
946
946
  declare global {
947
947
  namespace JSX {
948
948
  interface IntrinsicElements {
949
- 'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
949
+ 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
950
950
  }
951
951
  }
952
952
  }
@@ -954,7 +954,7 @@ declare global {
954
954
 
955
955
  declare global {
956
956
  interface HTMLElementTagNameMap {
957
- 'gs-mutations-component': MutationsComponent;
957
+ 'gs-genome-data-viewer': GenomeDataViewerComponent;
958
958
  }
959
959
  }
960
960
 
@@ -962,7 +962,7 @@ declare global {
962
962
  declare global {
963
963
  namespace JSX {
964
964
  interface IntrinsicElements {
965
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
965
+ 'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
966
966
  }
967
967
  }
968
968
  }
@@ -986,7 +986,7 @@ declare global {
986
986
 
987
987
  declare global {
988
988
  interface HTMLElementTagNameMap {
989
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
989
+ 'gs-mutations': MutationsComponent;
990
990
  }
991
991
  }
992
992
 
@@ -994,7 +994,7 @@ declare global {
994
994
  declare global {
995
995
  namespace JSX {
996
996
  interface IntrinsicElements {
997
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
997
+ 'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
998
998
  }
999
999
  }
1000
1000
  }
@@ -1018,7 +1018,7 @@ declare global {
1018
1018
 
1019
1019
  declare global {
1020
1020
  interface HTMLElementTagNameMap {
1021
- 'gs-aggregate': AggregateComponent;
1021
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1022
1022
  }
1023
1023
  }
1024
1024
 
@@ -1026,7 +1026,7 @@ declare global {
1026
1026
  declare global {
1027
1027
  namespace JSX {
1028
1028
  interface IntrinsicElements {
1029
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1029
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1030
1030
  }
1031
1031
  }
1032
1032
  }
@@ -1034,7 +1034,7 @@ declare global {
1034
1034
 
1035
1035
  declare global {
1036
1036
  interface HTMLElementTagNameMap {
1037
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1037
+ 'gs-aggregate': AggregateComponent;
1038
1038
  }
1039
1039
  }
1040
1040
 
@@ -1042,7 +1042,7 @@ declare global {
1042
1042
  declare global {
1043
1043
  namespace JSX {
1044
1044
  interface IntrinsicElements {
1045
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1045
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1046
1046
  }
1047
1047
  }
1048
1048
  }
@@ -1050,7 +1050,7 @@ declare global {
1050
1050
 
1051
1051
  declare global {
1052
1052
  interface HTMLElementTagNameMap {
1053
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1053
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1054
1054
  }
1055
1055
  }
1056
1056
 
@@ -1058,7 +1058,7 @@ declare global {
1058
1058
  declare global {
1059
1059
  namespace JSX {
1060
1060
  interface IntrinsicElements {
1061
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1061
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1062
1062
  }
1063
1063
  }
1064
1064
  }
@@ -1066,7 +1066,7 @@ declare global {
1066
1066
 
1067
1067
  declare global {
1068
1068
  interface HTMLElementTagNameMap {
1069
- 'gs-sequences-by-location': SequencesByLocationComponent;
1069
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1070
1070
  }
1071
1071
  }
1072
1072
 
@@ -1074,7 +1074,7 @@ declare global {
1074
1074
  declare global {
1075
1075
  namespace JSX {
1076
1076
  interface IntrinsicElements {
1077
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1077
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1078
1078
  }
1079
1079
  }
1080
1080
  }
@@ -1082,7 +1082,7 @@ declare global {
1082
1082
 
1083
1083
  declare global {
1084
1084
  interface HTMLElementTagNameMap {
1085
- 'gs-statistics': StatisticsComponent;
1085
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1086
1086
  }
1087
1087
  }
1088
1088
 
@@ -1090,7 +1090,7 @@ declare global {
1090
1090
  declare global {
1091
1091
  namespace JSX {
1092
1092
  interface IntrinsicElements {
1093
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1093
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1094
1094
  }
1095
1095
  }
1096
1096
  }
@@ -1098,7 +1098,11 @@ declare global {
1098
1098
 
1099
1099
  declare global {
1100
1100
  interface HTMLElementTagNameMap {
1101
- 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1101
+ 'gs-date-range-filter': DateRangeFilterComponent;
1102
+ }
1103
+ interface HTMLElementEventMap {
1104
+ [gsEventNames.dateRangeFilterChanged]: CustomEvent<Record<string, string>>;
1105
+ [gsEventNames.dateRangeOptionChanged]: DateRangeOptionChangedEvent;
1102
1106
  }
1103
1107
  }
1104
1108
 
@@ -1106,7 +1110,7 @@ declare global {
1106
1110
  declare global {
1107
1111
  namespace JSX {
1108
1112
  interface IntrinsicElements {
1109
- 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1113
+ 'gs-date-range-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1110
1114
  }
1111
1115
  }
1112
1116
  }
@@ -1114,11 +1118,7 @@ declare global {
1114
1118
 
1115
1119
  declare global {
1116
1120
  interface HTMLElementTagNameMap {
1117
- 'gs-date-range-filter': DateRangeFilterComponent;
1118
- }
1119
- interface HTMLElementEventMap {
1120
- [gsEventNames.dateRangeFilterChanged]: CustomEvent<Record<string, string>>;
1121
- [gsEventNames.dateRangeOptionChanged]: DateRangeOptionChangedEvent;
1121
+ 'gs-statistics': StatisticsComponent;
1122
1122
  }
1123
1123
  }
1124
1124
 
@@ -1126,7 +1126,7 @@ declare global {
1126
1126
  declare global {
1127
1127
  namespace JSX {
1128
1128
  interface IntrinsicElements {
1129
- 'gs-date-range-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1129
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1130
1130
  }
1131
1131
  }
1132
1132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "0.19.7",
3
+ "version": "0.19.9",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -0,0 +1,9 @@
1
+ import z from 'zod';
2
+
3
+ const lineage = z.object({
4
+ parents: z.array(z.string()).optional(),
5
+ aliases: z.array(z.string()),
6
+ });
7
+
8
+ export const lineageDefinitionResponseSchema = z.record(lineage);
9
+ export type LineageDefinitionResponse = z.infer<typeof lineageDefinitionResponseSchema>;
@@ -11,6 +11,7 @@ import {
11
11
  type ProblemDetail,
12
12
  } from './lapisTypes';
13
13
  import { type SequenceType } from '../types';
14
+ import { lineageDefinitionResponseSchema } from './LineageDefinition';
14
15
 
15
16
  export class UnknownLapisError extends Error {
16
17
  constructor(
@@ -127,6 +128,30 @@ export async function fetchReferenceGenome(lapisUrl: string, signal?: AbortSigna
127
128
  return referenceGenomeResponse.parse(await response.json());
128
129
  }
129
130
 
131
+ export async function fetchLineageDefinition({
132
+ lapisUrl,
133
+ lapisField,
134
+ signal,
135
+ }: {
136
+ lapisUrl: string;
137
+ lapisField: string;
138
+ signal?: AbortSignal;
139
+ }) {
140
+ const response = await callLapis(
141
+ lineageDefinitionEndpoint(lapisUrl, lapisField),
142
+ {
143
+ method: 'GET',
144
+ headers: {
145
+ 'Content-Type': 'application/json',
146
+ },
147
+ signal,
148
+ },
149
+ `${lapisField} lineage definition`,
150
+ );
151
+
152
+ return lineageDefinitionResponseSchema.parse(await response.json());
153
+ }
154
+
130
155
  async function callLapis(
131
156
  input: Parameters<typeof fetch>[0],
132
157
  init: Parameters<typeof fetch>[1],
@@ -191,3 +216,5 @@ export const substitutionsOrDeletionsEndpoint = (lapisUrl: string, sequenceType:
191
216
  : `${lapisUrl}/sample/nucleotideMutations`;
192
217
  };
193
218
  export const referenceGenomeEndpoint = (lapisUrl: string) => `${lapisUrl}/sample/referenceGenome`;
219
+ export const lineageDefinitionEndpoint = (lapisUrl: string, lapisField: string) =>
220
+ `${lapisUrl}/sample/lineageDefinition/${lapisField}`;