@genspectrum/dashboard-components 0.16.2 → 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 (40) 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 +69 -31
  4. package/dist/components.js +305 -148
  5. package/dist/components.js.map +1 -1
  6. package/dist/style.css +16 -0
  7. package/dist/util.d.ts +31 -31
  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/error-display.tsx +9 -9
  14. package/src/preact/components/info.tsx +6 -13
  15. package/src/preact/components/modal.stories.tsx +7 -19
  16. package/src/preact/components/modal.tsx +35 -4
  17. package/src/preact/mutations/mutations-table.tsx +14 -2
  18. package/src/preact/mutations/mutations.stories.tsx +40 -2
  19. package/src/preact/mutations/mutations.tsx +1 -0
  20. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +19 -8
  21. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +34 -5
  22. package/src/preact/mutationsOverTime/mutations-over-time.tsx +13 -1
  23. package/src/preact/sequencesByLocation/sequences-by-location-map.tsx +28 -30
  24. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +6 -1
  25. package/src/web-components/gs-app.spec-d.ts +10 -0
  26. package/src/web-components/gs-app.stories.ts +24 -6
  27. package/src/web-components/gs-app.ts +17 -0
  28. package/src/web-components/mutation-annotations-context.ts +16 -0
  29. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +18 -1
  30. package/src/web-components/visualization/gs-mutations-over-time.tsx +22 -11
  31. package/src/web-components/visualization/gs-mutations.stories.ts +18 -1
  32. package/src/web-components/visualization/gs-mutations.tsx +20 -9
  33. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.stories.ts +11 -1
  34. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +18 -7
  35. package/standalone-bundle/assets/mutationOverTimeWorker-CERZSdcA.js.map +1 -0
  36. package/standalone-bundle/dashboard-components.js +7332 -7202
  37. package/standalone-bundle/dashboard-components.js.map +1 -1
  38. package/standalone-bundle/style.css +1 -1
  39. package/dist/assets/mutationOverTimeWorker-BL50C-yi.js.map +0 -1
  40. package/standalone-bundle/assets/mutationOverTimeWorker-CFB5-Mdk.js.map +0 -1
@@ -1,9 +1,12 @@
1
+ import { consume } from '@lit/context';
1
2
  import { customElement, property } from 'lit/decorators.js';
2
3
  import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
4
 
5
+ import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
4
6
  import { MutationsOverTime, type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
5
7
  import type { Equals, Expect } from '../../utils/typeAssertions';
6
8
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
9
+ import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
7
10
 
8
11
  /**
9
12
  * ## Context
@@ -105,19 +108,27 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
105
108
  @property({ type: Object })
106
109
  initialMeanProportionInterval: { min: number; max: number } = { min: 0.05, max: 0.9 };
107
110
 
111
+ /**
112
+ * @internal
113
+ */
114
+ @consume({ context: mutationAnnotationsContext, subscribe: true })
115
+ mutationAnnotations: MutationAnnotations = [];
116
+
108
117
  override render() {
109
118
  return (
110
- <MutationsOverTime
111
- lapisFilter={this.lapisFilter}
112
- sequenceType={this.sequenceType}
113
- views={this.views}
114
- width={this.width}
115
- height={this.height}
116
- granularity={this.granularity}
117
- lapisDateField={this.lapisDateField}
118
- displayMutations={this.displayMutations}
119
- initialMeanProportionInterval={this.initialMeanProportionInterval}
120
- />
119
+ <MutationAnnotationsContextProvider value={this.mutationAnnotations}>
120
+ <MutationsOverTime
121
+ lapisFilter={this.lapisFilter}
122
+ sequenceType={this.sequenceType}
123
+ views={this.views}
124
+ width={this.width}
125
+ height={this.height}
126
+ granularity={this.granularity}
127
+ lapisDateField={this.lapisDateField}
128
+ displayMutations={this.displayMutations}
129
+ initialMeanProportionInterval={this.initialMeanProportionInterval}
130
+ />
131
+ </MutationAnnotationsContextProvider>
121
132
  );
122
133
  }
123
134
  }
