@genspectrum/dashboard-components 0.10.0 → 0.10.2

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 (59) hide show
  1. package/custom-elements.json +186 -23
  2. package/dist/assets/{mutationOverTimeWorker-CvZg52rf.js.map → mutationOverTimeWorker-Di6yP1e6.js.map} +1 -1
  3. package/dist/components.d.ts +95 -45
  4. package/dist/components.js +402 -182
  5. package/dist/components.js.map +1 -1
  6. package/dist/{utilEntrypoint-g4DsyhU7.js → dateRangeOption-du8H7LWu.js} +33 -2
  7. package/dist/dateRangeOption-du8H7LWu.js.map +1 -0
  8. package/dist/style.css +41 -0
  9. package/dist/util.d.ts +114 -56
  10. package/dist/util.js +3 -2
  11. package/package.json +2 -2
  12. package/src/preact/components/color-scale-selector.tsx +7 -3
  13. package/src/preact/components/error-boundary.tsx +39 -5
  14. package/src/preact/components/error-display.tsx +40 -5
  15. package/src/preact/components/min-max-range-slider.tsx +4 -4
  16. package/src/preact/components/percent-intput.tsx +2 -2
  17. package/src/preact/dateRangeSelector/computeInitialValues.spec.ts +8 -2
  18. package/src/preact/dateRangeSelector/computeInitialValues.ts +6 -0
  19. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +16 -2
  20. package/src/preact/dateRangeSelector/date-range-selector.tsx +20 -15
  21. package/src/preact/dateRangeSelector/dateRangeOption.ts +10 -5
  22. package/src/preact/lineageFilter/lineage-filter.stories.tsx +18 -4
  23. package/src/preact/lineageFilter/lineage-filter.tsx +15 -10
  24. package/src/preact/locationFilter/location-filter.stories.tsx +14 -0
  25. package/src/preact/locationFilter/location-filter.tsx +15 -10
  26. package/src/preact/mutationComparison/mutation-comparison-venn.tsx +17 -18
  27. package/src/preact/mutationComparison/mutation-comparison.tsx +18 -12
  28. package/src/preact/mutationFilter/mutation-filter.tsx +0 -1
  29. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +1326 -9341
  30. package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +615 -4920
  31. package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +2203 -17624
  32. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +16 -8
  33. package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -3
  34. package/src/preact/shared/stories/expectInvalidAttributesErrorMessage.ts +13 -0
  35. package/src/preact/statistic/__mockData__/denominator.json +13 -0
  36. package/src/preact/statistic/__mockData__/numerator.json +13 -0
  37. package/src/preact/statistic/statistics.stories.tsx +81 -0
  38. package/src/preact/statistic/statistics.tsx +78 -0
  39. package/src/preact/webWorkers/useWebWorker.ts +8 -4
  40. package/src/query/queryGeneralStatistics.ts +18 -0
  41. package/src/query/queryMutationsOverTime.spec.ts +12 -27
  42. package/src/query/queryMutationsOverTime.ts +2 -6
  43. package/src/types.ts +19 -6
  44. package/src/utilEntrypoint.ts +8 -0
  45. package/src/utils/map2d.spec.ts +10 -10
  46. package/src/utils/map2d.ts +10 -10
  47. package/src/web-components/input/gs-date-range-selector.stories.ts +2 -2
  48. package/src/web-components/input/gs-date-range-selector.tsx +3 -3
  49. package/src/web-components/input/gs-lineage-filter.tsx +1 -1
  50. package/src/web-components/input/gs-location-filter.tsx +2 -2
  51. package/src/web-components/visualization/gs-aggregate.tsx +2 -2
  52. package/src/web-components/visualization/gs-statistics.stories.ts +95 -0
  53. package/src/web-components/visualization/gs-statistics.tsx +83 -0
  54. package/src/web-components/visualization/index.ts +1 -0
  55. package/standalone-bundle/assets/{mutationOverTimeWorker-CypX_PYM.js.map → mutationOverTimeWorker-cIyshfj_.js.map} +1 -1
  56. package/standalone-bundle/dashboard-components.js +7747 -7592
  57. package/standalone-bundle/dashboard-components.js.map +1 -1
  58. package/standalone-bundle/style.css +1 -1
  59. package/dist/utilEntrypoint-g4DsyhU7.js.map +0 -1
