@genspectrum/dashboard-components 0.16.1 → 0.16.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 (41) hide show
  1. package/custom-elements.json +72 -7
  2. package/dist/assets/mutationOverTimeWorker-DJcZmEH9.js.map +1 -0
  3. package/dist/components.d.ts +63 -25
  4. package/dist/components.js +310 -151
  5. package/dist/components.js.map +1 -1
  6. package/dist/style.css +16 -0
  7. package/dist/util.d.ts +25 -25
  8. package/package.json +4 -2
  9. package/src/preact/MutationAnnotationsContext.spec.tsx +58 -0
  10. package/src/preact/MutationAnnotationsContext.tsx +72 -0
  11. package/src/preact/components/annotated-mutation.stories.tsx +163 -0
  12. package/src/preact/components/annotated-mutation.tsx +80 -0
  13. package/src/preact/components/downshift-combobox.tsx +6 -4
  14. package/src/preact/components/error-display.tsx +9 -9
  15. package/src/preact/components/info.tsx +6 -13
  16. package/src/preact/components/modal.stories.tsx +7 -19
  17. package/src/preact/components/modal.tsx +35 -4
  18. package/src/preact/mutations/mutations-table.tsx +14 -2
  19. package/src/preact/mutations/mutations.stories.tsx +40 -2
  20. package/src/preact/mutations/mutations.tsx +1 -0
  21. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +19 -8
  22. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +34 -5
  23. package/src/preact/mutationsOverTime/mutations-over-time.tsx +13 -1
  24. package/src/preact/sequencesByLocation/sequences-by-location-map.tsx +28 -30
  25. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +7 -2
  26. package/src/web-components/gs-app.spec-d.ts +10 -0
  27. package/src/web-components/gs-app.stories.ts +24 -6
  28. package/src/web-components/gs-app.ts +17 -0
  29. package/src/web-components/mutation-annotations-context.ts +16 -0
  30. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +18 -1
  31. package/src/web-components/visualization/gs-mutations-over-time.tsx +22 -11
  32. package/src/web-components/visualization/gs-mutations.stories.ts +18 -1
  33. package/src/web-components/visualization/gs-mutations.tsx +20 -9
  34. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.stories.ts +11 -1
  35. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +18 -7
  36. package/standalone-bundle/assets/mutationOverTimeWorker-CERZSdcA.js.map +1 -0
  37. package/standalone-bundle/dashboard-components.js +8094 -7963
  38. package/standalone-bundle/dashboard-components.js.map +1 -1
  39. package/standalone-bundle/style.css +1 -1
  40. package/dist/assets/mutationOverTimeWorker-BL50C-yi.js.map +0 -1
  41. package/standalone-bundle/assets/mutationOverTimeWorker-CFB5-Mdk.js.map +0 -1
@@ -66,6 +66,12 @@
66
66
  "declarations": [],
67
67
  "exports": []
68
68
  },
69
+ {
70
+ "kind": "javascript-module",
71
+ "path": "src/web-components/gs-app.spec-d.ts",
72
+ "declarations": [],
73
+ "exports": []
74
+ },
69
75
  {
70
76
  "kind": "javascript-module",
71
77
  "path": "src/web-components/gs-app.stories.ts",
@@ -82,15 +88,15 @@
82
88
  "kind": "variable",
83
89
  "name": "Default",
84
90
  "type": {
85
- "text": "StoryObj<{ lapis: string }>"
91
+ "text": "StoryObj<StoryProps>"
86
92
  },
87
- "default": "{ ...Template, play: async ({ canvasElement }) => { const canvas = within(canvasElement); await waitFor(async () => { await expect(canvas.getByText(LAPIS_URL)).toBeVisible(); await expect(canvas.getByText('\"name\": \"ORF1a\",', { exact: false })).toBeVisible(); }); }, }"
93
+ "default": "{ ...Template, play: async ({ canvasElement }) => { const canvas = within(canvasElement); await waitFor(async () => { await expect(canvas.getByText(LAPIS_URL)).toBeVisible(); await expect(canvas.getByText('\"name\": \"ORF1a\",', { exact: false })).toBeVisible(); await expect(canvas.getByText('I am an annotation!', { exact: false })).toBeVisible(); }); }, }"
88
94
  },
