@genspectrum/dashboard-components 0.18.5 → 0.19.0

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 (46) hide show
  1. package/README.md +12 -2
  2. package/custom-elements.json +3 -3
  3. package/dist/assets/{mutationOverTimeWorker--b8ZHlji.js.map → mutationOverTimeWorker-ChQTFL68.js.map} +1 -1
  4. package/dist/components.d.ts +15 -14
  5. package/dist/components.js +1602 -332
  6. package/dist/components.js.map +1 -1
  7. package/dist/util.d.ts +14 -14
  8. package/package.json +3 -4
  9. package/src/preact/MutationAnnotationsContext.tsx +34 -27
  10. package/src/preact/components/dropdown.tsx +1 -1
  11. package/src/preact/components/info.tsx +1 -2
  12. package/src/preact/components/min-max-range-slider.tsx +0 -2
  13. package/src/preact/components/mutations-over-time-text-filter.stories.tsx +57 -0
  14. package/src/preact/components/mutations-over-time-text-filter.tsx +63 -0
  15. package/src/preact/components/segment-selector.tsx +1 -1
  16. package/src/preact/components/table.tsx +0 -2
  17. package/src/preact/dateRangeFilter/date-picker.tsx +15 -10
  18. package/src/preact/mutationFilter/mutation-filter.stories.tsx +169 -50
  19. package/src/preact/mutationFilter/mutation-filter.tsx +239 -234
  20. package/src/preact/mutationFilter/parseAndValidateMutation.ts +62 -10
  21. package/src/preact/mutationFilter/parseMutation.spec.ts +62 -47
  22. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +128 -0
  23. package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +39 -2
  24. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +8 -11
  25. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +27 -0
  26. package/src/preact/mutationsOverTime/mutations-over-time.tsx +26 -5
  27. package/src/preact/shared/tanstackTable/pagination-context.tsx +30 -0
  28. package/src/preact/shared/tanstackTable/pagination.tsx +19 -6
  29. package/src/preact/shared/tanstackTable/tanstackTable.tsx +17 -3
  30. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +19 -1
  31. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +6 -1
  32. package/src/styles/replaceCssProperties.stories.tsx +49 -0
  33. package/src/styles/replaceCssProperties.ts +25 -0
  34. package/src/styles/tailwind.css +1 -0
  35. package/src/web-components/PreactLitAdapter.tsx +6 -3
  36. package/src/web-components/PreactLitAdapterWithGridJsStyles.tsx +0 -2
  37. package/src/web-components/gs-app.stories.ts +6 -2
  38. package/src/web-components/gs-app.ts +4 -1
  39. package/src/web-components/input/gs-date-range-filter.tsx +6 -0
  40. package/src/web-components/input/gs-mutation-filter.stories.ts +4 -4
  41. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +1 -1
  42. package/standalone-bundle/assets/mutationOverTimeWorker-jChgWnwp.js.map +1 -1
  43. package/standalone-bundle/dashboard-components.js +10836 -11289
  44. package/standalone-bundle/dashboard-components.js.map +1 -1
  45. package/dist/style.css +0 -392
  46. package/standalone-bundle/style.css +0 -1
package/README.md CHANGED
@@ -14,12 +14,23 @@ Usage with a bundler in HTML:
14
14
  <body>
15
15
  <script>
16
16
  import '@genspectrum/dashboard-components/components';
17
- import '@genspectrum/dashboard-components/style.css';
18
17
  </script>
19
18
  <gs-app lapis="https://your.lapis.url"></gs-app>
20
19
  </body>
21
20
  ```
22
21
 
22
+ **Note for vite (and potentially other bundlers) users**:
23
+ There is currently an issue with one of our peer dependencies: leaflet.
24
+ Vite will use the commonjs style of leaflet, which will create an error, when you run it in the browser.
25
+ `Uncaught SyntaxError: The requested module ... doesn't provide an export named: 'geoJson'`
26
+ To fix this add the following to your `vite.config.js`:
27
+
28
+ ```js
29
+ optimizeDeps: {
30
+ include: ['leaflet'];
31
+ }
32
+ ```
33
+
23
34
  We also provide a standalone version of the components that can be used without installing the dependencies:
24
35
 
