@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.
Files changed (47) hide show
  1. package/custom-elements.json +328 -0
  2. package/dist/assets/mutationOverTimeWorker-BjjkMGzd.js.map +1 -0
  3. package/dist/components.d.ts +178 -9
  4. package/dist/components.js +1164 -134
  5. package/dist/components.js.map +1 -1
  6. package/dist/{dateRangeOption-DjtcAEWq.js → dateRangeOption-Doo6WHKu.js} +3 -2
  7. package/dist/dateRangeOption-Doo6WHKu.js.map +1 -0
  8. package/dist/style.css +5 -1
  9. package/dist/util.d.ts +26 -9
  10. package/dist/util.js +1 -1
  11. package/package.json +9 -3
  12. package/src/preact/aggregatedData/aggregate.stories.tsx +1 -1
  13. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +1 -1
  14. package/src/preact/lineageFilter/lineage-filter.stories.tsx +1 -1
  15. package/src/preact/locationFilter/location-filter.stories.tsx +1 -1
  16. package/src/preact/map/__mockData__/aggregatedGermany.json +83 -0
  17. package/src/preact/map/__mockData__/aggregatedWorld.json +259 -0
  18. package/src/preact/map/__mockData__/germanyMap.json +9083 -0
  19. package/src/preact/map/__mockData__/howToGenerateWorldMap.md +9 -0
  20. package/src/preact/map/__mockData__/worldAtlas.json +497127 -0
  21. package/src/preact/map/leafletStyleModifications.css +3 -0
  22. package/src/preact/map/sequences-by-location-map.tsx +202 -0
  23. package/src/preact/map/sequences-by-location-table.tsx +18 -0
  24. package/src/preact/map/sequences-by-location.stories.tsx +144 -0
  25. package/src/preact/map/sequences-by-location.tsx +151 -0
  26. package/src/preact/map/useGeoJsonMap.tsx +62 -0
  27. package/src/preact/mutationComparison/mutation-comparison.tsx +1 -1
  28. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +1 -1
  29. package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +1 -1
  30. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +1 -1
  31. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +1 -1
  32. package/src/preact/shared/stories/expectErrorMessage.ts +21 -0
  33. package/src/preact/textInput/text-input.stories.tsx +1 -1
  34. package/src/preact/useQuery.ts +9 -1
  35. package/src/styles/tailwind.css +1 -1
  36. package/src/types.ts +1 -0
  37. package/src/web-components/visualization/gs-sequences-by-location.stories.ts +234 -0
  38. package/src/web-components/visualization/gs-sequences-by-location.tsx +253 -0
  39. package/src/web-components/visualization/index.ts +1 -0
  40. package/standalone-bundle/assets/mutationOverTimeWorker-DoUBht2e.js.map +1 -0
  41. package/standalone-bundle/dashboard-components.js +16187 -9391
  42. package/standalone-bundle/dashboard-components.js.map +1 -1
  43. package/standalone-bundle/style.css +1 -1
  44. package/dist/assets/mutationOverTimeWorker-CNg_ztNp.js.map +0 -1
  45. package/dist/dateRangeOption-DjtcAEWq.js.map +0 -1
  46. package/src/preact/shared/stories/expectInvalidAttributesErrorMessage.ts +0 -13
  47. package/standalone-bundle/assets/mutationOverTimeWorker-cIyshfj_.js.map +0 -1
@@ -3200,6 +3200,326 @@
3200
3200
  }
3201
3201
  ]
3202
3202
  },