@@ -68,9 +68,26 @@ const meta: Meta<Required<MutationsProps>> = {
68
68
 
69
69
  export default meta;
70
70
 
71
+ const mutationAnnotations = [
72
+ {
73
+ name: 'I am a mutation annotation!',
74
+ description: 'This describes what is special about these mutations.',
75
+ symbol: '#',
76
+ nucleotideMutations: ['C241T', 'C3037T'],
77
+ aminoAcidMutations: ['S:501Y', 'S:S31-', 'ORF1a:S4286C'],
78
+ },
79
+ {
80
+ name: 'I am another mutation annotation!',
81
+ description: 'This describes what is special about these other mutations.',
82
+ symbol: '+',
83
+ nucleotideMutations: ['C3037T', 'C11750T'],
84
+ aminoAcidMutations: ['S:501Y', 'S:S31-', 'ORF1a:S4286C'],
85
+ },
86
+ ];
87
+
71
88
  const Template: StoryObj<Required<MutationsProps>> = {
72
89
  render: (args) => html`
73
- <gs-app lapis="${LAPIS_URL}">
90
+ <gs-app lapis="${LAPIS_URL}" .mutationAnnotations=${mutationAnnotations}>
74
91
  <gs-mutations
75
92
  .lapisFilter=${args.lapisFilter}
76
93
  .baselineLapisFilter=${args.baselineLapisFilter}
@@ -1,9 +1,12 @@
1
+ import { consume } from '@lit/context';
1
2
  import { customElement, property } from 'lit/decorators.js';
2
3
  import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
4
 
5
+ import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
4
6
  import { Mutations, type MutationsProps } from '../../preact/mutations/mutations';
5
7
  import type { Equals, Expect } from '../../utils/typeAssertions';
6
8
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
9
+ import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
7
10
 
8
11
  /**
9
12
  * ## Context
@@ -120,17 +123,25 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
120
123
  @property({ type: Object })
121
124
  pageSize: boolean | number = false;
122
125
 
126
+ /**
127
+ * @internal
128
+ */
129
+ @consume({ context: mutationAnnotationsContext, subscribe: true })
130
+ mutationAnnotations: MutationAnnotations = [];
131
+
123
132
  override render() {
124
133
  return (
125
- <Mutations
126
- lapisFilter={this.lapisFilter}
127
- sequenceType={this.sequenceType}
128
- views={this.views}
129
- width={this.width}
130
- height={this.height}
131
- pageSize={this.pageSize}
132
- baselineLapisFilter={this.baselineLapisFilter}
133
- />
134
+ <MutationAnnotationsContextProvider value={this.mutationAnnotations}>
135
+ <Mutations
136
+ lapisFilter={this.lapisFilter}
137
+ sequenceType={this.sequenceType}
138
+ views={this.views}
139
+ width={this.width}
140
+ height={this.height}
141
+ pageSize={this.pageSize}
142
+ baselineLapisFilter={this.baselineLapisFilter}
143
+ />
144
+ </MutationAnnotationsContextProvider>
134
145
  );
135
146
  }
136
147
  }
@@ -52,9 +52,19 @@ const meta: Meta<WastewaterMutationsOverTimeProps & { infoText: string }> = {
52
52
 
53
53
  export default meta;
54
54
 
55
+ const mutationAnnotations = [
56
+ {
57
+ name: 'I am an annotation!',
58
+ description: 'This describes what is special about these mutations.',
59
+ symbol: '*',
60
+ nucleotideMutations: ['C3422A', 'G6661A', 'G7731A'],
61
+ aminoAcidMutations: ['S:501Y', 'S:S31-', 'ORF1a:S4286C'],
62
+ },
63
+ ];
64
+
55
65
  export const WastewaterMutationsOverTime: StoryObj<WastewaterMutationsOverTimeProps & { infoText: string }> = {
56
66
  render: (args) => html`
57
- <gs-app lapis="${WISE_LAPIS_URL}">
67
+ <gs-app lapis="${WISE_LAPIS_URL}" .mutationAnnotations=${mutationAnnotations}>
58
68
  <gs-wastewater-mutations-over-time
59
69
  .lapisFilter=${args.lapisFilter}
60
70
  .sequenceType=${args.sequenceType}
@@ -1,12 +1,15 @@
1
+ import { consume } from '@lit/context';
1
2
  import { customElement, property } from 'lit/decorators.js';
2
3
  import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
3
4
 
5
+ import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
4
6
  import {
5
7
  WastewaterMutationsOverTime,
6
8
  type WastewaterMutationsOverTimeProps,
7
9
  } from '../../preact/wastewater/mutationsOverTime/wastewater-mutations-over-time';
8
10
  import { type Equals, type Expect } from '../../utils/typeAssertions';
9
11
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
12
+ import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
10
13
 
11
14
  /**
12
15
  * ## Context
@@ -71,15 +74,23 @@ export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGr
71
74
  @property({ type: Number })
72
75
  maxNumberOfGridRows: number = 100;
73
76
 
77
+ /**
78
+ * @internal
79
+ */
80
+ @consume({ context: mutationAnnotationsContext, subscribe: true })
81
+ mutationAnnotations: MutationAnnotations = [];
82
+
74
83
  override render() {
75
84
  return (
76
- <WastewaterMutationsOverTime
77
- lapisFilter={this.lapisFilter}
78
- sequenceType={this.sequenceType}
79
- width={this.width}
80
- height={this.height}
81
- maxNumberOfGridRows={this.maxNumberOfGridRows}
82
- />
85
+ <MutationAnnotationsContextProvider value={this.mutationAnnotations}>
86
+ <WastewaterMutationsOverTime
87
+ lapisFilter={this.lapisFilter}
88
+ sequenceType={this.sequenceType}
89
+ width={this.width}
90
+ height={this.height}
91
+ maxNumberOfGridRows={this.maxNumberOfGridRows}
92
+ />
93
+ </MutationAnnotationsContextProvider>
83
94
  );
84
95
  }
85
96
  }