25
36
  ```html
@@ -29,7 +40,6 @@ We also provide a standalone version of the components that can be used without
29
40
  type="module"
30
41
  src="https://unpkg.com/@genspectrum/dashboard-components@latest/standalone-bundle/dashboard-components.js"
31
42
  ></script>
32
- <link rel="stylesheet" href="https://unpkg.com/@genspectrum/dashboard-components@latest/dist/style.css" />
33
43
  </head>
34
44
  <body>
35
45
  <gs-app lapis="https://your.lapis.url"></gs-app>
@@ -104,7 +104,7 @@
104
104
  "type": {
105
105
  "text": "StoryObj<StoryProps>"
106
106
  },
107
- "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(); }); }, }"
107
+ "default": "{ ...Default, args: { ...Default.args, lapis: 'notAValidUrl', }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); await waitFor(async () => { await expect( canvas.getByText(\"Error in gs-app: Invalid LAPIS URL: 'notAValidUrl'\", { exact: false }), ).toBeVisible(); }); }, }"
108
108
  },
109
109
  {
110
110
  "kind": "variable",
@@ -120,7 +120,7 @@
120
120
  "type": {
121
121
  "text": "StoryObj<StoryProps>"
122
122
  },
123
- "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(); }); }, }"
123
+ "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 in gs-app: Cannot fetch reference genome.', { exact: false }), ).toBeVisible(); }); }, }"
124
124
  },
125
125
  {
126
126
  "kind": "class",
@@ -1080,7 +1080,7 @@
1080
1080
  "type": {
1081
1081
  "text": "StoryObj<MutationFilterProps>"
1082
1082
  },
1083
- "default": "{ ...Template, args: { ...Template.args, initialValue: ['seg1:123T', 'gene2:56', 'ins_seg2:78:AAA'], }, parameters: { fetchMock: { mocks: [ { matcher: { name: 'referenceGenome', url: REFERENCE_GENOME_ENDPOINT, }, response: { status: 200, body: { nucleotideSequences: [ { name: 'seg1', sequence: 'dummy', }, { name: 'seg2', sequence: 'dummy', }, ], genes: [ { name: 'gene1', sequence: 'dummy', }, { name: 'gene2', sequence: 'dummy', }, ], }, }, options: { overwriteRoutes: false, }, }, ], }, }, play: async ({ canvasElement }) => { const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-filter'); const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false }); await waitFor(async () => { const placeholderText = inputField().getAttribute('placeholder'); await expect(placeholderText).toEqual( 'Enter a mutation (e.g. seg1:23T, ins_seg1:10462:A, gene1:57Q, ins_gene1:31:N)', ); }); await waitFor(async () => { await expect(canvas.getByText('seg1:123T')).toBeVisible(); await expect(canvas.getByText('gene2:56')).toBeVisible(); await expect(canvas.getByText('ins_seg2:78:AAA')).toBeVisible(); }); }, }"
1083
+ "default": "{ ...Template, args: { ...Template.args, initialValue: ['seg1:3T', 'gene2:4', 'ins_seg2:4:AAA'], }, parameters: { fetchMock: { mocks: [ { matcher: { name: 'referenceGenome', url: REFERENCE_GENOME_ENDPOINT, }, response: { status: 200, body: { nucleotideSequences: [ { name: 'seg1', sequence: 'dummy', }, { name: 'seg2', sequence: 'dummy', }, ], genes: [ { name: 'gene1', sequence: 'dummy', }, { name: 'gene2', sequence: 'dummy', }, ], }, }, options: { overwriteRoutes: false, }, }, ], }, }, play: async ({ canvasElement }) => { const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-filter'); const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false }); await waitFor(async () => { const placeholderText = inputField().getAttribute('placeholder'); await expect(placeholderText).toEqual( 'Enter a mutation (e.g. seg1:23T, ins_seg1:10462:A, gene1:57Q, ins_gene1:31:N)', ); }); await waitFor(async () => { await expect(canvas.getByText('seg1:3T')).toBeVisible(); await expect(canvas.getByText('gene2:4')).toBeVisible(); await expect(canvas.getByText('ins_seg2:4:AAA')).toBeVisible(); }); }, }"
1084
1084
  }
1085
1085
  ],
1086
1086
  "exports": [