@genspectrum/dashboard-components 0.12.1 → 0.13.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 (63) hide show
  1. package/custom-elements.json +292 -25
  2. package/dist/{LocationChangedEvent-CORvQvXv.js → LineageFilterChangedEvent-GedKNGFI.js} +25 -3
  3. package/dist/LineageFilterChangedEvent-GedKNGFI.js.map +1 -0
  4. package/dist/assets/mutationOverTimeWorker-B1-WrM4b.js.map +1 -0
  5. package/dist/components.d.ts +124 -25
  6. package/dist/components.js +765 -572
  7. package/dist/components.js.map +1 -1
  8. package/dist/style.css +3 -0
  9. package/dist/util.d.ts +48 -18
  10. package/dist/util.js +3 -1
  11. package/package.json +2 -2
  12. package/src/constants.ts +6 -0
  13. package/src/lapisApi/__mockData__/wiseReferenceGenome.json +9 -0
  14. package/src/lapisApi/lapisApi.ts +17 -0
  15. package/src/lapisApi/lapisTypes.ts +7 -1
  16. package/src/operator/FetchDetailsOperator.ts +28 -0
  17. package/src/preact/components/downshift-combobox.tsx +145 -0
  18. package/src/preact/components/tabs.tsx +1 -1
  19. package/src/preact/lineageFilter/LineageFilterChangedEvent.ts +11 -0
  20. package/src/preact/lineageFilter/fetchLineageAutocompleteList.spec.ts +16 -2
  21. package/src/preact/lineageFilter/fetchLineageAutocompleteList.ts +13 -2
  22. package/src/preact/lineageFilter/lineage-filter.stories.tsx +110 -9
  23. package/src/preact/lineageFilter/lineage-filter.tsx +40 -50
  24. package/src/preact/locationFilter/LocationChangedEvent.ts +1 -1
  25. package/src/preact/locationFilter/fetchAutocompletionList.spec.ts +6 -2
  26. package/src/preact/locationFilter/fetchAutocompletionList.ts +16 -6
  27. package/src/preact/locationFilter/location-filter.stories.tsx +33 -30
  28. package/src/preact/locationFilter/location-filter.tsx +47 -144
  29. package/src/preact/mutationsOverTime/MutationOverTimeData.ts +9 -5
  30. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +5 -3
  31. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.ts +4 -7
  32. package/src/preact/textInput/TextInputChangedEvent.ts +1 -1
  33. package/src/preact/textInput/fetchStringAutocompleteList.ts +20 -0
  34. package/src/preact/textInput/text-input.stories.tsx +14 -11
  35. package/src/preact/textInput/text-input.tsx +39 -140
  36. package/src/preact/wastewater/mutationsOverTime/__mockData__/details.json +88 -0
  37. package/src/preact/wastewater/mutationsOverTime/computeWastewaterMutationsOverTimeDataPerLocation.spec.ts +159 -0
  38. package/src/preact/wastewater/mutationsOverTime/computeWastewaterMutationsOverTimeDataPerLocation.ts +51 -0
  39. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +71 -0
  40. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +151 -0
  41. package/src/query/queryMutationsOverTime.ts +6 -14
  42. package/src/query/queryWastewaterMutationsOverTime.spec.ts +94 -0
  43. package/src/query/queryWastewaterMutationsOverTime.ts +55 -0
  44. package/src/types.ts +3 -0
  45. package/src/utilEntrypoint.ts +2 -0
  46. package/src/utils/map2d.ts +39 -0
  47. package/src/web-components/index.ts +1 -0
  48. package/src/web-components/input/gs-lineage-filter.stories.ts +120 -31
  49. package/src/web-components/input/gs-lineage-filter.tsx +24 -8
  50. package/src/web-components/input/gs-location-filter.stories.ts +9 -0
  51. package/src/web-components/input/gs-location-filter.tsx +21 -3
  52. package/src/web-components/input/gs-text-input.stories.ts +14 -5
  53. package/src/web-components/input/gs-text-input.tsx +23 -7
  54. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.stories.ts +82 -0
  55. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +112 -0
  56. package/src/web-components/wastewaterVisualization/index.ts +1 -0
  57. package/standalone-bundle/assets/{mutationOverTimeWorker-DEybsZ5r.js.map → mutationOverTimeWorker-Cls1J0cl.js.map} +1 -1
  58. package/standalone-bundle/dashboard-components.js +6972 -6796
  59. package/standalone-bundle/dashboard-components.js.map +1 -1
  60. package/standalone-bundle/style.css +1 -1
  61. package/dist/LocationChangedEvent-CORvQvXv.js.map +0 -1
  62. package/dist/assets/mutationOverTimeWorker-DTv93Ere.js.map +0 -1
  63. package/src/preact/textInput/fetchAutocompleteList.ts +0 -9