@@ -173,13 +173,13 @@ export declare class DateRangeSelectorComponent extends PreactLitAdapter {
173
173
  * If set, the date range selector will be initialized with the given date (overwriting `initialValue` to `custom`).
174
174
  * If `initialDateTo` is set, but this is unset, it will default to `earliestDate`.
175
175
  */
176
- initialDateFrom: string;
176
+ initialDateFrom: string | undefined;
177
177
  /**
178
178
  * A date string in the format `YYYY-MM-DD`.
179
179
  * If set, the date range selector will be initialized with the given date (overwriting `initialValue` to `custom`).
180
180
  * If `initialDateFrom` is set, but this is unset, it will default to the current date.
181
181
  */
182
- initialDateTo: string;
182
+ initialDateTo: string | undefined;
183
183
  /**
184
184
  * The width of the component.
185
185
  *
@@ -199,7 +199,9 @@ declare class ErrorEvent_2 extends Event {
199
199
  }
200
200
  export { ErrorEvent_2 as ErrorEvent }
201
201
 
202
- declare type LapisFilter = Record<string, string | number | null | boolean>;
202
+ declare type LapisFilter = default_2.infer<typeof lapisFilterSchema>;
203
+
204
+ declare const lapisFilterSchema: default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodNumber, default_2.ZodNull, default_2.ZodBoolean]>>;
203
205
 
204
206
  /**
205
207
  *
@@ -238,7 +240,7 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
238
240
  /**
239
241
  * The placeholder text to display in the input field.
240
242
  */
241
- placeholderText: string;
243
+ placeholderText: string | undefined;
242
244
  /**
243
245
  * The width of the component.
244
246
  *
@@ -281,7 +283,7 @@ export declare class LocationFilterComponent extends PreactLitAdapter {
281
283
  * The initial value to use for this location filter.
282
284
  * Must be of the form `valueForField1 / valueForField2 / ... / valueForFieldN`.
283
285
  */
284
- initialValue: string;
286
+ initialValue: string | undefined;
285
287
  /**
286
288
  * Required.
287
289
  *
@@ -300,7 +302,7 @@ export declare class LocationFilterComponent extends PreactLitAdapter {
300
302
  /**
301
303
  * The placeholder text to display in the input field, if it is empty.
302
304
  */
303
- placeholderText: string;
305
+ placeholderText: string | undefined;
304
306
  render(): JSX_2.Element;
305
307
  }
306
308
 
@@ -919,6 +921,38 @@ export declare class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
919
921
  render(): JSX_2.Element;
920
922
  }
921
923
 