3203
+ {
3204
+ "kind": "javascript-module",
3205
+ "path": "src/web-components/visualization/gs-sequences-by-location.stories.ts",
3206
+ "declarations": [
3207
+ {
3208
+ "kind": "variable",
3209
+ "name": "meta",
3210
+ "type": {
3211
+ "text": "Meta<Required<SequencesByLocationProps>>"
3212
+ },
3213
+ "default": "{ title: 'Visualization/Sequences by location', component: 'gs-sequences-by-location', argTypes: {}, parameters: withComponentDocs({ fetchMock: { mocks: [ { matcher: { name: 'aggregatedData', url: AGGREGATED_ENDPOINT, body: { fields: ['division', 'host'], country: 'USA', }, }, response: { status: 200, body: aggregatedData, }, }, ], }, componentDocs: { opensShadowDom: true, expectsChildren: false, codeExample, }, }), tags: ['autodocs'], }"
3214
+ },
3215
+ {
3216
+ "kind": "variable",
3217
+ "name": "WorldMap",
3218
+ "type": {
3219
+ "text": "StoryObj<SequencesByLocationProps>"
3220
+ },
3221
+ "default": "{ ...Template, args: { ...Template.args, lapisFilter: { dateFrom: '2022-01-01', dateTo: '2022-04-01' }, lapisLocationField: 'country', mapSource: { type: 'topojson', url: mockMapUrl, topologyObjectsKey: 'countries', }, zoom: 2, offsetX: 0, offsetY: 10, }, parameters: { fetchMock: { mocks: [ { matcher: { name: 'worldMap', url: mockMapUrl, }, response: { status: 200, body: worldAtlas, }, }, { matcher: { name: 'aggregatedData', url: AGGREGATED_ENDPOINT, body: { fields: ['country'], dateFrom: '2022-01-01', dateTo: '2022-04-01', }, }, response: { status: 200, body: aggregatedWorld, }, }, ], }, }, }"
3222
+ },
3223
+ {
3224
+ "kind": "variable",
3225
+ "name": "Germany",
3226
+ "type": {
3227
+ "text": "StoryObj<SequencesByLocationProps>"
3228
+ },
3229
+ "default": "{ ...Template, args: { ...Template.args, lapisFilter: { dateFrom: '2022-01-01', dateTo: '2022-04-01', country: 'Germany' }, lapisLocationField: 'division', mapSource: { type: 'topojson', url: mockMapUrl, topologyObjectsKey: 'deu', }, views: ['map', 'table'], zoom: 6.3, offsetX: 10, offsetY: 51.4, }, parameters: { fetchMock: { mocks: [ { matcher: { name: 'worldMap', url: mockMapUrl, }, response: { status: 200, body: mapOfGermany, }, }, { matcher: { name: 'aggregatedData', url: AGGREGATED_ENDPOINT, body: { fields: ['division'], dateFrom: '2022-01-01', dateTo: '2022-04-01', country: 'Germany', }, }, response: { status: 200, body: aggregatedGermany, }, }, ], }, }, }"
3230
+ },
3231
+ {
3232
+ "kind": "variable",
3233
+ "name": "GermanyTableOnly",
3234
+ "type": {
3235
+ "text": "StoryObj<SequencesByLocationProps>"
3236
+ },
3237
+ "default": "{ render: (args) => html` <gs-app lapis=\"${LAPIS_URL}\"> <gs-sequences-by-location .lapisFilter=${args.lapisFilter} .lapisLocationField=${args.lapisLocationField} .width=${args.width} .height=${args.height} .views=${args.views} .pageSize=${args.pageSize} ></gs-sequences-by-location> </gs-app> `, args: { lapisFilter: { dateFrom: '2022-01-01', dateTo: '2022-04-01', country: 'Germany' }, lapisLocationField: 'division', width: '100%', height: '700px', views: ['table'], pageSize: 10, }, parameters: { fetchMock: { mocks: [ { matcher: { name: 'aggregatedData', url: AGGREGATED_ENDPOINT, body: { fields: ['division'], dateFrom: '2022-01-01', dateTo: '2022-04-01', country: 'Germany', }, }, response: { status: 200, body: aggregatedGermany, }, }, ], }, }, }"
3238
+ }
3239
+ ],
3240
+ "exports": [
3241
+ {
3242
+ "kind": "js",
3243
+ "name": "default",
3244
+ "declaration": {
3245
+ "name": "meta",
3246
+ "module": "src/web-components/visualization/gs-sequences-by-location.stories.ts"
3247
+ }
3248
+ },
3249
+ {
3250
+ "kind": "js",
3251
+ "name": "WorldMap",
3252
+ "declaration": {
3253
+ "name": "WorldMap",
3254
+ "module": "src/web-components/visualization/gs-sequences-by-location.stories.ts"
3255
+ }
3256
+ },
3257
+ {
3258
+ "kind": "js",
3259
+ "name": "Germany",
3260
+ "declaration": {
3261
+ "name": "Germany",
3262
+ "module": "src/web-components/visualization/gs-sequences-by-location.stories.ts"
3263
+ }
3264
+ },
3265
+ {
3266
+ "kind": "js",
3267
+ "name": "GermanyTableOnly",
3268
+ "declaration": {
3269
+ "name": "GermanyTableOnly",
3270
+ "module": "src/web-components/visualization/gs-sequences-by-location.stories.ts"
3271
+ }
3272
+ }
3273
+ ]
3274
+ },
3275
+ {
3276
+ "kind": "javascript-module",
3277
+ "path": "src/web-components/visualization/gs-sequences-by-location.tsx",
3278
+ "declarations": [
3279
+ {
3280
+ "kind": "class",
3281
+ "description": "## Context\n\nThis component shows the geographic distribution of sequence data from LAPIS.\nIt displays the count and proportion (number of sample per `lapisLocationField` / number of samples matching the `lapisFilter`)\nof the data by location.\n\n## Views\n\n### Map View\n\nThis view displays a chloropleth map based on [Leaflet](https://leafletjs.com/).\nThe component expects a `mapSource` object that specifies where the map data can be downloaded from.\nWe can imagine that we add other map source types later (for example, GeoJSON).\n\n#### TopoJSON\n\nSuppose you provide this example object as `mapSource`:\n\n```json\n{\n \"type\": \"topojson\",\n \"url\": \"https://example.com/map.topojson\",\n \"topologyObjectsKey\": \"myObjectKey\"\n}\n```\n\nThe URL must point to a [TopoJSON file](https://github.com/topojson/topojson) that contains the map data.\nThe TopoJSON file must schematically look like this,\nwhere `objects[topologyObjectsKey]` must be a valid GeometryCollection (`objects.myObjectKey` in this example):\n\n```json\n{\n \"type\": \"Topology\",\n \"objects\": {\n \"myObjectKey\": {\n \"type\": \"GeometryCollection\",\n \"geometries\": [\n {\n \"type\": \"Polygon\",\n \"properties\": {\n \"name\": \"North Rhine Westphalia\"\n },\n \"id\": \"DE.NW\",\n \"arcs\": [...]\n },\n ...\n ]\n }\n },\n \"arcs\": [...],\n \"transform\": {...}\n}\n```\n\nYou can use any valid TopoJSON file.\nhttps://github.com/markmarkoh/datamaps/tree/master/src/js/data contains TopoJSON files for many countries.\n\nThe `lapisFilter` is used to select the data to display, and it is aggregated by the `lapisLocationField`.\nThis component assumes that every geometry object in the TopoJSON file has a `properties.name` field.\n\nThe values that LAPIS returns for `lapisLocationField` must match the `properties.name` in the map data.\nLAPIS entries where `lapisLocationField` is `null` are ignored on the map.\n\nThe names of the locations in the TopoJSON map and in LAPIS should match.\nHowever, there are two cases of misalignment:\n- If there is a LAPIS location that does not match any location in the TopoJSON map,\n the component will log a console warning to assist in creating map data that aligns with the LAPIS data.\n- If a TopoJSON location does not match any LAPIS location for the given filter,\n no data will be displayed for this location.\n This is expected, as LAPIS will only return locations where sequences have been collected for that filter.\n\n### Table View\n\nThis view displays the data in a table format.\nIt is similar to the table view of the `gs-aggregate` component.\nThe table has three columns:\n- `lapisLocationField`,\n- `count` (the number of samples in this location matching the `lapisFilter`),\n- `proportion` (`count` / sum of the `count` of all locations).",
3282
+ "name": "SequencesByLocationComponent",
3283
+ "members": [
3284
+ {
3285
+ "kind": "field",
3286
+ "name": "lapisFilter",
3287
+ "type": {
3288
+ "text": "Record<string, string | number | null | boolean>"
3289
+ },
3290
+ "default": "{}",
3291
+ "description": "LAPIS filter to select the displayed data.\nIf you want to display the distribution over the states of a certain country,\nyou should usually filter by that country here (e.g. { country: 'USA' }).",
3292
+ "attribute": "lapisFilter"
3293
+ },
3294
+ {
3295
+ "kind": "field",
3296
+ "name": "lapisLocationField",
3297
+ "type": {
3298
+ "text": "string"
3299
+ },
3300
+ "default": "''",
3301
+ "description": "Required.\n\nThe location field to aggregate the data by.\nThis should match the selected map location granularity.",
3302
+ "attribute": "lapisLocationField"
3303
+ },
3304
+ {
3305
+ "kind": "field",
3306
+ "name": "mapSource",
3307
+ "type": {
3308
+ "text": "{ type: 'topojson'; url: string; topologyObjectsKey: string } | undefined"
3309
+ },
3310
+ "default": "undefined",
3311
+ "description": "Required when using the map view.\n\nThe source of the map data. See component level docs for more information.",
3312
+ "attribute": "mapSource"
3313
+ },
3314
+ {
3315
+ "kind": "field",
3316
+ "name": "enableMapNavigation",
3317
+ "type": {
3318
+ "text": "boolean"
3319
+ },
3320
+ "default": "true",
3321
+ "description": "Enable map navigation (dragging, keyboard navigation, zooming).",
3322
+ "attribute": "enableMapNavigation"
3323
+ },
3324
+ {
3325
+ "kind": "field",
3326
+ "name": "width",
3327
+ "type": {
3328
+ "text": "string"
3329
+ },
3330
+ "default": "'100%'",
3331
+ "description": "The width of the component.\nNot that the map in the map view is not responsive\n(i.e. does not adjust its size when the component is resized).\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.",
3332
+ "attribute": "width"
3333
+ },
3334
+ {
3335
+ "kind": "field",
3336
+ "name": "height",
3337
+ "type": {
3338
+ "text": "string"
3339
+ },
3340
+ "default": "'700px'",
3341
+ "description": "The height of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.",
3342
+ "attribute": "height"
3343
+ },
3344
+ {
3345
+ "kind": "field",
3346
+ "name": "views",
3347
+ "type": {
3348
+ "text": "('map' | 'table')[]"
3349
+ },
3350
+ "default": "['map', 'table']",
3351
+ "description": "A list of tabs with views that this component should provide.",
3352
+ "attribute": "views"
3353
+ },
3354
+ {
3355
+ "kind": "field",
3356
+ "name": "zoom",
3357
+ "type": {
3358
+ "text": "number"
3359
+ },
3360
+ "default": "1",
3361
+ "description": "The initial zoom level of the map.",
3362
+ "attribute": "zoom"
3363
+ },
3364
+ {
3365
+ "kind": "field",
3366
+ "name": "offsetX",
3367
+ "type": {
3368
+ "text": "number"
3369
+ },
3370
+ "default": "0",
3371
+ "description": "Initially shift the center of the map in x direction (longitude).\n\n`-180` is the International Date Line with the map shifted to the right, `0` is the prime meridian,\n`180` is the International Date Line with the map shifted to the left.",
3372
+ "attribute": "offsetX"
3373
+ },
3374
+ {
3375
+ "kind": "field",
3376
+ "name": "offsetY",
3377
+ "type": {
3378
+ "text": "number"
3379
+ },
3380
+ "default": "0",
3381
+ "description": "Initially shift the center of the map in y direction (latitude).\n\n`-90` is the South Pole, `0` is the equator, `90` is the North Pole.",
3382
+ "attribute": "offsetY"
3383
+ },
3384
+ {
3385
+ "kind": "field",
3386
+ "name": "pageSize",
3387
+ "type": {
3388
+ "text": "boolean | number"
3389
+ },
3390
+ "default": "false",
3391
+ "description": "The maximum number of rows to display in the table view.\nSet to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).",
3392
+ "attribute": "pageSize"
3393
+ }
3394
+ ],
3395
+ "attributes": [
3396
+ {
3397
+ "name": "lapisFilter",
3398
+ "type": {
3399
+ "text": "Record<string, string | number | null | boolean>"
3400
+ },
3401
+ "default": "{}",
3402
+ "description": "LAPIS filter to select the displayed data.\nIf you want to display the distribution over the states of a certain country,\nyou should usually filter by that country here (e.g. { country: 'USA' }).",
3403
+ "fieldName": "lapisFilter"
3404
+ },
3405
+ {
3406
+ "name": "lapisLocationField",
3407
+ "type": {
3408
+ "text": "string"
3409
+ },
3410
+ "default": "''",
3411
+ "description": "Required.\n\nThe location field to aggregate the data by.\nThis should match the selected map location granularity.",
3412
+ "fieldName": "lapisLocationField"
3413
+ },
3414
+ {
3415
+ "name": "mapSource",
3416
+ "type": {
3417
+ "text": "{ type: 'topojson'; url: string; topologyObjectsKey: string } | undefined"
3418
+ },
3419
+ "default": "undefined",
3420
+ "description": "Required when using the map view.\n\nThe source of the map data. See component level docs for more information.",
3421
+ "fieldName": "mapSource"
3422
+ },
3423
+ {
3424
+ "name": "enableMapNavigation",
3425
+ "type": {
3426
+ "text": "boolean"
3427
+ },
3428
+ "default": "true",
3429
+ "description": "Enable map navigation (dragging, keyboard navigation, zooming).",
3430
+ "fieldName": "enableMapNavigation"
3431
+ },
3432
+ {
3433
+ "name": "width",
3434
+ "type": {
3435
+ "text": "string"
3436
+ },
3437
+ "default": "'100%'",
3438
+ "description": "The width of the component.\nNot that the map in the map view is not responsive\n(i.e. does not adjust its size when the component is resized).\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.",
3439
+ "fieldName": "width"
3440
+ },
3441
+ {
3442
+ "name": "height",
3443
+ "type": {
3444
+ "text": "string"
3445
+ },
3446
+ "default": "'700px'",
3447
+ "description": "The height of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.",
3448
+ "fieldName": "height"
3449
+ },
3450
+ {
3451
+ "name": "views",
3452
+ "type": {
3453
+ "text": "('map' | 'table')[]"
3454
+ },
3455
+ "default": "['map', 'table']",
3456
+ "description": "A list of tabs with views that this component should provide.",
3457
+ "fieldName": "views"
3458
+ },
3459
+ {
3460
+ "name": "zoom",
3461
+ "type": {
3462
+ "text": "number"
3463
+ },
3464
+ "default": "1",
3465
+ "description": "The initial zoom level of the map.",
3466
+ "fieldName": "zoom"
3467
+ },
3468
+ {
3469
+ "name": "offsetX",
3470
+ "type": {
3471
+ "text": "number"
3472
+ },
3473
+ "default": "0",
3474
+ "description": "Initially shift the center of the map in x direction (longitude).\n\n`-180` is the International Date Line with the map shifted to the right, `0` is the prime meridian,\n`180` is the International Date Line with the map shifted to the left.",
3475
+ "fieldName": "offsetX"
3476
+ },
3477
+ {
3478
+ "name": "offsetY",
3479
+ "type": {
3480
+ "text": "number"
3481
+ },
3482
+ "default": "0",
3483
+ "description": "Initially shift the center of the map in y direction (latitude).\n\n`-90` is the South Pole, `0` is the equator, `90` is the North Pole.",
3484
+ "fieldName": "offsetY"
3485
+ },
3486
+ {
3487
+ "name": "pageSize",
3488
+ "type": {
3489
+ "text": "boolean | number"
3490
+ },
3491
+ "default": "false",
3492
+ "description": "The maximum number of rows to display in the table view.\nSet to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).",
3493
+ "fieldName": "pageSize"
3494
+ }
3495
+ ],
3496
+ "superclass": {
3497
+ "name": "PreactLitAdapterWithGridJsStyles",
3498
+ "module": "/src/web-components/PreactLitAdapterWithGridJsStyles"
3499
+ },
3500
+ "tagName": "gs-sequences-by-location",
3501
+ "customElement": true
3502
+ }
3503
+ ],
3504
+ "exports": [
3505
+ {
3506
+ "kind": "js",
3507
+ "name": "SequencesByLocationComponent",
3508
+ "declaration": {
3509
+ "name": "SequencesByLocationComponent",
3510
+ "module": "src/web-components/visualization/gs-sequences-by-location.tsx"
3511
+ }
3512
+ },
3513
+ {
3514
+ "kind": "custom-element-definition",
3515
+ "name": "gs-sequences-by-location",
3516
+ "declaration": {
3517
+ "name": "SequencesByLocationComponent",
3518
+ "module": "src/web-components/visualization/gs-sequences-by-location.tsx"
3519
+ }
3520
+ }
3521
+ ]
3522
+ },
3203
3523
  {
3204
3524
  "kind": "javascript-module",
3205
3525
  "path": "src/web-components/visualization/gs-statistics.stories.ts",
@@ -3416,6 +3736,14 @@
3416
3736
  "module": "./gs-mutations-over-time"
3417
3737
  }
3418
3738
  },
3739
+ {
3740
+ "kind": "js",
3741
+ "name": "SequencesByLocationComponent",
3742
+ "declaration": {
3743
+ "name": "SequencesByLocationComponent",
3744
+ "module": "./gs-sequences-by-location"
3745
+ }
3746
+ },
3419
3747
  {
3420
3748
  "kind": "js",
3421
3749
  "name": "StatisticsComponent",