@@ -230,11 +230,11 @@ export { ErrorEvent_2 as ErrorEvent }
230
230
  * Currently, it is designed to work well with Pango Lineages,
231
231
  * but it may also be used for other lineage types, if suitable.
232
232
  *
233
- * It fetches all available values of the `lapisField` from the LAPIS instance
233
+ * It fetches all available values of the `lapisField` from the LAPIS instance within the given `lapisFilter`
234
234
  * and provides an autocomplete list with the available values of the lineage and sublineage queries
235
235
  * (a `*` appended to the lineage value).
236
236
  *
237
- * @fires {CustomEvent<Record<string, string>>} gs-lineage-filter-changed
237
+ * @fires {CustomEvent<Record<string, string | undefined>>} gs-lineage-filter-changed
238
238
  * Fired when the input field is changed.
239
239
  * The `details` of this event contain an object with the `lapisField` as key and the input value as value.
240
240
  * Example:
@@ -248,7 +248,7 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
248
248
  /**
249
249
  * The initial value to use for this lineage filter.
250
250
  */
251
- initialValue: string;
251
+ value: string;
252
252
  /**
253
253
  * Required.
254
254
  *
@@ -256,6 +256,17 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
256
256
  * The field must exist on this LAPIS instance.
257
257
  */
258
258
  lapisField: string;
259
+ /**
260
+ * The filter that is used to fetch the available the autocomplete options.
261
+ * If not set it fetches all available options.
262
+ * It must be a valid LAPIS filter object.
263
+ */
264
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
265
+ nucleotideMutations?: string[];
266
+ aminoAcidMutations?: string[];
267
+ nucleotideInsertions?: string[];
268
+ aminoAcidInsertions?: string[];
269
+ };
259
270
  /**
260
271
  * The placeholder text to display in the input field.
261
272
  */
@@ -275,10 +286,11 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
275
286
  * This component provides an input field to specify filters for locations.
276
287
  *
277
288
  * It expects a list of fields that form a strict hierarchical order, such as continent, country, and city.
278
- * The component retrieves a list of all possible values for these fields from the Lapis instance.
289
+ * The component retrieves a list of all possible values for these fields from the Lapis instance,
290
+ * within the `lapisFilter`.
279
291
  * This list is then utilized to display autocomplete suggestions and to validate the input.
280
292
  *
281
- * @fires {CustomEvent<Record<string, string>>} gs-location-changed
293
+ * @fires {CustomEvent<Record<string, string | undefined>>} gs-location-changed
282
294
  * Fired when a value from the datalist is selected or when a valid value is typed into the field.
283
295
  * The `details` of this event contain an object with all `fields` as keys
284
296
  * and the corresponding values as values, even if they are `undefined`.
@@ -296,7 +308,7 @@ export declare class LocationFilterComponent extends PreactLitAdapter {
296
308
  /**
297
309
  * The initial value to use for this location filter.
298
310
  */
299
- value: Record<string, string | null | undefined> | undefined;
311
+ value: Record<string, string | undefined> | undefined;
300
312
  /**
301
313
  * Required.
302
314
  *
@@ -306,6 +318,17 @@ export declare class LocationFilterComponent extends PreactLitAdapter {
306
318
  * (e.g., `fields = ['continent', 'country', 'city']`).
307
319
  */
308
320
  fields: string[];
321
+ /**
322
+ * The filter that is used to fetch the available the autocomplete options.
323
+ * If not set it fetches all available options.
324
+ * It must be a valid LAPIS filter object.
325
+ */
326
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
327
+ nucleotideMutations?: string[];
328
+ aminoAcidMutations?: string[];
329
+ nucleotideInsertions?: string[];
330
+ aminoAcidInsertions?: string[];
331
+ };
309
332
  /**
310
333
  * The width of the component.
311
334
  *
@@ -1195,7 +1218,7 @@ export declare class StatisticsComponent extends PreactLitAdapterWithGridJsStyle
1195
1218
  *
1196
1219
  * This component provides a text input field to specify filters for arbitrary fields of this LAPIS instance.
1197
1220
  *
1198
- * @fires {CustomEvent<Record<string, string>>} gs-text-input-changed
1221
+ * @fires {CustomEvent<Record<string, string | undefined>>} gs-text-input-changed
1199
1222
  * Fired when the input field is changed.
1200
1223
  * The `details` of this event contain an object with the `lapisField` as key and the input value as value.
1201
1224
  * Example:
@@ -1209,7 +1232,7 @@ export declare class TextInputComponent extends PreactLitAdapter {
1209
1232
  /**
1210
1233
  * The initial value to use for this text input.
1211
1234
  */