924
+ /**
925
+ * ## Context
926
+ *
927
+ * This component displays general statistics (number of sequences, overall proportion)
928
+ * for a given numerator and denominator filter.
929
+ */
930
+ export declare class StatisticsComponent extends PreactLitAdapterWithGridJsStyles {
931
+ /**
932
+ * The filter to apply to the data for the overall number of sequences and as the numerator for the proportion.
933
+ * It must be a valid LAPIS filter object.
934
+ */
935
+ numeratorFilter: LapisFilter;
936
+ /**
937
+ * The filter to apply to the data for the denominator of the proportion.
938
+ * It must be a valid LAPIS filter object.
939
+ */
940
+ denominatorFilter: LapisFilter;
941
+ /**
942
+ * The width of the component.
943
+ *
944
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
945
+ */
946
+ width: string;
947
+ /**
948
+ * The height of the component.
949
+ *
950
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
951
+ */
952
+ height: string;
953
+ render(): JSX_2.Element;
954
+ }
955
+
922
956
  /**
923
957
  *
924
958
  * ## Context
@@ -995,7 +1029,11 @@ declare global {
995
1029
 
996
1030
  declare global {
997
1031
  interface HTMLElementTagNameMap {
998
- 'gs-mutation-comparison-component': MutationComparisonComponent;
1032
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1033
+ }
1034
+ interface HTMLElementEventMap {
1035
+ 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1036
+ 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
999
1037
  }
1000
1038
  }
1001
1039
 
@@ -1003,7 +1041,7 @@ declare global {
1003
1041
  declare global {
1004
1042
  namespace JSX {
1005
1043
  interface IntrinsicElements {
1006
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1044
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1007
1045
  }
1008
1046
  }
1009
1047
  }
@@ -1011,7 +1049,10 @@ declare global {
1011
1049
 
1012
1050
  declare global {
1013
1051
  interface HTMLElementTagNameMap {
1014
- 'gs-mutations-component': MutationsComponent;
1052
+ 'gs-location-filter': LocationFilterComponent;
1053
+ }
1054
+ interface HTMLElementEventMap {
1055
+ 'gs-location-changed': CustomEvent<Record<string, string>>;
1015
1056
  }
1016
1057
  }
1017
1058
 
@@ -1019,7 +1060,7 @@ declare global {
1019
1060
  declare global {
1020
1061
  namespace JSX {
1021
1062
  interface IntrinsicElements {
1022
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1063
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1023
1064
  }
1024
1065
  }
1025
1066
  }
@@ -1027,7 +1068,10 @@ declare global {
1027
1068
 
1028
1069
  declare global {
1029
1070
  interface HTMLElementTagNameMap {
1030
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1071
+ 'gs-text-input': TextInputComponent;
1072
+ }
1073
+ interface HTMLElementEventMap {
1074
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1031
1075
  }
1032
1076
  }
1033
1077
 
@@ -1035,7 +1079,7 @@ declare global {
1035
1079
  declare global {
1036
1080
  namespace JSX {
1037
1081
  interface IntrinsicElements {
1038
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1082
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1039
1083
  }
1040
1084
  }
1041
1085
  }
@@ -1043,7 +1087,10 @@ declare global {
1043
1087
 
1044
1088
  declare global {
1045
1089
  interface HTMLElementTagNameMap {
1046
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1090
+ 'gs-mutation-filter': MutationFilterComponent;
1091
+ }
1092
+ interface HTMLElementEventMap {
1093
+ 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
1047
1094
  }
1048
1095
  }
1049
1096
 
@@ -1051,7 +1098,7 @@ declare global {
1051
1098
  declare global {
1052
1099
  namespace JSX {
1053
1100
  interface IntrinsicElements {
1054
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1101
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1055
1102
  }
1056
1103
  }
1057
1104
  }
@@ -1059,7 +1106,10 @@ declare global {
1059
1106
 
1060
1107
  declare global {
1061
1108
  interface HTMLElementTagNameMap {
1062
- 'gs-aggregate-component': AggregateComponent;
1109
+ 'gs-lineage-filter': LineageFilterComponent;
1110
+ }
1111
+ interface HTMLElementEventMap {
1112
+ 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1063
1113
  }
1064
1114
  }
1065
1115
 
@@ -1067,7 +1117,7 @@ declare global {
1067
1117
  declare global {
1068
1118
  namespace JSX {
1069
1119
  interface IntrinsicElements {
1070
- 'gs-aggregate-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1120
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1071
1121
  }
1072
1122
  }
1073
1123
  }
@@ -1075,7 +1125,7 @@ declare global {
1075
1125
 
1076
1126
  declare global {
1077
1127
  interface HTMLElementTagNameMap {
1078
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1128
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
1079
1129
  }
1080
1130
  }
1081
1131
 
@@ -1083,7 +1133,7 @@ declare global {
1083
1133
  declare global {
1084
1134
  namespace JSX {
1085
1135
  interface IntrinsicElements {
1086
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1136
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1087
1137
  }
1088
1138
  }
1089
1139
  }
@@ -1091,7 +1141,7 @@ declare global {
1091
1141
 
1092
1142
  declare global {
1093
1143
  interface HTMLElementTagNameMap {
1094
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1144
+ 'gs-mutations-component': MutationsComponent;
1095
1145
  }
1096
1146
  }
1097
1147
 
@@ -1099,7 +1149,7 @@ declare global {
1099
1149
  declare global {
1100
1150
  namespace JSX {
1101
1151
  interface IntrinsicElements {
1102
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1152
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1103
1153
  }
1104
1154
  }
1105
1155
  }
@@ -1107,11 +1157,7 @@ declare global {
1107
1157
 
1108
1158
  declare global {
1109
1159
  interface HTMLElementTagNameMap {
1110
- 'gs-date-range-selector': DateRangeSelectorComponent;
1111
- }
1112
- interface HTMLElementEventMap {
1113
- 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1114
- 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1160
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1115
1161
  }
1116
1162
  }
1117
1163
 
@@ -1119,7 +1165,7 @@ declare global {
1119
1165
  declare global {
1120
1166
  namespace JSX {
1121
1167
  interface IntrinsicElements {
1122
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1168
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1123
1169
  }
1124
1170
  }
1125
1171
  }
@@ -1127,10 +1173,7 @@ declare global {
1127
1173
 
1128
1174
  declare global {
1129
1175
  interface HTMLElementTagNameMap {
1130
- 'gs-location-filter': LocationFilterComponent;
1131
- }
1132
- interface HTMLElementEventMap {
1133
- 'gs-location-changed': CustomEvent<Record<string, string>>;
1176
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1134
1177
  }
1135
1178
  }
1136
1179
 
@@ -1138,7 +1181,7 @@ declare global {
1138
1181
  declare global {
1139
1182
  namespace JSX {
1140
1183
  interface IntrinsicElements {
1141
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1184
+ 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1142
1185
  }
1143
1186
  }
1144
1187
  }
@@ -1146,10 +1189,7 @@ declare global {
1146
1189
 
1147
1190
  declare global {
1148
1191
  interface HTMLElementTagNameMap {
1149
- 'gs-text-input': TextInputComponent;
1150
- }
1151
- interface HTMLElementEventMap {
1152
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1192
+ 'gs-aggregate': AggregateComponent;
1153
1193
  }
1154
1194
  }
1155
1195
 
@@ -1157,7 +1197,7 @@ declare global {
1157
1197
  declare global {
1158
1198
  namespace JSX {
1159
1199
  interface IntrinsicElements {
1160
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1200
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1161
1201
  }
1162
1202
  }
1163
1203
  }
@@ -1165,10 +1205,7 @@ declare global {
1165
1205
 
1166
1206
  declare global {
1167
1207
  interface HTMLElementTagNameMap {
1168
- 'gs-mutation-filter': MutationFilterComponent;
1169
- }
1170
- interface HTMLElementEventMap {
1171
- 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
1208
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1172
1209
  }
1173
1210
  }
1174
1211
 
@@ -1176,7 +1213,7 @@ declare global {
1176
1213
  declare global {
1177
1214
  namespace JSX {
1178
1215
  interface IntrinsicElements {
1179
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1216
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1180
1217
  }
1181
1218
  }
1182
1219
  }
@@ -1184,10 +1221,23 @@ declare global {
1184
1221
 
1185
1222
  declare global {
1186
1223
  interface HTMLElementTagNameMap {
1187
- 'gs-lineage-filter': LineageFilterComponent;
1224
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1188
1225
  }
1189
- interface HTMLElementEventMap {
1190
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1226
+ }
1227
+
1228
+
1229
+ declare global {
1230
+ namespace JSX {
1231
+ interface IntrinsicElements {
1232
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1233
+ }
1234
+ }
1235
+ }
1236
+
1237
+
1238
+ declare global {
1239
+ interface HTMLElementTagNameMap {
1240
+ 'gs-statistics': StatisticsComponent;
1191
1241
  }
1192
1242
  }
1193
1243
 
@@ -1195,7 +1245,7 @@ declare global {
1195
1245
  declare global {
1196
1246
  namespace JSX {
1197
1247
  interface IntrinsicElements {
1198
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1248
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1199
1249
  }
1200
1250
  }
1201
1251
  }