89
95
  {
90
96
  "kind": "variable",
91
97
  "name": "WithNoLapisUrl",
92
98
  "type": {
93
- "text": "StoryObj<{ lapis: string }>"
99
+ "text": "StoryObj<StoryProps>"
94
100
  },
95
101
  "default": "{ ...Default, args: { ...Default.args, lapis: 'notAValidUrl', }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); await waitFor(async () => { await expect(canvas.getByText(\"Error: Invalid LAPIS URL: 'notAValidUrl'\", { exact: false })).toBeVisible(); }); }, }"
96
102
  },
@@ -98,7 +104,7 @@
98
104
  "kind": "variable",
99
105
  "name": "DelayFetchingReferenceGenome",
100
106
  "type": {
101
- "text": "StoryObj<{ lapis: string }>"
107
+ "text": "StoryObj<StoryProps>"
102
108
  },
103
109
  "default": "{ ...Template, parameters: { fetchMock: { mocks: [ { matcher: { name: 'referenceGenome', url: REFERENCE_GENOME_ENDPOINT, }, response: { status: 200, body: referenceGenome, }, options: { delay: 5000, }, }, ], }, }, }"
104
110
  },
@@ -106,7 +112,7 @@
106
112
  "kind": "variable",
107
113
  "name": "FailsToFetchReferenceGenome",
108
114
  "type": {
109
- "text": "StoryObj<{ lapis: string }>"
115
+ "text": "StoryObj<StoryProps>"
110
116
  },
111
117
  "default": "{ ...Template, args: { lapis: 'https://url.to.lapis-definitely-not-a-valid-url', }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); await waitFor(async () => { await expect(canvas.getByText('Error: Cannot fetch reference genome.', { exact: false })).toBeVisible(); }); }, }"
112
118
  },
@@ -130,6 +136,14 @@
130
136
  "text": "ReferenceGenome"
131
137
  },
132
138
  "default": "{ nucleotideSequences: [], genes: [], }"
139
+ },
140
+ {
141
+ "kind": "field",
142
+ "name": "mutationAnnotations",
143
+ "type": {
144
+ "text": "MutationAnnotations"
145
+ },
146
+ "default": "[]"
133
147
  }
134
148
  ],
135
149
  "superclass": {
@@ -197,7 +211,7 @@
197
211
  "declarations": [
198
212
  {
199
213
  "kind": "class",
200
- "description": "## Context\n\nThis component provides the main application context.\nAll other `gs-*` components must be (possibly nested) children of this component.\nIt makes use of the [Lit Context](https://lit.dev/docs/data/context/) to\n- provide the URL to the LAPIS instance to all its children\n- fetch the reference genomes from LAPIS and provide it to all its children\n\nThis will show an error message if the reference genome cannot be fetched\n(e.g., due to an invalid LAPIS URL).\n\n## Shadow DOM\n\nThis component does __not__ use a shadow DOM. Children of this component will be rendered directly in the light DOM.",
214
+ "description": "## Context\n\nThis component provides the main application context.\nAll other `gs-*` components must be (possibly nested) children of this component.\nIt makes use of the [Lit Context](https://lit.dev/docs/data/context/) to\n- provide the URL to the LAPIS instance to all its children\n- fetch the reference genomes from LAPIS and provide it to all its children\n- distribute the mutation annotations config to its children\n\nThis will show an error message if the reference genome cannot be fetched\n(e.g., due to an invalid LAPIS URL).\n\n## Shadow DOM\n\nThis component does __not__ use a shadow DOM. Children of this component will be rendered directly in the light DOM.",
201
215
  "name": "AppComponent",
202
216
  "members": [
203
217
  {
@@ -209,6 +223,16 @@
209
223
  "default": "''",
210
224
  "description": "Required.\n\nThe URL of the LAPIS instance that all children of this component will use.",
211
225
  "attribute": "lapis"
226
+ },
227
+ {
228
+ "kind": "field",
229
+ "name": "mutationAnnotations",
230
+ "type": {
231
+ "text": "{\n name: string;\n description: string;\n symbol: string;\n nucleotideMutations: string[];\n aminoAcidMutations: string[];\n }[]"
232
+ },
233
+ "default": "[]",
234
+ "description": "Supply lists of mutations that are especially relevant for the current organism.\nWhenever other components display mutations, matching mutations will be highlighted by appending the `symbol`.\nOn hover, a tooltip with the `name` and `description` will be shown.",
235
+ "attribute": "mutationAnnotations"
212
236
  }
213
237
  ],
214
238
  "attributes": [
@@ -220,6 +244,15 @@
220
244
  "default": "''",
221
245
  "description": "Required.\n\nThe URL of the LAPIS instance that all children of this component will use.",
222
246
  "fieldName": "lapis"
247
+ },
248
+ {
249
+ "name": "mutationAnnotations",
250
+ "type": {
251
+ "text": "{\n name: string;\n description: string;\n symbol: string;\n nucleotideMutations: string[];\n aminoAcidMutations: string[];\n }[]"
252
+ },
253
+ "default": "[]",
254
+ "description": "Supply lists of mutations that are especially relevant for the current organism.\nWhenever other components display mutations, matching mutations will be highlighted by appending the `symbol`.\nOn hover, a tooltip with the `name` and `description` will be shown.",
255
+ "fieldName": "mutationAnnotations"
223
256
  }
224
257
  ],
225
258
  "superclass": {
@@ -1424,6 +1457,38 @@
1424
1457
  }
1425
1458
  ]
1426
1459
  },