1212
- initialValue: string | undefined;
1235
+ value: string | undefined;
1213
1236
  /**
1214
1237
  * Required.
1215
1238
  *
@@ -1217,6 +1240,17 @@ export declare class TextInputComponent extends PreactLitAdapter {
1217
1240
  * The field must exist on this LAPIS instance.
1218
1241
  */
1219
1242
  lapisField: string;
1243
+ /**
1244
+ * The filter that is used to fetch the available the autocomplete options.
1245
+ * If not set it fetches all available options.
1246
+ * It must be a valid LAPIS filter object.
1247
+ */
1248
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
1249
+ nucleotideMutations?: string[];
1250
+ aminoAcidMutations?: string[];
1251
+ nucleotideInsertions?: string[];
1252
+ aminoAcidInsertions?: string[];
1253
+ };
1220
1254
  /**
1221
1255
  * The placeholder text to display in the input field.
1222
1256
  */
@@ -1235,6 +1269,55 @@ export declare class UserFacingError extends Error {
1235
1269
  constructor(headline: string, message: string);
1236
1270
  }
1237
1271
 
1272
+ /**
1273
+ * ## Context
1274
+ *
1275
+ * This component displays mutations for Swiss wastewater data generated within the WISE consortium. It is designed
1276
+ * only for this purpose and is not designed to be reused outside the WISE project.
1277
+ *
1278
+ * It relies on a LAPIS instance that has the fields `nucleotideMutationFrequency` and `aminoAcidMutationFrequency`.
1279
+ * Those fields are expected to be JSON strings of the format `{ [mutation]: frequency | null }`
1280
+ * (e.g. `{ "A123T": 0.5, "C456G": 0.7, "T789G": null }`).
1281
+ *
1282
+ * The component will stratify by `location`.
1283
+ * Every location will be rendered in a separate tab.
1284
+ * The content of the tab is a "mutations over time" grid, similar to the one used in the `gs-mutations-over-time` component.
1285
+ *
1286
+ * This component also assumes that the LAPIS instance has the field `date` which can be used for the time axis.
1287
+ */
1288
+ export declare class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
1289
+ /**
1290
+ * Required.
1291
+ *
1292
+ * LAPIS filter to select the displayed data.
1293
+ */
1294
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
1295
+ nucleotideMutations?: string[];
1296
+ aminoAcidMutations?: string[];
1297
+ nucleotideInsertions?: string[];
1298
+ aminoAcidInsertions?: string[];
1299
+ };
1300
+ /**
1301
+ * Required.
1302
+ *
1303
+ * Whether to display nucleotide or amino acid mutations.
1304
+ */
1305
+ sequenceType: 'nucleotide' | 'amino acid';
1306
+ /**
1307
+ * The width of the component.
1308
+ *
1309
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
1310
+ */
1311
+ width: string;
1312
+ /**
1313
+ * The height of the component.
1314
+ *
1315
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
1316
+ */
1317
+ height: string;
1318
+ render(): JSX_2.Element;
1319
+ }
1320
+
1238
1321
  export { }
1239
1322
 
1240
1323
 
@@ -1261,6 +1344,22 @@ declare global {
1261
1344
  }
1262
1345
 
1263
1346
 
