@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.
- package/custom-elements.json +186 -23
- package/dist/assets/{mutationOverTimeWorker-CvZg52rf.js.map → mutationOverTimeWorker-Di6yP1e6.js.map} +1 -1
- package/dist/components.d.ts +95 -45
- package/dist/components.js +402 -182
- package/dist/components.js.map +1 -1
- package/dist/{utilEntrypoint-g4DsyhU7.js → dateRangeOption-du8H7LWu.js} +33 -2
- package/dist/dateRangeOption-du8H7LWu.js.map +1 -0
- package/dist/style.css +41 -0
- package/dist/util.d.ts +114 -56
- package/dist/util.js +3 -2
- package/package.json +2 -2
- package/src/preact/components/color-scale-selector.tsx +7 -3
- package/src/preact/components/error-boundary.tsx +39 -5
- package/src/preact/components/error-display.tsx +40 -5
- package/src/preact/components/min-max-range-slider.tsx +4 -4
- package/src/preact/components/percent-intput.tsx +2 -2
- package/src/preact/dateRangeSelector/computeInitialValues.spec.ts +8 -2
- package/src/preact/dateRangeSelector/computeInitialValues.ts +6 -0
- package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +16 -2
- package/src/preact/dateRangeSelector/date-range-selector.tsx +20 -15
- package/src/preact/dateRangeSelector/dateRangeOption.ts +10 -5
- package/src/preact/lineageFilter/lineage-filter.stories.tsx +18 -4
- package/src/preact/lineageFilter/lineage-filter.tsx +15 -10
- package/src/preact/locationFilter/location-filter.stories.tsx +14 -0
- package/src/preact/locationFilter/location-filter.tsx +15 -10
- package/src/preact/mutationComparison/mutation-comparison-venn.tsx +17 -18
- package/src/preact/mutationComparison/mutation-comparison.tsx +18 -12
- package/src/preact/mutationFilter/mutation-filter.tsx +0 -1
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +1326 -9341
- package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +615 -4920
- package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +2203 -17624
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +16 -8
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -3
- package/src/preact/shared/stories/expectInvalidAttributesErrorMessage.ts +13 -0
- package/src/preact/statistic/__mockData__/denominator.json +13 -0
- package/src/preact/statistic/__mockData__/numerator.json +13 -0
- package/src/preact/statistic/statistics.stories.tsx +81 -0
- package/src/preact/statistic/statistics.tsx +78 -0
- package/src/preact/webWorkers/useWebWorker.ts +8 -4
- package/src/query/queryGeneralStatistics.ts +18 -0
- package/src/query/queryMutationsOverTime.spec.ts +12 -27
- package/src/query/queryMutationsOverTime.ts +2 -6
- package/src/types.ts +19 -6
- package/src/utilEntrypoint.ts +8 -0
- package/src/utils/map2d.spec.ts +10 -10
- package/src/utils/map2d.ts +10 -10
- package/src/web-components/input/gs-date-range-selector.stories.ts +2 -2
- package/src/web-components/input/gs-date-range-selector.tsx +3 -3
- package/src/web-components/input/gs-lineage-filter.tsx +1 -1
- package/src/web-components/input/gs-location-filter.tsx +2 -2
- package/src/web-components/visualization/gs-aggregate.tsx +2 -2
- package/src/web-components/visualization/gs-statistics.stories.ts +95 -0
- package/src/web-components/visualization/gs-statistics.tsx +83 -0
- package/src/web-components/visualization/index.ts +1 -0
- package/standalone-bundle/assets/{mutationOverTimeWorker-CypX_PYM.js.map → mutationOverTimeWorker-cIyshfj_.js.map} +1 -1
- package/standalone-bundle/dashboard-components.js +7747 -7592
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/standalone-bundle/style.css +1 -1
- package/dist/utilEntrypoint-g4DsyhU7.js.map +0 -1
|
@@ -48,7 +48,7 @@ export class LineageFilterComponent extends PreactLitAdapter {
|
|
|
48
48
|
* The placeholder text to display in the input field.
|
|
49
49
|
*/
|
|
50
50
|
@property()
|
|
51
|
-
placeholderText: string =
|
|
51
|
+
placeholderText: string | undefined = undefined;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* The width of the component.
|
|
@@ -40,7 +40,7 @@ export class LocationFilterComponent extends PreactLitAdapter {
|
|
|
40
40
|
* Must be of the form `valueForField1 / valueForField2 / ... / valueForFieldN`.
|
|
41
41
|
*/
|
|
42
42
|
@property()
|
|
43
|
-
initialValue =
|
|
43
|
+
initialValue: string | undefined = undefined;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Required.
|
|
@@ -65,7 +65,7 @@ export class LocationFilterComponent extends PreactLitAdapter {
|
|
|
65
65
|
* The placeholder text to display in the input field, if it is empty.
|
|
66
66
|
*/
|
|
67
67
|
@property()
|
|
68
|
-
placeholderText: string =
|
|
68
|
+
placeholderText: string | undefined = undefined;
|
|
69
69
|
|
|
70
70
|
override render() {
|
|
71
71
|
return (
|
|
@@ -101,7 +101,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
101
101
|
|
|
102
102
|
declare global {
|
|
103
103
|
interface HTMLElementTagNameMap {
|
|
104
|
-
'gs-aggregate
|
|
104
|
+
'gs-aggregate': AggregateComponent;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -109,7 +109,7 @@ declare global {
|
|
|
109
109
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
110
110
|
namespace JSX {
|
|
111
111
|
interface IntrinsicElements {
|
|
112
|
-
'gs-aggregate
|
|
112
|
+
'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/web-components';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
|
|
4
|
+
import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
|
|
5
|
+
import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
|
|
6
|
+
import denominatorData from '../../preact/statistic/__mockData__/denominator.json';
|
|
7
|
+
import numeratorData from '../../preact/statistic/__mockData__/numerator.json';
|
|
8
|
+
import { type StatisticsProps } from '../../preact/statistic/statistics';
|
|
9
|
+
|
|
10
|
+
import './gs-statistics';
|
|
11
|
+
import '../app';
|
|
12
|
+
|
|
13
|
+
const codeExample = `
|
|
14
|
+
<gs-statistics
|
|
15
|
+
numeratorFilter='{"country": "USA", "division": "Alabama}'
|
|
16
|
+
denominatorFilter='{"country": "USA"}'
|
|
17
|
+
width='100%'
|
|
18
|
+
height='700px'
|
|
19
|
+
></gs-statistics>`;
|
|
20
|
+
|
|
21
|
+
const meta: Meta<Required<StatisticsProps>> = {
|
|
22
|
+
title: 'Visualization/Statistics',
|
|
23
|
+
component: 'gs-statistics',
|
|
24
|
+
argTypes: {
|
|
25
|
+
width: { control: 'text' },
|
|
26
|
+
height: { control: 'text' },
|
|
27
|
+
},
|
|
28
|
+
parameters: withComponentDocs({
|
|
29
|
+
fetchMock: {
|
|
30
|
+
mocks: [
|
|
31
|
+
{
|
|
32
|
+
matcher: {
|
|
33
|
+
name: 'denominatorData',
|
|
34
|
+
url: AGGREGATED_ENDPOINT,
|
|
35
|
+
body: {
|
|
36
|
+
fields: [],
|
|
37
|
+
country: 'USA',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
response: {
|
|
41
|
+
status: 200,
|
|
42
|
+
body: denominatorData,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
matcher: {
|
|
47
|
+
name: 'numeratorData',
|
|
48
|
+
url: AGGREGATED_ENDPOINT,
|
|
49
|
+
body: {
|
|
50
|
+
fields: [],
|
|
51
|
+
country: 'USA',
|
|
52
|
+
division: 'Alabama',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
response: {
|
|
56
|
+
status: 200,
|
|
57
|
+
body: numeratorData,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
componentDocs: {
|
|
63
|
+
opensShadowDom: true,
|
|
64
|
+
expectsChildren: false,
|
|
65
|
+
codeExample,
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
tags: ['autodocs'],
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default meta;
|
|
72
|
+
|
|
73
|
+
export const Default: StoryObj<Required<StatisticsProps>> = {
|
|
74
|
+
render: (args) => html`
|
|
75
|
+
<gs-app lapis="${LAPIS_URL}">
|
|
76
|
+
<gs-statistics
|
|
77
|
+
.numeratorFilter=${args.numeratorFilter}
|
|
78
|
+
.denominatorFilter=${args.denominatorFilter}
|
|
79
|
+
.width=${args.width}
|
|
80
|
+
.height=${args.height}
|
|
81
|
+
></gs-statistics>
|
|
82
|
+
</gs-app>
|
|
83
|
+
`,
|
|
84
|
+
args: {
|
|
85
|
+
denominatorFilter: {
|
|
86
|
+
country: 'USA',
|
|
87
|
+
},
|
|
88
|
+
numeratorFilter: {
|
|
89
|
+
country: 'USA',
|
|
90
|
+
division: 'Alabama',
|
|
91
|
+
},
|
|
92
|
+
width: '100%',
|
|
93
|
+
height: '700px',
|
|
94
|
+
},
|
|
95
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
import { Statistics, type StatisticsProps } from '../../preact/statistic/statistics';
|
|
5
|
+
import type { LapisFilter } from '../../types';
|
|
6
|
+
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
7
|
+
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ## Context
|
|
11
|
+
*
|
|
12
|
+
* This component displays general statistics (number of sequences, overall proportion)
|
|
13
|
+
* for a given numerator and denominator filter.
|
|
14
|
+
*/
|
|
15
|
+
@customElement('gs-statistics')
|
|
16
|
+
export class StatisticsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
17
|
+
/**
|
|
18
|
+
* The filter to apply to the data for the overall number of sequences and as the numerator for the proportion.
|
|
19
|
+
* It must be a valid LAPIS filter object.
|
|
20
|
+
*/
|
|
21
|
+
@property({ type: Object })
|
|
22
|
+
numeratorFilter: LapisFilter = {};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The filter to apply to the data for the denominator of the proportion.
|
|
26
|
+
* It must be a valid LAPIS filter object.
|
|
27
|
+
*/
|
|
28
|
+
@property({ type: Object })
|
|
29
|
+
denominatorFilter: LapisFilter = {};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The width of the component.
|
|
33
|
+
*
|
|
34
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
35
|
+
*/
|
|
36
|
+
@property({ type: String })
|
|
37
|
+
width: string = '100%';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The height of the component.
|
|
41
|
+
*
|
|
42
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
43
|
+
*/
|
|
44
|
+
@property({ type: String })
|
|
45
|
+
height: string = '100%';
|
|
46
|
+
|
|
47
|
+
override render() {
|
|
48
|
+
return (
|
|
49
|
+
<Statistics
|
|
50
|
+
numeratorFilter={this.numeratorFilter}
|
|
51
|
+
denominatorFilter={this.denominatorFilter}
|
|
52
|
+
width={this.width}
|
|
53
|
+
height={this.height}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare global {
|
|
60
|
+
interface HTMLElementTagNameMap {
|
|
61
|
+
'gs-statistics': StatisticsComponent;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare global {
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
67
|
+
namespace JSX {
|
|
68
|
+
interface IntrinsicElements {
|
|
69
|
+
'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
75
|
+
type WidthMatches = Expect<Equals<typeof StatisticsComponent.prototype.width, StatisticsProps['width']>>;
|
|
76
|
+
type HeightMatches = Expect<Equals<typeof StatisticsComponent.prototype.height, StatisticsProps['height']>>;
|
|
77
|
+
type DenominatorFilterMatches = Expect<
|
|
78
|
+
Equals<typeof StatisticsComponent.prototype.denominatorFilter, StatisticsProps['denominatorFilter']>
|
|
79
|
+
>;
|
|
80
|
+
type NumeratorFilterMatches = Expect<
|
|
81
|
+
Equals<typeof StatisticsComponent.prototype.numeratorFilter, StatisticsProps['numeratorFilter']>
|
|
82
|
+
>;
|
|
83
|
+
/* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
@@ -5,3 +5,4 @@ export { RelativeGrowthAdvantageComponent } from './gs-relative-growth-advantage
|
|
|
5
5
|
export { AggregateComponent } from './gs-aggregate';
|
|
6
6
|
export { NumberSequencesOverTimeComponent } from './gs-number-sequences-over-time';
|
|
7
7
|
export { MutationsOverTimeComponent } from './gs-mutations-over-time';
|
|
8
|
+
export { StatisticsComponent } from './gs-statistics';
|