1460
+ {
1461
+ "kind": "javascript-module",
1462
+ "path": "src/web-components/mutation-annotations-context.ts",
1463
+ "declarations": [
1464
+ {
1465
+ "kind": "variable",
1466
+ "name": "mutationAnnotationsSchema"
1467
+ },
1468
+ {
1469
+ "kind": "variable",
1470
+ "name": "mutationAnnotationsContext"
1471
+ }
1472
+ ],
1473
+ "exports": [
1474
+ {
1475
+ "kind": "js",
1476
+ "name": "mutationAnnotationsSchema",
1477
+ "declaration": {
1478
+ "name": "mutationAnnotationsSchema",
1479
+ "module": "src/web-components/mutation-annotations-context.ts"
1480
+ }
1481
+ },
1482
+ {
1483
+ "kind": "js",
1484
+ "name": "mutationAnnotationsContext",
1485
+ "declaration": {
1486
+ "name": "mutationAnnotationsContext",
1487
+ "module": "src/web-components/mutation-annotations-context.ts"
1488
+ }
1489
+ }
1490
+ ]
1491
+ },
1427
1492
  {
1428
1493
  "kind": "javascript-module",
1429
1494
  "path": "src/web-components/reference-genome-context.ts",
@@ -4147,7 +4212,7 @@
4147
4212
  "type": {
4148
4213
  "text": "StoryObj<WastewaterMutationsOverTimeProps & { infoText: string }>"
4149
4214
  },
4150
- "default": "{ render: (args) => html` <gs-app lapis=\"${WISE_LAPIS_URL}\"> <gs-wastewater-mutations-over-time .lapisFilter=${args.lapisFilter} .sequenceType=${args.sequenceType} .width=${args.width} .height=${args.height} .maxNumberOfGridRows=${args.maxNumberOfGridRows} > <span slot=\"infoText\">${args.infoText}</span> </gs-wastewater-mutations-over-time> </gs-app> `, parameters: { fetchMock: { mocks: [ { matcher: { name: 'details', url: WISE_DETAILS_ENDPOINT, body: { fields: ['date', 'location', 'nucleotideMutationFrequency', 'aminoAcidMutationFrequency'], versionStatus: 'LATEST_VERSION', isRevocation: false, }, }, response: { status: 200, body: details, }, }, ], }, }, }"
4215
+ "default": "{ render: (args) => html` <gs-app lapis=\"${WISE_LAPIS_URL}\" .mutationAnnotations=${mutationAnnotations}> <gs-wastewater-mutations-over-time .lapisFilter=${args.lapisFilter} .sequenceType=${args.sequenceType} .width=${args.width} .height=${args.height} .maxNumberOfGridRows=${args.maxNumberOfGridRows} > <span slot=\"infoText\">${args.infoText}</span> </gs-wastewater-mutations-over-time> </gs-app> `, parameters: { fetchMock: { mocks: [ { matcher: { name: 'details', url: WISE_DETAILS_ENDPOINT, body: { fields: ['date', 'location', 'nucleotideMutationFrequency', 'aminoAcidMutationFrequency'], versionStatus: 'LATEST_VERSION', isRevocation: false, }, }, response: { status: 200, body: details, }, }, ], }, }, }"
4151
4216
  },
4152
4217
  {
4153
4218
  "kind": "variable",