1347
+ declare global {
1348
+ interface HTMLElementTagNameMap {
1349
+ 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1350
+ }
1351
+ }
1352
+
1353
+
1354
+ declare global {
1355
+ namespace JSX {
1356
+ interface IntrinsicElements {
1357
+ 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1358
+ }
1359
+ }
1360
+ }
1361
+
1362
+
1264
1363
  declare global {
1265
1364
  interface HTMLElementTagNameMap {
1266
1365
  'gs-mutation-comparison-component': MutationComparisonComponent;
@@ -1327,7 +1426,7 @@ declare global {
1327
1426
 
1328
1427
  declare global {
1329
1428
  interface HTMLElementTagNameMap {
1330
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1429
+ 'gs-aggregate': AggregateComponent;
1331
1430
  }
1332
1431
  }
1333
1432
 
@@ -1335,7 +1434,7 @@ declare global {
1335
1434
  declare global {
1336
1435
  namespace JSX {
1337
1436
  interface IntrinsicElements {
1338
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1437
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1339
1438
  }
1340
1439
  }
1341
1440
  }
@@ -1343,7 +1442,7 @@ declare global {
1343
1442
 
1344
1443
  declare global {
1345
1444
  interface HTMLElementTagNameMap {
1346
- 'gs-aggregate': AggregateComponent;
1445
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1347
1446
  }
1348
1447
  }
1349
1448
 
@@ -1351,7 +1450,7 @@ declare global {
1351
1450
  declare global {
1352
1451
  namespace JSX {
1353
1452
  interface IntrinsicElements {
1354
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1453
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1355
1454
  }
1356
1455
  }
1357
1456
  }
@@ -1359,7 +1458,7 @@ declare global {
1359
1458
 
1360
1459
  declare global {
1361
1460
  interface HTMLElementTagNameMap {
1362
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1461
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1363
1462
  }
1364
1463
  }
1365
1464
 
@@ -1367,7 +1466,7 @@ declare global {
1367
1466
  declare global {
1368
1467
  namespace JSX {
1369
1468
  interface IntrinsicElements {
1370
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1469
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1371
1470
  }
1372
1471
  }
1373
1472
  }
@@ -1375,7 +1474,7 @@ declare global {
1375
1474
 
1376
1475
  declare global {
1377
1476
  interface HTMLElementTagNameMap {
1378
- 'gs-sequences-by-location': SequencesByLocationComponent;
1477
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1379
1478
  }
1380
1479
  }
1381
1480
 
@@ -1383,7 +1482,7 @@ declare global {
1383
1482
  declare global {
1384
1483
  namespace JSX {
1385
1484
  interface IntrinsicElements {
1386
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1485
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1387
1486
  }
1388
1487
  }
1389
1488
  }
@@ -1446,10 +1545,10 @@ declare global {
1446
1545
 
1447
1546
  declare global {
1448
1547
  interface HTMLElementTagNameMap {
1449
- 'gs-mutation-filter': MutationFilterComponent;
1548
+ 'gs-text-input': TextInputComponent;
1450
1549
  }
1451
1550
  interface HTMLElementEventMap {
1452
- 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1551
+ 'gs-text-input-changed': TextInputChangedEvent;
1453
1552
  }
1454
1553
  }
1455
1554
 
@@ -1457,7 +1556,7 @@ declare global {
1457
1556
  declare global {
1458
1557
  namespace JSX {
1459
1558
  interface IntrinsicElements {
1460
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1559
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1461
1560
  }
1462
1561
  }
1463
1562
  }
@@ -1465,10 +1564,10 @@ declare global {
1465
1564
 
1466
1565
  declare global {
1467
1566
  interface HTMLElementTagNameMap {
1468
- 'gs-lineage-filter': LineageFilterComponent;
1567
+ 'gs-mutation-filter': MutationFilterComponent;
1469
1568
  }
1470
1569
  interface HTMLElementEventMap {
1471
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1570
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1472
1571
  }
1473
1572
  }
1474
1573
 
@@ -1476,7 +1575,7 @@ declare global {
1476
1575
  declare global {
1477
1576
  namespace JSX {
1478
1577
  interface IntrinsicElements {
1479
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1578
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1480
1579
  }
1481
1580
  }
1482
1581
  }
@@ -1484,10 +1583,10 @@ declare global {
1484
1583
 
1485
1584
  declare global {
1486
1585
  interface HTMLElementTagNameMap {
1487
- 'gs-text-input': TextInputComponent;
1586
+ 'gs-lineage-filter': LineageFilterComponent;
1488
1587
  }
1489
1588
  interface HTMLElementEventMap {
1490
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1589
+ 'gs-lineage-filter-changed': LineageFilterChangedEvent;
1491
1590
  }
1492
1591
  }
1493
1592
 
@@ -1495,7 +1594,7 @@ declare global {
1495
1594
  declare global {
1496
1595
  namespace JSX {
1497
1596
  interface IntrinsicElements {
1498
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1597
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1499
1598
  }
1500
1599
  }
1501
1600
  }