@genspectrum/dashboard-components 0.10.3 → 0.10.4
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 +328 -0
- package/dist/assets/mutationOverTimeWorker-BjjkMGzd.js.map +1 -0
- package/dist/components.d.ts +178 -9
- package/dist/components.js +1164 -134
- package/dist/components.js.map +1 -1
- package/dist/{dateRangeOption-DjtcAEWq.js → dateRangeOption-Doo6WHKu.js} +3 -2
- package/dist/dateRangeOption-Doo6WHKu.js.map +1 -0
- package/dist/style.css +5 -1
- package/dist/util.d.ts +26 -9
- package/dist/util.js +1 -1
- package/package.json +9 -3
- package/src/preact/aggregatedData/aggregate.stories.tsx +1 -1
- package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +1 -1
- package/src/preact/lineageFilter/lineage-filter.stories.tsx +1 -1
- package/src/preact/locationFilter/location-filter.stories.tsx +1 -1
- package/src/preact/map/__mockData__/aggregatedGermany.json +83 -0
- package/src/preact/map/__mockData__/aggregatedWorld.json +259 -0
- package/src/preact/map/__mockData__/germanyMap.json +9083 -0
- package/src/preact/map/__mockData__/howToGenerateWorldMap.md +9 -0
- package/src/preact/map/__mockData__/worldAtlas.json +497127 -0
- package/src/preact/map/leafletStyleModifications.css +3 -0
- package/src/preact/map/sequences-by-location-map.tsx +202 -0
- package/src/preact/map/sequences-by-location-table.tsx +18 -0
- package/src/preact/map/sequences-by-location.stories.tsx +144 -0
- package/src/preact/map/sequences-by-location.tsx +151 -0
- package/src/preact/map/useGeoJsonMap.tsx +62 -0
- package/src/preact/mutationComparison/mutation-comparison.tsx +1 -1
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +1 -1
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +1 -1
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +1 -1
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +1 -1
- package/src/preact/shared/stories/expectErrorMessage.ts +21 -0
- package/src/preact/textInput/text-input.stories.tsx +1 -1
- package/src/preact/useQuery.ts +9 -1
- package/src/styles/tailwind.css +1 -1
- package/src/types.ts +1 -0
- package/src/web-components/visualization/gs-sequences-by-location.stories.ts +234 -0
- package/src/web-components/visualization/gs-sequences-by-location.tsx +253 -0
- package/src/web-components/visualization/index.ts +1 -0
- package/standalone-bundle/assets/mutationOverTimeWorker-DoUBht2e.js.map +1 -0
- package/standalone-bundle/dashboard-components.js +16187 -9391
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/standalone-bundle/style.css +1 -1
- package/dist/assets/mutationOverTimeWorker-CNg_ztNp.js.map +0 -1
- package/dist/dateRangeOption-DjtcAEWq.js.map +0 -1
- package/src/preact/shared/stories/expectInvalidAttributesErrorMessage.ts +0 -13
- package/standalone-bundle/assets/mutationOverTimeWorker-cIyshfj_.js.map +0 -1
package/dist/components.d.ts
CHANGED
|
@@ -908,6 +908,159 @@ export declare class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
|
|
|
908
908
|
render(): JSX_2.Element;
|
|
909
909
|
}
|
|
910
910
|
|
|
911
|
+
/**
|
|
912
|
+
* ## Context
|
|
913
|
+
*
|
|
914
|
+
* This component shows the geographic distribution of sequence data from LAPIS.
|
|
915
|
+
* It displays the count and proportion (number of sample per `lapisLocationField` / number of samples matching the `lapisFilter`)
|
|
916
|
+
* of the data by location.
|
|
917
|
+
*
|
|
918
|
+
* ## Views
|
|
919
|
+
*
|
|
920
|
+
* ### Map View
|
|
921
|
+
*
|
|
922
|
+
* This view displays a chloropleth map based on [Leaflet](https://leafletjs.com/).
|
|
923
|
+
* The component expects a `mapSource` object that specifies where the map data can be downloaded from.
|
|
924
|
+
* We can imagine that we add other map source types later (for example, GeoJSON).
|
|
925
|
+
*
|
|
926
|
+
* #### TopoJSON
|
|
927
|
+
*
|
|
928
|
+
* Suppose you provide this example object as `mapSource`:
|
|
929
|
+
*
|
|
930
|
+
* ```json
|
|
931
|
+
* {
|
|
932
|
+
* "type": "topojson",
|
|
933
|
+
* "url": "https://example.com/map.topojson",
|
|
934
|
+
* "topologyObjectsKey": "myObjectKey"
|
|
935
|
+
* }
|
|
936
|
+
* ```
|
|
937
|
+
*
|
|
938
|
+
* The URL must point to a [TopoJSON file](https://github.com/topojson/topojson) that contains the map data.
|
|
939
|
+
* The TopoJSON file must schematically look like this,
|
|
940
|
+
* where `objects[topologyObjectsKey]` must be a valid GeometryCollection (`objects.myObjectKey` in this example):
|
|
941
|
+
*
|
|
942
|
+
* ```json
|
|
943
|
+
* {
|
|
944
|
+
* "type": "Topology",
|
|
945
|
+
* "objects": {
|
|
946
|
+
* "myObjectKey": {
|
|
947
|
+
* "type": "GeometryCollection",
|
|
948
|
+
* "geometries": [
|
|
949
|
+
* {
|
|
950
|
+
* "type": "Polygon",
|
|
951
|
+
* "properties": {
|
|
952
|
+
* "name": "North Rhine Westphalia"
|
|
953
|
+
* },
|
|
954
|
+
* "id": "DE.NW",
|
|
955
|
+
* "arcs": [...]
|
|
956
|
+
* },
|
|
957
|
+
* ...
|
|
958
|
+
* ]
|
|
959
|
+
* }
|
|
960
|
+
* },
|
|
961
|
+
* "arcs": [...],
|
|
962
|
+
* "transform": {...}
|
|
963
|
+
* }
|
|
964
|
+
* ```
|
|
965
|
+
*
|
|
966
|
+
* You can use any valid TopoJSON file.
|
|
967
|
+
* https://github.com/markmarkoh/datamaps/tree/master/src/js/data contains TopoJSON files for many countries.
|
|
968
|
+
*
|
|
969
|
+
* The `lapisFilter` is used to select the data to display, and it is aggregated by the `lapisLocationField`.
|
|
970
|
+
* This component assumes that every geometry object in the TopoJSON file has a `properties.name` field.
|
|
971
|
+
*
|
|
972
|
+
* The values that LAPIS returns for `lapisLocationField` must match the `properties.name` in the map data.
|
|
973
|
+
* LAPIS entries where `lapisLocationField` is `null` are ignored on the map.
|
|
974
|
+
*
|
|
975
|
+
* The names of the locations in the TopoJSON map and in LAPIS should match.
|
|
976
|
+
* However, there are two cases of misalignment:
|
|
977
|
+
* - If there is a LAPIS location that does not match any location in the TopoJSON map,
|
|
978
|
+
* the component will log a console warning to assist in creating map data that aligns with the LAPIS data.
|
|
979
|
+
* - If a TopoJSON location does not match any LAPIS location for the given filter,
|
|
980
|
+
* no data will be displayed for this location.
|
|
981
|
+
* This is expected, as LAPIS will only return locations where sequences have been collected for that filter.
|
|
982
|
+
*
|
|
983
|
+
* ### Table View
|
|
984
|
+
*
|
|
985
|
+
* This view displays the data in a table format.
|
|
986
|
+
* It is similar to the table view of the `gs-aggregate` component.
|
|
987
|
+
* The table has three columns:
|
|
988
|
+
* - `lapisLocationField`,
|
|
989
|
+
* - `count` (the number of samples in this location matching the `lapisFilter`),
|
|
990
|
+
* - `proportion` (`count` / sum of the `count` of all locations).
|
|
991
|
+
*/
|
|
992
|
+
export declare class SequencesByLocationComponent extends PreactLitAdapterWithGridJsStyles {
|
|
993
|
+
static styles: CSSResult[];
|
|
994
|
+
/**
|
|
995
|
+
* LAPIS filter to select the displayed data.
|
|
996
|
+
* If you want to display the distribution over the states of a certain country,
|
|
997
|
+
* you should usually filter by that country here (e.g. { country: 'USA' }).
|
|
998
|
+
*/
|
|
999
|
+
lapisFilter: Record<string, string | number | null | boolean>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Required.
|
|
1002
|
+
*
|
|
1003
|
+
* The location field to aggregate the data by.
|
|
1004
|
+
* This should match the selected map location granularity.
|
|
1005
|
+
*/
|
|
1006
|
+
lapisLocationField: string;
|
|
1007
|
+
/**
|
|
1008
|
+
* Required when using the map view.
|
|
1009
|
+
*
|
|
1010
|
+
* The source of the map data. See component level docs for more information.
|
|
1011
|
+
*/
|
|
1012
|
+
mapSource: {
|
|
1013
|
+
type: 'topojson';
|
|
1014
|
+
url: string;
|
|
1015
|
+
topologyObjectsKey: string;
|
|
1016
|
+
} | undefined;
|
|
1017
|
+
/**
|
|
1018
|
+
* Enable map navigation (dragging, keyboard navigation, zooming).
|
|
1019
|
+
*/
|
|
1020
|
+
enableMapNavigation: boolean;
|
|
1021
|
+
/**
|
|
1022
|
+
* The width of the component.
|
|
1023
|
+
* Not that the map in the map view is not responsive
|
|
1024
|
+
* (i.e. does not adjust its size when the component is resized).
|
|
1025
|
+
*
|
|
1026
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
1027
|
+
*/
|
|
1028
|
+
width: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* The height of the component.
|
|
1031
|
+
*
|
|
1032
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
1033
|
+
*/
|
|
1034
|
+
height: string;
|
|
1035
|
+
/**
|
|
1036
|
+
A list of tabs with views that this component should provide.
|
|
1037
|
+
*/
|
|
1038
|
+
views: ('map' | 'table')[];
|
|
1039
|
+
/**
|
|
1040
|
+
* The initial zoom level of the map.
|
|
1041
|
+
*/
|
|
1042
|
+
zoom: number;
|
|
1043
|
+
/**
|
|
1044
|
+
* Initially shift the center of the map in x direction (longitude).
|
|
1045
|
+
*
|
|
1046
|
+
* `-180` is the International Date Line with the map shifted to the right, `0` is the prime meridian,
|
|
1047
|
+
* `180` is the International Date Line with the map shifted to the left.
|
|
1048
|
+
*/
|
|
1049
|
+
offsetX: number;
|
|
1050
|
+
/**
|
|
1051
|
+
* Initially shift the center of the map in y direction (latitude).
|
|
1052
|
+
*
|
|
1053
|
+
* `-90` is the South Pole, `0` is the equator, `90` is the North Pole.
|
|
1054
|
+
*/
|
|
1055
|
+
offsetY: number;
|
|
1056
|
+
/**
|
|
1057
|
+
* The maximum number of rows to display in the table view.
|
|
1058
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
1059
|
+
*/
|
|
1060
|
+
pageSize: boolean | number;
|
|
1061
|
+
render(): JSX_2.Element;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
911
1064
|
/**
|
|
912
1065
|
* ## Context
|
|
913
1066
|
*
|
|
@@ -1080,6 +1233,22 @@ declare global {
|
|
|
1080
1233
|
}
|
|
1081
1234
|
|
|
1082
1235
|
|
|
1236
|
+
declare global {
|
|
1237
|
+
interface HTMLElementTagNameMap {
|
|
1238
|
+
'gs-aggregate': AggregateComponent;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
declare global {
|
|
1244
|
+
namespace JSX {
|
|
1245
|
+
interface IntrinsicElements {
|
|
1246
|
+
'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
|
|
1083
1252
|
declare global {
|
|
1084
1253
|
interface HTMLElementTagNameMap {
|
|
1085
1254
|
'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
|
|
@@ -1098,7 +1267,7 @@ declare global {
|
|
|
1098
1267
|
|
|
1099
1268
|
declare global {
|
|
1100
1269
|
interface HTMLElementTagNameMap {
|
|
1101
|
-
'gs-
|
|
1270
|
+
'gs-sequences-by-location': SequencesByLocationComponent;
|
|
1102
1271
|
}
|
|
1103
1272
|
}
|
|
1104
1273
|
|
|
@@ -1106,7 +1275,7 @@ declare global {
|
|
|
1106
1275
|
declare global {
|
|
1107
1276
|
namespace JSX {
|
|
1108
1277
|
interface IntrinsicElements {
|
|
1109
|
-
'gs-
|
|
1278
|
+
'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1110
1279
|
}
|
|
1111
1280
|
}
|
|
1112
1281
|
}
|
|
@@ -1146,11 +1315,10 @@ declare global {
|
|
|
1146
1315
|
|
|
1147
1316
|
declare global {
|
|
1148
1317
|
interface HTMLElementTagNameMap {
|
|
1149
|
-
'gs-
|
|
1318
|
+
'gs-location-filter': LocationFilterComponent;
|
|
1150
1319
|
}
|
|
1151
1320
|
interface HTMLElementEventMap {
|
|
1152
|
-
'gs-
|
|
1153
|
-
'gs-date-range-option-changed': DateRangeOptionChangedEvent;
|
|
1321
|
+
'gs-location-changed': CustomEvent<Record<string, string>>;
|
|
1154
1322
|
}
|
|
1155
1323
|
}
|
|
1156
1324
|
|
|
@@ -1158,7 +1326,7 @@ declare global {
|
|
|
1158
1326
|
declare global {
|
|
1159
1327
|
namespace JSX {
|
|
1160
1328
|
interface IntrinsicElements {
|
|
1161
|
-
'gs-
|
|
1329
|
+
'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1162
1330
|
}
|
|
1163
1331
|
}
|
|
1164
1332
|
}
|
|
@@ -1166,10 +1334,11 @@ declare global {
|
|
|
1166
1334
|
|
|
1167
1335
|
declare global {
|
|
1168
1336
|
interface HTMLElementTagNameMap {
|
|
1169
|
-
'gs-
|
|
1337
|
+
'gs-date-range-selector': DateRangeSelectorComponent;
|
|
1170
1338
|
}
|
|
1171
1339
|
interface HTMLElementEventMap {
|
|
1172
|
-
'gs-
|
|
1340
|
+
'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
|
|
1341
|
+
'gs-date-range-option-changed': DateRangeOptionChangedEvent;
|
|
1173
1342
|
}
|
|
1174
1343
|
}
|
|
1175
1344
|
|
|
@@ -1177,7 +1346,7 @@ declare global {
|
|
|
1177
1346
|
declare global {
|
|
1178
1347
|
namespace JSX {
|
|
1179
1348
|
interface IntrinsicElements {
|
|
1180
|
-
'gs-
|
|
1349
|
+
'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1181
1350
|
}
|
|
1182
1351
|
}
|
|
1183
1352
|
}
|